/*
 * OWO theme switcher + dark theme overrides for the public site, auth pages and cabinet.
 * Load last (after page styles, ui.css and page-specific CSS). Tokens live in tokens.css.
 * Rules are prefixed with [data-theme=dark] so the light theme is untouched.
 */

/* ---------- Switcher ---------- */
.theme-switch{display:inline-flex;gap:2px;padding:3px;border:1px solid var(--line);border-radius:12px;background:var(--card);flex-shrink:0}
html:not([data-theme]) .theme-switch{display:none}
.theme-switch button{display:grid;place-items:center;width:32px;height:30px;padding:0;border:0;border-radius:9px;background:transparent;color:var(--muted);cursor:pointer}
.theme-switch button:hover{color:var(--ink);background:var(--surface-2)}
.theme-switch button[aria-pressed=true]{background:var(--accent);color:#fff}
.theme-switch button:focus-visible{outline:3px solid var(--blue);outline-offset:2px}
.side .theme-switch{align-self:flex-start;margin-bottom:12px;background:#ffffff0d;border-color:#ffffff26}
.side .theme-switch button{color:#cbd5e1}.side .theme-switch button:hover{color:#fff;background:#ffffff14}
.side .theme-switch button[aria-pressed=true]{background:#1254e8;color:#fff}
.header-tools{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
/* Logo variant for dark backgrounds: owl mark + white wordmark. */
.logo-dark{display:none;align-items:center;gap:8px;font-size:34px;font-weight:900;letter-spacing:-1.5px;line-height:1;color:#fff}
.logo-dark img{width:52px;height:52px;object-fit:contain;margin:0}
.footer .logo-dark{font-size:28px}.footer .logo-dark img{width:42px;height:42px}
[data-theme=dark] .logo-light{display:none}
[data-theme=dark] .logo-dark{display:inline-flex}

/* ---------- Shared components (ui.css) ---------- */
[data-theme=dark] body{background:var(--bg);color:var(--ink)}
[data-theme=dark] :where(a,summary):focus-visible{outline-color:var(--blue)}
[data-theme=dark] .btn,[data-theme=dark] .button.primary{background:var(--accent);color:#fff;box-shadow:0 4px 14px #0000004d}
[data-theme=dark] .btn:hover,[data-theme=dark] .button.primary:hover{background:var(--accent-hover);color:#fff}
[data-theme=dark] .btn.ghost,[data-theme=dark] .btn.secondary{background:var(--card);border-color:var(--field-line);color:var(--blue);box-shadow:none}
[data-theme=dark] .btn.ghost:hover,[data-theme=dark] .btn.secondary:hover{background:var(--surface-2);border-color:#3d5578}
[data-theme=dark] .btn.cyan{background:#0e3346;color:#9be6ff;border-color:#1b5470}
[data-theme=dark] .btn.danger{background:#c53030;color:#fff}
[data-theme=dark] .btn.ai{background:#7040d9;color:#fff}
[data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]),[data-theme=dark] select,[data-theme=dark] textarea{background:var(--field);border-color:var(--field-line);color:var(--ink)}
[data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):focus,[data-theme=dark] select:focus,[data-theme=dark] textarea:focus{border-color:var(--blue)}
[data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):disabled,[data-theme=dark] select:disabled,[data-theme=dark] textarea:disabled{background:#172235;color:#7d8ca3}
[data-theme=dark] input[aria-invalid=true],[data-theme=dark] textarea[aria-invalid=true],[data-theme=dark] select[aria-invalid=true]{border-color:var(--bad)}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:#7385a0}
[data-theme=dark] .badge{background:#1c2a40;color:#a9b8cd}
[data-theme=dark] .badge.connected,[data-theme=dark] .badge.completed,[data-theme=dark] .badge.done,[data-theme=dark] .badge.passed{background:#0f2e1d;color:#86efac}
[data-theme=dark] .badge.pending,[data-theme=dark] .badge.planning,[data-theme=dark] .badge.awaiting_approval,[data-theme=dark] .badge.planned,[data-theme=dark] .badge.preparing_workspace,[data-theme=dark] .badge.testing,[data-theme=dark] .badge.blocked{background:#33260a;color:#fcd34d}
[data-theme=dark] .badge.running,[data-theme=dark] .badge.awaiting_review{background:#102a4c;color:#93c5fd}
[data-theme=dark] .badge.generating{background:#261d47;color:#c4b5fd}
[data-theme=dark] .badge.error,[data-theme=dark] .badge.failed,[data-theme=dark] .badge.uncertain,[data-theme=dark] .badge.timeout{background:#3a1519;color:#fca5a5}
[data-theme=dark] .badge.cancelled,[data-theme=dark] .badge.disconnected,[data-theme=dark] .badge.skipped,[data-theme=dark] .badge.not_configured{background:#1c2a40;color:#a9b8cd}
[data-theme=dark] .flash.success{background:#0f2a1c;border-color:#1f4d33;color:#86efac}
[data-theme=dark] .flash.error{background:#2a1418;border-color:#5a2228;color:#fca5a5}
[data-theme=dark] .flash.warning{background:#2d2208;border-color:#5c4510;color:#fcd34d}
[data-theme=dark] .flash.info{background:#0f2240;border-color:#1e3f6e;color:#93c5fd}
[data-theme=dark] progress{background:#1c2a40}
[data-theme=dark] progress::-webkit-progress-bar{background:#1c2a40}
[data-theme=dark] progress::-moz-progress-bar{background:var(--accent)}
[data-theme=dark] .skip{background:var(--card);color:var(--blue)}

/* ---------- Public site (landing.css) ---------- */
[data-theme=dark] .dark{background:var(--accent);color:#fff}
[data-theme=dark] .white{background:#fff;color:#0b1f3b}
[data-theme=dark] .lead,[data-theme=dark] .workspace p,[data-theme=dark] .demo-label,[data-theme=dark] .detail-note,[data-theme=dark] .auth-story-note{color:var(--muted)}
[data-theme=dark] .hero-art{background:radial-gradient(ellipse,#16365a 0%,#0f2440 45%,transparent 71%)}
[data-theme=dark] .owl{filter:drop-shadow(0 25px 18px #00000066)}
[data-theme=dark] .orbit{border-color:#24405f}
[data-theme=dark] .floating{background:var(--card);border-color:var(--line);box-shadow:0 12px 45px #00000066}
[data-theme=dark] .ribbon{background:#0d1829}
[data-theme=dark] .workspace{border-color:var(--line);box-shadow:0 18px 55px #00000059}
[data-theme=dark] .workspace aside{background:#08101d}
[data-theme=dark] .workspace aside .selected{background:var(--accent)}
[data-theme=dark] .prompt{background:var(--card);border-color:var(--line);box-shadow:none}
[data-theme=dark] .prompt b{background:var(--accent)}
[data-theme=dark] .demo-chips span,[data-theme=dark] .metrics>div,[data-theme=dark] .task-row{background:var(--card)}
[data-theme=dark] .task-row em{background:#261d47;color:#c4b5fd}
[data-theme=dark] .icon.blue{background:#172a52;color:var(--blue)}
[data-theme=dark] .icon.cyan{background:#0e3346;color:#67d8ff}
[data-theme=dark] .icon.purple{background:#261d47;color:#c4b5fd}
[data-theme=dark] .cards article{background:var(--card)}
[data-theme=dark] .detail-card{background:linear-gradient(140deg,var(--card),#0d1a2e)}
[data-theme=dark] .detail-number{color:#33476a}
[data-theme=dark] .cta{background:linear-gradient(135deg,#0f2440,#132b52);border:1px solid var(--line)}
[data-theme=dark] .cta:after{border-color:#2b4a74}
[data-theme=dark] .seo-table thead{background:var(--surface-2)}
[data-theme=dark] .seo-prompt{border-left-color:var(--accent)}

/* ---------- Auth pages (auth.css) ---------- */
[data-theme=dark] .auth-shell{background:var(--card);box-shadow:0 18px 65px #00000059}
[data-theme=dark] .auth-story{background:linear-gradient(145deg,#10213a,#161d42)}
[data-theme=dark] .auth-form input:focus{background:#0f1c30}
[data-theme=dark] .auth-google{border-color:var(--field-line);color:var(--ink)}
[data-theme=dark] .auth-google:hover{background:var(--surface-2)}
[data-theme=dark] .auth-message.error{background:#2a1418;color:#fca5a5;border-color:#5a2228}
[data-theme=dark] .auth-message.success{background:#0f2a1c;color:#86efac;border-color:#1f4d33}

/* ---------- Cabinet (owo.css) ---------- */
[data-theme=dark] body.owo{background:radial-gradient(ellipse at 90% 0,#0f2a44,transparent 50%),var(--bg)}
[data-theme=dark] body.owo h1,[data-theme=dark] body.owo h2{color:var(--ink)}
[data-theme=dark] .side{background:linear-gradient(155deg,#08111f,#0f2440);border-right:1px solid var(--line);box-shadow:none}
[data-theme=dark] .me .btn.ghost{background:#ffffff0a;color:#fff;border-color:#ffffff33}
[data-theme=dark] .me .btn.ghost:hover{background:#ffffff1a}
[data-theme=dark] .card{border-color:var(--line)}
[data-theme=dark] .card.card-warn{background:#2d2208;border-color:#5c4510}
[data-theme=dark] .empty{background:#111c2fb3;border-color:var(--field-line)}
[data-theme=dark] table{background:var(--card);border-color:var(--line)}
[data-theme=dark] th{background:var(--surface-2);color:var(--mut)}
[data-theme=dark] tr:hover td{background:#142139}
[data-theme=dark] .chip{background:#102a4c;color:#93c5fd}
[data-theme=dark] .convs{background:var(--card);border-color:var(--line)}
[data-theme=dark] .convs a:hover{background:var(--surface-2)}
[data-theme=dark] .convs a.on{background:#16305a;color:var(--blue)}
[data-theme=dark] .msg.user{background:var(--accent);color:#fff}
[data-theme=dark] .msg.assistant{background:var(--card);border-color:var(--line)}
[data-theme=dark] .plan{border-color:#1e3f6e}
[data-theme=dark] .old{background:#3a1519;color:#fca5a5}
[data-theme=dark] .new{background:#0f2e1d;color:#86efac}
[data-theme=dark] .composer{background:#0a1322ed;border-top-color:var(--line)}
[data-theme=dark] pre{border:1px solid var(--line)}
[data-theme=dark] .prompt-link{background:var(--card);border-color:#24406a;box-shadow:none}
[data-theme=dark] .prompt-link:hover{border-color:var(--blue)}
[data-theme=dark] .prompt-arrow{background:var(--accent)}
[data-theme=dark] .stat:hover{border-color:#3d5578}
[data-theme=dark] .dashboard-owl{filter:drop-shadow(0 18px 24px #00000066)}
[data-theme=dark] .kit .swatch i{border-color:#ffffff1a}
.theme-switch.labeled button{display:inline-flex;align-items:center;gap:8px;width:auto;height:38px;padding:0 14px;font:600 14px/1 var(--font-sans)}
.theme-switch.labeled{flex-wrap:wrap}
@media(max-width:600px){.theme-switch.labeled{display:flex;width:100%}.theme-switch.labeled button{flex:1 1 0;justify-content:center;padding:0 8px;gap:6px}}
[data-theme=dark] .convs-list a.on{background:#16305a;color:var(--blue)}
[data-theme=dark] .chat-notice.warning{background:#2d2208;border-color:#5c4510;color:#fcd34d}
[data-theme=dark] .chat-notice.info{background:#0f2240;border-color:#1e3f6e;color:#93c5fd}
[data-theme=dark] .agent .msg.error{background:#2a1418;border-color:#5a2228;color:#fca5a5}
[data-theme=dark] .agent .msg.error .msg-error-icon{background:#f87171;color:#2a1418}
[data-theme=dark] .agent .msg.assistant{background:var(--surface-2);border-color:transparent}
[data-theme=dark] .agent .composer{background:var(--card)}
[data-theme=dark] .chat-empty img{filter:drop-shadow(0 10px 16px #00000066)}
