/* =====================================================================
   Sabka Dentist · Leads console — brand stylesheet
   All colors are CSS custom properties in one :root block so they stay
   swappable (BUILD_PLAN.md §1). webhook = SD Orange, poll = SD Green.
   ===================================================================== */
/* Top progress bar (async refreshes) — fills 0%->90% then snaps to 100% */
#np{position:fixed;top:0;left:0;right:0;height:3px;z-index:9999;pointer-events:none;opacity:0;transition:opacity .25s}
#np.active{opacity:1}
#np::before{content:"";position:absolute;top:0;left:0;height:100%;width:var(--np-w,0%);background:var(--brand);box-shadow:0 0 8px 0 var(--brand);border-radius:0 2px 2px 0;transition:width .2s ease}
:root{
  /* Tell the browser the page's scheme so it paints its own surfaces (the
     Android bottom nav bar, status-bar divider, scrollbars) to match the app's
     theme instead of the phone's OS preference. */
  color-scheme:light;
  /* Sabka Dentist brand palette (from brand guide) */
  --brand:#99C221;            /* SD Green - primary */
  --brand-deep:#7CA017;       /* hover */
  --brand-dark:#4E6B0E;       /* deep green for text on light */
  --brand-tint:#F3F8E4; --brand-tint2:#E4F0C6;
  --ink:#3B3E42; --ink-soft:#63666A; --ink-faint:#97999B;   /* SD dark/light grey */
  --surface:#FFFFFF; --bg:#F6F7F4; --line:#E7E9E2; --line-soft:#F1F3EC;
  /* webhook = SD Orange (secondary accent) */
  --info:#E57200; --info-tint:#FDEFE2; --info-dark:#8A4500;
  /* poll / good = SD Green family */
  --good:#6E8F12; --good-tint:#EEF6D9; --good-dark:#4E6B0E;
  --warn:#9A6207; --warn-tint:#FBF1DE;
  --err:#B42318; --err-tint:#FDECEA;
  --r:10px; --r-lg:14px;
}
/* Dark theme — overrides the tokens above; brand green stays the accent. */
:root[data-theme="dark"]{
  color-scheme:dark;
  --brand:#A6CE39; --brand-deep:#8FB52E; --brand-dark:#B8DA5A;
  --brand-tint:#26301a; --brand-tint2:#33421f;
  --ink:#E6E8EA; --ink-soft:#AAB0B7; --ink-faint:#7E848C;
  --surface:#1F232A; --bg:#161A20; --line:#2E343E; --line-soft:#262B33;
  --info:#F08A3A; --info-tint:#3a2a17; --info-dark:#F3A766;
  --good:#9ACB3C; --good-tint:#22301a; --good-dark:#B8DA5A;
  --warn:#D9A441; --warn-tint:#332a16;
  --err:#E8736A; --err-tint:#3a2120;
}
:root[data-theme="dark"] body{-webkit-font-smoothing:auto}
:root[data-theme="dark"] .tabulator{color:var(--ink)}
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator{filter:invert(0.8)}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:'Open Sans',system-ui,sans-serif;background:var(--bg);color:var(--ink);font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
h1,h2,h3,.brand b,.btn,.topbar h1{font-family:'Nunito','Arial Rounded MT Bold',system-ui,sans-serif}
h1,h2,h3{margin:0;font-weight:700;letter-spacing:-0.01em}
.muted{color:var(--ink-faint);font-weight:400}

.app{display:grid;grid-template-columns:240px 1fr;min-height:100vh}

/* sidebar */
.side{background:var(--surface);border-right:1px solid var(--line);padding:18px 14px;display:flex;flex-direction:column;gap:6px;position:sticky;top:0;height:100vh}
.side-head{display:block}
/* On desktop the drawer wrapper is transparent (children lay out in .side as
   before); the mobile backdrop doesn't exist. Both come alive under 880px. */
.drawer{display:contents}
.nav-backdrop{display:none}
.nav-toggle{display:none;width:40px;height:40px;border:1px solid var(--line);background:var(--surface);border-radius:9px;align-items:center;justify-content:center;color:var(--ink);cursor:pointer;padding:0}
.nav-toggle i{font-size:22px}
.nav-toggle:hover{background:var(--line-soft)}
.nav-toggle:focus-visible{outline:none;box-shadow:0 0 0 3px var(--brand-tint2)}
/* Icon-only sign-out in the mobile header (hidden on desktop; the sidebar keeps
   its full Sign out button there). */
.head-signout{display:none;margin:0}
.head-signout button{width:40px;height:40px;border:1px solid var(--line);background:var(--surface);border-radius:9px;display:inline-flex;align-items:center;justify-content:center;color:var(--ink);cursor:pointer;padding:0}
.head-signout button i{font-size:20px}
.head-signout button:hover{background:var(--line-soft)}
.head-signout button:focus-visible{outline:none;box-shadow:0 0 0 3px var(--brand-tint2)}
/* Scoped to the anchor so it can't leak onto KPI value cards (.val is coloured
   with tone classes below, never the logo's .brand). */
