@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Inter:wght@400;500;600;700&display=swap');

:root{
  --bg:#f3f3f1; --surface:#ffffff; --surface-2:#f2f2f0; --ink:#1a1a1a; --muted:#66605c; --line:#e2ddd7;
  --red:#BE1E2D; --red-soft:#fbe3e5; --blue:#0056A7; --blue-soft:#e2ecf6; --green:#1f6e46; --green-soft:#e1f2e8;
  --chip-red-bg:#3a1418; --chip-red-text:#f3b9c0; --chip-green-bg:#0d2417; --chip-green-text:#a8e0bf;
}
:root[data-theme="dark"]{
  --bg:#1a1a1a; --surface:#121212; --surface-2:#1f1f1f; --ink:#fafafa; --muted:#a8a8a8; --line:#2e2e2e;
  --red-soft:#3a1418; --blue-soft:#0d2138; --green-soft:#0d2417;
}
*{box-sizing:border-box;}
html,body{margin:0; background:var(--bg); color:var(--ink); font-family:'Inter', system-ui, sans-serif; transition:background .15s ease, color .15s ease;}
a{color:inherit;}

.app-shell{display:flex; min-height:100vh;}

.sidebar{
  width:230px; flex:0 0 230px; background:var(--surface); border-right:1px solid var(--line);
  display:flex; flex-direction:column; position:fixed; top:0; left:0; bottom:0; z-index:20;
  transition:transform .2s ease;
}
.sidebar .brand{padding:20px 20px 18px; border-bottom:1px solid var(--line); background:#121212;}
.sidebar .brand img{height:52px; width:auto; display:block;}
.sidebar nav{flex:1; padding:16px 12px; display:flex; flex-direction:column; gap:2px; overflow-y:auto;}
.sidebar nav a{
  font-family:'Inter',sans-serif; font-weight:600; font-size:13.5px; color:var(--muted);
  padding:10px 14px; border-radius:6px; text-decoration:none;
}
.sidebar nav a:hover{color:var(--ink); background:var(--surface-2);}
.sidebar nav a.active{color:var(--ink); background:var(--red-soft);}
.sidebar .who{padding:16px 20px; border-top:1px solid var(--line);}
.who-row{display:flex; align-items:center; gap:10px; margin-bottom:8px;}
.avatar{
  width:32px; height:32px; border-radius:50%; background:var(--red); color:#fff; flex:0 0 auto;
  display:flex; align-items:center; justify-content:center; font-family:'Montserrat',sans-serif; font-weight:700; font-size:12px;
}
.who-info{min-width:0; flex:1;}
.settings-wrap{position:relative; flex:0 0 auto;}
.settings-btn{
  flex:0 0 auto; background:none; border:1px solid var(--line); color:var(--muted); cursor:pointer;
  width:28px; height:28px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:13px;
}
.settings-btn:hover{color:var(--ink); background:var(--surface-2);}
.settings-menu{
  display:none; flex-direction:column; gap:2px; padding:8px; border:1px solid var(--line); border-radius:6px; background:var(--surface-2);
  position:absolute; left:calc(100% + 8px); bottom:0; width:170px; box-shadow:0 6px 20px rgba(0,0,0,.25); z-index:40;
}
.settings-menu.open{display:flex;}
.settings-menu a{display:flex; align-items:center; gap:8px; font-size:12px; color:var(--ink); text-decoration:none; padding:7px 8px; border-radius:4px;}
.settings-menu a:hover{background:var(--surface);}
.settings-menu .theme-toggle{margin-bottom:0;}
.settings-menu button.settings-menu-btn{
  display:flex; align-items:center; gap:8px; width:100%; text-align:left; border:none; background:none;
  padding:7px 8px; font-size:12px; color:var(--ink); border-radius:4px; cursor:pointer; font-family:'Inter',sans-serif;
}
.settings-menu button.logout:hover{background:var(--surface);}
.icon{width:15px; height:15px; flex:0 0 auto; display:block;}
.settings-btn .icon, .bell-link .icon{width:16px; height:16px;}
.icon-wrap{display:inline-flex; align-items:center;}
@media (max-width:860px){
  .settings-menu{left:auto; right:calc(100% + 8px);}
}
.sidebar .who .name{font-size:12.5px; color:var(--ink); font-weight:600; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.sidebar .who .role{
  font-family:'Inter',sans-serif; font-weight:700; font-size:9.5px; letter-spacing:.06em; text-transform:uppercase;
  padding:2px 8px; border-radius:20px; background:var(--chip-red-bg); color:var(--chip-red-text); display:inline-block; margin-top:3px;
}
.theme-toggle{
  width:100%; display:flex; align-items:center; gap:8px; background:none; border:1px solid var(--line); color:var(--muted);
  font-family:'Inter',sans-serif; font-size:12px; padding:8px 13px; border-radius:6px; cursor:pointer; margin-bottom:8px;
}
.theme-toggle:hover{color:var(--ink); border-color:var(--muted);}
.sidebar form{margin:0;}
.sidebar button.logout{
  width:100%; background:none; border:1px solid var(--line); color:var(--muted); font-family:'Inter',sans-serif; font-size:12px;
  padding:8px 13px; border-radius:6px; cursor:pointer;
}
.sidebar button.logout:hover{color:var(--ink); border-color:var(--muted);}

.impersonate-banner{
  position:fixed; top:0; left:0; right:0; z-index:50;
  background:#a8791f; color:#1a1a1a; font-family:'Inter',sans-serif; font-size:13px; font-weight:600;
  padding:10px 16px; display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap; text-align:center;
}
.impersonate-banner form{margin:0;}
.impersonate-banner button{
  background:#1a1a1a; color:#fff; border:none; padding:6px 14px; border-radius:20px;
  font-family:'Inter',sans-serif; font-weight:700; font-size:12px; cursor:pointer;
}

.drawer-toggle{
  display:none; position:fixed; top:14px; left:14px; z-index:30;
  background:var(--surface); border:1px solid var(--line); color:var(--ink);
  width:38px; height:38px; border-radius:6px; cursor:pointer; font-size:16px;
}
.drawer-overlay{display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:15;}

.main{flex:1; margin-left:230px; min-width:0;}
.page{max-width:1100px; margin:0 auto; padding:40px 28px 80px;}

@media (max-width:860px){
  .sidebar{transform:translateX(-100%);}
  .sidebar.open{transform:translateX(0);}
  .drawer-toggle{display:block;}
  .drawer-overlay.open{display:block;}
  .main{margin-left:0;}
  .page{padding-top:70px;}
}
.eyebrow{font-family:'Inter',sans-serif; font-weight:700; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--red); margin:0 0 12px;}
h1{font-family:'Montserrat',sans-serif; font-weight:900; font-size:30px; text-transform:uppercase; letter-spacing:-0.01em; margin:0 0 8px;}
.dek{color:var(--muted); font-size:14px; margin:0 0 32px; max-width:64ch;}

.stat-row{display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:32px;}
@media (max-width:700px){ .stat-row{grid-template-columns:1fr;} }
.stat{background:var(--surface); border:1px solid var(--line); border-radius:6px; padding:20px;}
.stat .n{font-family:'Montserrat',sans-serif; font-weight:900; font-size:32px; color:var(--red);}
.stat .l{font-size:12px; color:var(--muted); margin-top:6px;}

.panel{background:var(--surface); border:1px solid var(--line); border-radius:6px; padding:24px; margin-bottom:24px;}
.panel h2{font-family:'Montserrat',sans-serif; font-weight:700; font-size:16px; margin:0 0 14px;}
.chart-panel{transition:border-color .15s ease, box-shadow .15s ease;}
.chart-panel:hover{border-color:var(--muted); box-shadow:0 4px 18px rgba(0,0,0,.06);}
:root[data-theme="dark"] .chart-panel:hover{box-shadow:0 4px 18px rgba(0,0,0,.35);}

.bar-track{fill:var(--surface-2);}
.bar-fill{transform-box:fill-box; transform-origin:left center; animation:barGrow .6s cubic-bezier(.22,1,.36,1) both;}
@keyframes barGrow{ from{ transform:scaleX(0); } to{ transform:scaleX(1); } }

.line-area{opacity:0; animation:fadeIn .5s ease .2s both;}
.line-stroke{stroke-dasharray:900; stroke-dashoffset:900; animation:lineDraw 1s cubic-bezier(.22,1,.36,1) both;}
.line-dot{opacity:0; animation:fadeIn .3s ease .9s both;}
@keyframes lineDraw{ to{ stroke-dashoffset:0; } }
@keyframes fadeIn{ to{ opacity:1; } }

.donut-slice{opacity:0; animation:donutFade .5s ease both; transition:opacity .15s ease, stroke-width .15s ease;}
.donut-slice:hover{opacity:0.75 !important; stroke-width:34;}
@keyframes donutFade{ to{ opacity:1; } }
.legend-row{transition:background .15s ease;}
.legend-row:hover{background:var(--surface-2);}

.segment-bar{display:flex; width:100%; height:30px; border-radius:15px; overflow:hidden; background:var(--surface-2); margin-bottom:6px;}
.segment-piece{
  height:100%; transform-origin:left center; animation:segGrow .55s cubic-bezier(.22,1,.36,1) both;
  transition:opacity .15s ease, filter .15s ease; cursor:default;
}
.segment-piece:hover{opacity:0.85; filter:brightness(1.1);}
.segment-piece + .segment-piece{border-left:2px solid var(--surface);}
@keyframes segGrow{ from{ transform:scaleX(0); } to{ transform:scaleX(1); } }
.segment-legend{display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:2px; margin-top:14px;}

table.data{width:100%; border-collapse:collapse; font-size:13.5px;}
table.data th, table.data td{text-align:left; padding:10px 12px; border-bottom:1px solid var(--line);}
table.data th{font-size:10.5px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); font-weight:600;}

