/* ==========================================================================
   TicketHappy design system
   Blue and white, with a dark theme and a few more (Themes, at the end). One
   set of tokens, several palettes: every color is a variable so a theme is a
   token swap, not a second stylesheet. No external fonts or CDNs -- the CSP
   forbids them.
   ========================================================================== */

:root {
  /* brand */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* surfaces */
  --bg:            #f6f8fc;
  --surface:       #ffffff;
  --surface-2:     #f9fbfe;
  --surface-hover: var(--blue-50);
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  /* Text boxes and selects: at least 3:1 against the card (WCAG 1.4.11),
     which the softer --border-strong isn't. Each theme sets its own. */
  --border-input:  #8593a8;

  /* text */
  --text:          #0f172a;
  --text-muted:    #5b6b84;
  --text-inverse:  #ffffff;
  --link:          var(--blue-700);

  /* feedback */
  --ok:     #15803d;  --ok-bg:     #dcfce7;
  --warn:   #b45309;  --warn-bg:   #fef3c7;
  --danger: #b91c1c;  --danger-bg: #fee2e2;
  --info:   var(--blue-700); --info-bg: var(--blue-100);
  --accent: #6d28d9;  --accent-bg: #ede9fe;
  --muted-bg: #eef2f7;
  /* chart series, validated for colorblind separation on --surface */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  /* slots 3–6 (the dataviz reference order; validated on #fff): Build a report's stacked bars and donut */
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  /* text on a --blue-600 fill (primary buttons, the current page) */
  --on-primary: #ffffff;

  /* shape + motion */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow:    0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --ring: 0 0 0 3px var(--blue-200);
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Dark theme: follow the device unless a theme has been chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg:            #0b1220;
    --surface:       #131c2e;
    --surface-2:     #18233a;
    --surface-hover: #1c2942;
    --border:        #26334d;
    --border-strong: #35456b;
    --border-input:  #5d71a3;
    --text:          #e8eefb;
    --text-muted:    #9bacc9;
    --link:          var(--blue-300);
    --ok:     #4ade80;  --ok-bg:     #10331f;
    --warn:   #fbbf24;  --warn-bg:   #3a2c09;
    --danger: #f87171;  --danger-bg: #3d1616;
    --info:   var(--blue-300); --info-bg: #17284a;
    --accent: #c4b5fd;  --accent-bg: #2a2150;
    --muted-bg: #1b2539;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 4px 16px rgba(0, 0, 0, .45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(59, 130, 246, .45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #0b1220;
  --surface:       #131c2e;
  --surface-2:     #18233a;
  --surface-hover: #1c2942;
  --border:        #26334d;
  --border-strong: #35456b;
  --border-input:  #5d71a3;
  --text:          #e8eefb;
  --text-muted:    #9bacc9;
  --link:          var(--blue-300);
  --ok:     #4ade80;  --ok-bg:     #10331f;
  --warn:   #fbbf24;  --warn-bg:   #3a2c09;
  --danger: #f87171;  --danger-bg: #3d1616;
  --info:   var(--blue-300); --info-bg: #17284a;
  --accent: #c4b5fd;  --accent-bg: #2a2150;
  --muted-bg: #1b2539;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(59, 130, 246, .45);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .75rem; }

a { color: var(--link); text-decoration: none; }
/* In running text a link's colour alone is under 3:1 against the words around it (WCAG 1.4.1,
   axe link-in-text-block on the guide), so public prose underlines its links; buttons keep their own look. */
main.public :is(p, li, td, dd, figcaption) a:not(.btn) { text-decoration: underline; text-underline-offset: .15em; }
a:hover { text-decoration: underline; }
/* A link inside running text is underlined, not told apart by colour alone
   (WCAG 1.4.1): a sentence on Reports, a hint, a notice, the Guide's steps.
   Standalone links (buttons, badges, ticket titles in lists, navigation)
   keep their own look. */
:where(p, dd, .notice, .hint, .page-sub, .message-body, .guide-section li) a:not(.btn):not(.badge):not(.row-link):not(.chip) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}

code, kbd, pre { font-family: var(--mono); font-size: .875em; }
pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem; overflow-x: auto;
}

:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

/* The hidden attribute wins over any display a class sets. */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* "Skip to content": the first Tab stop on every page, visible only while it
   has focus, so a keyboard user isn't walked through the whole menu first. */
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .5rem .9rem; border-radius: var(--radius-sm);
  background: var(--blue-600); color: var(--on-primary); font-weight: 600;
  transition: top .1s ease;
}
.skip-link:focus { top: .6rem; text-decoration: none; outline-color: var(--text); }
main:focus { outline: none; }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  height: 58px; padding: 0 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand-sub { font-weight: 400; }
.brand-mark {
  /* The SVG supplies its own rounded blue tile, so no background or radius
     here -- styling one on would frame the artwork twice. */
  display: block; width: 30px; height: 30px; object-fit: contain;
  flex: 0 0 auto;
}

.topbar-spacer { flex: 1; }

/* The account menu: the name in the top right opens profile, theme and
   sign-out (app.js toggles .is-open). On phones the name hides, leaving the icon. */
