:root { color-scheme: light; }
.theme-control {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 3px 8px;
    background: #fff;
    color: #686077;
    flex-shrink: 0;
}
.theme-control[hidden] { display: none; }
.theme-control .theme-icon { width: 17px; height: 17px; flex-shrink: 0; }
.theme-control select {
    width: 107px;
    padding: 5px 4px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: inherit;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 11px;
    cursor: pointer;
}
.theme-control select:focus { box-shadow: none; }
.theme-control:focus-within { outline: 3px solid var(--purple); outline-offset: 3px; }
.auth-theme { position: absolute; top: 22px; inset-inline-end: 24px; z-index: 5; }

:root[data-theme="dark"] {
    color-scheme: dark;
    --surface: #11131e;
    --ink: #eeeaf8;
    --muted: #b5afc8;
    --line: #34374b;
    --purple: #c1adff;
    --purple-dark: #d5c6ff;
    --green: #91dfc1;
    --amber: #f6ca88;
    --dark-panel: #1b1e2c;
    --dark-raised: #242739;
}
:root[data-theme="dark"] :is(.sidebar, .topbar, .panel, .stat-card, .project-card, .message) { background: var(--dark-panel); }
:root[data-theme="dark"] :is(.sidebar-help, .welcome-strip, .project-card, .project-link, .panel, .support-card, .message, .info-note, .selection-summary, .code-block, .context-quote, .demo-login, .upload-label, thead, td, .details > div, .ticket-row, .receipt-history) { border-color: var(--line); }
:root[data-theme="dark"] :is(.brand-en, .workspace-label, .sidebar-bottom, .version, .breadcrumb, .account small, .today, .demo-banner, .demo-description, .eyebrow, .stat-top, .stat-card > small, .section-heading p, .project-meta, .domain, .subline, .ticket-row small, .footer, .details dt, .form-stack label, .form-stack small, input[type="file"], .empty, .empty-state, .message-header time, .review-receipt p) { color: var(--muted); }
:root[data-theme="dark"] .breadcrumb strong { color: var(--ink); }
:root[data-theme="dark"] .slash { color: #777188; }
:root[data-theme="dark"] .brand-mark { border-radius: 9px; }
:root[data-theme="dark"] .nav-item { color: #c4bdd5; }
:root[data-theme="dark"] .nav-item:hover { background: #29263d; color: #e0d4ff; }
:root[data-theme="dark"] .nav-item.active { background: #342b50; color: #e0d4ff; }
:root[data-theme="dark"] .avatar { background: #39304f; border-color: var(--dark-panel); outline-color: var(--line); }
:root[data-theme="dark"] .icon-button { color: #b9afcd; }
:root[data-theme="dark"] .icon-button:hover { background: #30283f; color: #e0d4ff; }
:root[data-theme="dark"] .primary { background: #765adb; color: #fff; box-shadow: none; }
:root[data-theme="dark"] .primary:hover { background: #7b5fdd; }
:root[data-theme="dark"] :is(.secondary, .white) { background: var(--dark-raised); border-color: #49415e; color: #dbcaff; }
:root[data-theme="dark"] .secondary:hover { background: #312c44; border-color: #8f78ba; }
:root[data-theme="dark"] .purple { background: #332a4c; color: #d4c3ff; }
:root[data-theme="dark"] .amber { background: #3b3022; color: var(--amber); }
:root[data-theme="dark"] .blue { background: #23314a; color: #aacbff; }
:root[data-theme="dark"] .green { background: #203b34; color: var(--green); }
:root[data-theme="dark"] .neutral { background: #2b2d3d; color: #c4bfd2; }
:root[data-theme="dark"] :is(.sidebar-help, .welcome-strip, .support-card) { background: linear-gradient(125deg, #29233c, #211f31); }
:root[data-theme="dark"] :is(.sidebar-help p, .welcome-strip p, .support-card p) { color: #c0b3d0; }
:root[data-theme="dark"] :is(.welcome-strip h2, .support-card h2) { color: #e0d1f5; }
:root[data-theme="dark"] :is(.text-link, .table-action, .project-link, .support-card .text-link, .sidebar-help a, .attachment, .footer strong) { color: #c8b1f3; }
:root[data-theme="dark"] :is(.text-link:hover, .table-title:hover) { color: #e9dcff; }
:root[data-theme="dark"] :is(.strip-icon, .project-symbol, .ticket-icon, .count) { background: #332c48; color: #d0bdf3; }
:root[data-theme="dark"] .project-symbol.peach { background: #3c3029; color: #f2c4a4; }
:root[data-theme="dark"] .project-card:hover { border-color: #7e69a0; }
:root[data-theme="dark"] thead { background: #232535; color: #c2b8d2; }
:root[data-theme="dark"] .ticket-row:hover { background: #242333; }
:root[data-theme="dark"] :is(input, textarea, select) { background: #141722; color: #eeeaf8; border-color: #4b465e; }
:root[data-theme="dark"] :is(input, textarea, select):focus { border-color: #ad91dd; box-shadow: 0 0 0 3px #b294ed24; }
:root[data-theme="dark"] :is(input, textarea)::placeholder { color: #b0a6c0; }
:root[data-theme="dark"] input[type="file"]::file-selector-button { background: #352b49; color: #e0d1f5; }
:root[data-theme="dark"] :is(.upload-label, .info-note, .selection-summary, .code-block, .context-quote, .review-receipt) { background: #262335; color: #d2c3e2; }
:root[data-theme="dark"] .context-quote { border-right-color: #ad91dd; }
:root[data-theme="dark"] .preview-scroll { background: #12141f; }
:root[data-theme="dark"] .bank-card { background: linear-gradient(115deg, #3b325b, #5b497d); }
:root[data-theme="dark"] .alert.success { background: #1d3a31; color: #a7e8cb; }
:root[data-theme="dark"] .alert.error { background: #42282f; color: #ffc1b8; }
:root[data-theme="dark"] .receipt-history p { color: #ffb6a7; }
:root[data-theme="dark"] .operator-message { background: #2a243d; border-color: #514267; }
:root[data-theme="dark"] .message-body { color: #d6cee2; }
:root[data-theme="dark"] .auth-shell { background: var(--surface); }
:root[data-theme="dark"] .auth-art { background: linear-gradient(150deg, #29223f, #1d1b2d); }
:root[data-theme="dark"] .auth-art::after { border-color: #65517d66; box-shadow: 0 0 0 70px #65517d16, 0 0 0 140px #65517d0d; }
:root[data-theme="dark"] .auth-art h1 { color: #e1d2fa; }
:root[data-theme="dark"] :is(.auth-art p, .auth-art small, .auth-features) { color: #c2b2d4; }
:root[data-theme="dark"] .demo-login { background: #201e30; border-color: #544364; color: #c6b4db; }
:root[data-theme="dark"] .theme-control { background: var(--dark-raised); color: #e1d2fa; border-color: #4b465e; }
:root[data-theme="dark"] .theme-control select { background: transparent; box-shadow: none; color: inherit; }

@media (max-width: 1000px) {
    .topbar .account > div:not(.avatar) { display: none; }
}
@media (max-width: 680px) {
    .breadcrumb > span { display: none; }
    .theme-control { padding-inline: 5px; }
    .theme-control select { width: 98px; }
    .auth-theme { top: 18px; inset-inline-end: 18px; }
}
