/* Shared admin palette inspired by the customer balance proposal. No business-state inference. */
html:root {
  color-scheme: dark;
  --bg-primary:#101a2e; --bg-secondary:#192840; --bg-tertiary:#243957; --bg-card:#162239;
  --text-primary:#edf4ff; --text-secondary:#b9c9e3; --text-muted:#9bacc8;
  --border:#354b6c; --border-color:var(--border); --border-active:#82aaff;
  --accent:#8fb4ff; --primary:var(--accent); --accent-cyan:#8bcaff;
  --accent-glow:#4b83ff38; --accent-cyan-glow:#63b9ff29;
  --accent-gradient:linear-gradient(145deg,#1260f5,#0743d0);
  --success:#7ce5a0; --success-glow:#3bcd792b; --success-bg:#163d30;
  --warning:#ffd27a; --warning-text:#ffd27a; --warning-bg:#44371e; --warning-border:#7e6430; --warning-glow:#f9ba3726;
  --error:#ffa4b0; --error-glow:#ed4d652e; --error-bg:#482435;
  --credit:#d4a5ff; --credit-bg:#392b53;
  --theme-page:radial-gradient(ellipse at 15% 0%,#1c3760 0%,transparent 55%),linear-gradient(145deg,#101a2e,#152037);
  --theme-card:linear-gradient(155deg,#1b2a44,#162239);
  --theme-nav:linear-gradient(110deg,#1c2e4b,#162239);
  --theme-control:linear-gradient(180deg,#2a3c5b,#1f304d);
  --theme-control-hover:linear-gradient(180deg,#324b72,#273c5d);
  --theme-soft:#203451; --theme-selected:#244775;
  --theme-shadow:0 3px 12px #020b202b; --theme-control-shadow:0 2px 3px #020b203d;
  --theme-focus:#a4c5ff; --theme-heading:#f0f5ff;
}
html.light-theme {
  color-scheme:light;
  --bg-primary:#edf4ff; --bg-secondary:#f5f8ff; --bg-tertiary:#e1ecff; --bg-card:#fff;
  --text-primary:#182344; --text-secondary:#455779; --text-muted:#596b8a;
  --border:#cbd9f1; --border-color:var(--border); --border-active:#4d83ed;
  --accent:#0649df; --primary:var(--accent); --accent-cyan:#075ac0;
  --accent-glow:#0755ed22; --accent-cyan-glow:#0874de1a;
  --success:#17652e; --success-glow:#38af6224; --success-bg:#d9f5da;
  --warning:#87530b; --warning-text:#87530b; --warning-bg:#fff0ca; --warning-border:#e6c47b; --warning-glow:#e6b74a22;
  --error:#b11b2c; --error-glow:#df3e5421; --error-bg:#ffe3e6;
  --credit:#7923af; --credit-bg:#f0e3ff;
  --theme-page:radial-gradient(ellipse at 12% 0%,#dceaff 0%,transparent 55%),linear-gradient(145deg,#edf4ff,#f7faff);
  --theme-card:linear-gradient(155deg,#fff,#f9fbff);
  --theme-nav:linear-gradient(110deg,#fff,#edf4ff);
  --theme-control:linear-gradient(180deg,#fff,#e8effc);
  --theme-control-hover:linear-gradient(180deg,#f5f9ff,#dbe8ff);
  --theme-soft:#eef4ff; --theme-selected:#d8e9ff;
  --theme-shadow:0 3px 12px #2f62ac12; --theme-control-shadow:0 2px 3px #234d8e1a;
  --theme-focus:#0649df; --theme-heading:#132149;
}
/* Specificity keeps these variables ahead of the retained app's light-theme rules. */
html:root {background:var(--bg-primary)}
html:root body {background:var(--theme-page);background-attachment:fixed;color:var(--text-primary)}
html body :is(.card,.glass-panel,.stat-card,.login-card){background:var(--theme-card);border-color:var(--border);box-shadow:var(--theme-shadow)}
html body :is(.card,.glass-panel):hover{border-color:var(--border-active)}
html body :is(h1,h2,h3){color:var(--theme-heading)}
html body .nav {background:var(--theme-nav);border-bottom-color:var(--border);box-shadow:0 2px 9px #2558a30c}
html body .admin-navigation .an-items {background:var(--bg-card);border-color:var(--border);box-shadow:var(--theme-shadow)}
html body .admin-navigation .an-items a:hover {background:var(--theme-soft);color:var(--accent)}
html body :is(.btn-secondary,.ac-button,.id-panel button,.cd-panel button,.customer-invoice-timeline button,.cbl button,.cbl a.cbl-action,.admin-navigation .an-top,.admin-navigation summary){background:var(--theme-control);color:var(--text-primary);border-color:var(--border);box-shadow:var(--theme-control-shadow)}
html body :is(.btn-secondary,.ac-button,.id-panel button,.cd-panel button,.customer-invoice-timeline button,.cbl button,.cbl a.cbl-action,.admin-navigation .an-top,.admin-navigation summary):hover:not(:disabled){background:var(--theme-control-hover);border-color:var(--border-active);color:var(--text-primary)}
html body :is(.btn-primary,.ac-primary,.nav-link.active,.cbl-tabs button[aria-selected=true],.admin-navigation [aria-current=page],.admin-navigation details[data-active=true]>summary,.admin-navigation .an-mode [aria-pressed=true]) {
  background:var(--accent-gradient)!important;color:#fff!important;border-color:#0648d6!important;box-shadow:0 3px 9px #0755e929;border-radius:var(--radius-sm,6px);
}
html body :is(.btn-primary,.ac-primary):hover:not(:disabled){background:linear-gradient(145deg,#0756e8,#0036b6)!important;color:#fff!important}
/* Switch text and surface colors together; interpolate only decorative hover effects. */
html body :is(.card,.glass-panel,.stat-card,.nav-link,.btn,.btn-secondary,.admin-navigation a,.admin-navigation summary){transition-property:box-shadow,border-color,transform}
html body .btn-success{background:linear-gradient(145deg,#20833d,#14632d);color:#fff}
html body .btn-danger{background:linear-gradient(145deg,#d33249,#ad1b30);color:#fff}
html body .btn-warning{background:linear-gradient(145deg,#996114,#7b4908);color:#fff}
html body :is(.input-field,.form-input,.search-bar){background-color:var(--bg-card)!important;color:var(--text-primary)!important;border-color:var(--border)!important}
html body :is(.input-field,.form-input):focus,html body .search-bar:focus-within{border-color:var(--border-active)!important;box-shadow:0 0 0 3px var(--accent-glow)}
html body :is(input,select,textarea){accent-color:var(--accent)}
html body :is(input,textarea)::placeholder{color:var(--text-muted);opacity:1}
html body :is(a,button,input,select,textarea,summary):focus-visible{outline:3px solid var(--theme-focus);outline-offset:3px}
html body :is(.table-container,.cbl-grid,.id-panel,.cd-panel){border-color:var(--border)}
html body th{background:var(--theme-soft);color:var(--text-secondary);border-bottom-color:var(--border)}
html body td{border-bottom-color:var(--border)}
html body tr:hover td{background:color-mix(in srgb,var(--theme-selected) 45%,transparent)}
html body tr[aria-selected=true],html body tr[aria-selected=true]:hover td{background:var(--theme-selected)}
html body :is(.badge-released,.cbl-badge[data-tone=green]){color:var(--success);background:var(--success-bg);border-color:color-mix(in srgb,var(--success) 28%,transparent)}
html body :is(.badge-partially,.badge-abandoned,.cbl-badge[data-tone=amber]){color:var(--warning-text);background:var(--warning-bg);border-color:var(--warning-border)}
html body :is(.badge-overdue,.cbl-badge[data-tone=red]){color:var(--error);background:var(--error-bg);border-color:color-mix(in srgb,var(--error) 28%,transparent)}
html body :is(.badge-open,.cbl-badge[data-tone=blue]){color:var(--accent);background:var(--theme-selected);border-color:var(--border-active)}
html body :is(.badge-cancelled,.cbl-badge:not([data-tone]),.cbl-badge[data-tone='']){color:var(--text-secondary);background:var(--theme-soft)}
html body .cbl-badge {font-weight:650}
html body :is(.modal-content,dialog){color:var(--text-primary);border-color:var(--border)}
html body dialog{background:var(--theme-card);box-shadow:var(--theme-shadow)}
html body .event-node.highlight .event-marker{background:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}
/* The balance page uses the same shared colors with the proposal's individual summary cards. */
html body .cbl-summary{gap:12px;border:0;background:transparent;overflow:visible}
html body .cbl-summary>div:nth-child(n){border:1px solid var(--border);border-radius:10px;background:var(--theme-card);box-shadow:var(--theme-shadow)}
html body .cbl-summary>div:last-child{border:1px solid var(--border)}
html body .cbl-summary>div:has(>.cbl-danger){background:linear-gradient(140deg,var(--error-bg),color-mix(in srgb,var(--error-bg) 65%,var(--bg-card)));border-color:color-mix(in srgb,var(--error) 20%,var(--border))}
html body .cbl-summary>div:has(>.cbl-success){background:var(--success-bg)}
html body .cbl-summary strong{font-weight:750}
html body .cbl-list{background:var(--theme-card)}
html body .cbl-detail{background:linear-gradient(155deg,var(--bg-card),var(--theme-soft))}
html body .cbl-tabs{border-bottom:0;gap:10px;margin-bottom:18px;align-items:center}
html body .cbl-tabs button{padding:10px 14px;border:1px solid var(--border);border-radius:7px;font-weight:600}
html body .cbl-tabs button[aria-selected=true]{border-bottom-width:1px}
html body .cbl button.cbl-select,html body .cbl button.cbl-select:hover{background:transparent;color:inherit;border:0;box-shadow:none}
html body .cbl :is(.cbl-paid,.cbl-success){color:var(--success);font-weight:650}
html body .cbl :is(.cbl-credit,.cbl-fee){color:var(--credit);font-weight:650}
html body .cbl-danger{color:var(--error)}
html body .cbl-breakdown .cbl-total{background:var(--theme-soft);padding:10px 8px;border-radius:5px}
html body .cbl-detail details{border-color:var(--border)}
html body .cbl-detail summary{color:var(--theme-heading)}
html body :is(.cbl-proposal,.cbl-management,.cbl-billing){background:var(--theme-card);border-color:var(--border)}
html body .customer-invoice-timeline button[aria-pressed=true]{background:var(--theme-selected);color:var(--accent);outline-color:var(--accent)}
@media(max-width:600px){html body .cbl-summary>div:nth-child(n){border:1px solid var(--border)}html body .cbl-tabs button{padding:9px 11px}}
@media(prefers-reduced-motion:reduce){html body .badge-overdue{animation:none}html body :is(.btn,.card,.glass-panel){transition:none}}
@media print{html:root,html.light-theme{--text-primary:#111;--text-secondary:#333;--bg-primary:#fff;--bg-card:#fff;--border:#aaa;--theme-card:#fff;--theme-soft:#f3f3f3;--theme-page:#fff;--theme-selected:#eee}html body{background:#fff}html body :is(.card,.glass-panel,.cbl-summary>div){box-shadow:none}}
html body .modal-content{background:var(--theme-card)!important}
/* Standalone first-party log/camera documents embedded by the admin application. */
html[data-application-colors-frame] body :is(form,.log,.card){background:var(--theme-card);border-color:var(--border)}
html[data-application-colors-frame] body :is(p,small,summary){color:var(--text-secondary)}
html[data-application-colors-frame] body a{color:var(--accent)}
html[data-application-colors-frame] body :is(button,input,select){background:var(--theme-control);color:var(--text-primary);border-color:var(--border)}
html[data-application-colors-frame] body :is(button.primary,button[aria-selected=true],button[aria-current=page]){background:var(--accent-gradient);color:#fff;border-color:#0648d6}
html[data-application-colors-frame] body .table-wrap{border-color:var(--border)}
