/* DrTarun Part 31. Loaded AFTER existing site/portal/admin styles. */
:root,[data-drt-theme="default"]{--drt-bg:#f7f3ed;--drt-surface:#fff;--drt-surface2:#f1ebe1;--drt-ink:#182c3a;--drt-muted:#627384;--drt-border:#d9dddf;--drt-accent:#b9945b;--drt-link:#235a75;--drt-header:#14283a;--drt-header-text:#fff;--drt-shadow:0 12px 32px rgba(20,31,45,.06);color-scheme:light}
[data-drt-theme="light"]{--drt-bg:#fff;--drt-surface:#f7f9fc;--drt-surface2:#eef3f8;--drt-ink:#182c3a;--drt-muted:#566777;--drt-border:#d4dfe9;--drt-accent:#8b6637;--drt-link:#205b86;--drt-header:#f0f4fa;--drt-header-text:#172d40;--drt-shadow:0 12px 28px rgba(20,31,45,.035);color-scheme:light}
[data-drt-theme="dark"]{--drt-bg:#101820;--drt-surface:#1c2935;--drt-surface2:#263849;--drt-ink:#edf2f7;--drt-muted:#b4c2d0;--drt-border:#475a69;--drt-accent:#e3bc7e;--drt-link:#9dd1f0;--drt-header:#121e2a;--drt-header-text:#f4f7fb;--drt-shadow:0 14px 38px rgba(0,0,0,.2);color-scheme:dark}
/* Map to tokens used throughout earlier modules; do not change original templates. */
html[data-drt-theme]{--ink:var(--drt-ink);--muted:var(--drt-muted);--paper:var(--drt-bg);--cream:var(--drt-bg);--white:var(--drt-surface);--line:var(--drt-border);--gold:var(--drt-accent);--navy:var(--drt-header);--navy2:var(--drt-surface2);--shadow:var(--drt-shadow)}
html[data-drt-theme] body{background:var(--drt-bg);color:var(--drt-ink)}
/* Preserve contextual link contrast in the original hero, menus and footer. */
html[data-drt-theme] a:focus-visible,html[data-drt-theme] button:focus-visible,html[data-drt-theme] select:focus-visible,html[data-drt-theme] input:focus-visible{outline:3px solid var(--drt-accent);outline-offset:3px}
/* Brand bars and CMS navigation need contrasting text, even in light mode. */
html[data-drt-theme] .header,html[data-drt-theme] .sitehead,html[data-drt-theme] .p6-head,html[data-drt-theme] .sidebar,html[data-drt-theme] .sitefoot,html[data-drt-theme] footer:not(.pagefooter):not(.p6-footer){background:var(--drt-header);color:var(--drt-header-text)}
html[data-drt-theme] .header a,html[data-drt-theme] .sitehead a,html[data-drt-theme] .p6-head a,html[data-drt-theme] .sidebar a,html[data-drt-theme] .sidebar nav a,html[data-drt-theme] .sitefoot a{color:var(--drt-header-text)}
html[data-drt-theme] .header .brand span,html[data-drt-theme] .wordmark span{color:var(--drt-accent)}
html[data-drt-theme] .topbar,html[data-drt-theme] .panel,html[data-drt-theme] .stat,html[data-drt-theme] .card,html[data-drt-theme] .tile,html[data-drt-theme] .cm-panel,html[data-drt-theme] .cm-metric,html[data-drt-theme] .notice,html[data-drt-theme] .authbox{background:var(--drt-surface);color:var(--drt-ink);border-color:var(--drt-border)}
html[data-drt-theme] .stat small,html[data-drt-theme] .muted,html[data-drt-theme] .intro p,html[data-drt-theme] .topbar,html[data-drt-theme] .pagefooter,html[data-drt-theme] .panel p,html[data-drt-theme] .authbox p{color:var(--drt-muted)}
html[data-drt-theme] input:not([type="checkbox"]):not([type="radio"]),html[data-drt-theme] select,html[data-drt-theme] textarea{background:var(--drt-surface);color:var(--drt-ink);border-color:var(--drt-border)}
html[data-drt-theme] th,html[data-drt-theme] .status,html[data-drt-theme] .btn.secondary{background:var(--drt-surface2);color:var(--drt-ink);border-color:var(--drt-border)}
html[data-drt-theme] td,html[data-drt-theme] th,html[data-drt-theme] table{border-color:var(--drt-border)}
html[data-drt-theme] label{color:var(--drt-ink)}
html[data-drt-theme] .btn:not(.gold),html[data-drt-theme] button:not(.drt-reset){background:var(--drt-header);color:var(--drt-header-text);border-color:var(--drt-border)}
html[data-drt-theme] .btn.gold{background:var(--drt-accent);color:#14212e}
/* Existing modules with white/hard-coded panels. Carefully scoped to dark mode. */
html[data-drt-theme="dark"] .layout .main,html[data-drt-theme="dark"] .content,html[data-drt-theme="dark"] .shell{color:var(--drt-ink)}
html[data-drt-theme="dark"] .tablewrap,html[data-drt-theme="dark"] .cm-hearing-row,html[data-drt-theme="dark"] .cm-account-strip,html[data-drt-theme="dark"] .cm-tile,html[data-drt-theme="dark"] .drt-card{background:var(--drt-surface)!important;color:var(--drt-ink)!important;border-color:var(--drt-border)!important}
html[data-drt-theme="dark"] .eyebrow{color:var(--drt-accent)}
html[data-drt-theme="dark"] .note,html[data-drt-theme="dark"] .flash{background:#273c45;color:#f4f7fa;border-color:var(--drt-accent)}
/* Theme control: keyboard/touch accessible, unobtrusive on narrow screens. */
.drt-settings-control{--ctl-bg:var(--drt-surface);--ctl-ink:var(--drt-ink);display:flex;align-items:center;gap:.7rem;flex-wrap:wrap;font:600 12px/1.4 system-ui,-apple-system,'Segoe UI',sans-serif;isolation:isolate}
.drt-settings-control label{display:inline-flex!important;align-items:center;gap:.42rem!important;margin:0!important;color:var(--drt-header-text)!important;font:600 12px/1.4 system-ui,-apple-system,'Segoe UI',sans-serif!important}
.drt-settings-control .drt-setting-select{appearance:auto;width:auto;min-width:90px;max-width:132px;min-height:36px;margin:0;padding:.36rem .5rem;border:1px solid var(--drt-border);border-radius:8px;background:var(--drt-surface);color:var(--drt-ink);font:600 12px/1.5 system-ui;cursor:pointer}
.topbar .drt-settings-control label,.drt-preview-bar .drt-settings-control label{color:var(--drt-ink)!important}
.drt-settings-floating{position:fixed;right:12px;bottom:14px;z-index:2000;padding:9px 11px;border:1px solid var(--drt-border);border-radius:12px;background:var(--drt-header);box-shadow:0 8px 30px #0003;max-width:calc(100vw - 24px)}
@media(max-width:680px){.drt-settings-control{gap:.4rem}.drt-settings-control label{gap:.25rem!important;font-size:11px!important}.drt-settings-control .drt-setting-select{max-width:106px;min-width:79px;min-height:40px}.drt-settings-floating{right:8px;bottom:8px}}
@media(prefers-reduced-motion:reduce){html[data-drt-theme] *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important}}
html[data-drt-theme] .preview-header nav a{color:var(--drt-header-text)}

.drt-account-settings{max-width:700px}

/* Final website navigation theme integration */
html[data-drt-theme] #dt-global-header{background:var(--drt-header)!important;color:var(--drt-header-text)!important}
html[data-drt-theme] #dt-global-header .dt-brand,html[data-drt-theme] #dt-global-header .dt-nav-link,html[data-drt-theme] #dt-global-header .dt-more-trigger{color:var(--drt-header-text)!important}
html[data-drt-theme] #dt-global-header .dt-more-menu{background:var(--drt-surface)!important;border-color:var(--drt-border)!important}
html[data-drt-theme] #dt-global-header .dt-more-menu a{color:var(--drt-ink)!important}
html[data-drt-theme] #dt-global-header .dt-more-menu a:hover{background:var(--drt-surface2)!important}
html[data-drt-theme] #dt-global-header .drt-setting-select{background:var(--drt-surface);color:var(--drt-ink)}
html[data-drt-theme] #dt-global-header .dt-menu-toggle{color:var(--drt-header-text)!important}
@media(max-width:740px){html[data-drt-theme] #dt-global-header .drt-settings-control{margin-top:6px;max-width:100%}}
