/*
  V-SOL-style desk chrome. Loads last.
  --grad stays a solid color. Do not restyle the public customer portal.
*/

:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-600: #3b82f6;
  --blue-700: #2563eb;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-900: #0f172a;
  --green-600: #22c55e;
  --amber-600: #f59e0b;
  --red-600: #ef4444;

  --bg: var(--slate-50);
  --panel: #ffffff;
  --panel-2: var(--slate-50);
  --line: var(--slate-200);
  --text: var(--slate-900);
  --ink: var(--slate-900);
  --muted: var(--slate-500);
  --faint: var(--slate-400);
  --accent: var(--blue-600);
  --accent-2: var(--blue-600);
  --accent-dim: var(--blue-700);
  --accent-soft: var(--blue-50);
  --grad: var(--blue-600);
  --grad-flat: var(--blue-600);
  --ok: var(--green-600);
  --amber: var(--amber-600);
  --warn: var(--red-600);
  --bad: var(--red-600);
  --danger: var(--red-600);
  --card2: var(--slate-50);
  --radius: 4px;
  --shadow: none;
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --button-bg: #2563eb;
  --button-hover: #1d4ed8;
  --danger-fill: #b91c1c;
  --input-bg: #ffffff;
  --nav-active-bg: #e8eef8;
  --nav-active-fg: var(--slate-900);
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --hdr: #ffffff;
  --side: #f7f8fa;
}

:root[data-theme="dark"],
html[data-theme="dark"] {
  --bg: #0c0e12;
  --panel: #14161c;
  --panel-2: #1a1d24;
  --line: #252830;
  --text: #e8edf5;
  --ink: #e8edf5;
  --muted: #a8b0c2;
  --faint: #9098ac;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-dim: #2563eb;
  --accent-soft: rgba(59, 130, 246, .16);
  --grad: #3b82f6;
  --grad-flat: #3b82f6;
  --ok: #4ade80;
  --amber: #fbbf24;
  --warn: #f87171;
  --bad: #f87171;
  --danger: #f87171;
  --card2: #1a1d24;
  --input-bg: #0c0e12;
  --nav-active-bg: #2a3140;
  --nav-active-fg: #f2f5fb;
  --button-bg: #2563eb;
  --button-hover: #1d4ed8;
  --danger-fill: #b91c1c;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .45);
  --hdr: #14161c;
  --side: #14161c;
}

:root[data-theme="light"],
html[data-theme="light"] {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --line: #dbe1ea;
  --text: #1b2330;
  --ink: #1b2330;
  --muted: #5c6b80;
  --faint: #8492a6;
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-dim: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, .10);
  --grad: #2563eb;
  --grad-flat: #2563eb;
  --ok: #16a34a;
  --amber: #d97706;
  --warn: #dc2626;
  --bad: #dc2626;
  --danger: #dc2626;
  --card2: #eef1f6;
  --button-bg: #2563eb;
  --button-hover: #1d4ed8;
  --danger-fill: #b91c1c;
  --input-bg: #ffffff;
  --nav-active-bg: #e7eefc;
  --nav-active-fg: #1b2330;
  --hdr: #ffffff;
  --side: #f7f8fa;
}

body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: var(--sans);
}

