/* V10: single semantic theme layer. Keep page components free of hard-coded text colors. */
:root{color-scheme:dark;--bg:#0b1020;--bg-elevated:#111b30;--surface:#131f35;--surface-2:#192740;--surface-3:#22324d;--line:#2b3b56;--text:#edf3ff;--text-soft:#c5d1e5;--muted:#a5b3c9;--placeholder:#9aa9bf;--accent:#69d9c3;--accent-contrast:#101827;--danger:#ef6475;--success:#35b88c;--warning:#d99a35;--field-bg:#0c1629;--field-border:#435571;--shadow:0 18px 55px #02081766;--focus:color-mix(in srgb,var(--accent) 30%,transparent)}
*{box-sizing:border-box}
html,body{min-height:100%;max-width:100%;background:var(--bg);color:var(--text)}
body{font-family:var(--global-font,Inter,system-ui,sans-serif);color:var(--text);background-color:var(--bg);background-image:radial-gradient(ellipse at 85% 0%,color-mix(in srgb,var(--accent) 8%,transparent),transparent 38%);background-attachment:fixed}
body[data-color-mode="light"]{color-scheme:light;--bg:#eef3fa;--bg-elevated:#e6edf7;--surface:#fff;--surface-2:#f7f9fc;--surface-3:#e8eef7;--line:#d3deeb;--text:#17243a;--text-soft:#354761;--muted:#5d6e87;--placeholder:#73839a;--field-bg:#fff;--field-border:#bdcadd;--shadow:0 16px 45px #243c5a18;--focus:color-mix(in srgb,var(--accent) 25%,transparent);background-color:var(--bg)}
body[data-color-mode="dark"]{color-scheme:dark}
body[data-theme-style="naga"]{--accent:color-mix(in srgb,var(--admin-accent,#69d9c3) 75%,#ed7b35)}
body[data-theme-style="ninja"]{--accent:color-mix(in srgb,var(--admin-accent,#69d9c3) 75%,#8b9bb5)}
body[data-theme-style="molecule"]{--accent:color-mix(in srgb,var(--admin-accent,#69d9c3) 88%,#43b8e8)}
body:before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;opacity:.7}
body[data-theme-style="naga"]:before{background:radial-gradient(ellipse at 80% 10%,#b74a2d25,transparent 36%),radial-gradient(ellipse at 10% 80%,#d18b2620,transparent 35%)}
body[data-theme-style="ninja"]:before{background:radial-gradient(ellipse at 75% 5%,#77839a20,transparent 35%),radial-gradient(ellipse at 10% 90%,#202b3d30,transparent 38%)}
body[data-theme-style="molecule"]:before{background:radial-gradient(circle at 20% 20%,#57b9e322 0 2px,transparent 3px),radial-gradient(circle at 70% 65%,#70e1c122 0 2px,transparent 3px),radial-gradient(ellipse at 75% 10%,#263d6725,transparent 35%)}
body :where(h1,h2,h3,h4,h5,h6,p,span,small,strong,b,em,label,legend,summary,li,dt,dd,th,td,figcaption){color:inherit}
body :where(h1,h2,h3,h4,h5,h6){color:var(--text);font-family:var(--global-font,Inter,system-ui,sans-serif)!important}
body :where(b,strong,button,input,textarea,select){font-family:var(--global-font,Inter,system-ui,sans-serif)!important}
body :where(p,small,.muted-text,.panel-head p,.stat span,.stat small,.brand small,.user-chip small){color:var(--muted)}
body :where(a){color:var(--accent)}
body :where(code,pre){color:var(--text-soft)}
body :where(button,input,textarea,select){font-family:var(--global-font,Inter,system-ui,sans-serif)}
/* Workspace: main canvas, headers, navigation, cards, tables and notices. */
.layout{background:transparent;color:var(--text)}
.main{min-width:0;background:transparent!important;color:var(--text)!important}
.main .topbar,.main .topbar>div,.main .user-chip{color:var(--text)!important}
.main .topbar h1,.main h1,.main h2,.main h3,.main h4{color:var(--text)!important}
.main .topbar .eyebrow,.main .eyebrow{color:var(--accent)!important}
.main .user-chip small,.main .muted-text,.main .panel-head p,.main .stat span,.main .stat small{color:var(--muted)!important}
.sidebar{background:var(--surface)!important;border-color:var(--line)!important;color:var(--text)!important}
.sidebar .brand,.sidebar .brand b,.sidebar nav a,.sidebar .logout{color:var(--text-soft)!important}
.sidebar .brand small{color:var(--muted)!important}
.sidebar nav a:hover,.sidebar nav a.active{background:var(--surface-3)!important;color:var(--text)!important}
.sidebar nav a.active{box-shadow:inset 3px 0 var(--accent)!important}
.stat,.panel{background:var(--surface)!important;border:1px solid var(--line)!important;color:var(--text)!important;box-shadow:var(--shadow)}
.stat :where(strong,span,small),.panel :where(h1,h2,h3,h4,b,strong,p,span,small,label,li){color:inherit}
.panel-head p,.panel .muted-text,.stat span,.stat small{color:var(--muted)!important}
.table-wrap{max-width:100%;overflow:auto}table{color:var(--text);border-color:var(--line)}th,td{border-color:var(--line)!important}th{color:var(--muted)!important}td{color:var(--text-soft)!important}.empty{color:var(--muted)!important}
.pill{background:var(--surface-3)!important;color:var(--text-soft)!important}.avatar{background:var(--surface-3)!important;color:var(--accent)!important}
/* Forms: labels, inputs, placeholders and native controls stay readable in either mode. */
label,.main label,.auth-card label{color:var(--text-soft)!important}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),textarea,select{background:var(--field-bg)!important;color:var(--text)!important;border:1px solid var(--field-border)!important;accent-color:var(--accent)}
input::placeholder,textarea::placeholder{color:var(--placeholder)!important;opacity:1}
input:focus,textarea:focus,select:focus{border-color:var(--accent)!important;box-shadow:0 0 0 3px var(--focus)!important;outline:none}
input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-text-fill-color:var(--text)!important;box-shadow:0 0 0 1000px var(--field-bg) inset!important}
input[type="checkbox"],input[type="radio"]{accent-color:var(--accent)}
.btn.primary{background:var(--admin-button,var(--accent))!important;color:var(--admin-button-text,var(--accent-contrast))!important;border:1px solid color-mix(in srgb,var(--admin-button,var(--accent)) 75%,var(--line))!important}
.btn.secondary{background:var(--surface-3)!important;color:var(--text)!important;border:1px solid var(--line)!important}
.btn.danger{background:#a92f43!important;color:#fff!important;border:1px solid #8e2638!important}
.btn:focus-visible,a:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
.alert{background:color-mix(in srgb,var(--success) 14%,var(--surface))!important;color:var(--text)!important;border:1px solid color-mix(in srgb,var(--success) 35%,var(--line))}.alert.danger{background:color-mix(in srgb,var(--danger) 13%,var(--surface))!important;color:var(--danger)!important;border-color:color-mix(in srgb,var(--danger) 35%,var(--line))!important}
.callout{background:color-mix(in srgb,var(--warning) 12%,var(--surface))!important;color:var(--text)!important;border-color:color-mix(in srgb,var(--warning) 38%,var(--line))!important}.callout p{color:var(--text-soft)!important}
.response-box,.api-code,pre,code{background:var(--field-bg);color:var(--text-soft)!important;border-color:var(--line)!important}
/* Authentication and registration. */
body.auth-modern{display:grid;place-items:center;min-height:100svh;padding:clamp(14px,3vw,28px);background:radial-gradient(ellipse at 12% 8%,color-mix(in srgb,var(--accent) 13%,transparent),transparent 35%),radial-gradient(ellipse at 92% 90%,#7189c51c,transparent 38%),var(--bg)}
.auth-card{width:min(100%,480px);max-height:calc(100svh - 28px);overflow:auto;padding:clamp(24px,4vw,38px);background:var(--surface)!important;color:var(--text)!important;border:1px solid var(--line)!important;border-radius:24px;box-shadow:var(--shadow)}
.auth-card h1{color:var(--text)!important;line-height:1.2}.auth-card p,.auth-card small{color:var(--muted)!important}.auth-card label{color:var(--text-soft)!important;font-weight:650}.auth-card a,.auth-card small a,.auth-back{color:var(--accent)!important}.auth-card .brand-mark{color:var(--accent-contrast)!important;background:linear-gradient(135deg,var(--accent),color-mix(in srgb,var(--accent) 55%,#7d9cff))}
.otp-digit{background:var(--field-bg)!important;color:var(--text)!important;border-color:var(--field-border)!important}
/* Landing page uses the same semantic tokens as the authenticated workspace. */
body.landing{display:block!important;min-height:100svh;background:var(--bg)!important;color:var(--text)!important}
.landing-nav{border-color:var(--line)!important}.landing-brand,.landing-nav>div>a:not(.btn){color:var(--text)!important}.landing-brand small{color:var(--muted)!important}
.hero-copy>p,.section-heading p,.cta-section p,.feature-card p{color:var(--muted)!important}.hero-copy h1,.section-heading h2,.cta-section h2,.feature-card h3{color:var(--text)!important}.hero-copy h1 em,.eyebrow,.hero-trust,.hero-trust .ui-icon{color:var(--accent)!important}
.feature-card,.cta-section{background:var(--surface)!important;border-color:var(--line)!important;color:var(--text)!important}.landing-footer{border-color:var(--line)!important;color:var(--muted)!important}
/* Device mockups intentionally retain their realistic light device finish. */
.hero-phone,.phone-frame{background:linear-gradient(#fbfcff,#e8edf5)!important;color:#182033!important}.hero-phone *,.phone-frame *{color:inherit}.hero-phone .hero-bubble,.phone-frame .sms-bubble{color:#182033!important}
.page-loader{background:var(--bg)!important;color:var(--text)!important}
@media(max-width:900px){.layout{grid-template-columns:1fr}.sidebar{height:auto;position:relative}.main{padding:22px 16px}}
@media(max-width:560px){body.auth-modern{padding:12px}.auth-card{padding:24px 20px;border-radius:20px;max-height:calc(100svh - 24px)}.auth-card h1{font-size:24px}}
@media(prefers-reduced-motion:reduce){body:before{animation:none!important}}

/* User management dialogs: follow the active workspace theme (light/dark/custom). */
.modal-backdrop{
  background:color-mix(in srgb,var(--bg) 68%,#020617 32%)!important;
  backdrop-filter:blur(10px);
}
.user-edit-modal,
.user-edit-modal-wide{
  background:var(--surface)!important;
  color:var(--text)!important;
  border:1px solid var(--line)!important;
  box-shadow:var(--shadow)!important;
  color-scheme:inherit;
}
.user-edit-modal :where(h1,h2,h3,h4,b,strong){color:var(--text)!important}
.user-edit-modal :where(p,.muted-text,small){color:var(--muted)!important}
.user-edit-modal .eyebrow{color:var(--accent)!important}
.user-edit-modal label,
.user-edit-modal .user-modal-grid>label{color:var(--text-soft)!important}
.user-edit-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.user-edit-modal textarea,
.user-edit-modal select{
  background:var(--field-bg)!important;
  color:var(--text)!important;
  border:1px solid var(--field-border)!important;
}
.user-edit-modal input::placeholder,
.user-edit-modal textarea::placeholder{color:var(--placeholder)!important;opacity:1}
.user-edit-modal input:focus,
.user-edit-modal select:focus,
.user-edit-modal textarea:focus{
  border-color:var(--accent)!important;
  box-shadow:0 0 0 3px var(--focus)!important;
  outline:none!important;
}
.user-edit-modal .user-rule-toggle{
  background:var(--surface-2)!important;
  border-color:var(--line)!important;
  color:var(--text-soft)!important;
}
.user-edit-modal .user-rule-toggle p{color:var(--muted)!important}
.user-edit-modal .modal-title{color:var(--text)!important}
.user-edit-modal .modal-close{
  background:var(--surface-3)!important;
  color:var(--text)!important;
  border:1px solid var(--line)!important;
}
.user-edit-modal .modal-close:hover{
  background:var(--surface-2)!important;
  border-color:var(--accent)!important;
  color:var(--accent)!important;
}
.user-edit-modal .modal-actions{border-color:var(--line)!important}
.user-edit-modal .btn.primary{
  background:var(--admin-button,var(--accent))!important;
  color:var(--admin-button-text,var(--accent-contrast))!important;
}
.user-edit-modal .btn.secondary{
  background:var(--surface-3)!important;
  color:var(--text)!important;
  border:1px solid var(--line)!important;
}
.user-edit-modal :focus-visible{
  outline:2px solid var(--accent)!important;
  outline-offset:2px;
}
@media(prefers-reduced-motion:reduce){.user-edit-modal{animation:none!important}}

/* Theme Customizer v50: expanded global design tokens and presets. */
body[data-theme-style="aurora"]{--accent:var(--admin-accent,#69d9c3)}
body[data-theme-style="ocean"]{--accent:color-mix(in srgb,var(--admin-accent,#69d9c3) 62%,#328bff)}
body[data-theme-style="sunset"]{--accent:color-mix(in srgb,var(--admin-accent,#69d9c3) 48%,#ff795e)}
body[data-theme-style="midnight"]{--accent:color-mix(in srgb,var(--admin-accent,#69d9c3) 65%,#9c8cff)}
body[data-theme-style="minimal"]{--accent:var(--admin-accent,#64748b)}
body[data-theme-style="aurora"]:before{background:radial-gradient(ellipse at 78% 8%,#6c63ff22,transparent 36%),radial-gradient(ellipse at 12% 82%,#36d6b522,transparent 38%)}
body[data-theme-style="ocean"]:before{background:radial-gradient(ellipse at 80% 5%,#258bff24,transparent 38%),radial-gradient(ellipse at 10% 90%,#20c7c022,transparent 40%)}
body[data-theme-style="sunset"]:before{background:radial-gradient(ellipse at 82% 5%,#ff8a6528,transparent 38%),radial-gradient(ellipse at 12% 85%,#ec489922,transparent 38%)}
body[data-theme-style="midnight"]:before{background:radial-gradient(ellipse at 75% 8%,#7668ff24,transparent 40%),radial-gradient(ellipse at 15% 90%,#1e3a8a22,transparent 40%)}
body[data-theme-style="minimal"]:before{opacity:.25;background:radial-gradient(ellipse at 80% 10%,#94a3b820,transparent 42%)}
body[data-button-shape="rounded"]{--control-radius:12px}
body[data-button-shape="pill"]{--control-radius:999px}
body[data-button-shape="square"]{--control-radius:5px}
body :where(.btn,button.btn,input,textarea,select,.pill){border-radius:var(--control-radius,12px)}
body[data-icon-style="soft"] .ui-icon{stroke-width:1.55;filter:drop-shadow(0 1px 1px color-mix(in srgb,var(--accent) 18%,transparent))}
body[data-icon-style="bold"] .ui-icon{stroke-width:2.45}
body[data-icon-style="soft"] .sidebar nav .ui-icon,body[data-icon-style="soft"] .btn .ui-icon{padding:2px;border-radius:8px;background:color-mix(in srgb,var(--accent) 12%,transparent)}
body[data-density="compact"] .panel{padding:16px!important}
body[data-density="compact"] .stat{padding:14px!important}
body[data-density="compact"] .main{gap:12px}
body[data-density="spacious"] .panel{padding:28px!important}
body[data-density="spacious"] .stat{padding:24px!important}
body[data-density="spacious"] .main{gap:24px}
body[data-sidebar-style="solid"] .sidebar{background:var(--surface-2)!important;backdrop-filter:none!important}
body[data-sidebar-style="transparent"] .sidebar{background:color-mix(in srgb,var(--surface) 62%,transparent)!important;backdrop-filter:blur(18px)!important}
body[data-sidebar-style="glass"] .sidebar{backdrop-filter:blur(22px)!important}
.theme-customizer{display:grid;gap:20px;max-width:1180px;margin:0 auto}
.theme-intro,.theme-section,.theme-preview{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:clamp(18px,3vw,26px);box-shadow:var(--shadow)}
.theme-intro{display:flex;justify-content:space-between;align-items:center;gap:18px}.theme-intro h2{margin:5px 0 8px;font-size:clamp(23px,3vw,30px);color:var(--text)}.theme-intro p,.theme-section-head p,.theme-preview p{margin:0;color:var(--muted)}
.theme-live-pill{white-space:nowrap;border:1px solid var(--line);background:var(--surface-2);border-radius:999px;padding:8px 12px;color:var(--accent);font-size:12px;font-weight:750}
.theme-section{display:grid;gap:18px}.theme-section-head h3,.theme-preview h3{margin:0 0 5px;color:var(--text);font-size:17px}.theme-choice-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.theme-choice{position:relative;display:grid;gap:7px;cursor:pointer;border:1px solid var(--line);border-radius:15px;padding:10px;background:var(--surface-2);min-width:0;transition:border-color .18s,transform .18s}.theme-choice:hover{transform:translateY(-2px);border-color:var(--accent)}.theme-choice input{position:absolute;top:13px;right:13px;accent-color:var(--accent)}.theme-choice:has(input:checked){border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 18%,transparent)}.theme-choice b{color:var(--text);font-size:13px}.theme-choice small{color:var(--muted);font-size:11px}
.theme-swatch{height:62px;border-radius:10px;display:flex;align-items:end;gap:5px;padding:9px;overflow:hidden;background:linear-gradient(135deg,#17233a,#40506b)}.theme-swatch i{display:block;height:27px;flex:1;border-radius:5px;background:#ffffff30;border:1px solid #ffffff35}.theme-swatch i:nth-child(2){height:39px;background:var(--swatch,#69d9c3)}.theme-swatch-aurora{--swatch:#69d9c3;background:linear-gradient(135deg,#18243b,#6d65a9)}.theme-swatch-naga{--swatch:#e58a45;background:linear-gradient(135deg,#261c24,#9d4832)}.theme-swatch-ninja{--swatch:#9ba9bf;background:linear-gradient(135deg,#0b1220,#39465c)}.theme-swatch-molecule{--swatch:#49b9e8;background:linear-gradient(135deg,#132b42,#386c7a)}.theme-swatch-ocean{--swatch:#328bff;background:linear-gradient(135deg,#092b4b,#147eaa)}.theme-swatch-sunset{--swatch:#ff8a65;background:linear-gradient(135deg,#48243d,#d65d55)}.theme-swatch-midnight{--swatch:#9c8cff;background:linear-gradient(135deg,#10152e,#453b82)}.theme-swatch-minimal{--swatch:#94a3b8;background:linear-gradient(135deg,#334155,#64748b)}
.theme-controls-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.theme-controls-grid>label{display:grid;gap:8px;color:var(--text-soft);font-weight:650}.color-picker-wrap{display:flex;align-items:center;gap:12px}.color-picker-wrap input[type=color]{width:58px;height:42px;padding:4px;cursor:pointer}.color-picker-wrap output{font:600 12px ui-monospace,monospace;color:var(--muted)}.theme-preset-row{display:flex;gap:10px;flex-wrap:wrap}.theme-color-preset{width:28px;height:28px;border-radius:50%;border:3px solid var(--surface);background:var(--preset);box-shadow:0 0 0 1px var(--line);cursor:pointer}.theme-color-preset:hover{transform:scale(1.12)}
.theme-preview{display:flex;justify-content:space-between;align-items:center;gap:20px;background:linear-gradient(115deg,var(--surface),color-mix(in srgb,var(--accent) 8%,var(--surface)))}.theme-preview-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.theme-preview-icon{display:flex;gap:9px;color:var(--accent)}.theme-save-row{display:flex;justify-content:space-between;align-items:center;gap:16px}.theme-save-row p{margin:0}.theme-auto-note{font-size:12px}
@media(max-width:760px){.theme-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.theme-intro,.theme-preview{align-items:flex-start;flex-direction:column}.theme-save-row{align-items:stretch;flex-direction:column}.theme-save-row .btn{width:100%}}
@media(max-width:420px){.theme-controls-grid{grid-template-columns:1fr}.theme-choice-grid{gap:8px}.theme-choice{padding:8px}.theme-swatch{height:50px}}