a.brand{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:8px 8px 18px}
.brand-logo{width:100%;max-width:172px;height:auto;display:block}
.brand-sub{font-size:11.5px;color:var(--ink-faint);font-weight:500;padding-left:2px}
.logo{width:34px;height:34px;border-radius:9px;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-size:19px}
.nav{display:flex;flex-direction:column;gap:3px;margin-top:4px;flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}
.nav a{display:flex;align-items:center;gap:11px;color:var(--ink-soft);font-weight:500;padding:9px 11px;border-radius:9px;cursor:pointer}
.nav a i{font-size:19px}
.nav a .nav-svg{flex-shrink:0;display:block}
.nav a:hover{background:var(--line-soft);color:var(--ink)}
.nav a.active{background:var(--brand-tint);color:var(--brand-dark)}
/* Collapsible Reports group */
.nav details.navgroup>summary{list-style:none;display:flex;align-items:center;gap:11px;color:var(--ink-soft);font-weight:500;padding:9px 11px;border-radius:9px;cursor:pointer;user-select:none}
.nav details.navgroup>summary>i:not(.chev){font-size:19px}
.nav details.navgroup>summary::-webkit-details-marker{display:none}
.nav details.navgroup>summary:hover{background:var(--line-soft);color:var(--ink)}
.nav details.navgroup>summary .chev{margin-left:auto;font-size:16px;transition:transform .15s ease}
.nav details.navgroup[open]>summary .chev{transform:rotate(90deg)}
.nav .navsub{display:flex;flex-direction:column;gap:2px;margin:2px 0 4px}
.nav .navsub.scroll{max-height:150px;overflow-y:auto}
.nav .navsub a{display:block;padding:7px 11px 7px 34px;border-radius:8px;color:var(--ink-soft);font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.nav .navsub a:hover{background:var(--line-soft);color:var(--ink)}
.nav .navsub a.active{background:var(--brand-tint);color:var(--brand-dark)}
.nav-dot{width:8px;height:8px;border-radius:50%;background:#fe5000;margin-left:auto;flex:none;
  box-shadow:0 0 0 3px color-mix(in srgb,#fe5000 22%,transparent)}

/* On/off toggle switch (e.g. enabling a CRM) */
.switch{position:relative;display:inline-block;width:38px;height:22px;vertical-align:middle}
.switch input{opacity:0;width:0;height:0}
.switch .slider{position:absolute;inset:0;background:var(--line);border-radius:22px;transition:.15s;cursor:pointer}
.switch .slider::before{content:"";position:absolute;height:16px;width:16px;left:3px;top:3px;background:#fff;
  border-radius:50%;transition:.15s}
.switch input:checked+.slider{background:var(--good)}
.switch input:checked+.slider::before{transform:translateX(16px)}
.side-foot{margin-top:auto;padding-top:12px;border-top:1px solid var(--line)}
.who-row{display:flex;align-items:center;gap:10px;margin-bottom:11px}
.who{width:34px;height:34px;border-radius:50%;background:var(--info-tint);color:var(--info-dark);display:flex;align-items:center;justify-content:center;font-weight:600;font-size:13px;flex:0 0 auto}
.who-meta b{font-size:13px;display:block;line-height:1.2}
.who-meta span{font-size:11.5px;color:var(--ink-faint)}

/* main */
.main{padding:26px 32px 60px;min-width:0}
.topbar{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:22px}
.topbar h1{font-size:23px}
.topbar p{margin:3px 0 0;color:var(--ink-soft);font-size:13.5px}
.status{display:flex;align-items:center;gap:14px}
.sync{display:inline-flex;align-items:center;gap:7px;background:var(--good-tint);color:var(--good-dark);padding:6px 12px;border-radius:99px;font-size:12.5px;font-weight:500}
.sync i{font-size:9px}

/* panels / cards */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:16px 18px;margin-bottom:16px}
.placeholder{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:48px 24px;color:var(--ink-soft)}
.placeholder i{font-size:34px;color:var(--brand)}
.placeholder h3{font-size:17px;color:var(--ink)}
.placeholder p{max-width:460px;font-size:13.5px}

/* buttons */
.btn{height:38px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:9px;padding:0 14px;font:inherit;font-weight:500;font-size:13.5px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:7px}
.btn:hover{background:var(--line-soft)}
.btn i{font-size:17px}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.primary:hover{background:var(--brand-dark);border-color:var(--brand-dark)}
.btn.btn-block{width:100%}
.btn:focus-visible{outline:none;box-shadow:0 0 0 3px var(--brand-tint2)}

/* forms */
.field{margin-bottom:13px}
.field label{display:block;font-size:11.5px;color:var(--ink-soft);font-weight:600;margin-bottom:5px}
input:not([type="checkbox"]):not([type="radio"]),select{width:100%;height:38px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:0 11px;font:inherit;font-size:13.5px;color:var(--ink)}
input:not([type="checkbox"]):not([type="radio"]):focus,select:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-tint2)}
/* brand-styled checkboxes / radios (the global input rule above skips them) */
input[type="checkbox"],input[type="radio"]{width:17px;height:17px;accent-color:var(--brand);cursor:pointer;flex:0 0 auto;margin:0}
/* let native checkbox/radio boxes render dark in dark mode (else the unchecked box is white) */
:root[data-theme="dark"] input[type="checkbox"],:root[data-theme="dark"] input[type="radio"]{color-scheme:dark}

/* flash messages */
.flashes{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.flash{display:flex;align-items:center;gap:9px;padding:10px 13px;border-radius:10px;font-size:13.5px;font-weight:500}
.flash i{font-size:18px}
.flash-info{background:var(--info-tint);color:var(--info-dark)}
.flash-error{background:var(--err-tint);color:var(--err)}

/* login */
.login-body{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:24px}
.login-card{width:100%;max-width:380px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:28px 26px;box-shadow:0 10px 30px rgba(59,62,66,.06)}
.login-brand{display:flex;flex-direction:column;align-items:center;gap:4px;margin-bottom:22px;text-align:center}
.login-brand .brand-logo{width:100%;max-width:210px;height:auto}
.login-brand .brand-sub{font-size:12px;color:var(--ink-faint)}
.login-form{margin-top:6px}
.login-form .btn{margin-top:6px}

/* coverage strip */
.coverage{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:18px 20px;margin-bottom:18px}
.coverage .row{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:11px}
.coverage h3{font-size:14px;color:var(--ink-soft);font-weight:500}
.coverage .pct{font-size:15px;font-weight:600;color:var(--good)}
.bar{height:12px;border-radius:99px;background:var(--line);overflow:hidden;display:flex}
.bar .wh{background:var(--info)} .bar .pl{background:var(--good)}
.legend{display:flex;gap:18px;margin-top:11px;font-size:12.5px;color:var(--ink-soft)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.dot{width:9px;height:9px;border-radius:3px;display:inline-block}

/* metric cards */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:13px;margin-bottom:18px}
/* KPI card: one consistent shape on every page. Flex column + min-height so all
   cards are the same height with content top-aligned; the value size is fixed
   here (use .val.sm for text values like timestamps/status words, never an
   inline font-size). Colour comes from a .val.<tone> class, never inline. */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:15px 17px;display:flex;flex-direction:column;min-height:106px}
.card .lbl{font-size:12.5px;color:var(--ink-soft);font-weight:500}
.card .val{font-size:27px;font-weight:700;letter-spacing:-0.02em;line-height:1.12;margin-top:3px;font-family:'Nunito',system-ui,sans-serif}
.card .val.sm{font-size:19px;line-height:1.25;letter-spacing:-0.01em}
/* margin-top:auto pins the sub to the bottom edge, so every card matches. */
.card .sub{font-size:12px;color:var(--ink-faint);margin-top:auto;padding-top:6px}
/* Single accent green (--good) for highlighted values; orange for spend. */
.val.info{color:var(--info)} .val.good{color:var(--good)}
.val.warn{color:var(--warn)} .val.err{color:var(--err)} .val.muted{color:var(--ink-soft)}

