/* Support101 — app-specific component styles (helpdesk UI: topbar, ticket
   detail, dashboard, queue, admin editors, login split, customer header…).

   The GENERIC design layer — self-hosted fonts, Ops Light/Dark tokens, the
   Bootstrap --bs-* mapping, --shadow/--shadow-lg elevation, brand buttons
   (.btn-primary/.btn-outline-primary), edge-clarity (cards/inputs/tables), the
   a11y focus/reduced-motion defaults AND the sidebar rail component (.s-side
   CSS + /theme/sidebar.js behavior; our markup in views/partials/sidebar.ejs)
   — lives in the shared `@aria-framework/theme` npm package, served from
   /theme/theme.css and loaded BEFORE this file (see views/partials/*-head.ejs,
   views/errors/*, views/auth/login.ejs).

   ⇒ Change shared tokens/colours/components in the package (bump its version,
     `npm update @aria-framework/theme` here), NOT in this file.
   ⇒ Keep ONLY Support101-specific component rules below. All var(--brand|--line|
     --surface|--side-*|--text|--shadow…) references resolve from theme.css. */

/* Chrome bits (public-site navbar) that use fixed Bootstrap utilities need a
   nudge in dark mode until they're rebuilt on tokens. */
[data-bs-theme="dark"] .navbar.bg-light{background-color:var(--surface)!important;border-color:var(--line)!important}
[data-bs-theme="dark"] .navbar.bg-light .navbar-text{color:var(--text)!important}
[data-bs-theme="dark"] body.bg-light,[data-bs-theme="dark"] .bg-light{background-color:var(--paper)!important}

/* ── Top bar (Phase 1) ──────────────────────────────────────────────────────*/
.topbar{
  position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:14px;
  padding:13px 24px; background:var(--surface); border-bottom:1px solid var(--line);
  /* Declared rather than left to the content so the floating flash below can clear it without a
     magic number that drifts the first time this bar gains a control. */
  min-height:var(--topbar-h);
}

/* ── Floating flash ─────────────────────────────────────────────────────────
   The transient success message, taken OUT of the document flow. In the flow it pushed the page
   down when it appeared and pulled it back up when it removed itself three seconds later — and the
   second shift arrives exactly while somebody is typing or clicking the next thing.

   --flash-top clears whichever chrome is above it. The staff console's .topbar is sticky and stays
   put; the public portal's navbar is 56px and scrolls away. Both are expressed here so the offset
   cannot drift away from the bar it is clearing. */
:root{ --topbar-h:65px; --flash-top:68px; --flash-h:auto; }   /* 68 = public navbar 56 + 12 */
/* THE STAFF CONSOLE PUTS IT ON THE BAR, not under it — level with the bell and the drafts pencil.
   The bar is sticky at the top of the viewport and the flash is fixed, so top:0 plus the bar's own
   height is exactly its band, and --topbar-h stays the one place that number is written. */
#page-content-wrapper{ --flash-top:0px; --flash-h:var(--topbar-h); }