header {
  min-height: 48px;
  height: 48px;
  padding: 0 16px !important;
  background: var(--hdr) !important;
  border-bottom: 1px solid var(--line) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  gap: 12px;
  overflow: visible;
}
.brand { gap: 10px; flex: 0 0 auto; min-width: 0; }
.brand .logo-fallback {
  width: 22px;
  height: 22px;
  border-radius: 4px !important;
  background: transparent !important;
  border: 1px solid var(--line);
  color: var(--text) !important;
  font-size: 11px;
  font-weight: 800;
}
.brand .bn h1 {
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase;
  line-height: 1;
}
.brand .tag { display: none !important; }
.ident-bar {
  flex: 0 0 auto;
  padding: 5px 16px;
  background: var(--hdr);
  border-bottom: 1px solid var(--line);
  min-height: 28px;
}
.ident {
  color: var(--muted) !important;
  background: transparent !important;
  border: 0 !important;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 18px;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ident.ident-warn {
  color: var(--amber) !important;
  font-weight: 600;
}

.hdr-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}
.hdr-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  flex: 0 1 200px;
  min-width: 140px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--bg);
  color: var(--muted);
}
.hdr-search [data-icon] { flex: 0 0 auto; }
.hdr-search input {
  flex: 1;
  min-width: 0;
  height: 28px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12.5px !important;
  border-radius: 0 !important;
}
.hdr-search input:focus { box-shadow: none !important; }
header #theme-btn,
header .hdr-ico {
  width: 32px !important;
  min-width: 32px;
  height: 30px !important;
  padding: 0 !important;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  border-radius: 4px !important;
  flex: 0 0 auto;
}
header #theme-btn:hover,
header .hdr-ico:hover {
  background: var(--panel-2) !important;
  color: var(--text) !important;
}
header .hdr-router { display: none !important; }
.hdr-rt-wrap { position: relative; flex: 0 1 auto; min-width: 0; }
header .rt {
  display: flex !important;
  align-items: center;
  gap: 7px;
  height: 30px !important;
  max-width: 220px;
  min-width: 120px;
  padding: 2px 8px 2px 8px !important;
  background: var(--bg) !important;
  color: var(--muted) !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  cursor: pointer;
  flex: 0 1 auto;
  min-width: 0;
}
header .rt:hover { border-color: var(--accent) !important; color: var(--text) !important; filter: none; box-shadow: none !important; }
header .rt .txt { min-width: 0; text-align: left; line-height: 1.15; }
header .rt .txt b {
  color: var(--text);
  display: block;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
header .rt .txt span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
header .rt .chev { color: var(--muted); font-size: 10px; flex: 0 0 auto; }
header .rt .dot,
#rt-menu .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
header .rt .dot.on, #rt-menu .dot.on { background: var(--ok, #2dd482); box-shadow: 0 0 6px var(--ok, #2dd482); }
header .rt .dot.off, #rt-menu .dot.off { background: var(--warn, #ff5d6d); }
header .rt .dot.wait, #rt-menu .dot.wait { background: var(--amber, #f5b83d); }
#rt-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 240px;
  max-width: min(84vw, 320px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg, 0 14px 44px rgba(0,0,0,.44));
  overflow: hidden;
}
#rt-menu .mi {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
}
#rt-menu .mi:last-child { border-bottom: none; }
#rt-menu .mi:hover { background: var(--panel-2); }
#rt-menu .mi .grow { flex: 1; min-width: 0; }
#rt-menu .mi .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rt-menu .mi .meta { font-size: 11px; color: var(--muted); }
#rt-menu .mi.on .nm { color: var(--accent-2, var(--accent)); }
#rt-menu .mi.manage {
  color: var(--accent-2, var(--accent));
  font-weight: 600;
  justify-content: center;
  background: var(--panel-2);
  gap: 8px;
}
header .hdr-logout {
  height: 30px !important;
  padding: 0 12px !important;
  background: transparent !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  font-size: 12.5px !important;
  font-weight: 600;
  gap: 6px;
  display: inline-flex !important;
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

.layout { background: var(--bg); }
.sidebar {
  width: 210px;
  flex-basis: 210px;
  padding: 10px 8px 16px;
  background: var(--side) !important;
  border-right: 1px solid var(--line) !important;
  backdrop-filter: none;
}
.sidebar .grp-head {
  color: var(--text) !important;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  padding: 0 10px;
}
.navgrp .grp-items button {
  width: 100% !important;
  margin: 1px 0 !important;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
}
.navgrp .grp-items button:hover {
  background: transparent !important;
  color: var(--text);
}
.navgrp .grp-items button.active {
  background: var(--nav-active-bg) !important;
  border-color: transparent !important;
  color: var(--nav-active-fg) !important;
  font-weight: 600;
}
.sidebar button.active::before { display: none; }
.me-box { border-top: 1px solid var(--line); padding-top: 8px; }

main { padding: 12px 18px 72px !important; }
#view-ops:before { display: none; }

.form {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  padding: 12px 16px !important;
  gap: 10px 8px !important;
  align-items: end;
}
.form:has(.fld) { align-items: end; }
.form > button {
  justify-self: start;
  align-self: end;
}
.form input, .form select {
  height: 34px;
}
.form button {
  height: 34px !important;
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 0 14px !important;
  white-space: nowrap;
}
.form input.grow { min-width: 160px; }
.login-box .fld,
.form .fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
}
.login-box .fld > span,
.form .fld > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-box .fld { width: 100%; }
.login-box .fld input { width: 100%; box-sizing: border-box; }
.login-box input[aria-invalid="true"] { border-color: var(--warn); }
.form .fld.grow {
  flex: 1 1 160px;
  min-width: 160px;
  grid-column: 1 / -1;
}
.form .fld input,
.form .fld select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ops-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ops-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.ops-head button {
  flex: 0 0 auto;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  align-self: center;
}
.ops-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  margin: 0;
  padding: 0;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  line-height: 1.2;
}
#golive-btn {
  height: 32px !important;
  min-height: 32px !important;
}
.ops-sub {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.panel, .kpi, .stat, .bcard, .rt-card, .modal-box {
  background: var(--bg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
}
.modal-box { background: var(--panel) !important; }
.panel {
  overflow: hidden;
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  margin-bottom: 16px;
}
.panel h2 {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 44px;
  padding: 12px 16px !important;
  background: var(--panel-2) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--line);
  font-size: 13px !important;
  font-family: var(--sans) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-weight: 600 !important;
  line-height: 1.3;
}
.panel h2 > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bcard { background: var(--panel) !important; }
.panel > .scroll { padding: 0 16px 14px; }
.panel > .clientlist { margin: 0 16px; }
.panel > .seg { margin-left: 16px !important; margin-right: 16px !important; }
.panel h2 .h2-label { flex: 0 1 auto; }
.panel h2 > span:not(.h2-label) {
  margin-left: auto;
}
.panel h2 > button:first-of-type {
  margin-left: auto;
}
.panel h2 .h2-tools,
.panel h2 .isp-ctl,
.panel h2 > .chart-total {
  margin-left: auto;
}
.panel h2 .h2-tools {
  flex: 0 1 auto;
  justify-content: flex-end;
}
.panel h2 button,
.panel h2 .refresh {
  height: 32px !important;
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 0 12px !important;
  white-space: nowrap;
}
.panel h2 input {
  height: 32px !important;
  min-width: 140px;
  max-width: 260px;
  flex: 1 1 180px;
}
#kpis {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 0 20px;
}
.kpi-band {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
}
.kpis {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px !important;
  margin: 0;
}
.kpis.kpis-attn {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.kpi {
  min-height: 88px;
  padding: 14px 16px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  border-left: 1px solid var(--line) !important;
  background: var(--panel) !important;
  box-sizing: border-box;
}
button.kpi {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  height: auto !important;
  min-height: 88px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  box-shadow: none !important;
  color: var(--text) !important;
}
.kpi::before, .kpi::after, .stat::after { display: none !important; }
.kpi:hover, .stat:hover {
  transform: none !important;
  box-shadow: none !important;
}
button.kpi:hover,
.kpi-link:hover {
  border-color: var(--accent) !important;
}
.kpi .k, .stat .k, .bcard .k {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--sans);
  font-weight: 600;
}
.kpi .v { color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; }
button.kpi .v { margin-top: 0; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
.kpi.alert { border-color: var(--amber) !important; }
.kpi.alert .v { color: var(--amber) !important; }
.kpi.bad { border-color: var(--bad) !important; }
.kpi.bad .v { color: var(--bad) !important; }
.ops-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 14px;
  margin: 0 0 20px;
  align-items: stretch;
}
.ops-split > .panel {
  min-width: 0;
  height: 100%;
}
.stats {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 14px !important;
  margin: 0 !important;
  align-items: stretch;
}
.stat {
  padding: 14px 16px;
  background: var(--panel) !important;
  border-radius: 8px !important;
  box-sizing: border-box;
  min-height: 104px;
  display: flex;
  flex-direction: column;
}
.stat .v { font-size: 22px; color: var(--text); }
.bar { background: var(--panel-2); }
.bar > span { background: var(--accent); }

