:root {
  --bg: #f4f5f9; --panel: #ffffff; --panel2: #f8f9fc;
  --border: #e8eaf1; --border2: #d9dcea;
  --text: #2d3436; --muted: #7f8c9b;
  --primary: #7138d4; --primary-dark: #5b25b8; --primary-soft: #f0e8ff;
  --yellow: #fbb016; --yellow-soft: #fef4d8;
  --green: #2ecc71; --green-soft: #e3f9ed;
  --red: #e74c3c; --red-soft: #fdeae8;
  --blue: #3498db; --blue-soft: #e7f3fc;
  --navy: #ffffff; --navy2: #17213b;
  --sidebar-w: 168px; --rail-w: 50px; --header-h: 56px;
  --radius: 8px; --shadow: 0 1px 3px rgba(16,24,40,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 19px; } h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---- shell: navy icon rail + white menu column ---- */
.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: calc(var(--rail-w) + var(--sidebar-w)); display: flex; z-index: 40; }
.rail { width: var(--rail-w); background: var(--navy2); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; }
.rail .logo-cube { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #4834d4); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 10px; }
.rail a { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: #8f93ab; text-decoration: none; }
.rail a:hover { background: rgba(255,255,255,.07); color: #fff; }
.rail a.active { background: var(--primary); color: #fff; }
.menu { width: var(--sidebar-w); background: var(--navy); color: #6b7280; padding: 14px 9px 24px; overflow-y: auto; border-right: 1px solid var(--border); }
.menu .brand { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 9px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--text); }
.menu .brand .dot { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), #4834d4); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.menu .brand b { font-size: 14.5px; display: block; line-height: 1.1; }
.menu .brand small { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .6px; }
.menu .yellow-bar { height: 3px; background: var(--yellow); border-radius: 3px; margin: 0 6px 14px; }
.nav .group { margin: 14px 8px 5px; font-size: 9px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #9aa1ad; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin: 1px 0; border-radius: 5px; color: #687180; font-weight: 500; font-size: 12px; text-decoration: none; }
.nav a:hover { background: #f5f0ff; color: var(--primary); }
.nav button.navgrp-head { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 8px; margin: 1px 0; border: 0; border-radius: 5px; background: transparent; color: #687180; font: inherit; font-size: 12px; font-weight: 500; text-align: left; cursor: pointer; }
.nav button.navgrp-head:hover { background: #f5f0ff; color: var(--primary); }
.nav a.active { background: #f0e7ff; color: var(--primary); font-weight: 700; }
.nav .ico { width: 18px; text-align: center; font-size: 13.5px; }
.nav .count { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }

.main { margin-left: calc(var(--rail-w) + var(--sidebar-w)); }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--header-h); background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.topbar .crumb { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.topbar .crumb .ico { color: var(--primary); }
.topbar .crumb .sep { color: var(--muted); font-weight: 400; font-size: 12px; }
.chips { display: flex; gap: 8px; align-items: center; }
.chip { background: var(--yellow); color: #4a3503; font-weight: 700; font-size: 11.5px; padding: 5px 12px; border-radius: 16px; border: none; cursor: default; white-space: nowrap; }
.chip.plain { background: var(--panel2); color: var(--muted); border: 1px solid var(--border); }
.userchip { display: flex; align-items: center; gap: 8px; }
.userchip .who { text-align: right; line-height: 1.2; }
.userchip .who b { font-size: 12.5px; display: block; }
.userchip .who span { font-size: 10.5px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #4834d4); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 13px; }
.page { padding: 18px 20px 40px; }

/* ---- reference dashboard ---- */
.dashboard-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.dashboard-actions .btn { border-radius: 5px; padding: 7px 11px; font-size: 11px; }
.dashboard-actions .btn::first-letter { font-size: 12px; }
.reports-card { background: #fff; border: 1px solid var(--border); border-radius: 7px; box-shadow: var(--shadow); padding: 16px; }
.reports-card > h2 { margin-bottom: 12px; font-size: 15px; }
.report-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.report-tabs button { padding: 0 0 9px; color: #9aa1ad; background: transparent; border: 0; border-bottom: 2px solid transparent; font: inherit; font-size: 11px; cursor: pointer; }
.report-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.report-tabs button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.report-chart-card { min-width: 0; border: 1px solid #f0f1f4; border-radius: 7px; padding: 12px; }
.report-chart-card h3 { font-size: 12px; margin-bottom: 10px; }
.report-chart { display: grid; gap: 9px; }
.report-chart-row { display: grid; grid-template-columns: minmax(100px, 1.2fr) minmax(40px, 2fr) minmax(65px, .7fr); gap: 8px; align-items: center; font-size: 10px; }
.report-chart-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.report-chart-track { height: 9px; overflow: hidden; border-radius: 8px; background: var(--panel2); }
.report-chart-bar { display: block; height: 100%; min-width: 0; border-radius: inherit; }
.report-chart-value { overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.report-summary { display: grid; gap: 10px; }
.report-summary > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.report-summary span, .report-note { color: var(--muted); }
.report-note { margin: 0 0 12px; font-size: 11px; }
.report-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #f4c7c7; border-radius: 7px; color: var(--red); }
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 255px; gap: 12px; }
.subscriber-panel, .pie-panel { border: 1px solid #f0f1f4; border-radius: 7px; padding: 12px; }
.subscriber-panel h3, .pie-panel h3 { font-size: 12px; margin-bottom: 10px; }
.subscriber-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.subscriber-stat { min-height: 70px; border-radius: 5px; padding: 9px 10px; border: 1px solid transparent; }
.subscriber-stat .stat-label { font-size: 10px; margin-bottom: 6px; }
.subscriber-stat .stat-value { font-size: 17px; font-weight: 800; line-height: 1; }
.subscriber-stat .stat-note { margin-top: 5px; color: #8b93a1; font-size: 9px; }
.subscriber-stat.purple { background: #f4edff; color: #7138d4; }
.subscriber-stat.green { background: #e9fbf3; color: #22a66a; }
.subscriber-stat.mint { background: #e5faf5; color: #149b83; }
.subscriber-stat.red { background: #fff0f3; color: #df5573; }
.subscriber-stat.yellow { background: #fff8db; color: #c79b12; }
.subscriber-stat.blue { background: #edf7ff; color: #3288c6; }
.subscriber-stat.gray { background: #f2f4f7; color: #667085; }
.pie-panel { display: flex; flex-direction: column; }
.pie-chart { width: 145px; height: 145px; border-radius: 50%; margin: 24px auto 15px; background: conic-gradient(#3699e6 0 28%, #4bc88b 28% 48%, #ec5e91 48% 63%, #f3bc3e 63% 70%, #8d96a8 70% 84%, #7138d4 84% 92%, #dce3ed 92% 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }
.pie-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; font-size: 9px; color: #7d8695; }
.pie-legend span::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--dot); margin-right: 4px; }

/* ---- action bar (purple buttons row, Zal-style) ---- */
.actionbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.actionbar .spacer { flex: 1; }

/* ---- cards & grids ---- */
.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.k3 { grid-template-columns: repeat(3, 1fr); }
.grid.k2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card h2 .right { float: right; }
.kpi { display: flex; align-items: center; gap: 13px; }
.kpi .ic { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi .value { font-size: 21px; font-weight: 800; line-height: 1.15; }
.kpi .sub { margin-top: 2px; font-size: 11.5px; }
.ic.purple { background: var(--primary-soft); color: var(--primary); }
.ic.green { background: var(--green-soft); color: var(--green); }
.ic.red { background: var(--red-soft); color: var(--red); }
.ic.yellow { background: var(--yellow-soft); color: #b87d05; }
.ic.blue { background: var(--blue-soft); color: var(--blue); }
/* aliases used by older pages */
.ic.amber { background: var(--yellow-soft); color: #b87d05; }
.ic.violet { background: var(--primary-soft); color: var(--primary); }
.ic.teal { background: #e0f5f3; color: #0d9488; }
.badge.violet { background: var(--primary-soft); color: var(--primary); }

/* ---- tables: DataTables-like ---- */
.tablewrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel2); flex-wrap: wrap; }
.table-toolbar .entries { font-size: 12px; color: var(--muted); white-space: nowrap; }
.table-toolbar .entries select { width: auto; padding: 3px 6px; font-size: 12px; margin: 0 4px; }
.table-toolbar .tsearch { position: relative; }
.table-toolbar .tsearch input { width: 220px; padding: 6px 10px 6px 28px; font-size: 12.5px; }
.table-toolbar .tsearch::before { content: '🔍'; position: absolute; left: 8px; top: 6px; font-size: 11px; opacity: .5; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 9px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-bottom: 2px solid var(--border2); background: var(--panel); white-space: nowrap; font-weight: 700; }
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--primary); }
td { padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:nth-child(even) { background: var(--panel2); }
tbody tr:hover { background: #eef0f8; }
tr.clickable { cursor: pointer; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 12px; color: var(--muted); }
.pager { display: flex; gap: 4px; }
.pager button { min-width: 28px; height: 28px; border: 1px solid var(--border2); background: var(--panel); border-radius: 6px; font-size: 12px; color: var(--text); cursor: pointer; }
.pager button.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---- badges (soft pastel pills) ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: #1d9d57; }
.badge.red { background: var(--red-soft); color: #cf3727; }
.badge.amber { background: var(--yellow-soft); color: #b87d05; }
.badge.gray { background: #eef0f6; color: var(--muted); }
.badge.purple { background: var(--primary-soft); color: var(--primary); }
.badge.blue { background: var(--blue-soft); color: #2577b5; }
.sig { font-weight: 700; font-size: 12.5px; }
.sig.good { color: var(--green); } .sig.warn { color: #b87d05; } .sig.bad { color: var(--red); }

/* ---- forms & buttons ---- */
input, select, textarea { background: #fff; border: 1px solid var(--border2); color: var(--text); border-radius: 7px; padding: 8px 12px; font-size: 13.5px; width: 100%; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin: 10px 0 5px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff; border: none; border-radius: 7px; padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--border2); }
.btn.secondary:hover { background: #eceef5; }
.btn.yellow { background: var(--yellow); color: #4a3503; }
.btn.yellow:hover { background: #e89e0b; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #cf3727; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #27ae60; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 130px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 2px solid var(--border2); flex-wrap: wrap; background: var(--panel); border-radius: var(--radius) var(--radius) 0 0; padding: 6px 8px 0; }
.tabs a, .tabs button { padding: 9px 14px; color: var(--muted); border: 0; border-bottom: 3px solid transparent; background: transparent; font-family: inherit; font-weight: 600; font-size: 13px; margin-bottom: -2px; cursor: pointer; }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(30,30,45,.5); display: flex; align-items: flex-start; justify-content: center; padding: 50px 20px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 580px; padding: 22px; box-shadow: 0 20px 60px rgba(16,24,40,.3); }
.modal h2 { margin-bottom: 4px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy2) 0%, #2d2d4a 55%, var(--primary) 160%); }
.login-card { width: 390px; background: #fff; border-radius: 14px; padding: 34px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.login-card .logo { border: none; height: auto; justify-content: center; margin-bottom: 6px; padding: 0; font-size: 21px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.login-card .logo .dot { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #4834d4); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.login-card p.hint { text-align: center; margin-top: 16px; }
.error-box { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 8px; margin-top: 12px; font-size: 13px; }

/* ---- misc ---- */
.toast { position: fixed; bottom: 24px; right: 24px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--green); padding: 12px 18px; border-radius: 8px; z-index: 100; box-shadow: 0 10px 34px rgba(16,24,40,.2); font-weight: 600; font-size: 13px; }
.toast.err { border-left-color: var(--red); }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 10px 4px 24px; }
.bar-chart .bar { flex: 1; background: linear-gradient(180deg, var(--primary), #4834d4); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; }
.bar-chart .bar span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 9px 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 36px; font-size: 13px; }
.pon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pon-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--panel2); }
.pon-card b { font-size: 13.5px; }
.pon-card .meter { height: 6px; background: #e8edf5; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.pon-card .meter i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.alertline { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.alertline:last-child { border-bottom: none; }
.portpill { display: inline-block; background: var(--panel2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.portpill .pill-remove { border: 0; background: transparent; color: var(--red); padding: 0 0 0 4px; font: inherit; cursor: pointer; }
.impbanner { background: var(--yellow-soft); color: #8a6206; padding: 7px 20px; font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
@media (max-width: 1000px) { .grid.k4 { grid-template-columns: repeat(2,1fr); } .grid.k3 { grid-template-columns: 1fr; } .sidebar .menu { display: none; } .main { margin-left: var(--rail-w); } }
@media (max-width: 760px) { .report-grid { grid-template-columns: 1fr; } .report-tabs { gap: 12px; overflow-x: auto; } .report-chart-row { grid-template-columns: minmax(85px, 1.2fr) minmax(30px, 2fr) minmax(58px, .7fr); gap: 5px; } }

/* Original MeshBill-inspired workspace styling for the Z-Radius product. */
:root {
  --bg: #f3f6f8;
  --panel: #fff;
  --panel2: #f7f9fb;
  --border: #e4e9ee;
  --border2: #d7dfe6;
  --text: #263746;
  --muted: #71808e;
  --primary: #187cad;
  --primary-dark: #126990;
  --primary-soft: #e7f3f8;
  --blue: #2586b7;
  --blue-soft: #e8f4fa;
  --navy: #fff;
  --navy2: #eff4f4;
  --sidebar-w: 256px;
  --rail-w: 0px;
  --header-h: 76px;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(34, 55, 70, .07);
}
body { background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(37, 134, 183, .28);
  outline-offset: 2px;
}

.sidebar {
  width: var(--sidebar-w);
  background: #edf3f2;
  box-shadow: 2px 0 12px rgba(33, 54, 68, .06);
  transition: transform .22s ease;
}
.rail { display: none; }
.menu {
  width: 100%;
  padding: 18px 12px 24px;
  background: #edf3f2;
  border-right: 1px solid #e1e9e7;
  color: var(--text);
}
.menu .brand {
  min-height: 58px;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  gap: 11px;
}
.menu .brand .dot {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #1d82b3, #49a58c);
  box-shadow: 0 3px 8px rgba(24, 124, 173, .18);
  font-size: 13px;
  font-weight: 700;
}
.menu .brand b { font-size: 15px; color: #233745; }
.menu .brand small { display: block; margin-top: 3px; font-size: 10px; letter-spacing: .2px; color: #768894; }
.menu .yellow-bar { display: none; }
.nav { display: grid; gap: 3px; }
.nav .navgrp { margin: 0; }
.nav a, .nav button.navgrp-head {
  min-height: 42px;
  padding: 9px 11px;
  margin: 0;
  gap: 11px;
  border-radius: 10px;
  color: #485968;
  font-size: 13px;
  font-weight: 550;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav a:hover, .nav button.navgrp-head:hover {
  background: rgba(255,255,255,.72);
  color: var(--primary);
}
.nav a.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 7px rgba(33, 54, 68, .08);
}
.nav button.navgrp-head.open {
  background: rgba(255,255,255,.86);
  color: var(--primary);
  font-weight: 700;
}
.nav .ico { width: 22px; font-size: 15px; color: #7d9eaa; }
.nav a.active .ico, .nav button.navgrp-head.open .ico { color: var(--primary); }
.nav .navgrp-body { margin: 2px 0 7px 17px; padding-left: 9px; border-left: 2px solid #c9e2e8; }
.nav a.sub { min-height: 36px; padding: 7px 9px; font-size: 12px; }
.nav a.sub .ico { width: 15px; font-size: 12px; }
.nav .count { background: #e5f1f5; color: #377c95; }

.main { min-height: 100vh; margin-left: var(--sidebar-w); }
.topbar {
  height: var(--header-h);
  padding: 0 26px;
  gap: 20px;
  box-shadow: 0 2px 7px rgba(34, 55, 70, .06);
}
.topbar .crumb { min-width: 170px; gap: 10px; color: #334858; font-size: 16px; }
.topbar .crumb .ico { color: var(--primary); font-size: 16px; }
.userchip { gap: 10px; }
.userchip .who b { color: #334858; font-size: 12px; }
.userchip .who span { color: #82909b; font-size: 10px; }
.avatar { background: linear-gradient(145deg, #2586b7, #52a88f); }
.iconbtn {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #536572;
  cursor: pointer;
}
.iconbtn:hover { background: #f1f6f8; border-color: var(--border); color: var(--primary); }
.iconbtn .dotbadge { position: absolute; top: 0; right: 0; }
.chipsel, #langSel {
  width: auto;
  max-width: 138px;
  padding: 7px 9px;
  border-color: var(--border);
  border-radius: 9px;
  color: #4c5f6e;
  font-size: 12px;
  background-color: #fff;
}
.chip { background: #e9f4f7; color: #3a7388; border-radius: 999px; }
.chip.plain { background: #fff; }
.btn { border-radius: 9px; }
.btn.secondary { background: #fff; border-color: var(--border2); }
.btn.secondary:hover { background: #f4f8fa; }
.page { max-width: 1600px; margin: 0 auto; padding: 28px 32px 48px; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 22px; }
.page-intro .eyebrow { margin-bottom: 6px; color: #758b97; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
.page-intro h1 { margin-bottom: 5px; color: #277da4; font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.page-intro .muted { font-size: 13px; }
.dashboard-actions { gap: 9px; margin-bottom: 18px; }
.dashboard-actions .btn { padding: 9px 13px; border-radius: 9px; font-size: 12px; }
.card, .reports-card, .tablewrap {
  background: #fff;
  border-color: var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.reports-card { padding: 20px; }
.reports-card > h2 { margin-bottom: 16px; color: #314858; font-size: 16px; }
.report-tabs { gap: 22px; margin-bottom: 18px; }
.report-tabs button { padding-bottom: 10px; font-size: 12px; }
.report-layout { grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 16px; }
.subscriber-panel, .pie-panel, .report-chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px;
}
.subscriber-panel h3, .pie-panel h3 { margin-bottom: 14px; color: #445967; font-size: 13px; }
.subscriber-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.subscriber-stat {
  position: relative;
  min-width: 0;
  min-height: 104px;
  padding: 14px;
  overflow: hidden;
  background: #fff !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(34, 55, 70, .045);
}
.subscriber-stat::after {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary-soft);
  content: "";
}
.subscriber-stat.green::after, .subscriber-stat.mint::after { background: #e3f7ef; }
.subscriber-stat.red::after { background: #fdebed; }
.subscriber-stat.yellow::after { background: #fff5dc; }
.subscriber-stat.blue::after { background: #e6f3fb; }
.subscriber-stat.gray::after { background: #eff2f5; }
.subscriber-stat .stat-label { position: relative; z-index: 1; margin: 0 34px 11px 0; color: #687986; font-size: 11px; line-height: 1.35; }
.subscriber-stat .stat-value { position: relative; z-index: 1; color: #273846; font-size: 23px; font-weight: 750; line-height: 1.1; }
.subscriber-stat .stat-note { position: relative; z-index: 1; margin-top: 6px; color: #86939d; font-size: 10px; }
.subscriber-stat.purple, .subscriber-stat.green, .subscriber-stat.mint, .subscriber-stat.red, .subscriber-stat.yellow, .subscriber-stat.blue, .subscriber-stat.gray { color: #273846; }
.pie-panel { align-self: start; }
.pie-chart { width: 158px; height: 158px; margin: 26px auto 18px; }
.pie-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pie-legend span { color: #687986; font-size: 11px; }
.report-grid { gap: 14px; }
.report-chart-card h3 { color: #445967; font-size: 13px; }
.tablewrap { overflow-x: auto; }
.table-toolbar { padding: 13px 16px; background: #fafcfd; }
th { padding: 12px 15px; background: #f6f9fa; border-bottom-width: 1px; color: #647783; font-size: 10px; }
td { padding: 11px 15px; }
tbody tr:nth-child(even) { background: #fbfcfd; }
tbody tr:hover { background: #f0f7f8; }
input, select, textarea { border-radius: 9px; border-color: var(--border2); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tabs { gap: 6px; padding: 8px 10px 0; border-radius: 12px 12px 0 0; }
.tabs a, .tabs button { padding: 10px 14px; }
.overlay { backdrop-filter: blur(3px); }
.modal { border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 22px 60px rgba(27, 49, 64, .22); }
.toast { border-radius: 11px; }

.login-wrap { padding: 24px; background: linear-gradient(145deg, #eef5f5, #f7f9fb 58%, #e8f2f6); }
.login-card { width: min(420px, 100%); border: 1px solid var(--border); border-radius: 16px; padding: 34px; box-shadow: 0 16px 42px rgba(34, 55, 70, .12); }
.login-card .logo { justify-content: flex-start; color: #263d4c; font-size: 22px; }
.login-card .logo .dot { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(145deg, #187cad, #49a58c); }
.login-card p.hint { text-align: left; }
.login-card label { color: #415564; }
.login-card input:not([type=checkbox]) { min-height: 42px; }

html.dark {
  --bg: #111a22;
  --panel: #17232d;
  --panel2: #1d2b36;
  --border: #2a3a46;
  --border2: #3a4b57;
  --text: #d9e4ea;
  --muted: #9aabb5;
  --primary: #55a9d0;
  --primary-dark: #328bb7;
  --primary-soft: #213b49;
  --navy2: #17232d;
  color-scheme: dark;
}
html.dark body, html.dark .sidebar, html.dark .menu { background: var(--bg); color: var(--text); }
html.dark .menu .brand b, html.dark .topbar .crumb, html.dark .userchip .who b,
html.dark .subscriber-stat .stat-value, html.dark .reports-card > h2 { color: var(--text); }
html.dark .nav a, html.dark .nav button.navgrp-head { color: #b8c5cc; }
html.dark .nav a.active, html.dark .nav button.navgrp-head.open, html.dark .navgrp-body,
html.dark .subscriber-panel, html.dark .pie-panel, html.dark .report-chart-card,
html.dark .subscriber-stat, html.dark .reports-card, html.dark .card,
html.dark .tablewrap, html.dark .modal, html.dark input, html.dark select, html.dark textarea {
  background-color: var(--panel);
  color: var(--text);
  border-color: var(--border);
}
html.dark .nav a.active, html.dark .nav button.navgrp-head.open { background: #203440; }
html.dark th { background: #1d2b36; color: #b8c5cc; }
html.dark tbody tr:nth-child(even) { background: #192630; }
html.dark tbody tr:hover { background: #203541; }
html.dark .subscriber-stat .stat-label, html.dark .subscriber-stat .stat-note,
html.dark .pie-legend span { color: #a7b6be; }

@media (max-width: 1200px) {
  .topbar { padding: 0 18px; }
  .topbar .crumb { min-width: 120px; }
  .userchip { gap: 6px; }
  .userchip .who { display: none; }
  .page { padding: 24px 24px 40px; }
}
@media (max-width: 1000px) {
  .sidebar { width: min(290px, calc(100vw - 52px)); transform: translateX(-105%); }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar .menu { display: block; }
  .main { margin-left: 0; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 35; display: none; background: rgba(21, 38, 48, .36); }
  body.nav-open .nav-backdrop { display: block; }
  .topbar { padding: 0 18px; }
  .navToggle { display: inline-flex; }
  .report-layout { grid-template-columns: minmax(0, 1fr) 240px; }
}
@media (min-width: 1001px) {
  .nav-backdrop, .navToggle { display: none; }
}
@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .crumb { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
  .userchip { gap: 3px; }
  .userchip .chip, .userchip #ispSel, .userchip #branchSel, .userchip #fsBtn, .userchip #themeBtn { display: none; }
  .userchip #langSel { max-width: 62px; padding: 6px; }
  .userchip .avatar { width: 30px; height: 30px; }
  .userchip #logoutBtn { padding: 5px 8px; font-size: 11px; }
  .page { padding: 20px 14px 32px; }
  .page-intro { margin-bottom: 17px; }
  .page-intro h1 { font-size: 21px; }
  .dashboard-actions .btn { flex: 1 1 auto; justify-content: center; }
  .report-layout { grid-template-columns: 1fr; }
  .subscriber-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: 1fr; }
  .report-tabs { gap: 14px; overflow-x: auto; }
  .report-tabs button { white-space: nowrap; }
  .page > .toolbar { align-items: stretch; }
  .table-toolbar .tsearch, .table-toolbar .tsearch input { width: 100%; }
}
@media (max-width: 420px) {
  .userchip #bellBtn { display: none; }
  .subscriber-stats { grid-template-columns: 1fr; }
  .login-wrap { padding: 16px; }
  .login-card { padding: 26px 22px; }
}