.flash-float{
  /* TOP CENTRE, over the banner. Still `fixed`, which is the load-bearing half: in the flow this
     shifted the whole page down on arrival and back up three seconds later, and the second shift
     landed exactly when somebody had started typing the next thing.

     Centred on the VIEWPORT, not on the content column — the sidebar is in the flow on desktop and
     changes width when it collapses, so matching the content centre would mean copying 236px and
     64px out of @aria-framework/theme and having them drift the day the package changes them. */
  position:fixed; top:var(--flash-top); left:50%; transform:translateX(-50%); z-index:1080;
  width:min(30rem, calc(100vw - 48px));
  /* min-height, not height: a message long enough to wrap grows DOWNWARD past the bar rather than
     spilling equally above it and off the top of the screen. */
  min-height:var(--flash-h); display:flex; align-items:center;
  /* The container spans part of the page even when empty, so it must never eat a click aimed at
     what is underneath. The alert itself takes them back. */
  pointer-events:none;
}
.flash-float .alert{
  /* The container is a flex row now, so without this the alert shrinks to its text and stops
     filling the width the container was given. */
  flex:1 1 auto;
  pointer-events:auto; margin-bottom:0;
  box-shadow:0 10px 30px rgba(0,0,0,.18);
  animation:flashIn .18s ease-out;
}
@keyframes flashIn{ from{ opacity:0; transform:translateY(-6px); } to{ opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce){ .flash-float .alert{ animation:none; } }
/* Narrow screens: a 30rem card leaves an awkward sliver either side, so span the gutters instead.
   `transform:none` because the centring above would then pull it half a screen to the left. */
@media (max-width: 576px){
  .flash-float{ left:12px; right:12px; width:auto; transform:none; --flash-h:auto; }
  /* A narrow bar has no room to share — the title and the icons already fill it — so the flash goes
     back to sitting under it. */
  #page-content-wrapper{ --flash-top:calc(var(--topbar-h) + 12px); }
}
.topbar h1{ font-size:18px; font-weight:700; letter-spacing:-.02em; margin:0; color:var(--text); }
.topbar .topbar-actions{ margin-left:auto; display:flex; align-items:center; gap:10px; }
/* One rule, two buttons: the drafts pencil is the same control as the bell, and a second copy of
   these numbers would drift the first time either is touched. */
.topbar .bell-btn, .topbar .draft-btn{
  position:relative; width:38px; height:38px; border-radius:10px; border:1px solid var(--line);
  background:var(--surface); color:var(--text-soft); display:grid; place-items:center; font-size:16px; text-decoration:none;
}
.topbar .bell-btn:hover, .topbar .draft-btn:hover{ color:var(--text); }
/* Not bg-danger like the bell's: an unsent draft is your own work in progress, not an alert. The
   token pair inverts with the theme, so the count is legible on either brand value. */
.badge.draft-count{ background-color:var(--brand); color:var(--paper); }
/* The kind chip inside that dropdown. NOT .draft-pill: that one is --paper so it reads against a
   BUTTON, and the dropdown menu is itself --paper — the chip vanished into it and was visible only
   by its border. A brand tint reads against both. */
.badge.draft-kind{
  background-color:rgba(var(--brand-rgb), .16); color:var(--brand);
  border:1px solid rgba(var(--brand-rgb), .38); font-weight:600;
}

/* ── Composer toggles (Reply / Note) ────────────────────────────────────────
   BOTH RULES EXIST BECAUSE OF FIXED BOOTSTRAP COLOURS, which is the same bug twice.

   THE CLOSED LOOK FOR BOTH TOGGLES. Which button is filled is the page's answer to "which composer
   am I in", so exactly one of them may be filled at a time and neither is filled when both are shut.
   `.btn-outline-secondary` used to supply this, drawing from --bs-secondary (#6c757d), a constant:
   on Ops Dark that is a low-contrast outline beside a solid brand button, so the pair looked
   unfinished. This re-points the same --bs-btn-* variables at the theme's tokens — the mechanism
   theme.css itself uses for .btn-primary — so the button is neutral by intent rather than by
   accident.

   The draft pill was `bg-light text-dark`: in dark mode .bg-light is remapped to var(--paper) (a
   near-black) while text-dark stayed dark, so the word "draft" was black on black. It now takes
   both halves from the same token pair, which cannot disagree with itself. --paper rather than
   --surface so it reads against the brand fill of the Reply button as well as the Note outline. */
/* :not(.btn-primary) — THE OPEN STATE MUST WIN.
   The toggle marks an expanded composer by ADDING btn-primary to the button, so an open Note button
   carries two variants at once. Unscoped, the muted --bs-btn-color below survived that and painted
   text-soft grey onto the brand fill: measured at rgb(155,167,174) on rgb(22,181,163), which is the
   dark-mode complaint in a new place. Open, it is simply a primary button, exactly like Reply. */
.composer-toggle:not(.btn-primary){
  /* Stated rather than inherited from .btn's default: this is the whole outline look now, and a
     background that depends on a Bootstrap default is one upgrade away from being a filled button. */
  --bs-btn-bg:transparent;
  --bs-btn-color:var(--text-soft);
  --bs-btn-border-color:var(--line-strong);
  --bs-btn-hover-color:var(--text);
  --bs-btn-hover-bg:var(--surface-2);
  --bs-btn-hover-border-color:var(--line-strong);
  --bs-btn-active-color:var(--text);
  --bs-btn-active-bg:var(--surface-2);
  --bs-btn-active-border-color:var(--line-strong);
}
.badge.draft-pill{
  background-color:var(--paper); color:var(--text);
  border:1px solid var(--line-strong); font-weight:600;
}

/* ── Checkboxes and radios ──────────────────────────────────────────────────
   ⚠ LOCAL OVERRIDE OF A SHARED COMPONENT. By the rule at the top of this file this belongs in
   @aria-framework/theme, next to the .form-control / .form-select / .card rules it mirrors — a
   checkbox is a form control and looks like it was simply missed there. It is here so the app is
   usable today; it should move upstream and be deleted from here.

   MEASURED, not guessed. The border of an UNCHECKED box came from --bs-border-color (--line),
   against the surface behind it:

       dark  1.40:1        light  1.28:1

   WCAG 2.1 SC 1.4.11 asks for 3:1 on the boundary of a user-interface component, and a checkbox
   boundary is the whole affordance — on the roles matrix, which is 78 of them in a grid, the empty
   boxes were effectively invisible. --line-strong does not fix it either (2.01 / 1.53); --text-soft
   is the first token that clears 3:1 in BOTH themes (7.67 / 5.29).

   The checked state was stock Bootstrap blue (#0d6efd) in an app that is teal everywhere else. */
.form-check-input{ border-color:var(--text-soft); }
.form-check-input:checked{ background-color:var(--brand); border-color:var(--brand); }
.form-check-input:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 .25rem rgba(var(--brand-rgb), .3);
}

/* ── The polish diff ────────────────────────────────────────────────────────
   Insertions and deletions, from the theme rather than from Bootstrap's fixed reds and greens —
   the same reason the risk notes moved off .text-warning. --signal marks what went, --brand what
   arrived, which is the pairing the rest of the app already uses for "attention" and "ours". */
.polish-del{ text-decoration:line-through; text-decoration-color:var(--signal); color:var(--text-faint); }
.polish-ins{ text-decoration:none; background:rgba(var(--brand-rgb), .18); border-radius:3px; padding:0 .12em; }

