/* ==========================================================================
   PC 2.0 · Dark mode
   Activated by html[data-theme="dark"]; persisted in localStorage.
   ========================================================================== */

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf1fb;
  --ink-2: #c7d0e4;
  --ink-3: #a0abc2;
  --muted: #8793aa;
  --muted-2: #717d94;
  --paper: #181e30;

  --line: rgba(164, 178, 216, 0.12);
  --line-2: rgba(164, 178, 216, 0.18);
  --line-strong: rgba(164, 178, 216, 0.26);

  --accent-soft: rgba(108, 138, 255, 0.16);
  --glass: linear-gradient(155deg, rgba(32, 39, 62, 0.92), rgba(23, 29, 47, 0.8));
  --glass-soft: linear-gradient(155deg, rgba(34, 41, 65, 0.78), rgba(23, 29, 47, 0.62));
  --glass-border: rgba(255, 255, 255, 0.09);

  --shadow-xs: 0 2px 9px -4px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 12px 28px -20px rgba(0, 0, 0, 0.8);
  --shadow-md: 0 24px 56px -38px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 34px 86px -48px rgba(0, 0, 0, 0.95);
}

html[data-theme="dark"] body {
  color: var(--ink);
  background:
    radial-gradient(1100px 720px at 88% -10%, rgba(58, 78, 138, 0.28), transparent 60%),
    radial-gradient(900px 620px at 2% -2%, rgba(87, 61, 130, 0.24), transparent 58%),
    radial-gradient(900px 740px at -4% 104%, rgba(91, 52, 55, 0.18), transparent 60%),
    radial-gradient(1000px 700px at 104% 104%, rgba(32, 86, 79, 0.2), transparent 60%),
    linear-gradient(178deg, #0d1220 0%, #11172a 48%, #0f1424 100%);
}

html[data-theme="dark"] body::after {
  opacity: 0.06;
  mix-blend-mode: soft-light;
}

html[data-theme="dark"] ::selection {
  background: rgba(126, 150, 255, 0.38);
  color: #fff;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(155, 170, 210, 0.28);
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Shell / sidebar ---------- */

html[data-theme="dark"] .sidebar {
  background: linear-gradient(168deg, rgba(28, 34, 54, 0.96), rgba(19, 24, 39, 0.9));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 70px -42px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .sidebar::before {
  background: radial-gradient(circle, rgba(116, 138, 255, 0.13), transparent 68%);
}

html[data-theme="dark"] .sidebar::after {
  background: radial-gradient(circle, rgba(207, 130, 108, 0.1), transparent 68%);
}

html[data-theme="dark"] .brand-card,
html[data-theme="dark"] .user-card {
  color: var(--ink-2);
}

html[data-theme="dark"] .brand-line strong,
html[data-theme="dark"] .user-meta strong {
  color: #e6ebf8;
}

html[data-theme="dark"] .brand-info small,
html[data-theme="dark"] .user-meta small,
html[data-theme="dark"] .nav-label {
  color: #8793aa;
}

html[data-theme="dark"] .nav-item {
  color: #aeb8cf;
}

html[data-theme="dark"] .nav-item .ico {
  color: #8f9bb5;
}

html[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #eef2fb;
}

html[data-theme="dark"] .nav-item.is-active {
  background: linear-gradient(100deg, rgba(108, 138, 255, 0.2), rgba(125, 99, 238, 0.13));
  color: #eef2ff;
  box-shadow: inset 0 0 0 1px rgba(159, 179, 255, 0.16);
}

html[data-theme="dark"] .nav-item.is-active .ico {
  color: #aebeff;
}

html[data-theme="dark"] .nav-item.is-active::before {
  background: #9aacff;
}

html[data-theme="dark"] .nav-badge {
  background: rgba(255, 152, 169, 0.15);
  color: #ffb0bd;
}

html[data-theme="dark"] .nav-sub {
  border-left-color: rgba(164, 178, 216, 0.16);
}

html[data-theme="dark"] .nav-sub-item {
  color: #909cb5;
}

html[data-theme="dark"] .nav-sub-item:hover,
html[data-theme="dark"] .nav-sub-item.is-active {
  color: #d9e1f4;
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .quick-filter {
  color: #aeb8cf;
  border-color: rgba(164, 178, 216, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .quick-filter:hover {
  background: rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .quick-filter b {
  color: #dbe3f5;
}

html[data-theme="dark"] .today-card {
  background: linear-gradient(150deg, rgba(54, 64, 99, 0.58), rgba(31, 38, 61, 0.7));
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .today-card strong,
html[data-theme="dark"] .tc-frac {
  color: #e5eaf8;
}

html[data-theme="dark"] .today-card p {
  color: #929db4;
}

html[data-theme="dark"] .tc-link {
  color: #a9b8ff;
}

html[data-theme="dark"] .user-card {
  border-color: rgba(164, 178, 216, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

/* ---------- Topbar / search / popovers ---------- */

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .topbar.is-scrolled {
  background: transparent !important;
  box-shadow: none;
}

html[data-theme="dark"] .topbar.is-scrolled {
  background: linear-gradient(180deg, rgba(13, 18, 32, 0.9), rgba(13, 18, 32, 0.7)) !important;
  backdrop-filter: blur(18px) saturate(1.2);
}

html[data-theme="dark"] .top-page-title h1 {
  color: #edf1fb;
}

html[data-theme="dark"] .top-page-title p {
  color: #8f9ab1;
}

html[data-theme="dark"] .search-trigger {
  color: #99a5bd;
  border-color: rgba(164, 178, 216, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] .search-trigger:hover {
  background: rgba(255, 255, 255, 0.075);
  color: #cfd8ea;
}

html[data-theme="dark"] .search-trigger kbd {
  color: #8f9ab1;
  border-color: rgba(164, 178, 216, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .icon-btn {
  color: #9aa6bd;
}

html[data-theme="dark"] .icon-btn:hover {
  color: #e1e8f7;
  background: rgba(255, 255, 255, 0.075);
}

html[data-theme="dark"] .top-divider {
  background: rgba(164, 178, 216, 0.14);
}

html[data-theme="dark"] .user-chip {
  color: #c3cde0;
  border-color: rgba(164, 178, 216, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .pop,
html[data-theme="dark"] .palette {
  background: linear-gradient(165deg, #202840, #171d2e);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 30px 70px -36px rgba(0, 0, 0, 0.92);
}

html[data-theme="dark"] .menu-user strong,
html[data-theme="dark"] .pop .menu-item {
  color: #dbe3f4;
}

html[data-theme="dark"] .menu-user small,
html[data-theme="dark"] .pop .menu-item .ico {
  color: #8e9ab3;
}

html[data-theme="dark"] .pop .menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .palette-input {
  border-bottom-color: rgba(164, 178, 216, 0.12);
}

html[data-theme="dark"] .palette-input input {
  color: #e8edf8;
}

html[data-theme="dark"] .palette-input input::placeholder {
  color: #75819a;
}

html[data-theme="dark"] .palette-item {
  color: #b8c2d7;
}

html[data-theme="dark"] .palette-item:hover,
html[data-theme="dark"] .palette-item.is-selected {
  background: rgba(255, 255, 255, 0.06);
  color: #eef2fb;
}

/* ---------- Common glass / cards ---------- */

/* Legacy fallback surfaces exclude the settings module, which owns its tokens. */
html[data-theme="dark"] .glass:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .panel:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .table-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .stat-strip:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .filter-bar:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .settings-section:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .settings-block:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .member-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .team-stat:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .team-admin-panel:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .pool-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .group-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .record-row:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .stop-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .owner-customer:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .task-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .route-stat:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .map-panel:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .stops-panel:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .plan-owner-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .member-admin-row:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .audit-panel:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .audit-sum-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .sales-batches:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .sales-source-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .data-preview-box:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .rule-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .region-stat:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .brand-preview:where(:not(.settings-workspace, .settings-workspace *)) {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background: linear-gradient(155deg, rgba(31, 38, 60, 0.86), rgba(22, 28, 45, 0.74)) !important;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

html[data-theme="dark"] .glass:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .panel:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .table-card:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .filter-bar:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .settings-section:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .settings-block:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .modal:where(:not(.settings-workspace, .settings-workspace *)),
html[data-theme="dark"] .drawer:where(:not(.settings-workspace, .settings-workspace *)) {
  backdrop-filter: blur(22px) saturate(1.1);
}

html[data-theme="dark"] .panel-head h3,
html[data-theme="dark"] .settings-panel-head h2,
html[data-theme="dark"] .modal-head h2,
html[data-theme="dark"] .drawer-head h2,
html[data-theme="dark"] .list-head strong,
html[data-theme="dark"] .table-toolbar strong,
html[data-theme="dark"] .member-name strong,
html[data-theme="dark"] .member-admin-id > strong,
html[data-theme="dark"] .owner-title strong,
html[data-theme="dark"] .stop-body strong,
html[data-theme="dark"] .record-main strong,
html[data-theme="dark"] .task-title,
html[data-theme="dark"] .pool-card h3,
html[data-theme="dark"] .group-card h3,
html[data-theme="dark"] .settings-block-head h3 {
  color: #edf1fb !important;
}

html[data-theme="dark"] .panel-head p,
html[data-theme="dark"] .settings-panel-head p,
html[data-theme="dark"] .table-toolbar span,
html[data-theme="dark"] .list-head span,
html[data-theme="dark"] .settings-block-head p,
html[data-theme="dark"] .form-hint,
html[data-theme="dark"] .page-head p,
html[data-theme="dark"] .modal-head p,
html[data-theme="dark"] .drawer-head p {
  color: #939fb7 !important;
}

html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .drawer-head .eyebrow {
  color: #f1f4fc;
}

/* ---------- Tables ---------- */

html[data-theme="dark"] .table {
  color: #c7d1e4;
}

html[data-theme="dark"] .table thead th {
  color: #a8b4ca;
  background: rgba(255, 255, 255, 0.045);
  border-bottom-color: rgba(164, 178, 216, 0.12);
}

html[data-theme="dark"] .table tbody td {
  border-bottom-color: rgba(164, 178, 216, 0.08);
}

html[data-theme="dark"] .table tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] .table tbody tr.is-selected,
html[data-theme="dark"] .member-admin-row:hover,
html[data-theme="dark"] .pool-card:hover,
html[data-theme="dark"] .group-card:hover {
  background: rgba(125, 151, 255, 0.09) !important;
}

html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .table-foot,
html[data-theme="dark"] .pager {
  border-color: rgba(164, 178, 216, 0.1);
  color: #939fb7;
}

html[data-theme="dark"] .pager-btn {
  border-color: rgba(164, 178, 216, 0.14);
  color: #aeb9cf;
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .pager-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Forms ---------- */

html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] textarea.input {
  color: #dce5f5;
  border-color: rgba(164, 178, 216, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

html[data-theme="dark"] .input::placeholder,
html[data-theme="dark"] textarea.input::placeholder {
  color: #717e98;
}

html[data-theme="dark"] .input:focus,
html[data-theme="dark"] .select:focus,
html[data-theme="dark"] textarea.input:focus {
  border-color: rgba(143, 162, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(108, 138, 255, 0.14);
}

html[data-theme="dark"] select option {
  background: #1b2235;
  color: #dce5f5;
}

html[data-theme="dark"] .input-unit > span,
html[data-theme="dark"] .field > span {
  color: #a4b0c8 !important;
}

html[data-theme="dark"] .field > label {
  color: #a4b0c8;
}

html[data-theme="dark"] .check-line,
html[data-theme="dark"] .switch-line,
html[data-theme="dark"] .field-inline {
  color: #b2bdd2;
}

html[data-theme="dark"] .checkbox {
  border-color: rgba(164, 178, 216, 0.24);
  background: rgba(255, 255, 255, 0.045);
  color: #b6c5ff;
}

html[data-theme="dark"] .checkbox.is-checked {
  background: rgba(108, 138, 255, 0.24);
  border-color: rgba(139, 160, 255, 0.55);
}

/* ---------- Buttons / tabs / badges ---------- */

html[data-theme="dark"] .btn {
  color: #b8c3d8;
  border-color: rgba(164, 178, 216, 0.16);
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] .btn:hover {
  color: #f0f4ff;
  background: rgba(255, 255, 255, 0.085);
}

html[data-theme="dark"] .btn.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(100deg, #6c8aff, #7d63ee);
  box-shadow: 0 10px 24px -16px rgba(90, 114, 255, 0.72);
}

html[data-theme="dark"] .btn.danger {
  color: #ffb1bf;
  border-color: rgba(255, 130, 150, 0.22);
  background: rgba(255, 118, 140, 0.1);
}

html[data-theme="dark"] .seg {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .seg button {
  color: #929fb8;
}

html[data-theme="dark"] .seg button.is-active {
  color: #edf1ff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .visit-tab,
html[data-theme="dark"] .store-tab,
html[data-theme="dark"] .settings-tab {
  color: #97a3bb;
}

html[data-theme="dark"] .store-tab.is-active,
html[data-theme="dark"] .settings-tab.is-active,
html[data-theme="dark"] #visit-tabs button.is-active {
  color: #dbe4ff !important;
  background: linear-gradient(100deg, rgba(108, 138, 255, 0.24), rgba(125, 99, 238, 0.16)) !important;
  box-shadow: inset 0 0 0 1px rgba(159, 179, 255, 0.14) !important;
}

html[data-theme="dark"] #visit-tabs button.is-active::after {
  background: linear-gradient(90deg, #8ea1ff, #b395ff);
}

html[data-theme="dark"] .pill,
html[data-theme="dark"] .tag,
html[data-theme="dark"] .mini-chip,
html[data-theme="dark"] .type-chip {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
}

html[data-theme="dark"] .pill-blue,
html[data-theme="dark"] .pill-violet {
  background: rgba(108, 138, 255, 0.16);
  color: #b9c7ff;
}

html[data-theme="dark"] .pill-green {
  background: rgba(62, 207, 154, 0.14);
  color: #89e6c4;
}

html[data-theme="dark"] .pill-rose,
html[data-theme="dark"] .pill-red {
  background: rgba(249, 123, 145, 0.14);
  color: #ffb5c1;
}

html[data-theme="dark"] .pill-amber {
  background: rgba(245, 178, 71, 0.14);
  color: #ffd38b;
}

html[data-theme="dark"] .pill-gray {
  background: rgba(255, 255, 255, 0.055);
  color: #9ba7bd;
}

html[data-theme="dark"] .panel-tag {
  background: rgba(255, 255, 255, 0.06);
  color: #a9b5cb;
}

/* ---------- Modal / drawer / toast ---------- */

html[data-theme="dark"] .modal-scrim,
html[data-theme="dark"] .drawer-scrim,
html[data-theme="dark"] .palette-scrim {
  background: rgba(5, 8, 16, 0.58);
}

html[data-theme="dark"] .modal {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(168deg, #202840, #171d2e);
  box-shadow: 0 40px 100px -50px rgba(0, 0, 0, 0.95);
}

html[data-theme="dark"] .modal-head h2,
html[data-theme="dark"] .drawer-head h2 {
  color: #f0f4fd;
}

html[data-theme="dark"] .modal-head p,
html[data-theme="dark"] .drawer-head p {
  color: #929eb5;
}

html[data-theme="dark"] .modal-text,
html[data-theme="dark"] .form-hint,
html[data-theme="dark"] .notice-box,
html[data-theme="dark"] .settings-note,
html[data-theme="dark"] .form-hint {
  color: #9ca8c0;
}

html[data-theme="dark"] .notice-box,
html[data-theme="dark"] .settings-note {
  background: rgba(108, 138, 255, 0.08);
  border-color: rgba(108, 138, 255, 0.14);
}

html[data-theme="dark"] .drawer {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(168deg, #202840, #171d2e);
  box-shadow: -30px 0 80px -40px rgba(0, 0, 0, 0.9);
}

html[data-theme="dark"] .drawer-foot,
html[data-theme="dark"] .modal-actions {
  border-color: rgba(164, 178, 216, 0.1);
  background: rgba(10, 14, 24, 0.28);
}

html[data-theme="dark"] .toast {
  color: #e5ebf8;
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(30, 37, 57, 0.96);
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.9);
}

html[data-theme="dark"] .toast .ico {
  color: #9fe6c8;
}

html[data-theme="dark"] .toast.tone-warn .ico {
  color: #ffd08a;
}

/* ---------- Dashboard / charts ---------- */

html[data-theme="dark"] .hero-main,
html[data-theme="dark"] .hero-sla,
html[data-theme="dark"] .hero-side,
html[data-theme="dark"] .board-col,
html[data-theme="dark"] .ai-panel,
html[data-theme="dark"] .team-mini,
html[data-theme="dark"] .activity-panel {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background: linear-gradient(155deg, rgba(32, 39, 62, 0.86), rgba(22, 28, 45, 0.74)) !important;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

html[data-theme="dark"] .hero-number,
html[data-theme="dark"] .hero-copy strong,
html[data-theme="dark"] .hero-sub b,
html[data-theme="dark"] .ai-panel-label,
html[data-theme="dark"] .team-mini-head strong,
html[data-theme="dark"] .activity-list strong {
  color: #edf1fb;
}

html[data-theme="dark"] .hero-sub,
html[data-theme="dark"] .hero-eyebrow,
html[data-theme="dark"] .hero-ai-foot,
html[data-theme="dark"] .board-col .col-head h2,
html[data-theme="dark"] .task-addr,
html[data-theme="dark"] .task-foot {
  color: #97a3ba;
}

html[data-theme="dark"] .task-card {
  color: #d8e1f1;
}

html[data-theme="dark"] .task-card h3,
html[data-theme="dark"] .task-title {
  color: #edf1fb;
}

html[data-theme="dark"] .board-col {
  background: rgba(24, 30, 48, 0.6) !important;
}

html[data-theme="dark"] .col-head {
  border-bottom-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .col-body {
  background: transparent;
}

html[data-theme="dark"] .col-empty {
  color: #7f8ba3;
}

html[data-theme="dark"] .donut-hole {
  background: #1a2136 !important;
}

html[data-theme="dark"] .donut-hole strong {
  color: #edf1fb;
}

html[data-theme="dark"] .donut-hole span,
html[data-theme="dark"] .donut-legend small {
  color: #98a4ba;
}

html[data-theme="dark"] .donut-legend span {
  color: #b5c0d5;
}

html[data-theme="dark"] .progress {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .progress > i {
  background: linear-gradient(90deg, #7f9aff, #a183f5);
}

/* ---------- Visit / route ---------- */

html[data-theme="dark"] .visit-row,
html[data-theme="dark"] .record-row,
html[data-theme="dark"] .plan-owner-card,
html[data-theme="dark"] .stop-card,
html[data-theme="dark"] .owner-customer {
  color: #aeb9cf;
}

html[data-theme="dark"] .visit-row h3,
html[data-theme="dark"] .record-main strong,
html[data-theme="dark"] .stop-body strong,
html[data-theme="dark"] .owner-customer-main > strong {
  color: #e8eefb;
}

html[data-theme="dark"] .visit-row p,
html[data-theme="dark"] .record-main p,
html[data-theme="dark"] .stop-body p,
html[data-theme="dark"] .owner-customer-main > p,
html[data-theme="dark"] .record-meta,
html[data-theme="dark"] .stop-meta {
  color: #95a1b8;
}

html[data-theme="dark"] .plan-owner-card .plan-owner-head {
  border-bottom-color: rgba(164, 178, 216, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .owner-customer {
  background: rgba(255, 255, 255, 0.045) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .owner-customer:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .owner-customer-seq,
html[data-theme="dark"] .stop-seq {
  background: rgba(108, 138, 255, 0.16);
  color: #b9c7ff;
}

html[data-theme="dark"] .stops-head,
html[data-theme="dark"] .map-head {
  border-bottom-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .stops-head h3,
html[data-theme="dark"] .map-head h3 {
  color: #edf1fb;
}

html[data-theme="dark"] .route-inline-actions .input,
html[data-theme="dark"] .route-inline-actions .select {
  background-color: rgba(255, 255, 255, 0.055);
}

html[data-theme="dark"] .route-policy {
  color: #a4b0c4;
  border-color: rgba(108, 138, 255, 0.14);
  background: rgba(108, 138, 255, 0.08);
}

html[data-theme="dark"] .route-policy strong {
  color: #cfd9ee;
}

html[data-theme="dark"] .route-policy p {
  color: #96a3ba;
}

html[data-theme="dark"] .route-note {
  color: #8e9bb2;
}

html[data-theme="dark"] .map-canvas {
  background: #111827;
}

html[data-theme="dark"] #mapBg stop:first-child {
  stop-color: #1b2438;
}

html[data-theme="dark"] #mapBg stop:last-child {
  stop-color: #151c2e;
}

html[data-theme="dark"] .route-bg path {
  stroke: rgba(132, 150, 193, 0.2);
}

html[data-theme="dark"] .grid-line {
  stroke: rgba(132, 150, 193, 0.12);
}

html[data-theme="dark"] .route-river {
  stroke: rgba(76, 112, 154, 0.3);
}

html[data-theme="dark"] .route-parks ellipse {
  fill: rgba(63, 94, 89, 0.24);
}

html[data-theme="dark"] .map-float,
html[data-theme="dark"] .map-brand {
  color: #c0cbe0;
  background: rgba(19, 26, 43, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .map-foot {
  color: #8f9cb4;
  border-top-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .pin-text {
  fill: #fff;
}

/* ---------- Team / stores / settings ---------- */

html[data-theme="dark"] .member-card,
html[data-theme="dark"] .team-admin-panel,
html[data-theme="dark"] .pool-card,
html[data-theme="dark"] .group-card {
  color: #b4bfd4;
}

html[data-theme="dark"] .member-name small,
html[data-theme="dark"] .member-stats small,
html[data-theme="dark"] .member-today,
html[data-theme="dark"] .member-admin-id > small,
html[data-theme="dark"] .member-admin-metrics small,
html[data-theme="dark"] .team-admin-note,
html[data-theme="dark"] .pool-card p,
html[data-theme="dark"] .group-card p {
  color: #8e9ab1 !important;
}

html[data-theme="dark"] .member-stats {
  border-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .member-foot,
html[data-theme="dark"] .member-progress {
  border-top-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .team-filter-chip {
  border-color: rgba(164, 178, 216, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] .team-filter-chip.is-active {
  background: rgba(108, 138, 255, 0.16);
  border-color: rgba(139, 160, 255, 0.3);
}

html[data-theme="dark"] .team-filter-chip > button:first-child {
  color: #a4b0c7;
}

html[data-theme="dark"] .team-filter-chip.is-active > button:first-child {
  color: #dce5ff;
}

html[data-theme="dark"] .team-admin-note,
html[data-theme="dark"] .team-panel-head p {
  color: #8e9ab1;
}

html[data-theme="dark"] .store-tab,
html[data-theme="dark"] .visit-tab {
  color: #8f9bb2;
}

html[data-theme="dark"] .store-filter-bar,
html[data-theme="dark"] .settings-nav {
  background: rgba(24, 30, 48, 0.74);
}

html[data-theme="dark"] .store-dot {
  color: #c4d0e3;
}

html[data-theme="dark"] .cell-main strong,
html[data-theme="dark"] .member-admin-id > strong {
  color: #e6ecf8;
}

html[data-theme="dark"] .settings-nav,
html[data-theme="dark"] .settings-tabs {
  border-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .brand-preview:where(:not(.settings-workspace, .settings-workspace *)) {
  background:
    radial-gradient(300px 220px at 90% 10%, rgba(87, 105, 170, 0.32), transparent 70%),
    linear-gradient(150deg, #202845, #1b2238 65%, #201d34) !important;
}

html[data-theme="dark"] .brand-preview > strong {
  color: #e8eefb;
}

html[data-theme="dark"] .brand-preview > span,
html[data-theme="dark"] .brand-preview-label,
html[data-theme="dark"] .brand-preview-foot {
  color: #93a0b7;
}

html[data-theme="dark"] .brand-preview-rail i {
  background: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] .brand-preview-rail i.active {
  background: #93a7ff;
}

html[data-theme="dark"] .logo-current {
  background: linear-gradient(140deg, #6f8cff, #9b70f3);
}

html[data-theme="dark"] .attribute-group,
html[data-theme="dark"] .attribute-table thead th {
  border-color: rgba(164, 178, 216, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .attribute-head {
  border-bottom-color: rgba(164, 178, 216, 0.1);
}

html[data-theme="dark"] .attr-name {
  color: #dce5f5;
  background: rgba(255, 255, 255, 0.055);
}

html[data-theme="dark"] .region-inventory,
html[data-theme="dark"] .region-update {
  border-color: rgba(164, 178, 216, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .region-inventory summary,
html[data-theme="dark"] .region-update summary {
  color: #b5c0d4;
}

html[data-theme="dark"] .region-province-grid > div {
  border-color: rgba(164, 178, 216, 0.08);
}

html[data-theme="dark"] .region-province-grid strong {
  color: #dce5f5;
}

html[data-theme="dark"] .audit-table td,
html[data-theme="dark"] .audit-table th {
  border-color: rgba(164, 178, 216, 0.08);
}

html[data-theme="dark"] .audit-action {
  color: #b6c4dc;
}

html[data-theme="dark"] .audit-detail {
  color: #8e9ab1;
}

/* ---------- Login ---------- */

html[data-theme="dark"] .login-screen {
  background:
    radial-gradient(900px 600px at 88% 0%, rgba(73, 91, 151, 0.24), transparent 60%),
    radial-gradient(800px 620px at 4% 100%, rgba(91, 61, 123, 0.2), transparent 60%),
    linear-gradient(160deg, #0d1220, #11182a) !important;
}

html[data-theme="dark"] .login-art {
  background:
    radial-gradient(620px 480px at 70% 20%, rgba(107, 129, 222, 0.18), transparent 65%),
    linear-gradient(160deg, rgba(29, 38, 64, 0.72), rgba(18, 24, 41, 0.6)) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .login-copy h1,
html[data-theme="dark"] .login-brand strong,
html[data-theme="dark"] .login-card h2 {
  color: #edf2fc;
}

html[data-theme="dark"] .login-copy p,
html[data-theme="dark"] .login-brand span,
html[data-theme="dark"] .login-card > p.muted,
html[data-theme="dark"] .login-foot {
  color: #929fb6;
}

html[data-theme="dark"] .login-points span {
  color: #aebbd1;
}

html[data-theme="dark"] .demo-login > span {
  color: #8d9ab2;
}

html[data-theme="dark"] .demo-accounts button {
  color: #cbd6e8;
  border-color: rgba(164, 178, 216, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] .demo-accounts button:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .demo-accounts button small {
  color: #8e9ab1;
}

html[data-theme="dark"] .login-foot kbd {
  color: #a1adc2;
  border-color: rgba(164, 178, 216, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Theme toggle feedback ---------- */

html[data-theme="dark"] [data-theme-toggle] {
  color: #c2cddf;
}

html[data-theme="dark"] [data-theme-toggle]:hover {
  color: #ffe0a1;
}

@media (max-width: 1080px) {
  html[data-theme="dark"] .sidebar {
    background: linear-gradient(168deg, rgba(27, 34, 54, 0.98), rgba(17, 22, 37, 0.97));
  }
}

/* Dark contrast fixes for hard-coded light-theme text colors */
html[data-theme="dark"] .view .num {
  color: #e3eaf8 !important;
}

html[data-theme="dark"] .table tbody td,
html[data-theme="dark"] .table tbody td .cell-main,
html[data-theme="dark"] .table tbody td .type-label,
html[data-theme="dark"] .table tbody td .mono,
html[data-theme="dark"] .table tbody td time {
  color: #c8d3e6 !important;
}

html[data-theme="dark"] .table tbody td .num {
  color: #e3eaf8 !important;
}

html[data-theme="dark"] .cell-main small,
html[data-theme="dark"] .store-table small,
html[data-theme="dark"] .member-admin-id > small,
html[data-theme="dark"] .member-admin-metrics small {
  color: #9aa7bd !important;
}

html[data-theme="dark"] .member-admin-metrics strong {
  color: #e3eaf8 !important;
}

html[data-theme="dark"] .mini-chip {
  color: #c4cfe2 !important;
}

html[data-theme="dark"] .mini-chip.mint {
  color: #8fe0c0 !important;
}

html[data-theme="dark"] .mini-chip.violet {
  color: #c9bbff !important;
}

html[data-theme="dark"] .mini-chip.blue {
  color: #b2c8ff !important;
}

html[data-theme="dark"] .type-chip {
  color: #b9c7ff !important;
}

html[data-theme="dark"] .type-label {
  color: #aebbd3 !important;
}

html[data-theme="dark"] .hero-unit,
html[data-theme="dark"] .col-empty,
html[data-theme="dark"] .ai-panel-label,
html[data-theme="dark"] .hero-team,
html[data-theme="dark"] .sla-copy,
html[data-theme="dark"] .sla-ring-inner span,
html[data-theme="dark"] .ai-tag {
  color: #96a3ba !important;
}

html[data-theme="dark"] .activity-list .act-body,
html[data-theme="dark"] .activity-list .act-body p,
html[data-theme="dark"] .activity-list .act-body b,
html[data-theme="dark"] .activity-list .act-body strong,
html[data-theme="dark"] .activity-list .act-body time {
  color: #aeb9ce !important;
}

html[data-theme="dark"] .activity-list .act-body b,
html[data-theme="dark"] .activity-list .act-body strong {
  color: #e3eaf8 !important;
}

html[data-theme="dark"] .map-float strong,
html[data-theme="dark"] .map-float small,
html[data-theme="dark"] .map-brand {
  color: #c4cfe2 !important;
}

html[data-theme="dark"] .map-tip {
  color: #8fe0c0 !important;
}

html[data-theme="dark"] .audit-table td,
html[data-theme="dark"] .audit-table td span,
html[data-theme="dark"] .audit-table td time {
  color: #c8d3e6 !important;
}

html[data-theme="dark"] .audit-action {
  color: #b9c7ff !important;
}

html[data-theme="dark"] .audit-detail {
  color: #96a3ba !important;
}

html[data-theme="dark"] .sales-batch-list strong,
html[data-theme="dark"] .sales-batch-list p,
html[data-theme="dark"] .sales-batch-list small,
html[data-theme="dark"] .sales-empty p,
html[data-theme="dark"] .sales-empty small {
  color: #aeb9ce !important;
}

html[data-theme="dark"] .task-foot .person,
html[data-theme="dark"] .task-foot .person span,
html[data-theme="dark"] .tm-line strong,
html[data-theme="dark"] .tm-main strong,
html[data-theme="dark"] .section-head h2,
html[data-theme="dark"] .hero-ai p,
html[data-theme="dark"] .hero-ai b,
html[data-theme="dark"] .table-person,
html[data-theme="dark"] .table-person span,
html[data-theme="dark"] .group-toolbar strong,
html[data-theme="dark"] .group-empty h3,
html[data-theme="dark"] .rank-name strong,
html[data-theme="dark"] .audit-filter-state strong,
html[data-theme="dark"] .audit-sum-card strong {
  color: #e3eaf8 !important;
}

html[data-theme="dark"] .owner-route-stats b {
  color: #dfe7f8 !important;
}

html[data-theme="dark"] .view .cnt {
  color: #aebfff !important;
}