th {
  background: var(--panel-2) !important;
  color: var(--muted) !important;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 8px 12px;
}
td { border-bottom-color: var(--line); padding: 8px 12px; vertical-align: middle; }
tr:hover td { background: rgba(255, 255, 255, .03) !important; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
select,
textarea {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  font-family: var(--sans) !important;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):focus,
select:focus,
textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft) !important;
}

button:not(.x):not(.ghost):not(.refresh):not(.menu-btn):not(.mini):not(.segbtn):not(.set-tab):not(.ok):not(.bad):not(.grp-head):not(.hdr-ico):not(.hdr-logout):not(.kpi):not(.rt) {
  background: var(--button-bg) !important;
  color: #fff !important;
  box-shadow: none !important;
  border-radius: 4px !important;
}
button:not(.x):not(.ghost):not(.refresh):not(.menu-btn):not(.mini):not(.segbtn):not(.set-tab):not(.ok):not(.bad):not(.grp-head):not(.hdr-ico):not(.hdr-logout):not(.kpi):not(.rt):hover {
  background: var(--button-hover) !important;
}
button.ghost, button.refresh, button.mini, .range-row button {
  background: transparent !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  box-shadow: none !important;
  border-radius: 4px !important;
}
button.ghost:hover, button.refresh:hover, button.mini:hover, .range-row button:hover {
  background: var(--accent-soft) !important;
}
button.danger, td .mini.danger { background: var(--danger-fill) !important; color: #fff !important; border-color: transparent !important; }

.modal { background: rgba(8, 10, 14, .72) !important; backdrop-filter: blur(4px); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.modal-head .x {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toast { background: var(--panel) !important; color: var(--text); border-color: var(--line); }

#login-screen { background: var(--bg) !important; }
#login-screen.hidden { display: none !important; }
.login-box {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 22px 20px !important;
  gap: 10px !important;
}
.login-title { font-family: var(--sans); letter-spacing: 0; text-transform: none; font-weight: 650; }
.desk-stamp {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .02em;
}
.login-box button {
  background: var(--button-bg) !important;
  color: #fff !important;
  border-radius: 4px !important;
}
.sms-bubble.out {
  background: var(--button-bg) !important;
  color: #fff !important;
}
button.refresh, .refresh {
  font-size: 12px !important;
}

@media (max-width: 860px) {
  header { padding: 0 10px !important; }
  .hdr-search { min-width: 0; width: 120px; }
  .sidebar { background: var(--side) !important; }
  main { padding: 12px 12px 64px !important; }
  .panel h2 { min-height: 38px; }
  header .hdr-logout span:last-child { /* keep label */ }
  #rt-manage-switch {
    max-width: 100% !important;
    width: 100%;
    flex: 1 1 100%;
  }
  #rt-manage-body input,
  #rt-manage-body select,
  #cust-edit-modal .set-in {
    max-width: 100% !important;
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .kpis, .kpis.kpis-attn { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .ops-split { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis, .kpis.kpis-attn, .stats { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .kpi { min-height: 76px; padding: 12px; }
  .kpi .v { font-size: 18px; }
  .hdr-search { display: none; }
}

/* Sidebar tree â€” after the shared button layer */
.sidebar {
  padding: 8px 6px 12px;
  gap: 0;
  overscroll-behavior: contain;
}
.sidebar .navgrp {
  gap: 0;
  margin-bottom: 2px;
}
#sidebar button.grp-head {
  display: flex !important;
  align-items: center;
  height: 28px;
  min-height: 28px !important;
  margin: 2px 0 1px !important;
  padding: 0 8px !important;
  gap: 8px;
  background: transparent !important;
  border: 0 !important;
  border-radius: 6px;
  box-shadow: none !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-family: var(--sans) !important;
  overflow: visible;
  white-space: nowrap;
}
#sidebar button.grp-head .ico {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  opacity: .85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#sidebar button.grp-head .ico svg { width: 15px; height: 15px; display: block; }
#sidebar button.grp-head > span:not(.ico):not(.chev) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#sidebar button.grp-head .chev {
  margin-left: auto;
  font-size: 9px;
  opacity: .55;
  flex: 0 0 auto;
}
#sidebar .grp-items > button {
  display: flex;
  align-items: center;
  height: 32px;
  min-height: 32px !important;
  margin: 1px 8px !important;
  padding: 0 10px !important;
  width: calc(100% - 16px) !important;
  gap: 8px;
  overflow: visible;
  white-space: nowrap;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  color: var(--muted) !important;
  font-size: 13px !important;
  font-weight: 500;
  line-height: 1;
}
#sidebar .grp-items > button .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  opacity: .8;
}
#sidebar .grp-items > button .ico svg {
  width: 16px;
  height: 16px;
  display: block;
}
#sidebar .grp-items > button:hover {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text) !important;
}
#sidebar .grp-items > button.active {
  background: var(--nav-active-bg) !important;
  border-color: transparent !important;
  color: var(--nav-active-fg) !important;
  font-weight: 600;
}
#sidebar .me-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: auto;
  padding: 10px 4px 0;
  border-top: 1px solid var(--line) !important;
  flex: 0 0 auto;
}
#sidebar .me-box .navsep { display: none; }
#sidebar .me-box .me-label {
  padding: 0 6px 6px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
}
#sidebar .me-box > button {
  display: flex;
  height: 30px;
  min-height: 30px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  gap: 8px;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  color: var(--muted) !important;
  font-family: var(--sans);
  font-size: 12px !important;
  font-weight: 500;
  line-height: 1;
}
#sidebar .me-box > button:hover {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text) !important;
}