/* ── Risk notes on the permission editor ────────────────────────────────────
   A handful of permissions carry a sentence explaining why they are not "another admin action" — a
   restore replaces the master key, an escalation discloses an internal investigation to the
   customer. Both the icon and the sentence were Bootstrap's .text-warning (#ffc107), and that one
   fixed colour is wrong in both themes for opposite reasons:

       light  1.49:1 on the page — loud, and barely legible as text
       dark  11.58:1              — glaring

   So the colour is split by job. The SENTENCE is prose and takes --text-soft (5.29 / 7.67): read it
   without being shouted at. The ICON keeps the signal, from the theme's own --signal (2.91 / 7.42)
   rather than Bootstrap's amber — orange rather than yellow, softer than what it replaces in dark
   and far more legible as a shape in light. A small marked glyph beside the label carries the
   warning with a fraction of the coloured area. */
.perm-risk-icon{ color:var(--signal); }
.perm-risk{ color:var(--text-soft); }

/* ── Dense grids: separators you can actually follow ────────────────────────
   Same measurement, different requirement. These are dividers rather than control boundaries, so
   3:1 is not mandated — but at 1.40 / 1.28 the permission matrix read as floating checkboxes with
   no rows or columns to track along. --text-faint (4.03 / 2.58) is a line you can follow without it
   becoming text.

   Scoped to the permission editor rather than every table in the app: this is the one that is a
   MATRIX, where the eye has to travel along a row to the right column. */
[data-perm-grid]{ --bs-table-border-color:var(--text-faint); }
[data-perm-grid] > thead{ border-bottom:2px solid var(--text-faint); }
[data-perm-editor] [data-perm-row].border{ border-color:var(--text-faint) !important; }