/* filter bar */
.filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:11px}
.filter-actions{display:flex;justify-content:space-between;align-items:center;margin-top:14px;flex-wrap:wrap;gap:10px}
.hint{font-size:12px;color:var(--ink-faint);display:inline-flex;align-items:center;gap:6px}
.btns{display:flex;gap:8px;flex-wrap:wrap}

/* tom-select (Adset/Ad type-ahead) — single-select, 38px, theme-aware.
   !important to beat the CDN stylesheet that loads after this file. */
.ts-wrapper{font-size:13.5px}
.ts-control{border:1px solid var(--line)!important;border-radius:9px!important;background:var(--surface)!important;
  min-height:38px!important;height:38px!important;box-sizing:border-box!important;padding:0 10px!important;
  display:flex!important;align-items:center;color:var(--ink)}
.ts-control>input{margin:0!important;padding:0!important;color:var(--ink)!important}
.ts-control .item{color:var(--ink)!important}
.ts-wrapper.focus .ts-control{border-color:var(--brand)!important;box-shadow:0 0 0 3px var(--brand-tint2)!important}
.ts-dropdown{background:var(--surface)!important;border:1px solid var(--line)!important;color:var(--ink)!important}
.ts-dropdown .option{color:var(--ink)!important}
.ts-dropdown .option.active,.ts-dropdown .active{background:var(--brand-tint)!important;color:var(--brand-dark)!important}
.ts-dropdown .no-results,.ts-dropdown .optgroup-header{color:var(--ink-faint)!important}

/* tabulator theming — applies to every grid (leads, forms, audit, alerts).
   !important because the Tabulator CDN stylesheet loads after this file and
   would otherwise win (e.g. white even-rows leaking through in dark mode). */
.tabulator{font-family:inherit;font-size:13.5px;background:var(--surface)!important;border:1px solid var(--line)!important;border-radius:var(--r-lg)!important;overflow:hidden;color:var(--ink)!important}
.tabulator .tabulator-header,.tabulator .tabulator-header .tabulator-col{background:var(--surface)!important;border-color:var(--line)!important}
.tabulator .tabulator-header{border-bottom:1px solid var(--line)!important}
.tabulator .tabulator-col-title{color:var(--ink-soft)!important;font-weight:600;font-size:12px}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter{color:var(--ink-faint)!important}
.tabulator-row,.tabulator-row.tabulator-row-even,.tabulator-row.tabulator-row-odd{background:var(--surface)!important;border-bottom:1px solid var(--line-soft)!important}
.tabulator-row .tabulator-cell{color:var(--ink)!important;border-right:0!important}
.tabulator-row.tabulator-selectable:hover,.tabulator-row:hover{background:var(--brand-tint)!important}
.tabulator-row:hover .tabulator-cell{color:var(--ink)!important}
.tabulator .tabulator-footer{background:var(--surface)!important;border-top:1px solid var(--line)!important;color:var(--ink-soft)!important}
.tabulator .tabulator-footer .tabulator-page{background:var(--surface)!important;color:var(--ink-soft)!important;border:1px solid var(--line)!important}
.tabulator .tabulator-footer .tabulator-page[disabled]{opacity:.45}
.tabulator .tabulator-footer .tabulator-page.active{background:var(--brand)!important;color:#fff!important;border-color:var(--brand)!important}
.tabulator .tabulator-footer .tabulator-page-counter,.tabulator .tabulator-footer .tabulator-paginator label,.tabulator .tabulator-footer .tabulator-page-size{color:var(--ink-soft)!important}
.tabulator .tabulator-placeholder,.tabulator .tabulator-placeholder .tabulator-placeholder-contents{color:var(--ink-faint)!important;background:var(--surface)!important}
.pill{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;padding:3px 9px;border-radius:7px}
.pill.wh{background:var(--info-tint);color:var(--info-dark)}
.pill.pl{background:var(--good-tint);color:var(--good-dark)}
.plat{display:inline-flex;align-items:center;gap:6px}

/* settings */
/* align-items:start so each card sizes to its own content — a tall Meta-apps
   card no longer stretches the "How often we check Meta" card beside it. */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:6px;align-items:start}
.masked{font-family:ui-monospace,monospace;letter-spacing:.5px;color:var(--ink-soft)}
.toggle{font-size:13.5px;color:var(--ink-soft)}
@media (max-width:880px){.grid2{grid-template-columns:1fr}}
details.collapse{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);margin-bottom:16px}
details.collapse>summary{cursor:pointer;padding:14px 18px;font-weight:600;font-size:13px;color:var(--ink-soft);list-style:none;display:flex;align-items:center;gap:8px;font-family:'Nunito',system-ui,sans-serif}
details.collapse>summary::-webkit-details-marker{display:none}
details.collapse[open]>summary{border-bottom:1px solid var(--line)}
details.collapse .panel-body{padding:16px 18px}

/* analytics heatmap (day x hour) */
.heatmap{display:flex;flex-direction:column;gap:3px;overflow-x:auto}
.hm-row{display:grid;grid-template-columns:38px repeat(24,1fr);gap:3px;align-items:center;min-width:560px}
.hm-day{font-size:11px;color:var(--ink-soft);text-align:right;padding-right:6px}
.hm-h{font-size:10px;color:var(--ink-faint);text-align:center}
.hm-cell{height:20px;border-radius:3px;border:1px solid var(--line-soft)}

/* reconciliation */
.section-title{font-size:13px;color:var(--ink-soft);font-weight:600;margin:22px 0 11px;padding-left:6px;letter-spacing:.01em;font-family:'Nunito',system-ui,sans-serif;display:flex;align-items:center;gap:8px;min-height:34px}
.dtable{width:100%;border-collapse:separate;border-spacing:0;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);font-size:13.5px}
.dtable th{text-align:left;font-weight:600;font-size:12px;color:var(--ink-soft);padding:11px 14px;border-bottom:1px solid var(--line);background:var(--surface)}
.dtable td{padding:11px 14px;border-bottom:1px solid var(--line-soft)}
.dtable tr:last-child td{border-bottom:0}
/* round the four corner cells so the header/footer don't square off the table */
.dtable thead tr:first-child th:first-child{border-top-left-radius:var(--r-lg)}
.dtable thead tr:first-child th:last-child{border-top-right-radius:var(--r-lg)}
.dtable tbody tr:last-child td:first-child{border-bottom-left-radius:var(--r-lg)}
.dtable tbody tr:last-child td:last-child{border-bottom-right-radius:var(--r-lg)}
/* Option A: wrap a wide table so IT scrolls horizontally, not the whole page. */
.scroll-x{overflow-x:auto;-webkit-overflow-scrolling:touch}
.tag{font-size:11.5px;font-weight:600;padding:2px 8px;border-radius:6px;background:var(--line-soft);color:var(--ink-soft)}
.tag.ok{background:var(--good-tint);color:var(--good-dark)}
.tag.warn{background:var(--warn-tint);color:var(--warn)}
/* Leads-per-day chart: a Y-axis + gridlines behind bottom-aligned bars, with the
   lead count above each bar. Bars scale to axis_max (a rounded ceiling). */
