/* Stark appearance modes. Loaded last so theme tokens consistently cover every workspace. */
.theme-toggle{display:flex;align-items:center;gap:10px;border:0;border-radius:12px;background:transparent;color:#aebdcb;padding:8px 10px;font:inherit;font-size:12px;font-weight:700;text-align:left;transition:background .18s,color .18s}
.theme-toggle:hover{background:rgba(255,255,255,.08);color:#fff}.theme-icon{display:grid;place-items:center;flex:0 0 32px;width:32px;height:32px;border:1px solid rgba(100,210,255,.42);border-radius:10px;background:linear-gradient(145deg,rgba(10,132,255,.34),rgba(94,92,230,.24));box-shadow:0 6px 18px rgba(10,132,255,.18);color:#fff}.theme-icon svg{display:block;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.theme-icon svg .theme-icon-star{fill:currentColor;stroke:none}.theme-toggle b{margin-left:auto;padding:3px 7px;border-radius:999px;background:rgba(255,255,255,.09);color:#8fa8be;font-size:9px;letter-spacing:.04em}
.sidebar-theme-toggle{width:100%;margin-top:auto}.sidebar-theme-toggle+.sidebar-foot{margin-top:8px}
.portal-theme-toggle{margin-left:auto;border:1px solid rgba(60,60,67,.12);background:rgba(255,255,255,.74);color:#566174;padding:6px 8px}.portal-theme-toggle:hover{background:#fff;color:#111827}.portal-theme-toggle .theme-icon{border-color:rgba(0,113,227,.22);background:linear-gradient(145deg,#0a84ff,#5e5ce6);box-shadow:0 5px 14px rgba(10,132,255,.22)}.portal-theme-toggle b{background:rgba(0,113,227,.10);color:#075eb6}

html[data-theme="dark"]{color-scheme:dark;--ink:#f5f5f7;--muted:rgba(235,235,245,.60);--line:rgba(84,84,88,.65);--paper:#1c1c1e;--canvas:#000;--navy:#1c1c1e;--navy-2:#2c2c2e;--magenta:#ff375f;--blue:#0a84ff;--cyan:#64d2ff;--green:#30d158;--amber:#ff9f0a;--red:#ff453a;--shadow:0 20px 60px rgba(0,0,0,.42)}
html[data-theme="dark"] body{background:radial-gradient(circle at 14% -12%,rgba(10,132,255,.15),transparent 35rem),radial-gradient(circle at 96% 2%,rgba(94,92,230,.12),transparent 32rem),var(--canvas);color:var(--ink)}
html[data-theme="dark"] .shell{background:transparent}
html[data-theme="dark"] :is(.admin-workspace,.portal-experience,.vendor-portal-page){color:var(--ink)}
html[data-theme="dark"] .sidebar{background:rgba(0,0,0,.94);border-right-color:var(--line);box-shadow:16px 0 50px rgba(0,0,0,.28)}
html[data-theme="dark"] .nav button.active{background:linear-gradient(90deg,rgba(10,132,255,.30),rgba(94,92,230,.12));box-shadow:inset 2px 0 var(--blue),0 0 22px rgba(10,132,255,.08)}
html[data-theme="dark"] .nav-count{background:linear-gradient(135deg,rgba(100,210,255,.19),rgba(94,92,230,.19));color:#b9e8ff}
html[data-theme="dark"] .topbar{background:rgba(0,0,0,.82);border-color:var(--line)}
html[data-theme="dark"] .workspace-jumpbar{color:var(--muted)}
html[data-theme="dark"] :is(.search-global,.toolbar-search input,.workspace-jumpbar select,.workspace-directory-controls input,.workspace-directory-controls select,.field input,.field select,.field textarea,.invoice-filter-bar input,.invoice-filter-bar select,.csv-upload-controls select,.csv-map-grid select,.bulk-edit-bar select,.bulk-edit-bar input,.line-row input,.line-row select,.line-row textarea,.total-edit-row input,.total-edit-row select,.report-filter select,.calendar-pickers select,.vendor-intake input,.vendor-intake select,.vendor-report-toolbar select,.vendor-search,.vendor-review-meta input,.vendor-review-meta select,.vendor-review-line select,.vendor-overage-filters select,.project-toolbar select,.vendor-message-center-layout>aside input,.vendor-message-compose select,.vendor-message-compose textarea){background:#1c1c1e;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#78859b}
html[data-theme="dark"] :is(.button.light,.back){background:#2c2c2e;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(.button.light,.back):hover{background:#3a3a3c;border-color:rgba(99,99,102,.75)}
html[data-theme="dark"] .button.primary{background:linear-gradient(120deg,#0a84ff,#5e5ce6);box-shadow:0 9px 24px rgba(10,132,255,.24)}
html[data-theme="dark"] .button.danger{background:rgba(255,70,95,.13);color:#ff7b8b}
html[data-theme="dark"] :is(.panel,.metric,.record-card,.setting-card,.side-card,.report-filter,.calendar-summary>div,.email-template-card,.csv-summary>div,.analytics-card,.contractor-grid article,.vendor-statement-metrics>div){background:rgba(28,28,30,.92);border-color:var(--line);box-shadow:0 15px 42px rgba(0,0,0,.24)}
html[data-theme="dark"] :is(.workspace-recent,.workspace-tile,.portal-tile){background:#1c1c1e;color:var(--ink)}
html[data-theme="dark"] .workspace-heading :is(p,span),html[data-theme="dark"] :is(.workspace-label,.workspace-note,.portal-tile-label,.portal-tile-note,.alphabet-preview){color:var(--muted)}
html[data-theme="dark"] .workspace-purple{background:radial-gradient(ellipse at 84% 105%,#bf5af2,transparent 62%),linear-gradient(135deg,#32105d,#5e2ca5);box-shadow:0 18px 46px rgba(191,90,242,.20)}
html[data-theme="dark"] .workspace-admin-blue{background:radial-gradient(ellipse at 84% 105%,#64d2ff,transparent 62%),linear-gradient(135deg,#062a59,#0969c9);box-shadow:0 18px 46px rgba(10,132,255,.22)}
html[data-theme="dark"] .workspace-green{background:radial-gradient(circle at 92% 105%,rgba(48,209,88,.34),transparent 62%),linear-gradient(135deg,#102619,#1c1c1e)}html[data-theme="dark"] .workspace-green>strong{color:#30d158}
html[data-theme="dark"] .workspace-blue{background:radial-gradient(circle at 92% 105%,rgba(10,132,255,.36),transparent 62%),linear-gradient(135deg,#10253e,#1c1c1e)}html[data-theme="dark"] .workspace-blue>strong{color:#64d2ff}
html[data-theme="dark"] .workspace-peach{background:radial-gradient(circle at 92% 105%,rgba(255,159,10,.34),transparent 62%),linear-gradient(135deg,#34220c,#1c1c1e)}
html[data-theme="dark"] .workspace-red{background:radial-gradient(circle at 92% 105%,rgba(255,55,95,.34),transparent 62%),linear-gradient(135deg,#35131d,#1c1c1e)}html[data-theme="dark"] .workspace-red>strong{color:#ff375f}
html[data-theme="dark"] .workspace-filter-note{background:linear-gradient(120deg,rgba(30,119,255,.17),rgba(111,73,255,.12))}
html[data-theme="dark"] th{background:#101722;color:#94a4bd;border-color:var(--line)}
html[data-theme="dark"] td{border-color:rgba(170,192,226,.10)}
html[data-theme="dark"] tbody tr.clickable:hover,html[data-theme="dark"] .project-chart-rows button:hover{background:rgba(55,139,255,.09)}
html[data-theme="dark"] .cell-main{color:#e8efff}
html[data-theme="dark"] :is(.segmented,.view-toggle,.vendor-grain,.analytics-period){background:#0d131e}
html[data-theme="dark"] :is(.segmented button.active,.view-toggle button.active,.vendor-grain button.active,.analytics-period button.active){background:#202b3e;color:#fff;box-shadow:0 4px 15px rgba(0,0,0,.28)}
html[data-theme="dark"] :is(.status,.status.draft){background:rgba(154,170,198,.12);color:#b3bed0}
html[data-theme="dark"] :is(.status.paid,.status.accepted){background:rgba(56,222,139,.13);color:#58eba3}
html[data-theme="dark"] :is(.status.sent){background:rgba(56,159,255,.14);color:#68b8ff}
html[data-theme="dark"] :is(.status.reminder){background:rgba(255,170,44,.14);color:#ffc063}
html[data-theme="dark"] :is(.status.overdue,.status.declined){background:rgba(255,74,101,.14);color:#ff8190}
html[data-theme="dark"] :is(.drawer,.bulk-delete-list,.metric-comments-log>div,.saved-report-view,.send-queue-row,.contractor-assignment-list>div,.contractor-rate-list span,.clickup-list-groups section,.column-picker label,.column-order-row){background:#121925;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(.saved-report-views,.report-catalog>div,.report-catalog>button){background:#111925;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(.saved-report-open strong,.invoice-table-total td:first-child){color:var(--ink)}
html[data-theme="dark"] .saved-report-open:hover,html[data-theme="dark"] .report-catalog>button:hover{background:rgba(48,132,255,.09);border-color:rgba(73,153,255,.28)}
html[data-theme="dark"] .invoice-list-table tfoot,html[data-theme="dark"] .vendor-statement-section tfoot td{background:#0d1521;border-color:var(--line)}
html[data-theme="dark"] .drawer-head,html[data-theme="dark"] .drawer-foot{background:rgba(15,21,32,.92);border-color:var(--line)}
html[data-theme="dark"] .close{background:#2c2c2e;color:#f5f5f7;border-color:rgba(99,99,102,.72);box-shadow:0 7px 20px rgba(0,0,0,.30)}
html[data-theme="dark"] .close:hover{background:linear-gradient(135deg,#0a84ff,#5e5ce6);color:#fff;border-color:#64d2ff}
html[data-theme="dark"] .close:focus-visible{outline-color:#64d2ff}
html[data-theme="dark"] :is(.metric-comments,.bulk-delete-summary,.invoice-card-followup,.partner-project,.subject,.vendor-report-toolbar,.paste-assist,.project-toolbar){background:#0f1622;border-color:var(--line)}
html[data-theme="dark"] :is(.calendar-weekdays,.calendar-day.outside){background:#0e1520}html[data-theme="dark"] .calendar-day{background:#121925;border-color:var(--line)}
html[data-theme="dark"] .calendar-day.today{background:rgba(39,130,255,.09)}
html[data-theme="dark"] .finance-kpi-strip .blue{background:linear-gradient(135deg,rgba(22,136,255,.25),#121925)}html[data-theme="dark"] .finance-kpi-strip .green{background:linear-gradient(135deg,rgba(32,201,135,.23),#121925)}html[data-theme="dark"] .finance-kpi-strip .purple{background:linear-gradient(135deg,rgba(137,87,239,.26),#121925)}html[data-theme="dark"] .finance-kpi-strip .orange{background:linear-gradient(135deg,rgba(255,157,33,.24),#121925)}
html[data-theme="dark"] .finance-bar-chart{border-color:var(--line);background:repeating-linear-gradient(to top,transparent 0,transparent 54px,rgba(164,188,226,.10) 55px)}
html[data-theme="dark"] .finance-donut::before,html[data-theme="dark"] .aging-donut::before{background:#1c1c1e;box-shadow:inset 0 0 0 1px var(--line)}
html[data-theme="dark"] .analytics-rank-track{background:rgba(151,175,211,.10)}
html[data-theme="dark"] .portal-public-root,html[data-theme="dark"] .vendor-portal-page{background:radial-gradient(circle at 8% 0%,rgba(0,122,255,.19),transparent 30rem),radial-gradient(circle at 92% 12%,rgba(150,75,255,.17),transparent 28rem),var(--canvas)}
html[data-theme="dark"] .portal-global-header{background:rgba(9,14,23,.84);border-color:var(--line)}
html[data-theme="dark"] .portal-theme-toggle{background:#151e2d;color:#d8e4f7;border-color:var(--line)}
html[data-theme="dark"] .theme-icon{border-color:rgba(191,90,242,.48);background:linear-gradient(145deg,rgba(10,132,255,.58),rgba(191,90,242,.46));box-shadow:0 6px 20px rgba(94,92,230,.28)}
html[data-theme="dark"] .portal-paid-tile{background:linear-gradient(135deg,rgba(31,214,132,.28),#121925 88%)}html[data-theme="dark"] .portal-paid-tile>.portal-tile-value{color:#55e9a1}
html[data-theme="dark"] .portal-invoiced-tile{background:linear-gradient(135deg,rgba(32,129,255,.22),#121925 88%)}html[data-theme="dark"] .portal-invoiced-tile>.portal-tile-value{background-image:linear-gradient(100deg,#53b7ff,#b269ff)}
html[data-theme="dark"] .portal-alert-tile{background:linear-gradient(135deg,rgba(255,65,91,.26),#181925)}html[data-theme="dark"] .portal-alert-tile>.portal-tile-value{color:#ff7488}
html[data-theme="dark"] .portal-outstanding-tile{background:linear-gradient(135deg,rgba(255,159,35,.23),#151a24 88%)}
html[data-theme="dark"] .portal-message-tile{background:linear-gradient(135deg,rgba(34,142,255,.22),#121925 88%)}
html[data-theme="dark"] :is(.portal-data-card,.portal-submit-page,.portal-experience .panel,.portal-experience .vendor-portal-form,.portal-experience .vendor-portal-card,.portal-experience .vendor-message-thread,.portal-experience .vendor-statement-metrics>div,.portal-experience .vendor-statement-balance>button,.portal-banking-card,.portal-auth-card){background:#121925;color:var(--ink)}
html[data-theme="dark"] :is(.portal-data-card th,.portal-ring:before){background:#121925}html[data-theme="dark"] :is(.portal-ring b,.portal-invoice-totals b){color:var(--ink)}
html[data-theme="dark"] :is(.portal-local-nav button.active,.portal-local-nav select,.portal-master-toolbar input,.portal-master-toolbar select,.portal-project-controls input,.portal-project-controls select,.portal-experience .vendor-report-filters input,.portal-experience .vendor-report-filters select,.portal-intake-line input,.portal-intake-line select,.portal-banking-fields input,.portal-banking-fields select){background:#192334;color:var(--ink)}
html[data-theme="dark"] :is(.portal-intake-line,.portal-banking-admin pre,.portal-experience .vendor-admin-grid>div){background:#0e1622;color:var(--ink)}
html[data-theme="dark"] :is(.vendor-portal-kpis article,.vendor-portal-card,.vendor-portal-form,.vendor-message-thread,.vendor-message-thread article,.vendor-portal-project-picker article,.vendor-admin-grid>div,.portal-quick-actions>button,.portal-allowance-metrics>div,.portal-allowance-row){background:linear-gradient(145deg,rgba(20,29,44,.95),rgba(13,19,30,.88));border-color:var(--line);box-shadow:0 16px 45px rgba(0,0,0,.22)}
html[data-theme="dark"] .vendor-portal-kpis article:nth-child(1){background:linear-gradient(145deg,rgba(26,124,255,.26),rgba(15,22,34,.94))}html[data-theme="dark"] .vendor-portal-kpis article:nth-child(2){background:linear-gradient(145deg,rgba(36,211,137,.23),rgba(15,22,34,.94))}
html[data-theme="dark"] :is(.vendor-portal-nav,.vendor-report-range>[data-range-toggle],.vendor-range-popover){background:rgba(17,24,37,.92);border-color:var(--line)}
html[data-theme="dark"] .vendor-portal-nav button{color:#aebbd0}html[data-theme="dark"] .vendor-portal-nav button.active{background:linear-gradient(120deg,rgba(41,139,255,.25),rgba(126,74,255,.18));color:#ddecff}
html[data-theme="dark"] :is(.portal-allowance-section,.vendor-drilldown-total){background:linear-gradient(135deg,rgba(31,125,255,.17),rgba(18,24,35,.88));border-color:rgba(73,153,255,.24)}
html[data-theme="dark"] .portal-allowance-section.over{background:linear-gradient(135deg,rgba(255,71,93,.18),rgba(18,24,35,.9))}
html[data-theme="dark"] .project-summary-card{background:linear-gradient(145deg,rgba(29,126,255,.18),rgba(17,24,36,.95))}html[data-theme="dark"] .project-summary-card.green{background:linear-gradient(145deg,rgba(42,218,139,.18),rgba(17,24,36,.95))}html[data-theme="dark"] .project-summary-card.amber{background:linear-gradient(145deg,rgba(255,167,41,.18),rgba(17,24,36,.95))}html[data-theme="dark"] .project-summary-card.red{background:linear-gradient(145deg,rgba(255,67,92,.19),rgba(17,24,36,.95))}
html[data-theme="dark"] .project-summary-card.purple{background:linear-gradient(145deg,rgba(94,92,230,.24),rgba(17,24,36,.96))}html[data-theme="dark"] .project-summary-card.orange{background:linear-gradient(145deg,rgba(255,159,10,.22),rgba(17,24,36,.96))}html[data-theme="dark"] .project-summary-card.pink{background:linear-gradient(145deg,rgba(255,55,95,.22),rgba(17,24,36,.96))}
html[data-theme="dark"] :is(.project-intelligence-grid>.panel,.project-gantt,.project-collaboration,.project-message-thread article){background:#121925;border-color:var(--line);color:var(--ink)}html[data-theme="dark"] :is(.project-stage-list button,.project-updates-panel>button){background:#192334;border-color:var(--line);color:var(--ink)}html[data-theme="dark"] .project-sow-banner.expired{color:#ff8a83;background:linear-gradient(135deg,rgba(255,69,58,.27),rgba(255,55,95,.08))}html[data-theme="dark"] .project-sow-banner.warning{color:#ffd16b;background:linear-gradient(135deg,rgba(255,159,10,.22),rgba(255,204,0,.06))}html[data-theme="dark"] .project-gantt-track{background:#2c2c2e}
html[data-theme="dark"] .toast{background:#2c2c2e;color:#f5f5f7;border:1px solid var(--line);box-shadow:0 16px 45px rgba(0,0,0,.42)}
html[data-theme="dark"] .reset-card{background:linear-gradient(135deg,rgba(255,69,58,.13),#1c1c1e 72%);border-color:rgba(255,69,58,.32);color:var(--ink)}
html[data-theme="dark"] .user-counts>div{background:#2c2c2e;color:var(--ink);box-shadow:inset 0 0 0 1px rgba(99,99,102,.40)}
html[data-theme="dark"] .credential-security{background:linear-gradient(135deg,rgba(10,132,255,.16),rgba(94,92,230,.10));border-color:rgba(100,210,255,.24);color:var(--ink)}
html[data-theme="dark"] .credential-security>span{background:rgba(10,132,255,.18);color:#64d2ff}

/* Apple system-color refinement: neutral graphite chrome with color reserved for meaning and focus. */
html[data-theme="dark"] :is(.vendor-tabs,.vendor-portal-nav){padding:6px;border:1px solid var(--line);border-radius:16px;background:rgba(28,28,30,.94);box-shadow:0 12px 32px rgba(0,0,0,.24)}
html[data-theme="dark"] .vendor-tabs{gap:4px;margin-bottom:20px}
html[data-theme="dark"] :is(.vendor-tabs,.vendor-portal-nav) button{color:rgba(235,235,245,.60);background:transparent}
html[data-theme="dark"] :is(.vendor-tabs,.vendor-portal-nav) button:hover{color:#fff;background:#2c2c2e}
html[data-theme="dark"] .vendor-tabs button.active{color:#fff;background:linear-gradient(135deg,rgba(10,132,255,.30),rgba(94,92,230,.24));box-shadow:inset 0 0 0 1px rgba(100,210,255,.16)}
html[data-theme="dark"] .vendor-portal-nav button.active{color:#fff;background:linear-gradient(135deg,rgba(10,132,255,.30),rgba(94,92,230,.24));box-shadow:inset 0 0 0 1px rgba(100,210,255,.16)}
html[data-theme="dark"] :is(.portal-global-header,.portal-local-nav){background:rgba(0,0,0,.88);border-color:var(--line)}
html[data-theme="dark"] :is(.workspace-vendor-menu,.portal-operation-menu){color:#fff;background:#1c1c1e;border:1px solid var(--line);box-shadow:0 10px 28px rgba(0,0,0,.22)}
html[data-theme="dark"] .portal-local-nav button{color:rgba(235,235,245,.60)}
html[data-theme="dark"] .portal-local-nav button:hover{color:#64d2ff;background:rgba(10,132,255,.10)}
html[data-theme="dark"] :is(.portal-local-nav button.active,.portal-local-nav select){color:#fff;background:#2c2c2e;box-shadow:inset 0 0 0 1px rgba(99,99,102,.46)}

html[data-theme="dark"] .clickup-connection{color:var(--ink);border-color:rgba(10,132,255,.34);background:radial-gradient(circle at 8% 20%,rgba(100,210,255,.16),transparent 24rem),linear-gradient(115deg,#182536,#202035);box-shadow:0 14px 36px rgba(0,0,0,.24)}
html[data-theme="dark"] .clickup-connection.pending{border-color:rgba(255,159,10,.34);background:linear-gradient(115deg,#302310,#1c1c1e)}
html[data-theme="dark"] .clickup-connection .connection-mark{color:#0a84ff;background:rgba(10,132,255,.16)}
html[data-theme="dark"] .clickup-connection.pending .connection-mark{color:#ff9f0a;background:rgba(255,159,10,.16)}
html[data-theme="dark"] .clickup-connection p:not(.eyebrow){color:var(--muted)}
html[data-theme="dark"] :is(.clickup-space-group,.clickup-folder-group){color:var(--ink);background:#1c1c1e;border-color:var(--line)}
html[data-theme="dark"] .clickup-scope-toggle.space{background:linear-gradient(135deg,rgba(10,132,255,.18),rgba(94,92,230,.13));border-color:var(--line)}
html[data-theme="dark"] .clickup-scope-toggle.folder{background:#2c2c2e;border-color:var(--line)}
html[data-theme="dark"] .clickup-list-option:hover{background:#2c2c2e}
html[data-theme="dark"] .clickup-selection-bar{color:var(--ink);background:#1c1c1e;border-color:var(--line)}
html[data-theme="dark"] .clickup-space-mark{color:#64d2ff;background:rgba(10,132,255,.16)}
html[data-theme="dark"] .drawer-body{scrollbar-color:rgba(100,210,255,.48) rgba(28,28,30,.22)}
html[data-theme="dark"] .vendor-report-filters :is(input,select){background:#1c1c1e;color:#f5f5f7;border-color:var(--line);color-scheme:dark;-webkit-text-fill-color:#f5f5f7}
html[data-theme="dark"] .vendor-report-filters :is(input,select):disabled{background:#202124;color:#9da9bb;-webkit-text-fill-color:#9da9bb;opacity:1;cursor:not-allowed}
html[data-theme="dark"] .vendor-report-filters label{color:#e5e5ea}

html[data-theme="dark"] .vendor-overage-summary>div{border:1px solid transparent;color:#fff;box-shadow:0 12px 28px rgba(0,0,0,.20)}
html[data-theme="dark"] .vendor-overage-summary>div:nth-child(1){background:linear-gradient(135deg,rgba(10,132,255,.36),rgba(28,28,30,.96));border-color:rgba(10,132,255,.24)}
html[data-theme="dark"] .vendor-overage-summary>div:nth-child(2){background:linear-gradient(135deg,rgba(48,209,88,.30),rgba(28,28,30,.96));border-color:rgba(48,209,88,.22)}
html[data-theme="dark"] .vendor-overage-summary>div:nth-child(3){background:linear-gradient(135deg,rgba(255,159,10,.32),rgba(28,28,30,.96));border-color:rgba(255,159,10,.22)}
html[data-theme="dark"] .vendor-overage-summary span{color:rgba(235,235,245,.60)}
html[data-theme="dark"] .vendor-overage-table tbody tr{background:linear-gradient(90deg,rgba(255,69,58,.08),transparent)}
html[data-theme="dark"] .vendor-overage-table .overage-hours{color:#ff453a}

html[data-theme="dark"] .library-banner{border:1px solid rgba(191,90,242,.25);background:radial-gradient(circle at 86% 120%,rgba(191,90,242,.48),transparent 28rem),radial-gradient(circle at 4% -40%,rgba(100,210,255,.24),transparent 22rem),linear-gradient(135deg,#17172b,#24152f);box-shadow:0 18px 42px rgba(0,0,0,.28)}
html[data-theme="dark"] .library-banner p:not(.eyebrow){color:rgba(235,235,245,.60)}
html[data-theme="dark"] .library-banner .button.light{background:rgba(44,44,46,.88);border-color:rgba(255,255,255,.14)}

html[data-theme="dark"] :is(.template-library-intro,.user-admin-head,.profile-form-intro,.recurring-intro,.schedule-card,.sow-marker,.sow-missing,.document-portal,.invoice-financials,.financial-summary,.card-payment-option,.share-review-status>div){background:#1c1c1e;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(.sow-marker:hover,.share-company:hover,.share-company:focus-visible,.chart-drill:hover){background:#2c2c2e}
html[data-theme="dark"] :is(.bar-track,.analytics-rank-track,.collection-meter){background:#3a3a3c}
html[data-theme="dark"] :is(.empty-icon,.template-intro-mark,.profile-avatar){background:#2c2c2e;color:#64d2ff;box-shadow:none}
html[data-theme="dark"] :is(.calendar-event,.vendor-calendar-event){background:#1c1c1e;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(.calendar-event.scheduled,.vendor-calendar-event.scheduled){background:rgba(94,92,230,.12);border-left-color:#5e5ce6}
html[data-theme="dark"] .calendar-event.overdue{background:rgba(255,69,58,.11);border-left-color:#ff453a}
html[data-theme="dark"] .calendar-event.paid{background:rgba(48,209,88,.10);border-left-color:#30d158}

html[data-theme="dark"] .order-import{color:var(--ink);border-color:rgba(10,132,255,.28);background:radial-gradient(circle at 92% 120%,rgba(94,92,230,.24),transparent 28rem),linear-gradient(135deg,#151f2e,#211b31)}
html[data-theme="dark"] .order-import-icon{color:#bf5af2;background:#2c2c2e;box-shadow:none}
html[data-theme="dark"] .order-import-main p:last-child{color:var(--muted)}
html[data-theme="dark"] :is(.totals-editor,.card-payment-editor,.quick-customer,.template-subject,.template-token-help){color:var(--ink);background:#1c1c1e;border-color:var(--line)}
html[data-theme="dark"] :is(.total-edit-row input,.total-edit-row select,.analytics-card-filters input,.analytics-card-filters select,.analytics-multiselect summary){color:var(--ink);background:#2c2c2e;border-color:var(--line)}
html[data-theme="dark"] :is(.analytics-multiselect>div,.template-library-intro>span,.template-category-legend span){color:var(--ink);background:#2c2c2e;border-color:var(--line);box-shadow:none}
html[data-theme="dark"] .template-subject span{color:rgba(235,235,245,.60)}
html[data-theme="dark"] .template-subject strong{color:#f5f5f7}
html[data-theme="dark"] .template-category{color:#64d2ff;background:rgba(10,132,255,.16)}
html[data-theme="dark"] .template-category.reminder{color:#ffd60a;background:rgba(255,159,10,.16)}
html[data-theme="dark"] .template-category.receipt{color:#30d158;background:rgba(48,209,88,.15)}
html[data-theme="dark"] .template-category.general{color:#bf5af2;background:rgba(191,90,242,.16)}
html[data-theme="dark"] .system-template.custom{color:#bf5af2}
html[data-theme="dark"] :is(.finance-donut strong,.aging-donut strong){color:#f5f5f7}
html[data-theme="dark"] :is(.finance-donut small,.aging-donut small){color:var(--muted)}
html[data-theme="dark"] .aging-donut-list button:hover,html[data-theme="dark"] .aging-donut-list button:focus-visible{background:#2c2c2e;outline-color:rgba(10,132,255,.28)}

/* Contrast floor for secondary controls and supporting copy. */
html[data-theme="dark"] :is(.field label,.project-toolbar label>span,.project-summary-card span,.analytics-period button,.empty-views span){color:#b7c2d3}
html[data-theme="dark"] :is(.table-sort span,.portal-project-sort span){background:rgba(10,132,255,.16);color:#64d2ff}
html[data-theme="dark"] :is(.table-sort.active span,.portal-project-sort:hover span){background:rgba(100,210,255,.22);color:#d8f4ff}
html[data-theme="dark"] .calendar-date-button{color:#e5e5ea}
html[data-theme="dark"] .calendar-day.outside .calendar-date-button{color:#9ca8ba}
html[data-theme="dark"] .rank{background:#2c2c2e;color:#f5f5f7}
html[data-theme="dark"] .rank.winner{background:rgba(255,214,10,.18);color:#ffd60a}
html[data-theme="dark"] :is(.csv-upload-panel,.sow-bulk-panel){background:radial-gradient(circle at 92% 112%,rgba(94,92,230,.20),transparent 25rem),linear-gradient(135deg,#151f2e,#1c1c1e);border-color:rgba(100,210,255,.20);color:var(--ink)}
html[data-theme="dark"] :is(.csv-upload-panel,.sow-bulk-panel) p{color:#c2ccda}
html[data-theme="dark"] .you-badge{background:rgba(10,132,255,.18);color:#8fd3ff!important}
html[data-theme="dark"] .reset-button{background:#a92f3b!important;border-color:#c23a48!important}
html[data-theme="dark"] .reset-button:hover{background:#8e2631!important;border-color:#a92f3b!important}
html[data-theme="dark"] .attachment-drop{background:#1c1c1e;border-color:#4c6b91;color:#64d2ff}
html[data-theme="dark"] :is(.attachment-drop small,.selected-files){color:#c2ccda}
html[data-theme="dark"] .line-remove{background:rgba(255,69,58,.16);color:#ff9aa7;border:1px solid rgba(255,69,58,.32)}
html[data-theme="dark"] :is(.portal-global-header,.portal-home-heading>span,.portal-detail-intro,.portal-project-controls label,.portal-project-result-count,.portal-banking-card>p,.portal-banking-fields label,.portal-banking-audit p,.portal-document-list small,.portal-submit-page>small){color:#b7c2d3}
html[data-theme="dark"] .portal-banking-status{color:#e5e5ea}
html[data-theme="dark"] .calendar-event>span{color:#b7c2d3}
html[data-theme="dark"] .calendar-event.scheduled>span{color:#d0b8ff}
html[data-theme="dark"] .calendar-event.overdue>span{color:#ff9aa7}
html[data-theme="dark"] .calendar-event.paid>span{color:#55e9a1}
html[data-theme="dark"] .portal-quiet-tile>.portal-tile-value{color:#b7c2d3}
html[data-theme="dark"] .portal-allowance-tile>.portal-tile-value{color:#d0b8ff}
html[data-theme="dark"] .portal-week-caption>span:first-child{color:#b7c2d3}
html[data-theme="dark"] .vendor-autofill{color:var(--ink);background:radial-gradient(circle at 8% 20%,rgba(100,210,255,.14),transparent 20rem),linear-gradient(115deg,#182536,#202035);border-color:rgba(100,210,255,.26)}
html[data-theme="dark"] .vendor-autofill span{color:#c2ccda}
html[data-theme="dark"] :is(.contractor-rate-row>input,.rate-money){background:#1c1c1e;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .rate-money input{background:transparent;color:var(--ink)}
html[data-theme="dark"] :is(.engagement-overview,.engineer-time-form,.project-calendar-card,.project-time-register){background:#1c1c1e;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(.engagement-facts>div,.project-time-history,.project-date-list,.project-calendar-day){background:#202124;border-color:var(--line)}
html[data-theme="dark"] .engagement-admin-note{background:rgba(10,132,255,.11)}
html[data-theme="dark"] .project-calendar-day.outside{background:#151619}
html[data-theme="dark"] .project-calendar-controls input{background:#202124;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .project-calendar-day>span:not(.project-calendar-event){background:rgba(10,132,255,.15)}
html[data-theme="dark"] .project-calendar-day>span.end{background:rgba(255,159,10,.14)}
html[data-theme="dark"] .project-calendar-day>span.important{background:rgba(191,90,242,.15)}
html[data-theme="dark"] .vendor-warnings{background:rgba(255,159,10,.12);border-color:rgba(255,159,10,.32);color:#ffd49a}
html[data-theme="dark"] .vendor-portal-card-head>span{background:rgba(10,132,255,.2);color:#9fd0ff}
html[data-theme="dark"] .project-calendar-day>strong{color:#f5f5f7}
html[data-theme="dark"] .project-calendar-day.outside>strong{color:#aeb8c8}
html[data-theme="dark"] .project-calendar-day.today>strong{background:#0066cc;color:#fff}
html[data-theme="dark"] .clickup-sync-policy{background:linear-gradient(135deg,rgba(10,132,255,.16),rgba(94,92,230,.13));border-color:rgba(100,210,255,.25)}
html[data-theme="dark"] .project-invoice-admin{background:#1c1c1e;border-color:var(--line)}
html[data-theme="dark"] .project-invoice-banner{background:linear-gradient(135deg,rgba(10,132,255,.16),rgba(94,92,230,.13));border-color:rgba(100,210,255,.25)}
html[data-theme="dark"] .project-assignment-callout{background:linear-gradient(135deg,rgba(10,132,255,.14),rgba(94,92,230,.10));border-color:rgba(100,210,255,.24)}
html[data-theme="dark"] .project-rule-note{background:#182536;color:#b7c7dc;border-color:rgba(100,210,255,.22)}

/* Invoices are customer documents: keep the paper light even inside dark admin chrome. */
@media screen{
  html[data-theme="dark"] .invoice-paper{--ink:#1d1d1f;--muted:#6e6e73;--line:rgba(60,60,67,.20);--paper:#fff;--navy:#18202b;color-scheme:light;background:#fff;color:#1d1d1f;border-color:#d1d3d7;box-shadow:0 20px 60px rgba(0,0,0,.34)}
  html[data-theme="dark"] .invoice-paper .invoice-brand{border-color:#d7d9dd}
  html[data-theme="dark"] .invoice-paper :is(.invoice-company,.bill-block p,.invoice-table .cell-sub,.terms,.card-payment-option span){color:#6e6e73}
  html[data-theme="dark"] .invoice-paper :is(.bill-block label,.invoice-meta label,.partner-project-grid label,.financial-summary>p){color:#73777f}
  html[data-theme="dark"] .invoice-paper .invoice-meta{background:#fff;border-color:#d1d1d6}
  html[data-theme="dark"] .invoice-paper .invoice-meta div{border-color:#d8dade}
  html[data-theme="dark"] .invoice-paper .partner-project{background:#fafafa;color:#1d1d1f;border-color:#cfd2d7}
  html[data-theme="dark"] .invoice-paper .partner-project-title{border-color:#d7d9dd}
  html[data-theme="dark"] .invoice-paper .partner-project-grid>div{box-shadow:inset -1px -1px #dedfe2}
  html[data-theme="dark"] .invoice-paper .subject{background:#fff;color:#6e6e73;border-color:#d7d9dd}
  html[data-theme="dark"] .invoice-paper .subject strong{color:#1d1d1f}
  html[data-theme="dark"] .invoice-paper .invoice-financials{background:#fff;color:#1d1d1f;border-color:#d1d3d7}
  html[data-theme="dark"] .invoice-financials .invoice-table td{background:#fff;color:#1d1d1f;border-color:#d8dade}
  html[data-theme="dark"] .invoice-financials .invoice-table th{background:#18202b;color:#c4cbd3;border-color:#3c3d42}
  html[data-theme="dark"] .invoice-financials .invoice-table th:first-child{color:#fff}
  html[data-theme="dark"] .invoice-paper .financial-summary{background:#fcfcfd;color:#1d1d1f;border-color:#d8dade}
  html[data-theme="dark"] .invoice-paper .totals div{color:#55565c;border-color:#dedfe3}
  html[data-theme="dark"] .invoice-paper .totals div strong{color:#1d1d1f}
  html[data-theme="dark"] .invoice-paper .totals .balance{background:#edf4ff;color:#086de0}
  html[data-theme="dark"] .invoice-paper .totals .balance strong{color:#086de0}
  html[data-theme="dark"] .invoice-paper .card-payment-option{background:#f7faff;color:#1d1d1f;border-color:#cfd8e6}
  html[data-theme="dark"] .invoice-paper .terms{border-color:#d7d9dd}
  html[data-theme="dark"] .invoice-paper .service-charge-line{background:#f8fbff}
  html[data-theme="dark"] .invoice-paper .service-charge-line td{border-top-color:#cbd8ea!important}
  html[data-theme="dark"] .customer-invoice-portal{--ink:#1d1d1f;--muted:#6e6e73;--line:rgba(60,60,67,.18);--paper:#fff;--canvas:#eef2f6;--navy:#18202b;color-scheme:light;background:#eef2f6;color:#1d1d1f}
}

/* Statement totals share the Apple palette in admin and vendor views. */
@media screen {
  .vendor-statement-balance { --balance-tint:12%; }
  .vendor-statement-balance [data-vendor-balance="charged"] { --balance-accent:var(--blue); }
  .vendor-statement-balance [data-vendor-balance="paid"] { --balance-accent:var(--green); }
  .vendor-statement-balance [data-vendor-balance="outstanding"] { --balance-accent:var(--amber); }
  html .vendor-statement-balance>button[data-vendor-balance],
  html[data-theme="dark"] .vendor-statement-balance>button[data-vendor-balance] {
    background:linear-gradient(135deg,color-mix(in srgb,var(--balance-accent) var(--balance-tint),var(--paper)),var(--paper));
    color:var(--ink);
    border:1px solid color-mix(in srgb,var(--balance-accent) 30%,var(--line));
    box-shadow:inset 3px 0 var(--balance-accent);
  }
  html[data-theme="dark"] .vendor-statement-balance { --balance-tint:28%; }
  html .vendor-statement-balance>button[data-vendor-balance] small { color:var(--balance-accent); }
  html[data-theme="dark"] .vendor-statement-balance>button[data-vendor-balance] small { color:color-mix(in srgb,var(--balance-accent) 65%,white); }
  html[data-theme="dark"] .vendor-statement-balance>button[data-vendor-balance] span { color:color-mix(in srgb,var(--ink) 80%,var(--paper)); }
  html .vendor-statement-balance>button[data-vendor-balance]:hover { border-color:var(--balance-accent); }
  html .vendor-statement-balance>button[data-vendor-balance]:focus-visible { outline:3px solid var(--balance-accent);outline-offset:3px; }
  html[data-theme="dark"] .bulk-edit-bar { background:var(--paper);border-color:var(--line);box-shadow:none;color:var(--ink); }
  html[data-theme="dark"] .bulk-edit-bar strong { color:var(--ink); }
  html[data-theme="dark"] .bulk-edit-bar span { color:var(--muted); }
  html[data-theme="dark"] .spreadsheet-table tbody tr { background:var(--paper);color:var(--ink); }
  html[data-theme="dark"] .spreadsheet-table tbody tr:hover { background:#2c2c2e; }
  html[data-theme="dark"] .spreadsheet-table tbody tr.selected-row { background:color-mix(in srgb,var(--blue) 18%,var(--paper));box-shadow:inset 3px 0 var(--blue); }
  html[data-theme="dark"] .spreadsheet-table tbody td { background:inherit;border-color:var(--line); }
  html[data-theme="dark"] .spreadsheet-table .grid-input { background:transparent;color:var(--ink);color-scheme:dark; }
  html[data-theme="dark"] .spreadsheet-table .grid-input:hover { background:#2c2c2e;border-color:var(--line); }
  html[data-theme="dark"] .spreadsheet-table .grid-input:focus { background:#2c2c2e;border-color:var(--blue);box-shadow:0 0 0 3px color-mix(in srgb,var(--blue) 25%,transparent); }
  html[data-theme="dark"] .spreadsheet-table .grid-input option { background:var(--paper);color:var(--ink); }
  html[data-theme="dark"] .spreadsheet-table tbody td.grid-dirty { background:color-mix(in srgb,var(--amber) 16%,var(--paper));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--amber) 45%,transparent); }
}


/* One client-labelled event treatment for staff and assigned-engineer calendars. */
@media screen {
  :is(.internal-calendar-entry,.project-calendar-day,.project-date-list) .calendar-detail-hint{font-size:10px;color:var(--ink);opacity:.8}
  .project-calendar-event{--event-accent:var(--blue)}
  .project-calendar-event.yellow{--event-accent:var(--amber)}
  .project-calendar-event.orange{--event-accent:var(--amber)}
  .project-calendar-event.red{--event-accent:var(--red)}
  .project-calendar-event.purple{--event-accent:var(--magenta)}
  :is(.calendar-event,.project-calendar-day>button,.project-calendar-day>span,.project-date-list button,.project-date-list span).project-calendar-event{
    display:grid;gap:4px;width:100%;min-width:0;padding:10px;text-align:left;
    border:1px solid color-mix(in srgb,var(--event-accent) 30%,var(--line));
    border-left:3px solid var(--event-accent);border-radius:9px;
    background:color-mix(in srgb,var(--event-accent) 10%,var(--paper));color:var(--ink);
    box-shadow:none;white-space:normal
  }
  :is(.calendar-event,.project-calendar-day>button,.project-calendar-day>span,.project-date-list button,.project-date-list span).project-calendar-event :is(span,b,strong,small){
    color:var(--ink);white-space:normal;overflow-wrap:anywhere;text-overflow:clip;overflow:visible;line-height:1.4;text-transform:none;letter-spacing:normal
  }
  .project-calendar-event :is(span,b){font-size:11px;font-weight:700}
  .project-calendar-event strong{font-size:12px}
  .project-calendar-event small{font-size:11px}
  button.project-calendar-event{cursor:pointer}
  button.project-calendar-event:hover{filter:brightness(1.12)}
  button.project-calendar-event:focus-visible{outline:3px solid var(--blue);outline-offset:3px}
  .project-calendar-day>button.project-calendar-event{margin-top:5px}
  .project-date-list article>div{min-width:0;flex:1}
}

@media screen and (max-width:1600px){.calendar-layout{grid-template-columns:minmax(0,1fr)}}
@media(max-width:900px){.sidebar-theme-toggle{justify-content:center}.sidebar-theme-toggle>span:nth-child(2),.sidebar-theme-toggle>b{display:none}.portal-theme-toggle>span:nth-child(2){display:none}}
@media(max-width:600px){html[data-theme="dark"] .vendor-overage-report .panel-head{align-items:stretch;flex-direction:column}html[data-theme="dark"] .vendor-overage-filters{align-items:stretch;flex-direction:column;justify-content:stretch}html[data-theme="dark"] .vendor-overage-filters select{flex:1;min-width:0;width:100%}html[data-theme="dark"] .vendor-overage-summary{grid-template-columns:1fr}}
@media print{html[data-theme="dark"]{--ink:#1d1d1f;--muted:#6e6e73;--line:rgba(60,60,67,.12);--paper:#fff;--canvas:#fff;color-scheme:light}html[data-theme="dark"] body{background:#fff;color:#1d1d1f}html[data-theme="dark"] .invoice-paper{background:#fff;color:#1d1d1f}html[data-theme="dark"] :is(.partner-project,.subject,.invoice-financials,.card-payment-option){background:#fff;color:#1d1d1f;border-color:#d1d3d7}html[data-theme="dark"] .financial-summary{background:#fcfcfd;color:#1d1d1f;border-color:#d8dade}html[data-theme="dark"] .partner-project{background:#fafafa}html[data-theme="dark"] .partner-project .combined-subject{background:#fff}html[data-theme="dark"] .invoice-table td{background:#fff;color:#1d1d1f;border-color:#d8dade}html[data-theme="dark"] .invoice-table th{background:#18202b;color:#c4cbd3}html[data-theme="dark"] .totals div{color:#55565c;border-color:#dedfe3}html[data-theme="dark"] .totals div strong{color:#1d1d1f}html[data-theme="dark"] .totals .balance{background:#edf4ff;color:#086de0}html[data-theme="dark"] .totals .balance strong{color:#086de0}}