@media (max-width: 860px) {
  .sidebar { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

html,
body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
body { display: flex; flex-direction: column; }
header {
  position: relative;
  top: auto;
  flex: 0 0 auto;
}
.layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
#sidebar {
  position: relative;
  top: auto;
  align-self: stretch;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
main {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 860px) {
  #sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: auto;
    min-height: 0;
    max-height: none;
    align-self: auto;
    width: 250px;
    transform: translateX(-100%);
    overflow-y: auto;
  }
  body.drawer-open #sidebar { transform: translateX(0); }
  main { width: 100%; height: 100%; }
}

@media (max-height: 620px) {
  #sidebar {
    overflow-y: auto;
    scrollbar-width: none;
  }
  #sidebar::-webkit-scrollbar { display: none; }
}

/* Tabs + table-like client rows */
#cu-dueseg, #ip-dueseg { margin-left: 0 !important; margin-right: 0 !important; }
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  overflow: visible;
  background: transparent;
  min-height: 34px;
}
.seg .segbtn,
.seg button.segbtn {
  flex: 0 0 auto;
  min-width: 72px;
  height: 34px;
  min-height: 34px;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  font-family: var(--sans) !important;
  font-size: 13px !important;
  font-weight: 600;
}
.seg .segbtn.on,
.seg button.segbtn.on {
  background: transparent !important;
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
  font-weight: 700;
}
.clientlist {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.clientrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  min-height: 40px;
}
.clientrow:last-child { border-bottom: 0; }
.clientrow:hover { background: rgba(255, 255, 255, .03); }
.clientrow .grow { flex: 1 1 220px; min-width: 0; }
.clientrow .nm {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.25;
}
.clientrow .facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.clientrow .facts .amt { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.clientrow .facts .due { color: var(--amber); }
.clientrow .facts .over { color: var(--danger); }
.clientrow .facts .cut { color: var(--danger); }
.st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
}
.st::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.st.on { color: var(--ok); }
.st.off { color: var(--danger); }
.clientrow .acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 0;
  align-items: center;
  flex: 1 1 100%;
  width: 100%;
}
.clientrow .acts button {
  min-height: 32px;
  min-width: 0;
  width: auto;
  height: 32px;
  padding: 0 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 4px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  font-weight: 600;
  color: var(--text) !important;
  background: transparent !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
  overflow: visible;
  white-space: nowrap;
}
.clientrow .acts button .ico,
.clientrow .acts button [data-icon] {
  width: 14px;
  height: 14px;
}
.clientrow .acts button .ico svg,
.clientrow .acts button [data-icon] svg {
  width: 14px;
  height: 14px;
}
.clientrow .acts button.ok {
  background: var(--ok) !important;
  color: #052e16 !important;
  border-color: transparent !important;
}
.clientrow .acts button.bad {
  background: var(--danger-fill) !important;
  color: #fff !important;
  border-color: transparent !important;
}
.clientrow .acts button.ghost {
  color: var(--text) !important;
  border-color: var(--accent) !important;
}
.clientlist .empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.devlist {
  min-height: 64px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--input-bg);
  margin-top: 8px;
}
.devrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.devrow:last-child { border-bottom: 0; }
.devrow:hover { background: var(--panel-2); }
.devrow.sel { background: var(--accent-soft); }
.devrow .dv { flex: 1; min-width: 0; }
.devrow .dv b { display: block; font-size: 13px; }
.devrow .dv span { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
@media (max-width: 860px) {
  .clientrow .acts button { min-height: 44px; height: 44px; min-width: 44px; }
  .seg .segbtn { min-height: 44px; height: 44px; }
}

/* 44px hit boxes. Sidebar / header stay visually compact (nav â‰¤36, group â‰¤30). */
#sidebar button.grp-head,
#sidebar .grp-items > button,
#sidebar .me-box > button {
  position: relative;
}
#sidebar button.grp-head::after,
#sidebar .grp-items > button::after,
#sidebar .me-box > button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 44px;
  transform: translateY(-50%);
}
header #theme-btn,
header .hdr-ico,
header .hdr-logout,
header .rt,
.menu-btn {
  position: relative;
}
header #theme-btn::after,
header .hdr-ico::after,
header .hdr-logout::after,
header .rt::after,
.menu-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
header .hdr-logout::after,
header .rt::after {
  width: 100%;
  min-width: 44px;
}
.login-box button {
  min-height: 44px;
}
.login-box input {
  min-height: 44px;
  box-sizing: border-box;
}