.chart{display:flex;align-items:flex-start;gap:10px}
.chart .yaxis{display:flex;flex-direction:column;justify-content:space-between;height:170px;text-align:right;font-size:10.5px;color:var(--ink-faint);font-variant-numeric:tabular-nums;flex:0 0 auto}
.chart .plotwrap{flex:1;min-width:0}
.chart .plot{position:relative;height:170px;overflow:visible}
.chart .grid{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;pointer-events:none}
.chart .gline{height:0;border-top:1px solid var(--line-soft)}
.daybars{position:relative;height:100%;display:flex;align-items:flex-end;gap:14px;padding:0 2px}
/* full-height column so the whole bar area is hoverable, even on tiny days */
.daybar{position:relative;flex:1;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:0}
/* hover value, like the Analytics chart — positioned just above each bar */
.daybar .tip{position:absolute;left:50%;transform:translateX(-50%) translateY(4px);background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:8px;padding:6px 10px;font-size:11px;line-height:1.35;white-space:nowrap;text-align:center;opacity:0;pointer-events:none;transition:opacity .12s ease,transform .12s ease;z-index:5;box-shadow:0 6px 20px rgba(59,62,66,.14)}
.daybar .tip strong{font-size:13px;font-weight:700;font-variant-numeric:tabular-nums}
.daybar .tip small{display:block;color:var(--ink-faint);font-size:10.5px;font-weight:500;margin-top:1px}
.daybar:hover .tip{opacity:1;transform:translateX(-50%) translateY(0)}
.daybar:hover .stack{filter:brightness(1.06)}
.daybar .stack{width:100%;max-width:46px;display:flex;flex-direction:column-reverse;border-radius:6px 6px 0 0;overflow:hidden;background:var(--line-soft)}
.daybar .stack .wh{background:var(--info)} .daybar .stack .pl{background:var(--good)}
.xlabels{display:flex;gap:14px;padding:6px 2px 0}
.xlabels small{flex:1;text-align:center;font-size:11px;color:var(--ink-faint);min-width:0}
.cover-list{display:flex;flex-direction:column;gap:11px}
.cover-row{display:grid;grid-template-columns:160px 1fr 48px;align-items:center;gap:12px;font-size:13px}
.cover-row .track{height:9px;border-radius:99px;background:var(--line);overflow:hidden}
.cover-row .fill{height:100%;background:var(--brand);border-radius:99px}

@media (max-width:880px){
  /* align-content:start stops the grid from stretching the short header row to
     fill leftover height (which left a tall white gap under the header). */
  .app{grid-template-columns:1fr;align-content:start}
  /* Sidebar becomes a sticky top header; nav + account collapse into a burger drawer. */
  .side{position:sticky;top:0;z-index:100;height:auto;flex-direction:column;gap:0;
    padding:0;border-right:0;border-bottom:1px solid var(--line)}
  .side-head{position:relative;display:flex;align-items:center;justify-content:center;
    min-height:58px;padding:9px 14px}
  .nav-toggle{display:inline-flex;position:absolute;left:12px;top:50%;transform:translateY(-50%)}
  /* Sign-out icon pinned to the right of the header. */
  .head-signout{display:block;position:absolute;right:12px;top:50%;transform:translateY(-50%)}
  /* Logo + "Leads console" centered in the header. */
  a.brand{flex-direction:column;align-items:center;gap:2px;padding:0;text-align:center}
  .brand-logo{width:auto;max-width:150px;max-height:34px}
  .brand-sub{padding-left:0}
  /* Off-canvas aside: the drawer slides in from the left, below the header,
     over a dimmed backdrop. --hh (header height) is set by JS. */
  .drawer{display:flex;flex-direction:column;position:fixed;top:var(--hh,64px);left:0;bottom:0;
    z-index:1;width:min(300px,84vw);background:var(--surface);border-right:1px solid var(--line);
    transform:translateX(-100%);transition:transform .22s ease;
    overflow-y:auto;overscroll-behavior:contain}
  .side.open .drawer{transform:translateX(0)}
  .nav-backdrop{display:block;position:fixed;top:var(--hh,64px);left:0;right:0;bottom:0;z-index:0;
    background:rgba(0,0,0,.42);opacity:0;pointer-events:none;transition:opacity .22s ease}
  .side.open .nav-backdrop{opacity:1;pointer-events:auto}
  .nav{display:flex;flex-direction:column;flex-wrap:nowrap;gap:3px;margin:0;
    padding:8px 12px;overflow:visible;min-height:auto}
  .side-foot{display:flex;margin:auto 0 0;flex-direction:row;justify-content:space-between;
    align-items:center;padding:12px;border-top:1px solid var(--line)}
  .side-foot .who-row{margin:0}
  /* Sign-out lives in the header on mobile, so hide the drawer's Sign out
     button (keep the user identity row). */
  .side-foot form{display:none}
  .main{padding:18px}
  .topbar{flex-wrap:wrap}
  .topbar h1{font-size:20px}
  .filters{grid-template-columns:1fr 1fr}
}
@media (max-width:540px){
  .filters{grid-template-columns:1fr}
  .cards{grid-template-columns:1fr 1fr}
}
/* Option B: on mobile, `.dtable.stack` tables become one card per row with
   `label: value` pairs (labels come from each cell's data-label). Desktop keeps
   the normal table. Works with .showmore (its display:none on rows 6+ wins). */
