/* Theme overrides load after the base and batch styles. */
body[data-theme="dark"]{color-scheme:dark}

body[data-theme="light"]{
  color-scheme:light;
  --bg:#f5f2e9;--bg-soft:#eee9dc;--panel:#ffffff;--panel-2:#faf8f1;--panel-3:#f1ecdf;
  --line:rgba(122,94,26,.18);--line-strong:rgba(122,94,26,.32);
  --text:#201b12;--muted:#625b4e;--muted-2:#746c5e;
  --gold:#9d7415;--gold-deep:#76540d;--gold-soft:#7d5a10;
  --success:#267a50;--danger:#a43737;--shadow:0 18px 50px rgba(58,45,20,.12);
  background:#f3efe5 !important;
  background-image:radial-gradient(circle at 14% 8%,rgba(181,142,46,.10),transparent 27%),linear-gradient(180deg,#faf8f2 0%,#f0ebdf 100%) !important;
  color:var(--text) !important;
}
body[data-theme="light"] .login-wrap{background:transparent !important}
body[data-theme="light"] .topbar{border-bottom-color:rgba(122,94,26,.18)}
body[data-theme="light"] .brand-title,
body[data-theme="light"] h1,
body[data-theme="light"] h2,
body[data-theme="light"] h3,
body[data-theme="light"] .section-title h2,
body[data-theme="light"] .workflow-guide h2,
body[data-theme="light"] .card h2,
body[data-theme="light"] .card h3,
body[data-theme="light"] .batch-title,
body[data-theme="light"] .cycle-title,
body[data-theme="light"] .queue-label{text-shadow:none}

body[data-theme="light"] .nav a{color:#332b1e}
body[data-theme="light"] .nav-pill{
  color:#2d261b !important;border-color:rgba(94,74,30,.14);background:rgba(255,255,255,.62);
  box-shadow:0 5px 18px rgba(60,47,21,.06)
}
body[data-theme="light"] .nav-pill:hover,
body[data-theme="light"] .nav-pill.active{color:#5f450d !important;background:rgba(184,143,43,.10);border-color:rgba(157,116,21,.34)}
body[data-theme="light"] .nav-pill.nav-signout{color:#514a3f !important}
body[data-theme="light"] .nav-more-menu{background:#fffdf8;border-color:rgba(122,94,26,.20);box-shadow:0 18px 50px rgba(61,46,17,.15)}
body[data-theme="light"] .nav-more-menu a:hover{background:rgba(157,116,21,.08)}

body[data-theme="light"] .card,
body[data-theme="light"] .login-card,
body[data-theme="light"] .table-wrap,
body[data-theme="light"] .cycle-accordion,
body[data-theme="light"] .batch-accordion,
body[data-theme="light"] .batch-cycle-accordion,
body[data-theme="light"] .secondary-section,
body[data-theme="light"] .stage,
body[data-theme="light"] .mini,
body[data-theme="light"] .queue-card,
body[data-theme="light"] .page-flow{
  background:#fffdf8 !important;color:#201b12 !important;border-color:rgba(112,87,27,.16) !important;box-shadow:var(--shadow) !important
}
body[data-theme="light"] .card.gold{
  background:radial-gradient(circle at 20% 18%,rgba(222,188,94,.22),transparent 28%),linear-gradient(145deg,#fff8da,#f6e7ad 55%,#fffdf8) !important;
  border-color:rgba(157,116,21,.28) !important
}
body[data-theme="light"] .batch-accordion>summary,
body[data-theme="light"] .cycle-accordion summary{background:rgba(157,116,21,.035) !important}
body[data-theme="light"] .batch-cycle-row,
body[data-theme="light"] .batch-empty-state,
body[data-theme="light"] .approval-banner,
body[data-theme="light"] .approval-login-alert,
body[data-theme="light"] .approval-preview-banner,
body[data-theme="light"] .historical-editor,
body[data-theme="light"] .batch-payment-form{
  background:#faf6eb !important;color:#201b12 !important;border-color:rgba(112,87,27,.16) !important
}

body[data-theme="light"] .muted,
body[data-theme="light"] .note,
body[data-theme="light"] .hero p,
body[data-theme="light"] .workflow-guide p,
body[data-theme="light"] .queue-hint,
body[data-theme="light"] .batch-subtitle,
body[data-theme="light"] .brand-caption,
body[data-theme="light"] .brand-sub,
body[data-theme="light"] .kpi .hint,
body[data-theme="light"] .stage .stage-name,
body[data-theme="light"] .field small,
body[data-theme="light"] .field .muted,
body[data-theme="light"] .payment-notification-details,
body[data-theme="light"] .request-note,
body[data-theme="light"] .start-cycle-note{color:#625b4e !important;opacity:1}
body[data-theme="light"] .batch-cycle-row strong,
body[data-theme="light"] .mini .v,
body[data-theme="light"] .stage .stage-date,
body[data-theme="light"] .payment-notification-amount{color:#2b2418 !important}

body[data-theme="light"] .field label{color:#765816}
body[data-theme="light"] .field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body[data-theme="light"] .field select,
body[data-theme="light"] .field textarea{
  background:#ffffff !important;color:#211c13 !important;border-color:rgba(122,94,26,.32) !important
}
body[data-theme="light"] .field input:focus,
body[data-theme="light"] .field select:focus,
body[data-theme="light"] .field textarea:focus{
  background:#ffffff !important;border-color:#a67b18 !important;box-shadow:0 0 0 3px rgba(166,123,24,.12) !important
}
body[data-theme="light"] .field input::placeholder,
body[data-theme="light"] .field textarea::placeholder{color:#8b8375}
body[data-theme="light"] label.card:has(input[type="radio"]){background:#fffdf8 !important;border-color:rgba(122,94,26,.20) !important}
body[data-theme="light"] label.card:has(input[type="radio"]:checked){background:#fbf0c9 !important;border-color:#a77b18 !important}

body[data-theme="light"] th{background:#f2ead7;color:#705315}
body[data-theme="light"] td{border-bottom-color:rgba(82,67,37,.09)}
body[data-theme="light"] .divider{background:rgba(82,67,37,.12)}
body[data-theme="light"] .alert{background:#fff4cd;color:#6a5014;border-color:rgba(157,116,21,.26)}
body[data-theme="light"] .alert.good{background:#e6f5ec;color:#246d48;border-color:rgba(38,122,80,.22)}
body[data-theme="light"] .alert.bad{background:#fdeaea;color:#8f3030;border-color:rgba(164,55,55,.22)}
body[data-theme="light"] .footer{color:#746c5e}
body[data-theme="light"] .market-strip{background:#fffaf0;border-color:rgba(157,116,21,.24)}
body[data-theme="light"] .market-values{color:#2f281c}
body[data-theme="light"] .market-source{color:#6c6458}
body[data-theme="light"] .impersonation{background:#fff0b8;color:#5b4513}

.settings-secret-state{display:inline-flex;align-items:center;gap:7px;margin-top:7px;font-size:11px;color:var(--muted)}
.settings-secret-dot{width:7px;height:7px;border-radius:50%;background:var(--success)}
.settings-danger-card{border-color:rgba(255,133,133,.35) !important}
body[data-theme="light"] .settings-danger-card{border-color:rgba(164,55,55,.28) !important}
.settings-counts{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.settings-counts span{padding:6px 9px;border:1px solid var(--line);border-radius:999px;font-size:11px;color:var(--muted)}


/* Minimal client dashboard and secure portal messaging */
.nav-count{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--gold);color:#15120b;font-size:10px;font-weight:800;margin-left:4px}
.dashboard-hero{align-items:center}
.dashboard-status{display:flex;justify-content:space-between;align-items:center;gap:22px;padding:20px 22px;margin:0 0 18px;border:1px solid var(--line);border-radius:18px;background:linear-gradient(145deg,rgba(15,15,14,.98),rgba(8,8,8,.96));box-shadow:var(--shadow)}
.dashboard-status h2{margin:4px 0 6px;color:var(--gold)}
.dashboard-status p{margin:0;color:var(--muted)}
.dashboard-status.action{border-color:rgba(216,175,68,.38)}
.dashboard-status.waiting{border-color:rgba(216,175,68,.24)}
.dashboard-status.clear{border-color:rgba(70,170,115,.28)}
.dashboard-summary{margin-bottom:18px}
.dashboard-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:4px 0 24px}
.dashboard-action{display:flex;flex-direction:column;gap:5px;padding:15px 16px;border:1px solid var(--line);border-radius:14px;background:rgba(8,8,8,.72);text-decoration:none;color:var(--text);transition:.16s ease}
.dashboard-action:hover{transform:translateY(-1px);border-color:var(--line-strong);background:rgba(216,175,68,.06)}
.dashboard-action strong{color:var(--gold)}
.dashboard-action span{font-size:12px;color:var(--muted)}
.dashboard-updates{display:grid;gap:8px;margin-bottom:18px}
.dashboard-update{display:grid;grid-template-columns:12px 1fr auto;gap:12px;align-items:center;padding:13px 15px;border:1px solid var(--line);border-radius:13px;background:rgba(8,8,8,.62);text-decoration:none;color:var(--text)}
.dashboard-update:hover{border-color:var(--line-strong);background:rgba(216,175,68,.05)}
.dashboard-update-dot{width:8px;height:8px;border-radius:50%;background:var(--gold);box-shadow:0 0 0 4px rgba(216,175,68,.10)}
.dashboard-update p{margin:3px 0 0;color:var(--muted);font-size:12px}
.dashboard-update small{color:var(--muted);white-space:nowrap}
.dashboard-empty{padding:18px;margin-bottom:18px}
body[data-role="client"] .kpi .label,
body[data-role="client"][data-route="client-dashboard"] .dashboard-update strong,
body[data-role="client"][data-route="client-dashboard"] .dashboard-empty strong{color:var(--gold)}

.message-inbox{display:grid;gap:9px}
.message-inbox-row{display:grid;grid-template-columns:minmax(220px,.8fr) minmax(260px,1.5fr) auto;gap:18px;align-items:center;padding:16px 18px;border:1px solid var(--line);border-radius:14px;background:rgba(8,8,8,.7);text-decoration:none;color:var(--text)}
.message-inbox-row:hover{border-color:var(--line-strong);background:rgba(216,175,68,.05)}
.message-inbox-row.unread{border-color:rgba(216,175,68,.34);background:linear-gradient(90deg,rgba(216,175,68,.07),rgba(8,8,8,.7))}
.message-inbox-preview{display:flex;flex-direction:column;gap:4px;min-width:0}
.message-inbox-preview span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted)}
.message-inbox-preview small{color:var(--muted)}
.message-unread{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;border-radius:999px;background:var(--gold);color:#17130c;font-weight:800}
.message-thread{display:flex;flex-direction:column;gap:10px;min-height:180px;max-height:520px;overflow:auto;padding:18px;border:1px solid var(--line);border-radius:18px;background:rgba(5,5,5,.55);margin-bottom:14px}
.message-bubble{max-width:76%;padding:12px 14px;border-radius:15px;border:1px solid var(--line);background:rgba(26,26,24,.96)}
.message-bubble.mine{align-self:flex-end;background:linear-gradient(145deg,rgba(83,64,18,.82),rgba(43,34,13,.88));border-color:rgba(216,175,68,.30)}
.message-bubble.theirs{align-self:flex-start}
.message-meta{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:6px}
.message-body{line-height:1.55}
.message-empty{text-align:center;color:var(--muted);padding:38px 16px}
.message-compose label{display:block;color:var(--gold);font-weight:700;margin-bottom:8px}
.message-compose textarea{width:100%;resize:vertical}
.message-compose-foot{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:12px}
.message-compose-foot small{color:var(--muted)}
.empty-state{text-align:center;padding:34px}

body[data-theme="light"] .dashboard-status,
body[data-theme="light"] .dashboard-action,
body[data-theme="light"] .dashboard-update,
body[data-theme="light"] .message-inbox-row,
body[data-theme="light"] .message-thread,
body[data-theme="light"] .message-bubble{background:#fffdf8 !important;border-color:rgba(112,87,27,.17) !important;color:#201b12 !important}
body[data-theme="light"] .message-bubble.mine{background:#fbf0c9 !important;border-color:rgba(157,116,21,.28) !important}
body[data-theme="light"] .dashboard-status p,
body[data-theme="light"] .dashboard-action span,
body[data-theme="light"] .dashboard-update p,
body[data-theme="light"] .message-meta,
body[data-theme="light"] .message-compose-foot small,
body[data-theme="light"] .message-inbox-preview span,
body[data-theme="light"] .message-inbox-preview small{color:#625b4e !important}

@media(max-width:1050px){
  .dashboard-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .message-inbox-row{grid-template-columns:1fr auto}
  .message-inbox-preview{grid-column:1/2}
}
@media(max-width:700px){
  .dashboard-status{align-items:flex-start;flex-direction:column}
  .dashboard-actions{grid-template-columns:1fr}
  .dashboard-update{grid-template-columns:12px 1fr}
  .dashboard-update small{grid-column:2}
  body[data-role="client"][data-route="client-dashboard"] .section-title{margin:18px 0 10px}
  body[data-role="client"][data-route="client-dashboard"] .dashboard-updates,
  body[data-role="client"][data-route="client-dashboard"] .dashboard-empty{margin-bottom:14px}
  body[data-role="client"][data-route="client-dashboard"] .dashboard-status{margin-bottom:14px}
  body[data-role="client"][data-route="client-dashboard"] .dashboard-summary{gap:12px;margin-bottom:14px}
  .message-bubble{max-width:92%}
  .message-compose-foot{align-items:flex-start;flex-direction:column}
}


/* Client cycle timing */
.batch-cycle-title-line{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.cycle-expected-date{font-size:12px;font-weight:500;color:var(--muted)}
body[data-theme="light"] .cycle-expected-date{color:#625b4e !important}