@media (pointer: coarse), (max-width: 860px) {
  .clientrow .acts button {
    min-height: 44px !important;
    height: 44px !important;
    min-width: 44px;
  }
  .seg .segbtn,
  .seg button.segbtn {
    min-height: 44px !important;
    height: 44px !important;
  }
  .form button,
  .panel h2 button,
  .panel h2 .refresh {
    height: 44px !important;
    min-height: 44px;
  }
  .form input,
  .form select,
  .panel h2 input {
    height: 44px !important;
    min-height: 44px;
    font-size: 16px !important;
  }
  .login-box input { font-size: 16px; }
  .menu-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    flex-basis: 44px;
  }
  .modal-head .x {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
  .devrow { min-height: 44px; }
  header .rt {
    max-width: min(42vw, 148px);
    min-width: 0;
  }
  header .rt .txt span { display: none !important; }
}

@media (max-width: 520px) {
  header .rt {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    padding: 0 !important;
    gap: 0;
    justify-content: center;
  }
  header .rt .txt,
  header .rt .chev { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .stat:hover,
  .kpi:hover,
  .kpi-link:hover,
  button:active {
    transform: none !important;
  }
  .mappin.act,
  .mappin.sus,
  #fiber-diagram .fd-blink {
    animation: none !important;
  }
  .sidebar .grp-head .chev,
  #sidebar button.grp-head .chev {
    transition: none !important;
  }
  .sidebar,
  .drawer-scrim {
    transition: none !important;
  }
}

/* Browser surfaces + keyboard focus (beats outline:none on :focus). */
html { caret-color: var(--accent); }
::selection { background: var(--button-bg); color: #fff; }
a { text-underline-offset: 2px; }
input, select, textarea { accent-color: var(--accent); }
input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
}
.login-box input:focus,
.form input:focus,
.form select:focus,
.set-in:focus,
.acct-search:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-width: 2px !important;
  outline-style: solid !important;
  outline-color: var(--accent) !important;
  outline-offset: 2px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hdr-search input:focus,