/* ── Status + priority badges (helpdesk; constant across themes) ────────────*/
.badge.st-new { background-color: #2563eb; }
.badge.st-open { background-color: #0891b2; }
.badge.st-pending { background-color: #d97706; }
.badge.st-resolved { background-color: #059669; }
.badge.st-closed { background-color: #6b7280; }
.badge.pr-low { background-color: #94a3b8; }
.badge.pr-medium { background-color: #2563eb; }
.badge.pr-high { background-color: #ea580c; }
.badge.pr-critical { background-color: #dc2626; }

/* ── Ticket detail header + message avatars (Phase 4) ───────────────────────*/
.back-link{ display:inline-flex; align-items:center; gap:7px; color:var(--text-soft); text-decoration:none; font-size:13px; font-weight:600; margin-bottom:14px; }
.back-link:hover{ color:var(--text); }
/* Tightened at v0.148.0. Every value below was chosen for a page that had a back link and a
   separate tab row above the composer; with both gone the header reads as one block at half the
   spacing, and the ~24px returned is a line and a half of conversation on every ticket. */
.dhead{ display:flex; align-items:flex-start; gap:16px; margin-bottom:10px; }
.dhead-main{ flex:1; min-width:0; }
.dhead-title{ font-size:22px; font-weight:700; letter-spacing:-.02em; line-height:1.25; margin:0; }
/* gap is ROW then COLUMN. The reference line and the "raised by" line are one wrapping flex
   row, not two blocks, so the space between them was the 14px row-gap rather than a margin —
   14px of leading between two lines of 12px mono, which is where the header looked airy. */
.dhead-meta{ display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:3px; font-family:var(--font-mono); font-size:12px; color:var(--text-faint); }
.dhead-meta span{ display:inline-flex; align-items:center; gap:6px; }
/* Status + priority, under the meta line. They read as the ticket's STATE, so they get
   their own row rather than joining the meta run — where they would scan as one more
   metadata item and wrap unpredictably. This fills whitespace that was already there;
   the gap above the title and .dhead's margin-bottom are unchanged. */
.dhead-pills{ display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
/* Right-side quick-access stack on the title line (Attachments + Time widget). */
.dhead-aside{ flex:0 0 auto; width:430px; max-width:50%; }
.dhead-aside .time-widget{ width:100%; }
@media (max-width: 767.98px){
  .dhead{ flex-wrap:wrap; }
  .dhead-aside{ width:100%; max-width:100%; align-items:stretch !important; }
}
/* ── App-standard tabs ──────────────────────────────────────────────────────
   Clearer outline (var(--line-strong)) + a brand accent bar on the active tab,
   so tabs read as a defined block instead of floating. Applies to every
   Bootstrap .nav-tabs in the app. */
.nav-tabs{
  --bs-nav-tabs-border-color: var(--line-strong);
  --bs-nav-tabs-link-active-color: var(--brand);
  --bs-nav-tabs-link-active-bg: var(--surface);
  --bs-nav-tabs-link-active-border-color: var(--line-strong) var(--line-strong) var(--surface);
}
.nav-tabs .nav-link{ color:var(--text-soft); }
.nav-tabs .nav-link.active{ border-top:3px solid var(--brand); font-weight:700; }
/* Strengthen the host card's border so it matches the tabs sitting on it. */
.card:has(> .card-header .nav-tabs){ border-color: var(--line-strong); }

/* ── Ticket detail: static top, independently-scrolling columns ──────────────
   On large screens the title + time widget stay put; the tabbed frame scrolls
   its body, and the right sidebar scrolls on its own. Scoped to the ticket page
   via :has(.tdetail) so no other page is affected; below lg it's normal flow. */
@media (min-width: 992px){
  #page-content-wrapper:has(.tdetail){ display:flex; flex-direction:column; overflow:hidden; }
  #page-content-wrapper:has(.tdetail) > .container-fluid{ flex:1 1 auto; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
  .tdetail{ flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
  .tdetail > .row{ flex:1 1 auto; min-height:0; --bs-gutter-y:0; }
  .tdetail > .row > .col-lg-8{ height:100%; }
  .tdetail > .row > .col-lg-8 > .card{ height:100%; display:flex; flex-direction:column; margin-bottom:0; }
  .tdetail > .row > .col-lg-8 > .card > .card-body{ flex:1 1 auto; min-height:0; overflow-y:auto; }
  .tdetail > .row > .col-lg-4{ height:100%; overflow-y:auto; }
}
.msg-head{ display:flex; align-items:center; gap:9px; margin-bottom:9px; }
.msg-av{ width:28px; height:28px; border-radius:7px; flex:0 0 28px; display:grid; place-items:center; font-weight:700; font-size:11px; color:#fff; background:var(--av, var(--brand)); }
.msg-who{ font-size:13.5px; font-weight:600; }
.msg-when{ margin-left:auto; font-family:var(--font-mono); font-size:11px; color:var(--text-faint); }

/* ── Admin inline editors: statuses + categories (aligned grid rows) ────────
   Replaces the old "whole edit form crammed into one table cell" layout, which
   wrapped and never lined up. Each row is a CSS grid; the edit <form> uses
   display:contents so its fields become grid cells that align across all rows
   (and with the header). Horizontal scroll on narrow viewports. */
.adm-scroll{ overflow-x:auto; }
.adm-editor{ display:flex; flex-direction:column; min-width:max-content; }
.adm-head, .adm-row{ display:grid; gap:10px; align-items:center; }
.adm-head{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.06em; text-transform:uppercase;
  color:var(--text-faint); padding:0 4px 8px; border-bottom:1px solid var(--line); }
.adm-row{ padding:9px 4px; border-bottom:1px solid var(--line); }
.adm-row:last-child{ border-bottom:0; }
.adm-form{ display:contents; }
.adm-form > .form-control, .adm-form > .form-select, .adm-row > form { margin:0; }
.adm-del{ margin:0; justify-self:start; }
.adm-flag{ display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--text-soft); white-space:nowrap; }
.adm-flag input{ margin:0; }
.adm-slug{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); display:flex; align-items:center; gap:6px; min-width:0; }
.adm-swatch{ padding:0; width:34px; height:34px; }
/* Fixed action-column widths (NOT auto) so every row's tracks match exactly and
   columns stay aligned regardless of cell content (e.g. "★ Default" badge vs
   "Make default" button). Each .adm-row is its own grid, so auto columns would
   size per-row and break alignment. */
/* Categories: Name · Description · Sort · Active · Save · Delete */
.adm-cats .adm-head, .adm-cats .adm-row{ grid-template-columns: minmax(140px,1.6fr) minmax(160px,2.4fr) 78px 116px 72px 84px; min-width:760px; }
/* Statuses: Colour · Name · Slug · Sort · Active · Closed · Notify · Save · Default · Delete */
.adm-statuses .adm-head, .adm-statuses .adm-row{ grid-template-columns: 54px minmax(130px,1.5fr) 134px 68px 104px 70px 74px 66px 120px 84px; min-width:1020px; }

/* ── Accessibility (Phase 7) ────────────────────────────────────────────────*/
/* Visible keyboard focus on interactive elements (mouse focus stays clean). */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, .metric:focus-visible, .att:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px;
}
/* Respect users who prefer reduced motion — kill animations + transitions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ── Login split screen (Phase 6) ───────────────────────────────────────────*/
.login-split{ min-height:100vh; display:grid; grid-template-columns:1.05fr .95fr; }
.login-art{ position:relative; overflow:hidden; padding:54px; display:flex; flex-direction:column; justify-content:space-between;
  /* Deliberately dark in BOTH schemes (white headings/copy sit on it) — fixed
     hexes, NOT var(--side-*): since theme 0.5.0 the rail tokens follow the
     scheme, and a light gradient here would wash out the white text. */
  background:linear-gradient(160deg, #0E1417, #141C21); color:#AEB8BE; }
.login-art::after{ content:""; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(circle at 1px 1px, rgba(255,255,255,.045) 1px, transparent 0) 0 0/26px 26px; }
.login-art > *{ position:relative; z-index:1; }
/* Dark mode ONLY: the pane's --paper (#0C1215) is DARKER than this panel's own
   gradient start (#0E1417) — 2 per channel — so the split all but vanishes at the
   top of the viewport and the one bold surface in the design stops reading as a
   surface. It only emerges near the bottom, where the gradient reaches #141C21.
   A hairline restores the seam. Light mode needs none and must NOT have one: a
   light --line (#DCDAD2) against this near-black panel reads as a rendering
   artifact rather than an edge. Reported by Acc101 porting this screen. */
[data-bs-theme="dark"] .login-art{ border-right:1px solid var(--line); }
.la-brand{ display:flex; align-items:center; gap:12px; }
.la-brand .mark{ width:40px; height:40px; border-radius:11px; display:grid; place-items:center; color:#fff; font-weight:800; font-size:20px;
  background:linear-gradient(140deg, var(--brand-bright), var(--brand-deep)); }
.la-brand b{ color:#fff; font-size:19px; font-weight:700; }
.la-pitch{ max-width:430px; }
.la-pitch h2{ color:#fff; font-size:32px; font-weight:700; line-height:1.18; letter-spacing:-.02em; }
.la-pitch p{ margin-top:14px; font-size:15px; line-height:1.6; color:#AEB8BE; }
.la-feats{ display:flex; flex-direction:column; gap:12px; }
.la-feats div{ display:flex; align-items:center; gap:11px; font-size:13.5px; }
.la-feats i{ color:var(--brand-bright); font-size:17px; }

.login-pane{ position:relative; display:grid; place-items:center; padding:40px; background:var(--paper); }
.login-box{ width:100%; max-width:360px; }
.login-box h1{ font-size:23px; font-weight:700; letter-spacing:-.01em; margin:0; }
.login-box .lead{ color:var(--text-soft); margin:4px 0 24px; font-size:14px; }
.login-theme{ position:absolute; top:20px; right:20px; display:flex; gap:3px; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:3px; }
.login-theme button{ border:0; background:transparent; color:var(--text-faint); width:30px; height:28px; border-radius:7px; cursor:pointer; display:grid; place-items:center; font-size:14px; }
.login-theme button:hover{ color:var(--text-soft); }
.login-theme button.on{ background:var(--surface-2); color:var(--brand); }
/* The global button:focus-visible uses outline-offset:2px, but these sit in a pill
   with padding:3px and a 1px border — a 2px-offset ring has nowhere to go but across
   the container's own border. Tuck it inside; the radius matches the button.

   The effective global rule is THIS file's copy at line ~127, not the theme
   package's (theme.css:86-88). Identical specificity, and login.ejs loads
   /css/style.css AFTER /theme/theme.css, so ours wins the cascade everywhere. If you
   are changing the global offset, change it here — editing the package has no
   effect while that duplicate exists. (The duplicate itself is worth collapsing now
   that the theme package owns the a11y defaults; see ROADMAP.) */
.login-theme button:focus-visible{ outline-offset:-1px; border-radius:7px; }
@media (max-width: 860px){ .login-split{ grid-template-columns:1fr; } .login-art{ display:none; } }

/* ── Customer detail header + ministats (Phase 5) ───────────────────────────*/
.chead{ display:flex; align-items:center; gap:16px; margin-bottom:18px; }
.chead-logo{ width:54px; height:54px; border-radius:14px; flex:0 0 54px; display:grid; place-items:center; font-size:24px; color:#fff; background:linear-gradient(140deg, var(--brand), var(--brand-deep)); }
.chead-main{ flex:1; min-width:0; }
.chead-name{ font-size:22px; font-weight:700; letter-spacing:-.02em; margin:0; }
.chead-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:9px; margin-top:6px; }
.chead-phone{ font-size:12.5px; color:var(--text-faint); display:inline-flex; align-items:center; gap:5px; }
.chead-actions{ display:flex; gap:8px; align-items:center; }
.tagpill{ font-size:11.5px; font-weight:600; padding:3px 10px; border-radius:20px; background:var(--surface-2); border:1px solid var(--line); color:var(--text-soft); display:inline-flex; align-items:center; gap:5px; }
.tagpill.ok{ color:#0E9E6E; background:color-mix(in srgb, #0E9E6E 13%, var(--surface)); border-color:transparent; }
.ministats{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.mini{ background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:14px 16px; box-shadow:var(--shadow); }
.mini-n{ font-family:var(--font-mono); font-size:26px; font-weight:600; letter-spacing:-.02em; color:var(--text); }
.mini-l{ font-size:12px; color:var(--text-soft); margin-top:2px; }
@media (max-width: 992px){ .ministats{ grid-template-columns:repeat(2,1fr); } }

/* ── Ticket conversation (token-driven so dark mode adapts) ─────────────────*/
.msg { border: 1px solid var(--line); border-radius: .5rem; padding: .85rem 1.1rem; margin-bottom: 1rem; background: var(--surface); }
.msg-staff { border-left: 3px solid var(--brand); }
.msg-customer { border-left: 3px solid #94a3b8; }
/* author_type = 'system' — a machine-raised message (a monitoring alert). The value was in the
   schema's vocabulary from the start but nothing produced it until integrations arrived, so it had
   no accent at all and read as an unstyled block in both threads. Distinct from staff and customer
   because "who claimed this" is the thing an agent needs to judge it. */
.msg-system { border-left: 3px solid #7c3aed; }
.msg-note { background: color-mix(in srgb, var(--signal) 9%, var(--surface)); border-left: 3px solid #d97706; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg { scroll-margin-top: 1rem; }
/* Briefly highlight a message jumped to from the attachments list */
.msg.msg-flash { animation: msgFlash 1.6s ease-out; }
@keyframes msgFlash { 0% { box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.5); } 100% { box-shadow: 0 0 0 3px rgba(var(--brand-rgb),0); } }
.att-list-row { cursor: pointer; }
.att-list-row .att-thumb { width: 40px; height: 40px; flex: 0 0 40px; }

/* ── Dashboard (Phase 2) ────────────────────────────────────────────────────*/
.dash-eyebrow{ font-family:var(--font-mono); font-size:11px; letter-spacing:.13em; text-transform:uppercase; color:var(--text-faint); margin:2px 0 13px; }
.metrics{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.metric{ position:relative; overflow:hidden; display:block; text-decoration:none; color:inherit;
  background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:18px; box-shadow:var(--shadow);
  transition:border-color .14s, transform .08s, box-shadow .14s; }
.metric:hover{ transform:translateY(-1px); box-shadow:0 6px 20px -10px rgba(0,0,0,.18); }
.metric::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--ac); }
.metric .m-lab{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text-soft); font-weight:600; }
.metric .m-lab i{ color:var(--ac); font-size:15px; }
.metric .m-num{ font-family:var(--font-mono); font-weight:600; font-size:34px; letter-spacing:-.03em; line-height:1; margin:12px 0 4px; color:var(--text); }
.metric .m-sub{ font-size:12px; color:var(--text-faint); }

.dash-cols{ display:grid; grid-template-columns:1.5fr 1fr; gap:16px; align-items:start; }
.dash-stack{ display:flex; flex-direction:column; gap:16px; }
.dash-card{ background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); }
.dash-card .dc-hd{ display:flex; align-items:center; justify-content:space-between; padding:14px 18px; border-bottom:1px solid var(--line); }
.dash-card .dc-hd h2{ font-size:14.5px; font-weight:700; margin:0; letter-spacing:-.01em; }
.dash-card .dc-hd a{ font-size:12.5px; font-weight:600; text-decoration:none; color:var(--brand); }
.dash-card .dc-bd{ padding:6px 18px 10px; }

.feed{ list-style:none; margin:0; padding:0; }
.feed li{ display:flex; gap:13px; padding:12px 0; border-bottom:1px solid var(--line); align-items:flex-start; }
.feed li:last-child{ border-bottom:0; }
.feed .fic{ width:30px; height:30px; flex:0 0 30px; border-radius:8px; display:grid; place-items:center; font-size:14px; margin-top:1px;
  background:color-mix(in srgb, var(--ic) 15%, var(--surface)); color:var(--ic); }
.feed .ftx{ flex:1; min-width:0; font-size:13.5px; }
.feed .ftx a{ font-weight:600; text-decoration:none; color:var(--brand); }
.feed .fago{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); white-space:nowrap; margin-top:3px; }

.att{ display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); text-decoration:none; color:inherit; }
.att:last-child{ border-bottom:0; }
.att:hover .att-t b{ color:var(--brand); }
.att .att-bar{ width:3px; align-self:stretch; min-height:32px; border-radius:3px; background:var(--c); flex:0 0 3px; }
.att .att-t{ flex:1; min-width:0; }
.att .att-t b{ display:block; font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.att .att-t span{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); }
.att .att-age{ font-family:var(--font-mono); font-size:11px; color:var(--text-soft); white-space:nowrap; }

.prio-row{ display:flex; align-items:center; justify-content:space-between; padding:9px 0; border-bottom:1px solid var(--line); text-decoration:none; }
.prio-row:last-child{ border-bottom:0; }
.prio-row .pr-name{ display:flex; align-items:center; gap:9px; font-size:13px; font-weight:600; color:var(--text); text-transform:capitalize; }
.prio-row .pr-dot{ width:9px; height:9px; border-radius:50%; background:var(--c); flex:0 0 9px; }
.prio-row .pr-c{ font-family:var(--font-mono); font-weight:600; font-size:14px; color:var(--text); }

@media (max-width: 992px){ .metrics{ grid-template-columns:repeat(2,1fr); } .dash-cols{ grid-template-columns:1fr; } }

/* ── Ticket queue (Phase 3) ─────────────────────────────────────────────────*/
.tix-bar{ display:flex; align-items:center; gap:14px; margin-bottom:14px; flex-wrap:wrap; }
.tix-bar-right{ margin-left:auto; display:flex; align-items:center; gap:14px; }
.tix-total{ font-family:var(--font-mono); font-size:12.5px; color:var(--text-faint); }
.seg{ display:inline-flex; background:var(--surface); border:1px solid var(--line); border-radius:11px; padding:4px; flex-wrap:wrap; gap:2px; }
.seg a{ border-radius:8px; padding:7px 14px; font-size:13px; font-weight:600; color:var(--text-soft); text-decoration:none; }
.seg a:hover{ color:var(--text); }
.seg a.on{ background:var(--brand); color:#fff; }

.tix-card{ background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
.tix-table{ width:100%; border-collapse:collapse; }
.tix-table thead th{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--text-faint); text-align:left; font-weight:500; padding:11px 14px; border-bottom:1px solid var(--line); background:var(--surface-2); }
.tix-table tbody tr{ border-bottom:1px solid var(--line); transition:background .12s; }
.tix-table tbody tr:last-child{ border-bottom:0; }
.tix-table tbody tr:hover{ background:var(--surface-2); }
.tix-table tbody td{ padding:12px 14px; vertical-align:middle; position:relative; }
.tix-table tbody td:first-child{ padding-left:18px; }
.tix-table tbody td:first-child::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--c, transparent); }
.tix-pr{ display:flex; align-items:center; gap:8px; }
.tix-pr .d{ width:8px; height:8px; border-radius:50%; background:var(--c); flex:0 0 8px; }
.tix-pr .l{ font-size:12px; font-weight:600; color:var(--text-soft); text-transform:capitalize; }
.tix-subj{ font-weight:600; font-size:13.8px; }
.tix-subj a{ color:var(--text); text-decoration:none; }
.tix-subj a:hover{ color:var(--brand); }
.tix-meta{ font-size:12px; color:var(--text-faint); margin-top:2px; }
.tix-meta .tid{ color:var(--brand); text-decoration:none; }
.tix-cust{ font-size:13px; }
.tix-cust .site{ font-size:12px; color:var(--text-faint); }
.who-chip{ display:flex; align-items:center; gap:8px; font-size:13px; }
.who-chip .av{ width:25px; height:25px; border-radius:6px; flex:0 0 25px; display:grid; place-items:center; font-weight:700; font-size:10.5px; color:#fff; background:var(--av, var(--brand)); }
.who-chip.un{ color:var(--text-faint); }
.who-chip.un .av{ background:var(--surface-2); color:var(--text-faint); box-shadow:inset 0 0 0 1px var(--line); font-weight:600; }
.tix-when{ font-family:var(--font-mono); font-size:11.5px; color:var(--text-faint); }

/* Status pill (shared) — colour comes from --pc (statusColor()). */
.pill{ display:inline-flex; align-items:center; gap:6px; font-size:11.5px; font-weight:600; padding:3px 10px; border-radius:20px;
  color:var(--pc, #6b7280); background:color-mix(in srgb, var(--pc, #6b7280) 14%, var(--surface)); white-space:nowrap; }
.pill::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }

/* ── Public tracking-id chip ────────────────────────────────────────────────*/
.tracking-id {
  font-size: 1.4rem; font-weight: 700; letter-spacing: .05em;
  display: inline-block; padding: .5rem 1rem; border: 1px dashed var(--line); border-radius: .5rem;
}

/* KB deflection suggestions */
.kb-suggest { margin-top: .5rem; }

/* ── Attachment tiles + preview ─────────────────────────────────────────────*/
.att-tile { max-width: 260px; background: var(--surface); cursor: pointer; }
.att-tile:hover { background: var(--surface-2); }
.att-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.att-thumb { width: 48px; height: 48px; flex: 0 0 48px; overflow: hidden; border-radius: .25rem; background: var(--surface-2); border: 1px solid var(--line); }
.att-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb-icon { font-size: 1.4rem; color: #6c757d; }
.att-meta { min-width: 0; }
.att-tile .att-name { max-width: 150px; font-size: .85rem; }
.att-tile .att-size { font-size: .72rem; }
#attPreviewBody img { max-height: 70vh; }

/* ── Directory lists: customers + contacts ──────────────────────────────────
   Both tables previously spent columns on facts that barely varied — Contacts
   read 3 and Tickets read 5 on almost every customer row; Active read ✓ on all
   of them — while the company name was repeated on all 34 contact rows with its
   legal name in brackets, wrapping to two lines and taking the phone with it.

   What varies is open work, so that is the only thing that gets colour. --signal
   means one thing across these pages: this needs someone. */
.load{ display:inline-flex; align-items:baseline; gap:5px; font-family:var(--font-mono); }
.load b{ font-size:14px; font-weight:600; color:var(--signal); }
.load span{ font-size:11px; color:var(--text-faint); }
.load-none b{ color:var(--text-faint); font-weight:500; }   /* nothing to do reads calm */
.mono-sm{ font-family:var(--font-mono); font-size:12.5px; }

/* Legal name / exact timestamp: present but demoted under the thing you scan for. */
.cust-legal{ display:block; font-size:11.5px; color:var(--text-faint); font-family:var(--font-mono); }
/* Inactive is the exception, so it dims the row rather than spending a column on ✓. */
tr.row-off td{ opacity:.55; }
.star{ color:var(--signal); font-size:12px; }

/* Contacts, grouped by customer. The header carries the counts the removed column
   used to imply. */
.contact-table .grp-row td{
  background:var(--surface-2); border-bottom:1px solid var(--line-strong);
  padding-top:7px; padding-bottom:7px;
}
.contact-table .grp-row:hover td{ background:var(--surface-2); }   /* not a clickable row */
.grp-name{ font-weight:700; font-size:12.5px; color:var(--text); text-decoration:none; }
.grp-name:hover{ color:var(--brand); }
.grp-meta{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); margin-left:8px; }
/* Secondary counts: present for the unusual customer, never competing with Open. */
.col-quiet{ color:var(--text-faint); font-weight:400; }
th.col-quiet{ font-weight:600; }

/* ── Customer detail: one strip instead of four cards beside a dead rail ─────
   The col-lg-4 rail held four rows and then ~1,200px of empty column next to a
   right side that ran the full page. Phone and Team went into the header chips;
   "8 open · 9 total" duplicated the stat cards above it; "2 Sites" and "3
   Contacts" restated the section headings below. What is left fits on one line. */
.cstrip{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px 22px;
  background:var(--surface); border:1px solid var(--line); border-radius:10px;
  padding:10px 16px; margin-bottom:18px;
}
.cstrip-facts{ display:flex; gap:18px; flex:0 0 auto; }
.cstrip-fig{ font-size:12px; color:var(--text-faint); text-transform:uppercase; letter-spacing:.07em; }
.cstrip-fig b{ font-family:var(--font-mono); font-size:17px; font-weight:600; color:var(--text);
  margin-right:5px; text-transform:none; letter-spacing:0; }
.cstrip-fig.hot b{ color:var(--signal); }          /* open work, the one coloured figure */
.cstrip-text{ display:flex; flex-wrap:wrap; gap:6px 20px; font-size:13px; color:var(--text-soft); min-width:0; }
.cstrip-text i{ color:var(--text-faint); margin-right:5px; }
.cstrip-notes{ font-style:italic; }
.tagpill.warn{ border-color:var(--signal); color:var(--signal); }
.tagpill.sm{ font-size:10.5px; padding:1px 7px; }

/* Contacts, read view. A list of people, not a grid of inputs. */
.clist{ list-style:none; margin:0; padding:0; }
.clist-row{
  display:grid; grid-template-columns:minmax(150px,1.1fr) minmax(180px,1.6fr) 130px 1fr;
  gap:12px; align-items:center; padding:7px 0; border-bottom:1px solid var(--line); font-size:13.5px;
}
.clist-row:last-child{ border-bottom:0; }
.clist-name a{ font-weight:600; text-decoration:none; }
.clist-phone{ color:var(--text-faint); }
.clist-tags{ display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; }
@media (max-width: 767.98px){
  .clist-row{ grid-template-columns:1fr; gap:2px; padding:10px 0; }
  .clist-tags{ justify-content:flex-start; }
}
/* The contacts editor's column track. Nine cells: the four text fields, three flags,
   Save and the delete button — declared once so the header and every row line up.

   The last two are FIXED rather than auto. With auto they size to their content, and the
   header's trailing cells are empty while the rows' hold a button and an × — so the two
   grids resolved different leftovers for their 1fr tracks and the header drifted out of
   step with the fields, by 16px at Surname and 73px by Active. */
.clist-editor .adm-head, .clist-editor .adm-row{
  grid-template-columns:
    minmax(76px,1fr) minmax(76px,1fr) minmax(140px,1.7fr) minmax(90px,1fr)
    56px 92px 66px 62px 38px;   /* Save + delete: FIXED, not auto */
}
.clist-editor .adm-flag{ justify-content:center; }
/* The shared .adm-editor sets min-width:max-content, which suits the admin editors' few
   wide fields but pushes this nine-column row past the container and clips Save — the
   primary action — behind a horizontal scrollbar. Nine columns that fit beat nine columns
   you have to scroll to reach. */
.clist-editor{ min-width:0; }
.clist-editor .form-control, .clist-editor .form-select{ min-width:0; }
/* A prose field inside the admin grid: its own full-width line, not an extra column.
   .adm-form is display:contents, so a cell spanning every column flows to the next row. */
.adm-wide{ grid-column: 1 / -1; margin-top:6px; }

/* The restore panel's <summary> rules — marker suppression and the disclosure caret — live in
   @aria-framework/backup's assets/backup-ui.css, served at /js/backup/backup-ui.css and linked
   by views/admin/backup.ejs. They were once copied here verbatim, so a change to the package's
   version would not have reached this app and nothing would have failed to say so.

   The copy is gone. Its opening comment was left unterminated when it went — a second comment
   opened before the first had closed — which CSS resolves by treating the whole span as one
   comment. Harmless only because nothing followed it: the next rule appended to this file
   would have disappeared into it without a word. */

/* ── One button size ────────────────────────────────────────────────────────
   Every .btn in Support101 renders at the compact size. Bootstrap 5.3 drives
   button metrics through custom properties, so redefining the four .btn sets
   here reaches all 89 full-size buttons at once — 69 <button>, 18 <a> styled as
   buttons, 2 <input> — without touching a single view.

   WHY: on the ticket composer, `Send reply` (37px/16px) sat on the SAME ROW as
   Fix / Tidy / Rephrase / Tone / Discard draft (30px/14px). Both were correctly
   centred; the size alone was the mismatch. Editing only the 37 submit buttons
   would NOT have fixed it — the 18 anchor-buttons would have stayed tall right
   beside them. The inconsistency was never "the submits drifted", it was that
   two size vocabularies met on one row.

   WHY HERE AND NOT IN @aria-framework/theme, which this file's header says owns
   button styling: the package is shared, and Acc101 consumes it. Button density
   is a Support101 decision, not a design-system one — pushing it upstream would
   silently resize another app's forms to settle an argument about this app's
   ticket page. The boundary is about SHARED brand, and this is not shared.

   SAFE BECAUSE btn-lg APPEARS ZERO TIMES. .btn and .btn-sm carry equal
   specificity, and style.css loads after bootstrap, so this rule also wins on
   elements that carry BOTH — normally a way to silently flatten a size variant.
   It is harmless only because the values below are byte-identical to .btn-sm's
   and there is no larger variant left to destroy. Higher-specificity group
   rules (.btn-group-sm>.btn, .input-group-sm>.btn, both 0,2,0) still win, and
   set the same values.

   CONSEQUENCE: the ~12 `btn-sm` classes left in the views are now no-ops. They
   are harmless and were not chased out of 12 files for zero visual change, but
   they no longer distinguish anything — and adding `btn-sm` to something new
   will do nothing at all. If a LARGER button is ever wanted, it needs its own
   class; the absence of `btn-sm` will not produce one. */
.btn{
  --bs-btn-padding-y:.25rem;
  --bs-btn-padding-x:.5rem;
  --bs-btn-font-size:.875rem;
  --bs-btn-border-radius:var(--bs-border-radius-sm);
}

/* ── Inference panels (admin/ai) ───────────────────────────────────────────────────────────────
   The fold marker. A rotation rather than two glyphs, so the control reads as one thing changing
   state instead of two icons swapping — and it is skipped entirely for anyone who has asked their
   system for less motion. */
.panel-chev {
  display: inline-block;
  transition: transform .18s ease;
  font-size: 1.1rem;
  line-height: 1.2;
}
.panel-open > * > [data-panel-toggle] .panel-chev,
[data-panel-toggle][aria-expanded="true"] .panel-chev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .panel-chev { transition: none; } }

/* Progress bars carry the BRAND, not Bootstrap's blue.
   `--bs-primary` is already mapped to `--brand` by the theme, but Bootstrap 5.3 does not build
   `.progress-bar` from it: the component sets its own `--bs-progress-bar-bg` to a literal #0d6efd.
   So a teal page rendered cobalt bars, and only next to a teal button was it obvious. */
.progress { --bs-progress-bar-bg: var(--brand); }