@media (max-width:880px){
  .dtable.stack{display:block;width:100%;border:0;background:transparent;font-size:13.5px}
  .dtable.stack thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
  .dtable.stack tbody,.dtable.stack tr,.dtable.stack td{display:block;width:100%}
  .dtable.stack tr{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);margin-bottom:10px;overflow:hidden}
  .dtable.stack tr:last-child{margin-bottom:0}
  .dtable.stack td{border:0;border-bottom:1px solid var(--line-soft);padding:9px 14px;
    display:flex;align-items:center;gap:12px;
    text-align:right;white-space:normal!important;max-width:none!important;min-height:0}
  .dtable.stack td:last-child{border-bottom:0}
  /* label sits left; margin-right:auto pushes every value element to the right,
     grouped together (works even when a cell holds a switch + text + tag). */
  .dtable.stack td[data-label]::before{content:attr(data-label);font-weight:600;font-size:12px;
    color:var(--ink-soft);text-align:left;flex:0 0 auto;margin-right:auto}
  /* action cells (no label): let the buttons use the row, right-aligned + wrapping */
  .dtable.stack td.actions{justify-content:flex-end;flex-wrap:wrap;gap:8px}
  /* empty-state row (colspan): plain centered message, not a label/value pair */
  .dtable.stack td[colspan]{justify-content:center;text-align:center}
  .dtable.stack td[colspan]::before{content:none}
  .dtable.stack .masked{word-break:break-all}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
:focus-visible{outline:none;box-shadow:0 0 0 3px var(--brand-tint2)}

/* =====================================================================
   SD Reminders — additions.
   Everything above this line is the leads console stylesheet, verbatim.
   New rules only; no token blocks, selectors or values above are altered.
   ===================================================================== */

/* The sidebar identity block is the way into Profile (there is no nav item
   for it), so it's an <a> now. Same layout as the leads .who-row; this only
   adds the affordance. */
a.who-row{border-radius:9px;padding:6px;margin:0 -6px 5px;cursor:pointer}
a.who-row:hover{background:var(--line-soft)}

/* Inline validation message under a .field input. */
.err-msg{display:flex;align-items:center;gap:5px;margin-top:5px;font-size:11.5px;font-weight:600;color:var(--err)}
.err-msg i{font-size:14px}
.field input[aria-invalid="true"]{border-color:var(--err)}

/* Checkbox + label on one line (login's "Keep me signed in"). */
.checkline{display:flex;align-items:center;gap:9px;font-size:13px;color:var(--ink-soft);margin:2px 0 14px;cursor:pointer}

/* Login card footnote. */
.login-foot{margin:16px 0 0;font-size:11.5px;line-height:1.5;color:var(--ink-faint);text-align:center}

/* Panel heading + one-line description, matching .topbar's h1/p pairing. */
.panel-title{font-size:15px;margin-bottom:3px}
.panel-lede{margin:0 0 15px;font-size:12.5px;color:var(--ink-soft)}

/* Profile identity strip — the sidebar avatar at reading size. */
.who-card{display:flex;align-items:center;gap:14px}
.who-card b{font-size:15px;display:block;line-height:1.3;font-family:'Nunito',system-ui,sans-serif}
.who-card .muted{font-size:12.5px}
.who.lg{width:48px;height:48px;font-size:19px}

/* Light/dark chooser: two radio cards, the selected one outlined in brand
   green. The radio itself stays in the DOM for keyboard and screen readers. */
.theme-opts{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:15px}
.theme-opt{display:flex;align-items:center;gap:10px;padding:11px 13px;border:1px solid var(--line);border-radius:9px;cursor:pointer;font-size:13.5px;font-weight:500;background:var(--surface)}
.theme-opt:hover{background:var(--line-soft)}
.theme-opt:has(input:checked){border-color:var(--brand);background:var(--brand-tint);color:var(--brand-dark)}
.theme-opt:has(input:focus-visible){box-shadow:0 0 0 3px var(--brand-tint2)}
.theme-swatch{width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;border:1px solid var(--line);flex:0 0 auto}
/* Fixed literals, not tokens: these two swatches always preview the light and
   dark themes, whichever one you're currently looking at. */
.theme-swatch-light{background:#F6F7F4;color:#63666A;border-color:#E7E9E2}
.theme-swatch-dark{background:#1F232A;color:#AAB0B7;border-color:#2E343E}

/* Row-header cells in a plain two-column .dtable (Profile > Account). */
.dtable th[scope="row"]{width:190px;border-bottom:1px solid var(--line-soft);vertical-align:top}
.dtable tbody tr:last-child th{border-bottom:0}

/* Error / rate-limit page, centred in the .login-body shell. */
.errpage{text-align:center}
.errpage-code{display:inline-block;font-family:'Nunito',system-ui,sans-serif;font-size:12px;font-weight:700;letter-spacing:.08em;color:var(--ink-faint);margin-bottom:8px}
.errpage h3{font-size:19px;margin-bottom:8px}
.errpage p{margin:0 0 20px;font-size:13.5px;color:var(--ink-soft)}

@media (max-width:540px){
  .theme-opts{grid-template-columns:1fr}
  .dtable th[scope="row"]{width:130px}
}

/* ---------- Phase 2 · recipients ---------------------------------------- */

/* The base input rule targets input+select only, so a textarea would render
   unstyled. Match the 38px field height; let it grow vertically only. */
textarea{width:100%;min-height:38px;border:1px solid var(--line);border-radius:9px;
  background:var(--surface);padding:9px 11px;font:inherit;font-size:13.5px;color:var(--ink);
  resize:vertical;line-height:1.4}
textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-tint2)}
textarea::placeholder,input::placeholder{color:var(--ink-faint)}

/* Compact button for table rows. */
.btn.btn-sm{height:31px;padding:0 10px;font-size:12.5px;border-radius:8px;gap:5px}
.btn.btn-sm i{font-size:15px}
/* Destructive action. Red only on hover, so a row of buttons doesn't read as
   a warning at rest — SD Green stays the only colour at idle. */
.btn.btn-danger{color:var(--ink-soft)}
.btn.btn-danger:hover{background:var(--err-tint);border-color:var(--err);color:var(--err)}
.btn.btn-danger:focus-visible{box-shadow:0 0 0 3px var(--err-tint)}

/* Action cell. Above 880px the .dtable.stack flex rules don't apply, so keep
   the cell a real table-cell and space the buttons with a sibling margin. */
.dtable td.actions{text-align:right;white-space:nowrap}
@media (min-width:881px){.dtable td.actions .btn + .btn{margin-left:6px}}

/* Avatar chip reused at row scale. */
.who.sm{width:26px;height:26px;font-size:11px;border-radius:50%}
.rec-who{display:inline-flex;align-items:center;gap:9px;font-weight:600}
.rec-mail{color:var(--ink-soft);text-decoration:none}
.rec-mail:hover{color:var(--brand-dark);text-decoration:underline}