.hdr-search input:focus-visible { outline: none !important; }
.hdr-search:focus-within {
  outline: 2px solid var(--accent) !important;
  outline-offset: 0;
}
#pwa-install {
  position: static !important;
  bottom: auto !important;
  z-index: auto !important;
  height: 30px !important;
  min-height: 30px;
  padding: 0 10px !important;
  font-size: 12px !important;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
@media (max-width: 860px) {
  #pwa-install { display: none !important; }
}
#forcepw-ovl {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(6, 10, 18, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

/* Popups: body must share the header gutter. */
.modal-box { overflow-x: hidden; overscroll-behavior: contain; }
.modal-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-body .fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.modal-body .fld .set-in,
.modal-body .fld .rt-pass-wrap { margin: 0; }
.rt-form-row { align-items: flex-end; }
.rt-pass-wrap {
  display: block;
  position: relative;
}
.rt-pass-wrap .set-in {
  margin: 0;
  padding-right: 64px;
}
.rt-pass-wrap .rt-eye {
  top: 50%;
  transform: translateY(-50%);
}
#view-routers .scroll {
  overflow-x: auto;
  max-width: 100%;
}
#view-routers .rt-table { width: 100%; }
.rt-copy {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  padding: 12px 16px 2px;
  line-height: 1.5;
}
.rt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 16px 16px;
}
.rt-banner {
  display: none;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: rgba(255, 180, 84, .12);
  border: 1px solid var(--amber);
  border-radius: 4px;
  color: var(--amber);
  font-family: var(--sans);
  font-size: 13px;
}
#rt-manage-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rt-block {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  padding: 12px 14px;
}
.rt-block-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  margin: 0 0 10px;
}
#rt-manage-switch {
  max-width: 220px;
  min-width: 140px;
  height: 32px;
  background: var(--input-bg) !important;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12.5px;
}
#rt-manage-page h2 .h2-label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
@media (max-width: 520px) {
  .rt-form-row { flex-direction: column; align-items: stretch; }
  .rt-form-row .fld.port { flex: 1 1 auto; width: 100%; max-width: none; }
}

/* Compact toolbar forms (cut-off row) â€” beat .form { padding: 12px 16px !important } */
.form.form-inline {
  padding: 0 !important;
  grid-template-columns: minmax(88px, 110px) minmax(140px, 180px) repeat(3, max-content);
  align-items: end;
  gap: 10px 10px !important;
}
.form.form-inline .fld { max-width: none; }

/* Wide horizontal Add / Edit client dialogs */
#cu-add-modal .modal-box,
#cust-edit-modal .modal-box,
#ipoe-modal .modal-box {
  width: min(920px, calc(100vw - 32px));
  max-width: 920px;
}
#cu-add-modal .modal-head,
#cust-edit-modal .modal-head,
#ipoe-modal .modal-head {
  padding: 14px 16px;
}
#cu-add-modal .modal-body,
#cust-edit-modal .modal-body,
#ipoe-modal .modal-body {
  padding: 16px;
  gap: 14px;
}
.cu-add-grid,
.cu-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: start;
}
#cu-add-modal .fld,
#cust-edit-modal .fld,
#ipoe-modal .fld {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  line-height: 1.2;
}
#cu-add-modal .fld > span,
#cust-edit-modal .fld > span,
#ipoe-modal .fld > span {
  display: block;
  min-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#cu-add-modal .fld > span em,
#cust-edit-modal .fld > span em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  opacity: .75;
}
#cu-add-modal .fld .set-in,
#cust-edit-modal .fld .set-in,
#ipoe-modal .fld .set-in,
#cu-add-modal .fld input,
#cu-add-modal .fld select,
#cust-edit-modal .fld input,
#cust-edit-modal .fld select,
#ipoe-modal .fld input,
#ipoe-modal .fld select {
  margin: 0;
  height: 36px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 11px;
  font-size: 13px;
  line-height: 1.2;
  appearance: none;
  -webkit-appearance: none;
}
#cu-add-modal .fld select.set-in,
#cust-edit-modal .fld select.set-in {
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23a8b0c2' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
#cust-edit-modal .fld textarea.set-in {
  height: auto;
  min-height: 64px;
  padding: 8px 11px;
  line-height: 1.4;
  resize: vertical;
}
#cu-add-modal .cu-span-2,
#cust-edit-modal .cu-span-2,
#ipoe-modal .cu-span-2 { grid-column: span 2; }
#cu-add-modal .cu-span-3,
#cust-edit-modal .cu-span-3,
#ipoe-modal .cu-span-3 { grid-column: 1 / -1; }
.cu-add-hint {
  margin: 0;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}