.account-toggle { gap: .4rem; max-width: 16rem; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-caret { flex: none; opacity: .7; }
.topbar-menu {
  display: none; position: absolute; top: calc(100% + .35rem); right: 1rem;
  flex-direction: column; align-items: stretch; gap: 2px;
  width: 16rem; max-width: calc(100vw - 1.5rem); padding: .35rem;
  max-height: calc(100vh - 5rem); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.topbar-menu.is-open { display: flex; }
.help-toggle { padding-inline: .5rem; }
.help-menu { width: 13rem; }
/* The setup guide card leads Settings, and stands out a little. */
.settings-lead { border-color: var(--blue-200, var(--border)); }
.settings-lead .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
/* Settings is one column of sections, each closed until its heading is clicked
   (pages/org_settings.html). The heading row is the <summary>; a chevron turns
   when it's open, and the row loses its rule while there's nothing under it. */
.settings-stack { max-width: 56rem; }
.settings-section > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.settings-section > summary::-webkit-details-marker { display: none; }
.settings-section > summary::after {
  content: ""; margin-left: auto; width: .55rem; height: .55rem; flex: none;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
.settings-section[open] > summary { border-bottom: 1px solid var(--border); }
.settings-section[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.settings-section > summary:hover { background: var(--surface-hover); }
.settings-section > summary:hover, .settings-section > summary:focus-visible { border-radius: var(--radius); }
.settings-section[open] > summary:hover, .settings-section[open] > summary:focus-visible {
  border-radius: var(--radius) var(--radius) 0 0;
}
@media (prefers-reduced-motion: reduce) { .settings-section > summary::after { transition: none; } }
.topbar-menu .btn { width: 100%; justify-content: flex-start; font-size: .875rem; padding: .5rem .7rem; }
.topbar-menu form { margin: 0; }
.menu-head {
  display: flex; flex-direction: column; padding: .45rem .7rem .55rem;
  border-bottom: 1px solid var(--border); margin-bottom: .2rem; min-width: 0;
}
.menu-head span { font-size: .8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
/* The bell panel's "Notifications" is a real heading (an h2), sized as the
   menu's bold title rather than a page heading. It's only in the page's
   outline while the panel is open (a closed panel is display: none). */
.menu-head .menu-title { margin: 0; font-size: .9rem; font-weight: 700; line-height: 1.3; letter-spacing: 0; }
/* The dashboard's Customize mode (static/js/dashboard_edit.js): each card
   gets a bar with its Show switch and Move up / Move down; hidden cards stay
   listed but dimmed (and say so), so they can be switched back on. */
/* Customize sits in the page head as a quiet icon button; while editing, the
   bar below the head shows Done, Cancel and Reset. */
.dashboard-edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.dashboard-edit-bar:not(.is-editing) { display: none; }
.btn-icon-text { display: inline-flex; align-items: center; gap: .35rem; }
.dashboard-edit-bar .hint { margin: 0; }
.dashboard-editing [data-dashboard-card] {
  outline: 2px dashed var(--border-strong); outline-offset: 3px; border-radius: var(--radius);
}
/* The compact dashboard (Stretch's design, 12 Oct; Brad: "build it").
   Count tiles in one dense row: label over a 1.4rem value, the note as one
   line that collapses when empty, no reserved lines. A row is as tall as its
   tallest tile (one note line at most), so tiles stay even; the panel grid
   lets each card take its own height. Lists stop at five rows with a
   "See all" foot, so no card needs a height cap or an internal scroll. */
#dashboard .dash-tiles {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}
/* Rows that come out even once tiles wrap: 5-6 as 3+3, 7-8 as 4+4, 9 as 5+4. */
@media (max-width: 1180px) {
  #dashboard .dash-tiles:has(> [data-dashboard-card]:nth-child(5):not([hidden])):not(:has(> [data-dashboard-card]:nth-child(7):not([hidden]))) {
    grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #dashboard .dash-tiles:has(> [data-dashboard-card]:nth-child(7):not([hidden])):not(:has(> [data-dashboard-card]:nth-child(9):not([hidden]))) {
    grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #dashboard .dash-tiles:has(> [data-dashboard-card]:nth-child(9):not([hidden])) {
    grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
#dashboard .dash-tiles > [data-dashboard-card] { display: flex; flex-direction: column; min-width: 0; }
#dashboard .dash-tiles > [data-dashboard-card][hidden] { display: none; }
.tile {
  flex: 1; display: flex; flex-direction: column; gap: .1rem; min-width: 0;
  padding: .55rem .8rem .5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--text);
}
a.tile:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.tile-row { display: flex; flex-direction: column; gap: .05rem; min-width: 0; }
.tile-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.tile-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; line-height: 1.2;
  color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.tile-note { font-size: .72rem; line-height: 1.25; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-note:empty { display: none; }
.tile.is-warn .tile-value { color: var(--warn); }
.tile.is-danger .tile-value { color: var(--danger); }
.tile.is-muted .tile-value { color: var(--text-muted); }   /* a chosen tile at zero */

.dash-alerts { display: grid; gap: .6rem; margin-top: .9rem; }
.dash-alerts .notice { margin: 0; }
/* Outside Customize, the strip and each line show only with something to say
   (a spike line is fetched, so "something" is a rendered .notice). */
#dashboard:not(.dashboard-editing) .dash-alerts:not(:has(.notice)),
#dashboard:not(.dashboard-editing) .dash-alerts > [data-dashboard-card]:not(:has(.notice)) { display: none; }

.dash-panels {
  display: grid; gap: .9rem; margin-top: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;                        /* each card its own height */
}
.dash-panel { min-width: 0; }
.dash-panel[hidden] { display: none; }
.dash-panel > .card { margin: 0; }
.dash-panel.is-wide { grid-column: span 2; }
@media (max-width: 1100px) { .dash-panel.is-wide { grid-column: auto; } }
.dash-panel .card-head { padding: .6rem .9rem; }
.dash-panel .card-head h2, .dash-panel .card-head h3 { font-size: .92rem; }
.dash-foot { display: flex; justify-content: space-between; align-items: center;
  padding: .45rem .9rem; border-top: 1px solid var(--border); font-size: .8rem; }
.dash-foot a { font-weight: 600; }
.dash-empty { margin: 0; padding: .6rem .9rem .7rem; }
.dash-panel .card-head .hint { margin: 0; }

/* The compact ticket row, two lines: title and key, then status, due, who. */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { padding: .38rem .9rem; line-height: 1.3; border-bottom: 1px solid var(--border); }
.row-list li:last-child { border-bottom: 0; }
.row-list li:hover { background: var(--surface-hover); }
.row-top { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.row-top .row-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.row-top .ticket-key { font-size: .75rem; color: var(--text-muted); }
.row-meta { display: flex; align-items: center; gap: .45rem; margin-top: .1rem; font-size: .76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.row-meta .badge { font-size: .68rem; padding: .05rem .4rem; }
.row-meta .due-danger { color: var(--danger); font-weight: 600; }
.row-meta .due-warn { color: var(--warn); font-weight: 600; }
/* Priority: colour, and a shape so it isn't colour alone (Stretch): urgent a
   filled dot with a ring, high and normal filled, low hollow. Each carries a
   visually-hidden "<Priority> priority" for screen readers. */
.pri { width: .5rem; height: .5rem; border-radius: 50%; flex: none; display: inline-block; position: relative; top: -.05rem; }
.pri-urgent { background: var(--danger); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--danger); margin-right: .15rem; }
.pri-high { background: var(--warn); }
.pri-normal { background: var(--blue-500); }
.pri-low { background: transparent; border: 2px solid var(--border-strong); }

/* The small list cards (Common issues, E-mail intake, the devices and
   requesters cards): one line per row, the figure right-aligned. */
.mini-list { list-style: none; margin: 0; padding: .2rem 0; }
.mini-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .32rem .9rem; font-size: .85rem; min-width: 0; }
.mini-list li + li { border-top: 1px solid var(--border); }
.mini-list li > :first-child { flex: 0 1 auto; min-width: 0; }
.mini-list .num { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
/* An address wraps only at "@" and "+" (break_email) and never squeezes the
   department's name beside it. */
.mini-list li > span:first-child { flex: none; white-space: nowrap; }
/* My week: seven days of two bars, scaled to the week's busiest day in ten
   steps (a height class from widthratio, so no inline style). */
.week-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; padding: .7rem .9rem .3rem; align-items: end; }
.week-bars { display: flex; gap: 3px; align-items: flex-end; height: 56px; }
.week-bar { flex: 1; display: block; min-height: 2px; border-radius: 3px 3px 0 0; }
.week-bar.opened { background: var(--blue-500); }
.week-bar.resolved { background: var(--ok); }
a.week-bar:hover, a.week-bar:focus-visible { filter: brightness(1.15); }
.week-bar.h-0 { height: 2px; opacity: .35; }
.week-bar.h-1 { height: 10%; } .week-bar.h-2 { height: 20%; } .week-bar.h-3 { height: 30%; }
.week-bar.h-4 { height: 40%; } .week-bar.h-5 { height: 50%; } .week-bar.h-6 { height: 60%; }
.week-bar.h-7 { height: 70%; } .week-bar.h-8 { height: 80%; } .week-bar.h-9 { height: 90%; }
.week-bar.h-10 { height: 100%; }
.week-label { display: block; text-align: center; font-size: .7rem; color: var(--text-muted); margin-top: .25rem; }
.week-key { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; vertical-align: -1px; }
.week-key.opened { background: var(--blue-500); } .week-key.resolved { background: var(--ok); }
.mini-list code { flex: 0 1 auto; max-width: 72%; font-size: .78rem; text-align: right; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  #dashboard .dash-tiles, #dashboard .dash-tiles[class] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: .45rem; }
  #dashboard .dash-tiles > [data-dashboard-card]:not([hidden]):last-of-type:nth-of-type(odd),
  #dashboard .dash-tiles > [data-dashboard-card]:not([hidden]):nth-of-type(odd):has(+ [hidden]) { grid-column: 1 / -1; }
  .tile { padding: .45rem .6rem .4rem; }
  .tile-value { font-size: 1.25rem; }
  /* Label and number only on a phone; the note stays for screen readers. */
  .tile-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dash-panels { grid-template-columns: minmax(0, 1fr); }
}

.card-edit {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem;
  padding: .4rem .5rem; margin-bottom: .5rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.card-edit .card-edit-show { margin: 0 auto 0 0; font-size: .85rem; font-weight: 600; }
.card-edit .btn:disabled { opacity: .45; }
/* An alert that's on but has nothing to say right now (data-empty) takes no
   space on the dashboard; in Customize it shows its controls and says so. */
.dashboard-editing [data-dashboard-alerts] > [data-empty] { display: block; }
.dashboard-editing [data-empty]:not(.is-off) .card-edit-show span::after {
  content: " (nothing right now)"; font-weight: 400; color: var(--text-muted);
}
.dashboard-editing [data-dashboard-card].is-off > :not(.card-edit) { opacity: .4; }
.dashboard-editing [data-dashboard-card].is-off .card-edit-show span::after {
  content: " (hidden)"; font-weight: 400; color: var(--text-muted);
}
/* The notification bell (partials/notification_menu.html, notify.js): the
   unread count sits on the bell's corner in the same blue pill as the
   sidebar's counts (contrast checked in every theme); the panel is the
   account menu's, wider, and anchored to the same corner. */
.bell-toggle { position: relative; padding: .35rem .5rem; }
.bell-toggle[aria-expanded="true"] { background: var(--surface-hover); }
.bell-badge {
  position: absolute; top: -.2rem; right: -.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--blue-600); color: var(--on-primary);
  font-size: .68rem; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);   /* a gap between the pill and the bell */
}
.bell-badge[hidden] { display: none; }
.notification-menu { width: 22rem; }
.notification-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.notification-item {
  display: flex; flex-direction: column; gap: .15rem; position: relative;
  padding: .55rem .7rem .55rem 1.5rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
}
.notification-item:hover, .notification-item:focus-visible { background: var(--surface-hover); text-decoration: none; }
.notification-title { font-size: .875rem; line-height: 1.35; }
.notification-meta { font-size: .76rem; color: var(--text-muted); }
/* Unread: a dot and a heavier title, not colour alone (and "Unread: " for
   screen readers, in the markup). */
.notification-item.is-unread .notification-title { font-weight: 650; }
.notification-item.is-unread::before {
  content: ""; position: absolute; left: .65rem; top: .95rem;
  width: .45rem; height: .45rem; border-radius: 50%; background: var(--blue-600);
}
.notification-actions { border-top: 1px solid var(--border); margin-top: .2rem; padding-top: .2rem; }
.notification-empty { margin: 0; padding: .6rem .7rem .7rem; }
.menu-label {
  padding: .55rem .7rem .2rem; border-top: 1px solid var(--border); margin-top: .2rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted);
}
.theme-choices { display: flex; flex-direction: column; gap: 1px; padding-bottom: .2rem;
  border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
.theme-choice { gap: .6rem; }
/* On the profile page: tiles in a grid rather than the old menu's list. */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .5rem;
  padding: 0; border-bottom: 0; margin-bottom: 0; }
.theme-grid .theme-choice { justify-content: flex-start; }
.theme-grid .theme-choice[aria-checked="true"] { border-color: var(--link); }
.theme-choice[aria-checked="true"] { background: var(--surface-hover); font-weight: 650; }
.theme-choice[aria-checked="true"]::after { content: "\2713"; margin-left: auto; color: var(--link); }
.theme-swatch {
  flex: none; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 1px solid var(--border-strong);
}
.theme-swatch[data-swatch="system"]   { background: linear-gradient(135deg, #ffffff 50%, #0b1220 50%); }
.theme-swatch[data-swatch="light"]    { background: linear-gradient(135deg, #ffffff 50%, #2563eb 50%); }
.theme-swatch[data-swatch="dark"]     { background: linear-gradient(135deg, #131c2e 50%, #93c5fd 50%); }
.theme-swatch[data-swatch="terminal"] { background: linear-gradient(135deg, #000000 50%, #33ff66 50%); }
.theme-swatch[data-swatch="mono"]     { background: linear-gradient(135deg, #000000 50%, #e8e8e8 50%); }
.theme-swatch[data-swatch="forest"]   { background: linear-gradient(135deg, #eef3ea 50%, #2f7a43 50%); }
.theme-swatch[data-swatch="glitter"]  {
  background: radial-gradient(circle at 30% 30%, #ffffff 0 12%, transparent 14%),
              radial-gradient(circle at 70% 65%, #fff4fb 0 9%, transparent 11%),
              linear-gradient(135deg, #ff8fc4, #e6338c 55%, #b072ff);
}

/* Sidebar icons, and collapsing to them. Icons are currentColor line drawings,
   so each theme colors them like the link text. Collapsed (data-sidebar on
   <html>, set by app.js) keeps the icons, hides the words for sight only, and
   shows a tooltip from the link's title. Phones keep the full strip. */
.nav-icon { flex: none; width: 18px; height: 18px; }
.nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-collapse {
  width: 100%; margin-bottom: .75rem; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 500; text-align: left; color: var(--text-muted);
}
.nav-collapse .nav-icon { transition: transform .15s ease; }
@media (min-width: 761px) {
  .sidebar { transition: width .15s ease, flex-basis .15s ease, padding .15s ease; }
  :root[data-sidebar="collapsed"] .sidebar {
    width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed);
    padding: 1rem .55rem; overflow-x: hidden;
  }
  :root[data-sidebar="collapsed"] .nav-text,
  :root[data-sidebar="collapsed"] .nav-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  :root[data-sidebar="collapsed"] .nav-link { justify-content: center; padding: .6rem; }
  :root[data-sidebar="collapsed"] .nav-group + .nav-group {
    padding-top: .75rem; border-top: 1px solid var(--border);
  }
  :root[data-sidebar="collapsed"] .nav-group { margin-bottom: .75rem; }
  :root[data-sidebar="collapsed"] .nav-collapse .nav-icon { transform: scaleX(-1); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-collapse .nav-icon { transition: none; }
}

.shell { flex: 1; display: flex; align-items: flex-start; }

.sidebar {
  position: sticky; top: 58px;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: calc(100vh - 58px); overflow-y: auto;
  padding: 1rem .75rem;
  background: var(--surface); border-right: 1px solid var(--border);
}

.nav-group { margin-bottom: 1.25rem; }
.nav-label {
  padding: 0 .6rem; margin-bottom: .35rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
}
.nav-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text); font-weight: 500;
}
.nav-link:hover { background: var(--surface-hover); text-decoration: none; }
.nav-link[aria-current="page"] {
  background: var(--blue-600); color: var(--on-primary); font-weight: 600;
}
.nav-link[aria-current="page"] .nav-count { background: rgba(255,255,255,.22); color: var(--on-primary); }
.nav-count {
  margin-left: auto; padding: 0 .4rem; border-radius: 999px;
  background: var(--muted-bg); color: var(--text-muted);
  font-size: .72rem; font-weight: 700;
}

.content { flex: 1; min-width: 0; padding: 1.5rem; max-width: 1280px; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  margin-bottom: 1.25rem;
}
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.page-sub { color: var(--text-muted); margin: .15rem 0 0; font-size: .9rem; }

/* --------------------------------------------------------------------------
   Cards, panels, grids
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }
/* A card drawn into an htmx wrapper (People → Work profiles) isn't a sibling of the cards
   around it, so .card + .card can't see it: the slot passes the gap on both sides, and an
   empty slot (no card yet, or none to show) leaves one gap, not none. */
.card + .card-slot > .card:first-child, .card-slot + .card { margin-top: 1rem; }
.card-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.1rem; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-head .spacer { flex: 1; }
.card-body { padding: 1.1rem; }
.card-body.tight { padding: .6rem; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.detail { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

.stat {
  padding: 1rem 1.1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
}
.stat-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-note { font-size: .8rem; color: var(--text-muted); }
.stat.is-warn .stat-value { color: var(--warn); }
.stat.is-danger .stat-value { color: var(--danger); }
.stat-value.is-compact { font-size: 1.15rem; }
/* A counter that opens the matching queue (partials/ticket_stats.html). */
.stat-link { display: block; color: var(--text); }
.stat-link:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.billing-summary { margin-bottom: 1rem; }
.hint.spaced { margin-top: .5rem; }

/* --------------------------------------------------------------------------
   Charts (server-drawn SVG; see reports/templatetags/charts.py)
   -------------------------------------------------------------------------- */
.filter-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.filter-row select { width: auto; }

/* Reports → Build a report (pages/report_build.html, Drew's engine; Stretch's design).
   The question is a sentence: its selects read as words, each as wide as its choice
   (not app.css's full-width select), the chosen word bold and underlined in the accent;
   on a phone the clauses wrap, one under another. "Narrow it" folds the filters. */
.report-sentence .sentence { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem;
  font-size: 1.05rem; line-height: 2.2; margin: 0 0 .25rem; }
.report-sentence select.as-word {
  width: auto; max-width: 100%; font: inherit; font-size: 1rem; font-weight: 600; color: var(--text);
  field-sizing: content;   /* only as wide as the chosen word (Musamil); width:auto is the fallback */
  padding: .2rem 1.6rem .2rem .55rem; background-color: var(--surface);
  border: 1px solid var(--border); border-bottom: 2px solid var(--accent); border-radius: var(--radius);
}
.report-sentence .sentence-dates { font-size: .9rem; line-height: 1.6; }
.report-sentence .sentence-dates input[type="date"] { width: auto; }
.report-sentence .narrow { margin-top: .75rem; }
.report-sentence .narrow > summary {
  cursor: pointer; font-size: .9rem; color: var(--info); list-style: none;
  display: inline-flex; gap: .4rem; align-items: center;
}
.report-sentence .narrow > summary::-webkit-details-marker { display: none; }
.report-sentence .narrow > summary::before { content: "▸"; font-size: .8rem; }
.report-sentence .narrow[open] > summary::before { content: "▾"; }
.report-sentence .narrow .filter-row { margin: .6rem 0 .25rem; }
/* The answer: numbers link to the tickets they count, quietly, as the Tickets report's do. */
.report-table td.num a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--text-muted); }
.report-table td.num a:hover { color: var(--info); border-bottom-style: solid; }
.report-table tfoot td { font-weight: 600; border-top: 2px solid var(--border); }
.report-table tr.is-muted td { color: var(--text-muted); }
/* A question too big to answer, in the answer's place: Drew's .limit in the answer card
   (a 200), and app.js showErrorsInline's .report-limit for any other refusal. */
.report-answer .card-body.limit, .report-limit { margin: .75rem; padding: .6rem .75rem; border-radius: var(--radius); background: var(--warn-bg); font-size: .875rem; }
.report-answer .card-body.limit p { margin: 0; }
/* From … to … only while that period is chosen (Stretch): otherwise the sentence is the five choices. */
.report-sentence .sentence-dates { display: none; }
.report-sentence:has(#rb-preset option[value=""]:checked) .sentence-dates { display: flex; }
/* Build a report's chart (partials/report_chart.html, Drew's geometry; Stretch's design).
   Scoped to .chart-wrap so the dashboard's charts keep their own rules. Thin marks, a
   recessive axis, text in text colours; series in the fixed categorical order (series-0
   is slot 1), never cycled; the period before as hollow dashed bars behind this one. The
   legend names every series and the table below carries every number, so a light series
   under 3:1 is never the only way to read it. Every mark with tickets is a link. */
.chart-wrap { overflow-x: auto; }
.chart-wrap svg.chart { display: block; width: 100%; min-width: 520px; height: auto; font-family: var(--font); }
.chart-wrap .axis { stroke: var(--border); stroke-width: 1; }
.chart-wrap .tick, .chart-wrap .label { fill: var(--text-muted); font-size: 11px; }
.chart-wrap .bar-a { fill: var(--series-1); }
.chart-wrap .bar-b { fill: transparent; stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 2; }
.chart-wrap rect.series-0 { fill: var(--series-1); } .chart-wrap rect.series-1 { fill: var(--series-2); }
.chart-wrap rect.series-2 { fill: var(--series-3); } .chart-wrap rect.series-3 { fill: var(--series-4); }
.chart-wrap rect.series-4 { fill: var(--series-5); } .chart-wrap rect.series-5 { fill: var(--series-6); }
/* stacked segments keep a 2px surface gap between them */
.chart-wrap rect[class^="series-"] { stroke: var(--surface); stroke-width: 2; }
.chart-wrap .donut-track { stroke: var(--muted-bg); }
.chart-wrap circle.series-0 { stroke: var(--series-1); } .chart-wrap circle.series-1 { stroke: var(--series-2); }
.chart-wrap circle.series-2 { stroke: var(--series-3); } .chart-wrap circle.series-3 { stroke: var(--series-4); }
.chart-wrap circle.series-4 { stroke: var(--series-5); } .chart-wrap circle.series-5 { stroke: var(--series-6); }
.chart-wrap .line-a { stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-wrap .line-b { stroke: var(--text-muted); stroke-width: 2; stroke-dasharray: 4 3; }
.chart-wrap .dot-a { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart-wrap a { cursor: pointer; }
.chart-wrap a:hover rect, .chart-wrap a:hover circle, .chart-wrap a:focus-visible rect { opacity: .8; }
.chart-wrap a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chart-wrap .legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--text-muted); margin-top: .35rem; }
.chart-wrap .legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-wrap .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--series-1); }
.chart-wrap .legend i.bar-b, .chart-wrap .legend i.line-b { background: transparent; border: 1px dashed var(--text-muted); }
.chart-wrap .legend i.series-1 { background: var(--series-2); } .chart-wrap .legend i.series-2 { background: var(--series-3); }
.chart-wrap .legend i.series-3 { background: var(--series-4); } .chart-wrap .legend i.series-4 { background: var(--series-5); }
.chart-wrap .legend i.series-5 { background: var(--series-6); }
/* Compare: the headline's change and each cell's, in words with the colour beside them. */
.report-answer .delta { font-size: .85rem; font-weight: 600; color: var(--text-muted); margin-left: .35rem; }
.report-answer .delta.better { color: var(--ok); }
.report-answer .delta.up-bad, .report-answer .delta-cell.up-bad { color: var(--danger); }
.report-answer .delta-cell { display: block; font-size: .75rem; font-weight: 400; color: var(--text-muted); }
/* The answer's chart picker (Drew, Stretch's review): Table · Bar · Line · Stacked · Donut as
   chips in the card's head, the current one filled; a kind that doesn't fit this report is a
   muted chip that says why on hover. The head wraps on a phone, the picker above Download. */
.report-answer > .card-head { flex-wrap: wrap; gap: .5rem; }
.chart-picker { display: flex; flex-wrap: wrap; gap: .3rem; }
.chart-picker .chip.is-disabled { color: var(--text-muted); opacity: .55; cursor: not-allowed; }
.chart-picker .chip.is-disabled:hover { background: transparent; }
/* A pinned saved report on the dashboard (partials/dashboard_panel.html "report:…", Drew;
   Stretch's call): the report's name in the head links to it, then the same chart drawn to
   the panel's width (no 520px floor inside a panel), then one line: the figure, its range as a
   hint, and its change since the period before in words. */
.dash-report .dash-report-link { color: inherit; text-decoration: none; }
.dash-report .dash-report-link:hover, .dash-report .dash-report-link:focus-visible { text-decoration: underline; color: var(--accent); }
.dash-report .delta { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.dash-report .delta.up-bad { color: var(--danger); }
.dash-report .dash-figure { margin: 0; padding: .1rem .9rem .75rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.dash-report .dash-figure strong { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-report .chart-wrap { padding: .5rem .9rem .25rem; }
.dash-report .chart-wrap svg.chart { min-width: 0; }
/* Build a report, opened from a saved one: which, and whose. */
.saved-report { margin: 0 0 .5rem; }
/* A saved report opened on the Build page: its note, then Save changes when it's yours to change. */
.saved-report-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin: 0 0 .5rem; }
.saved-report-bar .saved-report { margin: 0; }
.report-limit + .report-limit { margin-top: .5rem; }
.report.htmx-request { opacity: .55; transition: opacity .15s; }
.report > * + * { margin-top: 1rem; }

.chart { position: relative; margin: 0; overflow-x: auto; }
.chart-svg { display: block; width: 100%; min-width: 520px; height: auto; font-family: var(--font); }
.chart-svg text { fill: var(--text-muted); font-size: 11px; }
.chart-svg .chart-value { fill: var(--text); font-weight: 600; }
.chart-svg .chart-label { fill: var(--text); font-size: 12px; }
.chart-grid line, .chart-baseline { stroke: var(--border); stroke-width: 1; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.series-1 { stroke: var(--series-1); }
.chart-line.series-2 { stroke: var(--series-2); }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-dot.series-1, .chart-bar { fill: var(--series-1); }
.chart-dot.series-2 { fill: var(--series-2); }
.chart-hit { fill: transparent; cursor: default; }
.chart-hit:focus { outline: none; }
.chart-hit:focus-visible { fill: var(--surface-hover); fill-opacity: .6; }
.chart-row:hover .chart-bar, .chart-row:focus-within .chart-bar { fill-opacity: .8; }
/* A bar that links to its tickets (Reports' Common issues): the label reads
   as a link on hover and focus, and the whole row carries the focus ring. */
.chart-link { cursor: pointer; }
.chart-link:hover .chart-label,
.chart-link:focus-visible .chart-label { text-decoration: underline; fill: var(--accent); }
.chart-link:focus { outline: none; }
.chart-link:focus-visible .chart-hit { fill: var(--surface-hover); fill-opacity: .6;
  stroke: var(--blue-600); stroke-width: 2px; }
.chart-crosshair { stroke: var(--border-strong); stroke-width: 1; visibility: hidden; }
.chart-crosshair.is-visible { visibility: visible; }

.chart-legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--text-muted); }
.chart-key.series-1 { background: var(--series-1); }
.chart-key.series-2 { background: var(--series-2); }

.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 9rem;
  padding: .45rem .6rem; font-size: .8rem; line-height: 1.4;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  opacity: 0; transition: opacity .08s;
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip-title { color: var(--text-muted); margin-bottom: .15rem; }
.chart-tip-row { display: flex; align-items: center; gap: .45rem; }
.chart-tip-row strong { font-variant-numeric: tabular-nums; }
.chart-tip-row span:last-child { color: var(--text-muted); }

/* One sentence under each chart saying what it shows (charts.py). */
.chart-summary { margin: .5rem 0 0; font-size: .85rem; color: var(--text-muted); }
.chart-table { margin-top: .5rem; font-size: .85rem; }
.chart-table summary { cursor: pointer; color: var(--text-muted); font-size: .8rem; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .48rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; font-size: .875rem;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, transform .06s ease;
  text-decoration: none;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--blue-600); border-color: var(--blue-600); color: var(--on-primary);
}
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); }

.btn-danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
/* A quiet destructive action (Deactivate on the People page): red only in
   its text, and a red tint on hover. */
.btn-ghost.is-danger { color: var(--danger); }
.btn-ghost.is-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-icon { padding: .4rem; width: 34px; height: 34px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: 1rem; }
.field > label, .label {
  display: block; margin-bottom: .3rem;
  font-size: .82rem; font-weight: 600; color: var(--text);
}
.hint { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], input[type="url"],
input[type="time"], select, textarea {
  width: 100%; padding: .5rem .65rem;
  font: inherit; font-size: .9rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
}
/* Browsers fade placeholders on their own; the muted text color reads at
   4.5:1 or better in every theme, so use it as it is. */
::placeholder { color: var(--text-muted); opacity: 1; }
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500); box-shadow: var(--ring); outline: none;
}
input[type="file"] {
  width: 100%; padding: .45rem; font-size: .85rem;
  border: 1px dashed var(--border-input); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-muted);
}
.check { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .6rem; }
.check input { margin-top: .2rem; }
.check label { font-weight: 500; font-size: .88rem; }
/* A box that only means something with the one above it ticked (Spark More Joy under Celebrations). */
.check.is-dependent { margin-left: 1.6rem; }

.form-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-row > * { flex: 1 1 180px; min-width: 0; }

/* A group of checkboxes under one label, e.g. the working days. */
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field > legend {
  padding: 0; margin-bottom: .3rem;
  font-size: .82rem; font-weight: 600; color: var(--text);
}
.check-row { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.check-row > .check { margin-bottom: 0; }
/* A checkbox or radio straight inside a .field reads as an option, not as
   the field's own label (the Alerts card's "Play a sound for"). */
.field > label.check { display: flex; font-size: inherit; font-weight: 400; color: inherit; margin-bottom: .35rem; }
/* Alerts on Your profile: each sound and its Preview line up in two columns. */
#alerts .check-row { display: grid; grid-template-columns: minmax(9rem, max-content) auto;
  align-items: center; justify-content: start; gap: .25rem 1rem; margin-bottom: .2rem; }
input[type="number"].hours { width: 5.5rem; }
.category-targets { margin: 0; }
.category-targets input.hours { flex: 0 0 5rem; width: 5rem; }

/* A refused field's message, put under it by app.js (markRefusedFields). */
.field-error { margin: .3rem 0 0; font-size: .8rem; color: var(--danger); }
[aria-invalid="true"] { border-color: var(--danger) !important; }

.errorlist, .form-errors {
  margin: 0 0 .75rem; padding: .6rem .8rem; list-style: none;
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid var(--danger); border-radius: var(--radius-sm); font-size: .85rem;
}

/* --------------------------------------------------------------------------
   Tables and lists
   -------------------------------------------------------------------------- */
/* Positioned, so a visually-hidden heading inside (an "Actions" column) stays in the scrolling
   box instead of widening a phone's page (Stretch, 375). */
.table-wrap { position: relative; overflow-x: auto; }

/* Saved views above the ticket list */
.view-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .75rem; }
.view-tab {
  display: inline-flex; align-items: center; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); font-size: .85rem;
}
.view-tab a { padding: .3rem .8rem; color: var(--text); text-decoration: none; }
.view-tab.is-active { background: var(--info-bg); border-color: var(--info); }
.view-tab.is-active a { color: var(--info); font-weight: 600; }
.view-remove {
  border: 0; background: none; color: var(--text-muted); cursor: pointer;
  padding: 0 .55rem 0 0; font-size: 1rem; line-height: 1;
}
.view-remove:hover { color: var(--danger); }
/* A saved view's Share / Stop sharing (inventory): a small word beside its ×. */
.view-share {
  border: 0; background: none; color: var(--text-muted); cursor: pointer;
  padding: 0 .35rem 0 0; font-size: .75rem; text-decoration: underline;
}
.view-share:hover { color: var(--info); }
.view-actions-inline { display: inline-flex; align-items: center; }
.view-menu { display: none; position: relative; }
@media (max-width: 600px) {
  .view-actions-inline { display: none; }
  .view-menu { display: inline-block; }
  .view-menu > summary {
    list-style: none; cursor: pointer; min-width: 44px; min-height: 44px; margin: -.3rem 0;
    display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted);
  }
  .view-menu > summary::-webkit-details-marker { display: none; }
  .view-menu-list {
    position: absolute; z-index: 20; top: 100%; right: 0; min-width: 10rem;
    display: grid; gap: .15rem; padding: .35rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  }
  .view-menu-list .btn { justify-content: flex-start; width: 100%; }
}
.view-save { position: relative; }
.view-save > summary { list-style: none; }
.view-save > summary::-webkit-details-marker { display: none; }
.view-save-form {
  position: absolute; z-index: 10; top: calc(100% + .35rem); left: 0; width: min(22rem, 80vw);
  display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.view-save-form input { flex: 1 1 12rem; }
.view-save-form .hint { flex-basis: 100%; margin: 0; }
/* On a phone the form spans the row of tabs rather than hang off "+ Save view",
   which can sit at the right edge and push the page wider (Musamil). */
@media (max-width: 600px) {
  .view-tabs { position: relative; }
  .view-save { position: static; }
  .view-save-form { left: 0; right: 0; width: auto; }
}
/* Build a report's "+ Save report": the fields stacked, each with its label above. */
.report-save-form { display: grid; gap: .35rem; }
.report-save-form label:not(.check) { font-size: .8rem; font-weight: 600; }
.report-save-form label.check { margin: .2rem 0 0; }
/* The box, then its words: not stretched like the name box (.view-save-form input). */
.report-save-form .check input { flex: none; }
.report-save-form .btn { justify-self: start; }
/* Inventory: the fetched tabs sit in the same row as "+ Save view". */
.view-tabs-list { display: contents; }
.view-meta { font-weight: 400; color: var(--text-muted); }
.view-save-form .check { flex-basis: 100%; }

/* A drop-down of checkboxes in the filter bar ("Assigned to") */
.check.inline { margin: 0; }
.filter-dropdown { position: relative; }
.filter-dropdown > summary {
  cursor: pointer; padding: .5rem .65rem; font-size: .9rem; border: 1px solid var(--border-input);
  border-radius: var(--radius-sm); background: var(--surface); list-style: none;
}
.filter-dropdown > summary::-webkit-details-marker { display: none; }
.filter-dropdown > summary::after { content: " ▾"; color: var(--text-muted); }
.filter-dropdown-menu {
  position: absolute; z-index: 10; top: calc(100% + .25rem); left: 0; min-width: 14rem;
  max-height: 16rem; overflow-y: auto; padding: .5rem .75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* "Scan or type a tag" above the inventory list (pages/inventory.html): the label, the
   field and Open on one row, the hint underneath; on a phone the field takes the row. */
.scan-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  padding: .75rem 1.1rem;
}
.scan-bar label { font-weight: 600; margin: 0; }
.scan-bar input { flex: 1 1 14rem; max-width: 24rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.scan-bar .hint { flex-basis: 100%; margin: 0; }
/* The list's "⋯" (44px, the touch target) and the row-actions dialog's list. */
.row-more { min-width: 2.75rem; min-height: 2.75rem; font-size: 1.1rem; line-height: 1; }
.asset-actions { width: min(26rem, calc(100vw - 2rem)); }
.asset-actions-what { margin: -.4rem 0 .9rem; }
.action-list { display: grid; gap: .5rem; }
.action-list form { margin: 0; }
.action-list .btn { width: 100%; justify-content: flex-start; }
@media (max-width: 600px) {
  /* A sheet from the bottom on a phone, not the full-screen form other panels take. */
  dialog.panel-dialog.asset-actions {
    height: auto; max-height: 85vh; inset: auto 0 0 0; margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
/* The asset page's tabs (partials/asset_detail.html, app.js "tabs"): underlined, so
   they read as the page's own sections, not saved views. One row that scrolls
   sideways on a phone, with a fade at the right edge. */
.tabs {
  display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
  padding-right: 1.5rem;        /* the last tab scrolls clear of the fade */
}
/* The fade says there are more tabs to the right, only while there are (app.js, has-more):
   wide enough to read as a cue, not a rounding (Stretch's layout review, row 4). */
.tabs.has-more {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 3.5rem), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 3.5rem), transparent);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem .8rem; min-height: 2.75rem; border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary, var(--blue-600)); border-bottom-color: currentColor; }
.tab-count {
  font-size: .72rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}
.tab-panel:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 4px; }
.asset-head .inline-form { margin: 0; }
.history-chips { margin-bottom: 1rem; }
.history-chips .view-tab { padding: .3rem .8rem; color: var(--text); cursor: pointer; font: inherit; font-size: .85rem; }

/* The Repairs tab: one line a repair, the cost on the right. */
.repair-list { list-style: none; margin: 0; padding: 0; }
.repair {
  display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .25rem 1rem;
  padding: .85rem 1.1rem; border-top: 1px solid var(--border);
}
.repair:first-child { border-top: 0; }
.repair-when { color: var(--text-muted); font-size: .85rem; }
.repair-what .badge { margin-left: .25rem; }
.repair-cost { font-variant-numeric: tabular-nums; }
.repair-back { margin-top: .5rem; }
.repair-back > summary { list-style: none; display: inline-flex; }
.repair-back > summary::-webkit-details-marker { display: none; }
.repair-back[open] > summary { margin-bottom: .5rem; }
.repair-note { padding: 0 1.1rem 1rem; margin: 0; }
@media (max-width: 600px) {
  .repair { grid-template-columns: 1fr auto; }
  .repair-when { grid-column: 1 / -1; }
}

/* Photos & documents: a drop zone the native file input fills (no script), the
   pictures as thumbnails, the rest as a list. */
.drop-zone {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 6rem; padding: 1rem; margin-bottom: .5rem; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius); color: var(--text-muted);
}
.drop-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone:hover, .drop-zone:focus-within { border-color: var(--blue-600); color: var(--text); }
.drop-zone:focus-within { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.file-thumbs { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.file-thumb { display: grid; gap: .3rem; align-content: start; }
.file-thumb img { width: 100%; height: 7.5rem; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.file-thumb .btn { justify-self: start; }
/* A flagged picture takes the whole row, its picture at the usual width and the sentence
   beside or under it, so the warning reads as a line, not a narrow column (Stretch). */
.file-thumb:has(.scan-warning) { grid-column: 1 / -1; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr); column-gap: 1rem; }
.file-thumb:has(.scan-warning) > a { grid-row: span 3; }
.file-thumb:has(.scan-warning) .btn { grid-column: 2; }
@media (max-width: 600px) {
  .file-thumb:has(.scan-warning) { grid-template-columns: minmax(0, 1fr); }
  .file-thumb:has(.scan-warning) > a { grid-row: auto; }
  .file-thumb:has(.scan-warning) .btn { grid-column: auto; }
}
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .5rem 0; border-top: 1px solid var(--border); }
.file-list li:first-child { border-top: 0; }
.file-list .btn { margin-left: auto; }

/* Settings → Device lifecycle: the school's default row shaded at the top; on a
   phone each row becomes a small block with its labels above the boxes. */
.lifecycle-table .num-input { width: 4.5rem; display: inline-block; margin-right: .3rem; }
.lifecycle-table tr.lifecycle-default { background: var(--info-bg); }
/* Its grey hint was 4.43:1 on the blue shade (Stretch's axe run): full ink on that row. */
.lifecycle-table tr.lifecycle-default .hint { color: var(--text); }
.lifecycle-table tbody th { font-weight: 600; text-align: left; }
@media (max-width: 600px) {
  .lifecycle-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lifecycle-table, .lifecycle-table tbody, .lifecycle-table tr, .lifecycle-table th, .lifecycle-table td { display: block; }
  .lifecycle-table tr { padding: .6rem 0; border-top: 1px solid var(--border); }
  .lifecycle-table td { border: 0; padding: .2rem 0; }
  .lifecycle-table td::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--text-muted); }
}
/* The asset's lifecycle line: age against expected life as a slim bar. */
.lifecycle-line meter { display: block; width: 100%; max-width: 22rem; height: .5rem; margin: .35rem 0 .2rem; }

/* The History timeline: a small mark coloured by what happened (data-kind). */
.asset-timeline li[data-kind] { position: relative; }
.asset-timeline li[data-kind]::before {
  content: ""; display: inline-block; width: .55rem; height: .55rem; margin-right: .5rem;
  border-radius: 50%; background: var(--text-muted); vertical-align: middle;
}
.asset-timeline li[data-kind="handed"]::before, .asset-timeline li[data-kind="returned"]::before { background: var(--blue-600); }
.asset-timeline li[data-kind="repair"]::before, .asset-timeline li[data-kind="status"]::before { background: var(--warn); }
.asset-timeline li[data-kind="retired"]::before { background: var(--danger); }
.asset-timeline li[data-kind="reinstated"]::before, .asset-timeline li[data-kind="created"]::before { background: var(--ok, #16a34a); }
.asset-timeline li[data-kind="moved"]::before, .asset-timeline li[data-kind="stocktake"]::before { background: var(--info, var(--blue-600)); }
.asset-timeline .timeline-more { list-style: none; }

/* Printing the asset sheet: every section, no tab row. */
@media print {
  .tabs { display: none; }
  .tab-panel[hidden] { display: block !important; }
}

/* A scan that named no device: the sentence and its next step on one line. */
.scan-miss { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 1rem 0; }

/* Bulk changes on the ticket list. The bar sits under the table and sticks
   to the bottom of the window while the table scrolls past, so it never
   pushes the rows about when it appears. */
table.data th.select, table.data td.select { width: 2.25rem; padding-right: 0; }
.bulk-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  padding: .6rem 1rem; background: var(--surface);
  border-top: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .10);
}
/* Only there once a row is ticked (app.js adds has-selection). */
.bulk-bar:not(.has-selection) { display: none; }
.bulk-bar select, .bulk-bar input[type="text"] { width: auto; min-width: 10rem; padding: .35rem .5rem; }
.bulk-bar input[type="text"] { flex: 1 1 12rem; max-width: 18rem; }
/* Each action stays on one line; the bar wraps between actions instead. */
.bulk-action { display: flex; align-items: center; gap: .5rem; margin: 0; }
.bulk-action + .bulk-action { padding-left: .5rem; border-left: 1px solid var(--border); }
.bulk-count { font-size: .85rem; color: var(--text-muted); min-width: 9rem; }
.bulk-bar.has-selection .bulk-count { color: var(--text); font-weight: 600; }
/* The phone's "Do what…" picker (app.js): hidden wider, where every form shows. */
.bulk-bar [data-bulk-picker] { display: none; }
@media (max-width: 600px) {
  .bulk-bar.has-picker [data-bulk-picker] { display: block; flex: 1 1 10rem; }
  .bulk-bar.has-picker .bulk-action:not(.is-chosen) { display: none; }
  .bulk-bar.has-picker .bulk-action + .bulk-action { padding-left: 0; border-left: 0; }
  .bulk-bar.has-picker .bulk-action { flex: 1 1 100%; }
  .bulk-bar.has-picker .bulk-action select, .bulk-bar.has-picker .bulk-action input[type="text"] { flex: 1 1 auto; min-width: 0; }
}
/* Who has what: an address wraps rather than widen the table on a phone. */
.holders-table .hint { overflow-wrap: anywhere; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td {
  padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2); white-space: nowrap;
}
table.data tbody tr:hover { background: var(--surface-hover); }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-link { font-weight: 600; }
.ticket-key { font-family: var(--mono); font-size: .8rem; color: var(--text-muted); }
.ticket-key .badge { font-family: var(--font); }
/* The Merge dialog (pages/ticket_list.html, app.js): the ticked tickets as one radio list
   that scrolls inside the dialog, the main ticket shaded, a note under each saying what
   will happen; a sheet from the bottom on a phone. */
.merge-dialog { width: min(36rem, calc(100vw - 2rem)); }
.merge-choices { border: 0; padding: 0; margin: 0 0 .5rem; min-width: 0; }
.merge-choices legend { font-weight: 600; margin-bottom: .5rem; }
.merge-list { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.merge-row { padding: .55rem .75rem; border-top: 1px solid var(--border); }
.merge-list .merge-row:first-child { border-top: 0; }
.merge-row.is-main { background: var(--info-bg); }
.merge-pick { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; cursor: pointer; margin: 0; }
.merge-title { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.merge-when { font-size: .8rem; color: var(--text-muted); }
.merge-who { margin: .1rem 0 0 1.6rem; }
.merge-note { margin: .2rem 0 0 1.6rem; font-size: .85rem; color: var(--text-muted); }
.merge-note:empty { display: none; }
.merge-note.tone-warn { color: var(--warn); }
/* A warning said as a hint: a confidential department's article read by others, the reply
   that goes to every linked ticket (Stretch). */
.hint.tone-warn { color: var(--warn); }
.merge-note.tone-danger { color: var(--danger); }
.merge-other { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; border-top: 0; padding-left: 0; }
.merge-results { list-style: none; padding: 0; margin: 0; }
.merge-results li { padding: .5rem 0; border-top: 1px solid var(--border); }
.merge-results li:first-child { border-top: 0; }
.merge-result-title { font-size: 1rem; margin: 0 0 .5rem; }
@media (max-width: 600px) {
  dialog.panel-dialog.merge-dialog {
    height: auto; max-height: 90vh; inset: auto 0 0 0; margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
/* Main, linked and merged tickets in the key line: muted links, not badges (Stretch). */
.ticket-key .link-marker { color: var(--info); text-decoration: none; white-space: nowrap; }
.ticket-key .link-marker:hover { text-decoration: underline; }
/* The queue's "Opened from … to …" dates, labelled where they sit. */
.filter-dates { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.filter-dates input[type="date"] { width: auto; }
.filter-date { display: inline; margin: 0; font-size: .85rem; color: var(--text-muted); white-space: nowrap; }

/* Any data table: one column that takes the width the others leave, and
   columns that never wrap. */
table.data th.grow { width: 100%; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }

/* The ticket queue (partials/ticket_list.html). The subject column takes the
   width the others leave, and the short columns never wrap. */
.ticket-table th.col-subject { width: 100%; }
.ticket-table td.col-subject { min-width: 16rem; }
.ticket-table td.col-status, .ticket-table td.col-priority,
.ticket-table td.col-assignee, .ticket-table td.col-sla { white-space: nowrap; }
/* Under "opened": when it last moved, or when it was resolved. */
.ticket-table .col-activity { font-size: .76rem; color: var(--text-muted); }

/* A field the organization has marked required on intake. */
.req { color: var(--danger); font-weight: 700; }
/* Lets an HTMX-loaded group of filters sit in the toolbar's flex flow rather
   than becoming one flex item. */
.contents { display: contents; }

/* ---- Knowledge base ------------------------------------------------------ */
/* The articles as a list read top to bottom (Brad, 24 Oct 2026; Stretch's rows): a row each,
   divided by a hairline, the title first, two lines of the preview, then the small print. The
   staff list sits in its card; only the title is a link, so the row itself doesn't light up. */
.kb-list { list-style: none; margin: 0; padding: 0; }
.kb-row { padding: .8rem 0; }
.kb-row + .kb-row { border-top: 1px solid var(--border); }
.kb-row-title { font-weight: 650; font-size: 1rem; color: var(--text); line-height: 1.3; }
.kb-row-title:hover { color: var(--link); }
.kb-row-lead, .help-lead {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; color: var(--text-muted);
}
.kb-row-lead { margin: .2rem 0 0; font-size: .85rem; }
.kb-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin-top: .35rem; font-size: .78rem; }
/* A paged list scrolls to its top after Previous / Next (app.js, data-pager): clear of the
   sticky top bar, as #reporter and #ticket-form (Stretch). */
#kb-results, #ticket-results, #asset-results, #canned-results { scroll-margin-top: 5rem; }

/* "Who can read it" (partials/kb_visibility.html): four choices narrow to wide, each with
   who that is; the departments to tick sit under the first, indented to its words, two or three
   to a line, one on a phone. */
.audience-field > .hint { margin: 0 0 .35rem; }
.audience-choice .audience-label { display: block; }
.audience-choice .hint { display: block; margin: 0; }
.audience-departments { margin: 0 0 .6rem 1.55rem; }
.audience-checks { gap: .25rem 1.1rem; }
.audience-checks > .check { margin: 0; }
.audience-departments > .hint { margin: 0 0 .3rem; }
.audience-departments > [data-audience-confidential]:not(.is-shown) { display: none; }
.audience-sentence { margin: .5rem 0 0; }
/* .filter-checks centres its items; on a phone the ticks run down the left. */
@media (max-width: 600px) {
  .filter-checks.audience-checks { flex-direction: column; align-items: flex-start; }
}
/* The article's readers, first in "About this article" (Stretch). */
.kb-visible { font-weight: 600; margin: 0 0 .6rem; }

.kb-summary {
  font-size: 1.02rem; color: var(--text-muted);
  border-left: 3px solid var(--blue-500); padding-left: .85rem; margin-bottom: 1.25rem;
}

/* Rendered article body. The sanitiser fixes the tag set, so these rules can
   safely assume what may appear. */
.kb-body { line-height: 1.65; }
.kb-body > *:first-child { margin-top: 0; }
.kb-body h1, .kb-body h2, .kb-body h3, .kb-body h4 {
  margin: 1.6rem 0 .6rem; line-height: 1.25; letter-spacing: -.01em;
}
.kb-body h1 { font-size: 1.45rem; }
.kb-body h2 { font-size: 1.2rem; }
.kb-body h3 { font-size: 1.05rem; }
.kb-body p { margin: 0 0 .9rem; }
.kb-body ul, .kb-body ol { margin: 0 0 .9rem; padding-left: 1.4rem; }
.kb-body li { margin-bottom: .3rem; }
.kb-body a { color: var(--link); }
.kb-body code {
  background: var(--muted-bg); padding: .1rem .3rem; border-radius: var(--radius-sm);
  font-size: .87em;
}
.kb-body pre {
  background: var(--muted-bg); padding: .8rem 1rem; border-radius: var(--radius);
  overflow-x: auto; margin: 0 0 .9rem;
}
.kb-body pre code { background: none; padding: 0; }
.kb-body blockquote {
  margin: 0 0 .9rem; padding: .1rem 0 .1rem 1rem;
  border-left: 3px solid var(--border-strong); color: var(--text-muted);
}
.kb-body table { width: 100%; border-collapse: collapse; margin: 0 0 .9rem; }
.kb-body th, .kb-body td {
  border: 1px solid var(--border); padding: .45rem .6rem; text-align: left;
}
.kb-body th { background: var(--surface-2); font-weight: 650; }
.kb-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---- Public knowledge base -------------------------------------------------- */
.public-main {
  max-width: 62rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; width: 100%;
}
.public-footer {
  border-top: 1px solid var(--border); padding: 1.25rem;
  text-align: center; background: var(--surface);
}
.help-search { max-width: 34rem; margin: 1.25rem auto 0; position: relative; }
.help-search input[type="search"] { font-size: 1rem; padding: .7rem .9rem; }

/* The help centre's articles: the same rows in one framed list; each row is one link. Its
   focus ring sits inside the row, since the frame clips anything outside it. */
.help-list {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
.help-list li + li { border-top: 1px solid var(--border); }
.help-item { display: block; padding: .85rem 1rem; color: var(--text); }
.help-item:hover { background: var(--surface-2); text-decoration: none; }
.help-item:hover .help-title { color: var(--brand, var(--blue-600)); }
.help-item:focus-visible { outline-offset: -2px; }
.help-title { display: block; font-weight: 650; line-height: 1.3; }
.help-lead { margin-top: .2rem; font-size: .87rem; }
.help-item .hint { display: block; margin-top: .35rem; font-size: .78rem; }

/* ---- Canned responses --------------------------------------------------- */
.canned-picker { margin: 0 0 1rem; }
.canned-picker > summary {
  cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--link);
  padding: .35rem 0; list-style: none;
}
.canned-picker > summary::-webkit-details-marker { display: none; }
.canned-picker > summary::before { content: "+ "; font-weight: 700; }
.canned-picker[open] > summary::before { content: "− "; }
.canned-picker > summary:hover { text-decoration: underline; }

.canned-panel {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); overflow: hidden; margin-top: .4rem;
}
.canned-panel input[type="search"] {
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent;
}
.canned-list { list-style: none; margin: 0; padding: 0; max-height: 15rem; overflow-y: auto; }
.canned-list li { border-bottom: 1px solid var(--border); }
.canned-list li:last-child { border-bottom: 0; }
.canned-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 0; background: none; padding: .55rem .75rem; font: inherit;
  color: var(--text);
}
.canned-item:hover, .canned-item:focus-visible { background: var(--surface-hover); }
.canned-title { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .88rem; }
.canned-title code { font-size: .72rem; }
.canned-preview {
  display: block; color: var(--text-muted); font-size: .8rem;
  margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Condensed queue used in narrow panels. */
.compact-list { list-style: none; margin: 0; padding: 0; }
.compact-list li {
  padding: .65rem 1.1rem; border-bottom: 1px solid var(--border);
}
.compact-list li:last-child { border-bottom: 0; }
.compact-list li:hover { background: var(--surface-hover); }
.compact-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  margin-top: .25rem; font-size: .8rem;
}

.empty {
  padding: 2.5rem 1rem; text-align: center; color: var(--text-muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: .25rem; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  background: var(--muted-bg); color: var(--text-muted);
}
.badge.tone-ok     { background: var(--ok-bg);     color: var(--ok); }
.badge.tone-warn   { background: var(--warn-bg);   color: var(--warn); }
.badge.tone-danger { background: var(--danger-bg); color: var(--danger); }
.badge.tone-info   { background: var(--info-bg);   color: var(--info); }
.badge.tone-accent { background: var(--accent-bg); color: var(--accent); }
.badge.tone-muted  { background: var(--muted-bg);  color: var(--text-muted); }
/* A ticket whose e-mail failed its sender's domain checks (ticket page). */
.sender-unverified { margin-top: .35rem; }
#reporter { scroll-margin-top: 5rem; }   /* clear of the sticky header when the badge links here */
.sender-unverified .hint { margin: .25rem 0 0; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Ticket page: status, priority and SLA in a row above the request, a size up
   (Brad, 16 Oct 2026: "see the status at a glance since there's a lot going on"). */
.ticket-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.ticket-status .badge { font-size: .88rem; padding: .3rem .75rem; }
.ticket-status .badge-dot { width: 8px; height: 8px; }

/* --------------------------------------------------------------------------
   Who else has a ticket open (partials/ticket_presence.html)
   -------------------------------------------------------------------------- */
.presence-slot:empty { display: none; }
.presence {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .85rem;
  margin-bottom: 1rem; padding: .55rem .9rem; font-size: .85rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--info-bg);
}
.presence.is-replying { background: var(--warn-bg); border-color: var(--warn); }
.presence-label { font-weight: 700; color: var(--info); }
.presence.is-replying .presence-label { color: var(--warn); }
.presence-people {
  display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 0; padding: 0; list-style: none;
}
.presence-person { display: inline-flex; align-items: center; gap: .35rem; color: var(--text); }
.presence-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent); font-size: .72rem; font-weight: 700;
}

/* --------------------------------------------------------------------------
   Conversation
   -------------------------------------------------------------------------- */
.thread { display: flex; flex-direction: column; gap: .85rem; }
.message {
  padding: .85rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.message.is-internal {
  background: var(--warn-bg); border-color: var(--warn);
}
.message.is-internal .message-meta { color: var(--warn); }
.message-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: .4rem; font-size: .8rem; color: var(--text-muted);
}
.message-author { font-weight: 650; color: var(--text); }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
/* The AI first reply (assist/): the assistant's words, told apart from a person's. */
.message.is-ai { border-color: var(--info); border-left-width: 3px; }
/* The AI reply's disclosure line (its first paragraph, .ai-preface from assist/): kept, but
   muted so the advice is what the eye lands on; the author label and badge say AI too. */
.message.is-ai .ai-preface { color: var(--text-muted); font-size: .85rem; margin: 0 0 .5rem; }
.message.is-ai .message-author::before {
  content: ""; display: inline-block; width: .6em; height: .6em; margin-right: .35em;
  border-radius: 50%; background: var(--info); vertical-align: 0;
}
.message-fixed {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  margin-top: .75rem; padding-top: .6rem; border-top: 1px dashed var(--border);
}
.message-fixed .hint { margin: 0; flex-basis: 100%; }
.message-fixed.is-done { margin-bottom: 0; color: var(--ok); font-weight: 600; }
/* "Report this reply" under the AI reply: folded away until wanted. */
.report-ai { margin-top: .6rem; font-size: .85rem; }
.report-ai summary { cursor: pointer; color: var(--text-muted); width: max-content; }
.report-ai summary:hover { color: var(--text); }
.report-ai form { margin-top: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.report-ai .field { margin-bottom: .5rem; }
.report-ai .spinner { display: none; }
.report-ai .htmx-request .spinner { display: inline-block; }
/* The staff AI assistant (assist/staff.py). "Suggest a reply": its button under the reply box,
   and the suggestion ghosted there -- muted italic text in a dashed box, labelled as the AI's,
   so it can't be mistaken for what's typed; "Use this" makes it real text in the box. */
.ai-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.ai-suggest .hint { margin: 0; }
.ai-suggestion-slot:empty { display: none; }
.ai-suggestion-slot { margin-top: .5rem; }
.ai-ghost {
  padding: .6rem .75rem; border: 1px dashed var(--border-input); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-muted);
}
.ai-ghost:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
/* The assistant's help on a ticket, between the conversation and the reply box (Stretch): one
   dashed panel, its pill and line saying it's for the technician, a 44px × in the corner; then
   "Steps to try" and "Articles that might help", each shown once its request brings something,
   a hairline between them only when both are there. The panel shows only with a section in it. */
.ai-help { position: relative; margin: .75rem 0 1rem; padding-right: 2.75rem; }
.ai-help:not(:has(.ai-help-section)) { display: none; }
.ai-help-head { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin: 0 0 .6rem; }
.ai-help-head .ai-suggested { margin-left: 0; }
.ai-help-head .hint { margin: 0; }
.ai-help-close {
  position: absolute; top: 0; right: 0; width: 44px; height: 44px;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.ai-help-close:hover { color: var(--text); background: var(--surface-hover); }
.ai-help-section h3 { margin: 0 0 .45rem; font-size: .9rem; color: var(--text); }
#suggested-steps:has(.ai-help-section) + #suggested-articles .ai-help-section {
  margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border);
}
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.steps-list li { display: grid; gap: .1rem; }
.steps-list .step-text { color: var(--text); overflow-wrap: anywhere; }
.steps-list .hint { margin: 0; }
.steps-list .hint a { overflow-wrap: anywhere; }
.steps-copy { margin-top: .5rem; min-height: 44px; }
.suggested-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.suggested-list a { font-weight: 600; color: var(--link); overflow-wrap: anywhere; }
/* "This fixed it" at a row's right; under the reason, at the right, on a phone (Stretch). */
.suggested-row { display: flex; align-items: flex-start; gap: .25rem .75rem; }
.suggested-text { flex: 1 1 auto; min-width: 0; }
.suggested-fix { flex: none; display: flex; align-items: center; gap: .35rem; }
.suggested-fix .btn { min-height: 44px; }
@media (max-width: 600px) {
  .suggested-row { flex-wrap: wrap; }
  .suggested-fix { flex-basis: 100%; justify-content: flex-end; }
}
/* The article that fixed a ticket, in its card: title, who and when, Undo. */
.fixed-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.fixed-list .hint { margin: 0; }
.fixed-unreadable { color: var(--text-muted); font-style: italic; }
.kb-fixed-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .4rem; }
.kb-fixed-list .hint { flex-basis: 100%; margin: 0; }
.suggested-list .hint {
  margin: .1rem 0 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-clamp: 2; overflow: hidden;
}
.ai-ghost-label { margin: 0 0 .35rem; font-size: .8rem; font-weight: 600; color: var(--info); }
.ai-ghost-text { font-style: italic; white-space: normal; overflow-wrap: anywhere; }
.ai-ghost-text p { margin: 0 0 .5rem; }
.ai-ghost-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.ai-ghost-message { margin: 0; }
/* "Turn this into a help article": the editable draft under its button. */
.ai-article-slot:empty { display: none; }
.ai-article-slot { margin-top: .75rem; }
.ai-article-form { padding: .75rem; border: 1px dashed var(--border-input); border-radius: var(--radius-sm); }
.ai-article-form textarea { width: 100%; }
/* Flagged by the AI assistant (staff only): the sentence and Clear flag on one row. */
.ai-flag { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.ai-flag span { flex: 1 1 20rem; }
.ai-flag form { margin: 0; }
.ai-flag .btn { color: var(--text); }
.ai-flag .spinner { display: none; }
.ai-flag .htmx-request .spinner { display: inline-block; }
.message-fixed .spinner { display: none; }
.message-fixed .htmx-request .spinner, .message-fixed.htmx-request .spinner { display: inline-block; }
/* Organization settings: the automatic first reply card (partials/org_ai.html). */
.ai-usage { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 0 0 .9rem; }
.ai-usage dt { font-size: .78rem; color: var(--text-muted); margin: 0; }
.ai-usage dd { margin: 0; font-weight: 650; }
.ai-usage div { min-width: 7rem; }
.ai-chat-settings { border-top: 1px solid var(--border); }
.ai-reply-settings h3, .ai-chat-settings h3 { margin: 0 0 .5rem; font-size: 1rem; }
/* The administrators' review of AI replies and chats, inside the settings card. */
.ai-review { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.ai-review h3 { margin: 0 0 .5rem; font-size: 1rem; }
.ai-review .toolbar { padding: 0; margin-bottom: .5rem; }
.ai-review .table-wrap { margin: 0; }
.ai-review .data td { vertical-align: top; }
.ai-review .ai-reply-text { color: var(--text-muted); font-size: .82rem; margin: .2rem 0 0; max-width: 32rem; }
.ai-review .pager { margin-top: .5rem; }
@media (max-width: 700px) {
  /* A phone shows what happened and who reported it; the reply's words wait for a wider screen. */
  .ai-review .ai-reply-text { display: none; }
  .ai-review .data th:first-child, .ai-review .data td:first-child { white-space: nowrap; }
}
.message-body p:last-child { margin-bottom: 0; }

/* The AI help chat (partials/ai_chat.html; assist/chat.py): a folded panel on Raise a ticket
   and the knowledge base. The person's words on the right, the assistant's labelled, with the
   AI reply's blue edge; a flagged chat's edge is red. */
.ai-chat { margin-bottom: 1rem; }
.ai-chat > summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 650; }
.ai-chat > summary .hint { font-weight: 400; }
.ai-chat[open] > summary { border-bottom: 1px solid var(--border); }
.ai-chat .ai-preface { color: var(--text-muted); font-size: .85rem; margin: 0 0 .4rem; }
.ai-chat-safety { font-size: .85rem; margin: 0 0 .75rem; }
.ai-chat-log { display: flex; flex-direction: column; gap: .6rem; max-height: 28rem; overflow-y: auto; }
.ai-chat-log:empty { display: none; }
.ai-chat-turn { display: flex; flex-direction: column; gap: .4rem; }
.ai-chat-bubble {
  padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow-wrap: anywhere; max-width: 46rem;
}
.ai-chat-bubble.is-person { align-self: flex-end; background: var(--surface-2); white-space: pre-wrap; }
.ai-chat-bubble.is-ai { border-left: 3px solid var(--info); }
.ai-chat-bubble.is-escalated { border-left-color: var(--danger); }
.ai-chat-bubble.is-done { color: var(--ok); font-weight: 600; }
.ai-chat-bubble .message-meta { margin-bottom: .25rem; }
.ai-chat-answer p { margin: 0 0 .5rem; }
.ai-chat-answer p:last-child { margin-bottom: 0; }
.ai-chat-bubble .hint { margin: .5rem 0 0; }
.ai-chat-links { margin: .2rem 0 0; padding-left: 1.2rem; }
.ai-chat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0; }
.ai-chat-actions:empty { display: none; }
.ai-chat-actions form { margin: 0; }
.ai-chat-actions .report-ai { flex-basis: 100%; margin-top: 0; }
.ai-chat-reported { margin: .25rem 0 0; color: var(--ok); }
.ai-chat-form .field { margin-bottom: .5rem; }
.ai-chat-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.ai-chat-row .hint { margin: 0; }
.ai-chat-waiting { display: none; }
.ai-chat-form.htmx-request .ai-chat-waiting { display: inline; }

/* Chat first on Raise a ticket (a requester, the chat on): one prominent box, "Skip to the
   form" beside its heading. ai_chat.js folds the form away (is-folded) until it's wanted. */
.ai-chat-first { border-color: var(--blue-200); box-shadow: var(--shadow); }
.ai-chat-first > .card-body { padding: 1.25rem 1.35rem; }
.ai-chat-first-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .25rem 1rem; }
.ai-chat-heading { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.ai-chat-heading label { font: inherit; color: inherit; margin: 0; cursor: pointer; }
.ai-chat-skip { margin: 0; font-weight: 600; white-space: nowrap; }
.ai-chat-lede { margin: .35rem 0 .75rem; }
.ai-chat-first .ai-chat-form textarea { font-size: 1rem; }
.is-folded { display: none; }
#ticket-form { scroll-margin-top: 5rem; }   /* clear of the sticky top bar after a hand-off */
/* A form field the chat filled in: marked until the person changes it. */
.ai-suggested {
  display: inline-block; margin-left: .35rem; padding: .05rem .45rem; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent); font-size: .72rem; font-weight: 600;
  vertical-align: .1em;
}
.ai-suggested[hidden] { display: none; }
.ai-handoff-note { margin: 0 0 .9rem; padding: .55rem .75rem; border-radius: var(--radius-sm);
  background: var(--info-bg); color: var(--text); font-size: .88rem; }
.ai-handoff-note:empty { display: none; }
@media (max-width: 640px) {
  .ai-chat-first > .card-body { padding: 1rem; }
  .ai-chat-heading { font-size: 1.2rem; }
  .ai-chat-first .ai-chat-actions > .btn, .ai-chat-first .ai-chat-actions > form { flex: 1 1 100%; }
  .ai-chat-first .ai-chat-actions > form .btn { width: 100%; }
}

.timeline { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.timeline li {
  display: flex; gap: .6rem; padding: .45rem 0;
  border-bottom: 1px dashed var(--border); color: var(--text-muted);
}
.timeline li:last-child { border-bottom: 0; }
.timeline time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.attachments { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.attachment {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .6rem; font-size: .82rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
}
.attachment:hover { background: var(--surface-hover); text-decoration: none; }
.attachment .size { color: var(--text-muted); font-size: .76rem; }
/* A file the upload checks couldn't fully look into: its warning on a line of its own,
   under the link, in the attachments row and the device's file list. */
.attachment-flagged { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; flex-basis: 100%; }
.scan-warning { display: block; flex-basis: 100%; font-size: .78rem; color: var(--warn); }   /* the .hint size */
/* An image attachment, shown in the ticket; it opens full size in a new tab. */
.attachment-image { margin: 0; max-width: min(100%, 22rem); }
.attachment-image img {
  display: block; max-width: 100%; max-height: 16rem; width: auto; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.attachment-image figcaption { margin-top: .3rem; font-size: .8rem; overflow-wrap: anywhere; }
.attachment-image figcaption .size { color: var(--text-muted); font-size: .76rem; }

.meta-list { margin: 0; font-size: .875rem; }
.meta-list dt {
  font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); margin-top: .8rem;
}
.meta-list dt:first-child { margin-top: 0; }
.meta-list dd { margin: .15rem 0 0; }

/* --------------------------------------------------------------------------
   Filters, toolbar, pagination
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  padding: .75rem 1.1rem; border-bottom: 1px solid var(--border);
  background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar input[type="search"], .toolbar select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }

/* The ticket list's toolbar: search, the Filters button and sort on one row,
   the other filters in a panel underneath that the button opens. */
.toolbar-stack { display: grid; gap: .6rem; align-items: stretch; }
/* A grid item is as wide as its widest select's longest option unless told otherwise
   ("Warranty ends after its alert window…" pushed a phone's inventory list sideways). */
.toolbar-stack > * { min-width: 0; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
/* The search box gives way before the Filters button wraps, so at 375 they share the row. */
.toolbar-row input[type="search"] { flex: 1 1 10rem; min-width: 8rem; }
.toolbar-row .filter-toggle, .toolbar-row [data-filter-clear] { flex: 0 0 auto; }
.filter-toggle[aria-expanded="true"] { background: var(--surface-hover); border-color: var(--blue-600); }
.filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.3rem; padding: 0 .4rem; border-radius: 999px;
  background: var(--blue-600); color: var(--on-primary); font-size: .72rem; font-weight: 700;
}
.filter-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding-top: .6rem; border-top: 1px dashed var(--border-strong);
}
.filter-checks { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; flex-basis: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer;
}
.chip:hover { background: var(--surface-hover); text-decoration: none; }
.chip.is-active { background: var(--blue-600); border-color: var(--blue-600); color: var(--on-primary); }
/* A device's groups under its name (partials/asset_detail.html), each a link to the list filtered to it. */
.group-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 0; padding: 0; list-style: none; }
a.chip { display: inline-block; text-decoration: none; }

.pager {
  display: flex; align-items: center; gap: .6rem; justify-content: flex-end;
  padding: .75rem 1.1rem; border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   The confirmation dialog (layout/base.html, app.js)
   -------------------------------------------------------------------------- */
dialog.confirm {
  width: min(26rem, calc(100vw - 2rem)); padding: 1.25rem 1.4rem; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.confirm::backdrop { background: rgba(15, 23, 42, .45); }
dialog.confirm h2 { font-size: 1.1rem; margin-bottom: .4rem; }
dialog.confirm p { margin: 0 0 1rem; font-size: .92rem; }
.confirm-actions { justify-content: flex-end; }

/* A form in a dialog (the inventory's add, import and categories): the
   confirm dialog's box, wider and scrolling when it's tall. */
dialog.panel-dialog {
  width: min(32rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto;
  padding: 1.1rem 1.4rem 1.4rem; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.panel-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.panel-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.panel-dialog-head h2 { font-size: 1.1rem; margin: 0; }
/* The submit row stays in reach while a tall form scrolls inside the dialog. */
.panel-dialog-foot {
  position: sticky; bottom: 0; margin: .75rem -1.4rem -1.4rem; padding: .75rem 1.4rem 1.1rem;
  background: var(--surface); border-top: 1px solid var(--border);
}
@media (max-width: 600px) {
  /* Edge to edge on a phone: one scroll, not a box inside a page. */
  dialog.panel-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; inset: 0; border: 0; border-radius: 0; }
}
.menu-divider { border: 0; border-top: 1px solid var(--border); margin: .25rem 0; }

/* --------------------------------------------------------------------------
   Toasts + messages
   -------------------------------------------------------------------------- */
#toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 90;
  display: flex; flex-direction: column; gap: .5rem; max-width: 22rem;
}
.toast {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .7rem .85rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: .88rem;
  animation: toast-in .16s ease-out;
}
.toast.level-success { border-left: 3px solid var(--ok); }
.toast.level-error   { border-left: 3px solid var(--danger); }
.toast.level-info    { border-left: 3px solid var(--info); }
.toast.level-warning { border-left: 3px solid var(--warn); }
.toast button {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; line-height: 1; padding: 0 .15rem;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.toast-link { font-weight: 600; white-space: nowrap; color: var(--info); }
/* Settings → Data retention: a period's long option ("Same as above (7 years)")
   mustn't widen the table past a phone (Stretch: 328px in 306). */
.retention-table select { width: 100%; min-width: 0; max-width: 100%; }
/* The headers ("Keeps finished tickets for") set the width too; let them wrap (Stretch). */
table.data.retention-table th { white-space: normal; }

.notice {
  padding: .7rem .9rem; border-radius: var(--radius); font-size: .88rem;
  border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 1rem;
}
.notice.warn   { background: var(--warn-bg);   border-color: var(--warn);   color: var(--warn); }
.notice.danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.notice.info   { background: var(--info-bg);   border-color: var(--info);   color: var(--info); }
/* A notice that asks something ("Times are in UTC"): its answers sit under its sentence,
   and at phone width a notice's buttons are thumb-sized, as the ticket page's controls are
   (Vincent and Stretch, 11 Nov 2026). */
.notice .btn-row { margin-top: .6rem; }
@media (max-width: 760px) { .notice .btn { min-height: 44px; } }
/* A secret shown once (the provisioning token): readable, selectable, and
   wrapped rather than overflowing on a phone. */
.secret-once p { margin: 0 0 .5rem; }
.secret-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.secret-value {
  flex: 1 1 16rem; min-width: 0; padding: .45rem .6rem; border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  font-size: .85rem; word-break: break-all; user-select: all;
}
.provisioning-actions { margin-top: 1rem; }
/* A notice that can be put away (the dashboard's spike alert). */
.spike-notice { position: relative; padding-right: 2.2rem; }
.notice-close {
  position: absolute; top: .45rem; right: .45rem; border: 0; background: none; cursor: pointer;
  color: inherit; font-size: 1.1rem; line-height: 1; padding: .2rem .35rem; border-radius: var(--radius);
}
.notice-close:hover { background: rgba(0, 0, 0, .06); }
.notice.ok     { background: var(--ok-bg);     border-color: var(--ok);     color: var(--ok); }

/* --------------------------------------------------------------------------
   Public pages
   -------------------------------------------------------------------------- */
.public { max-width: 1060px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.hero { padding: 3rem 0 2rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
.hero p.lede { font-size: 1.1rem; color: var(--text-muted); max-width: 40rem; margin: 0 auto 1.5rem; }
/* Landing page. Classes, not style="" attributes: the production CSP blocks
   inline styles, so they'd be ignored there (they only work in dev). */
.hero-actions { justify-content: center; }
.landing-features { margin: 2rem 0; }
.landing-heading { text-align: center; margin-bottom: 1.25rem; }
.landing-note { text-align: center; margin-top: 1rem; }
/* The App Store badge under the public heroes (partials/app_badges.html). Apple's badge
   rules: never under 40px tall on screen, and clear space of a quarter of its height on every
   side, which the link's padding keeps (12px at 48px tall). Room for a Google Play badge as a
   second item later. */
.app-badges { margin-top: 1.5rem; }
.app-badges .app-badges-line { margin: 0; }
.app-badges-list { list-style: none; margin: .25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; }
.app-badge { display: inline-block; padding: 12px; line-height: 0; border-radius: var(--radius); }
.app-badge img { display: block; height: 48px; width: auto; }
.auth-card {
  max-width: 26rem; margin: 3rem auto; padding: 1.75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.35rem; }
/* "This fixed it" from the AI reply's e-mail (pages/ai_solved.html). */
.auth-card.fixed-card { text-align: center; }
.fixed-card .fixed-mark {
  width: 3rem; height: 3rem; margin: 0 auto .75rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-bg); color: var(--ok); font-size: 1.5rem; font-weight: 700;
}
.fixed-card.is-asking .fixed-mark { background: var(--info-bg); color: var(--info); }
.fixed-card.is-sorry .fixed-mark { background: var(--muted-bg); color: var(--text-muted); }
.fixed-card .ticket-key { font-weight: 650; }
/* The satisfaction survey (Stretch; Brad's five faces): one row of five big targets even at
   375px, the face over its word (the word is what's read), the chosen one ringed in the
   accent. Shared by the e-mail's rating page and the requester's card on the ticket. */
.faces { display: flex; gap: .4rem; margin: .75rem 0; }
.face {
  flex: 1 1 0; min-width: 0; min-height: 68px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .2rem; padding: .5rem .15rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit;
  cursor: pointer; text-decoration: none;
}
.face .face-glyph { font-size: 1.75rem; line-height: 1; }
/* A word wraps only at a space ("Very" / "unhappy"), never inside a word or cut short (Stretch). */
.face .face-word { font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.15;
  overflow-wrap: normal; word-break: normal; hyphens: manual; }
@media (max-width: 400px) {
  .faces { gap: .25rem; }
  .face { padding: .5rem .1rem; }
  .face .face-word { font-size: .7rem; }
}
.face:hover { background: var(--surface-hover); }
.face[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.face:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.survey-card form { text-align: left; }
.survey-card form h1 { text-align: center; }
.survey-card .survey-actions { margin-top: .75rem; }
/* The requester's card on the ticket, and the rating in its Details. */
.survey-ask-title { font-size: 1rem; margin: 0 0 .25rem; }
.survey-ask-message { margin: 0; color: var(--text-muted); }
.survey-ask .survey-note { margin-top: .5rem; }
.survey-ask .survey-note textarea { width: 100%; }
.survey-comment { margin-top: .2rem; font-style: italic; color: var(--text-muted); overflow-wrap: anywhere; }
/* Settings → Requester e-mails → Satisfaction survey. */
.card-subhead { font-size: 1rem; margin: 0; padding: .9rem 1.1rem 0; border-top: 1px solid var(--border); }
.survey-settings .survey-message-field { flex: 2 1 18rem; }
.survey-dept-title { font-size: .95rem; margin: 1rem 0 .4rem; }
.survey-dept-table select, .survey-dept-table input[type="text"] { width: 100%; min-width: 0; }
/* Each select wide enough for "Same as organization (off)": with two such columns (ticket help)
   a phone scrolls the table in its box rather than clip the words to "S" (Musamil). */
.survey-dept-table select { min-width: 12.5rem; }
/* The ticket help table on a phone (Stretch): each department a block, its name first, then
   each setting's label (data-label) beside its select, so nothing waits off-screen for a swipe.
   The header stays for screen readers. */
@media (max-width: 600px) {
  table.help-dept-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  table.help-dept-table, table.help-dept-table tbody, table.help-dept-table tr, table.help-dept-table td {
    display: block; width: 100%;
  }
  table.help-dept-table tr { padding: .6rem 0; border-top: 1px solid var(--border); }
  table.help-dept-table tr:first-child { border-top: 0; }
  table.help-dept-table tbody tr:hover { background: none; }
  table.help-dept-table td { padding: .2rem 0; border: 0; }
  table.help-dept-table td.help-dept-name { font-weight: 650; }
  /* The label, then the select beside it, or under it, full width, where the line is too short. */
  table.help-dept-table td[data-label] { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
  table.help-dept-table td[data-label]::before {
    content: attr(data-label); flex: 0 0 7rem; font-size: .78rem; color: var(--text-muted);
  }
  table.help-dept-table td[data-label] select { flex: 1 1 12.5rem; min-width: 0; }
  table.help-dept-table td[data-label] .hint { flex-basis: 100%; margin: 0; }
}
.survey-dept-table td { vertical-align: top; }

/* --------------------------------------------------------------------------
   AI routing (Stretch's routing.html, 29 Oct): Settings → AI assistant → AI routing, the
   work profiles (People, a person's own Profile, a team) and the ticket's "Routed by AI"
   note. Shipped off, and drawn only where the server says routing is available.
   -------------------------------------------------------------------------- */
/* What leaves for the AI service, said under the switch. */
.disclosure {
  margin: .5rem 0 .9rem; padding: .5rem .75rem; font-size: .85rem;
  border-left: 3px solid var(--blue-500); background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
/* The administrator's confirmation, shown once the switch is on. */
.attest { margin: .6rem 0; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.attest[hidden] { display: none; }
.attest .check { margin: 0; align-items: flex-start; }
.attest .hint { margin: .4rem 0 0; }
.routing-intro { margin: .2rem 0 .6rem; }
/* Under the switch once routing is on (Brad, 31 Oct): what it does, and the policy's section. */
.notice.routing-on { margin: .4rem 0 .6rem; font-size: .85rem; }
.notice.routing-on a { white-space: nowrap; }
.route-table td:first-child { font-weight: 600; }
.route-table td.route-dept {
  background: var(--surface-2); font-size: .78rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text-muted);
}
.route-table select { width: 100%; min-width: 14rem; }
.routing-usage { margin-top: .8rem; }
.routing-personal { margin-top: .8rem; }
/* A team's work profile, folded under its name in the department's Teams table. */
.team-profile { margin-top: .35rem; }
.team-profile > summary { cursor: pointer; font-size: .85rem; }
.team-profile .pfields { margin-top: .5rem; min-width: 26rem; }
@media (max-width: 760px) { .team-profile .pfields { min-width: 0; } }
.routing-personal select { max-width: 22rem; }
/* A work profile: fixed, labelled lists (no free text): label, then chips from the school's own
   terms with an × each and "Add…", or the days and hours, or the open load. */
.pfields { display: grid; gap: .55rem; }
.pfield { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .3rem .6rem; align-items: start; }
.pfield .lbl { padding-top: .35rem; font-size: .78rem; font-weight: 650; color: var(--text-muted); }
.pfield .cap { font-weight: 400; }
/* Positioned, so the visually-hidden words in it ("to skills") stay inside a scrolling table. */
.chips-edit { position: relative; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.chips-edit .chip { cursor: default; }
.chips-edit .chip:hover { background: inherit; }
.chip-x {
  margin: 0 -.25rem 0 .3rem; padding: 0 .25rem; border: 0; background: none; color: inherit;
  font: inherit; line-height: 1; opacity: .6; cursor: pointer;
}
.chip-x:hover, .chip-x:focus-visible { opacity: 1; }
.chip-add {
  padding: .3rem .7rem; border: 1px dashed var(--border-strong); border-radius: 999px; background: transparent;
  font: inherit; font-size: .78rem; color: var(--text-muted); cursor: pointer;
}
.chip-add:hover { color: var(--text); border-color: var(--text-muted); }
.chip-picker { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.chip-picker[hidden] { display: none; }
.chip-picker select, .chip-picker input { width: auto; min-width: 12rem; }
.chip.is-suggested { border-style: dashed; border-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.load { padding-top: .35rem; font-size: .85rem; }
.days { display: flex; flex-wrap: wrap; gap: .25rem .8rem; }
.days .check { margin: 0; }
/* A day is a finger's width to tap on a phone (Stretch: 44px, as the survey's switches). */
@media (max-width: 600px) { .days .check { min-height: 2.75rem; padding: 0 .35rem; align-items: center; } }
.hours-range { display: inline-flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-top: .35rem; }
.hours-range select { width: auto; }
.hours-range .hint { margin: 0; }
/* The switch while the AI first reply is off: shown, but not offered. */
.check.is-unavailable { opacity: .6; }
.profile-rule { font-size: .85rem; }
.profile-rule ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.member-profile {
  display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: .6rem 1rem; align-items: start;
  padding: .7rem 0; border-top: 1px solid var(--border);
}
.member-profile .who strong { display: block; }
.member-profile .who .hint { margin: 0; }
.card-head-note { margin: 0 0 0 auto; }
.profiles-save { margin-top: .8rem; }
.profiles-save .hint { margin: 0; }
/* The heading's fold button (partials/work_profiles.html): the head stacks the button row (the
   title, with the Settings sections' chevron at the far right, turning when open), the note, then
   the summary; folded, the head loses its rule. 44px tall on a phone. */
.card-head-fold { flex-direction: column; align-items: stretch; gap: .2rem; }
.card-head-fold .card-head-note, .card-head-fold .profiles-count { margin: 0; }
.profiles-count .tone-warn { color: var(--warn); }               /* tone-warn is per-component here */
.card-toggle {
  display: flex; align-items: center; gap: .5rem; width: calc(100% + .8rem); margin: -.25rem -.4rem;
  padding: .25rem .4rem; border: 0; border-radius: var(--radius-sm); background: none; color: inherit;
  font: inherit; cursor: pointer; text-align: left;
}
.card-toggle:hover { background: var(--surface-hover); }
.card-toggle::after {
  content: ""; margin-left: auto; width: .55rem; height: .55rem; flex: none;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
.card-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { .card-toggle::after { transition: none; } }
.card-head-fold:has(.card-toggle[aria-expanded="false"]) { border-bottom: 0; }
@media (max-width: 760px) { .card-toggle { min-height: 44px; } }
/* A person's suggested change, waiting for an administrator. */
.suggestion {
  margin-top: .6rem; padding: .6rem .75rem; border: 1px dashed var(--border-input);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.suggestion .hint { margin: 0 0 .4rem; overflow-wrap: anywhere; }
.ai-suggested.tone-warn { background: var(--warn-bg); color: var(--warn); }
/* The ticket's note under its status: staff only, never the requester or an e-mail. */
.routed {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin: .6rem 0 0;
  padding: .55rem .75rem; border: 1px dashed var(--border-input); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: .85rem;
}
.routed .ai-suggested { margin-left: 0; }
.routed .routed-reassign { margin: 0; }
.routed .why { flex-basis: 100%; color: var(--text-muted); overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .member-profile, .pfield { grid-template-columns: minmax(0, 1fr); }
  .pfield .lbl { padding-top: 0; }
}
/* On a phone both routing tables stack like the ticket help table (help-dept-table). */
@media (max-width: 600px) {
  /* Where each kind of ticket goes: each label above its select at full width, so a long choice
     ("Let the AI choose in Facilities") reads whole (Stretch, as Branding's stacked cells). */
  table.help-dept-table.route-table td[data-label] { display: block; }
  table.help-dept-table.route-table td[data-label]::before { display: block; margin-bottom: .15rem; }
  table.help-dept-table.route-table td[data-label] select { width: 100%; min-width: 0; }
  table.help-dept-table.route-table td.route-dept { padding: .3rem .5rem; }
  .ai-usage.routing-usage { display: grid; gap: .4rem; }
}
/* Room between the department table and Save, in the survey card and the Suggested articles
   card, which shares .survey-settings (Stretch). */
.survey-settings .table-wrap { margin-bottom: .75rem; }
.fixed-card form p:first-of-type { margin-top: 0; }
.fixed-card [data-ai-solved-fallback] p, .fixed-card [data-ai-report-fallback] p { color: var(--text-muted); }
.fixed-card form h1, .fixed-card [data-ai-solved-fallback] h1, .fixed-card [data-ai-report-fallback] h1 { margin-top: 0; }
/* "Report this reply" from the e-mail (pages/ai_report.html): the reason box reads
   left-to-right under its label, the rest stays centred. */
.fixed-card.is-asking:has([data-ai-report]) .fixed-mark { background: var(--warn-bg); color: var(--warn); }
.fixed-card [data-ai-report] label { display: block; text-align: left; font-weight: 600; font-size: .9rem; margin: .25rem 0 .3rem; }
.fixed-card [data-ai-report] textarea { width: 100%; box-sizing: border-box; margin-bottom: .75rem; }
/* The 404 and 500 pages: an auth-card with a big faint code above the heading. */
.error-page { text-align: center; }
.error-page .btn-row { justify-content: center; margin-top: 1rem; }
.error-page .page-sub { font-size: .95rem; }
.error-code {
  margin: 0 0 .25rem; font-size: 3rem; font-weight: 800; line-height: 1;
  letter-spacing: -.04em; color: var(--blue-200);
}
.plan {
  display: flex; flex-direction: column;
  padding: 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.plan.is-featured { border-color: var(--blue-600); box-shadow: var(--shadow); }
.plan .price { font-size: 1.5rem; font-weight: 700; margin: .25rem 0 .75rem; }
.plan ul { margin: 0 0 1rem; padding-left: 1.1rem; font-size: .88rem; color: var(--text-muted); }
.plan li { margin-bottom: .3rem; }
.plan .btn { margin-top: auto; }

/* allauth entrance pages: the primary action owns the full width. */
.auth-card .btn-primary { width: 100%; }
.auth-card form { margin-bottom: .5rem; }
.auth-card h2 { font-size: 1rem; color: var(--text-muted); margin-top: 1.25rem; }
.auth-panel { margin-bottom: 1rem; }
.auth-panel .btn-row { margin-top: .75rem; }
.auth-back { margin-top: 1.25rem; }
hr.rule { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* Provider buttons (allauth socialaccount) */
.socialaccount_providers, .provider-list { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .5rem; }
.socialaccount_providers a, .provider-list a {
  display: block; text-align: center; padding: .5rem .9rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-weight: 600; font-size: .88rem; color: var(--text); background: var(--surface);
}
.socialaccount_providers a:hover, .provider-list a:hover { background: var(--surface-hover); text-decoration: none; }

/* Sign in with Google / Microsoft as each provider publishes its button (Stretch's spec,
   ~/TicketHappy-stretch-mocks/providers/provider-buttons-spec.md, 7 Nov 2026). Sources: Google,
   https://developers.google.com/identity/branding-guidelines (colours, 12/10/12 padding, the G);
   Microsoft, https://learn.microsoft.com/en-us/entra/identity-platform/howto-add-branding-in-apps
   and its ms-symbollockup_signin_light/dark.svg (41px, the mark 13px in, 14px to the text,
   square corners, colours). The fonts they name (Google Sans, Segoe UI) aren't loaded under
   our CSP, so the system font at their sizes and weights. The logos are never recoloured; the
   sign-in pages are never branded, so no --brand here. Light, and dark for the dark themes. */
:root {
  --gsi-bg: #ffffff; --gsi-border: #747775; --gsi-text: #1f1f1f;
  --msi-bg: #ffffff; --msi-border: #8c8c8c; --msi-text: #5e5e5e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --gsi-bg: #131314; --gsi-border: #8e918f; --gsi-text: #e3e3e3;
    --msi-bg: #2f2f2f; --msi-border: transparent; --msi-text: #ffffff;
  }
}
:root[data-theme="dark"], :root[data-theme="terminal"], :root[data-theme="mono"] {
  --gsi-bg: #131314; --gsi-border: #8e918f; --gsi-text: #e3e3e3;
  --msi-bg: #2f2f2f; --msi-border: transparent; --msi-text: #ffffff;
}
/* .auth-card form adds a bottom margin; the provider forms sit by the list's own 8px gap. */
.auth-card .provider-form, .provider-form { margin: 0; }
.provider-btn {
  display: flex; align-items: center; width: 100%; box-sizing: border-box; margin: 0;
  font-family: inherit; text-align: left; cursor: pointer; white-space: nowrap;
}
.provider-btn .provider-logo { flex: none; display: block; }
/* Google: 40px, 4px corners, 1px inside stroke; 12px to the G, 10px to the text, 12px after. */
.provider-btn-google {
  height: 40px; padding: 0 11px; gap: 10px; border: 1px solid var(--gsi-border); border-radius: 4px;
  background: var(--gsi-bg); color: var(--gsi-text); font-size: 14px; line-height: 20px; font-weight: 500;
}
/* Microsoft: 41px, square; the 19px mark (in its 21px file) 13px from the edge, 14px to the text. */
.provider-btn-microsoft {
  height: 41px; padding: 0 12px 0 11px; gap: 13px; border: 1px solid var(--msi-border); border-radius: 0;
  background: var(--msi-bg); color: var(--msi-text); font-size: 15px; line-height: 20px; font-weight: 400;
}
/* Hover and pressed: 8% and 12% of the text colour mixed into the fill, the logo untouched. */
.provider-btn-google:hover { background: color-mix(in srgb, var(--gsi-text) 8%, var(--gsi-bg)); }
.provider-btn-google:active { background: color-mix(in srgb, var(--gsi-text) 12%, var(--gsi-bg)); }
.provider-btn-microsoft:hover { background: color-mix(in srgb, var(--msi-text) 8%, var(--msi-bg)); }
.provider-btn-microsoft:active { background: color-mix(in srgb, var(--msi-text) 12%, var(--msi-bg)); }
.provider-btn-other { width: 100%; }
.provider-list.sso-link { margin-top: 1rem; }
.provider-hint { margin-top: 0; }

.divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.1rem 0; color: var(--text-muted); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .08em;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* --------------------------------------------------------------------------
   HTMX feedback
   -------------------------------------------------------------------------- */
.htmx-indicator { opacity: 0; transition: opacity .15s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-swapping { opacity: .45; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--blue-200); border-top-color: var(--blue-600);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* Stretch, so the content column is the screen's width and wide tables
     and charts scroll inside their own wrappers instead of widening the page. */
  .shell { flex-direction: column; align-items: stretch; }
  /* Every topbar fits a 320px screen instead of widening the page: the logo
     loses its name and the theme toggle says just "Dark"/"Light" (both still
     read out), buttons never wrap, and long organization names truncate.
     The app's bar also folds its account controls into a menu. */
  .topbar { gap: .5rem; padding: 0 .75rem; }
  .brand-name, .topbar > .btn .theme-word, .account-name, .account-caret {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .topbar > .btn { flex: none; white-space: nowrap; }
  .brand { min-width: 0; }
  .topbar .badge, .brand-org, .brand-sub {
    display: block; min-width: 0; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .help-brand { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.25; }
  .help-brand .brand-sub { margin-top: 0; }
  .org-switcher { min-width: 0; }
  .topbar-menu { right: .75rem; }
  .sidebar {
    position: static; width: 100%; flex: none; height: auto;
    border-right: 0; border-bottom: 1px solid var(--border);
    display: flex; gap: .35rem; overflow-x: auto; padding: .6rem;
  }
  .nav-group { display: flex; gap: .35rem; margin: 0; }
  .nav-label { display: none; }
  .nav-link { white-space: nowrap; }
  .nav-collapse { display: none; }
  .content { padding: 1rem; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  /* Counters two to a row, so the dashboard's numbers fit one screen. */
  .grid.cols-4, .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .stat { padding: .8rem .9rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-note { font-size: .76rem; }

  /* A policy table (retention, subprocessors) as a stack of labelled blocks,
     one per row, instead of four squeezed columns and a sideways scroll. */
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td {
    display: block; width: 100%;
  }
  table.table-stack thead { display: none; }
  table.table-stack tr { padding: .7rem 0 .8rem; border-bottom: 1px solid var(--border); }
  table.table-stack tr:last-child { border-bottom: 0; }
  table.table-stack td { padding: .3rem 0; border: 0; white-space: normal; }
  table.table-stack td::before {
    content: attr(data-label); display: block; margin-bottom: .1rem;
    font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-muted);
  }
  /* The first cell names the row, so it's the block's heading. */
  table.table-stack td:first-child::before { display: none; }
  table.table-stack td:first-child { font-size: 1rem; padding-bottom: .35rem; }

  /* The ticket list's filters, two to a row. */
  .filter-panel > select, .filter-panel > input,
  .filter-panel > .contents > select, .filter-panel > .contents > input,
  .filter-panel > .filter-dropdown { flex: 1 1 calc(50% - .25rem); min-width: 0; width: auto; }
  .filter-dropdown > summary { display: block; text-align: left; }

  /* The bulk bar outranks the Setup tab in the corner while rows are ticked. */
  .bulk-bar { z-index: 26; }
}

/* Under 900px the queue table needs a sideways scroll for its columns, so
   from there down it's the card layout, as on a phone. */
@media (max-width: 900px) {
  /* The ticket queue as a stack of cards, so nothing scrolls sideways: the
     subject on top, then the badges, then who has it and since when. (The
     table.* selectors outrank the table.data cell rules above.) */
  table.ticket-table, table.ticket-table tbody { display: block; width: 100%; }
  table.ticket-table thead { display: none; }
  table.ticket-table tr {
    display: grid; grid-template-columns: auto auto auto minmax(0, 1fr);
    grid-template-areas: "sel subj subj subj" "sel st pr sla" "sel who when when";
    align-items: center; gap: .35rem .5rem;
    padding: .7rem .85rem; border-bottom: 1px solid var(--border);
  }
  table.ticket-table.no-select tr {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas: "subj subj subj" "st pr sla" "who when when";
  }
  table.ticket-table td {
    display: block; width: auto; min-width: 0; padding: 0; border: 0; white-space: normal;
  }
  table.ticket-table td.select { grid-area: sel; align-self: start; padding-top: .2rem; }
  table.ticket-table td.col-subject { grid-area: subj; }
  table.ticket-table td.col-status { grid-area: st; }
  table.ticket-table td.col-priority { grid-area: pr; }
  table.ticket-table td.col-sla { grid-area: sla; }
  table.ticket-table td.col-assignee, table.ticket-table td.col-opened {
    font-size: .8rem; color: var(--text-muted); text-align: left;
  }
  table.ticket-table td.col-assignee { grid-area: who; }
  table.ticket-table td.col-assignee:not(:empty)::after { content: "\00a0\00b7"; }
  table.ticket-table td.col-opened { grid-area: when; }
  table.ticket-table td.col-opened::before { content: "opened "; }
  /* With nobody assigned the "who" cell is empty, so "opened" starts the line. */
  table.ticket-table td.col-assignee:empty ~ td.col-opened { grid-area: auto; grid-row: 3; grid-column: 2 / -1; }
  table.ticket-table.no-select td.col-assignee:empty ~ td.col-opened { grid-column: 1 / -1; }
  table.ticket-table .col-activity { display: none; }
  table.ticket-table tbody tr:hover { background: var(--surface-hover); }
}

/* The inventory list under 900px, the same way: the name and tag on top,
   then the status, holder and warranty badges, then open tickets and Delete. */
@media (max-width: 900px) {
  table.asset-table, table.asset-table tbody { display: block; width: 100%; }
  table.asset-table thead { display: none; }
  table.asset-table tr {
    display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "sel asset asset asset asset" "sel st held warr warr" "sel open open open del";
    align-items: center; gap: .35rem .5rem;
    padding: .7rem .85rem; border-bottom: 1px solid var(--border);
  }
  table.asset-table.no-select tr {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas: "asset asset asset" "st held warr" "open open open";
  }
  table.asset-table td {
    display: block; width: auto; min-width: 0; padding: 0; border: 0; white-space: normal;
  }
  table.asset-table td.select { grid-area: sel; align-self: start; padding-top: .2rem; }
  table.asset-table td.col-asset { grid-area: asset; }
  table.asset-table td.col-asset .ticket-key { white-space: normal; overflow-wrap: anywhere; }
  table.asset-table td.col-status { grid-area: st; }
  table.asset-table td.col-holder { grid-area: held; font-size: .85rem; }
  table.asset-table td.col-holder > .hint:only-child { display: none; }   /* no "—" between the badges */
  table.asset-table td.col-warranty { grid-area: warr; }
  table.asset-table td.col-open { grid-area: open; text-align: left; font-size: .8rem; color: var(--text-muted); }
  table.asset-table td.col-open::before { content: "open tickets: "; }
  table.asset-table td.row-actions { grid-area: del; text-align: right; }
  table.asset-table tbody tr:hover { background: var(--surface-hover); }
}

/* --------------------------------------------------------------------------
   Departments and teams
   -------------------------------------------------------------------------- */
.department-card .card-head { flex-wrap: wrap; }
.department-people { border-top: 1px solid var(--border); }
.department-people h3 { font-size: .95rem; margin: 0 0 .5rem; }
.department-people h3.spaced, .department-people .spaced { margin-top: 1rem; }
.department-settings > summary { cursor: pointer; color: var(--text-muted); font-weight: 600; }
.department-settings[open] > summary { margin-bottom: .75rem; }
.form-row-end { flex: 0 0 auto; align-self: flex-end; }
.team-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.team-chip {
  display: inline-flex; align-items: center;
  padding: .15rem .55rem; border-radius: 999px;
  border: 1px dashed var(--border-strong); background: transparent;
  font: inherit; font-size: .76rem; color: var(--text-muted); cursor: pointer;
}
span.team-chip { cursor: default; }
.team-chip.is-on { border-style: solid; border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
button.team-chip:hover { border-color: var(--accent); }
.intake-list { list-style: none; padding: 0; margin: .25rem 0 .5rem; display: grid; gap: .35rem; }
.intake-list li { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; }
.intake-list li > span { font-weight: 600; }
/* Addresses break only before "@" and "+" (the break_email filter), and
   anywhere only if a piece is still too wide for the line. */
.intake-list code { word-break: normal; overflow-wrap: anywhere; }
.spaced-form { margin-top: 1rem; }

/* --------------------------------------------------------------------------
   Public knowledge base branding (Settings → Branding): the colours, font and background
   are variables in the organization's own stylesheet (/help/<slug>/brand/theme.css:
   --brand, --brand-ink, --brand-accent, --brand-accent-ink, --brand-surface,
   --brand-heading, --brand-font, --help-background); the top bar's and the background's
   styles are data-help-header and data-help-background on .help-layout.
   -------------------------------------------------------------------------- */
.help-layout { font-family: var(--brand-font, var(--font)); }
.help-topbar { border-top: 4px solid var(--brand, var(--blue-600)); }
.help-layout[data-help-header="bar"] .help-topbar {
  border-top: 0; background: var(--brand, var(--blue-600)); color: var(--brand-ink, #fff);
}
/* The name and "Knowledge base" sit inside .help-brand, a .brand link with its own text
   colour, so the link takes the bar's ink too (Musamil: #0f172a on Forest was 3.3:1). */
.help-layout[data-help-header="bar"] .help-topbar .help-brand,
.help-layout[data-help-header="bar"] .help-topbar .brand-org,
.help-layout[data-help-header="bar"] .help-topbar .brand-sub,
.help-layout[data-help-header="bar"] .help-topbar .btn-ghost { color: inherit; }
.help-layout[data-help-header="bar"] .help-topbar .btn-ghost:hover {
  background: color-mix(in srgb, var(--brand-ink, #fff) 15%, transparent);
}
/* The top bar's own button (Sign in, Open TicketHappy), Stretch: on a bar, an outline in
   the bar's ink; on the plain stripe, the accent and its ink, as Raise a ticket. */
.help-layout .help-topbar .btn:not(.btn-ghost) {
  background: var(--brand-accent, var(--brand, var(--blue-600))); border-color: var(--brand-accent, var(--brand, var(--blue-600)));
  color: var(--brand-accent-ink, var(--brand-ink, #fff));
}
.help-layout[data-help-header="bar"] .help-topbar .btn:not(.btn-ghost) {
  background: transparent; border: 1px solid var(--brand-ink, #fff); color: var(--brand-ink, #fff);
}
.help-layout[data-help-header="bar"] .help-topbar .btn:not(.btn-ghost):hover {
  background: color-mix(in srgb, var(--brand-ink, #fff) 15%, transparent);
}
.help-logo { display: block; max-height: 2.5rem; max-width: 14rem; width: auto; height: auto; }
/* The band behind the search. Its tint is always light, so its words stay dark whatever
   the visitor's theme; on a gradient or a photo they're --help-background-ink (Evan: the
   ink that reads at the gradient's worse end; white on a darkened photo). */
.help-hero {
  padding: 2.5rem 1rem 1.75rem; margin-top: 1rem; border-radius: var(--radius-lg);
  background: var(--help-background, var(--brand-surface, color-mix(in srgb, var(--blue-600) 8%, white)));
  color: #0f172a;
}
.help-hero h1 { color: var(--brand-heading, #0f172a); }
/* "p.lede" beats ".hero p.lede" (the public hero's muted text), which in a dark theme turned
   the band's words grey on its always-light tint (2.1:1; accessibility pass, 6 Nov 2026). */
.help-hero p.lede, .help-hero .lede { color: #334155; }
.help-layout[data-help-background="gradient"] .help-hero,
.help-layout[data-help-background="gradient"] .help-hero h1,
.help-layout[data-help-background="gradient"] .help-hero .lede,
.help-layout[data-help-background="image"] .help-hero,
.help-layout[data-help-background="image"] .help-hero h1,
.help-layout[data-help-background="image"] .help-hero .lede { color: var(--help-background-ink, #fff); }
.help-layout .btn-primary {
  background: var(--brand-accent, var(--brand, var(--blue-600))); border-color: var(--brand-accent, var(--brand, var(--blue-600)));
  color: var(--brand-accent-ink, var(--brand-ink, #fff));
}
.help-layout .help-search input[type="search"]:focus { border-color: var(--brand, var(--blue-600)); }
.help-layout :focus-visible { outline-color: var(--brand, var(--blue-600)); }


/* --------------------------------------------------------------------------
   The guide (/guide/): contents on the left, sticky on wide screens.
   -------------------------------------------------------------------------- */
.guide { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; padding: 2rem 0 4rem; align-items: start; }
.guide-toc { position: sticky; top: 1rem; font-size: .88rem; }
.guide-toc-title { font-weight: 700; margin: 0 0 .5rem; }
.guide-toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.guide-body { max-width: 46rem; line-height: 1.65; }
/* A guide page without a contents list (Delete your account, Support) is one column: the grid's
   15rem contents column held the whole article on a computer and left the rest empty. */
.guide:not(:has(> .guide-toc)) { grid-template-columns: minmax(0, 1fr); }
.guide-head h1 { margin-top: 0; }
.guide-section { padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--border); scroll-margin-top: 1rem; }
.guide-section h2 { margin-top: 0; }
.guide-section h3 { margin: 1.4rem 0 .4rem; font-size: 1.05rem; }
.guide-section h4 { margin: 1.1rem 0 .3rem; font-size: .95rem; }
.guide-steps { padding-left: 1.3rem; display: grid; gap: .45rem; }
.guide-section code { overflow-wrap: anywhere; }
.guide-section .table-wrap { margin: .75rem 0 1rem; }
.guide-faq dt { font-weight: 700; margin-top: 1rem; }
/* Where a tutorial's screenshot (later, its video) goes: a labelled frame. */
.tutorial-shot {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 7rem; margin: .75rem 0 1.25rem; padding: 1rem 1.25rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-muted); font-size: .85rem;
}
/* With the screenshot in it: a plain frame, the picture scaled to the column. */
.tutorial-shot.has-image { display: block; min-height: 0; padding: 0; border-style: solid; overflow: hidden; }
.tutorial-shot.has-image img { display: block; width: 100%; height: auto; }
.guide-toc ol ol { margin-top: .35rem; padding-left: 1rem; font-size: .84rem; }
.guide-faq dd { margin: .25rem 0 0; }
@media (max-width: 860px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .guide-toc { position: static; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
}

/* Stripe Checkout inside the Billing page (static/js/checkout.js). */
.embedded-checkout [data-checkout-mount] { min-height: 2rem; }

/* Small lists inside a card (e.g. people copied in on a ticket). */
.plain-list { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .35rem; }
.plain-list li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.plain-list li .btn { margin-left: auto; }
/* A one-line form: a field and its button side by side. */
/* Choosing a ticket to merge into or link under (partials/ticket_pick.html). */
.ticket-picker { position: relative; }
.pick-results:empty { display: none; }
.pick-results {
  margin: -.25rem 0 .6rem; max-height: 18rem; overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li + li { border-top: 1px solid var(--border); }
.pick-option {
  display: grid; grid-template-columns: auto 1fr; gap: .1rem .5rem; width: 100%;
  padding: .5rem .7rem; border: 0; background: none; color: var(--text);
  font: inherit; font-size: .85rem; text-align: left; cursor: pointer;
}
.pick-option:hover, .pick-option:focus-visible { background: var(--surface-hover); outline: none; }
.pick-subject { font-weight: 600; overflow-wrap: anywhere; }
.pick-meta {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  font-size: .76rem; color: var(--text-muted);
}
.pick-empty { padding: .6rem .7rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.inline-form input, .inline-form select { flex: 1 1 10rem; min-width: 0; }
.inline-form .btn { flex: none; }
.field > .inline-form { margin-bottom: 0; }

/* @mentions in an internal note: the list of colleagues under the reply box. */
.mention-anchor { position: relative; }
.mention-list {
  position: absolute; z-index: 12; left: 0; right: 0; top: 100%; margin-top: .25rem;
  max-height: 14rem; overflow-y: auto; padding: .25rem;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.mention-option {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; width: 100%;
  padding: .45rem .7rem; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text); font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
}
.mention-option:hover, .mention-option[aria-selected="true"] { background: var(--surface-hover); }
.mention-handle { color: var(--text-muted); font-family: var(--mono); font-size: .78rem; }

/* The reply box under a ticket's conversation: set off from the thread, with
   the note switch and Send on one line. */
.reply-form { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.reply-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem .75rem;
}
.reply-foot .check { margin: 0; flex: 1 1 18rem; min-width: 0; }   /* wraps its words, keeps Send on the right */
/* Send and, for staff on a public reply, Send and resolve beside it. The spinner
   inside each button takes no room until the request is running, so "Send" sits
   centred in a button the app's usual size. */
.reply-send { display: flex; gap: .5rem; margin-left: auto; }
.reply-send .btn { white-space: nowrap; }
.reply-send .htmx-indicator { display: none; }
.reply-send .htmx-request .htmx-indicator, .reply-send .htmx-request.htmx-indicator,
.htmx-request .reply-send .htmx-indicator { display: inline-block; }
.reply-foot:has(input[name="is_internal"]:checked) [data-reply-resolve] { display: none; }
/* Send and resolve with a main ticket's linked ones: the warning only while it's ticked. */
.reply-linked { flex: 1 1 100%; }
.reply-linked .check { margin: 0; }
.reply-linked .hint { display: none; margin: .25rem 0 0 1.6rem; color: var(--warn); }
.reply-linked:has(input:checked) .hint { display: block; }
@media (max-width: 600px) {
  .reply-send { width: 100%; margin-left: 0; }
  .reply-send .btn { flex: 1 1 0; }
}

/* Articles that match a new ticket's subject as it's typed (partials/kb_suggest.html). */
.kb-suggest-slot:empty { display: none; }
.kb-suggest {
  margin: .5rem 0 0; padding: .55rem .75rem;
  border: 1px solid var(--info); border-radius: var(--radius-sm); background: var(--info-bg);
  font-size: .85rem;
}
.kb-suggest-title { margin: 0 0 .25rem; font-weight: 650; color: var(--info); }
.kb-suggest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.kb-suggest-list a { font-weight: 600; }
.kb-suggest-list .hint { display: block; margin: 0; }

/* The reminder under a ticket's text boxes not to type in secrets or
   personal details (partials/sensitive_note.html). */
.sensitive-note {
  display: flex; align-items: flex-start; gap: .45rem;
  margin: .4rem 0 0; padding: .45rem .65rem;
  font-size: .78rem; line-height: 1.45; color: var(--text-muted);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.sensitive-note svg { flex: none; margin-top: .1rem; }

/* Small spacing utilities, for what used to be style="" attributes: the
   production CSP (style-src 'self') ignores inline styles, so they only ever
   worked in development. */
.u-mt-1 { margin-top: 1rem; }
.u-mt-half { margin-top: .5rem; }
.u-mt-075 { margin-top: .75rem; }
.u-mt-125 { margin-top: 1.25rem; }
.u-mb-1 { margin-bottom: 1rem; }
.u-w-full { width: 100%; }
.u-p-075 { padding: .75rem; }
.u-p-tight { padding: .4rem .75rem; }
.u-m-0 { margin: 0; }
.u-pl-list { padding-left: 1.1rem; }
.u-px-0 { padding-left: 0; padding-right: 0; }
.u-narrow-field { min-width: 8rem; flex: 0 1 9rem; }
.u-max-32 { max-width: 32rem; }
.u-flex-none { flex: 0 0 auto; }
.u-bare { border: 0; padding: 0; }
.u-break { overflow-wrap: anywhere; }

/* A row's own small buttons, at the end of a table row (the inventory's Delete). */
td.row-actions { width: 1%; white-space: nowrap; text-align: right; }
/* The import preview's two tables, under the outcome. */
.import-heading { font-size: .95rem; margin: 1rem 0 .4rem; }
/* A tag or name with no spaces (a QR address, up to 60 characters in the
   preview) breaks anywhere rather than pushing the Problem column out of view
   (Musamil, 14 Nov 2026). */
table.import-rows td.import-cell { overflow-wrap: anywhere; min-width: 5rem; }
/* The same for a column's Sample one step up, which holds the same long value
   and pushed the "Becomes" selects out of view (Stretch, 14 Nov 2026). */
table.import-columns td.import-cell { overflow-wrap: anywhere; min-width: 5rem; }
/* Rooms: Start a stocktake beside Change, on one line. */
.room-table td.row-actions > form { display: inline-block; vertical-align: top; }
/* A phone (Musamil: 13px too wide at 375px): each room is a small grid, its
   name, devices and last stocktake on one line, the buttons on their own below,
   free to wrap; the Change form opens full width. */
@media (max-width: 600px) {
  /* The name and the last-stocktake line both give and wrap: an auto column would take the whole
     "Last stocktake 27 October 2026 · 3 missing" line and push the name under it. */
  .room-table thead tr, .room-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr); }
  .room-table td.room-stocktake { white-space: normal; overflow-wrap: anywhere; }
  .room-table thead th:last-child { display: none; }
  .room-table td.row-actions {
    grid-column: 1 / -1; width: auto; white-space: normal; text-align: left;
    display: flex; flex-wrap: wrap; gap: .4rem; padding-top: 0;
  }
  .room-table td.row-actions details.row-actions { flex: 1 1 100%; }
  .room-table td.row-actions details .form-row { flex-direction: column; align-items: stretch; }
  /* .form-row > * grows to 180px, which in a column is height (Stretch). */
  .room-table td.row-actions .form-row > * { flex: 0 0 auto; }
  .room-table td.row-actions .form-row > .btn { align-self: flex-start; }
}
.member-role select { min-width: 9.5rem; }

/* --------------------------------------------------------------------------
   Themes
   Picked per person from the account menu and saved on the account
   (User.theme); layout/app.html renders it as data-theme on <html>. Each is a
   token swap like the dark theme above. The --blue-* scale is the theme's
   accent, whatever its color. Two terminals, two light themes.
   -------------------------------------------------------------------------- */

/* Green terminal: phosphor green on black, monospace, square corners. */
:root[data-theme="terminal"] {
  color-scheme: dark;
  --blue-50:  #062b0e; --blue-100: #0a3d14; --blue-200: #14632a; --blue-300: #4dff7a;
  --blue-500: #2bd957; --blue-600: #33ff66; --blue-700: #66ff8c; --blue-800: #99ffb3; --blue-900: #ccffd9;
  --on-primary: #000000;
  --bg:            #000000;
  --surface:       #030803;
  --surface-2:     #071207;
  --surface-hover: #0b2410;
  --border:        #14501f;
  --border-strong: #1f7a2e;
  --border-input:  #1f7a2e;
  --text:          #33ff66;
  --text-muted:    #22b347;
  --text-inverse:  #000000;
  --link:          #7dffa0;
  --ok:     #33ff66;  --ok-bg:     #062b0e;
  --warn:   #ffd23f;  --warn-bg:   #2b2200;
  --danger: #ff5c5c;  --danger-bg: #2e0808;
  --info:   #7dffa0;  --info-bg:   #0a2b12;
  --accent: #c6ff66;  --accent-bg: #1c2b06;
  --muted-bg: #0a170b;
  --series-1: #33ff66;
  --series-2: #ffd23f;
  --radius: 2px; --radius-sm: 2px; --radius-lg: 3px;
  --shadow-sm: none; --shadow: 0 0 0 1px #14501f; --shadow-lg: 0 0 0 1px #1f7a2e, 0 8px 24px rgba(0, 0, 0, .8);
  --ring: 0 0 0 2px rgba(51, 255, 102, .55);
  --font: var(--mono);
}
:root[data-theme="terminal"] body { text-shadow: 0 0 3px rgba(51, 255, 102, .35); }

/* Black and white terminal: white on black, monospace. Status colors are kept
   faint so badges still mean something. */
:root[data-theme="mono"] {
  color-scheme: dark;
  --blue-50:  #141414; --blue-100: #1f1f1f; --blue-200: #4a4a4a; --blue-300: #ffffff;
  --blue-500: #cccccc; --blue-600: #e8e8e8; --blue-700: #ffffff; --blue-800: #ffffff; --blue-900: #ffffff;
  --on-primary: #000000;
  --bg:            #000000;
  --surface:       #0a0a0a;
  --surface-2:     #111111;
  --surface-hover: #1c1c1c;
  --border:        #333333;
  --border-strong: #5a5a5a;
  --border-input:  #6e6e6e;
  --text:          #e8e8e8;
  --text-muted:    #a3a3a3;
  --text-inverse:  #000000;
  --link:          #ffffff;
  --ok:     #a7e0a7;  --ok-bg:     #142014;
  --warn:   #e6d690;  --warn-bg:   #22200f;
  --danger: #ff9d9d;  --danger-bg: #2a1212;
  --info:   #ffffff;  --info-bg:   #222222;
  --accent: #d6d6d6;  --accent-bg: #262626;
  --muted-bg: #161616;
  --series-1: #ffffff;
  --series-2: #8a8a8a;
  --radius: 0; --radius-sm: 0; --radius-lg: 0;
  --shadow-sm: none; --shadow: 0 0 0 1px #333333; --shadow-lg: 0 0 0 1px #5a5a5a, 0 8px 24px rgba(0, 0, 0, .8);
  --ring: 0 0 0 2px rgba(255, 255, 255, .6);
  --font: var(--mono);
}
:root[data-theme="mono"] a { text-decoration: underline; text-underline-offset: 2px; }
:root[data-theme="mono"] .btn, :root[data-theme="mono"] .nav-link { text-decoration: none; }

/* Forest: light, sage and pine, with bark brown as the second color. */
:root[data-theme="forest"] {
  --blue-50:  #e8f3ea; --blue-100: #d2e8d6; --blue-200: #a9d2b2; --blue-300: #7fbf8e;
  --blue-500: #3f8f52; --blue-600: #2f7a43; --blue-700: #256536; --blue-800: #1d5129; --blue-900: #163d20;
  --bg:            #eef3ea;
  --surface:       #fbfcf8;
  --surface-2:     #f3f7ef;
  --surface-hover: #e3eddc;
  --border:        #d3dfcb;
  --border-strong: #b5c7aa;
  --border-input:  #76906a;
  --text:          #1c2b1f;
  --text-muted:    #55705a;
  --link:          #256536;
  --accent: #8a5a2b;  --accent-bg: #f3e7da;
  --muted-bg: #e6eee0;
  --series-1: #2f7a43;
  --series-2: #b5651d;
  --ring: 0 0 0 3px #a9d2b2;
}
:root[data-theme="forest"] .topbar { border-bottom: 3px solid var(--blue-600); }

/* Glitter: pink, with sparkles in the background and a shimmer on primary
   buttons (still when the device asks for reduced motion). */
:root[data-theme="glitter"] {
  --blue-50:  #fff0f7; --blue-100: #ffd6ea; --blue-200: #ffb3d6; --blue-300: #ff8fc4;
  --blue-500: #ff4fa3; --blue-600: #cf1f78; --blue-700: #b0175f; --blue-800: #9e165c; --blue-900: #7a1047;
  --bg:            #fff0f7;
  --surface:       #ffffff;
  --surface-2:     #fff6fb;
  --surface-hover: #ffe4f1;
  --border:        #f8cfe3;
  --border-strong: #f0a8cb;
  --border-input:  #d66aa0;
  --text:          #4a1036;
  --text-muted:    #94497a;
  --link:          #c21f73;
  --info:   #c21f73;  --info-bg: #ffe4f1;
  --accent: #7c3aed;  --accent-bg: #f1e8ff;
  --muted-bg: #fbe3ef;
  --series-1: #e6338c;
  --series-2: #7c3aed;
  --radius: 14px; --radius-sm: 9px; --radius-lg: 20px;
  --shadow: 0 4px 16px rgba(230, 51, 140, .12);
  --shadow-lg: 0 12px 32px rgba(230, 51, 140, .18);
  --ring: 0 0 0 3px #ffb3d6;
}
:root[data-theme="glitter"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, .95) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 63% 41%, rgba(255, 143, 196, .8) 0 1px, transparent 2px),
    radial-gradient(circle at 37% 77%, rgba(176, 114, 255, .55) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 86% 64%, rgba(255, 255, 255, .9) 0 1px, transparent 2px),
    radial-gradient(circle at 24% 52%, rgba(255, 215, 120, .6) 0 1px, transparent 2px);
  background-size: 140px 140px, 95px 95px, 170px 170px, 60px 60px, 120px 120px;
  background-attachment: fixed;
}
:root[data-theme="glitter"] .topbar {
  border-bottom: 0;
  box-shadow: 0 3px 0 0 transparent;
  background-image: linear-gradient(var(--surface), var(--surface)),
    linear-gradient(90deg, #ff8fc4, #e6338c, #b072ff, #ffd778, #ff8fc4);
  background-size: 100% calc(100% - 3px), 100% 3px;
  background-position: top, bottom;
  background-repeat: no-repeat;
}
:root[data-theme="glitter"] .btn-primary,
:root[data-theme="glitter"] .nav-link[aria-current="page"] {
  /* Every stop keeps white text at 4.5:1; the shimmer is the lighter one passing by. */
  background-image: linear-gradient(110deg, #c21f73 0%, #cf1f78 38%, #d9247f 50%, #cf1f78 62%, #b0175f 100%);
  background-size: 250% 100%;
  border-color: #e6338c;
  text-shadow: 0 1px 1px rgba(110, 10, 60, .45);
  animation: glitter-shimmer 5s linear infinite;
}
@keyframes glitter-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -150% 0; }
}
/* A star-tipped wand for a cursor (the hot spot is the star), and the sparkles
   app.js drops behind the pointer and bursts on each click. */
:root[data-theme="glitter"] body {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M9 9 25 25' stroke='%237a1047' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M9 9 25 25' stroke='%23ff8fc4' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 0l2.1 5.9L16 8l-5.9 2.1L8 16l-2.1-5.9L0 8l5.9-2.1Z' fill='%23ffd778' stroke='%23e6338c' stroke-width='1'/%3E%3C/svg%3E") 8 8, auto;
}
:root[data-theme="glitter"] a,
:root[data-theme="glitter"] button,
:root[data-theme="glitter"] select,
:root[data-theme="glitter"] label,
:root[data-theme="glitter"] [role="button"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M9 9 25 25' stroke='%237a1047' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M9 9 25 25' stroke='%23b072ff' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 0l2.1 5.9L16 8l-5.9 2.1L8 16l-2.1-5.9L0 8l5.9-2.1Z' fill='%23ffffff' stroke='%23e6338c' stroke-width='1.2'/%3E%3C/svg%3E") 8 8, pointer;
}
:root[data-theme="glitter"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
:root[data-theme="glitter"] textarea { cursor: text; }
.sparkle {
  position: fixed; z-index: 1000; pointer-events: none;
  font-size: var(--sparkle-size, 12px); line-height: 1; color: var(--sparkle-color, #ff4fa3);
  text-shadow: 0 0 6px var(--sparkle-color, #ff4fa3);
  transform: translate(-50%, -50%);
  animation: sparkle-fall .8s ease-out forwards;
}
.sparkle.is-burst { animation: sparkle-burst .7s ease-out forwards; }
@keyframes sparkle-fall {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2) rotate(140deg); }
}
@keyframes sparkle-burst {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  60%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-theme="glitter"] .btn-primary,
  :root[data-theme="glitter"] .nav-link[aria-current="page"] { animation: none; }
  .sparkle { display: none; }
}

/* --------------------------------------------------------------------------
   Setup guide
   Docked on the right for owners and administrators until they put it away
   (partials/setup_rail.html, accounts/setup.py). Closed, it's a tab on the
   edge; open, a panel that sits beside the page on wide screens and over it
   on narrow ones. Colors are theme tokens, so every theme dresses it.
   -------------------------------------------------------------------------- */
:root { --setup-w: 360px; }
.setup-tab {
  position: fixed; z-index: 25; right: 0; top: 140px;
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: .7rem .45rem; border: 1px solid var(--blue-600); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--blue-600); color: var(--on-primary);
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow);
}
.setup-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; }
.setup-tab-count {
  font-size: .72rem; padding: .1rem .3rem; border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}
.setup-rail.is-open .setup-tab { display: none; }

.setup-panel {
  display: none; position: fixed; z-index: 26; top: 58px; right: 0; bottom: 0;
  width: var(--setup-w); max-width: 100vw;
  flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.setup-rail.is-open .setup-panel { display: flex; }
@media (min-width: 1000px) {
  /* Room for the page beside it, so people can work with it open. */
  .app:has(.setup-rail.is-open) .content { margin-right: var(--setup-w); }
}
@media (min-width: 1000px) and (max-width: 1320px) {
  /* With the panel open there's less room, so the counters and the two-column
     pages fold as they do on a narrower screen instead of squeezing. */
  .app:has(.setup-rail.is-open) .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app:has(.setup-rail.is-open) .grid.cols-4,
  .app:has(.setup-rail.is-open) .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app:has(.setup-rail.is-open) .grid.detail { grid-template-columns: minmax(0, 1fr); }
}
.setup-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
  padding: .9rem 1rem .5rem;
}
.setup-kicker {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--link);
}
.setup-progress { display: flex; flex-direction: column; gap: .25rem; padding: 0 1rem .75rem;
  border-bottom: 1px solid var(--border); }
.setup-progress progress {
  width: 100%; height: 8px; appearance: none; -webkit-appearance: none; border: 0;
  border-radius: 999px; overflow: hidden; background: var(--muted-bg); color: var(--blue-600);
}
.setup-progress progress::-webkit-progress-bar { background: var(--muted-bg); }
.setup-progress progress::-webkit-progress-value { background: var(--blue-600); border-radius: 999px; }
.setup-progress progress::-moz-progress-bar { background: var(--blue-600); border-radius: 999px; }
.setup-body { flex: 1; overflow-y: auto; padding: .9rem 1rem; }
.setup-nav, .setup-pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.setup-nav { margin: -.3rem 0 .6rem; }
.setup-pager { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.setup-title { margin-top: .25rem; }
.setup-how { font-size: .9rem; }
.setup-how ol, .setup-how ul { padding-left: 1.2rem; margin: 0 0 .6rem; }
.setup-how li { margin-bottom: .3rem; }
.setup-how details { margin: .4rem 0; padding: .45rem .6rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); }
.setup-how summary { cursor: pointer; font-weight: 600; }
.setup-how details ol { margin-top: .4rem; }
.setup-addresses { list-style: none; padding: 0 !important; }
.setup-addresses li { display: flex; flex-direction: column; margin-bottom: .45rem; }
.setup-addresses code { word-break: break-all; }
.setup-address { display: flex; align-items: center; justify-content: space-between; gap: .4rem; min-width: 0; }
.setup-address code { min-width: 0; }
.setup-address .btn { flex: none; }
.setup-how-label { margin: .6rem 0 .2rem; font-weight: 600; }
.setup-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.setup-steps { list-style: none; padding: 0; margin: .25rem 0 1rem; }
.setup-step {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  padding: .55rem .5rem; margin-bottom: 2px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.setup-step:hover { background: var(--surface-hover); }
.setup-step-text { display: flex; flex-direction: column; min-width: 0; }
.setup-step.is-skipped .setup-step-text > span:first-child { color: var(--text-muted); text-decoration: line-through; }
.setup-mark {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 2px solid var(--border-strong); font-size: .75rem; font-weight: 700; color: var(--text-muted);
}
.setup-step.is-done .setup-mark { background: var(--blue-600); border-color: var(--blue-600); color: var(--on-primary); }
.setup-step.is-skipped .setup-mark { border-style: dashed; }
.setup-continue { width: 100%; justify-content: center; }
.setup-foot { padding: .6rem 1rem; border-top: 1px solid var(--border); text-align: center; }
@media (max-width: 760px) {
  /* A small pill in the corner rather than a tall strip down the right edge, which
     covered the ends of lines at 375px; the page's bottom padding scrolls past it. */
  .setup-tab {
    top: auto; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    flex-direction: row; gap: .45rem; padding: .45rem .85rem; min-height: 2.75rem;
    border: 1px solid var(--blue-600); border-radius: 999px;
  }
  .setup-tab-label { writing-mode: horizontal-tb; transform: none; }
  .setup-panel { width: 100vw; }
  /* The tab floats in the corner; leave room under the page to scroll past it. */
  .app:has(.setup-rail) .content { padding-bottom: 8rem; }
}

/* Billing: seats and monthly/yearly beside the Checkout button. */
.checkout-choices .inline-form { flex-wrap: wrap; }
.checkout-choices input[type=number], #billing-seats { flex: 0 0 6rem; }
.segmented { display: flex; flex-wrap: wrap; gap: .25rem .75rem; border: 0; margin: 0; padding: 0; }
.segmented label { display: inline-flex; gap: .35rem; align-items: center; font-size: .9rem; white-space: nowrap; }
.inline-form .segmented input { flex: none; }
.tax-form { flex-wrap: wrap; }
.tax-form label { white-space: nowrap; }
.tax-form select { flex: 0 0 6rem; }
.tax-form input { flex: 1 1 9rem; }

/* Public home page: the two lead cards (cheaper, and one flat price) sit between the hero
   and the feature cards, a size up so they read as the pitch and not as two more features. */
.landing-lead { margin: 2rem 0 1rem; }
.landing-lead h3 { font-size: 1.25rem; }
.landing-lead .page-sub { font-size: .95rem; }
.landing-lead + .landing-features { margin-top: 1rem; }
/* The AI first reply card sits between the lead pair and the feature grid, one
   card wide, with the same breathing room as its neighbours. */
.landing-ai { margin: 1rem 0; }
.landing-ai h3 { font-size: 1.25rem; }
.landing-ai ul { margin: .75rem 0 0; padding-left: 1.1rem; }
.landing-ai li + li { margin-top: .35rem; }
.landing-ai + .landing-features { margin-top: 1rem; }
/* Cards side by side in a grid share a row's height; each fills its cell. */
.landing-lead .card, .landing-features .card { display: flex; }
.landing-lead .card-body, .landing-features .card-body { flex: 1 1 auto; }

/* .card + .card spaces cards stacked in a column. Inside a grid the gap does that,
   and the inherited margin pushed the second card of a row 1rem below the first
   (home page, profile, raise a ticket). Cards stacked outside grids are unchanged. */
.grid > .card + .card { margin-top: 0; }

/* ---- The public Compare page (templates/pages/compare.html) ----------------
   Seven columns need more than the 1060px text column, so the table section
   widens itself to the window (up to 1400px) and centres on the column. Below
   760px the table gives way to one card per product. Each cell's status is
   words; the mark before it is generated content with empty alt text. */
.compare-head { margin-bottom: 1.5rem; }
.compare-head .lede { font-size: 1.05rem; color: var(--text-muted); max-width: 44rem; }
.compare-key { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 1rem 0 0; padding: 0; }
.compare-key li { padding-left: 1.4rem; position: relative; }

.compare-table {
  width: min(100vw - 2.5rem, 1400px);
  margin-left: calc(50% - min(100vw - 2.5rem, 1400px) / 2);
}
.compare-table .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.compare-table table.data { table-layout: fixed; min-width: 1200px; font-size: .85rem; }   /* 9 plans since One to One Plus */
.compare-table caption { caption-side: top; text-align: left; font-weight: 600; padding: .75rem .9rem .5rem; }
.compare-table th, .compare-table td { vertical-align: top; overflow-wrap: break-word; }
.compare-table th[scope="col"] { white-space: normal; vertical-align: bottom; }
.compare-table th[scope="col"]:first-child, .compare-table th[scope="row"] {
  width: 13rem; position: sticky; left: 0; z-index: 1; background: var(--surface-2);
}
.compare-table th[scope="row"] {
  font-size: .85rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--text); white-space: normal;
}
.compare-table th .hint, .compare-table td .hint { display: block; font-weight: 400; margin-top: .15rem; }
.compare-product { display: block; font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--text); }
.compare-tier { display: block; font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-muted); }
.compare-price { font-size: 1.05rem; }
.compare-table .is-us { background: var(--accent-bg); }
.compare-table thead th.is-us { box-shadow: inset 0 3px 0 var(--accent); }
.compare-table tbody tr:hover { background: transparent; }
.compare-table tbody tr:hover td:not(.is-us) { background: var(--surface-hover); }
.compare-table sup { font-size: .7em; margin-left: .15rem; }
@media (min-width: 1240px) {
  /* No sideways scroll, so the header can stick while the page scrolls. The table's
     min-width (1200px) plus the page's 2.5rem margin must fit, or the page itself
     scrolls sideways. */
  .compare-table .table-wrap { overflow: visible; }
  .compare-table thead th { position: sticky; top: 0; z-index: 2; }
  .compare-table thead th:first-child { z-index: 3; }
}

/* Status marks: a tick, a plus, an up arrow, a dash, a question mark. The
   words carry the meaning; the mark and its colour only help the eye. */
.cmp-cell { position: relative; }
.compare-table td.cmp-cell { padding-left: 2rem; }
.cmp-cell::before {
  position: absolute; left: .75rem; top: .55rem;
  width: 1rem; text-align: center; font-weight: 700; line-height: 1.2;
}
.compare-key .cmp-cell::before, .compare-list .cmp-cell::before { left: 0; top: .45rem; }
.cmp-cell.is-included::before     { content: "✓" / ""; color: var(--ok); }
.cmp-cell.is-addon::before        { content: "+" / ""; color: var(--warn); }
.cmp-cell.is-higher_tier::before  { content: "↑" / ""; color: var(--warn); }
.cmp-cell.is-not_offered::before  { content: "–" / ""; color: var(--text-muted); }
.cmp-cell.is-not_published::before { content: "?" / ""; color: var(--text-muted); }
/* "Not offered" is a fact about the product, so it reads like "Included"; "Not
   published" is about what we could find out, so it's visibly weaker (Drew). */
.cmp-cell.is-not_published { color: var(--text-muted); font-style: italic; }

/* Monthly prices and the vendors' pricing notes, once, under the table. */
.compare-monthly .compare-note { display: block; margin-top: .25rem; }

/* Phones: TicketHappy beside one vendor at a time. Every vendor's cells are
   in the rows; only the column whose data-vendor matches the section's shows. */
.compare-duo { display: none; }
.compare-pick { display: flex; align-items: center; gap: .6rem; margin: 0 0 .75rem; }
.compare-pick label { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.compare-pick select { flex: 1 1 auto; min-width: 0; }
.compare-duo-table { table-layout: fixed; font-size: .82rem; }
.compare-duo-table th[scope="row"] {
  width: 34%; font-size: .82rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--text); white-space: normal; vertical-align: top;
}
.compare-duo-table th[scope="col"] {
  white-space: normal; vertical-align: bottom; overflow-wrap: normal; hyphens: manual;
  letter-spacing: 0; text-transform: none; font-size: .82rem; color: var(--text);
}
.compare-duo-table th, .compare-duo-table td { padding: .5rem .5rem; vertical-align: top; }
.compare-duo-table td { overflow-wrap: anywhere; }   /* long e-mail addresses in notes */
.compare-duo-table td.cmp-cell { padding-left: 1.6rem; }
.compare-duo-table .cmp-cell::before { left: .35rem; top: .5rem; }
.compare-duo-table .hint { display: block; margin-top: .1rem; }
.compare-duo-table .is-us { background: var(--accent-bg); }
.compare-duo-table thead th.is-us { box-shadow: inset 0 3px 0 var(--accent); }
.compare-duo-table [data-vendor] { display: none; }
.compare-duo[data-vendor="jira"] [data-vendor="jira"],
.compare-duo[data-vendor="zoho"] [data-vendor="zoho"],
.compare-duo[data-vendor="manageengine"] [data-vendor="manageengine"],
.compare-duo[data-vendor="freshservice"] [data-vendor="freshservice"],
.compare-duo[data-vendor="zendesk"] [data-vendor="zendesk"],
.compare-duo[data-vendor="incidentiq"] [data-vendor="incidentiq"],
.compare-duo[data-vendor="onetooneplus"] [data-vendor="onetooneplus"],
.compare-duo[data-vendor="happyfox"] [data-vendor="happyfox"] { display: table-cell; }
@media (max-width: 760px) {
  .compare-table { display: none; }
  .compare-duo { display: block; }
}

.compare-theirs, .compare-alternatives, .compare-sources { margin-top: 2.5rem; }
.compare-theirs h3, .compare-alternatives h3 { margin: 0 0 .35rem; }
.compare-theirs .compare-tier { display: inline; margin-left: .25rem; }
.compare-plain { margin: .25rem 0 0; padding-left: 1.1rem; }
.compare-plain li { margin-bottom: .3rem; }
.compare-sources-sub { font-size: .9rem; margin: 1.25rem 0 .25rem; }
.compare-footnotes { columns: 2; column-gap: 2rem; padding-left: 2rem; overflow-wrap: anywhere; }
.compare-footnotes li { margin-bottom: .2rem; break-inside: avoid; }
@media (max-width: 760px) { .compare-footnotes { columns: 1; } }
.compare-cta .btn-row { justify-content: center; margin: 2.5rem 0 1rem; }

/* Home page: the eyebrow over the headline, the product under the hero, and the one plan
   with both prices side by side. */
.hero .eyebrow { margin: 0 0 .5rem; font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.landing-shot { margin: 0 auto 2.5rem; max-width: 1060px; }
.landing-shot img {
  display: block; width: 100%; height: auto; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
@media (max-width: 600px) { .landing-shot img { aspect-ratio: 375 / 812; max-width: 320px; margin: 0 auto; } }
.plan-single { max-width: 36rem; margin: 0 auto; }
.plan .founding-label { margin: -.25rem 0 .5rem; font-size: .8rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); }
.plan-single .price-pair { display: flex; flex-wrap: wrap; gap: .25rem 2rem; }
.plan-single .page-sub { margin: 0 0 .75rem; }

/* A "More" menu in a page head (inventory): the account menu's panel, hung under its button. */
.head-menu { position: relative; }
.head-menu .topbar-menu { right: 0; left: auto; }
.head-menu .account-caret { margin-left: .2rem; font-size: .7rem; }

/* ---- Print labels (templates/pages/inventory_labels.html) --------------
   The label itself is drawn in mm by labels/sizes.css and labels_print.css;
   here it sits on a checkerboard stage, scaled to fit by labels.js, with the
   sheet thumbnail (an SVG in mm) under it. */
.lbl-stage {
  display: grid; place-items: center; padding: 1.25rem; min-height: 8rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px;
  overflow: hidden;
}
.lbl-stage .label { zoom: var(--lbl-zoom, 1); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); outline: 1px solid #c9ced6; }   /* an outline takes no width: the text box is the size the fit measured (Musamil) */
.lbl-feed { margin-top: .6rem; }
.lbl-stage .label .is-cut { color: #b91c1c; }   /* preview only: labels_print.css keeps print black */
.lbl-fit-note { margin-top: .6rem; }
/* The unzoomed copy, out of sight, that labels.js fits the preview and every
   chosen device's tag and name in (text under CSS zoom measures wider). */
.lbl-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }
.lbl-pager { align-items: center; margin: .6rem 0 0; }
.lbl-sheet-title { font-size: .9rem; margin: 1.25rem 0 .5rem; }
.lbl-sheet { display: block; width: min(100%, 22rem); height: auto; }
.lbl-sheet-page { fill: #fff; stroke: var(--border-strong); stroke-width: .4; }
.lbl-cell { fill: var(--blue-50); fill-opacity: .6; stroke: var(--border-strong); stroke-width: .6; stroke-dasharray: 1.6 1.2; }
.lbl-cell.is-used { fill: var(--muted-bg); fill-opacity: 1; stroke: var(--border); }
.lbl-cell.is-start { stroke: var(--blue-600); stroke-width: 1.2; stroke-dasharray: none; }
/* Layout (Stretch): each setting a row of radios drawn as a segmented control;
   arrow keys move within a row, as radios do. */
.lbl-seg-group { border: 0; padding: 0; margin: 0 0 .85rem; min-width: 0; }
.lbl-seg-group > legend { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; padding: 0; }
.lbl-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-input); border-radius: var(--radius-sm); overflow: hidden; }
.lbl-seg-option { position: relative; display: inline-flex; }
.lbl-seg-option input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.lbl-seg-option span { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 .85rem; font-size: .85rem; border-right: 1px solid var(--border-input); }
.lbl-seg-option:last-child span { border-right: 0; }
.lbl-seg-option input:checked + span { background: var(--blue-600); color: #fff; }
.lbl-seg-option input:focus-visible + span { box-shadow: var(--ring); }
.lbl-seg-option input:disabled { cursor: not-allowed; }
.lbl-seg-option input:disabled + span { color: var(--text-muted); opacity: .6; }
.lbl-seg-option input:disabled:checked + span { background: var(--muted-bg); color: var(--text); opacity: 1; }
/* On a phone the preview sits above the settings: a way back up to it. */
.lbl-to-preview, .lbl-to-preview-row { display: none; }
@media (max-width: 760px) {
  .lbl-seg-option span { min-height: 44px; }
  .lbl-to-preview { display: inline-flex; align-items: center; min-height: 44px; }
  .lbl-to-preview-row { display: block; margin: .25rem 0 0; }
}

/* ---- Satisfaction card (Drew's piece 5 in the Tickets report; Stretch's design) ---- */
/* The figures in a row that wraps, the average largest; then a bar per face, the word
   beside it so the colour isn't the only sign: happy in the accent, OK amber, unhappy
   red. The CSP forbids inline widths, so a fill's width is .w-0 … .w-20, in twentieths.
   Each li keeps its list semantics and lines up with the others through subgrid. */
.sat-head { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: baseline; }
.sat-head strong { font-variant-numeric: tabular-nums; }
.sat-head .sat-average strong { font-size: 1.6rem; font-weight: 700; }
.sat-bars {
  list-style: none; margin: 0; padding: 0 1.1rem 1.1rem;
  display: grid; grid-template-columns: auto 1fr auto; gap: .4rem .75rem; align-items: center; font-size: .9rem;
}
.sat-bars li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; }
.sat-label { white-space: nowrap; }
.sat-bar { display: block; height: 10px; border-radius: 5px; background: var(--muted-bg); overflow: hidden; }
.sat-fill { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.sat-fill.sat-3 { background: var(--warn); }
.sat-fill.sat-1, .sat-fill.sat-2 { background: var(--danger); }
.sat-count { min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sat-fill.w-0 { width: 0; }      .sat-fill.w-1 { width: 5%; }    .sat-fill.w-2 { width: 10%; }
.sat-fill.w-3 { width: 15%; }    .sat-fill.w-4 { width: 20%; }   .sat-fill.w-5 { width: 25%; }
.sat-fill.w-6 { width: 30%; }    .sat-fill.w-7 { width: 35%; }   .sat-fill.w-8 { width: 40%; }
.sat-fill.w-9 { width: 45%; }    .sat-fill.w-10 { width: 50%; }  .sat-fill.w-11 { width: 55%; }
.sat-fill.w-12 { width: 60%; }   .sat-fill.w-13 { width: 65%; }  .sat-fill.w-14 { width: 70%; }
.sat-fill.w-15 { width: 75%; }   .sat-fill.w-16 { width: 80%; }  .sat-fill.w-17 { width: 85%; }
.sat-fill.w-18 { width: 90%; }   .sat-fill.w-19 { width: 95%; }  .sat-fill.w-20 { width: 100%; }
.sat-agents th[scope="row"] .hint { font-weight: 400; font-size: .75rem; }
/* On a phone a head's hint drops under its title rather than squeeze "By agent" onto two lines. */
.sat-card > .card-head { flex-wrap: wrap; gap: .15rem .75rem; }
.sat-card > .card-head h2, .sat-card > .card-head h3 { white-space: nowrap; }
@media (max-width: 400px) {
  .sat-bars { padding: 0 .75rem .75rem; gap: .35rem .5rem; }
}

/* ---- Settings → Branding (partials/branding_settings.html; Stretch's design) ----------- */
/* The controls on the left, the preview on the right and sticky; one column under 760px.
   Colours reach the preview as --pv-* custom properties set by static/js/branding.js. */
.branding-intro { margin: 0 0 .9rem; }
.branding-suspended { margin: 1rem 1.1rem 0; }
.upload-form { display: none; }
.brand-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: 1.25rem; align-items: start; }
.brand-sticky { position: sticky; top: 4.5rem; }
.brand-pv-summary { display: none; }
/* On a phone the preview comes first, a bar pinned under the top bar that opens in place,
   its preview scrolling inside so the controls stay reachable underneath. */
@media (max-width: 760px) {
  .brand-grid { grid-template-columns: 1fr; }
  .brand-pv-bar {
    position: static; order: -1; z-index: 3; margin: 0 -.25rem; padding: 0 .25rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .brand-pv-summary {
    display: flex; align-items: center; gap: .5rem; min-height: 44px; cursor: pointer; list-style: none;
    font-weight: 600;
  }
  .brand-pv-summary::-webkit-details-marker { display: none; }
  .brand-pv-summary .hint { margin: 0; font-weight: 400; }
  .brand-pv-bar .pv-tools > strong { display: none; }          /* the bar says "Preview" already */
  .brand-pv-summary::after {
    content: ""; margin-left: auto; width: .55rem; height: .55rem; flex: none;
    border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
    transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
  }
  .brand-pv-bar[open] > .brand-pv-summary::after { transform: translateY(2px) rotate(-135deg); }
  /* Open, it stays in view under the top bar while the colours are tried; closed, it scrolls
     away with the page (Stretch). */
  .brand-pv-bar[open] { position: sticky; top: 58px; max-height: 55vh; overflow-y: auto; padding-bottom: .6rem; }
}
.brand-subhead { padding-left: 0; border-top: 0; margin-top: .75rem; }
.subhead-row { display: flex; align-items: baseline; gap: .6rem; }
.subhead-row .brand-subhead { flex: 1; }
.subhead-row .hint { margin: 0; }
.brand-upload { margin-top: .5rem; }
/* Its file box is hidden behind the "Upload" label; the page's own input[type="file"] rule
   would otherwise give it full width and push a phone's page sideways (Stretch, 375). */
.brand-upload input[type="file"].visually-hidden { width: 1px; height: 1px; padding: 0; }
/* The hidden file box takes the focus; its "Upload" label shows it. */
.brand-upload input[type="file"]:focus-visible + .btn { outline: 2px solid var(--blue-600); outline-offset: 2px; }

.logo-chips { display: flex; gap: .6rem; flex-wrap: wrap; }
.logo-chip {
  width: 7rem; height: 3rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem; overflow: hidden; padding: .3rem;
}
.logo-chip img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-chip.is-light { background: #fff; color: #1d4ed8; }
.logo-chip.is-dark { background: #0b1220; color: #93c5fd; }

/* The palette: a bordered row per colour, its name and use, then picker · hex · Auto. */
.colour-group > legend { margin-bottom: .45rem; }
.color-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .7rem; margin-bottom: .5rem; }
.color-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; margin-bottom: .4rem; }
.color-name { font-weight: 600; font-size: .9rem; }
.color-head .hint { margin: 0; }
.swatch-row { display: flex; align-items: center; gap: .5rem .6rem; flex-wrap: wrap; }
.swatch-row input[type=color] {
  width: 2.75rem; height: 2.25rem; padding: .15rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
}
.swatch-row input.hex-input { flex: none; width: 7rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.color-auto { margin: 0; }
.color-row.is-auto input[type=color], .color-row.is-auto .hex-input { opacity: .55; }
.color-row .field-error { margin: .35rem 0 0; }
.contrast { display: flex; align-items: flex-start; gap: .4rem; font-size: .78rem; color: var(--text-muted); margin: .4rem 0 0; }
.contrast .badge-dot { flex: none; width: 8px; height: 8px; margin-top: .3rem; border-radius: 50%; background: var(--ok); }
.contrast.is-low .badge-dot { background: var(--warn); }
@media (max-width: 600px) { .color-auto { flex-basis: 100%; } }

/* Choice cards: a radio (or a preset button) dressed as a card; the chosen one outlined. */
.choice-card {
  display: grid; gap: .1rem; padding: .5rem .65rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer;
  font: inherit; text-align: left; position: relative;
}
.choice-card input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-card:has(input:checked), .choice-card[aria-pressed="true"] { border-color: var(--blue-600); box-shadow: 0 0 0 1px var(--blue-600); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.choice-card .hint { margin: 0; }
.font-list { display: grid; gap: .4rem; }
.font-opt { display: flex; align-items: center; gap: .6rem; }
.font-opt .sample { font-size: 1.05rem; }
.font-opt .hint { margin-left: auto; }
.font-system { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.font-inter { font-family: Inter, system-ui, sans-serif; }
.font-source-sans { font-family: "Source Sans 3", system-ui, sans-serif; }
.font-atkinson { font-family: "Atkinson Hyperlegible", system-ui, sans-serif; }
.font-merriweather { font-family: Merriweather, Georgia, serif; }
.preset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .5rem; }
.preset { grid-template-columns: 2.2rem 1fr; align-items: center; gap: .6rem; }
.preset-dots { display: flex; gap: 2px; }
.preset-dots .dot { width: .6rem; height: 1.4rem; border-radius: 2px; display: block; }
.dot.is-blue { background: #2563eb; } .dot.is-blue-tint { background: #eef2ff; }
.dot.is-forest { background: #0f766e; } .dot.is-amber { background: #f59e0b; }
.dot.is-violet { background: #7c3aed; } .dot.is-rose { background: #db2777; }
.dot.is-slate { background: #1e293b; } .dot.is-crimson { background: #b91c1c; } .dot.is-royal { background: #1d4ed8; }
.bg-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; }
.bg-opt .thumb { height: 2.6rem; border-radius: 4px; margin-bottom: .3rem; border: 1px solid var(--border); }
.thumb.is-solid { background: var(--pv-surface, #eef2ff); }
.thumb.is-gradient { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.thumb.is-image { background: linear-gradient(rgba(15, 23, 42, .45), rgba(15, 23, 42, .45)), #94a3b8; }
.bg-current { max-width: 100%; max-height: 6rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.range-row { display: flex; align-items: center; gap: .6rem; }
.range-row input[type=range] { flex: 1; }
.range-row .hint { margin: 0; white-space: nowrap; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .6rem; }
.placeholders { display: flex; flex-wrap: wrap; gap: .3rem; }
.html-editor { width: 100%; min-height: 11rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.brand-test { margin-top: .9rem; align-items: center; }
.brand-test .hint { margin: 0; }
.sticky-save {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-top: 1rem; padding: .7rem 0 .2rem; background: var(--surface); border-top: 1px solid var(--border);
}
.sticky-save .spacer { flex: 1; }
.unsaved { font-size: .78rem; color: var(--warn); }

/* The preview: always the light look a visitor sees, in the chosen colours and font. */
.pv-tools { display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; flex-wrap: wrap; }
.pv-tools .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: .25rem .6rem; font-size: .75rem; cursor: pointer; color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--blue-600); color: var(--on-primary); }
.brand-preview { --pv-primary: #2563eb; --pv-accent: #2563eb; --pv-surface: #eef2ff; --pv-heading: #0f172a; }
.brand-preview.is-phone .hc-preview, .brand-preview.is-phone .em-card { max-width: 15rem; margin: 0 auto; }
.brand-preview.is-font-inter .hc-preview { font-family: Inter, system-ui, sans-serif; }
.brand-preview.is-font-source-sans .hc-preview { font-family: "Source Sans 3", system-ui, sans-serif; }
.brand-preview.is-font-atkinson .hc-preview { font-family: "Atkinson Hyperlegible", system-ui, sans-serif; }
.brand-preview.is-font-merriweather .hc-preview { font-family: Merriweather, Georgia, serif; }
.hc-preview {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; color: #0f172a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hc-top {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; font-weight: 650; font-size: .8rem;
  border-top: 3px solid var(--pv-primary); border-bottom: 1px solid #e2e8f0;
}
.hc-top .lg { width: 1.3rem; height: 1.3rem; border-radius: 4px; background: var(--pv-primary); object-fit: contain; }
.hc-sub { font-weight: 400; opacity: .7; font-size: .7rem; }
.brand-preview.is-top-bar .hc-top { background: var(--pv-primary); color: var(--pv-primary-ink); border-top: 0; }
.brand-preview.is-top-bar .hc-top span.lg { background: #fff; }
.hc-hero { padding: 1.1rem .9rem; text-align: center; background: var(--pv-surface); color: var(--pv-surface-ink, #0f172a); }
.hc-hero h4 { margin: 0 0 .2rem; font-size: .95rem; color: var(--pv-heading); }
.hc-hero p { margin: 0 0 .5rem; font-size: .72rem; opacity: .85; }
.brand-preview.is-bg-gradient .hc-hero { background: linear-gradient(135deg, var(--pv-primary), var(--pv-gradient-end, var(--pv-accent))); color: var(--pv-gradient-ink, #fff); }
.brand-preview.is-bg-image .hc-hero {
  background: linear-gradient(rgba(0, 0, 0, var(--pv-overlay, .45)), rgba(0, 0, 0, var(--pv-overlay, .45))),
    var(--pv-photo, #94a3b8) center / cover;
  color: #fff;
}
.brand-preview.is-bg-gradient .hc-hero h4 { color: var(--pv-gradient-ink, #fff); }
.brand-preview.is-bg-image .hc-hero h4 { color: #fff; }
.hc-search {
  max-width: 12rem; margin: 0 auto; padding: .35rem .5rem; border: 1px solid #cbd5e1; border-radius: 6px;
  background: #fff; color: #64748b; font-size: .7rem; text-align: left;
}
.hc-body { padding: .6rem .75rem; display: grid; gap: .4rem; font-size: .72rem; }
.hc-row { border: 1px solid #e2e8f0; border-radius: 6px; padding: .4rem .5rem; }
.hc-row b { display: block; color: var(--pv-primary); font-size: .75rem; }
.hc-btn {
  display: inline-block; justify-self: start; padding: .3rem .6rem; border-radius: 6px; font-size: .7rem; font-weight: 600;
  background: var(--pv-accent); color: var(--pv-accent-ink);
}
/* The e-mail: "TicketHappy standard" in TicketHappy's own blue whatever the palette says. */
.em-preview { padding: .9rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: #f6f8fc; color: #0f172a; }
.em-card { max-width: 24rem; margin: 0 auto; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font-size: .72rem; }
.em-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .55rem .8rem; font-weight: 700; font-size: .85rem;
  color: #1d4ed8; border-bottom: 2px solid #2563eb;
}
.em-head .lg { width: 1rem; height: 1rem; border-radius: 3px; background: currentColor; display: inline-block; }
.em-tagline { flex-basis: 100%; font-weight: 400; font-size: .68rem; color: #5b6b84; }
.em-body { padding: .7rem .8rem; line-height: 1.5; }
.em-body p { margin: .4rem 0; }
.em-body .k { color: #5b6b84; }
.em-btn { display: inline-block; margin-top: .4rem; padding: .3rem .6rem; border-radius: 6px; font-weight: 600; background: #2563eb; color: #fff; }
.em-foot { padding: .5rem .8rem; border-top: 1px solid #e2e8f0; font-size: .62rem; color: #5b6b84; }
.em-footline { display: block; margin-bottom: .2rem; }
.em-custom-note { display: none; text-align: center; }
.brand-preview.is-email-brand .em-preview { background: var(--pv-surface); }
.brand-preview.is-email-brand .em-head { color: var(--pv-primary); border-bottom-color: var(--pv-primary); }
.brand-preview.is-email-brand.is-emtop-bar .em-head { background: var(--pv-primary); color: var(--pv-primary-ink); border-bottom: 0; border-radius: 8px 8px 0 0; }
.brand-preview.is-email-brand .em-body .k { color: var(--pv-heading); font-weight: 600; }
.brand-preview.is-email-brand .em-btn { background: var(--pv-accent); color: var(--pv-accent-ink); }
.brand-preview.is-email-brand.is-emfont-georgia .em-card { font-family: Georgia, serif; }
.brand-preview.is-email-brand.is-emfont-arial .em-card { font-family: Arial, Helvetica, sans-serif; }
.brand-preview.is-email-brand.is-emfont-verdana .em-card { font-family: Verdana, sans-serif; }
.brand-preview.is-email-brand.is-emfont-trebuchet .em-card { font-family: "Trebuchet MS", sans-serif; }
.brand-preview:not(.is-email-brand) .em-tagline, .brand-preview:not(.is-email-brand) .em-footline { display: none; }
.em-frame { display: none; width: 100%; height: 26rem; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.brand-preview.is-email-custom .em-frame { display: block; }
.brand-preview.is-email-custom .em-card { display: none; }
.brand-preview.is-email-custom .em-preview:not(:has(.em-frame)) .em-card { display: block; opacity: .45; }
.brand-preview.is-email-custom .em-custom-note { display: block; margin-top: .6rem; }

/* Settings → E-mail (Stretch, 5 Nov 2026): Receiving is the section's first subhead, straight
   under its head, so no rule above it. Send from your own address: the DNS records' names and
   values are long, so they wrap (at a dot where they can) rather than widen the page at 375px; each Copy button
   sits under its value. */
.card-subhead-first { border-top: 0; }
.sending-status { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.dns-records code { display: block; overflow-wrap: anywhere; }
.dns-records td .btn { margin-top: .25rem; }
.sending-identity .card-body > * + * { margin-top: .75rem; }
.sending-records > summary, .sending-change > summary { cursor: pointer; }
@media (max-width: 600px) {
  /* On a phone the record stacks (as .lifecycle-table does), each part under its label, so the ~400-character value has the
     card's whole width instead of a third of it. */
  .dns-records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dns-records, .dns-records tbody, .dns-records tr, .dns-records td { display: block; }
  .dns-records td { border: 0; padding: .3rem 0; }
  .dns-records td::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--text-muted); }
}

/* "Link a device" on a ticket (Stretch's spec, inventory win 7b): each linked badge with its ×,
   the button that opens the picker, and the picker's group headings ("Robin's devices", "Recently
   seen"). The × is a 44px target on a phone. */
.linked-devices { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.linked-device { display: inline-flex; align-items: center; gap: .15rem; }
.unlink-device { min-width: 1.75rem; min-height: 1.75rem; padding: 0 .35rem; line-height: 1; }
@media (max-width: 600px) { .unlink-device { min-width: 44px; min-height: 44px; } }
.linked-devices .hint { flex-basis: 100%; margin: 0; }
.link-device { flex-basis: 100%; }
.link-device > summary { list-style: none; display: inline-flex; }
.link-device > summary::-webkit-details-marker { display: none; }
.link-device .ticket-picker { margin-top: .5rem; }
.pick-list li.pick-group { padding: .4rem .75rem .2rem; font-size: .75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; }
.pick-list li.pick-group + li { border-top: 0; }

/* The organization's own asset fields in the inventory filters (partials/asset_custom_filters.html):
   a from-to pair keeps its two boxes side by side, phone included; more than four fields fold
   under "More filters", a row of its own. */
.filter-range {
  display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: 0; border: 0; min-width: 0;
}
.filter-range > legend {
  float: left; margin-right: .15rem; padding: 0; font-size: .85rem; color: var(--text-muted);
}
.filter-range input { width: 8.5rem; }
.filter-range input[type="number"] { width: 6.5rem; }
.custom-filters { flex-basis: 100%; min-width: 0; }
.custom-filters > summary { cursor: pointer; font-size: .9rem; color: var(--text-muted); padding: .25rem 0; }
.custom-filters-body { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: .35rem; }
@media (max-width: 600px) {
  .custom-filters-body > select, .custom-filters-body > input,
  .custom-filters-body > .filter-dropdown, .filter-panel > .filter-range,
  .custom-filters-body > .filter-range { flex: 1 1 100%; min-width: 0; }
  .filter-range { flex-wrap: wrap; }
  .filter-range > legend { flex-basis: 100%; float: none; margin: 0; }
  /* width 0, then grow: a date box's own width would otherwise push the panel past the screen. */
  .filter-range input, .filter-range input[type="number"] { flex: 1 1 0; width: 0; min-width: 0; min-height: 2.75rem; }
  .custom-filters > summary { min-height: 2.75rem; display: flex; align-items: center; }
}

/* The inventory list (Stretch's layout review, rows 1-3): one search box with the scanner's
   hint under it; on a phone a slimmer head (no subtitle, Print labels and Reports inside
   More), the saved views as one strip that scrolls sideways, and two- or three-line rows. */
.scan-hint { flex-basis: 100%; margin: 0; }
.head-narrow, .asset-table .open-label { display: none; }
@media (max-width: 600px) {
  .inventory-head { flex-wrap: nowrap; }
  /* The hint is about a USB scanner at a computer (the box isn't focused on arrival on a phone either). */
  .inventory-head .page-sub, .inventory-head .head-wide, .scan-hint { display: none; }
  .topbar-menu .head-narrow { display: flex; }
  [data-inventory-views] { flex-wrap: nowrap; }
  [data-inventory-views] .view-tabs-list {
    display: flex; gap: .35rem; flex: 1 1 auto; min-width: 0; overflow-x: auto;
    scrollbar-width: none; scroll-snap-type: x proximity;
  }
  [data-inventory-views] .view-tabs-list::-webkit-scrollbar { display: none; }
  [data-inventory-views] .view-tab { flex: 0 0 auto; scroll-snap-align: start; }
  [data-inventory-views] .view-save { flex: 0 0 auto; }
}
@media (max-width: 900px) {
  /* The holder is the column that gives (it shortens with an ellipsis), so "1 open ticket"
     keeps its width and never runs under ⋯ / Delete (Stretch). */
  table.asset-table tr {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "sel asset asset asset asset del" "sel st held warr open del";
  }
  table.asset-table.no-select tr {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "asset asset asset asset" "st held warr open";
  }
  /* Nobody holds it: the warranty badge sits next to the status rather than across the gap. */
  table.asset-table tr:has(td.col-holder > .hint:only-child) {
    grid-template-areas: "sel asset asset asset asset del" "sel st warr warr open del";
  }
  table.asset-table.no-select tr:has(td.col-holder > .hint:only-child) {
    grid-template-areas: "asset asset asset asset" "st warr warr open";
  }
  /* With an expired-warranty badge as well, the four don't fit a phone's line: open tickets
     takes a third. */
  table.asset-table tr:has(td.col-open:not(.is-zero)):has(td.col-warranty .badge.tone-danger) {
    grid-template-areas: "sel asset asset asset asset del" "sel st held warr warr del" "sel open open open open del";
  }
  table.asset-table.no-select tr:has(td.col-open:not(.is-zero)):has(td.col-warranty .badge.tone-danger) {
    grid-template-areas: "asset asset asset asset" "st held warr warr" "open open open open";
  }
  /* ⋯ over Delete in a narrow column down the right, so the name and its line keep the width. */
  table.asset-table td.row-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; align-self: start; }
  table.asset-table .key-serial, table.asset-table .warranty-ok, table.asset-table td.col-open.is-zero,
  table.asset-table td.col-warranty > .hint:only-child { display: none; }
  table.asset-table td.col-open::before { content: none; }
  table.asset-table td.col-open .open-label { display: inline; }
  table.asset-table td.col-holder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* "This is a warranty claim" on Send for repair (partials/asset_detail.html): a whole 44px row on a phone. */
@media (max-width: 600px) {
  .warranty-claim .check { min-height: 2.75rem; display: flex; align-items: center; }
}

/* The asset page (Stretch's layout review, row 5): Details as label-and-value rows on a computer,
   and Who has it before Details on a phone. */
@media (min-width: 901px) {
  #asset-details-view {
    display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    column-gap: 1.25rem; row-gap: .5rem; align-items: baseline;
  }
  #asset-details-view dt, #asset-details-view dd { margin: 0; }
}
@media (max-width: 900px) {
  .grid.detail > .asset-side { order: -1; }
}
.stocktake-line { margin: .15rem 0 0; }

/* Settings → Device lifecycle: "Stocktake every … days" under the table (inventory row 3e). */
.stocktake-period { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: 1rem 0 .5rem; }
.stocktake-period-label { font-weight: 600; }
.stocktake-period .num-input { width: 4.5rem; }
.stocktake-period .hint { flex-basis: 100%; margin: 0; }

/* Inventory → Stocktakes (inventory row 3d): the Room filter, and each finished stocktake's four counts. */
.audit-filter { padding: .75rem 1.1rem 0; }
.audit-tally { font-size: .85rem; }
.tally-missing { color: var(--danger); font-weight: 600; }

.room-sort { padding: .75rem 1.1rem 0; }
.room-stocktake .badge { margin-bottom: .2rem; }
/* Reports → Inventory, "Missing or not seen" (inventory row 3b): a full-width card after the two columns. */
.report-missing { margin-top: 1rem; }
.report-missing-lede { padding-top: 0; margin: 0; }

/* The import's "Check the columns" step (inventory item 6): the column letter beside each heading,
   so the server's "column B" points at something visible; the select takes the cell. */
.import-letter {
  display: inline-block; min-width: 1.4rem; margin-right: .35rem; padding: 0 .3rem; border-radius: var(--radius-sm);
  background: var(--surface-hover); color: var(--text-muted); font-family: var(--mono); font-size: .75rem; text-align: center;
}
.import-columns select { min-width: 11rem; }
.import-columns td .hint, .import-columns td .field-error { margin: .2rem 0 0; }
.import-mapping-error { margin-bottom: .35rem; }
/* "Missing or not seen" on a phone: the title, then the CSV button full width under it (Stretch). */
@media (max-width: 600px) {
  .report-missing > .card-head { flex-wrap: wrap; }
  .report-missing > .card-head .spacer { display: none; }
  .report-missing > .card-head .btn { flex: 1 1 100%; justify-content: center; }
}

/* ---- Ticket page: the properties panel, one Save (partials/ticket_detail.html) -------------
   Each property is a full-width field with no button of its own; "More" opens Team, Category and
   Due when they're unset; the one Save keeps its width as its label counts the changes, and is the
   panel's full width on a phone like Pick this up. */
.props-form .field select, .props-form .field input { width: 100%; }
.props-more-toggle {
  display: inline-flex; align-items: center; gap: .35rem; margin: 0 0 .75rem; padding: .2rem 0;
  border: 0; background: none; color: var(--link, var(--primary)); font: inherit; font-size: .875rem; cursor: pointer;
}
.props-more-toggle::after {
  content: ""; width: .4rem; height: .4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.props-more-toggle[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
.props-save { margin: .25rem 0 1rem; }
.props-save .btn { min-width: 10.5rem; justify-content: center; }
@media (max-width: 760px) { .props-save .btn { width: 100%; } }

/* ---- Ticket page: empty cards fold, and phone-sized targets (Stretch's T5, 11 Nov) ----------
   Related tickets, Article that fixed it and Copied in fold to their heading while empty (the
   Settings sections' <details>); at phone width every button and field on the ticket is 44px. */
#fixed-by > .ticket-fold { margin: 0; }
#fixed-by > .ticket-fold > summary { border-radius: var(--radius); }
@media (max-width: 760px) {
  #ticket-detail .btn, #ticket-detail select,
  #ticket-detail input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
}

/* An open ticket's new messages (app.js; Musamil #70, Stretch): one divider above the first,
   and a pill that scrolls to it while it's below the screen. */
.thread-new { display: flex; align-items: center; gap: .5rem; margin: .75rem 0; color: var(--blue-600); }
.thread-new::before, .thread-new::after { content: ""; flex: 1; border-top: 1px solid var(--blue-600); }
.thread-new span { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.thread-pill { position: sticky; bottom: 1rem; display: block; margin: .5rem auto 0; border-radius: 999px; box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,.15)); }
