/* Flozic Admin — Slate Pro design system (live build) */
:root{
  --bg:#f8fafc; --panel:#ffffff; --ink:#0f172a; --muted:#64748b; --line:#e7ebf0;
  --side:#0b1220; --side2:#131c30; --sideink:#9fb0c9; --sideact:#1e293b;
  --brand:#2563eb; --brand2:#3b82f6; --brand-soft:#dbeafe;
  --ok:#16a34a; --bad:#dc2626; --warn:#d97706;
  --r:10px; --shadow:0 1px 2px rgba(15,23,42,.04),0 1px 3px rgba(15,23,42,.06);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:var(--bg);color:var(--ink);font-size:14px;-webkit-font-smoothing:antialiased}
a{text-decoration:none;color:inherit}
button{font-family:inherit}

/* minmax(0,1fr) — NOT plain 1fr — so the content column can shrink below its
   min-content width. A bare 1fr track defaults to a min of auto (=min-content),
   which lets wide tables (nowrap action cells, long emails) blow the column past
   the viewport and push the whole page off-screen. minmax(0,…) caps that so the
   inner .tablewrap{overflow-x:auto} scrolls the table instead. */
.app{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh}

/* ---------- Sidebar ---------- */
.side{background:var(--side);color:var(--sideink);position:sticky;top:0;height:100vh;overflow:auto;padding-bottom:24px}
.side::-webkit-scrollbar{width:8px}
.side::-webkit-scrollbar-thumb{background:#1e2a44;border-radius:8px}
.side .brand{display:flex;align-items:center;gap:10px;padding:18px 20px;border-bottom:1px solid rgba(255,255,255,.06);position:sticky;top:0;background:var(--side);z-index:1;cursor:pointer;text-decoration:none;color:inherit}
.side .logo{width:34px;height:34px;border-radius:9px;background:#000;display:grid;place-items:center;flex:0 0 auto;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08)}
.side .logo svg{width:25px;height:25px;display:block}
.side .brand b{color:#fff;font-size:15px;line-height:1.1}
.side .brand span{font-size:11px;color:#64748b;display:block;margin-top:1px}
.side .grp{padding:16px 14px 4px;font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:#475569;font-weight:700}

.side nav{display:flex;flex-direction:column}
.side nav a{display:flex;align-items:center;gap:11px;padding:9px 14px;margin:1px 8px;border-radius:8px;color:var(--sideink);font-weight:500;font-size:13.5px;cursor:pointer}
.side nav a svg{width:17px;height:17px;stroke:#64748b;fill:none;stroke-width:2;flex:0 0 auto}
.side nav a:hover{background:var(--side2);color:#e2e8f0}
.side nav a:hover svg{stroke:#94a3b8}
.side nav a.active{background:var(--sideact);color:#fff;box-shadow:inset 3px 0 0 var(--brand)}
.side nav a.active svg{stroke:#60a5fa}
.side nav a .ct{margin-left:auto;font-size:11px;color:#7c8aa6;font-weight:600;background:rgba(148,163,184,.12);padding:1px 7px;border-radius:20px}

/* "key" = a few important shortcuts, lifted above the muted default items with a
   brand-blue icon + brighter/bolder label. Layers under .active (no bg/bar clash).
   Easy to revert: delete these two rules + the class="key" attrs in index.html. */
.side nav a.key{color:#e2e8f0;font-weight:600}
.side nav a.key svg{stroke:#60a5fa}

/* submenu */
.side nav .sub{margin:0}
.side nav .has-sub{display:flex;align-items:center;gap:11px;width:calc(100% - 16px);margin:1px 8px;padding:9px 14px;border-radius:8px;background:none;border:0;color:var(--sideink);font-weight:500;font-size:13.5px;cursor:pointer;text-align:left}
.side nav .has-sub svg{width:17px;height:17px;stroke:#64748b;fill:none;stroke-width:2;flex:0 0 auto}
.side nav .has-sub:hover{background:var(--side2);color:#e2e8f0}
.side nav .has-sub .ct{margin-left:auto;font-size:11px;color:#7c8aa6;font-weight:600;background:rgba(148,163,184,.12);padding:1px 7px;border-radius:20px}
.caret{width:0;height:0;border-left:5px solid currentColor;border-top:4px solid transparent;border-bottom:4px solid transparent;opacity:.55;transition:transform .15s ease;margin-left:auto;flex:0 0 auto}
.has-sub .ct ~ .caret{margin-left:7px}
.sub.open > .has-sub .caret{transform:rotate(90deg)}
.sub.open > .has-sub{color:#e2e8f0}
.sub ul{list-style:none;margin:1px 0 3px;padding:0;max-height:0;overflow:hidden;transition:max-height .22s ease}
.sub.open ul{max-height:460px}
.side nav .sub ul a{padding:7px 14px 7px 44px;font-size:13px;color:#8295b3;margin:1px 8px}
.side nav .sub ul a:hover{background:var(--side2);color:#e2e8f0}
.side nav .sub ul a.active{background:var(--sideact);color:#fff;box-shadow:inset 3px 0 0 var(--brand)}

.side nav a.ext .extico{margin-left:auto;font-style:normal;opacity:.5;font-size:12px}
.side nav a.ext .extico::before{content:'\2197'}

/* ---------- Workspace switcher (Admin vs Help Desk) ---------- */
.side .wsswitch{display:flex;gap:6px;padding:12px 12px 8px;position:sticky;top:71px;background:var(--side);z-index:1}
.side .ws-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:7px;padding:8px 6px;border-radius:8px;background:var(--side2);color:#8295b3;font-weight:600;font-size:12.5px;cursor:pointer;text-decoration:none}
.side .ws-tab svg{width:16px;height:16px;stroke:#64748b;fill:none;stroke-width:2;flex:0 0 auto}
.side .ws-tab:hover{color:#e2e8f0}
.side .ws-tab.ws-on{background:var(--sideact);color:#fff;box-shadow:inset 0 0 0 1px rgba(96,165,250,.35)}
.side .ws-tab.ws-on svg{stroke:#60a5fa}
/* only the active workspace's nav pane is visible */
.side .wspane{display:none}
.side .wspane.ws-show{display:block}

/* ---------- Main ---------- */
.main{display:flex;flex-direction:column;min-width:0}
.top{display:flex;align-items:center;gap:14px;padding:13px 26px;background:linear-gradient(180deg,rgba(255,255,255,.94),rgba(248,250,252,.86));backdrop-filter:blur(10px) saturate(1.35);-webkit-backdrop-filter:blur(10px) saturate(1.35);border-bottom:1px solid var(--line);box-shadow:0 6px 22px -16px rgba(15,23,42,.35);position:sticky;top:0;z-index:20}
.burger{display:none;background:none;border:0;color:var(--ink);cursor:pointer;padding:4px;align-items:center}
.burger svg{width:22px;height:22px;stroke:currentColor}
.crumb{font-size:13px;color:var(--muted);white-space:nowrap;font-weight:500;letter-spacing:.01em}
.crumb b{color:var(--ink);font-weight:700}
/* Top-bar date range reads as one segmented control (label · dates · Apply) */
.rangewrap{display:flex;align-items:center;gap:7px;background:#fff;border:1px solid var(--line);border-radius:10px;padding:4px 5px 4px 12px;box-shadow:var(--shadow);transition:border-color .15s,box-shadow .15s}
.rangewrap.hide{display:none}
.rangewrap:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.rangewrap .rl{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700}
.rangewrap .dash{color:var(--muted)}
/* Unified date-range picker — identical look in the funnel panel and the
   Customers panel, so every range control reads as one component. */
.rangewrap input[type=date],.frange input[type=date],.crange input[type=date]{border:1px solid var(--line);background:var(--bg);border-radius:8px;padding:7px 10px;font-size:13px;color:var(--ink);font-family:inherit}
.rangewrap input[type=date]:focus,.frange input[type=date]:focus,.crange input[type=date]:focus{outline:0;border-color:var(--brand);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
/* …but inside the top bar the dates sit flush within the pill (no inner borders) */
.top .rangewrap input[type=date]{border:0;background:transparent;border-radius:6px;padding:5px 6px;box-shadow:none}
.top .rangewrap input[type=date]:focus{outline:0;border:0;box-shadow:none}
#applyRange{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 1px 2px rgba(37,99,235,.28)}
#applyRange:hover{background:#1d4ed8;border-color:#1d4ed8}
.btn{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);background:#fff;border-radius:8px;padding:8px 13px;font-size:13px;font-weight:600;color:#334155;cursor:pointer}
.btn:hover{background:#f8fafc}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.primary:hover{background:#1d4ed8}
.btn.sm{padding:7px 12px;font-size:12.5px}
.btn.ghost{background:transparent;border-color:transparent;color:var(--muted)}
.btn.ghost:hover{background:#f1f5f9;color:#334155}
.ava{width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,var(--brand2),var(--brand));display:grid;place-items:center;color:#fff;font-weight:700;flex:0 0 auto;box-shadow:0 0 0 1px rgba(37,99,235,.18),0 4px 10px -2px rgba(37,99,235,.4);transition:transform .15s,box-shadow .15s}

/* account menu (top-right) */
.usermenu{position:relative;flex:0 0 auto}
.usermenu .ava{border:0;cursor:pointer;font-family:inherit;font-size:14px}
.usermenu .ava:hover{transform:translateY(-1px);box-shadow:0 0 0 1px rgba(37,99,235,.3),0 8px 18px -4px rgba(37,99,235,.55)}
.usermenu-pop{position:absolute;right:0;top:calc(100% + 8px);min-width:220px;background:var(--panel);border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 40px rgba(15,23,42,.16);padding:8px;z-index:60}
.usermenu-head{padding:8px 10px 10px;border-bottom:1px solid var(--line);margin-bottom:6px;display:flex;flex-direction:column;gap:2px}
.usermenu-label{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-weight:600}
.usermenu-email{font-size:13px;color:var(--ink);font-weight:600;word-break:break-all}
.usermenu-logout{display:flex;align-items:center;gap:9px;width:100%;padding:9px 10px;border:0;border-radius:8px;background:none;color:var(--bad);font-size:13.5px;font-weight:600;cursor:pointer;text-align:left}
.usermenu-logout:hover{background:#fef2f2}
.usermenu-logout svg{width:16px;height:16px;flex:0 0 auto}
.usermenu-logout:disabled{opacity:.6;cursor:default}

/* ---------- Page body ---------- */
/* The page column (<main class="content" id="view">): comfortable gutters, and
   capped + centered so wide monitors don't stretch tables edge-to-edge with
   huge gaps between columns. (These paddings were written as `.body`, a class
   no markup ever carried — every page rendered flush and full-bleed.) */
/* No max-width: the top bar spans the full main column, so capping the content
   at 1400px left the page stopping short of a header that did not — 176px of
   dead space each side at a 2000px viewport, which read as a lopsided gap on
   the right. Content now shares the top bar's edges. Re-cap here if very wide
   monitors ever make the tables feel stretched. */
.content{width:100%;margin:0 auto;padding:22px 26px 48px}
.pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.pagehead h1{margin:0;font-size:21px;letter-spacing:-.4px}
.pagehead p{margin:5px 0 0;color:var(--muted);font-size:13px}
.pagehead-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}

/* ---------- KPIs ---------- */
.kpis{display:grid;grid-template-columns:repeat(5,1fr);gap:1px;background:var(--line);border:1px solid var(--line);border-radius:var(--r);overflow:hidden;margin-bottom:18px}
.kpi{background:var(--panel);padding:16px 18px;display:flex;flex-direction:column}
.kpi .l{color:var(--muted);font-size:12.5px;font-weight:600;display:flex;align-items:center;gap:7px}
.kpi .l svg{width:14px;height:14px}
.kpi .v{font-size:26px;font-weight:800;letter-spacing:-.6px;margin:8px 0 2px;font-variant-numeric:tabular-nums}
.kpi .d{font-size:12px;font-weight:700;color:var(--muted)}
.kpi .d.up{color:var(--ok)}.kpi .d.down{color:var(--bad)}
/* Per-card "Details →" link, pinned to the top-right of each KPI card. */
.kpi .kpi-detail{margin-left:auto;font-size:11px;font-weight:700}
.spark{height:30px;margin-top:10px}

/* ---------- Panels / grid ---------- */
.grid{display:grid;grid-template-columns:2fr 1fr;gap:18px;margin-bottom:18px}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);overflow:hidden}
.panel .h{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px 18px;border-bottom:1px solid var(--line)}
.panel .h h3{margin:0;font-size:15px;font-weight:700;color:var(--ink);letter-spacing:-.01em}
.panel .h .s{font-size:12px;color:var(--muted);margin-top:2px}
.panel .c{padding:18px}
.link{color:var(--brand);font-size:12.5px;font-weight:600;cursor:pointer;white-space:nowrap}
.link:hover{text-decoration:underline}
/* right-side header cluster: a "Details →" link sitting next to a range picker */
.panel .h .hctrl{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:flex-end}
/* Tinted, colour-accented header so Recent Payments stands out. */
#recentPanel .h{background:linear-gradient(0deg,#eff6ff,#eff6ff);border-bottom-color:#bfdbfe}
#recentPanel .h h3{color:#1d4ed8}
#recentPanel .h h3::before{content:"";display:inline-block;width:8px;height:8px;border-radius:2px;background:#2563eb;margin-right:8px;vertical-align:middle}
.axis{display:flex;justify-content:space-between;color:#94a3b8;font-size:11px;font-weight:600;margin-top:6px}

/* ---------- Tables ---------- */
.tablewrap{width:100%;overflow-x:auto}
table{width:100%;border-collapse:collapse}
th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#475569;font-weight:700;padding:11px 18px;background:#f1f5f9;border-bottom:1px solid var(--line);white-space:nowrap}
td{padding:12px 18px;border-bottom:1px solid var(--line);font-size:13px;vertical-align:middle}
tr:last-child td{border-bottom:0}
tbody tr:hover td{background:#fbfcfe}
.right{text-align:right}
.mono{font-variant-numeric:tabular-nums;font-weight:700;white-space:nowrap}
.neg{color:var(--bad)}
.cust{font-weight:600;word-break:break-word}
tbody tr.cust-row{cursor:pointer}
.sub2{color:var(--muted);font-size:11.5px;margin-top:2px}

.tag{font-size:11px;font-weight:700;padding:3px 9px;border-radius:6px;border:1px solid;white-space:nowrap;display:inline-block}
.t-ren{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
.t-one{background:#f0fdf4;color:#15803d;border-color:#bbf7d0}
.t-up{background:#fffbeb;color:#b45309;border-color:#fde68a}
.t-ref{background:#fef2f2;color:#b91c1c;border-color:#fecaca}
.t-def{background:#f1f5f9;color:#475569;border-color:#e2e8f0}
/* product identifiers */
.t-connect{background:#eef2ff;color:#4338ca;border-color:#c7d2fe}
.t-bot{background:#faf5ff;color:#7e22ce;border-color:#e9d5ff}
/* payment-logs CSV export control */
.expwrap{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.expwrap .ctl{width:auto;height:34px;padding:5px 9px;font-size:12.5px}
.expwrap .dash{color:var(--muted)}
/* profile-tab section heading (payments below the details grid) */
.pf-subhead{margin:22px 0 10px;font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}

.pill{font-size:11px;font-weight:700;padding:3px 9px;border-radius:20px;display:inline-block;white-space:nowrap}
.pill-ok{background:#f0fdf4;color:#15803d}
.pill-bad{background:#fef2f2;color:#b91c1c}
.pill-warn{background:#fffbeb;color:#b45309}
.pill-info{background:#eff6ff;color:#1d4ed8}
.pill-muted{background:#f1f5f9;color:#475569}
.pf-until{font-size:11px;color:#64748b;font-weight:600;margin-left:2px;white-space:nowrap}
/* "Steps & apps used" reads as one titled card: white panel, hairline-separated
   header carrying a step-count pill and the app flow as a highlighted chip. */
.pf-consteps{margin:0;background:var(--panel);border:1px solid var(--line);border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(15,23,42,.06)}
.pf-substep-h{display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  margin:0;padding:11px 14px;background:var(--brand-soft);border-bottom:1px solid #bfdbfe}
.pf-substep-t{font-weight:700;font-size:11px;color:#1e40af;text-transform:uppercase;letter-spacing:.05em}
.pf-stepn{font-size:11px;font-weight:700;color:#1d4ed8;background:#fff;border:1px solid #bfdbfe;border-radius:999px;padding:2px 9px;letter-spacing:0}
.pf-appflow{font-weight:600;font-size:12px;color:#fff;background:var(--brand);border:1px solid var(--brand);
  border-radius:999px;padding:3px 11px;text-transform:none;letter-spacing:0;margin-left:auto;white-space:nowrap}
.pf-consteps .tablewrap{border:0}
.pf-consteps table{margin:0}
.pf-consteps th{background:#fff;font-size:10.5px;padding:9px 14px}
.pf-consteps td{padding:10px 14px;font-size:13px}
.pf-consteps tbody tr:last-child td{border-bottom:0}
.hdc-reply{flex:1;min-width:0;resize:vertical;font-family:inherit;font-size:13px;padding:7px 10px;border:1px solid #e2e8f0;border-radius:8px;line-height:1.4}
/* Rich-text reply editor + toolbar */
.hd-rte-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:2px;padding:6px 8px;border:1px solid #e2e8f0;border-bottom:0;border-radius:10px 10px 0 0;background:#f8fafc}
.hd-rte-btn{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 6px;border:0;background:transparent;border-radius:6px;color:#475569;cursor:pointer;font-size:14px;line-height:1}
.hd-rte-btn:hover{background:#e2e8f0;color:#0f172a}
.hd-rte-sep{width:1px;height:18px;background:#e2e8f0;margin:0 4px}
.hd-rte-sel{height:28px;border:1px solid #e2e8f0;border-radius:6px;background:#fff;color:#334155;font-size:12.5px;padding:0 4px;cursor:pointer;max-width:120px}
.hd-rte-sel.hd-rte-size{max-width:84px}
.hd-rte-sel:hover{border-color:#cbd5e1}
.hd-discard{color:#b91c1c}
.hd-discard:hover{background:#fef2f2;border-color:#fecaca}
.hd-rte-sw{width:24px;padding:0}
.hd-sw{width:14px;height:14px;border-radius:50%;display:inline-block;box-shadow:0 0 0 1px rgba(0,0,0,.15)}
/* Gmail-style "A" text/background colour button + palette popup */
.hd-rte-colorwrap{position:relative;display:inline-flex}
.hd-rte-colorbtn{gap:3px;padding:0 5px}
.hd-rte-Aicon{position:relative;display:inline-flex;align-items:center;justify-content:center;font-weight:800;font-size:14px;line-height:1;padding-bottom:4px}
.hd-rte-Abar{position:absolute;left:0;right:0;bottom:0;height:3px;border-radius:1px;background:#dc2626}
.hd-rte-caret{color:#94a3b8}
.hd-rte-colormenu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;display:flex;gap:16px;flex-wrap:wrap;padding:12px;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 12px 30px rgba(15,23,42,.16);width:max-content;max-width:min(468px,calc(100vw - 28px))}
/* the palette is closed until the "A" button opens it — a class-level display
   rule would otherwise beat the UA [hidden] rule and keep it always visible */
.hd-rte-colormenu[hidden]{display:none}
.hd-rte-collabel{font-size:12px;font-weight:600;color:#475569;margin-bottom:8px}
.hd-rte-colgrid{display:grid;grid-template-columns:repeat(10,16px);gap:4px}
.hd-rte-cw{width:16px;height:16px;padding:0;border:1px solid rgba(15,23,42,.12);border-radius:3px;cursor:pointer;transition:transform .08s}
.hd-rte-cw:hover{transform:scale(1.2);box-shadow:0 0 0 1px #64748b;position:relative;z-index:1}
/* @mention token in the composer / stored note, and the autocomplete dropdown */
.hd-mention{background:#e7edf5;color:#1d4ed8;border:1px solid #d7e0ec;border-radius:5px;padding:0 4px;font-weight:600;white-space:nowrap}
.hd-mention-menu{position:fixed;z-index:60;min-width:220px;max-width:340px;max-height:264px;overflow-y:auto;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 12px 30px rgba(15,23,42,.18);padding:4px}
.hd-mention-menu[hidden]{display:none}
.hd-mention-item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:7px;cursor:pointer}
.hd-mention-item.active,.hd-mention-item:hover{background:#f1f5f9}
.hd-mention-ava{width:24px;height:24px;border-radius:50%;background:#334155;color:#fff;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;flex:0 0 auto}
.hd-mention-nm{font-size:13px;color:#0f172a;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hd-mention-em{font-size:11.5px;color:#94a3b8;margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:150px}
.hd-composer-input.hd-rte{min-height:150px;max-height:70vh;overflow-y:auto;resize:vertical;border-top:0;border-radius:0 0 10px 10px;padding:12px 14px;line-height:1.55}
/* make the drag-to-resize grip obvious in the admin browser (Chromium/WebKit) */
.hd-composer-input.hd-rte::-webkit-resizer{background:linear-gradient(135deg,transparent 0 44%,#94a3b8 44% 52%,transparent 52% 66%,#94a3b8 66% 74%,transparent 74%);border-bottom-right-radius:10px}
.hd-rte:focus{outline:none;box-shadow:none}
.hd-rte:empty:before{content:attr(data-ph);color:#94a3b8;pointer-events:none}
.hd-rte a{color:#2563eb}
.hd-rte ul,.hd-rte ol{margin:6px 0;padding-left:22px}
.hd-rte p{margin:0 0 8px}
.alert-info{background:#eff6ff;color:#1e40af;border:1px solid #bfdbfe}
.ef-lock{display:flex;align-items:center;gap:6px;font-weight:600}
.ctl-locked{background:#f8fafc;color:#64748b;cursor:not-allowed;border-style:dashed}
.ef-rotag{font-size:10px;font-weight:700;color:#94a3b8;text-transform:uppercase;letter-spacing:.04em;margin-left:6px}
/* Help Desk header notification bell */
.hdnotif{position:relative;display:flex;align-items:center}
.hdnotif-btn{position:relative;width:38px;height:38px;border-radius:10px;border:1px solid #e2e8f0;background:#fff;color:#475569;display:flex;align-items:center;justify-content:center;cursor:pointer}
.hdnotif-btn:hover{background:#f8fafc;color:#1e293b}
.hdnotif-btn svg{width:19px;height:19px}
.hdnotif-badge{position:absolute;top:-5px;right:-5px;min-width:18px;height:18px;padding:0 4px;border-radius:9px;background:#ef4444;color:#fff;font-size:10px;font-weight:800;display:flex;align-items:center;justify-content:center;box-shadow:0 0 0 2px #fff}
.hdnotif-pop{position:absolute;top:46px;right:0;width:340px;max-height:60vh;overflow-y:auto;background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.16);z-index:60}
.hdnotif-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid #f1f5f9;font-weight:700;font-size:13px;color:#0f172a;position:sticky;top:0;background:#fff}
.hdnotif-readall{border:0;background:none;color:#2563eb;font-size:12px;font-weight:600;cursor:pointer}
.hdnotif-empty{padding:22px 14px;color:#94a3b8;font-size:13px;text-align:center}
.hdnotif-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:11px 14px;border:0;border-bottom:1px solid #f1f5f9;background:#fff;cursor:pointer}
.hdnotif-item:hover{background:#f8fafc}
.hdnotif-item.unread{background:#eff6ff}
.hdnotif-item.unread:hover{background:#e0edff}
.hdnotif-title{font-weight:700;font-size:12.5px;color:#0f172a}
.hdnotif-body{font-size:12px;color:#475569;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hdnotif-time{font-size:10.5px;color:#94a3b8;margin-top:1px}
.pill-def{background:#f1f5f9;color:#475569}

.fix{font-size:10px;font-weight:700;color:#b45309;background:#fffbeb;border:1px solid #fde68a;border-radius:5px;padding:1px 5px;margin-left:6px;vertical-align:middle;cursor:help}

/* ---------- Revenue by type bars ---------- */
.barrow{display:flex;align-items:center;gap:12px;margin:14px 0}
.barrow:first-child{margin-top:2px}
.barrow .nm{width:104px;font-size:12.5px;color:#475569;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.track{flex:1;height:9px;background:#eef2f7;border-radius:6px;overflow:hidden}
.fill{height:100%;border-radius:6px;min-width:2px;transition:width .4s ease}
.barrow .amt{width:84px;text-align:right;font-variant-numeric:tabular-nums;font-weight:700;font-size:12.5px}

/* ---------- Search ---------- */
.search{display:flex;align-items:center;gap:8px;background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:7px 11px;width:300px;max-width:100%;color:var(--muted)}
.search svg{flex:0 0 auto}
.search input{border:0;background:none;outline:0;width:100%;font-size:13px;color:var(--ink)}

/* ---------- Global top search (header) ---------- */
/* flex:0 1 520px (not 1 1 auto) + margin-right:auto so the search holds a
   comfortable 520px and the leftover space becomes a LEFT margin on the
   right cluster — pinning bell+avatar to the edge on wide monitors. With
   flex-grow:1 the search ate the width and the cluster drifted to the
   middle once it hit the 520 cap; margin-right:auto survives rangewrap/
   hdnotif being hidden (customer pages hide the range picker). */
.topsearch{position:relative;flex:0 1 520px;min-width:0;margin:0 18px;margin-right:auto}
.topsearch-in{width:100%;background:#fff;border-radius:10px;padding:9px 13px;box-shadow:var(--shadow);transition:border-color .15s,box-shadow .15s,color .15s}
.topsearch-in:hover{border-color:#cfd8e3}
.topsearch-in:focus-within{border-color:var(--brand);color:var(--brand);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.gs-pop{position:absolute;top:calc(100% + 8px);left:0;right:0;background:var(--panel);border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 44px rgba(15,23,42,.18);z-index:70;max-height:min(70vh,520px);overflow:auto;padding:6px}
.gs-loading,.gs-empty{padding:18px 14px;text-align:center;color:var(--muted);font-size:13px}
.gs-group{padding:4px 0}
.gs-group+.gs-group{border-top:1px solid var(--line);margin-top:4px}
.gs-h{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700;padding:8px 12px 4px}
.gs-item{display:block;width:100%;text-align:left;border:0;background:none;cursor:pointer;padding:8px 12px;border-radius:8px;font-family:inherit}
.gs-item:hover{background:var(--brand-soft)}
.gs-main{display:block;font-size:13.5px;font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gs-sub{display:block;font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
/* Search result WITH a signup date: text block on the left (allowed to shrink +
   ellipsis), date pinned right in what used to be dead space. */
.gs-item-when{display:flex;align-items:center;gap:12px}
.gs-item-when .gs-txt{flex:1 1 auto;min-width:0}
/* signup date: plain text, no chip/colour (per Ram) */
.gs-when{flex:0 0 auto;text-align:right;line-height:1.25}
.gs-when-l{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:700}
.gs-when-d{display:block;font-size:12px;font-weight:600;color:#475569;white-space:nowrap;font-variant-numeric:tabular-nums}

/* ---------- list filter bar ---------- */
.filterbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:14px 18px;border-bottom:1px solid var(--line)}
/* Icon-only buttons (Export CSV) — square, no label, tooltip carries the name. */
.btn.icon-only{display:inline-flex;align-items:center;justify-content:center;width:32px;padding:0;flex:0 0 auto}
.filterbar .search{width:auto;flex:1 1 220px;min-width:180px}
.filterbar .fsel{border:1px solid var(--line);background:#fff;border-radius:8px;padding:8px 11px;font-size:13px;color:var(--ink);font-family:inherit;cursor:pointer}
.filterbar .fsel:focus{outline:0;border-color:var(--brand);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.filterbar .fdate{border:1px solid var(--line);background:#fff;border-radius:8px;padding:7px 10px;font-size:13px;color:var(--ink);font-family:inherit}
.filterbar .fdate:focus{outline:0;border-color:var(--brand);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.filterbar .frl{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:700}
/* Pin the action buttons to the right edge so a wrapped filter row reads as a
   deliberate second line instead of controls left dangling mid-bar. */
.filterbar #lfApply,.filterbar #hdApply{margin-left:auto}
/* A From/To label + its date input wrap as one unit, never splitting apart. */
.filterbar .fgroup{display:inline-flex;align-items:center;gap:8px}

/* ---------- Pager ---------- */
.pager{display:flex;align-items:center;gap:12px;justify-content:flex-end;padding:14px 18px;border-top:1px solid var(--line);color:var(--muted);font-size:12.5px}
.pager .pinfo{margin-right:auto}
.pager button{border:1px solid var(--line);background:#fff;border-radius:8px;padding:6px 12px;font-size:12.5px;font-weight:600;color:#334155;cursor:pointer}
.pager button:hover:not(:disabled){background:#f8fafc}
.pager button:disabled{opacity:.45;cursor:default}

/* ---------- States ---------- */
.loading,.empty,.errbox{padding:48px 20px;text-align:center;color:var(--muted);font-size:14px}
.empty{padding:36px 20px}
.errbox{color:var(--bad)}
.spin{width:22px;height:22px;border:2.5px solid var(--line);border-top-color:var(--brand);border-radius:50%;display:inline-block;animation:sp .7s linear infinite;vertical-align:-5px;margin-right:10px}
@keyframes sp{to{transform:rotate(360deg)}}

.ph{max-width:520px;margin:60px auto;text-align:center;background:var(--panel);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);padding:42px 34px}
.ph .ico{width:54px;height:54px;border-radius:14px;background:var(--brand-soft);color:var(--brand);display:grid;place-items:center;margin:0 auto 16px}
.ph .ico svg{width:26px;height:26px;stroke:currentColor;fill:none;stroke-width:2}
.ph h2{margin:0 0 8px;font-size:19px}
.ph p{margin:0;color:var(--muted);font-size:13.5px;line-height:1.6}

/* ---------- Scrim (mobile) ---------- */
.scrim{position:fixed;inset:0;background:rgba(2,6,23,.5);z-index:30;opacity:0;pointer-events:none;transition:opacity .2s}
.scrim.show{opacity:1;pointer-events:auto}

/* ---------- Forms (Record Payment) ---------- */
.form{max-width:680px}
.hidden{display:none !important}
.frow{margin-bottom:16px}
.frow label{display:block;font-size:12.5px;font-weight:600;color:#334155;margin-bottom:6px}
.frow .req{color:var(--bad);font-weight:700}
.ctl{width:100%;border:1px solid var(--line);border-radius:8px;padding:9px 11px;font-size:14px;font-family:inherit;color:var(--ink);background:#fff;transition:border-color .15s,box-shadow .15s}
.ctl:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
select.ctl{appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");background-repeat:no-repeat;background-position:right 11px center;padding-right:32px}
textarea.ctl{resize:vertical;min-height:54px}
.help{font-size:12px;color:var(--muted);margin-top:6px;line-height:1.5}
.two{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.formactions{display:flex;align-items:center;gap:14px;margin-top:6px;padding-top:16px;border-top:1px solid var(--line)}
.formactions .btn[disabled]{opacity:.6;cursor:default}
.alert{border-radius:8px;padding:11px 13px;font-size:13px;margin-bottom:16px;line-height:1.5}
.alert-ok{background:#f0fdf4;border:1px solid #bbf7d0;color:#15803d}
.alert-bad{background:#fef2f2;border:1px solid #fecaca;color:#b91c1c}
.alert .mono{font-weight:600}
.stripefetch{display:flex;gap:8px;align-items:stretch}
.stripefetch .ctl{flex:1}
.stripefetch .btn{flex:0 0 auto;white-space:nowrap}
.ctl.locked,.ctl[readonly]{background:#f1f5f9;color:#475569;cursor:not-allowed}

/* ---------- Customer Analytics funnel ---------- */
.frange{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.frange .rl{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700}
.frange .dash{color:var(--muted)}

/* Customers panel range toolbar — full-width row under the header so the
   narrow (1fr) panel never squeezes the control into a cramped mid-wrap. */
/* Range rows in narrow side panels (Customers / Recent Payments). The date
   inputs FLEX-SHRINK so label + from – to + Apply always fit on ONE line —
   previously they had fixed intrinsic width and the row wrapped mid-way,
   stranding the dash and pushing Apply to a second line (misaligned). */
.crange{display:flex;align-items:center;gap:7px;flex-wrap:nowrap;padding:11px 18px;border-bottom:1px solid var(--line);background:#fbfcfe}
.crange input[type=date]{flex:1 1 0;min-width:86px;padding:6px 6px}
.crange .btn{flex:0 0 auto;padding:6px 11px}
.crange .dash{flex:0 0 auto}
/* the label is dead weight at this width — two date fields with a dash are
   self-explanatory, and keeping it was what pushed Apply off the row */
.crange .rl{display:none}
.crange .rl{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700}
.crange .dash{color:var(--muted)}

table.funnel{font-variant-numeric:tabular-nums}
.funnel-excluded{color:#2563eb;font-size:11.5px;margin-top:8px;font-variant-numeric:tabular-nums}
/* 17 columns since Live / Deployed OK must fit the card at 1440 px without a
   sideways scroll (Ram, 2026-11-17: "section is too wide"): two-word headers
   may wrap onto a second line, padding and letter-spacing are tighter. The
   .tablewrap still scrolls on narrower screens. */
table.funnel th{padding:6px 3px;text-align:right;font-size:10px;letter-spacing:.01em;line-height:1.2;white-space:normal}
table.funnel th.lft{text-align:left}
table.funnel tr.grp th.gb{text-align:center;color:#475569}
table.funnel tr.sub2h th{background:#fff;font-size:9.5px;color:#94a3b8;padding-top:4px;padding-bottom:7px;vertical-align:bottom}
table.funnel td{padding:7px 3px;font-size:12px}
table.funnel th.lft,table.funnel td.lft{padding-left:8px}
table.funnel td.num{text-align:right}
table.funnel td.lft{font-weight:600;white-space:nowrap;color:#334155}
table.funnel td.z{color:#cbd5e1;font-weight:400}
table.funnel th.gsep,table.funnel td.gsep{border-left:1px solid var(--line)}
table.funnel tr.tot td{background:#fbfcfe;font-weight:800;border-top:2px solid var(--line);border-bottom:0;color:var(--ink)}
table.funnel tbody tr:hover td{background:#f6f9ff}
/* group colours — acquisition / trial / cancelled / paid, so the bands read at a glance */
table.funnel tr.grp th.g-acq{color:#1d4ed8;background:#eff4ff}
table.funnel tr.grp th.g-trial{color:#b45309;background:#fff7ed}
table.funnel tr.grp th.gb.g-cancel{color:#b91c1c;background:#fef2f2}
table.funnel tr.grp th.gb.g-paid{color:#15803d;background:#ecfdf3}
table.funnel tr.sub2h th.g-trial{color:#c2812e;background:#fffaf3}
table.funnel tr.sub2h th.g-cancel{color:#cf6b6b;background:#fff6f6}
table.funnel tr.sub2h th.g-paid{color:#3f9d63;background:#f4fdf7}
table.funnel td.num.g-acq:not(.z){color:#1d4ed8}
table.funnel td.num.g-trial:not(.z){color:#b45309}
table.funnel td.num.g-cancel:not(.z){color:#b91c1c}
table.funnel td.num.g-paid:not(.z){color:#15803d}
/* clickable drill-down cells — a number you can open */
table.funnel td.fcell{cursor:pointer;position:relative;font-weight:700}
table.funnel td.fcell:hover{background:#eef4ff;box-shadow:inset 0 0 0 1px var(--brand)}
table.funnel td.fcell::after{content:"";position:absolute;left:9px;right:9px;bottom:4px;border-bottom:1px dotted currentColor;opacity:.35}
table.funnel td.fcell:hover::after{opacity:.8}
table.funnel tr.tot td.fcell:hover{background:#e6efff}

/* customer summary (beside Recent Payments) */
#custPanel .c{padding:8px 18px}
.srow{display:flex;align-items:center;gap:10px;padding:11px 0;border-bottom:1px solid var(--line)}
.srow:last-child{border-bottom:0}
.srow .dot{width:9px;height:9px;border-radius:50%;flex:0 0 auto}
.srow .lbl{font-size:13px;color:#475569;font-weight:500}
/* value column: EVERY row reserves the same chevron slot (fixed width, hidden
   until hover) so numbers share one right edge whether or not a row is
   clickable — previously only clickable rows had the slot, and 'Upgrades 0'
   (non-clickable) sat further right: zig-zag. */
.srow .val{margin-left:auto;display:flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums;font-weight:700;font-size:13.5px;color:var(--ink)}
.srow .val::after{content:"\203A";width:9px;text-align:left;color:var(--muted);font-weight:800;opacity:0;transform:translateX(-3px);transition:opacity .13s,transform .13s}
.srow .lblsub{color:var(--muted);font-weight:500;font-size:12px}

/* ---------- Detail modal (customer / connect / funnel drill-down) ---------- */
body.modal-open{overflow:hidden}
.modal{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-start;justify-content:center;padding:56px 20px}
.modal[hidden]{display:none}
/* the header's CSV button is .btn.icon-only (display:inline-flex), which beats the
   UA [hidden] rule — without this it showed, dead, on every modal */
.modal-export[hidden]{display:none}
.modal-scrim{position:absolute;inset:0;background:rgba(2,6,23,.55);animation:mfade .15s ease}
@keyframes mfade{from{opacity:0}to{opacity:1}}
.modal-card{position:relative;width:100%;max-width:860px;max-height:calc(100vh - 112px);display:flex;flex-direction:column;background:var(--panel);border-radius:16px;box-shadow:0 30px 80px rgba(2,6,23,.5);overflow:hidden;animation:mrise .18s ease}
@keyframes mrise{from{transform:translateY(10px);opacity:0}to{transform:none;opacity:1}}
.modal-head{display:flex;align-items:center;gap:12px;padding:16px 18px;border-bottom:1px solid var(--line);flex:0 0 auto}
.modal-title{font-size:15px;font-weight:800;color:var(--ink);flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.modal-title .mt-sub{font-weight:500;color:var(--muted);font-size:13px}
.modal-back{border:1px solid var(--line);background:#fff;border-radius:8px;padding:6px 11px;font-size:12.5px;font-weight:600;color:#334155;cursor:pointer;font-family:inherit;flex:0 0 auto}
.modal-back:hover{background:#f8fafc}
.modal-close{border:0;background:#f1f5f9;border-radius:8px;width:30px;height:30px;font-size:15px;color:#475569;cursor:pointer;flex:0 0 auto;line-height:1}
.modal-close:hover{background:#e2e8f0;color:var(--ink)}
.modal-body{padding:16px 18px 20px;overflow:auto}
.modal-body table{width:100%;border-collapse:collapse}
.modal-body thead th{position:sticky;top:0;background:var(--panel);text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:700;padding:8px 10px;border-bottom:1px solid var(--line);z-index:1}
.modal-body td{padding:9px 10px;font-size:13px;border-bottom:1px solid var(--line);color:#334155}
.modal-body td.num{text-align:right;font-variant-numeric:tabular-nums;font-weight:600}
.modal-body tr.rowlink{cursor:pointer}
.modal-body tr.rowlink:hover td{background:var(--brand-soft)}
.modal-foot{padding:12px 4px 0;color:var(--muted);font-size:12.5px;text-align:right}
.modal-pager{border-top:0;padding:12px 0 0}
.modal-sec{margin-bottom:20px}
.modal-sec:last-child{margin-bottom:0}
.modal-sec h4{margin:0 0 10px;font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:700}
.modal-sec-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.modal-sec-head h4{margin:0}
.mstat{font-size:12px;font-weight:700;color:var(--brand);background:var(--brand-soft);border-radius:20px;padding:4px 11px;white-space:nowrap}
.kvgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:10px;overflow:hidden}
.kv{display:flex;flex-direction:column;gap:2px;background:var(--panel);padding:9px 12px}
.kvk{font-size:10.5px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:700}
.kvv{font-size:13px;color:var(--ink);font-weight:600;word-break:break-word}

/* ---------- Customer profile — hero card + stat band + details card ----------
   V1-inspired sectioning (Ram, 2026-09-23): the old dashboard read as clear
   stacked blocks — hero header, stats strip, one boxed details card — on a grey
   canvas. Rebuilt in the Slate language: white cards, one brand banner. */
.pf-hero{background:var(--panel);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:visible;margin-bottom:18px;position:relative;z-index:2}
.pf-banner{height:92px;background:linear-gradient(112deg,#0f2c7e 0%,#2563eb 48%,#3b82f6 72%,#7db4f9 100%);position:relative;border-radius:13px 13px 0 0;overflow:hidden}
.pf-banner::after{content:"";position:absolute;inset:0;background:radial-gradient(440px 130px at 82% -30%,rgba(255,255,255,.32),transparent 62%),radial-gradient(320px 110px at 12% 140%,rgba(255,255,255,.14),transparent 60%)}
.pf-hero-body{display:flex;align-items:flex-start;gap:20px;padding:0 24px 20px}
/* position+z-index are load-bearing: .pf-banner is positioned (it carries a
   ::after sheen), so without them it paints over the avatar's overlapping top. */
.pf-avatar{position:relative;z-index:1;flex:0 0 auto;width:76px;height:76px;border-radius:50%;display:grid;place-items:center;font-size:25px;font-weight:700;color:#fff;background:linear-gradient(135deg,#3b82f6,#1e40af);letter-spacing:.02em;margin-top:-34px;box-shadow:0 0 0 4px var(--panel),0 6px 14px rgba(15,23,42,.22)}
.pf-idblock{min-width:0;flex:1 1 auto;padding-top:14px}
.pf-name{font-size:22px;font-weight:700;color:var(--ink);line-height:1.2;letter-spacing:-.01em}
.pf-email{font-size:13.5px;color:#475569;margin-top:3px;word-break:break-word}
/* meta facts as quiet chips instead of one dotted line */
.pf-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.pf-chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:500;color:var(--muted);background:var(--bg);border:1px solid var(--line);border-radius:999px;padding:4px 11px;white-space:nowrap}
.pf-chip b{color:var(--ink);font-weight:600}
.pf-chip .mono2{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--ink);font-weight:600}
.pf-statuswrap{flex:0 0 auto;align-self:flex-start;padding-top:16px}
.pf-statuswrap .pill,.pf-statusline .pill{font-size:12px;padding:4px 12px}

/* Stat band: ONE white card, hairline-divided cells (V1's stats strip, roomier).
   gap:1px over a line-coloured grid = dividers that survive wrapping. */
.pf-stats{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden;margin-bottom:18px}
/* Dual-product band: 7 tracks, and the Plan cell takes two of them. At 1/6 the
   cell could not fit "<product> <plan> <period> <status>" and clipped the plan
   name to "Standard …". */
/* Bands carrying labelled-row cells size every track to minmax(max-content,1fr):
   a track never falls below the width its own content needs (equal sixths
   clipped the plan name to "Standard …"), and the leftover is shared evenly
   rather than pooling in the plain-number cards — fixed max-content tracks let
   Sales swell to fill the slack while the paired cells stayed cramped. */
.pf-stats-dual{grid-template-columns:repeat(6,minmax(max-content,1fr))}
.pf-stats-ab{grid-template-columns:repeat(5,minmax(max-content,1fr))}
.pf-stats-dual .sc-planwide,.pf-stats-ab .sc-planwide{grid-column:auto}
/* Below this the six content-floored tracks no longer fit side by side and
   would overflow the page, so these bands wrap earlier than the plain one. */
@media (max-width:1280px){
  .pf-stats-dual,.pf-stats-ab{grid-template-columns:repeat(3,minmax(0,1fr))}
}
/* Dual-product profiles stack one stat band per product; this label row names
   the product above each band (single-product profiles render no label). */
.pf-bandlbl{display:flex;align-items:center;gap:8px;margin:0 0 8px 2px;font-size:12px;color:var(--muted);font-weight:600}
.pf-bandlbl .tag{font-size:11px}
.sc{display:block;background:var(--panel);border:0;border-radius:0;box-shadow:none;padding:16px 18px;min-width:0}
.sc-ic{display:none}
.sc-body{min-width:0;flex:1}
.sc-k{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);font-weight:700;line-height:1.3}
/* value stays on ONE line; the plan period drops to its own line under the name */
.sc-v{font-size:19px;font-weight:600;color:var(--ink);margin-top:6px;font-variant-numeric:tabular-nums;line-height:1.3;white-space:nowrap}
.sc-green .sc-v{color:var(--ok)}
.sc-plan .sc-v{color:var(--brand)}
.sc-sub{display:block;font-size:11.5px;font-weight:500;color:var(--muted);text-transform:capitalize;margin-top:1px}
/* quota usage bar (Tasks / Mindbody): the "managed properly" cue */
.sc-bar{height:5px;border-radius:999px;background:#edf1f7;margin-top:9px;overflow:hidden}
.sc-bar i{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,var(--brand2),var(--brand));min-width:3px}
.sc-bar.warn i{background:linear-gradient(90deg,#f59e0b,#d97706)}
.sc-bar.hot i{background:linear-gradient(90deg,#ef4444,#dc2626)}
.sc-pct{font-size:11px;font-weight:600;color:var(--muted);margin-top:5px}

/* Details card: tab strip header + padded panel (V1's "Customer's Details" box) */
.pf-card{background:var(--panel);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}
.pf-tabs{display:flex;gap:2px;flex-wrap:wrap;margin:0;border-bottom:1px solid var(--line);padding:0 14px;background:linear-gradient(180deg,#fbfcfe,#f6f8fb)}
.pf-tab{appearance:none;border:0;border-bottom:2px solid transparent;background:none;padding:13px 11px;margin:0 2px -1px;font-size:13px;font-weight:600;color:#64748b;cursor:pointer;border-radius:0;white-space:nowrap}
.pf-tab:hover{color:#0f172a;border-bottom-color:#cbd5e1}
.pf-tab.active{color:var(--brand);border-bottom-color:var(--brand);background:none;box-shadow:none}
.pf-panel{min-height:80px;padding:18px 20px 20px}
.pf-search{margin-bottom:14px}
.pf-search input{width:100%;max-width:340px;border:1px solid var(--line);border-radius:8px;padding:9px 13px;font-size:13px;color:var(--ink);background:#fff}
.pf-search input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.pf-appimg{width:18px;height:18px;border-radius:4px;object-fit:cover;vertical-align:-4px;margin-right:7px}
/* framed tables inside the profile panels (V1's bordered listing) */
.pf-panel .tablewrap{border:1px solid var(--line);border-radius:10px}
.pf-panel th{background:#f8fafc}
.pf-panel .pf-consteps .tablewrap{border:0;border-radius:0}
.pf-panel .pf-consteps th{background:#fff}

@media (max-width:1080px){
  .pf-stats,.pf-stats-dual,.pf-stats-ab{grid-template-columns:repeat(3,minmax(0,1fr))}
  .pf-stats-dual .sc-planwide,.pf-stats-ab .sc-planwide{grid-column:auto}
}
@media (max-width:640px){
  .pf-stats,.pf-stats-dual,.pf-stats-ab{grid-template-columns:repeat(2,minmax(0,1fr))}
  .pf-hero-body{flex-wrap:wrap;gap:14px}
  .pf-avatar{width:64px;height:64px;font-size:21px;margin-top:-28px}
}

/* ---------- Clickable drill-downs (Revenue by Type + Customers panel) ---------- */
/* Revenue-by-Type bar rows become buttons: hover lift + cursor cue. */
.barrow.rev-click{cursor:pointer;border-radius:8px;padding:6px 8px;margin:8px -8px;transition:background .13s}
.barrow.rev-click:hover{background:var(--brand-soft)}
.barrow.rev-click:hover .nm{color:var(--brand)}
.barrow.rev-click .amt{display:flex;align-items:center;justify-content:flex-end;gap:5px}
.barrow.rev-click .amt::after{content:"\203A";color:var(--muted);font-weight:800;opacity:0;transform:translateX(-3px);transition:opacity .13s,transform .13s}
.barrow.rev-click:hover .amt::after{opacity:1;transform:none;color:var(--brand)}
/* Customers-summary rows become buttons when the value is > 0. */
.srow.srow-click{cursor:pointer;border-radius:8px;margin:0 -8px;padding-left:8px;padding-right:8px;transition:background .13s}
.srow.srow-click:hover{background:var(--brand-soft)}
.srow.srow-click:hover .lbl{color:var(--brand)}

.srow.srow-click:hover .val::after{opacity:1;transform:none;color:var(--brand)}

/* ---------- Total Revenue "+ credit log" suffix on the KPI card ---------- */
.kpi-plus{font-size:13px;font-weight:800;letter-spacing:-.2px;color:var(--brand);white-space:nowrap}
.kpi-plus.pend{color:var(--muted);font-weight:700;font-style:italic}

/* ---------- Product Credit Log table ---------- */
#creditLogPanel{margin-top:18px}
/* Fit all 8 columns to the panel — no horizontal scrollbar (Ram, 2026-10-30).
   table-layout:fixed makes the table exactly 100% wide; the long Reference id
   truncates with an ellipsis instead of pushing a sideways slider. */
#creditLogPanel .tablewrap{overflow-x:hidden}
.cl-table{font-size:12.5px;table-layout:fixed;width:100%}
.cl-table th,.cl-table td{padding:10px 12px}
.cl-table th{white-space:nowrap}
.cl-table td{vertical-align:top;line-height:1.4;overflow-wrap:anywhere}
.cl-table td .sub2{margin-top:2px}
/* first/last columns line up with the panel header's 18px inset */
.cl-table th:first-child,.cl-table td:first-child{padding-left:18px}
.cl-table th:last-child,.cl-table td:last-child{padding-right:18px}
.cl-table td .mono{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
.cl-table th:nth-child(1),.cl-table td:nth-child(1){width:46px;text-align:right;color:var(--muted)}
.cl-table th:nth-child(2),.cl-table td:nth-child(2){width:16%}
.cl-table th:nth-child(3),.cl-table td:nth-child(3){width:18%}
.cl-table th:nth-child(4),.cl-table td:nth-child(4){width:19%}
.cl-table th:nth-child(5),.cl-table td:nth-child(5){width:118px;white-space:nowrap}
.cl-table th:nth-child(6),.cl-table td:nth-child(6){width:17%}
.cl-table th:nth-child(7),.cl-table td:nth-child(7){width:160px}
.cl-table th:nth-child(8),.cl-table td:nth-child(8){width:140px}

/* Full-width range bars (Recent Payments, Product Credit Log): the side-panel
   rule above stretches each date field to half the page here. Give them a
   normal fixed width and keep Apply/Clear right next to them. */
#recentPanel .crange input[type=date],#creditLogPanel .crange input[type=date]{flex:0 0 auto;width:150px;padding:6px 8px}
#recentPanel .crange .rl,#creditLogPanel .crange .rl{display:inline;margin-right:4px}
/* Narrow screens: 8 fixed columns can't fit, so keep a readable minimum width
   and let the table scroll sideways instead of overlapping the text. */
@media(max-width:900px){
  #creditLogPanel .tablewrap{overflow-x:auto}
  .cl-table{min-width:960px}
}
@media(max-width:560px){
  #recentPanel .crange,#creditLogPanel .crange{flex-wrap:wrap}
  #recentPanel .crange input[type=date],#creditLogPanel .crange input[type=date]{flex:1 1 0;width:auto;min-width:0}
  #recentPanel .crange .rl,#creditLogPanel .crange .rl{display:none}
}
.cl-empty{text-align:center;color:var(--muted);font-size:13px;font-weight:500;padding:34px 12px !important}

/* ---------- Customer profile: FULL PAGE + action toolbar ---------- */
.btn.danger{background:#fff;border-color:#fecaca;color:#dc2626}
.btn.danger:hover{background:#fef2f2}
.btn.ok{background:#fff;border-color:#bbf7d0;color:#15803d}
.btn.ok:hover{background:#f0fdf4}
/* No own cap: .content already caps the workspace at 1400px and centres it. A
   second, narrower cap here is NOT centred, so the difference piled up as dead
   space on the right (214px at a 1920px viewport). Fill the column instead. */
.pf-page{width:100%}
.pf-topbar{margin:0 0 14px;display:flex;align-items:center;gap:10px}
/* "Updated 21:17:05 · Refresh" — when the profile's figures were last read (the page re-reads them itself). */
.pf-fresh{margin-left:auto;display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);white-space:nowrap}
.pf-fresh-t.bad{color:var(--bad)}
/* What one agent has used — "Tasks 6 · Runs 3 · Tokens 407,636" — small and grey under its id, in every agents list. */
.ab-use{margin-top:2px;font-size:11px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
/* Went offline (#/ab-changes): agents that were live and are not now, and channels paused or removed. */
.ab-chg-bar .seg b{font-weight:700;margin-left:4px;color:var(--ink);font-variant-numeric:tabular-nums}
.ab-chg-sure{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--ink);cursor:pointer;white-space:nowrap}
.ab-chg-sure[hidden]{display:none}
.ab-chg-chips{display:flex;flex-wrap:wrap;gap:6px;padding:12px 18px}
.ab-chg-chip{appearance:none;border:1px solid var(--line);background:#fff;border-radius:999px;padding:4px 10px;font-size:12px;color:var(--muted);cursor:pointer;font-family:inherit;white-space:nowrap}
.ab-chg-chip b{color:var(--ink);margin-left:3px;font-variant-numeric:tabular-nums}
.ab-chg-chip:hover{border-color:#cbd5e1;color:var(--ink)}
.ab-chg-chip.on{background:var(--brand-soft);border-color:var(--brand);color:var(--brand)}
.ab-chg-chip.on b{color:var(--brand)}
.ab-chg-chip.clear{border-style:dashed}
.ab-chg td{vertical-align:top}
.ab-chg th,.ab-chg td{padding-left:12px;padding-right:12px}
.ab-chg .ab-chg-range{white-space:normal}
/* the Agents list's name cell is a flex box; in these taller rows it would stop short of the row's bottom border */
.ab-users.ab-chg td.cust{display:table-cell}
.ab-chg-what{font-weight:600;color:var(--ink);min-width:170px;max-width:260px;white-space:normal;line-height:1.35}
.ab-chg-note{min-width:170px;max-width:260px;white-space:normal;line-height:1.35;margin-top:2px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.ab-chg .tag.ab-chg-weak{border-style:dashed}
.ab-chg-sub{margin-top:3px}
.ab-chg-foot{padding:12px 18px 16px;font-size:12px;color:var(--muted);line-height:1.5}
.ab-chg-miss{color:var(--bad)}
/* right-aligned action cluster (status + buttons) inside the hero */
.pf-actions{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-end;gap:12px;padding-top:14px;align-self:center}
.pf-statusline{display:flex;align-items:center;gap:8px}
.pf-actionbtns{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.pf-menu{position:relative}
.pf-menu-pop{position:absolute;right:0;top:calc(100% + 6px);z-index:20;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 32px rgba(2,6,23,.18);padding:6px;min-width:210px;display:flex;flex-direction:column}
.pf-menu-pop[hidden]{display:none}
.pf-menu-pop button{appearance:none;border:0;background:transparent;text-align:left;padding:9px 11px;border-radius:7px;font-size:13px;font-weight:600;color:#334155;cursor:pointer;white-space:nowrap}
.pf-menu-pop button:hover{background:var(--brand-soft);color:var(--brand)}

/* ---------- Edit customer form ---------- */
/* same left-aligned-gutter problem as .pf-page — the 2-col .ef-grid fills fine */
.ef-page{width:100%}
.ef-head{margin:2px 2px 16px}
.ef-head h2{font-size:22px;font-weight:800;margin:0 0 3px;color:var(--ink)}
.ef-sub{font-size:13px;color:var(--muted)}
.ef-panel{padding:22px}
.ef-sectitle{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin:0 0 18px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.ef-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 22px}
.ef-field{display:flex;flex-direction:column;gap:6px}
.ef-lab{font-size:12.5px;font-weight:700;color:#334155}
.ef-lab .req{color:#dc2626}
.ef-input{width:100%;border:1px solid var(--line);border-radius:9px;padding:10px 12px;font-size:14px;color:var(--ink);background:#fff;outline:none;transition:border-color .15s,box-shadow .15s}
.ef-input:focus{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
select.ef-input{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:34px}
.ef-msg{margin:18px 0 0;font-size:13px;font-weight:600;padding:10px 12px;border-radius:9px}
.ef-msg.ok{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0}
.ef-msg.err{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}
.ef-actions{display:flex;gap:10px;margin-top:22px}
/* Edit customer → "Agent Builder · AI tokens" (admin token grant) */
/* Edit customer → Agent Builder · AI tokens: the account, figure tiles that
   fill the row (auto-fit, so no empty grey cell), a two-field grant form
   (Ram, 2026-11-18: "looks clumsy … make it smooth"). */
.abg-panel{margin-top:18px}
.abg-acct{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;font-weight:600;color:var(--ink);margin:0 0 14px;word-break:break-word}
.abg-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:0 0 20px}
.abg-stat{border:1px solid var(--line);border-radius:10px;background:#fbfcfe;padding:10px 12px;min-width:0}
.abg-k{font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.abg-v{font-size:18px;font-weight:800;color:var(--ink);margin-top:4px;font-variant-numeric:tabular-nums;white-space:nowrap}
.abg-of{font-size:13px;font-weight:600;color:var(--muted)}
.abg-s{font-size:11.5px;color:var(--muted);margin-top:2px}
.abg-form{display:grid;grid-template-columns:minmax(200px,280px) minmax(240px,1fr);gap:14px 16px;align-items:start;max-width:860px}
.abg-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:7px}
.abg-echo{font-size:11.5px;font-weight:600;color:#6d28d9;margin-left:4px;font-variant-numeric:tabular-nums}
.abg-foot{display:flex;align-items:center;gap:12px;margin-top:16px}
.abg-panel .ef-msg{margin-top:10px}
@media(max-width:720px){.abg-form{grid-template-columns:1fr}}
.abg-panel .ef-input:disabled,.abg-panel .btn[disabled]{opacity:.6;cursor:not-allowed}
.abg-panel td.num,.abg-panel th.num{text-align:right;font-variant-numeric:tabular-nums}
.abg-note{white-space:normal;overflow-wrap:anywhere;word-break:break-word;min-width:180px;max-width:520px}

/* ---------- Responsive ---------- */
@media(max-width:1100px){
  .grid{grid-template-columns:1fr}
}
@media(max-width:980px){
  .app{grid-template-columns:minmax(0,1fr)}
  .side{position:fixed;left:0;top:0;width:268px;transform:translateX(-100%);transition:transform .22s ease;z-index:40;box-shadow:0 12px 48px rgba(0,0,0,.45)}
  .side.open{transform:none}
  .burger{display:inline-flex}
  .kpis{grid-template-columns:repeat(2,1fr)}
  .pf-stats{grid-template-columns:repeat(3,1fr)}
  .content{padding:18px 16px 40px}
  .top{padding:12px 16px}
  .filterbar .search{width:220px}
  .topsearch{margin:0 10px}
}
@media(max-width:560px){
  .kpis{grid-template-columns:1fr}
  .pf-stats{grid-template-columns:repeat(2,1fr)}
  .cl-table{font-size:11.5px}
  .ef-grid{grid-template-columns:1fr}
  .pf-hero-body{flex-wrap:wrap}
  .pf-actions{align-items:flex-start;width:100%;padding-top:0;align-self:auto}
  .pf-actionbtns{justify-content:flex-start}
  .pf-panel{padding:14px 13px 16px}
  .rangewrap .rl{display:none}
  .crumb{display:none}
  .topsearch{margin:0 8px 0 0}
  .modal{padding:0}
  .modal-card{max-width:none;max-height:100vh;height:100vh;border-radius:0}
  .kvgrid{grid-template-columns:1fr}
  .two{grid-template-columns:1fr}
}

/* ---------- Login screen ---------- */
.login-body{display:grid;place-items:center;min-height:100vh;background:
  radial-gradient(1200px 600px at 50% -10%,#0f1d3a 0%,transparent 60%),
  linear-gradient(160deg,#0b1220 0%,#131c30 100%);padding:24px}
.login-wrap{width:100%;max-width:404px}
.login-card{background:var(--panel);border-radius:16px;padding:30px 30px 26px;
  box-shadow:0 24px 60px rgba(2,6,23,.45),0 2px 6px rgba(2,6,23,.3)}
.login-brand{display:flex;align-items:center;gap:11px;margin-bottom:22px}
.login-logo{width:38px;height:38px;border-radius:10px;background:#000;display:grid;place-items:center;flex:0 0 auto;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08)}
.login-logo svg{width:27px;height:27px;display:block}
.login-brandtext b{display:block;font-size:16px;font-weight:800;color:var(--ink);line-height:1.1}
.login-brandtext span{font-size:11px;color:var(--muted)}

.login-tabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;background:#f1f5f9;border-radius:10px;padding:4px;margin-bottom:22px}
.login-tab{border:0;background:none;padding:9px 8px;border-radius:7px;font-size:13px;font-weight:600;color:var(--muted);cursor:pointer}
.login-tab.active{background:var(--panel);color:var(--ink);box-shadow:var(--shadow)}

.login-title{font-size:20px;font-weight:800;margin:0 0 4px}
.login-sub{font-size:13px;color:var(--muted);margin:0 0 20px}

.login-field{display:block;margin-bottom:14px}
.login-field[hidden]{display:none}
.login-field span{display:block;font-size:12px;font-weight:600;color:#334155;margin-bottom:6px}
.login-field input{width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:9px;font-size:14px;color:var(--ink);background:#fff;outline:none;transition:border-color .15s,box-shadow .15s}
.login-field input:focus{border-color:var(--brand2);box-shadow:0 0 0 3px var(--brand-soft)}
.login-hint{font-size:11.5px;color:var(--muted);margin:-6px 0 14px;line-height:1.5}

.login-msg{font-size:13px;font-weight:500;padding:10px 12px;border-radius:9px;margin-bottom:14px}
.login-msg.error{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}
.login-msg.success{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0}

.login-btn{width:100%;padding:12px;border:0;border-radius:10px;background:var(--brand);color:#fff;font-size:14px;font-weight:700;cursor:pointer;transition:background .15s}
.login-btn:hover{background:#1d4ed8}
.login-btn:disabled{opacity:.65;cursor:default}

.login-foot{font-size:12px;color:var(--muted);text-align:center;margin:18px 0 0}
.login-copy{text-align:center;color:#64748b;font-size:11.5px;margin:16px 0 0;letter-spacing:.02em}

/* ================================================================
 * HELPDESK (Support) — Phase 1
 * ================================================================ */

/* Support dashboard KPI grid: 4 per row (8 cards) instead of 5. */
.kpis.hd-kpis{grid-template-columns:repeat(4,1fr)}

/* ---- Status & priority pills (color-coded) ---- */
.hd-pill{font-size:11px;font-weight:700;padding:3px 9px;border-radius:20px;display:inline-block;white-space:nowrap;border:1px solid transparent;line-height:1.5}
/* statuses */
.hd-st-new{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
.hd-st-open{background:#ecfeff;color:#0e7490;border-color:#a5f3fc}
.hd-st-pending{background:#fffbeb;color:#b45309;border-color:#fde68a}
.hd-st-waiting-on-customer{background:#fff7ed;color:#c2410c;border-color:#fed7aa}
.hd-st-waiting-on-third-party{background:#fdf4ff;color:#a21caf;border-color:#f5d0fe}
.hd-st-in-progress{background:#eef2ff;color:#4338ca;border-color:#c7d2fe}
.hd-st-resolved{background:#f0fdf4;color:#15803d;border-color:#bbf7d0}
.hd-st-closed{background:#f1f5f9;color:#475569;border-color:#e2e8f0}
.hd-st-reopened{background:#fef2f2;color:#b91c1c;border-color:#fecaca}
.hd-st-archived{background:#f8fafc;color:#94a3b8;border-color:#e7ebf0}
.hd-st-def{background:#f1f5f9;color:#475569;border-color:#e2e8f0}
/* priorities */
.hd-pr-low{background:#f0fdf4;color:#15803d;border-color:#bbf7d0}
.hd-pr-medium{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
.hd-pr-high{background:#fffbeb;color:#b45309;border-color:#fde68a}
.hd-pr-urgent{background:#fff1e9;color:#c2410c;border-color:#fed7aa}
.hd-pr-critical{background:#fef2f2;color:#b91c1c;border-color:#fecaca}
.hd-pr-def{background:#f1f5f9;color:#475569;border-color:#e2e8f0}

/* ---- Ticket list rows / tags ---- */
tbody tr.hd-row{cursor:pointer}
/* subtle, unified row hover — calm and consistent across every row state */
tbody tr.hd-row:hover > td{background:#f8fafc}
/* A ticket awaiting our reply (new customer message): a calm amber LEFT-EDGE +
   a bold subject + the "New reply" badge — NO full-row cream wash (that turned
   the whole list yellow and drowned out the open-vs-closed distinction). */
tbody tr.hd-row-awaiting > td:first-child{box-shadow:inset 3px 0 0 #f59e0b}
tbody tr.hd-row-awaiting > td.cust{font-weight:600}
/* Resolved / Closed / Archived recede (muted grey text) so ACTIVE tickets stand
   out and open-vs-closed reads at a glance. Status/priority pills keep their own
   colours (they set their own text colour), so the state stays legible. */
tbody tr.hd-row-done > td{color:#9aa3b2}
tbody tr.hd-row-done > td.cust,
tbody tr.hd-row-done > td.mono{color:#9aa3b2;font-weight:400}
/* UNREAD (this agent hasn't opened it since the last customer message): bold
   ticket id + subject, plus a small blue "unread" dot. Opening the ticket clears
   it (server marks it read). This is the opened-vs-unopened cue the agent asked
   for; it never applies to Resolved/Closed rows (gated in app.js). */
tbody tr.hd-row-unread > td.cust,
tbody tr.hd-row-unread > td.mono{font-weight:800;color:#0f172a}
.hd-unread-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#2563eb;margin-right:8px;vertical-align:middle;box-shadow:0 0 0 3px rgba(37,99,235,.14)}
.hd-newreply{display:inline-block;font-size:9.5px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;color:#b45309;background:#fef3c7;border:1px solid #fde68a;border-radius:20px;padding:1px 7px;margin-right:6px;vertical-align:middle}
.hd-awaiting-pill{display:inline-block;font-weight:700;color:#b91c1c;background:#fef2f2;border:1px solid #fecaca;border-radius:20px;padding:1px 9px}
.hd-tagrow{margin-top:5px;display:flex;flex-wrap:wrap;gap:5px}
.hd-tag{font-size:10.5px;font-weight:600;color:#475569;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:5px;padding:1px 7px;white-space:nowrap;display:inline-block}
.filterbar.hd-filterbar{gap:9px}

/* Ticket-list layout — SIX columns only: (1) select (2) Ticket (3) Status
   (4) Priority (5) Agent (6) Team. Customer, department, source and the
   timestamp used to be four extra columns that forced a horizontal scroll;
   they now live on the Ticket cell's second line, so the whole list fits one
   screen. Everything except Ticket shrinks to its content. */
.hd-tickets-table th:nth-child(3),.hd-tickets-table td:nth-child(3),
.hd-tickets-table th:nth-child(4),.hd-tickets-table td:nth-child(4),
.hd-tickets-table th:nth-child(5),.hd-tickets-table td:nth-child(5),
.hd-tickets-table th:nth-child(6),.hd-tickets-table td:nth-child(6){width:1%;white-space:nowrap}
.hd-tickets-table th,.hd-tickets-table td{padding-left:12px;padding-right:12px}
/* The one flexible column. width:100% + max-width:0 is the standard trick that
   lets a TABLE cell shrink below its content width — without it the cell sizes
   to the longest subject and the table overflows (horizontal scroll returns).
   With it, the cell takes the leftover width and the subject ellipsises. */
.hd-tkcell{width:100%;max-width:0}
.hd-tk-l2{overflow:hidden}
/* line 1: #id | subject, on a single line, ellipsised rather than wrapping */
.hd-tk-l1{display:flex;align-items:center;gap:6px;min-width:0;font-size:13.5px;line-height:1.35}
.hd-tk-id{font-variant-numeric:tabular-nums;font-weight:700;color:var(--ink);white-space:nowrap}
.hd-tk-sep{color:#cbd5e1;flex:0 0 auto}
.hd-tk-subj{font-weight:600;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
/* line 2: the folded-in meta (customer · email · dept · source · age) */
.hd-tk-l2{margin-top:2px;font-size:11.5px;color:var(--muted);display:flex;align-items:center;gap:6px;flex-wrap:wrap;line-height:1.4}
.hd-tk-who{font-weight:600;color:#475569}
.hd-tk-dot{color:#cbd5e1}
.hd-tk-ago{white-space:nowrap}
/* unread/done styling now keys off the new cell, not the old .cust/.mono cells */
tbody tr.hd-row-unread > td.hd-tkcell .hd-tk-subj,
tbody tr.hd-row-unread > td.hd-tkcell .hd-tk-id{font-weight:800;color:#0f172a}
tbody tr.hd-row-done > td.hd-tkcell .hd-tk-subj,
tbody tr.hd-row-done > td.hd-tkcell .hd-tk-id{color:#9aa3b2;font-weight:400}
tbody tr.hd-row-done > td.hd-tkcell .hd-tk-l2{color:#b6bec9}

/* ---- Ticket detail: split pane ---- */
.hd-detail{max-width:1240px}
.hd-dhead{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin:0 2px 16px;flex-wrap:wrap}
.hd-dsubject{font-size:20px;font-weight:800;letter-spacing:-.3px;color:var(--ink);line-height:1.25}
.hd-dmeta{font-size:12.5px;color:var(--muted);margin-top:5px}
.hd-dhead-pills{flex:0 0 auto;display:flex;align-items:center;gap:7px}
.hd-split{display:grid;grid-template-columns:1fr 340px;gap:18px;align-items:start}
/* Collapse chevron in the details-panel header (icon only). */
.hd-side-hide{padding:4px 7px;line-height:0;color:var(--muted)}
.hd-side-hide:hover{color:var(--ink)}
/* Slim right-edge rail: the icon-only "show" control, visible only when the
   panel is collapsed. The conversation grows to fill the freed space. */
.hd-side-rail{display:none;width:40px;height:40px;align-items:center;justify-content:center;
  background:var(--panel);border:1px solid var(--line);border-radius:10px;color:var(--muted);
  cursor:pointer;box-shadow:var(--shadow-sm)}
.hd-side-rail:hover{color:var(--ink);border-color:var(--brand)}
.hd-split.hd-side-hidden{grid-template-columns:1fr 40px}
.hd-split.hd-side-hidden .hd-side-panel{display:none}
.hd-split.hd-side-hidden .hd-side-rail{display:inline-flex}
.hd-convo-panel{display:flex;flex-direction:column;min-height:420px}

/* ---- Conversation timeline ---- */
/* No inner scroll — the whole ticket flows in ONE page scroll so the entire
   thread (and full email bodies) read top-to-bottom without a nested scrollbar. */
.hd-timeline{padding:18px;display:flex;flex-direction:column;gap:14px}
.hd-ev{font-size:13px}
/* message bubbles — professional two-tone: OUR reply sits on a faint slate-blue
   band with a dark avatar; the CUSTOMER on white with a light avatar; one muted
   role label. No loud fills (agent≈slate-blue · customer≈white · note≈faint amber). */
.hd-ev-msg{border:1px solid var(--line);border-radius:10px;padding:12px 14px;background:#fff}
/* cards with an avatar become a 2-col grid (gutter | content). minmax(0,1fr)
   + min-width:0 stop a full-width email iframe overflowing on narrow panels. */
.hd-ev-msg:has(> .hd-ev-avatar){display:grid;grid-template-columns:36px minmax(0,1fr);column-gap:12px}
.hd-ev-msg:has(> .hd-ev-avatar) > .hd-ev-head,
.hd-ev-msg:has(> .hd-ev-avatar) > .hd-ev-body{grid-column:2;min-width:0}
/* monochrome initial avatar — slate tones, never rainbow */
.hd-ev-avatar{grid-column:1;grid-row:1 / span 2;align-self:start;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;line-height:1;color:#475569;background:#e2e8f0;border:1px solid #e2e8f0;user-select:none}
/* CUSTOMER (incoming email) = NEUTRAL, no colour — reads like a plain email;
   only OUR replies get brand colour so they stand out. */
.hd-ev-msg.hd-ev-customer{background:#fff;border-color:var(--line);box-shadow:inset 4px 0 0 #e2e8f0}
.hd-ev-msg.hd-ev-customer .hd-ev-avatar{background:#e2e8f0;color:#475569;border-color:#e2e8f0}
.hd-ev-msg.hd-ev-customer .hd-ev-who{color:var(--ink)}
/* OUR reply (agent) = brand blue: soft blue tint + blue rule + blue avatar */
.hd-ev-msg.hd-ev-agent{background:#f5f8ff;border-color:#dbeafe;box-shadow:inset 4px 0 0 #2563eb}
.hd-ev-msg.hd-ev-agent .hd-ev-avatar{background:linear-gradient(135deg,#3b82f6,#1d4ed8);color:#fff;border-color:transparent}
.hd-ev-msg.hd-ev-agent .hd-ev-who{color:#1d4ed8}
/* INTERNAL NOTE = subtle amber accent, kept faint */
.hd-ev-msg.hd-ev-note{background:#fffdf7;border-color:#f2e8cf;box-shadow:inset 3px 0 0 #e3c46b}
.hd-ev-msg.hd-ev-note .hd-ev-avatar{background:#fbf3da;color:#a16207;border-color:#f2e8cf}
/* header: bold name · secondary email · muted role label · pushed-right time */
.hd-ev-head{display:flex;align-items:baseline;gap:8px;margin-bottom:6px;flex-wrap:wrap}
.hd-ev-who{font-weight:600;color:var(--ink);font-size:13px;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-ev-email{font-size:11.5px;font-weight:600;color:#64748b;min-width:0;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-ev-role{font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:#64748b;background:#f1f5f9;border:1px solid #e6ebf1;border-radius:5px;padding:1px 7px;white-space:nowrap}
.hd-ev-msg.hd-ev-agent .hd-ev-role{color:#1d4ed8;background:#eff6ff;border-color:#dbeafe}
.hd-ev-msg.hd-ev-note .hd-ev-role{color:#a16207;background:#fbf3da;border-color:#f2e8cf}
.hd-ev-time{margin-left:auto;font-size:11.5px;font-weight:600;color:#64748b;white-space:nowrap;font-variant-numeric:tabular-nums}
.hd-ev-ago{color:#94a3b8}
/* attachment (and any leftover) badge kept quiet, matching the calm palette */
.hd-ev-badge{font-size:10px;font-weight:600;border-radius:5px;padding:1px 7px;text-transform:uppercase;letter-spacing:.03em;color:#64748b;background:#f1f5f9;border:1px solid #e6ebf1}
/* email delivery indicator — desaturated so it never competes with the copy */
.hd-ev-mail{font-size:10px;font-weight:600;border-radius:20px;padding:1px 8px;text-transform:uppercase;letter-spacing:.03em;cursor:default}
.hd-ev-mail.ok{background:#ecfdf5;color:#047857}
.hd-ev-mail.off{background:#fef2f2;color:#b91c1c}
.hd-ev-mail.in{background:#f1f5f9;color:#475569}
.hd-ev-body{color:#334155;line-height:1.55;word-break:break-word}
/* system events (status/priority/assignment/tag changes) */
.hd-ev-system{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12.5px;padding:2px 2px 2px 4px}
.hd-ev-system .hd-ev-dot{width:8px;height:8px;border-radius:50%;background:#cbd5e1;flex:0 0 auto}
.hd-ev-sysbody{color:#475569}
.hd-ev-sysbody b{color:var(--ink);font-weight:700}
.hd-ev-system .hd-pill{font-size:10px;padding:1px 7px}

/* ---- Composer ---- */
.hd-composer{border-bottom:1px solid var(--line);padding:14px 18px;background:#fbfcfe}
.hd-composer-tabs{display:inline-flex;gap:4px;background:#f1f5f9;border-radius:9px;padding:4px;margin-bottom:10px}
.hd-ctab{border:0;background:none;padding:7px 14px;border-radius:7px;font-size:12.5px;font-weight:600;color:var(--muted);cursor:pointer;font-family:inherit}
.hd-ctab:hover{color:#334155}
.hd-ctab.active{background:var(--panel);color:var(--ink);box-shadow:var(--shadow)}
/* collapsed composer — a compact bar (tabs + hint) so the conversation shows
   first; clicking a tab expands the full editor */
.hd-composer-collapsed{display:flex;align-items:center;gap:12px}
.hd-composer-collapsed .hd-composer-tabs{margin-bottom:0}
/* collapsed: the two triggers read as coloured, inviting buttons —
   Public reply = blue, Internal note = amber */
.hd-composer-tabs.collapsed{background:transparent;padding:0;gap:8px}
.hd-composer-tabs.collapsed .hd-ctab{border:1px solid #bfdbfe;background:#eff6ff;color:#1d4ed8;padding:7px 16px;border-radius:8px}
.hd-composer-tabs.collapsed .hd-ctab:hover{background:#dbeafe;color:#1d4ed8;box-shadow:none}
.hd-composer-tabs.collapsed .hd-ctab[data-hdmode="note"]{border-color:#fde68a;background:#fffbeb;color:#b45309}
.hd-composer-tabs.collapsed .hd-ctab[data-hdmode="note"]:hover{background:#fef3c7;color:#b45309}
.hd-composer-hint{font-size:12.5px;color:var(--muted)}
/* open composer: tabs on the left, a Hide control on the right */
.hd-composer-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.hd-composer-head .hd-composer-tabs{margin-bottom:0}
.hd-composer-hide{border:1px solid var(--line);background:var(--panel);color:var(--muted);padding:5px 12px;border-radius:7px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit}
.hd-composer-hide:hover{color:#334155;border-color:#cbd5e1}
.hd-composer-input{width:100%;min-height:150px;resize:vertical}
.hd-composer-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:10px}
.hd-composer-actions .help{margin-right:auto}

/* ---- Ticket meta panel + action toolbar (right pane) ---- */
.hd-side-panel .c{padding:16px 18px}
.hd-toolbar{display:flex;flex-direction:column;gap:12px;padding-bottom:16px;margin-bottom:14px;border-bottom:1px solid var(--line)}
.hd-tool{display:flex;flex-direction:column;gap:5px}
.hd-tool span{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:700}
.hd-tool .ctl{padding:8px 11px;font-size:13px}
.hd-kv{display:flex;flex-direction:column}
.hd-kvrow{display:flex;align-items:baseline;gap:10px;padding:8px 0;border-bottom:1px solid var(--line)}
.hd-kvrow:last-child{border-bottom:0}
.hd-kvk{flex:0 0 96px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:700}
.hd-kvv{flex:1 1 auto;font-size:13px;color:var(--ink);font-weight:600;word-break:break-word;display:flex;flex-wrap:wrap;gap:5px;align-items:center}

/* ---- Detail header action buttons (Edit / Merge) ---- */
.hd-dhead-actions{display:flex;align-items:center;gap:7px;margin-left:4px}
.hd-dhead-actions .btn svg,.hd-attachbtn svg,.hd-histbtn svg{flex:0 0 auto}
/* History toggle (in the conversation panel header) */
.hd-histbtn{gap:6px}
.hd-histbtn.active{background:var(--brand-soft);border-color:#bfdbfe;color:var(--brand)}

/* ---- Merged banner (read-only notice) ---- */
.hd-merged-banner{display:flex;align-items:center;gap:10px;margin:0 2px 16px;padding:11px 14px;border-radius:var(--r);background:#fffbeb;border:1px solid #fde68a;color:#92400e;font-size:13px;font-weight:600;line-height:1.4}
.hd-merged-banner svg{flex:0 0 auto;stroke:#b45309}
.hd-mergelink{color:#1d4ed8;font-weight:700;cursor:pointer;text-decoration:underline}
.hd-mergelink:hover{color:#1e40af}

/* ---- Attachment badge / thumbnail / file chip (timeline) ---- */
.hd-ev-badge.attach{background:#eef2ff;color:#4338ca}
.hd-att-body{padding-top:2px}
.hd-att-thumb{max-width:120px;max-height:120px;border-radius:8px;border:1px solid var(--line);display:block;object-fit:cover}
.hd-att-thumb:hover{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.hd-filechip{display:inline-flex;align-items:center;gap:8px;padding:8px 11px;border:1px solid var(--line);border-radius:9px;background:#fff;color:#334155;font-size:12.5px;font-weight:600;max-width:100%}
.hd-filechip:hover{border-color:var(--brand);background:#f8fafc}
.hd-filechip svg{flex:0 0 auto;stroke:var(--brand)}
.hd-filechip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-filechip-size{color:var(--muted);font-weight:600;flex:0 0 auto}

/* ---- Side-panel attachments list ---- */
.hd-attsec{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.hd-attsec-h{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:700;margin-bottom:10px}
.hd-attsec-list{display:flex;flex-direction:column;gap:8px}
.hd-attrow{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--line);border-radius:9px;background:#fff}
.hd-attrow:hover{border-color:var(--brand);background:#f8fafc}
.hd-attrow-ico{flex:0 0 auto;width:28px;height:28px;border-radius:7px;background:var(--brand-soft);display:grid;place-items:center}
.hd-attrow-ico svg{stroke:var(--brand)}
.hd-attrow-main{min-width:0;display:flex;flex-direction:column;gap:2px}
.hd-attrow-name{font-size:13px;font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hd-attrow-meta{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ---- Attachment staging on the create/edit ticket forms ---- */
.hd-stage{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.hd-stage-list{display:flex;flex-wrap:wrap;gap:6px}
.hd-stage-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border:1px solid var(--line);border-radius:20px;background:#fff;font-size:12px;font-weight:600;color:var(--ink)}
.hd-stage-chip .sub2{font-weight:500}
.hd-stage-x{border:0;background:transparent;cursor:pointer;font-size:15px;line-height:1;color:var(--muted);padding:0 2px}
.hd-stage-x:hover{color:var(--bad,#b91c1c)}

/* ---- Composer attach button + drop hint + dragging state ---- */
.hd-attachbtn{gap:6px}
.hd-attachbtn svg{stroke:var(--brand)}
.hd-composer-actions .hd-attachbtn{margin-left:0}

/* ---- Canned-response picker (composer "Templates" menu) ---- */
#hdCannedBtn{gap:6px}
#hdCannedBtn svg{stroke:var(--brand)}
.hd-canned-wrap{position:relative;display:inline-block}
.hd-canned-menu{position:absolute;right:0;bottom:calc(100% + 6px);z-index:40;width:340px;max-width:80vw;max-height:320px;overflow-y:auto;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.16);padding:6px}
.hd-canned-item{display:block;width:100%;text-align:left;background:transparent;border:0;border-radius:8px;padding:9px 11px;cursor:pointer;font:inherit}
.hd-canned-item:hover{background:var(--brand-soft)}
.hd-canned-item-t{display:block;font-weight:700;color:var(--ink);font-size:13px}
.hd-canned-item-c{font-weight:600;color:var(--brand);font-size:11px;background:var(--brand-soft);border-radius:6px;padding:1px 6px;margin-left:4px}
.hd-canned-item-b{display:block;color:var(--muted);font-size:12px;margin-top:2px;line-height:1.4}
.hd-canned-empty{padding:12px 11px;color:var(--muted);font-size:12.5px}
/* placeholder chips shown on the canned-response edit form */
.hdc-ph{background:#eef2ff;border:1px solid #dbe1fb;color:#3730a3;border-radius:6px;padding:1px 6px;font-size:11.5px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:nowrap}
.hd-drophint{font-size:11.5px;color:var(--muted);text-align:center;padding:6px 12px;border-top:1px dashed var(--line);background:#fbfcfe}
.hd-convo-panel.hd-dragging{outline:2px dashed var(--brand);outline-offset:-4px;background:var(--brand-soft)}
.hd-convo-panel.hd-dragging .hd-drophint{color:var(--brand);font-weight:600}
textarea.ctl.hd-drop-on{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft);background:var(--brand-soft)}
.hd-cust-hint{font-size:12px;margin-top:6px;min-height:1em;line-height:1.4}
.hd-cust-hint.loading{color:var(--muted);font-style:italic}
.hd-cust-hint.muted{color:var(--muted)}
.hd-cust-hint.ok{color:#15803d;font-weight:600}

/* ---- History / audit log rows ---- */
.hd-log{padding:12px 18px;display:flex;flex-direction:column}
.hd-logrow{display:flex;align-items:baseline;gap:12px;padding:9px 2px;border-bottom:1px solid var(--line);font-size:12.5px}
.hd-logrow:last-child{border-bottom:0}
.hd-logtime{flex:0 0 132px;color:#94a3b8;font-variant-numeric:tabular-nums;white-space:nowrap}
.hd-logactor{flex:0 0 auto;font-weight:700;color:var(--ink)}
.hd-logdesc{flex:1 1 auto;color:#475569;display:flex;flex-wrap:wrap;align-items:center;gap:5px}
.hd-logdesc .hd-pill{font-size:10px;padding:1px 7px}

/* ---- Agents & Users (support/agents) ---- */
.ag-note{background:#fffaf0;border:1px solid #fde8c4;color:#8a5a12;border-radius:10px;padding:11px 14px;font-size:12.5px;line-height:1.5;margin:0 0 16px}
.ag-list td.cust{font-weight:600;color:var(--ink)}
.ag-actions{white-space:nowrap;text-align:right}
.ag-actions .btn{margin-left:6px;padding:5px 10px;font-size:12px}
.ag-hint{font-size:12px;color:var(--muted);margin-top:16px;line-height:1.5}
.ag-pw{margin-top:10px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:15px;font-weight:700;letter-spacing:.5px;color:var(--ink);background:#fff;border:1px dashed var(--brand);border-radius:8px;padding:10px 13px;user-select:all;word-break:break-all}
@media(max-width:820px){
  .ag-actions{text-align:left}
  .ag-actions .btn{margin:4px 6px 0 0}
}

/* ---------- Help Desk config & analytics (Phase 2) ---------- */
.hdc-note{background:#f8fafc;border:1px solid var(--line);color:#475569;border-radius:10px;padding:11px 14px;font-size:12.5px;line-height:1.5;margin:0 0 16px}
/* business-hours / SLA calendar editor (Settings) */
.hd-bh-enable{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;color:var(--ink);cursor:pointer}
.hd-bh-enable input{width:16px;height:16px}
.hd-bh-grid{display:flex;flex-direction:column;gap:8px;margin:14px 0 4px;max-width:420px}
.hd-bh-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid var(--line)}
.hd-bh-row:last-child{border-bottom:0}
.hd-bh-day{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--ink);cursor:pointer;min-width:120px}
.hd-bh-day input{width:15px;height:15px}
.hd-bh-times{display:inline-flex;align-items:center;gap:8px}
.hd-bh-time{width:110px;padding:5px 8px}
.hd-bh-to{color:var(--muted);font-size:12px}
.hdc-note b{color:#334155}
/* email delivery / setup status panel on the Email Channels page */
.hdc-setup{padding:16px 18px;margin-bottom:16px}
.hdc-setup-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:12px}
.hdc-setup-head h2{font-size:14px;font-weight:700;color:var(--ink);margin:0}
.hdc-setup-rows{display:flex;flex-direction:column;gap:8px;margin-bottom:14px}
.hdc-stat{display:flex;align-items:center;gap:8px;font-size:13px;color:#334155}
.hdc-dot{width:9px;height:9px;border-radius:50%;flex:0 0 auto}
.hdc-dot.ok{background:#10b981;box-shadow:0 0 0 3px #d1fae5}
.hdc-dot.off{background:#f43f5e;box-shadow:0 0 0 3px #ffe4e6}
.hdc-webhook label{display:block;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:#94a3b8;margin-bottom:5px}
.hdc-webhook-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.hdc-webhook-row code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:6px;padding:6px 9px;color:#334155;word-break:break-all;flex:1 1 260px}
.hdc-warn{margin:9px 0 0;font-size:12px;line-height:1.5;color:#9a3412;background:#fff7ed;border:1px solid #fed7aa;border-radius:8px;padding:9px 11px}
.hdc-warn b{color:#7c2d12}
.hdm-help{margin-top:14px;border-top:1px solid var(--line,#e2e8f0);padding-top:10px}
.hdm-help>summary{cursor:pointer;font-size:12.5px;font-weight:700;color:var(--ink);list-style:none;user-select:none}
.hdm-help>summary::-webkit-details-marker{display:none}
.hdm-help>summary::before{content:"▸ ";color:#94a3b8}
.hdm-help[open]>summary::before{content:"▾ "}
.hdm-help-list{margin:10px 0 6px;padding-left:18px;font-size:12.5px;line-height:1.6;color:#475569}
.hdm-help-list li{margin:4px 0}
.hdm-help code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:5px;padding:1px 5px;color:#334155}
.hdc-list{margin-bottom:18px}
.hdc-list td.cust{font-weight:600;color:var(--ink)}
.hdc-list code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:5px;padding:1px 6px;color:#334155;display:inline-block;margin:1px 0}
.hdc-block{margin-bottom:18px}
.grid.hdc-even{grid-template-columns:1fr 1fr}
textarea.ef-input{resize:vertical;min-height:70px;line-height:1.5;font-family:inherit}
.ef-field.ef-full{grid-column:1 / -1}
/* Rich reply-signature editor (contenteditable + toolbar) */
.hdc-sig{border:1px solid var(--line);border-radius:9px;overflow:hidden;background:#fff}
.hdc-sig:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.hdc-sig-tools{display:flex;gap:2px;flex-wrap:wrap;padding:6px;background:#f8fafc;border-bottom:1px solid var(--line)}
.hdc-sig-btn{min-width:30px;height:28px;padding:0 9px;border:1px solid transparent;border-radius:6px;background:transparent;color:#475569;font-size:12.5px;font-weight:600;cursor:pointer}
.hdc-sig-btn:hover{background:#eef2f7;color:#0f172a}
.hdc-sig-input{min-height:120px;max-height:340px;overflow-y:auto;padding:12px 14px;font-size:14px;line-height:1.6;color:var(--ink);outline:none}
.hdc-sig-input:empty:before{content:attr(data-ph);color:#94a3b8}
.hdc-sig-input img{max-width:100%;height:auto}
.hdc-sig-input a{color:var(--brand)}
/* team members checklist */
.hdc-member-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:6px 14px;margin-top:6px;max-height:240px;overflow:auto;border:1px solid var(--line);border-radius:10px;padding:12px}
.hdc-member{display:flex;align-items:center;gap:9px;font-size:13px;color:var(--ink);cursor:pointer;padding:3px 4px;border-radius:6px}
.hdc-member:hover{background:#f8fafc}
.hdc-member input{width:15px;height:15px;flex:0 0 auto}
/* Automation rule builder rows */
.hdc-rows{display:flex;flex-direction:column;gap:10px;margin-bottom:12px}
.hdc-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.hdc-row select,.hdc-row input{border:1px solid var(--line);border-radius:8px;padding:8px 11px;font-size:13px;color:var(--ink);background:#fff;font-family:inherit;outline:none}
.hdc-row select:focus,.hdc-row input:focus{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.hdc-row input[data-k=value],.hdc-row select[data-k=value]{flex:1;min-width:160px}
.hdc-cond-row select[data-k=field]{min-width:150px}
.hdc-act-row select[data-k=type]{min-width:150px}
.hdc-row .btn.ghost{margin-left:auto}
/* 14-day volume mini bar chart */
.hdc-vol{display:flex;align-items:flex-end;gap:8px;height:150px;padding-top:8px}
.hdc-vbar{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:4px;min-width:0}
.hdc-vfill{width:100%;max-width:34px;background:linear-gradient(180deg,#60a5fa,#2563eb);border-radius:5px 5px 0 0;min-height:3px;transition:height .2s}
.hdc-vn{font-size:11px;font-weight:700;color:#334155;font-variant-numeric:tabular-nums}
.hdc-vd{font-size:10px;color:var(--muted);white-space:nowrap}

/* ---- CSAT feedback list (Reports) ---- */
.hdc-csat-cmt{padding:10px 0;border-bottom:1px solid var(--line)}
.hdc-csat-cmt:last-child{border-bottom:0}
.hdc-csat-cmthead{font-size:12.5px;color:var(--muted);margin-bottom:3px}
.hdc-csat-cmthead strong{color:#f59e0b;font-size:13px}
.hdc-csat-cmtbody{font-size:13.5px;color:#334155;white-space:pre-wrap;word-wrap:break-word}

/* ---- Responsive ---- */
@media(max-width:1100px){
  .kpis.hd-kpis{grid-template-columns:repeat(2,1fr)}
  .hd-split{grid-template-columns:1fr}
}
@media(max-width:560px){
  .kpis.hd-kpis{grid-template-columns:1fr}
  .hd-logrow{flex-wrap:wrap;gap:2px 10px}
  .hd-logtime{flex:0 0 100%}
  .hdc-vd{display:none}
}

/* ---------- Connect Analytics: utilised-cost footer on KPI cards ---------- */
.kpi .an-cost{margin-top:10px;padding-top:9px;border-top:1px dashed var(--line);font-size:13.5px;font-weight:700;color:var(--ink)}
.kpi .an-cost .sub2{font-weight:400;white-space:nowrap}

/* ---------- Connect Analytics: clickable failure-reason drill-down ---------- */
/* Reason and connect rows expand on click; hover makes that discoverable. */
tr.an-reason-row,
tr.an-conn-row{transition:background .12s}
tr.an-reason-row:hover,
tr.an-conn-row:hover{background:#eff4ff}
tr.an-reason-row:hover td:first-child{color:var(--brand)}
/* nested connect table inside an expanded reason: tighter, visually inset */
tr.an-reason-detail > td{border-left:3px solid var(--brand-soft)}
tr.an-reason-detail table th{background:#f8fafc;font-size:10.5px;padding:8px 12px}
tr.an-reason-detail table td{padding:9px 12px}


/* customer profile · Connects tab: expandable inline detail rows */
.pf-conrow{cursor:pointer}
.pf-conrow td.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12.5px}
.pf-conarrow{display:inline-block; transition:transform .15s ease}
.pf-conrow.open .pf-conarrow{transform:rotate(180deg)}
.pf-condetail>td{background:#f8fafc; padding:0; box-shadow:inset 0 1px 0 var(--line), inset 0 -1px 0 var(--line)}
.pf-condetail-box{padding:14px 16px}

/* customer profile · v1-parity Profile tab (address card + payment logs) */
/* auto-fit with a MAX track: six short address lines stretched edge-to-edge read
   as an empty banner, so the card keeps a natural width (and a second card, if
   one is ever added back, lands beside it rather than under it). */
.pf-addrgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,480px));gap:14px;margin-bottom:10px}
@media(max-width:640px){.pf-addrgrid{grid-template-columns:1fr}}
.pf-addrcard{border:1px solid var(--line);border-radius:10px;padding:14px 18px 8px;font-size:13px;line-height:1.5;box-shadow:none;background:var(--bg)}
.pf-addr-h{
  display:flex; align-items:center; gap:7px;
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  color:#334155; margin-bottom:10px;
}
.pf-addr-ico{font-size:14px}
.pf-addr-name{font-weight:600; font-size:13px; color:var(--ink)}
.pf-addr-meta{color:var(--muted)}
.pf-addr-mail{color:var(--brand); font-weight:600}
.pf-sech{
  display:block; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  color:#334155; background:none; padding:0; margin:26px 0 12px;
}
.pf-paystatus{color:var(--bad); font-weight:600}
.pf-paymsg{max-width:420px; font-weight:500}
.pf-allfields{margin-top:26px}
.pf-allfields summary{cursor:pointer; font-size:12px; font-weight:600; color:var(--brand); padding:6px 0}
.pf-allfields summary:hover{text-decoration:underline}

/* tier pills + drill-down table polish */
.pill-blue{background:#dbeafe;color:#1d4ed8}
.pill-violet{background:#f3e8ff;color:#7c3aed}
.pill-teal{background:#ccfbf1;color:#0f766e}
.pill-ent{background:#0f172a;color:#e2e8f0}
.cell-email{color:var(--brand);font-weight:600}
.cell-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--muted)}
.cell-date{white-space:nowrap;color:var(--muted);font-size:12.5px}
.modal-body tbody tr:nth-child(even){background:#fafbfd}
.modal-body tbody tr.rowlink:hover{background:var(--brand-soft)}

/* inbound HTML email rendered in the ticket timeline (sandboxed) */
.hd-ev-htmlframe{width:100%;border:0;background:#fff;border-radius:8px;height:120px;display:block}
.hd-txtlink{color:var(--brand);font-weight:600;text-decoration:underline;text-underline-offset:2px;word-break:keep-all;white-space:nowrap}
/* analytics chart: date labels positioned to line up with vertical guides */
.axis-abs{position:relative;display:block;height:16px}

/* ticket list · inline agent-assignment dropdown */
.hd-agentcell{min-width:140px}
.hd-assign{font:inherit;font-size:12.5px;font-weight:600;color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:8px;padding:5px 8px;max-width:150px;cursor:pointer}
.hd-assign:hover{border-color:var(--brand2)}
.hd-assign.none{color:var(--muted);font-weight:500}
.hd-assign.saved{border-color:var(--ok);box-shadow:0 0 0 3px rgba(22,163,74,.15)}
.hd-assign:disabled{opacity:.6}
/* Inline TEAM dropdown — mirrors .hd-assign */
.hd-teamassign{font:inherit;font-size:12.5px;font-weight:600;color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:8px;padding:5px 8px;max-width:150px;cursor:pointer}
.hd-teamassign:hover{border-color:var(--brand2)}
.hd-teamassign.none{color:var(--muted);font-weight:500}
.hd-teamassign.saved{border-color:var(--ok);box-shadow:0 0 0 3px rgba(22,163,74,.15)}
.hd-teamassign:disabled{opacity:.6}
/* Bulk selection + action bar */
.hd-selth,.hd-selcell{width:36px;text-align:center;padding-left:12px;padding-right:0}
.hd-selcb,#hdSelAll{width:15px;height:15px;cursor:pointer;accent-color:var(--brand)}
tr.hd-row-sel>td{background:var(--brand-soft)}
.hd-bulkbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:11px 16px;border-bottom:1px solid var(--line);background:var(--brand-soft)}
/* Only show when tickets are selected — the class's display:flex would otherwise
   override the [hidden] attribute, leaving the bar visible at "0 selected". */
.hd-bulkbar[hidden]{display:none}
.hd-bulk-count{font-size:13px;font-weight:700;color:var(--brand)}
.hd-bulk-sep{font-size:12.5px;color:var(--muted);font-weight:600}
.hd-bulkbar .fsel{max-width:180px}
/* transient toast */
.app-toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(16px);z-index:120;
  background:#0f172a;color:#fff;font-size:13px;font-weight:600;padding:10px 16px;border-radius:10px;
  box-shadow:0 8px 30px rgba(2,6,23,.35);opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;max-width:80vw}
.app-toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.app-toast.err{background:#b91c1c}

/* analytics: click-a-day drill-down */
.an-daybar{cursor:pointer;background:transparent;transition:background .12s;z-index:3}
.an-daybar:hover{background:rgba(8,145,178,.10);box-shadow:inset 1px 0 0 rgba(8,145,178,.25),inset -1px 0 0 rgba(8,145,178,.25)}
.an-daypanel{margin-top:16px;border:1px solid var(--brand-soft)}
.an-daypanel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:2px 2px 12px;font-size:13.5px;color:var(--muted);flex-wrap:wrap}
.an-daypanel-head b{color:var(--ink)}
.an-day-morewrap{text-align:center;padding:12px 0 2px}

/* payments: TEST tag + customer-id line for no-email rows */
.tag.t-test{background:#fef3c7;color:#92400e;font-weight:700}
.pay-idline{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}
tr.pay-test td{background:#fffdf5}
.gs-tag{font-size:9.5px;padding:1px 6px;vertical-align:middle;margin-left:6px}

/* ===================== Helpdesk custom properties ======================== */
/* .btn.xs was already referenced in app.js but never defined, so those buttons
   silently rendered at full size. Defining it here fixes those too. */
.btn.xs{padding:5px 9px;font-size:11.5px;border-radius:7px;gap:5px}

.hd-props{margin-top:14px;padding-top:12px;border-top:1px solid var(--line)}
.hd-side-h{font-size:10.5px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:9px}
.hd-propmsg{font-size:12px;padding:7px 9px;border-radius:7px;margin-bottom:9px;background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0}
.hd-propmsg.err{background:#fef2f2;color:var(--bad);border-color:#fecaca}
.hd-empty-inline{font-size:12px;color:var(--muted);padding:5px 0}

.hd-propblock{margin:11px 0}
.hd-propblock-h{font-size:11.5px;font-weight:700;color:#334155;margin-bottom:5px}

/* Wide by nature (9 columns). Scroll inside its own box so the sidebar — and
   the page — never scroll sideways. */
.hd-proptable-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:8px;background:#fff}
.hd-proptable{border-collapse:collapse;width:100%;font-size:11.5px}
.hd-proptable th{text-align:left;font-weight:700;color:var(--muted);padding:6px 8px;border-bottom:1px solid var(--line);white-space:nowrap;background:#f8fafc}
.hd-proptable td{padding:5px 8px;border-bottom:1px solid #f1f5f9;vertical-align:middle;white-space:nowrap}
.hd-proptable tbody tr:last-child td{border-bottom:0}
.hd-proptable input.in{min-width:110px;font-size:11.5px;padding:4px 6px}

.hd-propfield{margin:9px 0}
.hd-propfield label{display:block;font-size:10.5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);margin-bottom:4px}
.hd-propfield .in{width:100%}
.hd-chk{display:inline-flex;align-items:center;gap:4px;font-size:12px;margin:0 9px 4px 0;white-space:nowrap}
.hd-propactions{display:flex;gap:6px;flex-wrap:wrap;margin-top:11px}

/* Per-location connection state. Mirrors the hd-pill status colouring so the
   sidebar and the History rows read the same. */
.hd-pill-not-started{background:#f1f5f9;color:#475569;border-color:#e2e8f0}
.hd-pill-queued{background:#eef2ff;color:#4338ca;border-color:#c7d2fe}
.hd-pill-connecting{background:#fef3c7;color:#92400e;border-color:#fde68a}
.hd-pill-connected{background:#dcfce7;color:#15803d;border-color:#bbf7d0}
.hd-pill-failed{background:#fee2e2;color:#b91c1c;border-color:#fecaca}
.hd-pill-skipped{background:#f5f3ff;color:#6d28d9;border-color:#ddd6fe}

/* Rolled-up ticket-level status, same palette. */
.hd-pill-in-progress{background:#fef3c7;color:#92400e;border-color:#fde68a}
.hd-pill-partial{background:#ffedd5;color:#c2410c;border-color:#fed7aa}
.hd-pill-completed{background:#dcfce7;color:#15803d;border-color:#bbf7d0}

/* ---------------- Webhook settings: form structure ---------------------- */
/* The form had label and input on one line with no spacing, and the textarea
   floated over its own label. These give each control its own row. */
.ef-row{margin:0 0 16px}
.ef-row>label{display:block;font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.ef-row>.in{width:100%;max-width:560px}
.ef-hint{margin:6px 0 0;font-size:12px;color:var(--muted);line-height:1.5;max-width:660px}
.ef-sec{margin:22px 0 0;padding-top:18px;border-top:1px solid var(--line)}
.ef-sec>h3{margin:0 0 2px;font-size:13.5px;font-weight:800;color:var(--ink)}
.ef-row2{display:flex;align-items:center;gap:10px;margin:12px 0}
.ef-row2 label.inline{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin:0}
.in.narrow{width:auto;min-width:220px}
.hd-chk.block{display:flex;align-items:flex-start;gap:8px;margin:10px 0 0;font-size:13px;white-space:normal}

/* Events: a readable grid instead of one long wrapped line. */
.hdw-events{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:2px 18px;margin-top:10px}
.hdw-ev{display:flex;align-items:center;gap:7px;padding:5px 0;font-size:13px;min-width:0}
.hdw-ev input{flex:0 0 auto;margin:0}
.hdw-ev-t{flex:0 1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hdw-ev-k{flex:0 1 auto;font-size:10.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hdw-ev .hd-tag{flex:0 0 auto;font-size:9.5px;padding:1px 6px}

/* Conditions: field / operator / value / remove, on one aligned row. */
.hdw-conds{margin:10px 0}
.hdw-cond{display:flex;align-items:center;gap:8px;margin:0 0 8px;flex-wrap:wrap}
.hdw-cond>.in{min-width:170px}
.hdw-cond-val{display:inline-flex;align-items:center;min-width:200px}
.hdw-cond-val .in{min-width:200px}
.hdw-condlist{font-size:12px;line-height:1.6}
.hdw-condlist code{font-size:11.5px}

/* ---- Record Payment: numbered section cards ---- */
.rp-form{max-width:760px}
.rp-card{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:18px 20px 14px;margin-bottom:14px;box-shadow:var(--shadow)}
.rp-sec{display:flex;align-items:center;gap:9px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:#334155;margin:0 0 16px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.rp-num{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--brand);color:#fff;font-size:11px;font-weight:700;letter-spacing:0}
.rp-form label{font-size:12px;font-weight:600;color:#334155}
.rp-form .help{font-size:12px}
/* computed next-billing feedback: a highlighted info strip, hidden while empty */
.rp-preview{margin:2px 0 12px;padding:8px 12px;border-radius:8px;background:var(--brand-soft);color:#1e40af;font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums}
.rp-preview:empty{display:none}
.rp-actions{padding-top:2px}
.rp-actions .btn.primary{padding:10px 22px;font-size:14px}

/* action footer inside the steps card — keeps the drawer ONE object instead of
   a card plus a loose button sitting on the background */
.pf-cardfoot{padding:11px 14px;background:#f8fafc;border-top:1px solid var(--line)}
.pf-cardfoot .btn{margin:0}

/* ---- reply composer: recipient bar + Cc ---- */
.hd-torow{display:flex;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--line);background:#f8fafc;font-size:13px}
.hd-torow-note{color:var(--muted);font-size:12px}
.hd-tolab{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:#64748b;flex:0 0 auto}
.hd-toval{color:var(--ink);font-weight:500;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hd-cclink{margin-left:auto;flex:0 0 auto;border:0;background:none;padding:2px 6px;font:inherit;font-size:12px;font-weight:600;color:var(--brand);cursor:pointer;border-radius:6px}
.hd-cclink:hover{background:var(--brand-soft)}
.hd-ccrow{display:flex;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--line);background:#f8fafc}
.hd-ccinput{flex:1;min-width:0;border:1px solid var(--line);border-radius:7px;padding:6px 9px;font:inherit;font-size:13px;background:#fff;color:var(--ink)}
.hd-ccinput:focus{outline:0;border-color:var(--brand);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
/* the signature block sitting inside the composer (Gmail style) */
.hd-rte .hd-sig{color:#475569}

/* ---------- Bot-escalation email → structured transcript (HD-00203) ---------- */
.hd-botmail{display:flex;flex-direction:column;gap:12px}
.hd-bm-lead{font-size:13.5px;color:#334155}
.hd-bm-request{background:#fffbeb;border:1px solid #fde68a;border-left:3px solid #f59e0b;border-radius:8px;padding:10px 13px;font-weight:600;color:#7c2d12;line-height:1.55}
.hd-bm-reqlab{display:block;font-size:10.5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:#b45309;margin-bottom:4px}
.hd-bm-convo{border:1px solid var(--line);border-radius:10px;padding:12px 14px;background:#fbfcfe}
.hd-bm-convolab{font-size:10.5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.hd-bm-turn{display:flex;gap:10px;padding:8px 0;align-items:flex-start}
.hd-bm-turn + .hd-bm-turn{border-top:1px solid #eef2f7}
.hd-bm-tag{flex:0 0 auto;font-size:10.5px;font-weight:700;border-radius:5px;padding:2px 8px;margin-top:2px}
.hd-bm-customer .hd-bm-tag{background:#eff6ff;color:#1d4ed8}
.hd-bm-bot .hd-bm-tag{background:#f1f5f9;color:#64748b}
.hd-bm-text{min-width:0;font-size:13px;line-height:1.6;word-break:break-word}
.hd-bm-customer .hd-bm-text{font-weight:600;color:var(--ink)}
.hd-bm-bot .hd-bm-text{color:#475569}
.hd-bm-meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.hd-bm-chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;background:var(--bg);border:1px solid var(--line);border-radius:999px;padding:4px 11px;color:var(--ink)}
.hd-bm-note{font-size:12px;color:var(--muted);font-style:italic}

/* ===================== Agent Builder (Cloudflare D1 via /api/ab/*) ===========
   Product chip, dashboard product switch, "All" KPI split lines, the
   not-connected card, the AB profile hero and the AB funnel column group.
   Everything else on the AB pages reuses the Connect classes (kpi, panel,
   filterbar, pager, pf-*, pill-*, tag) so both products read as one console. */
/* product chip — solid violet so it reads apart from the OUTLINED Connect
   (indigo) and AI Agent (purple) tags */
.tag.t-ab{background:linear-gradient(135deg,#7c3aed,#6d28d9);color:#fff;border-color:#6d28d9}
.tag.t-ab-link{cursor:pointer}
.tag.t-auto{background:linear-gradient(135deg,#2563eb,#1d4ed8);color:#fff;border-color:#1d4ed8;text-decoration:none}
a.tag.t-auto:hover{filter:brightness(1.12);box-shadow:0 0 0 2px rgba(37,99,235,.25)}
.plans-strip{margin-top:16px}
.plans-strip .ps-row{display:grid;grid-template-columns:minmax(150px,auto) 1fr 1.6fr auto;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line,#e5e7eb)}
.plans-strip .ps-row:last-of-type{border-bottom:0}
.plans-strip .ps-paid{text-align:right;white-space:nowrap}
.plans-strip .ps-warn{margin-top:10px;padding:10px 12px;border-radius:8px;background:#fffbeb;border:1px solid #fcd34d;color:#92400e;font-size:13px}
@media (max-width:720px){.plans-strip .ps-row{grid-template-columns:1fr 1fr}.plans-strip .ps-paid{text-align:left}}
.tag.t-ab-link:hover{filter:brightness(1.12);box-shadow:0 0 0 2px rgba(124,58,237,.25)}
.cust .t-ab,.pf-email .t-ab,.pf-email .t-test{vertical-align:middle;margin-left:4px}
.gs-main .t-ab{font-size:9.5px;padding:1px 6px;vertical-align:middle;margin-left:6px}
/* dashboard product switch (segmented control beside the page title) */
.pagehead-title{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.seg{display:inline-flex;align-items:center;gap:2px;background:#f1f5f9;border:1px solid var(--line);border-radius:9px;padding:3px}
.seg button{appearance:none;border:0;background:transparent;border-radius:7px;padding:5px 12px;font-size:12.5px;font-weight:600;color:var(--muted);cursor:pointer;font-family:inherit;white-space:nowrap}
.seg button:hover{color:var(--ink)}
.seg button.on{background:#fff;color:var(--ink);box-shadow:var(--shadow)}
.seg button.on[data-product="agent-builder"]{color:#6d28d9}
/* "All" mode: Connect / Agent Builder figures stacked under a KPI value */
.kpi-split{display:flex;flex-direction:column;gap:5px;margin-top:6px;padding-top:6px;border-top:1px dashed var(--line);font-size:12px;font-weight:600;color:var(--ink);align-items:flex-start}
.kpi-split span{display:flex;align-items:center;gap:4px;white-space:nowrap;cursor:pointer;padding-bottom:5px;border-bottom:1px dashed var(--line)}
.kpi-split span:last-child{border-bottom:none;padding-bottom:0}
.kpi-split i.sw{width:6px;height:6px;display:inline-block;border-radius:1px}
.kpi-split b{color:var(--ink);font-weight:700;font-variant-numeric:tabular-nums}
.kpi-split .sw{width:6px;height:6px;border-radius:1px;flex:0 0 auto}
.kpi-split .ab-fill.pend{color:var(--muted);font-weight:500}
/* not-connected card (also used inline inside a panel) */
.ab-notice{display:flex;gap:14px;align-items:flex-start;background:#f5f3ff;border:1px solid #ddd6fe;border-radius:12px;padding:16px 18px;margin-bottom:18px;color:#4c1d95}
.ab-notice.inpanel{margin:18px}
.ab-notice .ab-ico{width:38px;height:38px;border-radius:10px;background:#ede9fe;display:grid;place-items:center;flex:0 0 auto}
.ab-notice .ab-ico svg{width:20px;height:20px;stroke:#6d28d9;fill:none;stroke-width:2}
.ab-notice b{display:block;font-size:14px;margin-bottom:3px}
.ab-notice p{margin:0;font-size:13px;line-height:1.6;color:#5b21b6}
.ab-notice code{background:#fff;border:1px solid #ddd6fe;border-radius:5px;padding:1px 6px;font-size:12px;color:#4c1d95;white-space:nowrap}
.ab-notice .ab-why{display:block;margin-top:4px;font-size:12px;color:#7c3aed}
/* AB revenue-by-kind bars: wider label column ("Subscription invoice") */
.ab-bars .barrow .nm{width:124px}
/* AB profile hero: violet banner + avatar */
.pf-hero.ab .pf-banner{background:linear-gradient(112deg,#2e1065 0%,#6d28d9 48%,#8b5cf6 72%,#c4b5fd 100%)}
.pf-hero.ab .pf-avatar{background:linear-gradient(135deg,#8b5cf6,#5b21b6)}
.pf-hero.ab .pf-actionbtns .btn{white-space:nowrap}
.pf-hero.ab .pf-statusline{flex-wrap:wrap;justify-content:flex-end}
/* Dual-product hero (user exists in BOTH Automate and Agent Builder): one
   diagonal blend from Automate blue into Agent Builder violet. Must stay after
   the .pf-hero.ab rules — same specificity, so source order decides. */
.pf-hero.both .pf-banner{background:linear-gradient(112deg,#1e3a8a 0%,#3b82f6 40%,#9333ea 65%,#d8b4fe 100%)}
.pf-hero.both .pf-avatar{background:linear-gradient(135deg,#2563eb,#7c3aed)}
/* entitlement card sits between the stat band and the tabs card */
.ab-entcard{margin-bottom:18px}
.ab-entcard .c{padding:14px 18px 18px}
/* AB funnel: "Activity" column group (agents / top-ups) in the product colour */
table.funnel tr.grp th.gb.g-ab{color:#6d28d9;background:#f5f3ff}
table.funnel tr.sub2h th.g-ab{color:#8b5cf6;background:#faf8ff}
table.funnel td.num.g-ab:not(.z){color:#6d28d9}
.ab-note{color:var(--muted);font-size:11.5px;margin-top:8px;line-height:1.5}
/* Agent Builder tab on a Connect customer profile */
.ab-tabhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px}
.ab-tabhead .btn{margin-left:auto}
.ab-more{margin-top:4px}
/* AB users list: numeric columns */
.ab-users td.num{text-align:right;font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}
.ab-users th.num{text-align:right}
.ab-page .pf-panel td.num{text-align:right;font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}
.ab-page .pf-panel td.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;font-weight:600}
/* sidebar badge stays hidden until /api/counts reports abUsers */
.side nav .ct[data-ct="abUsers"]:empty{display:none}

/* A KPI's big number is a drill-down target, not only its "Details →" link —
   the figure is what the eye lands on and what people click first (Ram,
   2026-10-07, on the Agent Builder cards). Only cards that HAVE a destination
   get the affordance: .kpi-v-click is added alongside data-kpi. */
.kpi .v.kpi-v-click{cursor:pointer;width:fit-content;border-radius:6px;transition:color .13s,background .13s}
.kpi .v.kpi-v-click:hover{color:var(--brand);background:var(--brand-soft)}
.kpi .v.kpi-v-click:focus-visible{outline:2px solid var(--brand);outline-offset:2px}

/* Agent Builder users: the email cell held "email + tag" as plain inline flow,
   so each tag started wherever that row's address happened to end — a ragged
   column of chips (Ram, 2026-10-07: "why tags are not properly aligned").
   Flex with the tag pushed to the cell's right edge gives every chip one shared
   left edge. Scoped to .ab-users so the Connect customers list, where the chip
   genuinely distinguishes AB users from Connect-only ones, is untouched. */
.ab-users td.cust{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.ab-users td.cust > .tag{margin-left:auto;flex:0 0 auto}
.ab-users td.cust > .sub2{flex-basis:100%;margin-left:0}

/* "N test / @yopmail hidden — show them" in a list subtitle. The count used to
   be dead text next to an unrelated dropdown, so people read "hidden" as
   "lost". This makes the sentence itself the control. */
.pagehead p a.showtest{color:var(--brand);text-decoration:underline;text-underline-offset:2px;cursor:pointer}
.pagehead p a.showtest:hover{text-decoration-thickness:2px}

/* Clickable figures inside a KPI sub-line. MUST inherit colour/size/weight:
   .kpi .d.up is green while .link is brand-blue, so a .link here would render
   blue text on a green line. The dotted underline carries the affordance
   instead, matching the funnel cells. */
.kpi .d .kpi-sub-click{color:inherit;font-size:inherit;font-weight:inherit;cursor:pointer;
  border-bottom:1px dotted currentColor;transition:color .13s,background .13s}
.kpi .d .kpi-sub-click:hover{color:var(--brand);border-bottom-color:var(--brand)}
.kpi .d .kpi-sub-click:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:3px}
/* 1fr tracks are minmax(auto,1fr): without min-width:0 a long sub-line widens
   its track and .kpis{overflow:hidden} clips the row with no scrollbar. */
.kpi{min-width:0}
.kpi .d{line-height:1.45}

/* Hidden-row notice INSIDE the table. The subtitle version sits above the
   filter bar and was missed three times running — a row missing from a table
   is looked for in the table. */
.hidden-note{text-align:center;font-size:12.5px;font-weight:600;color:var(--muted);
  background:var(--amber-soft,#fffbeb);border-top:1px dashed var(--line)}
.hidden-note a{color:var(--brand);text-decoration:underline;text-underline-offset:2px;cursor:pointer}

/* Agent Builder rows inside an All-mode drill-down: same table as the Connect
   rows, visibly a different product. The split label marks where they begin. */
.ab-split{background:var(--brand-soft,#f5f3ff);font-size:12px;font-weight:700;color:var(--muted);
  border-top:1px dashed var(--line);border-bottom:1px dashed var(--line)}
tr.ab-detail-row > td{background:color-mix(in srgb, #7c3aed 4%, transparent)}
tr.ab-detail-row:hover > td{background:color-mix(in srgb, #7c3aed 9%, transparent)}

/* AppyConnect source chip — the counterpart to .t-ab. Blue is AppyConnect's
   accent (#2563eb) the way purple is Agent Builder's, so a mixed All-mode
   table reads by colour before you read the words. Outlined rather than
   filled: Connect rows are the majority, and N filled chips would shout. */
.tag.t-cn{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
tr.ab-detail-row .tag.t-cn{display:none}

/* Compact source tags for dense list rows. The full "Agent Builder" +
   "AppyConnect" labels wrapped to a second line and doubled row height. */
.tag.t-xs{font-size:9.5px;padding:1px 5px;border-radius:4px;letter-spacing:.2px;vertical-align:middle}
.modal td .cell-email{margin-right:2px}

/* All-mode drill-down: tags live in their own column so they line up instead of
   wrapping under long emails. The table also needs more room — customer IDs
   were breaking across two lines. */
.modal.modal-wide .modal-card{max-width:1180px}
.fd-table td.col-src,.fd-table th.col-src{white-space:nowrap;width:1%;text-align:left}
.fd-table td.col-src .tag{margin-right:3px}
.fd-table td .cell-email{white-space:nowrap}
.fd-table td .cell-id{white-space:nowrap;font-size:11.5px}

/* Drill-down breathing room: wider card, roomier cells, dates on one line.
   "very congested" — the join date was wrapping to three lines and row
   heights staggered. */
.modal.modal-wide .modal-card{max-width:1320px}
.fd-table th,.fd-table td{padding:11px 14px}
.fd-table td.cell-date,.fd-table td .cell-nw{white-space:nowrap}
.fd-table td{vertical-align:middle}

/* Source column everywhere (customer directories + drill-downs): chips in one
   narrow aligned column instead of trailing variable-length emails. */
table td.col-src,table th.col-src{white-space:nowrap;width:1%;text-align:left}
table td.col-src .tag{margin-right:3px;vertical-align:middle}

/* "Dashboard updated" nudge for open tabs when a new build ships. */
.newbuild{position:fixed;left:50%;transform:translateX(-50%);bottom:18px;z-index:200;background:#111827;color:#fff;
  padding:10px 16px;border-radius:10px;font-size:13px;font-weight:600;box-shadow:0 10px 30px rgba(2,6,23,.4);
  display:flex;gap:10px;align-items:center}
.newbuild button{background:var(--brand);color:#fff;border:0;border-radius:7px;padding:6px 12px;font-weight:700;cursor:pointer;font-family:inherit}

/* Top-bar QA toggle: include test / @yopmail signups in the analytics. */
.testtoggle{display:inline-flex;align-items:center;gap:6px;margin-left:12px;font-size:12.5px;
  font-weight:600;color:var(--muted);cursor:pointer;user-select:none;vertical-align:middle}
.testtoggle input{accent-color:var(--brand);width:14px;height:14px;cursor:pointer}

/* Copy-email button: subtle until hovered; green check flash on success. */
.copybtn{background:none;border:0;padding:1px 3px;margin-left:4px;cursor:pointer;color:var(--muted);
  opacity:.4;vertical-align:middle;border-radius:4px;line-height:0}
.copybtn svg{width:13px;height:13px}
.copybtn:hover{opacity:1;color:var(--brand);background:var(--brand-soft,#eef2ff)}
.copybtn.copied{opacity:1;color:var(--ok,#059669)}
.copybtn.copied svg{display:none}
.copybtn.copied::after{content:"✓";font-size:12px;font-weight:800;line-height:1}
tr:hover .copybtn{opacity:.75}

/* Product labels on the customer page's two independent status pills — without
   these, "AB: Paid" beside the email and an unlabelled "Trial" top-right read
   as one account contradicting itself. They're two different products. */
.pf-prodstat{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:700;
  color:var(--muted);text-transform:uppercase;letter-spacing:.3px}
.pf-prodstat .pill{text-transform:none;letter-spacing:0;margin-left:2px}
.pf-prodlabel{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.3px;margin-right:2px}


/* Agent Builder billing banner on the Connect Payments tab — a different
   product's billing, surfaced inline rather than left looking like "nothing
   has ever happened here" when a real trial/subscription exists in D1. */
.pf-ab-billing{background:color-mix(in srgb, #7c3aed 5%, transparent);border:1px solid color-mix(in srgb, #7c3aed 20%, transparent);
  border-radius:10px;padding:12px 14px;margin-bottom:14px}
.pf-ab-billing-h{font-size:12px;font-weight:700;color:#5b21b6;display:flex;align-items:center;gap:6px;margin-bottom:8px}
.pf-ab-billing-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
/* a customer can hold more than one Agent Builder subscription — separate the stacked rows */
.pf-ab-billing-row+.pf-ab-billing-row{margin-top:8px;padding-top:8px;border-top:1px solid color-mix(in srgb, #7c3aed 15%, transparent)}
.pf-ab-plan{font-weight:700}

/* Agent Builder's own plan, under the Plan stat card's Connect value — same
   slot the Tasks/Mindbody quota bar uses, so Plan stops being Connect-only
   when the person also has an Agent Builder account. */
.pf-plan-ab{margin-top:6px;font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.pf-plan-ab-nm{font-weight:700}

/* Dual-product Plan cell: one labelled row per product, name / plan / status
   on a shared 3-column grid so both products line up instead of one reading as
   the unlabelled default. */
/* Columns hug their content (justify-content:start) rather than stretching to
   the cell: a 1fr value track threw the status pill out to the far edge and
   left a dead gap mid-row. */
.pf-plan-rows{display:grid;grid-template-columns:auto minmax(0,auto) auto;justify-content:start;align-items:center;gap:6px 10px;margin-top:9px}
/* Each product keeps its own brand colour — the same blue / purple the Automate
   and Agent Builder chips use everywhere else — so the two rows are told apart
   by colour, not only by reading the label. */
.pf-plan-nm{font-size:11px;font-weight:700;white-space:nowrap;letter-spacing:.01em}
.pf-plan-nm.pp-auto{color:#2563eb}
.pf-plan-nm.pp-ab{color:#7c3aed}
.pf-plan-val{font-size:12.5px;font-weight:600;color:var(--ink);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pf-plan-per{font-size:11px;font-weight:600;color:var(--muted)}
.pf-plan-st{justify-self:start;display:flex}
.pf-plan-st .pill{font-size:10px;padding:1px 7px}
@media (max-width:1080px){
  .pf-plan-rows{grid-template-columns:auto minmax(0,1fr);gap:4px 8px}
  .pf-plan-st{grid-column:2;justify-self:start;margin-top:-2px}
}

/* Agent Builder merge failed for this view — the list is incomplete and has to
   say so. Amber, not red: the Connect rows shown are correct, not an error. */
.ab-degraded{
  background:#fffbeb;
  color:#92400e;
  border-left:3px solid #f59e0b;
  font-size:12.5px;
  font-weight:600;
  padding:9px 12px;
}

/* Profile stat band with the Mindbody tile hidden (no quota, never used) —
   five tiles fill the row instead of leaving a hole in the 6-column grid. */
.pf-stats.pf-stats-5{grid-template-columns:repeat(5,minmax(0,1fr))}
.pf-stats-dual.pf-stats-5{grid-template-columns:repeat(5,minmax(max-content,1fr))}
/* Tokens usage meter present alongside Tasks (and Mindbody) → seven tiles.
   Media overrides sit AFTER the desktop rule so they win on narrow screens. */
.pf-stats.pf-stats-7{grid-template-columns:repeat(7,minmax(0,1fr))}
.pf-stats-dual.pf-stats-7{grid-template-columns:repeat(7,minmax(max-content,1fr))}
@media (max-width:1280px){.pf-stats.pf-stats-7,.pf-stats-dual.pf-stats-7{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:640px){.pf-stats.pf-stats-7,.pf-stats-dual.pf-stats-7{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Product chip in payment/charge tables: Agent Builder in the same outline
   family (and exact metrics) as .t-connect / .t-bot — purple keeps the product
   color language without reading as a button among pills. */
.tag.t-prodab{background:#f5f3ff;color:#6d28d9;border-color:#ddd6fe}

/* CSV export in the modal header — matches .modal-close's 30px square. */
.modal-head .modal-export{width:30px;height:30px;border-radius:8px;color:#475569}
.modal-head .modal-export:hover{background:#eef2ff;color:#1d4ed8}
.modal-head .modal-export[disabled]{opacity:.5;cursor:wait}

/* Contact details card: aligned label/value rows (Ram, 2026-10-23 — the old
   free-form line stack read as misaligned, and Phone must show even when empty). */
.pf-addr-row{display:grid;grid-template-columns:84px 1fr;gap:12px;padding:8px 0;border-bottom:1px dashed var(--line);align-items:baseline}
.pf-addr-row:last-child{border-bottom:0}
.pf-addr-k{font-size:10.5px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.pf-addr-v{font-size:13px;color:var(--ink);word-break:break-word;min-width:0}
.pf-addr-h{margin-bottom:4px}

/* AB user Activity tab */
.act-bar{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.act-bar .ctl{width:auto;min-width:190px}
/* a label stays with its dropdown when the bar wraps ("Reached the payment page" filters) */
.act-bar .co-filter{display:inline-flex;align-items:center;gap:8px}

/* Agent Builder figures on a profile: where they come from (app.js abSrcTag).
   "live from Agent Builder" = the product's own answer for this customer;
   "admin estimate" = the D1 mirror while the product did not answer. A small
   label at the end of the band's label row, the why on hover — not an alert. */
.ab-src{margin-left:auto;font-size:10.5px;font-weight:700;letter-spacing:.02em;padding:2px 8px;border-radius:999px;border:1px solid;white-space:nowrap;cursor:help;text-transform:none}
.ab-src.live{color:#15803d;border-color:#bbf7d0;background:#f0fdf4}
.ab-src.live::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:#16a34a;margin-right:5px;vertical-align:1px}
.ab-src.est{color:#92400e;border-color:#fde68a;background:#fffbeb}
.pf-ab-billing-h .ab-src{font-size:10px;padding:1px 7px}
/* A figure with the customer's own detail on hover (what is left, the add-on
   split, whose allowance it is) — the dotted underline says there is more. */
.ab-fig[title]{cursor:help;text-decoration:underline dotted #cbd5e1;text-underline-offset:3px}
/* The Plan tile's lines under the plan name (renewal, who bills it, the free
   window) wrap inside the tile instead of widening it: the band sizes its
   tracks by max-content, and width:0 + min-width:100% keeps these lines out of
   that measure while still filling the tile. */
.ab-live-pills{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}
.ab-live-pills .pill{font-size:10px;padding:1px 7px}
.ab-live-notes{width:0;min-width:100%}
.ab-live-notes .sc-pct{white-space:normal;line-height:1.35;margin-top:4px}
.ab-billed-warn{color:#b45309;font-weight:700}
.ab-billed-info{color:#1d4ed8}
/* Payments banner: the customer's own line, then the subscription rows. */
.ab-live-line{margin-top:4px}
.pf-ab-billing-sub{font-size:10.5px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin:12px 0 6px}