.empty-state{color:var(--muted); font-size:13.5px; padding:24px 0; text-align:center;}

.flash{border-radius:6px; padding:14px 16px; font-size:13.5px; margin-bottom:20px; font-family:'Inter',sans-serif;}
.flash-success{background:var(--chip-green-bg); border:1px solid var(--green); color:var(--chip-green-text);}
.flash-error{background:var(--chip-red-bg); border:1px solid var(--red); color:var(--chip-red-text);}
.flash-note{font-size:11.5px; opacity:0.8; margin-top:6px;}

.inline-form{display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; margin-bottom:8px;}
.inline-form .field{margin-bottom:0; flex:1; min-width:160px;}
.inline-form .field label{display:block; font-size:11px; color:var(--muted); margin-bottom:5px;}
.inline-form .field input, .inline-form .field select{
  width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--ink);
  padding:9px 11px; border-radius:4px; font-size:13.5px; font-family:'Inter',sans-serif;
}
.inline-form .field input:focus, .inline-form .field select:focus{outline:none; border-color:var(--red);}
.inline-form button{
  background:var(--red); color:#fff; border:none; padding:10px 18px; border-radius:4px;
  font-family:'Inter',sans-serif; font-weight:700; font-size:13px; cursor:pointer; white-space:nowrap;
}
.inline-form button:hover{background:#a51826;}

table.data select{background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:5px 8px; border-radius:4px; font-size:12.5px;}
table.data .muted{color:var(--muted); font-size:12px;}
.count-pill{background:var(--surface-2); border:1px solid var(--line); border-radius:20px; padding:2px 9px; font-size:11.5px; color:var(--muted);}
.view-as-link{font-size:12px; color:var(--red); text-decoration:none; font-weight:600; white-space:nowrap;}
.view-as-link:hover{text-decoration:underline;}

.notif-dot{width:9px; height:9px; border-radius:50%; flex:0 0 auto; display:inline-block;}
.notif-info{background:var(--blue);}
.notif-warning{background:#a8791f;}
.notif-critical{background:var(--red);}

.sla-badge{font-family:'Inter',sans-serif; font-weight:700; font-size:10.5px; letter-spacing:.04em; text-transform:uppercase; padding:4px 10px; border-radius:20px; white-space:nowrap;}
.sla-on-track{background:#0d2417; color:#6fd99a;}
.sla-at-risk{background:#332711; color:#e0b25a;}
.sla-breached{background:var(--chip-red-bg); color:var(--chip-red-text);}

.bell-link{position:relative; display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:6px; color:var(--muted); text-decoration:none;}
.bell-link:hover{background:var(--surface-2); color:var(--ink);}
.bell-badge{
  position:absolute; top:2px; right:2px; background:var(--red); color:#fff; font-size:9.5px; font-weight:700;
  min-width:15px; height:15px; border-radius:8px; display:flex; align-items:center; justify-content:center; padding:0 3px;
}

.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px;}
.login-card{background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:36px; width:100%; max-width:380px;}
.login-card img{height:60px; margin-bottom:24px; display:block;}
.login-card h1{font-size:20px; margin-bottom:6px;}
.login-card .sub{color:var(--muted); font-size:13px; margin-bottom:24px;}
.field{margin-bottom:16px;}
.field label{display:block; font-size:12px; color:var(--muted); margin-bottom:6px;}
.field input{
  width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--ink);
  padding:10px 12px; border-radius:4px; font-size:14px; font-family:'Inter',sans-serif;
}
.field input:focus{outline:none; border-color:var(--red);}
.btn-primary{
  width:100%; background:var(--red); color:#fff; border:none; padding:12px; border-radius:4px;
  font-family:'Inter',sans-serif; font-weight:700; font-size:14px; cursor:pointer; margin-top:6px;
}
.btn-primary:hover{background:#a51826;}
.form-error{background:var(--chip-red-bg); border:1px solid var(--red); color:var(--chip-red-text); padding:10px 12px; border-radius:4px; font-size:12.5px; margin-bottom:16px;}

.error-page{min-height:100vh; display:flex; align-items:center; justify-content:center; text-align:center; padding:24px;}
.error-page h1{font-size:22px;}
.error-page p{color:var(--muted);}
.error-page a{color:var(--red); text-decoration:none; font-weight:600;}

/* ---------- Client modules ---------- */
.nav-section{font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); padding:14px 14px 4px;}
.module-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px;}
.module-card{display:block; border:1px solid var(--line); border-radius:6px; padding:16px; text-decoration:none; background:var(--surface-2);}
.module-card:hover{border-color:var(--red);}
.module-card strong{display:block; font-size:14px; margin-bottom:4px;}
.module-card span{font-size:12.5px; color:var(--muted);}
.module-list label{display:flex; gap:12px; align-items:flex-start; padding:12px 0; border-bottom:1px solid var(--line); cursor:pointer;}
.module-list label.unavailable{cursor:default; opacity:.6;}
.module-list input{margin-top:3px; width:16px; height:16px; accent-color:var(--red);}
.module-list .m-name{font-weight:600; font-size:14px;}
.module-list .m-desc{font-size:12.5px; color:var(--muted); margin-top:2px;}

/* ---------- Finance module ---------- */
.fin-tabs{display:flex; gap:4px; flex-wrap:wrap; border-bottom:1px solid var(--line); margin:-12px 0 24px;}
.fin-tabs a{font-size:13px; font-weight:600; color:var(--muted); text-decoration:none; padding:10px 14px; border-bottom:2px solid transparent; margin-bottom:-1px;}
.fin-tabs a:hover{color:var(--ink);}
.fin-tabs a.active{color:var(--ink); border-bottom-color:var(--red);}
.stat-row.four{grid-template-columns:repeat(4,1fr);}
@media (max-width:900px){ .stat-row.four{grid-template-columns:repeat(2,1fr);} }
@media (max-width:520px){ .stat-row.four{grid-template-columns:1fr;} }
.stat .n.sm{font-size:22px;}
.stat .n.ok{color:var(--green);}
.stat .n.ink{color:var(--ink);}
.status{font-weight:700; font-size:10.5px; letter-spacing:.04em; text-transform:uppercase; padding:4px 10px; border-radius:20px; white-space:nowrap; background:var(--surface-2); color:var(--muted); border:1px solid var(--line);}
.status-sent, .status-unpaid{background:var(--blue-soft); color:var(--blue); border-color:transparent;}
.status-paid, .status-accepted, .status-converted{background:var(--green-soft); color:var(--green); border-color:transparent;}
.status-overdue, .status-declined, .status-expired{background:var(--red-soft); color:var(--red); border-color:transparent;}
.status-part-paid{background:#f7ecd6; color:#8a5a00; border-color:transparent;}
:root[data-theme="dark"] .status-sent, :root[data-theme="dark"] .status-unpaid{color:#8fbfef;}
:root[data-theme="dark"] .status-paid, :root[data-theme="dark"] .status-accepted, :root[data-theme="dark"] .status-converted{color:#6fd99a;}
:root[data-theme="dark"] .status-overdue, :root[data-theme="dark"] .status-declined, :root[data-theme="dark"] .status-expired{color:var(--chip-red-text);}
:root[data-theme="dark"] .status-part-paid{background:#332711; color:#e0b25a;}
table.data td.num, table.data th.num{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap;}
.table-wrap{overflow-x:auto;}
.btn{display:inline-block; background:var(--red); color:#fff; border:none; padding:9px 16px; border-radius:4px; font-family:'Inter',sans-serif; font-weight:700; font-size:13px; cursor:pointer; text-decoration:none; white-space:nowrap;}
.btn:hover{background:#a51826;}
.btn-ghost{background:none; color:var(--ink); border:1px solid var(--line);}
.btn-ghost:hover{background:var(--surface-2);}
.btn-row{display:flex; gap:8px; flex-wrap:wrap; align-items:center;}
.btn-row form{margin:0;}
.panel-head{display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:14px;}
.panel-head h2{margin:0;}
.form-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px 16px;}
.form-grid .field{margin-bottom:0;}
.form-grid .wide{grid-column:1 / -1;}
.field select, .field textarea{
  width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--ink);
  padding:10px 12px; border-radius:4px; font-size:14px; font-family:'Inter',sans-serif;
}
.field textarea{min-height:70px; resize:vertical;}
.field select:focus, .field textarea:focus{outline:none; border-color:var(--red);}
.check{display:flex; gap:8px; align-items:center; font-size:13.5px; cursor:pointer;}
.check input{width:16px; height:16px; accent-color:var(--red);}
.lines-table{width:100%; border-collapse:collapse;}
.lines-table th{font-size:10.5px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); font-weight:600; text-align:left; padding:6px 6px;}
.lines-table td{padding:4px 6px; vertical-align:top;}
.lines-table input{width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:9px 10px; border-radius:4px; font-size:13.5px; font-family:'Inter',sans-serif;}
.lines-table input:focus{outline:none; border-color:var(--red);}
.lines-table .amt{text-align:right; font-variant-numeric:tabular-nums; padding-top:13px; white-space:nowrap;}
.remove-line{background:none; border:none; color:var(--muted); cursor:pointer; font-size:18px; padding:6px;}
.remove-line:hover{color:var(--red);}
.totals{margin-left:auto; max-width:300px; margin-top:12px;}
.totals div{display:flex; justify-content:space-between; padding:5px 0; font-size:14px; font-variant-numeric:tabular-nums;}
.totals .grand{font-weight:700; font-size:16px; border-top:1px solid var(--line); padding-top:9px; margin-top:4px;}
.doc-paper{background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:40px; max-width:820px;}
.doc-head{display:flex; justify-content:space-between; gap:24px; flex-wrap:wrap; margin-bottom:32px;}
.doc-head .biz{font-family:'Montserrat',sans-serif; font-weight:900; font-size:20px; margin-bottom:6px;}
.doc-head .small, .doc-parties .small{font-size:12.5px; color:var(--muted); line-height:1.6; white-space:pre-line;}
.doc-meta{text-align:right;}
.doc-meta .type{font-family:'Montserrat',sans-serif; font-weight:900; font-size:22px; text-transform:uppercase; color:var(--red);}
.doc-meta .num{font-weight:700; font-size:15px; margin:2px 0 8px;}
.doc-parties{margin-bottom:24px;}
.doc-parties .label{font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin-bottom:4px;}
.doc-parties .name{font-size:16px; font-weight:600;}
.doc-lines{width:100%; border-collapse:collapse;}
.doc-lines th{font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; padding:10px 0; border-bottom:1px solid var(--line); text-align:left;}
.doc-lines td{padding:12px 0; border-bottom:1px solid var(--line); font-size:14px;}
.doc-lines .num{text-align:right; font-variant-numeric:tabular-nums;}
.doc-footer{margin-top:28px; font-size:12.5px; color:var(--muted); white-space:pre-line; line-height:1.6;}
@media print{
  .sidebar, .drawer-toggle, .drawer-overlay, .no-print, .impersonate-banner, .fin-tabs{display:none !important;}
  .main{margin-left:0 !important; margin-top:0 !important;}
  .page{padding:0 !important; max-width:none !important;}
  body, .doc-paper{background:#fff !important; color:#111 !important;}
  .doc-paper{border:none !important; padding:0 !important; max-width:none !important;}
  .doc-paper *{color:#111 !important; border-color:#ccc !important;}
  .doc-meta .type{color:#BE1E2D !important;}
}

/* ---------- Stock module ---------- */
.insight-list{display:flex; flex-direction:column; gap:10px;}
.insight{display:flex; gap:12px; align-items:flex-start; font-size:13.5px; line-height:1.5; padding:12px 14px; background:var(--surface-2); border-radius:6px;}
.insight .status{flex:0 0 auto; margin-top:1px;}
.pill-select{background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:8px 12px; border-radius:20px; font-size:13px; font-family:'Inter',sans-serif;}
table.data td.neg{color:var(--red);}
table.data td.pos{color:var(--green);}
:root[data-theme="dark"] table.data td.pos{color:#6fd99a;}
.total-chips{display:flex; gap:8px; flex-wrap:wrap; margin:6px 0 16px;}
.total-chips .count-pill{padding:5px 12px; font-size:12px;}

/* ---------- Sales module ---------- */
.product-tiles{display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px;}
.product-tile{text-align:left; background:var(--surface-2); border:1px solid var(--line); border-radius:6px; padding:12px; cursor:pointer; font-family:'Inter',sans-serif; color:var(--ink); transition:border-color .12s ease, transform .12s ease;}
.product-tile:hover{border-color:var(--red);}
.product-tile.tapped{transform:scale(.96); border-color:var(--red);}
.product-tile strong{display:block; font-size:13.5px; margin-bottom:4px;}
.product-tile span{font-size:12.5px; color:var(--muted);}
.small-input{background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:6px 8px; border-radius:4px; font-size:13.5px; font-family:'Inter',sans-serif;}
.change-box{background:var(--surface-2); border:1px solid var(--line); border-radius:4px; padding:10px 12px; font-size:14px; font-weight:700; font-variant-numeric:tabular-nums;}
.day-chart{display:flex; align-items:stretch; gap:6px; height:200px;}
.day-col{flex:1; display:flex; flex-direction:column; align-items:center; min-width:0;}
.day-val{font-size:10.5px; color:var(--muted); height:16px; white-space:nowrap; font-variant-numeric:tabular-nums;}
.day-bar-wrap{flex:1; width:100%; display:flex; align-items:flex-end; background:var(--surface-2); border-radius:4px; overflow:hidden;}
.day-bar{width:100%; background:var(--red); border-radius:4px 4px 0 0; transform-origin:bottom; animation:dayGrow .5s cubic-bezier(.22,1,.36,1) both;}
@keyframes dayGrow{ from{ transform:scaleY(0); } to{ transform:scaleY(1); } }
.day-label{font-size:10.5px; color:var(--muted); text-align:center; margin-top:6px; line-height:1.3;}
@media (max-width:600px){ .day-val{display:none;} .day-chart{gap:3px;} }
@media print{ .doc-paper.receipt{max-width:380px !important;} }

/* ---------- Bookings module ---------- */
.link-btn{background:none; border:none; padding:0; cursor:pointer; font:inherit; font-size:12px; color:var(--red); font-weight:600;}
.link-btn:hover{text-decoration:underline;}
.steps{margin:0; padding-left:20px; font-size:13.5px; line-height:1.9;}
.slot-grid{display:flex; flex-wrap:wrap; gap:8px;}
.slot{background:var(--surface-2); border:1px solid var(--line); color:var(--ink); border-radius:20px; padding:8px 14px; font-size:13px; font-family:'Inter',sans-serif; font-variant-numeric:tabular-nums; cursor:pointer;}
.slot:hover{border-color:var(--red);}
.slot.picked{background:var(--red); border-color:var(--red); color:#fff;}
.cal-bar{display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:18px;}
.day-grid-wrap{overflow-x:auto;}
.day-grid{display:grid; gap:0 8px; min-width:100%;}
.col-head{font-size:13px; font-weight:700; padding:0 0 10px; border-bottom:1px solid var(--line); margin-bottom:6px;}
.time-col, .staff-col{position:relative;}
.hour-label{position:absolute; left:0; font-size:11px; color:var(--muted); transform:translateY(-6px); font-variant-numeric:tabular-nums;}
.staff-col{border-left:1px solid var(--line);}
.half-slot{position:absolute; left:0; right:0; border-top:1px dashed var(--line); display:block;}
.half-slot:hover{background:var(--red-soft);}
.half-slot.closed{background:repeating-linear-gradient(45deg, transparent, transparent 6px, var(--surface-2) 6px, var(--surface-2) 12px);}
.appt-block{position:absolute; left:4px; right:4px; border-radius:5px; padding:5px 8px; font-size:12px; text-decoration:none; overflow:hidden; background:var(--blue-soft); border-left:3px solid var(--blue); color:var(--ink); z-index:2; line-height:1.35;}
.appt-block strong, .week-appt strong{display:block; font-size:12px;}
.appt-block span, .week-appt span{display:block; color:var(--muted); font-size:11.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.appt-confirmed{background:var(--green-soft); border-left-color:var(--green);}
.appt-completed{background:var(--surface-2); border-left-color:var(--muted); opacity:.8;}
.appt-no_show{background:var(--red-soft); border-left-color:var(--red); opacity:.75;}
.week-grid{display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); gap:8px;}
@media (max-width:900px){ .week-grid{grid-template-columns:1fr;} }
.week-day{background:var(--surface); border:1px solid var(--line); border-radius:6px; padding:10px; display:flex; flex-direction:column; gap:6px; min-height:160px;}
.week-day.is-today{border-color:var(--red);}
.week-head{display:flex; justify-content:space-between; align-items:baseline; font-size:12px; border-bottom:1px solid var(--line); padding-bottom:6px;}
.week-head a{text-decoration:none; font-size:13px;}
.week-appt{display:block; text-decoration:none; color:var(--ink); background:var(--blue-soft); border-left:3px solid var(--blue); border-radius:4px; padding:5px 7px; font-size:12px;}
.week-appt.appt-confirmed{background:var(--green-soft); border-left-color:var(--green);}
.week-appt.appt-completed{background:var(--surface-2); border-left-color:var(--muted);}
.week-appt.appt-no_show{background:var(--red-soft); border-left-color:var(--red);}
.row-highlight td{background:var(--surface-2);}
.share-box{display:flex; gap:10px; align-items:center; flex-wrap:wrap; background:var(--green-soft); padding:12px 14px; border-radius:6px; font-size:13.5px;}
.share-box a{font-weight:700; color:var(--green); word-break:break-all;}
.hours-table td{vertical-align:middle;}

/* Public booking page */
.public-body{background:var(--bg);}
.public-wrap{max-width:720px; margin:0 auto; padding:32px 16px 60px;}
.public-head{text-align:center; margin-bottom:24px;}
.public-head h1{font-size:28px; margin-bottom:8px;}
.public-head p{color:var(--muted); margin:0 0 4px; font-size:14px;}
.public-contact{font-size:12.5px !important;}
.service-cards{display:grid; gap:10px;}
.service-card{display:flex; gap:12px; align-items:flex-start; border:1px solid var(--line); border-radius:6px; padding:14px; cursor:pointer; background:var(--surface-2);}
.service-card:has(input:checked){border-color:var(--red); background:var(--red-soft);}
.service-card input{margin-top:3px; accent-color:var(--red); width:16px; height:16px;}
.sc-body strong{display:block; font-size:14.5px;}
.sc-body span{display:block; font-size:13px; color:var(--muted);}
.sc-desc{margin-top:4px;}
.hp-field{position:absolute; left:-10000px; width:1px; height:1px; overflow:hidden;}
.done-panel{text-align:center; padding:36px 24px;}
.done-tick{width:56px; height:56px; border-radius:50%; background:var(--green); color:#fff; font-size:28px; display:flex; align-items:center; justify-content:center; margin:0 auto 16px;}
.done-when{font-size:16px; line-height:1.6;}
.public-foot{text-align:center; font-size:11.5px; color:var(--muted); margin-top:24px;}

/* ---------- AI Email Assistant ---------- */
.nav-sub{padding-left:28px !important; font-size:12.5px !important; font-weight:500 !important;}
.mail-list{display:flex; flex-direction:column;}
.mail-row{display:block; padding:14px 20px; border-bottom:1px solid var(--line); text-decoration:none; color:var(--ink);}
.mail-row:last-child{border-bottom:none;}
.mail-row:hover{background:var(--surface-2);}
.mail-row.unread .mail-from, .mail-row.unread .mail-subject{font-weight:700;}
.mail-top{display:flex; justify-content:space-between; gap:12px; font-size:13.5px;}
.mail-when{color:var(--muted); font-size:12px; white-space:nowrap;}
.mail-subject{font-size:13.5px; margin:3px 0; display:flex; gap:6px; align-items:center; flex-wrap:wrap;}
.mail-snippet{font-size:12.5px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.chip-on{border-color:var(--red) !important; color:var(--ink) !important;}
.total-chips a.count-pill{text-decoration:none;}
.cat-complaint{background:var(--red-soft); color:var(--red); border-color:transparent;}
.cat-booking_request, .cat-quote_request, .cat-order{background:var(--blue-soft); color:var(--blue); border-color:transparent;}
.cat-supplier_bill, .cat-payment{background:#f7ecd6; color:#8a5a00; border-color:transparent;}
:root[data-theme="dark"] .cat-booking_request, :root[data-theme="dark"] .cat-quote_request, :root[data-theme="dark"] .cat-order{color:#8fbfef;}
:root[data-theme="dark"] .cat-supplier_bill, :root[data-theme="dark"] .cat-payment{background:#332711; color:#e0b25a;}
.mail-h1{font-size:24px; text-transform:none;}
.ai-card{border-left:3px solid var(--blue);}
.ai-summary{font-size:15px; line-height:1.5; margin:0;}
.detail-chips{display:flex; flex-wrap:wrap; gap:8px; margin-top:12px;}
.detail-chips span{background:var(--surface-2); border:1px solid var(--line); border-radius:20px; padding:5px 12px; font-size:12.5px;}
.detail-chips em{font-style:normal; color:var(--muted);}
.reply-box{width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:12px 14px; border-radius:6px; font-size:14px; line-height:1.55; font-family:'Inter',sans-serif; resize:vertical;}
.reply-box:focus{outline:none; border-color:var(--red);}
.sent-reply{white-space:pre-wrap; background:var(--green-soft); border-radius:6px; padding:12px 14px; font-size:13.5px; margin-bottom:12px; line-height:1.5;}
.mail-body{white-space:pre-wrap; font-size:13.5px; line-height:1.6; max-height:600px; overflow:auto; background:var(--surface-2); border-radius:6px; padding:14px 16px; word-break:break-word;}

/* ---------- AI Customer Chat ---------- */
.transcript{display:flex; flex-direction:column; gap:10px; max-height:560px; overflow-y:auto; padding:4px 2px;}
.t-msg{max-width:78%; border-radius:12px; padding:9px 12px; font-size:13.5px; line-height:1.45;}
.t-meta{font-size:11px; color:var(--muted); margin-bottom:3px;}
.t-body{white-space:pre-wrap; word-wrap:break-word;}
.t-visitor{align-self:flex-start; background:var(--surface-2); border:1px solid var(--line);}
.t-assistant{align-self:flex-end; background:var(--blue-soft);}
.t-staff{align-self:flex-end; background:var(--green-soft);}
.t-event{align-self:center; max-width:90%; background:none; border:1px dashed var(--line); font-size:12.5px; color:var(--muted);}
.code-box{font-family:'IBM Plex Mono', ui-monospace, monospace; font-size:12.5px; background:var(--surface-2); border:1px solid var(--line); border-radius:6px; padding:12px 14px; word-break:break-all;}

/* ---------- Jobs and Projects ---------- */
.board{display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; align-items:start;}
@media (max-width:1000px){ .board{grid-template-columns:repeat(2, minmax(0, 1fr));} }
@media (max-width:600px){ .board{grid-template-columns:1fr;} }
.board-col{background:var(--surface-2); border:1px solid var(--line); border-radius:8px; padding:10px; display:flex; flex-direction:column; gap:8px; min-height:120px;}
.board-head{font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); display:flex; justify-content:space-between; align-items:center;}
.board-card{background:var(--surface); border:1px solid var(--line); border-radius:6px; padding:10px 12px; font-size:13px;}
.board-card.is-overdue{border-left:3px solid var(--red);}
.board-card a{text-decoration:none; color:var(--ink);}
.board-move{margin:8px 0 0;}
.board-move select{width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--muted); border-radius:4px; padding:4px 6px; font-size:11.5px;}
.task-bar{height:5px; background:var(--surface-2); border-radius:3px; margin-top:8px; overflow:hidden;}
.task-bar div{height:100%; background:var(--green);}
.task-list{display:flex; flex-direction:column;}
.task{display:flex; align-items:center; gap:10px; padding:7px 0; border-bottom:1px solid var(--line); font-size:13.5px;}
.task.done span{text-decoration:line-through; color:var(--muted);}
.tick{width:22px; height:22px; border-radius:5px; border:1.5px solid var(--muted); background:none; color:#fff; cursor:pointer; font-size:13px; line-height:1; padding:0;}
.task.done .tick{background:var(--green); border-color:var(--green);}
.job-note{white-space:pre-wrap; font-size:13.5px; padding:10px 0; border-bottom:1px solid var(--line);}

/* ---------- Staff and Rostering ---------- */
.dot{display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:7px; vertical-align:middle;}
table.roster{width:100%; border-collapse:collapse; font-size:12.5px; min-width:860px;}
table.roster th, table.roster td{border:1px solid var(--line); padding:6px; vertical-align:top;}
table.roster thead th{font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); background:var(--surface-2);}
table.roster th.who{text-align:left; font-size:13px; white-space:nowrap; background:var(--surface);}
table.roster th.who a{color:var(--ink); text-decoration:none; font-weight:600;}
table.roster tfoot th{text-align:left; font-size:11.5px; color:var(--muted); font-weight:600;}
table.roster .is-today{background:var(--red-soft);}
table.roster td.on-leave{background:repeating-linear-gradient(45deg, transparent, transparent 6px, var(--surface-2) 6px, var(--surface-2) 12px);}
.shift{display:block; background:var(--surface-2); border-left:3px solid var(--blue); border-radius:4px; padding:4px 6px; margin-bottom:4px; text-decoration:none; color:var(--ink); line-height:1.3;}
.shift span{color:var(--muted); font-size:11.5px;}
.shift.draft{border-style:dashed; border-left-style:solid; opacity:.75; border-top:1px dashed var(--line); border-right:1px dashed var(--line); border-bottom:1px dashed var(--line);}
.shift.flagged{outline:2px solid var(--red); outline-offset:-1px;}
.add-shift{display:block; text-align:center; color:var(--muted); text-decoration:none; border-radius:4px; font-size:14px; line-height:20px;}
.add-shift:hover{background:var(--surface-2); color:var(--red);}
.leave-tag{font-size:10.5px; font-weight:700; text-transform:uppercase; color:var(--red); margin-bottom:4px;}
.color-pick{display:flex; gap:6px; flex-wrap:wrap; padding-top:6px;}
.color-pick input{display:none;}
.color-pick span{display:block; width:24px; height:24px; border-radius:50%; cursor:pointer; border:2px solid transparent;}
.color-pick input:checked + span{border-color:var(--ink); box-shadow:0 0 0 2px var(--surface) inset;}
@media print{ .roster-page h1{font-size:20px;} table.roster{min-width:0; font-size:10.5px;} .add-shift{display:none;} }

/* ---------- Documents and Compliance ---------- */
.drop{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; border:2px dashed var(--line); border-radius:8px; padding:34px 16px; text-align:center; cursor:pointer; background:var(--surface-2);}
.drop.over, .drop:hover{border-color:var(--red);}
.drop input{max-width:100%; font-size:13px;}
.drop strong{font-size:15px;}
.drop span{font-size:12.5px;}
.doc-preview{max-width:100%; max-height:800px; display:block; margin:0 auto; border-radius:4px;}
.doc-frame{width:100%; height:760px; border:0; display:block; background:#fff;}
.comp-list{display:flex; flex-direction:column;}
.comp-item{display:flex; gap:12px; align-items:flex-start; flex-wrap:wrap; padding:14px 0; border-bottom:1px solid var(--line);}
.comp-item.off{opacity:.55;}
.comp-main{flex:1; min-width:240px;}
.comp-title{display:flex; gap:8px; align-items:center; flex-wrap:wrap; font-size:14px; margin-bottom:3px;}
.comp-desc{font-size:12.5px; color:var(--muted); margin-top:4px; max-width:70ch;}
.comp-actions{flex-basis:auto;}
.comp-actions summary{list-style:none; cursor:pointer;}
.comp-actions summary::-webkit-details-marker{display:none;}
.comp-actions[open]{flex-basis:100%;}
.tpl-list{display:flex; flex-direction:column;}
.tpl{display:flex; gap:12px; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--line); cursor:pointer;}
.tpl input[type=checkbox]{margin-top:3px; width:16px; height:16px; accent-color:var(--red); flex:0 0 auto;}
.tpl-body{flex:1; font-size:13.5px;}
.tpl-desc{display:block; font-size:12.5px; margin-top:2px;}

/* ---------- Monthly AI Business Insights ---------- */
.health-good{background:var(--green-soft); color:var(--green); border-color:transparent;}
.health-watch{background:#f7ecd6; color:#8a5a00; border-color:transparent;}
.health-concern{background:var(--red-soft); color:var(--red); border-color:transparent;}
:root[data-theme="dark"] .health-good{color:#6fd99a;}
:root[data-theme="dark"] .health-watch{background:#332711; color:#e0b25a;}
:root[data-theme="dark"] .health-concern{color:var(--chip-red-text);}
.headline-card{border-radius:8px; padding:22px 24px; margin-bottom:24px; border:1px solid var(--line); background:var(--surface);}
.headline-card.health-good, .headline-card.health-watch, .headline-card.health-concern{color:var(--ink);}
.headline-card.health-good{border-left:5px solid var(--green); background:var(--surface);}
.headline-card.health-watch{border-left:5px solid #a8791f; background:var(--surface);}
.headline-card.health-concern{border-left:5px solid var(--red); background:var(--surface);}
.headline-card .headline{font-family:'Montserrat',sans-serif; font-weight:700; font-size:20px; line-height:1.35; margin:12px 0 8px;}
.headline-card .summary{font-size:14.5px; line-height:1.6; margin:0; color:var(--ink);}
.issue-list{display:flex; flex-direction:column; gap:12px;}
.issue{border:1px solid var(--line); border-left:3px solid var(--red); border-radius:6px; padding:12px 14px;}
.issue-head{display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; font-size:14.5px;}
.issue p{font-size:13.5px; line-height:1.55; margin:6px 0;}
.impact{font-weight:700; color:var(--red); white-space:nowrap;}
.area-tag{font-size:11px; text-transform:uppercase; letter-spacing:.05em;}
.action-list{display:flex; flex-direction:column; gap:10px;}
.action{display:flex; gap:14px; align-items:flex-start; border:1px solid var(--line); border-radius:6px; padding:12px 14px;}
.action.done{opacity:.65;}
.action.done strong{text-decoration:line-through;}
.action.skipped{opacity:.5;}
.action-num{width:28px; height:28px; border-radius:50%; background:var(--red); color:#fff; font-weight:700; display:flex; align-items:center; justify-content:center; flex:0 0 auto; font-size:13px;}
.action-body{flex:1; min-width:0;}
.action-body strong{font-size:14.5px;}
.action-body p{font-size:13.5px; line-height:1.55; margin:4px 0 0;}
.action-btns{display:flex; flex-direction:column; align-items:flex-end; gap:6px; margin:0;}
.wins{margin:0; padding-left:20px; font-size:14px; line-height:1.8;}
.numbers-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(250px, 1fr)); gap:14px;}
.num-sec{border:1px solid var(--line); border-radius:6px; padding:12px 14px;}
.num-sec h3{font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin:0 0 8px;}
.num-row{display:flex; justify-content:space-between; gap:10px; font-size:13.5px; padding:4px 0; font-variant-numeric:tabular-nums;}
.chg{font-size:11.5px; font-weight:700;}
.chg.up{color:var(--green);}
.chg.down{color:var(--red);}
:root[data-theme="dark"] .chg.up{color:#6fd99a;}
@media print{ .insights-page .panel{break-inside:avoid;} .headline-card{border:1px solid #ccc !important;} }

/* ---------- Client dashboard snapshot ---------- */
.dash-report{display:block; text-decoration:none;}
.dash-report:hover{box-shadow:0 4px 18px rgba(0,0,0,.06);}
.dash-report-month{font-size:12px; margin-left:8px;}
.kpi-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(185px, 1fr)); gap:14px; margin-bottom:24px;}
.kpi{background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:14px 16px; text-decoration:none; color:var(--ink); display:flex; flex-direction:column; gap:6px; transition:border-color .15s ease, transform .15s ease;}
.kpi:hover{border-color:var(--muted); transform:translateY(-1px);}
.kpi-l{font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; font-weight:600;}
.kpi-n{font-family:'Montserrat',sans-serif; font-weight:900; font-size:20px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere;}
.kpi-n.bad{color:var(--red);}
.kpi-foot{font-size:12px; display:flex; gap:6px; flex-wrap:wrap; align-items:center; min-height:16px;}
.bad-note{color:var(--red) !important;}
:root[data-theme="dark"] .kpi-n.bad, :root[data-theme="dark"] .bad-note{color:var(--chip-red-text) !important;}
.attn-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column;}
.attn{display:flex; gap:10px; align-items:flex-start; padding:9px 0; border-bottom:1px solid var(--line); font-size:13.5px; line-height:1.45;}
.attn:last-child{border-bottom:none;}
.attn a{text-decoration:none; color:var(--ink);}
.attn a:hover{text-decoration:underline;}
.attn-dot{width:9px; height:9px; border-radius:50%; flex:0 0 auto; margin-top:5px; background:var(--muted);}
.attn-high .attn-dot{background:var(--red);}
.attn-medium .attn-dot{background:#a8791f;}
.attn-low .attn-dot{background:var(--blue);}
.attn-more summary{list-style:none; cursor:pointer; margin-top:10px;}
.attn-more summary::-webkit-details-marker{display:none;}
.dash-grid{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:0 20px; grid-auto-flow:row dense;}
.dash-grid .wide{grid-column:1 / -1;}
@media (max-width:900px){ .dash-grid{grid-template-columns:minmax(0, 1fr);} }
.dash-card-head{display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:10px;}
.dash-card-head h2{margin:0 0 2px;}
.dash-sub{font-size:12px;}
.dash-svg svg{width:100%; height:auto; display:block;}
.dash-bar{transform-origin:bottom; transform-box:fill-box; animation:dashGrow .5s ease-out both;}
@keyframes dashGrow{from{transform:scaleY(0);} to{transform:scaleY(1);}}
@media (prefers-reduced-motion:reduce){ .dash-bar, .hbar-fill{animation:none !important;} }
.dash-legend{display:flex; gap:16px; font-size:12px; color:var(--muted); margin-bottom:6px;}
.dash-legend i, .dash-slice i{display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; vertical-align:-1px;}
.dash-donut-wrap{display:flex; gap:22px; align-items:center; flex-wrap:wrap;}
.dash-donut-box{width:170px; flex:0 0 170px;}
.dash-donut-box svg{width:100%; height:auto; display:block;}
.dash-slices{flex:1; min-width:180px; display:flex; flex-direction:column; gap:8px;}
.dash-slice{display:flex; align-items:center; gap:8px; font-size:13px;}
.dash-slice .lbl{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.dash-slice .val{font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap;}
.dash-slice .pc{width:36px; text-align:right; font-size:12px;}
.hbars{display:flex; flex-direction:column; gap:12px;}
.hbar-top{display:flex; justify-content:space-between; gap:10px; font-size:13px; margin-bottom:5px;}
.hbar-top .lbl{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.hbar-top .val{font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap;}
.hbar-track{height:9px; border-radius:6px; background:var(--surface-2); overflow:hidden;}
.hbar-fill{height:100%; border-radius:6px; background:var(--blue); transform-origin:left; animation:dashGrowX .6s ease-out both;}
.hbar-fill.bad{background:var(--red);}
@keyframes dashGrowX{from{transform:scaleX(0);} to{transform:scaleX(1);}}
.dash-list{margin-top:14px; border-top:1px solid var(--line); padding-top:12px;}
.dash-list h3{font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin:0 0 6px;}
.dash-list-row{display:flex; gap:10px; font-size:13px; padding:4px 0;}
.dash-list-row .t{font-weight:700; width:44px; flex:0 0 auto; font-variant-numeric:tabular-nums;}
.dash-list-row .x{flex:1; min-width:0;}
.more-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:4px 20px;}
.more-kpi{display:grid; grid-template-columns:1fr auto; gap:0 10px; padding:8px 0; border-bottom:1px solid var(--line); text-decoration:none; color:var(--ink); font-size:13px;}
.more-kpi strong{font-variant-numeric:tabular-nums; text-align:right;}
.more-kpi .note{grid-column:1 / -1; font-size:11.5px;}
.more-kpi:hover strong{text-decoration:underline;}

/* ---------- Company settings ---------- */
.flash-info{background:var(--blue-soft); border:1px solid var(--blue); color:var(--ink);}
.plain-fieldset{border:none; margin:0; padding:0; min-width:0;}
.plain-fieldset:disabled input, .plain-fieldset:disabled select, .plain-fieldset:disabled textarea{opacity:.85; cursor:default;}
.pick-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(210px, 1fr)); gap:6px 14px; margin-top:4px;}
.field label.pick{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink); margin:0; cursor:pointer;}
.pick input{width:16px; height:16px; accent-color:var(--red); margin:0;}
.team-list{display:flex; flex-direction:column;}
.team-row{border-bottom:1px solid var(--line);}
.team-row:last-child{border-bottom:none;}
.team-row summary{list-style:none; cursor:pointer; display:flex; align-items:center; gap:12px; padding:12px 0; flex-wrap:wrap;}
.team-row summary::-webkit-details-marker{display:none;}
.team-row.off summary{opacity:.6;}
.avatar.sm{width:34px; height:34px; font-size:12px; flex:0 0 auto;}
.team-who{flex:1; min-width:180px; display:flex; flex-direction:column; font-size:13.5px;}
.team-who .muted{font-size:12.5px;}
.team-access{display:flex; align-items:center; gap:6px;}
.team-last{font-size:12px; min-width:110px; text-align:right;}
.team-edit{padding:4px 0 18px 46px;}
@media (max-width:600px){ .team-edit{padding-left:0;} .team-last{text-align:left;} }

/* Wide tables: the first column stays put while the rest scrolls sideways. */
table.sticky-first th:first-child, table.sticky-first tr.searchable-row > td:first-child{
  position:sticky; left:0; z-index:2; background:var(--surface); min-width:160px;
  box-shadow:1px 0 0 var(--line);
}
table.sticky-first th:first-child{z-index:3;}
table.sticky-first tr.searchable-row > td:first-child{font-weight:600;}
.table-wrap.scrolled table.sticky-first th:first-child, .table-wrap.scrolled table.sticky-first tr.searchable-row > td:first-child{box-shadow:6px 0 8px -6px rgba(0,0,0,.25), 1px 0 0 var(--line);}

/* ---------- Sign-in security and POPIA ---------- */
.login-foot{font-size:12.5px; color:var(--muted); text-align:center; margin:18px 0 0;}
.login-foot a{color:var(--muted);}
.login-help{font-size:13px; margin-top:16px; color:var(--muted);}
.login-help summary{cursor:pointer; color:var(--red); font-weight:600;}
.login-help p{line-height:1.5;}
.terms-points{font-size:13.5px; line-height:1.55; padding-left:18px; margin:14px 0;}
.terms-points li{margin-bottom:6px;}
.tfa-setup{display:flex; flex-direction:column; gap:22px; max-width:640px;}
.tfa-step{display:flex; gap:14px; align-items:flex-start;}
.tfa-step p{font-size:13.5px; margin:4px 0 0;}
.tfa-qr{display:block; margin:12px 0 6px; background:#fff; padding:8px; border-radius:6px; border:1px solid var(--line); width:220px; height:220px;}
.tfa-manual{margin-top:6px;}
.tfa-manual summary{cursor:pointer; list-style:none;}
.tfa-key{display:inline-block; margin-top:8px; padding:8px 12px; background:var(--surface-2); border:1px solid var(--line); border-radius:6px; font-size:15px; letter-spacing:.06em; word-break:break-all;}
.tfa-code{background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:9px 12px; border-radius:4px; font-size:17px; letter-spacing:.18em; width:150px;}
.tfa-code.sm{font-size:14px; letter-spacing:.08em; width:160px;}
.sec-actions{display:flex; gap:12px; flex-wrap:wrap; align-items:center;}
.code-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:8px;}
.code-grid code{background:var(--surface-2); border:1px solid var(--line); border-radius:6px; padding:9px 12px; font-size:15px; text-align:center; letter-spacing:.04em;}
.backup-codes{border-left:4px solid var(--red);}
.danger-panel{border-left:4px solid var(--red);}
.legal-page{max-width:820px; margin:0 auto; padding:24px 20px 60px;}
.legal-top{display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; padding-bottom:18px; border-bottom:1px solid var(--line); margin-bottom:32px;}
.legal-top img{height:34px; background:#121212; padding:6px 8px; border-radius:6px;}
.legal-top nav{display:flex; gap:18px; font-size:13.5px;}
.legal-top nav a{text-decoration:none; color:var(--muted); font-weight:600;}
.legal-top nav a.active, .legal-top nav a:hover{color:var(--red);}
.legal-body{background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:32px 36px; font-size:15px; line-height:1.65;}
.legal-body h1{font-size:28px;}
.legal-body h2{font-family:'Montserrat',sans-serif; font-size:17px; margin:28px 0 8px;}
.legal-body ul{padding-left:20px;}
.legal-body li{margin-bottom:6px;}
.legal-body a{color:var(--red);}
.legal-lead{font-size:16px;}
.legal-footer{text-align:center; font-size:12.5px; margin-top:24px;}
.legal-footer a{color:var(--muted);}
@media (max-width:600px){ .legal-body{padding:22px 18px;} }
@media print{ .sidebar, .drawer-toggle, .btn-row, .legal-top nav{display:none !important;} .main{margin:0 !important;} }

/* ---------- Billing ---------- */
.price-input{width:120px; text-align:right; background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:6px 8px; border-radius:4px; font-variant-numeric:tabular-nums;}
.pay-panel{border-left:4px solid var(--red);}
.pay-row{display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:10px 0; border-bottom:1px solid var(--line);}
.pay-row:last-of-type{border-bottom:none;}
.pay-row > span:first-child{flex:1; min-width:200px; font-size:14px;}
.pay-amt{font-weight:700; font-variant-numeric:tabular-nums; min-width:110px; text-align:right;}
.row-actions summary{list-style:none; cursor:pointer;}
.row-actions summary::-webkit-details-marker{display:none;}
.row-actions[open] .row-actions-menu{position:absolute; right:24px; z-index:5; background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:14px; box-shadow:0 8px 24px rgba(0,0,0,.12); min-width:320px; white-space:normal;}
table.data tr.total-row td{font-weight:700; border-top:2px solid var(--line);}
.rev-trend{display:grid; grid-template-columns:repeat(6, 1fr); gap:12px; align-items:end; height:190px;}
.rev-col{display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; text-decoration:none; color:var(--muted); font-size:12px;}
.rev-bar{flex:1; width:100%; max-width:56px; display:flex; flex-direction:column-reverse; border-radius:6px 6px 0 0; overflow:hidden; background:var(--surface-2);}
.rev-monthly{background:var(--blue); display:block;}
.rev-setup{background:#a8791f; display:block;}
.rev-col.on .rev-lbl{color:var(--ink); font-weight:700;}
.rev-col.on .rev-bar{outline:2px solid var(--red); outline-offset:2px;}
.rev-val{font-weight:600; color:var(--ink); min-height:16px;}
@media print{ .no-print{display:none !important;} }

/* ---------- Get set up checklist ---------- */
.setup-panel{border-left:4px solid var(--green);}
.setup-steps{list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:6px 24px;}
.setup-steps li{display:grid; grid-template-columns:22px 1fr; gap:2px 10px; align-items:start; padding:7px 0; font-size:13.5px;}
.setup-steps .tick{width:20px; height:20px; border-radius:50%; border:2px solid var(--line); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; grid-row:span 2;}
.setup-steps li.done .tick{background:var(--green); border-color:var(--green);}
.setup-steps li.done .t{color:var(--muted); text-decoration:line-through;}
.setup-steps a.t{color:var(--ink); font-weight:600; text-decoration:none;}
.setup-steps a.t:hover{color:var(--red);}
.setup-steps .h{font-size:12px; grid-column:2;}

/* ---------- Import ---------- */
.import-kinds{display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:10px;}
.import-kind{display:flex; gap:10px; align-items:flex-start; border:1px solid var(--line); border-radius:8px; padding:12px 14px; cursor:pointer;}
.import-kind:has(input:checked){border-color:var(--red); box-shadow:0 0 0 1px var(--red) inset;}
.import-kind input{margin-top:3px; accent-color:var(--red);}
.import-kind > span{display:flex; flex-direction:column; gap:4px; font-size:13.5px;}
.import-kind .muted{font-size:12px;}

/* ---------- Activity log ---------- */
.activity-filters{display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end;}
.activity-filters .field{margin:0; min-width:150px;}
.act-dot{display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:8px; background:var(--muted); vertical-align:1px;}
.act-create{background:var(--green);} .act-update{background:var(--blue);} .act-delete{background:var(--red);}
.act-security, .act-access{background:#a8791f;} .act-download, .act-request{background:#6b4fa0;} .act-sign-in{background:var(--line);}

/* ---------- Bank matching ---------- */
.sub-tabs{margin-bottom:12px;}
.bank-lines{display:flex; flex-direction:column;}
.bank-line{padding:12px 0; border-bottom:1px solid var(--line);}
.bank-line:last-child{border-bottom:none;}
.bl-main{display:flex; gap:14px; align-items:baseline;}
.bl-date{width:54px; flex:0 0 auto; font-size:12.5px;}
.bl-desc{flex:1; min-width:0; font-size:14px; overflow-wrap:anywhere;}
.bl-amt{font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap;}
.bl-amt.in{color:var(--green);}
:root[data-theme="dark"] .bl-amt.in{color:#6fd99a;}
.bl-act{display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin:8px 0 0 68px; font-size:13px;}
.bl-act form{margin:0;}
.bl-sugg{flex:1 1 320px;}
.bl-choose summary{list-style:none; cursor:pointer;}
.bl-choose summary::-webkit-details-marker{display:none;}
@media (max-width:600px){ .bl-act{margin-left:0;} }

/* ---------- Live client-agency chat ---------- */
.chat-panel{display:flex; flex-direction:column; gap:14px;}
.chat-log{display:flex; flex-direction:column; gap:10px; max-height:60vh; min-height:240px; overflow-y:auto; padding:4px 2px;}
.chat-msg{background:var(--surface-2); border-radius:10px; padding:10px 14px; align-self:flex-start; max-width:78%;}
.chat-msg.mine{align-self:flex-end; background:var(--blue-soft);}
.chat-msg.fresh{animation:chatIn .3s ease-out;}
@keyframes chatIn{from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:none;}}
.chat-meta{font-size:12px; margin-bottom:4px; display:flex; gap:6px; flex-wrap:wrap; align-items:baseline;}
.chat-meta time{margin-left:auto; font-size:11px;}
.chat-text{font-size:14px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere;}
.chat-form{display:flex; gap:10px; align-items:flex-end;}
.chat-form textarea{flex:1; background:var(--surface-2); border:1px solid var(--line); color:var(--ink); padding:10px 12px; border-radius:6px; font:inherit; font-size:14px; resize:vertical;}
.chat-form textarea:focus{outline:none; border-color:var(--red);}
.chat-status{font-size:12px; min-height:16px;}
.nav-badge{display:inline-block; min-width:18px; padding:1px 6px; margin-left:6px; border-radius:10px; background:var(--red); color:#fff; font-size:11px; font-weight:700; text-align:center; line-height:16px;}
.nav-badge[hidden], .bell-badge[hidden]{display:none;}
.bell-badge.static{position:static; display:inline-block;}
.chat-toast{position:fixed; right:20px; bottom:20px; z-index:100; background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--red); border-radius:8px; padding:12px 16px; box-shadow:0 10px 30px rgba(0,0,0,.18); display:flex; flex-direction:column; gap:2px; text-decoration:none; color:var(--ink); font-size:13.5px; transform:translateY(20px); opacity:0; transition:all .3s ease; max-width:320px;}
.chat-toast.show{transform:none; opacity:1;}
.chat-toast span{color:var(--muted); font-size:12.5px;}
.thread-list{display:flex; flex-direction:column;}
.thread{display:flex; gap:12px; align-items:center; padding:12px 6px; border-bottom:1px solid var(--line); text-decoration:none; color:var(--ink);}
.thread:last-child{border-bottom:none;}
a.thread:hover{background:var(--surface-2);}
.thread.unread strong{color:var(--red);}
.thread.locked{opacity:.6;}
.thread-body{flex:1; min-width:0; display:flex; flex-direction:column; font-size:14px;}
.thread-body .muted{font-size:12.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.thread-side{display:flex; flex-direction:column; align-items:flex-end; gap:4px;}
@media (max-width:600px){ .chat-msg{max-width:92%;} .chat-form{flex-direction:column; align-items:stretch;} }