/* A deactivated contact stays legible but visibly out of circulation. Only
   the identity dims — its buttons must stay readable to bring it back. */
.rec-off .rec-who,.rec-off .rec-mail{opacity:.5}

/* Row being edited in place. */
.rec-editing td{background:var(--brand-tint)}
.rec-editing input{height:33px;font-size:13px}

/* Brief confirmation after an inline save. */
@keyframes recSaved{from{background:var(--good-tint)}to{background:transparent}}
.rec-just-saved td{animation:recSaved 1.4s ease-out}
@media (prefers-reduced-motion:reduce){.rec-just-saved td{animation:none}}

/* Search + status, pushed to the right of the .section-title row. */
.section-title .spacer{margin-left:auto}
.rec-filters{display:flex;gap:8px;align-items:center;font-weight:400}
.rec-filters input[type="search"]{width:220px;height:34px;font-size:13px}
.rec-filters select{width:auto;min-width:96px;height:34px;font-size:13px}

.rec-count{font-size:12.5px;color:var(--ink-faint);margin:0 0 9px 2px}
.rec-count b{color:var(--ink-soft);font-weight:600}

/* Button that reads as a link (inside the empty-state row). */
.linkish{background:none;border:0;padding:0;font:inherit;font-size:inherit;
  color:var(--brand-dark);font-weight:600;cursor:pointer;text-decoration:underline}
.linkish:focus-visible{outline:none;box-shadow:0 0 0 3px var(--brand-tint2);border-radius:4px}

@media (max-width:880px){
  .section-title{flex-wrap:wrap}
  .section-title .spacer{margin-left:0;flex-basis:100%;height:0}
  .rec-filters{width:100%}
  .rec-filters input[type="search"]{flex:1;width:auto}
}

/* ---------- Tabulator grids · measurements ------------------------------
   The base .tabulator block earlier in this file handles colour; these handle
   size. Grid cells are brought to the same numbers as .dtable so a grid and a
   table on adjacent pages read as one family — Tabulator's own defaults are
   4px padding / 40px rows, a third of the table's, which looks unconsidered
   beside it.

   Verified against Tabulator 5.6.0 and 6.3.1, both themes.

   !important throughout for the same reason the base block uses it: the
   Tabulator CDN stylesheet loads after this file and wins on equal
   specificity. That is also why font-size is restated here — it is the one
   declaration in the base .tabulator rule without !important, so the CDN
   sheet silently overrides 13.5px to 14px.
   ---------------------------------------------------------------------- */
.tabulator .tabulator-row .tabulator-cell{padding:11px 14px!important;font-size:13.5px!important;
  font-variant-numeric:tabular-nums}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content{padding:11px 14px!important}
.tabulator .tabulator-footer{font-size:12.5px!important}

/* Header column dividers stay ON, matching the leads console. To drop them so
   the header matches the body cells — which the base block already zeroes —
   uncomment this one rule:
.tabulator .tabulator-header .tabulator-col{border-right:0!important}
*/

/* ---------- Phase 3 · reminders ----------------------------------------- */

/* Form beside a preview that stays in view while the schedule is edited —
   the preview is the thing to watch, not something to scroll back for. */
.form-2col{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:18px;align-items:start}
.form-main{min-width:0;display:flex;flex-direction:column;gap:16px}
/* .panel brings its own margin-bottom; with the gap above that doubles. */
.form-main>.panel{margin-bottom:0}
.form-side{position:sticky;top:20px}
.form-actions{display:flex;gap:10px;align-items:center}

/* A labelled block inside a panel, below the .filters grid. */
.subfield{margin-top:15px}
.subfield>label{display:block;font-size:11.5px;color:var(--ink-soft);font-weight:600;margin-bottom:7px}
.subfield[hidden],.sched[hidden],.monthly-row[hidden]{display:none}

/* Segmented radio group (One-off / Repeating, and the smaller variants). */
.seg{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;
  margin-bottom:15px;background:var(--surface)}
.seg-opt{position:relative;display:inline-flex;align-items:center;gap:7px;padding:9px 15px;
  font-size:13.5px;font-weight:500;cursor:pointer;color:var(--ink-soft);
  border-right:1px solid var(--line)}
.seg-opt:last-child{border-right:0}
.seg-opt input{position:absolute;opacity:0;width:0;height:0;margin:0}
.seg-opt:hover{background:var(--line-soft)}
.seg-opt:has(input:checked){background:var(--brand-tint);color:var(--brand-dark);font-weight:600}
.seg-opt:has(input:focus-visible){box-shadow:inset 0 0 0 2px var(--brand-tint2)}
.seg.seg-sm{margin-bottom:11px}
.seg.seg-sm .seg-opt{padding:7px 12px;font-size:12.5px}

/* A row of controls reading as a sentence: "On the [second] [Tuesday]". */
.monthly-row{display:flex;align-items:center;gap:9px;flex-wrap:wrap;font-size:13.5px;
  color:var(--ink-soft);margin-bottom:6px}
.monthly-row input[type="number"]{width:82px}
.monthly-row select{width:auto;min-width:120px}
.monthly-row input[type="date"]{width:auto}
.monthly-row .hint{margin-left:4px}
.inline-unit{display:flex;align-items:center;gap:9px}
.inline-unit input{width:82px}
.inline-unit span{font-size:13.5px;color:var(--ink-soft)}

/* Weekday and advance-notice pickers: checkbox chips. */
.daypick,.offsets{display:flex;flex-wrap:wrap;gap:8px}
.daybox,.offbox{position:relative;display:inline-flex;align-items:center;gap:7px;
  padding:7px 13px;border:1px solid var(--line);border-radius:9px;background:var(--surface);
  font-size:13px;font-weight:500;cursor:pointer;color:var(--ink-soft)}
.daybox input,.offbox input{position:absolute;opacity:0;width:0;height:0;margin:0}
.daybox:hover,.offbox:hover{background:var(--line-soft)}
.daybox:has(input:checked),.offbox:has(input:checked){
  border-color:var(--brand);background:var(--brand-tint);color:var(--brand-dark);font-weight:600}
.daybox:has(input:focus-visible),.offbox:has(input:focus-visible){box-shadow:0 0 0 3px var(--brand-tint2)}

/* Recipient picker. Search, scroll and chips, so it still works when the
   contact book outgrows a single screen of checkboxes. Filtering matches
   notes as well as name and email — notes holds the department, which is how
   you pick a whole team without groups existing as a concept (§4, §11). */