.cu-add-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 -16px -16px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}
.cu-add-foot .login-err,
.cu-add-foot #ce-msg {
  margin-right: auto;
  min-height: 16px;
}
#cust-edit-modal #ce-pppoe-fields,
#cust-edit-modal #ce-ipoe-fields {
  display: contents;
}
@media (max-width: 900px) {
  .cu-add-grid,
  .cu-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #cu-add-modal .cu-span-2,
  #cust-edit-modal .cu-span-2 { grid-column: auto; }
  #cu-add-modal .cu-span-3,
  #cust-edit-modal .cu-span-3 { grid-column: 1 / -1; }
  .form.form-inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form.form-inline > button { justify-self: start; }
}
@media (max-width: 860px) {
  #cu-add-modal.modal,
  #cust-edit-modal.modal,
  #ipoe-modal.modal { align-items: flex-end; padding: 0; }
  #cu-add-modal .modal-box,
  #cust-edit-modal .modal-box,
  #ipoe-modal .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
  }
  .cu-add-grid,
  .cu-form-grid { grid-template-columns: 1fr; }
  #cu-add-modal .cu-span-2,
  #cu-add-modal .cu-span-3,
  #cust-edit-modal .cu-span-2,
  #cust-edit-modal .cu-span-3 { grid-column: auto; }
  .form.form-inline { grid-template-columns: 1fr 1fr; }
}

/* Settings: tabbed panel, sticky save. Class names match index.html. */
#settings-modal .settings-box {
  width: min(720px, calc(100vw - 32px));
  max-width: 720px;
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#settings-modal .modal-head {
  flex: 0 0 auto;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
}
#settings-modal .set-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  flex: 0 0 auto;
  min-height: 36px;
  height: 36px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--panel);
}
#settings-modal .set-tabs::-webkit-scrollbar { display: none; }
#settings-modal .set-tab {
  flex: 0 0 auto;
  height: 36px;
  min-height: 36px;
  padding: 0 12px !important;
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  font-family: var(--sans) !important;
  font-size: 12.5px !important;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  filter: none !important;
}
#settings-modal .set-tab:hover {
  color: var(--text) !important;
  background: transparent !important;
  filter: none !important;
}
#settings-modal .set-tab.on {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
  font-weight: 700;
  background: transparent !important;
}
#settings-modal .set-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
#settings-modal .set-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px 14px;
}
#settings-modal .set-pane { display: none; }
#settings-modal .set-pane.on { display: block; }
#settings-modal .set-pane > .set-grp:first-child { margin-top: 0; }
#settings-modal .fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
#settings-modal .fld .set-in,
#settings-modal .set-in {
  margin: 0;
  height: 34px;
  box-sizing: border-box;
  padding: 0 11px;
}
#settings-modal textarea.set-in {
  height: auto;
  min-height: 54px;
  padding: 8px 11px;
  line-height: 1.4;
  resize: vertical;
}
#settings-modal .set-hint {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--muted);
  margin: 4px 0 8px;
  line-height: 1.45;
}
#settings-modal .set-hint code {
  font-family: var(--mono);
  color: var(--accent);
  word-break: break-all;
}
#settings-modal .set-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  margin: 6px 0;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}
#settings-modal .set-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}
#settings-modal .set-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
#settings-modal .set-row > .fld { flex: 1 1 140px; min-width: 0; }
#settings-modal .qr-btn { height: 32px; min-height: 32px; padding: 0 10px !important; font-size: 12px; }
#settings-modal .set-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
#settings-modal .set-foot-hint {
  margin-right: auto;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
#settings-modal .set-foot button { width: auto; height: 34px; min-height: 34px; padding: 0 16px; }
#settings-modal #dryrun-log,
#settings-modal #maint-archives {
  display: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  font-size: 12px;
  max-height: 240px;
  overflow: auto;
}
#settings-modal #dryrun-log { font-family: var(--mono); font-size: 11.5px; }
#settings-modal #receipt-preview,
#settings-modal #maint-stats,
#settings-modal #license-box {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
@media (max-width: 860px) {
  #settings-modal.modal { align-items: flex-end; padding: 0; }
  #settings-modal .settings-box {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 12px 12px 0 0 !important;
  }
  #settings-modal .set-tabs { height: auto; min-height: 36px; flex-wrap: wrap; }
  #settings-modal .set-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  #settings-modal .set-foot button { height: 44px; min-height: 44px; }
  #settings-modal .fld .set-in:not(textarea),
  #settings-modal input.set-in,
  #settings-modal select.set-in {
    height: 44px;
    min-height: 44px;
    font-size: 16px;
  }
}

/* MIKCON DESK POLISH
   Flat billing-desk scan. Solids only. Does not restate --grad and does not touch the customer portal. */

.panel,
.kpi:not(.alert):not(.bad) {
  border-color: color-mix(in srgb, var(--text) 18%, var(--line)) !important;
}
.panel h2 {
  border-bottom-color: color-mix(in srgb, var(--text) 32%, var(--line));
}