.picker{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}
.picker-bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.picker-bar input[type="search"]{flex:1;min-width:190px;height:34px;font-size:13px}
.picker-bar .btn:disabled{opacity:.45;cursor:default}

/* Selected people stay visible as chips even when the filter hides their row. */
.picker-chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px 4px 10px;border-radius:99px;
  border:1px solid transparent;background:var(--brand-tint);color:var(--brand-dark);
  font:inherit;font-size:12px;font-weight:600;cursor:pointer;line-height:1.4}
.chip i{font-size:14px;opacity:.65}
.chip:hover{background:var(--brand-tint2)}
.chip:hover i{opacity:1}
.chip:focus-visible{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-tint2)}

.picker-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:8px;
  max-height:290px;overflow-y:auto;padding:2px;border:1px solid var(--line);
  border-radius:10px;background:var(--bg)}
.picker-list .personbox[hidden]{display:none}
.picker-none{grid-column:1/-1;margin:0;padding:22px 12px;text-align:center;
  font-size:13px;color:var(--ink-faint)}
.picker-count{margin:0;font-size:12px;color:var(--ink-faint)}
.picker-count b{color:var(--ink-soft);font-weight:600}

.personbox{display:flex;align-items:center;gap:10px;padding:8px 11px;border:1px solid var(--line);
  border-radius:9px;font-size:13px;cursor:pointer;background:var(--surface);color:var(--ink-soft);
  min-width:0}