#sidebar .grp-items > button.active,
.sidebar .navgrp .grp-items button.active {
  position: relative;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
#sidebar .grp-items > button.active::before,
.sidebar .navgrp .grp-items button.active::before {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  box-shadow: none;
  pointer-events: none;
  transform: none;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .panel h2,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .due-board,
html[data-theme="dark"] .due-row,
html[data-theme="dark"] .remit-kpi,
html[data-theme="dark"] .wall-note,
html[data-theme="dark"] details.plan-drop,
html[data-theme="dark"] details.plan-drop > summary,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .panel h2,
:root[data-theme="dark"] .kpi,
:root[data-theme="dark"] .due-board,
:root[data-theme="dark"] .due-row,
:root[data-theme="dark"] .remit-kpi,
:root[data-theme="dark"] .wall-note,
:root[data-theme="dark"] details.plan-drop,
:root[data-theme="dark"] details.plan-drop > summary {
  color: var(--text);
}
html[data-theme="dark"] .kpi .k,
html[data-theme="dark"] .due-row .when,
html[data-theme="dark"] .remit-kpi .k,
:root[data-theme="dark"] .kpi .k,
:root[data-theme="dark"] .due-row .when,
:root[data-theme="dark"] .remit-kpi .k {
  color: var(--muted);
}

details.plan-drop {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}
details.plan-drop > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
details.plan-drop > summary::-webkit-details-marker { display: none; }
details.plan-drop > summary::marker { content: ""; }
details.plan-drop > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: -2px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
}
details.plan-drop[open] > summary {
  border-bottom: 1px solid var(--line);
}
details.plan-drop[open] > summary::before {
  margin-top: 2px;
  border-right-color: var(--accent);
  border-bottom-color: var(--accent);
  transform: rotate(45deg);
}
details.plan-drop > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
details.plan-drop > :not(summary) {
  margin: 8px 12px;
  color: var(--text);
}
.panel > details.plan-drop {
  margin-left: 16px;
  margin-right: 16px;
}

.due-board {
  display: flex;
  flex-direction: column;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  overflow: hidden;
}
.due-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}
.due-row:last-child { border-bottom: 0; }
.due-row .who {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  overflow-wrap: anywhere;
}
.due-row .when {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
}
.due-row .when.bad,
.due-row.bad .when { color: var(--bad); }
.due-row .when.ok,
.due-row.ok .when { color: var(--ok); }
.panel > .due-board {
  margin-left: 16px;
  margin-right: 16px;
}

#view-paywall,
#view-collect {
  color: var(--text);
  min-width: 0;
}

.remit-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.remit-kpi {
  box-sizing: border-box;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
}
.remit-kpi .k {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.remit-kpi .v {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.remit-kpi.ok .v,
.remit-kpi .v.ok { color: var(--ok); }
.remit-kpi.bad .v,
.remit-kpi .v.bad { color: var(--bad); }
.panel > .remit-kpis {
  margin-left: 16px;
  margin-right: 16px;
}
@media (max-width: 720px) {
  .remit-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

.wall-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.wall-note.bad { border-color: var(--bad); }
.wall-note.ok { border-color: var(--ok); }
.panel > .wall-note {
  margin-left: 16px;
  margin-right: 16px;
}

:is(#view-paywall, #view-collect, #view-ops, #view-billing) button.remit-kpi,
:is(#view-paywall, #view-collect, #view-ops, #view-billing) .remit-kpis > button {
  background: var(--panel) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 72px;
  font-family: var(--sans);
  text-align: left;
}
:is(#view-paywall, #view-collect, #view-ops, #view-billing) button.remit-kpi:hover,
:is(#view-paywall, #view-collect, #view-ops, #view-billing) .remit-kpis > button:hover {
  background: var(--panel) !important;
  border-color: var(--accent) !important;
}
:is(#view-paywall, #view-collect, #view-ops, #view-billing) button.due-row,
:is(#view-paywall, #view-collect, #view-ops, #view-billing) .due-board > button {
  display: flex;
  background: transparent !important;
  color: var(--text) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 44px;
  width: 100%;
  padding: 8px 12px !important;
  font: inherit;
  text-align: left;
}
:is(#view-paywall, #view-collect, #view-ops, #view-billing) button.due-row:last-child,
:is(#view-paywall, #view-collect, #view-ops, #view-billing) .due-board > button:last-child {
  border-bottom: 0 !important;
}
:is(#view-paywall, #view-collect, #view-ops, #view-billing) button.due-row:hover,
:is(#view-paywall, #view-collect, #view-ops, #view-billing) .due-board > button:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel)) !important;
  color: var(--text) !important;
}

@media (prefers-reduced-motion: reduce) {
  details.plan-drop > summary::before,
  #sidebar .grp-items > button.active::before,
  .sidebar .navgrp .grp-items button.active::before {
    transition: none;
  }
}