.personbox:hover{background:var(--line-soft)}
.personbox:has(input:checked){border-color:var(--brand);background:var(--brand-tint);color:var(--brand-dark)}
.personbox-body{display:flex;flex-direction:column;min-width:0;flex:1}
.personbox-body b{font-size:13px;font-weight:600;line-height:1.3;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.personbox-mail{font-size:11.5px;color:var(--ink-faint);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.personbox:has(input:checked) .personbox-mail{color:var(--good-dark)}
.personbox-tag{flex:0 0 auto;max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* The live occurrence preview (§8). */
.preview-panel{padding:0;overflow:hidden}
.preview{padding:16px 18px}
.preview-head{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap;margin-bottom:12px}
.preview-head .panel-title{margin:0}
.preview-list{list-style:none;margin:0;padding:0;counter-reset:p;display:flex;
  flex-direction:column;gap:2px}
.preview-list li{display:flex;flex-direction:column;gap:1px;padding:9px 11px;border-radius:9px;
  background:var(--line-soft)}
.preview-when{font-size:13.5px;font-weight:600;font-variant-numeric:tabular-nums}
.preview-why{font-size:11.5px;color:var(--ink-faint)}
.preview-foot{margin:12px 0 0;font-size:11.5px;color:var(--ink-faint);line-height:1.45}
.preview-error,.preview-empty{display:flex;gap:10px;align-items:flex-start;padding:12px 13px;
  border-radius:10px;font-size:13px}
.preview-error{background:var(--warn-tint);color:var(--warn)}
.preview-empty{background:var(--line-soft);color:var(--ink-soft)}
.preview-error i,.preview-empty i{font-size:18px;flex:0 0 auto;margin-top:1px}
.preview-error b,.preview-empty b{display:block;font-size:13px}
.preview-error span,.preview-empty span{display:block;font-size:12px;margin-top:2px;line-height:1.45}

/* Grid cells. */
/* The action column carries three icon buttons; the roomy padding applied to
   ordinary cells would push the last one out of view. */
.tabulator .tabulator-row .tabulator-cell.cell-actions{padding:6px 8px!important;white-space:nowrap}
.tabulator .cell-actions .btn+.btn{margin-left:4px}
.tabulator .cell-actions .btn.btn-sm{height:28px;padding:0 8px}
.grid-title{font-weight:600;color:var(--ink)}
.grid-title:hover{color:var(--brand-dark);text-decoration:underline}
.grid-warn{color:var(--err);font-weight:700}

@media (max-width:1100px){
  .form-2col{grid-template-columns:1fr}
  .form-side{position:static}
}
@media (max-width:540px){
  .seg{display:flex;width:100%}
  .seg-opt{flex:1;justify-content:center;padding:9px 8px}
  .picker-list{grid-template-columns:1fr}
}

/* "optional" marker beside a subfield label, and its explanatory line. */
.subfield>label .opt{font-weight:500;color:var(--ink-faint);text-transform:none;
  letter-spacing:0;font-size:11px}
.subhint{margin:-3px 0 9px;font-size:11.5px;color:var(--ink-faint);line-height:1.45;max-width:62ch}

/* Pushes a secondary action away from Save/Cancel so it is not mistaken for
   one of them (the send-test button on the reminder form). */
.form-actions-sep{margin-left:auto}

/* ---------- Phase 5 · acknowledgement ----------------------------------- */

/* The public ack page. Opened from an email, usually on a phone, with no
   session — so it stands alone rather than inside the app shell. */
.ack-card{text-align:center}
.ack-mark{width:52px;height:52px;border-radius:50%;display:flex;align-items:center;
  justify-content:center;margin:0 auto 14px;font-size:27px}
.ack-mark-good{background:var(--good-tint);color:var(--good-dark)}
.ack-mark-warn{background:var(--warn-tint);color:var(--warn)}
.ack-head{font-size:19px;margin-bottom:9px}
.ack-body{margin:0 0 14px;font-size:13.5px;line-height:1.6;color:var(--ink-soft)}
.ack-note{margin:12px 0 0;font-size:12px;line-height:1.5;color:var(--ink-faint)}
/* What is about to be confirmed, stated plainly before the button. */
.ack-detail{display:flex;flex-direction:column;gap:3px;padding:13px 15px;margin-bottom:14px;
  background:var(--bg);border:1px solid var(--line);border-radius:10px;text-align:left}
.ack-detail b{font-size:14.5px;font-family:'Nunito',system-ui,sans-serif;color:var(--ink)}
.ack-detail span{font-size:12.5px;color:var(--ink-soft)}
.ack-quote{text-align:left;white-space:pre-line;border-left:3px solid var(--brand);
  padding-left:12px;color:var(--ink)}
/* A deliberately large target: this is the whole point of the page, and it
   is usually being tapped with a thumb. */
.btn.btn-lg{height:46px;font-size:15px}

/* Status board */
.board-title{font-weight:600;color:var(--ink)}
.board-title:hover{color:var(--brand-dark);text-decoration:underline}
.dtable .tag+.tag{margin-left:4px}

/* ---------- Phase 6 · visibility ---------------------------------------- */

/* Failure banner (§8). Deliberately loud and above the metric cards: when
   the dispatcher has stopped, every number below reads zero as though that
   were good news, so the banner has to arrive first. */
.alertbar{display:flex;align-items:flex-start;gap:12px;padding:13px 16px;margin-bottom:18px;
  border-radius:var(--r);background:var(--err-tint);border:1px solid var(--err);color:var(--err)}
.alertbar>i{font-size:20px;flex:0 0 auto;margin-top:1px}
.alertbar-body{flex:1;font-size:13.5px;line-height:1.55;color:var(--ink)}
.alertbar-body b{color:var(--err)}
.alertbar .btn{flex:0 0 auto;background:var(--surface);border-color:var(--err);color:var(--err)}
.alertbar .btn:hover{background:var(--err);color:#fff}

/* Several small POST forms sharing one action cell. */
.inline-form{display:inline}

/* Status pills for a send, reused by the queue and the log. */
.tag.st-pending{background:var(--line-soft);color:var(--ink-soft)}
.tag.st-sent{background:var(--good-tint);color:var(--good-dark)}
.tag.st-acknowledged{background:var(--brand-tint2);color:var(--brand-dark)}
.tag.st-failed{background:var(--err-tint);color:var(--err)}
.tag.st-skipped,.tag.st-cancelled{background:var(--line-soft);color:var(--ink-faint)}
.tag.st-sending{background:var(--warn-tint);color:var(--warn)}
.tag.overdue{background:var(--warn-tint);color:var(--warn)}

/* Calendar legend and its status dots. Literal-free: the same tokens the
   events themselves use, so light and dark stay consistent. */
.cal-legend{display:flex;flex-wrap:wrap;align-items:center;gap:16px;margin-bottom:14px;
  font-size:12.5px;color:var(--ink-soft)}
.cal-legend span{display:inline-flex;align-items:center;gap:6px}
.cal-legend .dot{width:10px;height:10px;border-radius:3px;display:inline-block}
/* --line is a hairline colour and vanishes as a 10px swatch; the legend
   needs the slightly stronger neutral to be legible. */
.ev-dot-pending{background:var(--ink-faint)}
.ev-dot-sent{background:var(--good)}
.ev-dot-acknowledged{background:var(--brand)}
.ev-dot-failed{background:var(--err)}
.cal-legend .hint{margin-left:auto;max-width:46ch;text-align:right}

/* A form that exists only to be submitted by script (queue row actions). */
.hidden-form{display:none}

/* SMTP failure text in the log, wrapped rather than truncated — the reason
   for the failure is the entire point of the row. */
.log-error{color:var(--err);font-size:12.5px;line-height:1.4;
  white-space:normal;word-break:break-word}

@media (max-width:880px){
  .cal-legend .hint{margin-left:0;text-align:left;max-width:none}
}


/* ---------- Phase 7 - admin --------------------------------------------- */

/* Sub-navigation within Settings. The sidebar has one Settings entry, so
   Users and the audit log hang off this rather than the main nav. */
.tabs{display:flex;gap:4px;margin-bottom:18px;border-bottom:1px solid var(--line);
  flex-wrap:wrap}
.tabs a{display:inline-flex;align-items:center;gap:7px;padding:9px 14px;font-size:13.5px;
  font-weight:500;color:var(--ink-soft);border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs a i{font-size:17px}
.tabs a:hover{color:var(--ink)}
.tabs a.active{color:var(--brand-dark);border-bottom-color:var(--brand);font-weight:600}
.tabs a:focus-visible{outline:none;box-shadow:0 0 0 3px var(--brand-tint2);border-radius:6px}

/* Role picker sits inline in a table cell. */
.role-select{width:auto;min-width:96px;height:31px;font-size:12.5px;padding:0 8px}

/* Set-password opens in place rather than on its own page - it is two
   fields, and a round trip for that is a poor trade. */
.pw-drop{display:inline-block;position:relative}
.pw-drop>summary{list-style:none;cursor:pointer}
.pw-drop>summary::-webkit-details-marker{display:none}
.pw-form{position:absolute;right:0;top:calc(100% + 6px);z-index:20;display:flex;gap:6px;
  padding:10px;background:var(--surface);border:1px solid var(--line);
  border-radius:10px;box-shadow:0 10px 30px rgba(59,62,66,.14)}
.pw-form input{width:210px;height:31px;font-size:12.5px}
:root[data-theme="dark"] .pw-form{box-shadow:0 10px 30px rgba(0,0,0,.45)}

/* Audit payloads render as a sentence rather than raw JSON. */
.audit-detail{font-size:12.5px;color:var(--ink-soft);line-height:1.5}
.audit-detail b{color:var(--ink);font-weight:600}
.audit-detail i{font-size:13px;opacity:.6;vertical-align:-2px}
.audit-detail .sep{color:var(--ink-faint);margin:0 7px}

@media (max-width:880px){
  .pw-form{position:static;flex-wrap:wrap;box-shadow:none;margin-top:8px}
  .pw-form input{width:100%}
}

/* A disabled button must look disabled everywhere, not only inside the
   recipient picker where this rule first appeared. Deactivating your own
   account is blocked server-side; the button should say so before you press
   it rather than after. */
.btn:disabled,.btn[disabled]{opacity:.45;cursor:not-allowed}
.btn:disabled:hover,.btn[disabled]:hover{background:var(--surface)}
.btn.primary:disabled:hover{background:var(--brand)}

/* A hint carrying a long command wraps instead of pushing it off to the
   right; inline-flex kept it on one line. */
.hint-block{display:block}
.hint-block code{white-space:normal;word-break:break-word}

/* .hint is inline-flex, so each inline child (text, <code>, <br>, a link)
   becomes its own flex column and the sentence shatters into fragments.
   Multi-part hints opt into block layout; the icon floats beside the text. */
.hint-block>i:first-child{float:left;margin:2px 6px 0 0}
.hint-block::after{content:"";display:block;clear:both}

/* Send-test: an address beside its button. Pre-filled with your own, so the
   common case stays one click and mailing anyone else is deliberate. */
.sendtest{display:flex;gap:8px;align-items:center;min-width:0}
.sendtest input[type="email"]{width:230px;min-width:150px;height:38px;font-size:13px}
.sendtest .btn{flex:0 0 auto}
/* Visible to screen readers only — the field is self-evident to sighted users
   from its placeholder and the adjacent button. */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media (max-width:640px){
  .sendtest{width:100%;flex-wrap:wrap}
  .sendtest input[type="email"]{width:100%}
}
