/* ============================================================
   Velv Ticketing — stylesheet
   Built on the Velv Design System tokens (brand: "Our Team.
   Remotely Yours."). Light theme by default; toggling the
   "Lights" switch in the header sets [data-theme="dark"] on
   <html> for the Night Sky theme. See public/js/theme-*.js.
   ============================================================ */

/* ---- Webfonts (Helvetica Neue, self-hosted) ---- */
@font-face {
  font-family: "Helvetica Neue";
  src: url("/fonts/HelveticaNeue-Roman.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Helvetica Neue";
  src: url("/fonts/HelveticaNeue-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Helvetica Neue";
  src: url("/fonts/HelveticaNeue-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens — light (default) ---- */
:root {
  /* Brand solids */
  --velv-off-black: #11112C;
  --velv-electric: #8276F1;
  --velv-light-purple: #BABAFD;
  --velv-green: #00FF88;
  --velv-green-ink: #062E1B;

  /* Purple ramp */
  --velv-purple-100: #E4E3FE;
  --velv-purple-050: #F2F1FF;

  /* Ink (neutral) ramp */
  --velv-ink-700: #2A2A45;
  --velv-ink-500: #565572;
  --velv-ink-400: #7C7B96;
  --velv-ink-200: #D5D4E1;
  --velv-ink-100: #EBEAF2;
  --velv-ink-050: #F6F5FB;

  /* Signature gradients */
  --velv-night: linear-gradient(160deg, #000000 0%, #030E2A 42%, #2A2766 78%, #8C7ABF 100%);
  --velv-sky-wash: radial-gradient(120% 120% at 55% 42%, #EAF1FE 0%, #EFEEFE 55%, #F6F5FB 100%);
  --velv-headline: linear-gradient(90deg, #6E9BF0 0%, #8276F1 100%);
  --velv-headline-night: linear-gradient(90deg, #8FB4FF 0%, #A99CFF 100%);

  /* Semantic */
  --bg-page: var(--velv-sky-wash);
  --bg-subtle: var(--velv-ink-050);
  --surface-card: #FFFFFF;
  --surface-header: rgba(255, 255, 255, 0.78);

  --text-strong: var(--velv-off-black);
  --text-body: #2A2A45;
  --text-muted: var(--velv-ink-500);
  --text-accent: var(--velv-electric);

  --border-subtle: var(--velv-ink-100);
  --border-default: var(--velv-ink-200);

  --action-primary: var(--velv-green);
  --action-primary-ink: var(--velv-green-ink);
  --action-brand: var(--velv-electric);
  --action-brand-ink: #FFFFFF;
  --focus-ring: rgba(130, 118, 241, 0.45);

  --status-success: #00C46A;
  --status-warning: #F5B23E;
  --status-danger: #F0506B;
  --status-info: var(--velv-electric);

  /* Type */
  --font-sans: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-bold: 700;
  --fs-h1: 2rem;
  --fs-h2: 1.5rem;
  --fs-h3: 1.125rem;
  --fs-body: 1rem;
  --fs-body-sm: 0.875rem;
  --fs-caption: 0.75rem;
  --fs-overline: 0.6875rem;
  --lh-heading: 1.2;
  --lh-body: 1.55;
  --ls-tight: -0.015em;
  --ls-overline: 0.12em;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Radii — Velv "lightness" */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Shadows — soft, cool-tinted */
  --shadow-xs: 0 1px 2px rgba(17, 17, 44, 0.06);
  --shadow-sm: 0 2px 8px rgba(17, 17, 44, 0.06);
  --shadow-md: 0 8px 24px rgba(17, 17, 44, 0.08);
  --shadow-lg: 0 18px 48px rgba(17, 17, 44, 0.10);
  --shadow-glow-green: 0 10px 30px rgba(0, 255, 136, 0.28);
  --shadow-glow-purple: 0 12px 40px rgba(130, 118, 241, 0.30);

  /* Motion — fluid, never bouncy */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 140ms;
  --dur-base: 240ms;

  /* Layout */
  --container-max: 1100px;
  --header-h: 72px;
}

/* ---- Tokens — dark (Night Sky) ---- */
[data-theme="dark"] {
  --bg-page: #07061A;
  --bg-subtle: #0E0C29;
  --surface-card: #15123A;
  --surface-header: rgba(7, 6, 26, 0.78);

  --text-strong: #FFFFFF;
  --text-body: #EBEAF2;
  --text-muted: #9E9CC2;
  --text-accent: var(--velv-light-purple);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.14);

  --focus-ring: rgba(130, 118, 241, 0.6);
  --velv-headline: var(--velv-headline-night);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-base) var(--ease-out);
}

h1, h2 {
  margin: 0 0 var(--space-2);
  color: var(--text-strong);
  font-weight: var(--fw-regular);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }

a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

hr { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-5) 0; }

::selection { background: var(--velv-electric); color: #fff; }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

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

.muted { color: var(--text-muted); }
.overflow-wrap-anywhere { overflow-wrap: anywhere; }
.preserve-newlines { white-space: pre-wrap; }

/* ---- Icons (mask, recolour via currentColor) ---- */
.icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  background-color: currentColor;
  vertical-align: -0.15em;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.icon-lock { -webkit-mask-image: url("/icons/lock.svg"); mask-image: url("/icons/lock.svg"); }
.icon-check-circle { -webkit-mask-image: url("/icons/check-circle.svg"); mask-image: url("/icons/check-circle.svg"); }
.icon-alert-triangle { -webkit-mask-image: url("/icons/alert-triangle.svg"); mask-image: url("/icons/alert-triangle.svg"); }
.icon-sun { -webkit-mask-image: url("/icons/sun.svg"); mask-image: url("/icons/sun.svg"); }
.icon-moon { -webkit-mask-image: url("/icons/moon.svg"); mask-image: url("/icons/moon.svg"); }
.icon-download { -webkit-mask-image: url("/icons/download.svg"); mask-image: url("/icons/download.svg"); }
.icon-bell { -webkit-mask-image: url("/icons/bell.svg"); mask-image: url("/icons/bell.svg"); }
.icon-menu { -webkit-mask-image: url("/icons/menu.svg"); mask-image: url("/icons/menu.svg"); }
.icon-x { -webkit-mask-image: url("/icons/x.svg"); mask-image: url("/icons/x.svg"); }
.icon-star { -webkit-mask-image: url("/icons/star.svg"); mask-image: url("/icons/star.svg"); }
.icon-inbox { -webkit-mask-image: url("/icons/inbox.svg"); mask-image: url("/icons/inbox.svg"); }

/* ============================================================
   Header
   ============================================================ */
/* ---- Skip link (keyboard/screen-reader users only, until focused) ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  background: var(--surface-card);
  color: var(--text-strong);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-weight: var(--fw-medium);
}
.skip-link:focus {
  top: var(--space-3);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-header);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}
.site-header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: var(--space-2) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.brand { display: inline-flex; align-items: center; gap: var(--space-2); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 24px; width: auto; display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }
.brand-suffix {
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  padding-left: var(--space-2);
  border-left: 1px solid var(--border-default);
}

.nav-cluster { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }

/* ---- Mobile nav toggle (hamburger) - hidden entirely above the mobile
   breakpoint below, where .nav-cluster just displays inline as normal. ---- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-strong);
  cursor: pointer;
  flex: 0 0 auto;
}
.nav-toggle:hover { background: var(--bg-subtle); }
.nav-toggle-icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon-close { display: inline-block; }

.main-nav { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
.main-nav a {
  color: var(--text-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-body-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  transition: background var(--dur-base) var(--ease-out);
}
.main-nav a:hover { background: var(--velv-purple-050); text-decoration: none; }
[data-theme="dark"] .main-nav a:hover { background: rgba(255, 255, 255, 0.08); }
.main-nav .nav-cta {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  color: var(--text-strong);
  box-shadow: var(--shadow-xs);
}
.main-nav .nav-cta:hover { background: var(--bg-subtle); }
.main-nav .nav-user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-body-sm);
  padding: var(--space-2) var(--space-3);
}

/* Notification bell - a <details>/<summary> pair so the dropdown itself
   needs no JS at all; public/js/notifications-bell.js only listens for the
   "toggle" event to mark everything read the moment it's opened. */
.notif-bell { position: relative; }
.notif-bell > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-strong);
}
.notif-bell > summary::-webkit-details-marker { display: none; }
.notif-bell > summary:hover { background: var(--velv-ink-100); }
[data-theme="dark"] .notif-bell > summary:hover { background: rgba(255, 255, 255, 0.08); }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--status-danger);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: var(--fw-medium);
  padding: 3px 5px;
  border-radius: var(--radius-pill);
  min-width: 16px;
  text-align: center;
}
.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 50;
  padding: var(--space-2) 0;
}
.notif-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: inherit;
  text-decoration: none;
  font-size: var(--fs-body-sm);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--velv-ink-100); text-decoration: none; }
[data-theme="dark"] .notif-item:hover { background: rgba(255, 255, 255, 0.08); }
.notif-item.is-unread { font-weight: var(--fw-medium); }
.notif-item .notif-time { display: block; color: var(--text-muted); font-size: var(--fs-caption); margin-top: 2px; }
.notif-empty { padding: var(--space-4); color: var(--text-muted); text-align: center; font-size: var(--fs-body-sm); }

/* "More" nav menu (Agents/Canned responses/Knowledge base/Settings) - same
   <details>/<summary> pattern as .notif-bell, no JS needed. Keeps the
   header down to Dashboard/Assets/Consultants plus this one grouped menu
   for everything used less often, instead of a flat row that grows by one
   link every time a new settings-adjacent page is added. */
.nav-more { position: relative; }
.nav-more > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-body-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover { background: var(--velv-purple-050); }
[data-theme="dark"] .nav-more > summary:hover { background: rgba(255, 255, 255, 0.08); }
.nav-more[open] > summary .nav-more-caret { transform: rotate(180deg); }
.nav-more-caret { display: inline-block; font-size: 0.7em; transition: transform var(--dur-base) var(--ease-out); }
.nav-more-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + var(--space-2));
  min-width: 200px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 50;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-more-dropdown a {
  color: var(--text-body);
  font-size: var(--fs-body-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.nav-more-dropdown a:hover { background: var(--velv-ink-100); text-decoration: none; }
[data-theme="dark"] .nav-more-dropdown a:hover { background: rgba(255, 255, 255, 0.08); }

.link-button {
  background: none;
  border: none;
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-pill);
  transition: color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.link-button:hover { color: var(--velv-electric); background: var(--velv-purple-050); text-decoration: none; }
[data-theme="dark"] .link-button:hover { background: rgba(255, 255, 255, 0.08); }
.inline-form { display: inline; }

/* ---- Language toggle (public pages only) ---- */
.lang-toggle { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--fs-caption); font-weight: var(--fw-medium); }
.lang-toggle a { color: var(--text-muted); text-decoration: none; padding: var(--space-1) var(--space-2); border-radius: var(--radius-xs); }
.lang-toggle a:hover { background: var(--bg-subtle); }
.lang-toggle a.is-active { color: var(--text-strong); background: var(--velv-purple-050); }
[data-theme="dark"] .lang-toggle a.is-active { background: rgba(130, 118, 241, 0.2); }

/* ---- Lights toggle ---- */
.lights-toggle { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; user-select: none; }
.lights-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lights-label { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--text-muted); }
.lights-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 46px;
  height: 24px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--velv-off-black);
  transition: background var(--dur-base) var(--ease-out);
}
[data-theme="dark"] .lights-track { background: var(--velv-purple-100); }
.lights-track .icon { width: 12px; height: 12px; color: rgba(255, 255, 255, 0.55); }
[data-theme="dark"] .lights-track .icon { color: rgba(17, 17, 44, 0.45); }
.lights-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out);
}
.lights-toggle input:checked ~ .lights-track .lights-thumb { transform: translateX(22px); }
.lights-toggle input:focus-visible ~ .lights-track { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

@media (max-width: 640px) {
  .site-header-inner { padding: var(--space-2) var(--space-4); gap: var(--space-2); position: relative; }
  .brand-suffix { display: none; }
  .lights-label { display: none; }
  .main-nav .nav-user { display: none; }

  /* The hamburger button only exists at this width - above it .nav-cluster
     just displays inline as normal (see the un-media-queried rules above). */
  .nav-toggle { display: inline-flex; }

  /* Collapsed into a full-width dropdown panel under the header, open only
     while #nav-toggle has added .is-open (see public/js/nav-toggle.js). */
  .nav-cluster {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    padding: var(--space-3) var(--space-4) var(--space-4);
    z-index: 20;
  }
  .nav-cluster.is-open { display: flex; }

  .main-nav { flex-direction: column; align-items: stretch; gap: var(--space-1); }
  .main-nav a, .main-nav .nav-cta { width: 100%; text-align: left; }
  .main-nav .nav-user { display: flex; width: 100%; }
  .notif-bell { align-self: flex-start; }
  .notif-dropdown { width: min(320px, calc(100vw - 2 * var(--space-5))); right: auto; left: 0; }
}

/* ============================================================
   Layout
   ============================================================ */
.page {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-8);
  min-height: calc(100vh - var(--header-h) - 160px);
}
/* A data-dense page (currently just the ticket-list + reports Dashboard)
   opts into more room than the site's normal 1100px reading-width cap -
   most pages here are forms or a handful of stacked cards that stay
   comfortable at that width, but two real side-by-side panels want it. */
.page-wide { max-width: 1680px; }

/* ============================================================
   Footer — always Night Sky, regardless of the page theme
   ============================================================ */
.site-footer {
  background: var(--velv-night);
  color: rgba(255, 255, 255, 0.7);
}
.site-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-5);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}
.footer-logo { height: 20px; width: auto; display: block; }
.footer-claim { font-size: var(--fs-body-sm); color: rgba(255, 255, 255, 0.85); margin-top: var(--space-2); }
.site-footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); font-size: var(--fs-caption); }

/* ============================================================
   Cards & surfaces
   ============================================================ */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}
.card-narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card-medium { max-width: 640px; margin-left: auto; margin-right: auto; }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--velv-purple-050);
  color: var(--velv-electric);
  margin-bottom: var(--space-4);
}
[data-theme="dark"] .card-icon { background: rgba(130, 118, 241, 0.22); color: var(--velv-light-purple); }
.card-icon.tone-success { background: rgba(0, 196, 106, 0.14); color: #067A45; }
[data-theme="dark"] .card-icon.tone-success { background: rgba(0, 196, 106, 0.22); color: #6FE3A6; }
.card-icon.tone-warning { background: rgba(245, 178, 62, 0.18); color: #8A5A00; }
[data-theme="dark"] .card-icon.tone-warning { background: rgba(245, 178, 62, 0.24); color: #FFCB73; }

/* ============================================================
   Forms
   ============================================================ */
.stacked-form { display: flex; flex-direction: column; gap: var(--space-1); max-width: 520px; }
.stacked-form label {
  display: block;
  font-weight: var(--fw-medium);
  font-size: var(--fs-body-sm);
  color: var(--text-strong);
  margin-top: var(--space-3);
}
/* :not([type="radio"]):not([type="checkbox"]) - a radio/checkbox has its
   own small, native size; without this exclusion the block below stretches
   it to a full-width 46px-tall box, which a circular radio renders as one
   huge blob instead of a normal-sized dot (see .category-card and
   .inline-radios further down, which both rely on this exclusion to render
   at their native size with just an accent color applied). */
.stacked-form input:not([type="radio"]):not([type="checkbox"]),
.stacked-form select,
.stacked-form textarea,
.front-page input,
.quick-request-form input,
.front-help-search input {
  display: block;
  width: 100%;
  padding: 0 var(--space-4);
  height: 46px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--fs-body);
  font-family: inherit;
  background-color: var(--surface-card);
  color: var(--text-strong);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.stacked-form input[type="radio"],
.stacked-form input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--velv-electric);
}
.stacked-form textarea { height: auto; padding: var(--space-3) var(--space-4); resize: vertical; line-height: var(--lh-body); }
.stacked-form input:not([type="radio"]):not([type="checkbox"]):focus,
.stacked-form select:focus,
.stacked-form textarea:focus,
.front-page input:focus,
.quick-request-form input:focus,
.front-help-search input:focus {
  outline: none;
  border-color: var(--velv-electric);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.stacked-form input::placeholder,
.stacked-form textarea::placeholder,
.front-page input::placeholder,
.quick-request-form input::placeholder,
.front-help-search input::placeholder { color: var(--text-muted); }
.form-row { display: flex; gap: var(--space-4); }
.form-row > div { flex: 1; }

.stacked-form input[type="file"] {
  height: auto;
  padding: var(--space-3);
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}
.stacked-form input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
  background: var(--velv-purple-050);
  color: var(--velv-electric);
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  cursor: pointer;
}
[data-theme="dark"] .stacked-form input[type="file"]::file-selector-button { background: rgba(130, 118, 241, 0.2); }
.field-hint { font-size: var(--fs-caption); color: var(--text-muted); margin: 0; }

/* ---- Dropzone (progressive enhancement over a plain file input) ---- */
.dropzone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.dropzone.is-dragover { border-color: var(--velv-electric); background: var(--velv-purple-050); }
[data-theme="dark"] .dropzone.is-dragover { background: rgba(130, 118, 241, 0.14); }
.dropzone-hint { margin: var(--space-2) 0 0; font-size: var(--fs-caption); color: var(--text-muted); text-align: center; }
.dropzone-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.dropzone-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body-sm);
}
.dropzone-list li span { overflow-wrap: anywhere; }
.dropzone-list li button {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 var(--space-1);
}
.dropzone-list li button:hover { color: var(--status-danger); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23565572' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: var(--space-7) !important;
}
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239E9CC2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ============================================================
   Public form layouts — two-column split
   A narrower "aside" column (who/what-it's-about) next to a wider
   "main" column (the actual message/content), used by the request
   form and the ticket-status page. Always collapses to one column
   below 800px - there's no room for two on a phone.
   ============================================================ */
.card-wide { max-width: 880px; margin-left: auto; margin-right: auto; }

/* "Submitting as ..." banner on the public request form, shown once signed
   in via Microsoft (see views/public/request-form.ejs) - name/email are
   locked (plain text, not inputs) at that point, so this is the only place
   they're shown before the ticket itself is created. */
.requester-identity {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-5);
  font-size: var(--fs-body-sm);
  color: var(--text-body);
}
.requester-identity .inline-form { margin-left: var(--space-1); }

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 280px) 1fr;
  gap: var(--space-6) var(--space-7);
  align-items: start;
}
.split-legend {
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

/* "Contacting: TEAM · Change" breadcrumb above the request form's own
   title (see views/public/request-form.ejs) - a status line, not a
   section legend for the fields below it, so it gets its own small style
   rather than reusing .split-legend's uppercase overline treatment. */
.team-context { font-size: var(--fs-body-sm); color: var(--text-muted); margin: 0 0 var(--space-2); }
.team-context strong { color: var(--text-strong); }
@media (max-width: 800px) {
  .split-layout { grid-template-columns: 1fr; }
}

/* A <form class="stacked-form split-layout"> needs the grid to win over
   .stacked-form's own flex/max-width - the field styling underneath
   (label/input/select/textarea) still applies via .stacked-form's
   descendant selectors regardless of the form's own display mode. */
form.split-layout.stacked-form { display: grid; max-width: none; }
.split-layout-actions { grid-column: 1 / -1; margin-top: var(--space-2); }

/* Split-panel auth shell: a permanently-dark brand panel (like the
   footer, deliberately theme-invariant) beside the actual form. */
.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 860px;
  margin: var(--space-6) auto 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}
.auth-split-brand {
  background: var(--velv-night);
  color: #fff;
  padding: var(--space-7) var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-4);
}
.auth-split-brand img { height: 26px; width: auto; }
.auth-split-brand h2 { color: #fff; margin: 0; }
.auth-split-brand p { color: rgba(255, 255, 255, 0.75); margin: 0; max-width: 30ch; }
.auth-split-form {
  background: var(--surface-card);
  padding: var(--space-7) var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 800px) {
  .auth-split { grid-template-columns: 1fr; margin-top: 0; }
  .auth-split-brand { display: none; }
}

/* "Sign in with Microsoft" (see views/auth/login.ejs) - a full-width button
   above the password form, with its own small divider beneath it. The logo
   is a real, official 4-color Microsoft mark (public/img/microsoft-logo.svg)
   via a plain <img>, not the app's usual monochrome .icon mask system -
   recoloring it to currentColor would misrepresent the actual brand mark. */
.button-block { display: flex; width: 100%; margin-top: 0; }

/* Local dev-login link on the login page (see isDevLoginEnabled() in
   src/routes/auth.js) - CSP has no unsafe-inline for style-src, so this is
   a plain class rather than an inline style, same constraint as every
   other view in this app. */
.auth-split-form .dev-login-link { margin-top: var(--space-4); }
.dev-login-list { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-5) 0; padding: 0; list-style: none; }
.ms-logo { width: 1.1em; height: 1.1em; flex: 0 0 auto; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--text-muted);
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: var(--ls-overline);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* The ticket-status lookup form stays a focused, narrow moment even
   though its card widens to fit two columns once a ticket is found.
   text-align: center reaches the heading/copy and the inline-flex
   card-icon; the form itself just fills the narrow wrapper's width. */
.status-lookup { max-width: 420px; margin: 0 auto; text-align: center; }
.status-lookup .stacked-form { text-align: left; }

.icon-search { -webkit-mask-image: url("/icons/search.svg"); mask-image: url("/icons/search.svg"); }
.icon-send { -webkit-mask-image: url("/icons/send.svg"); mask-image: url("/icons/send.svg"); }

/* ============================================================
   Buttons
   ============================================================ */
.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  height: 46px;
  padding: 0 var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-tight);
  cursor: pointer;
  margin-top: var(--space-4);
  width: fit-content;
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.button-primary:hover,
.button-secondary:hover { transform: translateY(-1px); text-decoration: none; }
.button-primary:active,
.button-secondary:active { transform: translateY(0) scale(0.98); }

.button-primary {
  background: var(--action-primary);
  color: var(--action-primary-ink);
  box-shadow: var(--shadow-glow-green);
}
.button-primary:hover { background: var(--action-primary); filter: brightness(1.03); }

.button-secondary {
  background: var(--surface-card);
  color: var(--text-strong);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}
.button-secondary:hover { background: var(--bg-subtle); }

.button-ghost { text-decoration: none; display: inline-flex; align-items: center; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}
/* .alert's own `display: flex` above otherwise overrides the native
   [hidden] attribute's UA-stylesheet `display: none` - never an issue
   before this, since every other .alert in this app is conditionally
   rendered (an EJS `if`) rather than always in the DOM with `hidden`
   toggled on it (see the AI-suggestion chip on new-ticket.ejs/
   request-form.ejs, and public/js/ai-suggest-*.js, which is the first
   place that combines the two). */
.alert[hidden] { display: none; }
.alert-error {
  background: rgba(240, 80, 107, 0.10);
  color: #B0233F;
  border: 1px solid rgba(240, 80, 107, 0.25);
}
[data-theme="dark"] .alert-error { color: #FF95A8; }
.alert-error .icon { flex: 0 0 auto; margin-top: 2px; }
.alert-error ul { margin: 0; padding-left: var(--space-5); }

.alert-info {
  background: var(--velv-purple-050);
  color: var(--velv-off-black);
  border: 1px solid var(--velv-purple-100);
}
[data-theme="dark"] .alert-info { background: rgba(130, 118, 241, 0.14); color: var(--text-body); border-color: rgba(130, 118, 241, 0.28); }
.alert-info .icon { flex: 0 0 auto; margin-top: 2px; }

/* ============================================================
   Definition list (ticket details)
   ============================================================ */
.def-list { display: grid; grid-template-columns: 140px 1fr; gap: var(--space-2) var(--space-4); margin: 0; }
.def-list dt { font-weight: var(--fw-medium); color: var(--text-muted); font-size: var(--fs-body-sm); }
.def-list dd { margin: 0; }
.def-list + h2 { margin-top: var(--space-5); }

/* ============================================================
   Badges (status / priority pills)
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-tight);
  background: var(--velv-ink-100);
  color: var(--velv-ink-700);
  white-space: nowrap;
}
/* Tonal pill backgrounds are intentionally solid, not theme-reactive: they're
   tinted pastel chips regardless of light/dark page, and the ink text below
   is chosen to stay >= 4.5:1 against that fixed background in both themes.
   (The source design system's own "purple" badge tone pairs a light-lavender
   fill with Electric Purple text at ~2.9:1 — below AA for 12px text — so this
   uses off-black instead of literally copying that combination.) */
.badge-status-open { background: var(--velv-purple-100); color: var(--velv-off-black); }
.badge-status-in-progress { background: #FDF0D8; color: #8A5A00; }
.badge-status-waiting-on-customer { background: #E3E8FD; color: #2B3A9E; }
.badge-status-resolved { background: #D6F6E7; color: #067A45; }
.badge-status-closed { background: var(--velv-ink-100); color: var(--velv-ink-700); }
.badge-priority-low { background: var(--velv-ink-100); color: var(--velv-ink-700); }
.badge-priority-medium { background: var(--velv-purple-100); color: var(--velv-off-black); }
.badge-priority-high { background: #FDF0D8; color: #8A5A00; }
.badge-priority-urgent { background: #FDE3E7; color: #B0233F; }
.badge-asset-status-available { background: var(--velv-purple-100); color: var(--velv-off-black); }
.badge-asset-status-reserved { background: #FDF0D8; color: #8A5A00; }
.badge-asset-status-in-use { background: #D6F6E7; color: #067A45; }
.badge-asset-status-in-storage { background: var(--velv-ink-100); color: var(--velv-ink-700); }
.badge-asset-status-under-repair { background: #FDF0D8; color: #8A5A00; }
.badge-asset-status-retired { background: var(--velv-ink-100); color: var(--velv-ink-700); }
.badge-asset-status-lost { background: #FDE3E7; color: #B0233F; }
.badge-aging { background: #FDF0D8; color: #8A5A00; margin-left: var(--space-2); }
.badge-approval-pending { background: #FDF0D8; color: #8A5A00; }
.badge-approval-rejected { background: #FDE3E7; color: #B0233F; }
.badge-approval-approved { background: #D6F6E7; color: #067A45; }
.badge-consultant-status-active { background: #D6F6E7; color: #067A45; }
.badge-consultant-status-ended { background: var(--velv-ink-100); color: var(--velv-ink-700); }

/* Assets page: a card grid instead of a table (see views/dashboard/assets.ejs)
   - each card is itself the link to the asset's detail page, so the whole
   surface is clickable, not just the name. Deliberately no per-category
   icon - this app's existing icon set is all generic UI glyphs (search,
   bell, download, ...), none of which represent a laptop/monitor/phone
   etc., and a wrong icon is worse than no icon. */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.asset-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.asset-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.asset-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.asset-card-category {
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
}
.asset-card-name { font-size: var(--fs-body); font-weight: var(--fw-medium); margin: 0; color: var(--text-strong); line-height: var(--lh-heading); }
.asset-card-tag { font-size: var(--fs-caption); color: var(--text-muted); margin: 0; font-variant-numeric: tabular-nums; }
/* Public "choose your team" picker (see views/public/team-picker.ejs) -
   same clickable-card-grid pattern as .asset-grid/.asset-card above, a
   plainer "moment" page rather than a data-dense one, so cards are wider
   and centered rather than packed edge to edge. */
.team-picker-intro { text-align: center; max-width: 560px; margin: 0 auto var(--space-6); }
.team-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  max-width: 900px;
  margin: 0 auto;
}
.team-picker-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.team-picker-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.team-picker-card-name { font-size: var(--fs-h3); font-weight: var(--fw-medium); margin: 0; color: var(--text-strong); }
.team-picker-card-description { font-size: var(--fs-body-sm); color: var(--text-muted); margin: 0; }
/* Front page (views/public/team-picker.ejs): compact team chips on top,
   the subject-only "Not sure?" box, then recent help-center articles.
   The old .team-picker-* card grid above is kept for anything else that
   still uses it. */
.front-page h1 { margin-bottom: var(--space-5); }
.front-section + .front-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.front-section-label {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--text-strong);
  margin: 0 0 var(--space-3);
}
.team-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.team-chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  color: var(--text-strong);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.team-chip:hover { background: var(--bg-subtle); border-color: var(--velv-electric); text-decoration: none; }

/* "Got a suspicious email?" shortcut straight to IT's Security category. */
.security-report {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--velv-electric);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.security-report + .front-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.security-report > .icon { flex-shrink: 0; width: 20px; height: 20px; color: var(--text-accent); }
.security-report-text { flex: 1; min-width: 0; }
.security-report-title { font-size: var(--fs-body); font-weight: var(--fw-medium); color: var(--text-strong); margin: 0 0 var(--space-1); }
.security-report-text p { margin: 0; font-size: var(--fs-body-sm); color: var(--text-muted); }
.security-report-link { margin-top: 0; flex-shrink: 0; height: 40px; text-decoration: none; }
.security-report-link:hover { text-decoration: none; }
@media (max-width: 640px) {
  .security-report { flex-wrap: wrap; padding: var(--space-4); }
  .security-report > .icon { display: none; }
  .security-report-link { flex: 1 1 100%; white-space: nowrap; }
}

.quick-request-form { display: grid; gap: var(--space-2); }
.quick-request-identity { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.quick-request-row { display: flex; gap: var(--space-2); align-items: stretch; }
.quick-request-row input { flex: 1; min-width: 0; margin: 0; }
.quick-request-row .button-primary { margin-top: 0; flex-shrink: 0; }
.quick-request-form .field-hint { margin: 0; }

.front-help-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.front-help-search { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); }
.front-help-search input { flex: 1; min-width: 0; margin: 0; }
.front-help-search .button-secondary { margin-top: 0; flex-shrink: 0; }
.front-articles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-2);
}
.front-article {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  height: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-base) var(--ease-out);
}
.front-article:hover { background: var(--bg-subtle); text-decoration: none; }
.front-article-title { color: var(--text-strong); font-weight: var(--fw-medium); }
.front-article-category { font-size: var(--fs-caption); color: var(--text-muted); }

@media (max-width: 560px) {
  .quick-request-identity { grid-template-columns: 1fr; }
  .quick-request-row, .front-help-search { flex-direction: column; }
  .quick-request-row input, .front-help-search input { flex: none; }
  .quick-request-row .button-primary, .front-help-search .button-secondary { width: 100%; }
}
/* Category picker on each team's dedicated request form (see
   views/public/request-form.ejs) - a row of real radio inputs, each
   wrapped as a clickable card via <label>, rather than a plain <select>. */
.category-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-2); }
.category-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.category-card:hover { border-color: var(--velv-electric); }
.category-card:has(:checked) { border-color: var(--velv-electric); box-shadow: 0 0 0 1px var(--velv-electric); }
.category-card:has(:focus-visible) { outline: 2px solid var(--velv-electric); outline-offset: 2px; }
.category-card-name { font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
/* A category's own notice (e.g. a lead-time reminder) - a plain hint line
   under the picker once that category's chosen, not a bordered alert box;
   it's a helpful detail, not a warning. */
.category-notice { font-size: var(--fs-body-sm); color: var(--text-accent); margin: calc(-1 * var(--space-1)) 0 var(--space-3); }
.asset-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-body-sm);
  color: var(--text-body);
}

/* ============================================================
   Tags
   ============================================================ */
.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 26px;
  padding: 0 var(--space-1) 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--velv-ink-100);
  color: var(--velv-ink-700);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
}
.tag-chip form { display: inline-flex; margin: 0; }
.tag-chip a { color: inherit; text-decoration: none; }
.tag-chip a:hover { text-decoration: underline; }
.tag-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
}
.tag-chip button:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }
.tag-add-form { display: inline-flex; gap: var(--space-2); align-items: center; }
.tag-add-form input {
  height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  font-size: var(--fs-body-sm);
  background: var(--surface-card);
  color: var(--text-strong);
  width: 140px;
}
.tag-add-form input:focus { outline: none; border-color: var(--velv-electric); box-shadow: 0 0 0 4px var(--focus-ring); }
.tag-add-form .button-secondary { height: 32px; padding: 0 var(--space-3); margin-top: 0; font-size: var(--fs-caption); }

/* ============================================================
   Satisfaction rating (dashboard stat tile, ticket detail, public form)
   ============================================================ */
.stat-tile-satisfaction { border-top-color: var(--velv-electric); }
.stat-tile-satisfaction .stat-count { display: inline-flex; align-items: center; gap: var(--space-1); }
.stat-tile-satisfaction .icon-star { width: 0.85em; height: 0.85em; }

.icon-star { color: var(--velv-ink-300); }
.icon-star.is-filled { color: var(--velv-electric); }
.rating-stars { display: flex; gap: 2px; margin: 0 0 var(--space-3); }
.rating-stars .icon-star { width: 20px; height: 20px; }

.star-rating { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: var(--space-1); margin-bottom: var(--space-2); }
.star-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-rating label { cursor: pointer; display: inline-flex; padding: var(--space-1); }
.star-rating label .icon-star { width: 32px; height: 32px; }
.star-rating input:checked ~ label .icon-star,
.star-rating label:hover .icon-star,
.star-rating label:hover ~ label .icon-star {
  color: var(--velv-electric);
}
.star-rating input:focus-visible ~ label { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ============================================================
   Agents — active / deactivated
   ============================================================ */
.row-inactive { opacity: 0.55; }

/* ============================================================
   Reply / requester-reply activity
   ============================================================ */
.badge-visible-to-requester {
  background: rgba(0, 196, 106, 0.14);
  color: #067A45;
  margin-left: var(--space-2);
  font-size: 10px;
  height: 20px;
}
.activity-item.activity-reply,
.activity-item.activity-requester_reply { border-left-color: var(--status-success); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-body-sm);
  color: var(--text-body);
  margin-top: var(--space-3);
  cursor: pointer;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--velv-electric); }

/* ============================================================
   Requester ticket history
   ============================================================ */
.requester-history { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.requester-history li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--fs-body-sm); }
.requester-history a { color: var(--text-strong); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.requester-history a:hover { color: var(--velv-electric); }

/* ============================================================
   Bulk actions (dashboard ticket list)
   ============================================================ */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}
.bulk-action-label { font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--text-muted); margin-right: auto; }
.bulk-action-bar select {
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body-sm);
  background: var(--surface-card);
  color: var(--text-strong);
}
.bulk-action-bar .button-secondary,
.bulk-action-bar .button-primary { height: 36px; padding: 0 var(--space-4); margin-top: 0; }
.ticket-table .row-select,
.ticket-table #select-all { width: 16px; height: 16px; accent-color: var(--velv-electric); }

/* ============================================================
   Satisfaction / resolution-time stat tiles
   ============================================================ */
.stat-tile-resolution { border-top-color: var(--velv-electric); }

/* ============================================================
   Public conversation thread (/status)
   ============================================================ */
.conversation-thread { list-style: none; margin: var(--space-3) 0 var(--space-5); padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.conversation-item { border-left: 3px solid var(--border-default); padding-left: var(--space-3); }
.conversation-item-agent { border-left-color: var(--velv-electric); }
.conversation-item-you { border-left-color: var(--velv-ink-400); }
.badge-group { display: flex; gap: var(--space-2); align-items: flex-start; }

/* ============================================================
   Dashboard — stat tiles
   ============================================================ */
.dashboard-head { margin-bottom: var(--space-5); }
.dashboard-head-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.dashboard-head-title h1 { margin-bottom: 0; }
.dashboard-head-title .button-primary { margin-top: 0; }
.stat-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.stat-tile {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: var(--space-3) var(--space-5);
  min-width: 110px;
  text-align: center;
}
.stat-tile-open { border-top-color: var(--velv-electric); }
.stat-tile-in-progress { border-top-color: var(--status-warning); }
.stat-tile-resolved { border-top-color: var(--status-success); }
.stat-tile-closed { border-top-color: var(--velv-ink-400); }
.stat-count { display: block; font-size: 1.6rem; font-weight: var(--fw-bold); color: var(--text-strong); }
.stat-label { display: block; color: var(--text-muted); font-size: var(--fs-caption); margin-top: var(--space-1); text-transform: capitalize; }

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  align-items: center;
}
.filter-bar input,
.filter-bar select {
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body-sm);
  background-color: var(--surface-card);
  color: var(--text-strong);
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--velv-electric);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.filter-bar input[type="text"] { min-width: 220px; flex: 1; }
.filter-bar .button-secondary { margin-top: 0; height: 40px; padding: 0 var(--space-4); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  /* Scroll-shadow trick: two solid "cover" gradients pinned to the content
     via background-attachment: local hide the shadow layers underneath
     until the content actually scrolls past that edge, so the hint only
     appears when there's more to see (no JS/scroll-listener needed). */
  background-color: var(--surface-card);
  background-image:
    linear-gradient(to right, var(--surface-card) 30%, transparent),
    linear-gradient(to left, var(--surface-card) 30%, transparent),
    linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent),
    linear-gradient(to left, rgba(0, 0, 0, 0.15), transparent);
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-attachment: local, local, scroll, scroll;
}
.table-wrap-spaced { margin-top: var(--space-5); }
.asset-sync-error-col { max-width: 320px; white-space: normal; word-break: break-word; }
.ticket-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.ticket-table th, .ticket-table td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.ticket-table td:nth-child(2) { white-space: normal; }
.ticket-table th {
  color: var(--text-muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-overline);
}
.ticket-table tbody tr:last-child td { border-bottom: none; }
.ticket-table tbody tr:hover { background: var(--bg-subtle); }
.ticket-table a { color: var(--text-strong); font-weight: var(--fw-medium); }
.ticket-table a:hover { color: var(--velv-electric); }
.empty-row { text-align: center; color: var(--text-muted); padding: var(--space-6); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin: 0 0 var(--space-6);
}
.pagination-status { color: var(--text-muted); font-size: var(--fs-body-sm); }
.pagination [aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }

/* ============================================================
   Ticket detail
   ============================================================ */
/* Capped and centered within the wider .page-wide page (see .ticket-grid
   below) - on a very wide screen, letting the title bar/tags/grid all
   stretch edge to edge made the page feel sparse rather than dense. A
   comfortable max-width with auto side margins reads as an intentional
   layout, not empty space. Scoped to this one wrapper (not the shared
   .ticket-head/.tag-row classes directly) - both of those are reused by
   the consultant/asset detail pages and the dashboard's own tag row,
   none of which should be narrowed by a change meant for this page only. */
.ticket-page-content { max-width: 1300px; margin-left: auto; margin-right: auto; }

.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
/* Full-width "holy grail" layout (see wide:true on this route -
   src/routes/dashboard.js): Description/Activity anchor the center column,
   flanked left (Properties/More properties - the fields touched on nearly
   every ticket, read first) and right (Transfer/Approval - less frequent,
   consequential actions). Everything that benefits from real horizontal
   room (Time tracked's side-by-side fields, Relationships' lists, Admin
   actions, From this requester) lives in a full-width row below all three,
   not squeezed into a side column. Named areas (not just column order) so
   the narrow-viewport override below can reorder Description/Activity
   ahead of the side columns without touching the markup. */
.ticket-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 240px;
  grid-template-areas: "left center right" "bottom bottom bottom";
  gap: var(--space-4);
  align-items: start;
}
.ticket-left { grid-area: left; display: flex; flex-direction: column; gap: var(--space-3); }
.ticket-center { grid-area: center; display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.ticket-right { grid-area: right; display: flex; flex-direction: column; gap: var(--space-3); }
.ticket-bottom {
  grid-area: bottom;
  display: grid;
  /* 320px, not 260px: Time tracked's minutes/date fields sit side by side
     (.form-row) and that breakpoint is keyed to the page's own viewport
     width, not this card's container width - a real bug hit at 900px,
     where 3-up at a smaller minimum left each bottom card too narrow for
     .form-row's two inputs even though the page itself was still above
     .form-row's own 800px stacking breakpoint. */
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-3);
  align-items: start;
}

/* Smaller padding/heading than a normal .card (see .card above) - every
   card in the left/right/bottom zones is meant to read as a quick-glance
   chip, not a full page section. */
.card-compact { padding: var(--space-3); margin-bottom: 0; }
.card-compact h2 { font-size: var(--fs-h3); margin-bottom: var(--space-1); }
.card-compact p { margin-bottom: var(--space-1); }
.card-compact .field-hint { font-size: var(--fs-caption); margin-bottom: var(--space-1); }
.card-compact .property-list { gap: var(--space-2); }
.card-compact .card-subhead { margin: var(--space-2) 0 var(--space-1); }

/* .property-row's normal shape (fixed-width label, then select+button
   inline - see .property-row above) needs real width to work; the left/
   right zones here are only 220-260px, not enough room for a label AND a
   readable select AND a button on one line without truncating the
   select's own text (a real bug hit while building this, not a style
   nitpick - "Medium"/"In Progress"/"Rodrigo Dias" were rendering as
   "Med"/"In Progres"/"Rodrigo D" even after just wrapping the label onto
   its own line - select+button together still didn't have room). Full
   column stack - label, then select, then button each on their own line -
   guarantees the select gets the whole card's width regardless of
   viewport, so it never truncates. */
.card-compact .property-row { flex-direction: column; align-items: stretch; gap: var(--space-1); }
/* .property-row label's base rule (below) sets flex: 0 0 72px, a fixed
   WIDTH in that rule's original horizontal row layout - in this
   column-direction context flex-basis instead sets a fixed HEIGHT, padding
   the label box with empty space below its own text (the dominant visible
   part of the "gap before the select" bug this was written to fix; the
   select's own leftover flex: 1 immediately below compounded it further,
   also fixed here). */
.card-compact .property-row label { flex: none; }
.card-compact .property-row select,
.card-compact .property-row input[type="number"],
.card-compact .property-row input[type="date"] {
  /* .property-row select's base rule (below) sets flex: 1, which meant
     "grow to fill the remaining WIDTH" in that rule's original horizontal
     row layout - in this column-direction context flex-grow instead
     pulls extra HEIGHT into the select's flex item box (main axis is
     vertical in a column flex container), leaving a large empty gap
     above or below the actual control since a native <select> doesn't
     visually stretch to fill it. A real bug, not just visual noise -
     caught on a real Chrome/Edge render, not reproduced in this
     session's own Chromium screenshots because the surplus-space
     conditions that make flex-grow visible depend on exactly how much
     extra room the column has, which varies by card/content. */
  flex: none;
  width: 100%;
}
.card-compact .property-row .button-secondary { align-self: flex-start; }

@media (max-width: 1400px) {
  .ticket-grid { grid-template-columns: 220px minmax(0, 1fr) 220px; }
}

@media (max-width: 1100px) {
  .ticket-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "center" "left" "right" "bottom";
  }
}

/* Simpler two-column detail layout, for pages with real content in only
   two zones (see views/dashboard/asset.ejs and consultant.ejs - main
   content like the Details form and Activity feed, plus a narrower side
   column like related tickets or a Confidential toggle) - not the busier
   3-column .ticket-grid above, which was built for the ticket page's own
   Properties/Transfer/Approval spread and these pages never had a matching
   "left" zone for. :has() scopes this to only the .ticket-grid instances
   that actually use it, leaving the ticket page's own left/center/right
   areas above untouched. */
.ticket-grid:has(> .ticket-main) {
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "main side";
}
.ticket-main { grid-area: main; display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.ticket-side { grid-area: side; display: flex; flex-direction: column; gap: var(--space-3); }
@media (max-width: 900px) {
  .ticket-grid:has(> .ticket-main) { grid-template-columns: 1fr; grid-template-areas: "main" "side"; }
}

/* Requester directory enrichment (department/job title/phone/photo, see
   src/directory.js) - a small circular avatar beside the existing "From
   NAME (email)" line, both stay top-aligned since the line can wrap onto
   two lines (name/email, then job title/department/phone). */
.requester-line { display: flex; align-items: flex-start; gap: var(--space-3); }
.directory-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--bg-subtle); }
.directory-avatar-sm { width: 22px; height: 22px; }

/* Ticket detail sidebar: consolidated cards (Properties, Relationships)
   instead of one small single-field card each - same forms/routes as
   before, just grouped so the sidebar isn't 8 near-identical tiny boxes.
   .property-row mirrors .filter-bar's own compact label+field+button row
   (same heights/colors), just with a fixed-width label instead of a
   flex:1 text input up front. */
.property-list { display: flex; flex-direction: column; gap: var(--space-3); }
.property-row { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.property-row label { flex: 0 0 72px; font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--text-body); }
.property-row select,
.property-row input[type="number"],
.property-row input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background-color: var(--surface-card);
  color: var(--text-strong);
  font-family: inherit;
  font-size: var(--fs-body-sm);
}
.property-row select:focus,
.property-row input[type="number"]:focus,
.property-row input[type="text"]:focus {
  outline: none;
  border-color: var(--velv-electric);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.property-row .button-secondary { flex: 0 0 auto; height: 36px; padding: 0 var(--space-3); font-size: var(--fs-caption); margin-top: 0; }

/* A field inside a combined multi-field form (see /tickets/:id/properties
   and /tickets/:id/more-properties in src/routes/dashboard.js) - label
   above its control, one shared Save button at the end of the form
   instead of .property-row's own per-field button. */
.property-field { display: flex; flex-direction: column; gap: var(--space-1); }
.property-field label { font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--text-body); }
.property-field select,
.property-field input[type="date"] {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background-color: var(--surface-card);
  color: var(--text-strong);
  font-family: inherit;
  font-size: var(--fs-body-sm);
}
.property-field select:focus,
.property-field input[type="date"]:focus {
  outline: none;
  border-color: var(--velv-electric);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.property-field .muted,
.property-field .field-hint { margin: 0; }

/* A small muted overline between subsections sharing one card (e.g.
   Relationships: possible duplicates / related tickets / merge) - like
   .chart-eyebrow but with real top margin, since this one separates two
   already-populated blocks rather than sitting right above a card's own
   <h2> title. */
.card-subhead {
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-2);
}
.card-subhead:first-of-type { margin-top: 0; }

/* Dashboard: the ticket list (filters/bulk actions/table/pagination) sits
   full width up top, exactly like the plain ticket-only dashboard always
   looked. Reports live in their own full-width section below, separated
   by a divider, so .report-row-3/.report-bento get the whole .page-wide
   column to arrange their own card rows in - no squeezed sidebar. */
.dashboard-reports { margin-top: var(--space-7); padding-top: var(--space-6); border-top: 1px solid var(--border-subtle); }
.reports-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.dashboard-reports-title { margin-bottom: 0; }
.report-range-form { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.report-range-form label { font-size: var(--fs-body-sm); color: var(--text-muted); }

/* My day (see /dashboard/my-day): the "tickets you're watching" card sits
   below the main assigned-to-me table with some breathing room - a plain
   utility class since CSP has no unsafe-inline for style-src. */
.watching-card { margin-top: var(--space-6); }

/* ============================================================
   Settings sidebar (views/partials/settings-nav.ejs)
   ============================================================
   Every /dashboard/settings* page (plus /dashboard/recurring, which lives
   under this same umbrella) wraps its content in .settings-layout so the
   sidebar stays put across all ten of them instead of each page linking
   sideways to the others in a paragraph of prose. Same fixed-sidebar +
   fluid-content shape as .ticket-grid, just a narrower first column since
   this one is nav links, not a data panel. */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-6); align-items: start; }
.settings-content > h1:first-child { margin-top: 0; }

.settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  position: sticky;
  top: var(--space-5);
}
.settings-nav-group { display: flex; flex-direction: column; gap: 2px; }
.settings-nav-label {
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-2) var(--space-3);
}
.settings-sidebar a {
  color: var(--text-body);
  font-size: var(--fs-body-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.settings-sidebar a:hover { background: var(--velv-purple-050); text-decoration: none; }
[data-theme="dark"] .settings-sidebar a:hover { background: rgba(255, 255, 255, 0.08); }
.settings-sidebar a.is-active {
  background: var(--velv-purple-050);
  color: var(--velv-electric);
  font-weight: var(--fw-medium);
}
[data-theme="dark"] .settings-sidebar a.is-active { background: rgba(130, 118, 241, 0.16); color: var(--velv-light-purple); }

@media (max-width: 800px) {
  .form-row { flex-direction: column; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-2);
  }
  .settings-nav-group { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
  .settings-nav-label { margin: 0; }
}

.activity-feed { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.activity-item { border-left: 3px solid var(--border-default); padding-left: var(--space-3); }
.activity-item.activity-note { border-left-color: var(--velv-electric); }
.activity-meta { font-size: var(--fs-caption); color: var(--text-muted); margin-bottom: 2px; }
.activity-body { white-space: pre-wrap; }

/* ============================================================
   Attachments
   ============================================================ */
.attachment-list { list-style: none; margin: var(--space-3) 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body-sm);
}
.attachment-thumb { width: 36px; height: 36px; border-radius: var(--radius-xs); object-fit: cover; flex: 0 0 auto; background: var(--border-subtle); }
.attachment-name { flex: 1; color: var(--text-strong); font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.attachment-meta { color: var(--text-muted); font-size: var(--fs-caption); white-space: nowrap; }
.attachment-download-form { display: inline-flex; margin: 0; }
.attachment-download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  padding: var(--space-1) var(--space-2);
  color: var(--velv-electric);
  font-family: inherit;
  font-weight: var(--fw-medium);
  font-size: var(--fs-body-sm);
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.attachment-download-btn:hover { background: var(--velv-purple-050); text-decoration: none; }
[data-theme="dark"] .attachment-download-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* ============================================================
   Ticket print / PDF-export view
   ============================================================ */
.print-page { max-width: 760px; margin: 0 auto; padding: var(--space-6) var(--space-5); }
.print-toolbar { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); }
.print-toolbar .button-primary,
.print-toolbar .button-secondary { margin-top: 0; }
.print-activity { list-style: none; margin: var(--space-3) 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.print-activity li { border-top: 1px solid var(--border-subtle); padding-top: var(--space-3); }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* ============================================================
   Reports charts
   No inline styles (CSP has no 'unsafe-inline' for style-src) - bar sizes
   come from this fixed set of width/height utility classes (5% steps),
   picked server-side (src/routes/dashboard.js's barClass), not inline
   style attributes. One sequential hue (brand purple) throughout: every
   chart here compares a single count across categories, not multiple
   overlapping series, so there's no need for a multi-hue categorical scheme.
   ============================================================ */
/* Three trend charts side by side (Tickets created / Satisfaction trend /
   SLA compliance) - collapses at a wider breakpoint than the two-column
   .report-bento row below, since three vbar-charts need more room each
   before they get too narrow to read. */
.report-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); align-items: stretch; margin-bottom: var(--space-5); }
@media (max-width: 1100px) {
  .report-row-3 { grid-template-columns: 1fr; }
}

/* Bento mosaic for the breakdown row: asymmetric column widths instead of
   three equal thirds. By category gets the widest column (its labels run
   longest - "Account & Access" - and it's usually the primary axis tickets
   get triaged by); Status and Workload share the remaining, narrower space.
   Deliberately NOT an uneven row-span (e.g. a tile spanning two rows) -
   tried that first, but row count for all three is real ticket data (how
   many categories/statuses/agents actually have tickets right now), not
   a fixed list, so nothing guarantees Workload (or any of them) reliably
   has more rows to fill a taller tile with - on a small team it's often
   the shortest of the three, which just left a stretched tile with a lot
   of dead centered space. Equal-height row via `align-items: stretch`
   avoids that: every tile stays exactly as tall as its row's content.  */
.report-bento {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: var(--space-5);
  align-items: stretch;
}
@media (max-width: 900px) {
  .report-bento { grid-template-columns: 1fr; }
}
.report-row-3 .card,
.report-bento .card { margin-bottom: 0; display: flex; flex-direction: column; }

.chart-eyebrow {
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-1);
}

.vbar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  /* A faint 25/50/75/100% reference grid, drawn as a background rather than
     extra markup - keeps bar heights readable without a numeric y-axis. */
  background-image: repeating-linear-gradient(
    0deg,
    var(--border-subtle) 0,
    var(--border-subtle) 1px,
    transparent 1px,
    transparent 25%
  );
}
.vbar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.vbar-fill {
  width: 100%;
  background: var(--velv-electric);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: filter var(--dur-fast) var(--ease-out);
}
.vbar-col:hover .vbar-fill { filter: brightness(0.82); }
[data-theme="dark"] .vbar-col:hover .vbar-fill { filter: brightness(1.25); }
.vbar-axis { display: flex; justify-content: space-between; margin-top: var(--space-2); font-size: var(--fs-caption); color: var(--text-muted); }

.hbar-chart { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; justify-content: center; }
.hbar-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: var(--space-3); padding: var(--space-1) 0; border-radius: var(--radius-xs); transition: background var(--dur-fast) var(--ease-out); }
.hbar-row:hover { background: var(--bg-subtle); }
.hbar-label { font-size: var(--fs-body-sm); color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--bg-subtle); border-radius: var(--radius-pill); overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--velv-electric); border-radius: var(--radius-pill); }
.hbar-value { font-size: var(--fs-caption); color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Hover tooltip for individual chart marks (vbar columns): the text comes
   from a data-tip attribute via CSS attr(), so - like the bar-w-*/bar-h-*
   classes above - no per-request inline style is ever generated. Deliberately
   theme-invariant (a dark chip in either theme), same idea as the auth-split
   brand panel or the footer. */
.chart-tip { position: relative; }
.chart-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--velv-off-black);
  color: #fff;
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.chart-tip:hover::after { opacity: 1; visibility: visible; }

/* A no-data placeholder sized to fill the same card real estate a populated
   chart would - keeps a row of side-by-side cards (e.g. .report-row-3)
   from looking lopsided when one has data and its neighbors don't. */
.chart-empty {
  flex: 1;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-muted);
  text-align: center;
}
.chart-empty .icon { width: 28px; height: 28px; opacity: 0.6; }
.chart-empty p { margin: 0; }

.stat-tile.is-empty { opacity: 0.55; }
.stat-tile.is-empty .stat-count { color: var(--text-muted); font-weight: var(--fw-medium); }


.bar-w-0 { width: 0%; }
.bar-w-5 { width: 5%; }
.bar-w-10 { width: 10%; }
.bar-w-15 { width: 15%; }
.bar-w-20 { width: 20%; }
.bar-w-25 { width: 25%; }
.bar-w-30 { width: 30%; }
.bar-w-35 { width: 35%; }
.bar-w-40 { width: 40%; }
.bar-w-45 { width: 45%; }
.bar-w-50 { width: 50%; }
.bar-w-55 { width: 55%; }
.bar-w-60 { width: 60%; }
.bar-w-65 { width: 65%; }
.bar-w-70 { width: 70%; }
.bar-w-75 { width: 75%; }
.bar-w-80 { width: 80%; }
.bar-w-85 { width: 85%; }
.bar-w-90 { width: 90%; }
.bar-w-95 { width: 95%; }
.bar-w-100 { width: 100%; }
.bar-h-0 { height: 0%; }
.bar-h-5 { height: 5%; }
.bar-h-10 { height: 10%; }
.bar-h-15 { height: 15%; }
.bar-h-20 { height: 20%; }
.bar-h-25 { height: 25%; }
.bar-h-30 { height: 30%; }
.bar-h-35 { height: 35%; }
.bar-h-40 { height: 40%; }
.bar-h-45 { height: 45%; }
.bar-h-50 { height: 50%; }
.bar-h-55 { height: 55%; }
.bar-h-60 { height: 60%; }
.bar-h-65 { height: 65%; }
.bar-h-70 { height: 70%; }
.bar-h-75 { height: 75%; }
.bar-h-80 { height: 80%; }
.bar-h-85 { height: 85%; }
.bar-h-90 { height: 90%; }
.bar-h-95 { height: 95%; }
.bar-h-100 { height: 100%; }

/* Per-ticket category checklist (views/dashboard/ticket.ejs) and its
   settings editor (views/dashboard/departments.ejs). */
.ticket-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ticket-checklist li { display: flex; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; }
.checklist-toggle {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  padding: 0;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--surface-card);
  cursor: pointer;
}
.checklist-toggle:hover { border-color: var(--velv-electric); }
.is-done .checklist-toggle { background: var(--velv-electric); border-color: var(--velv-electric); box-shadow: inset 0 0 0 3px var(--surface-card); }
.checklist-label { flex: 1; min-width: 0; color: var(--text-strong); }
.is-done .checklist-label { color: var(--text-muted); text-decoration: line-through; }
.checklist-meta { flex-basis: 100%; padding-left: calc(20px + var(--space-3)); font-size: var(--fs-caption); }
.checklist-admin { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.checklist-admin li span { margin-right: var(--space-2); }

/* Signed-in requester's own tickets on /status (views/public/status-check.ejs). */
.my-tickets-title { font-size: var(--fs-body); font-weight: var(--fw-medium); margin: var(--space-5) 0 var(--space-3); }
.my-tickets { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); }
.my-tickets form { margin: 0; }
.my-ticket {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-strong);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.my-ticket:hover { border-color: var(--velv-electric); background: var(--bg-subtle); }
.my-ticket-number { color: var(--text-muted); font-size: var(--fs-body-sm); flex-shrink: 0; }
.my-ticket-subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-ticket .badge { flex-shrink: 0; }
.my-tickets-lookup-label { margin-bottom: var(--space-2); }

/* Known-issues banner (views/partials/known-issues.ejs) on the front page
   and each team's request form. Amber, not error-red: it's "we know, we're
   on it", not "something you did went wrong". */
.known-issues {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid rgba(214, 150, 20, 0.35);
  border-left: 3px solid #D69614;
  border-radius: var(--radius-md);
  background: rgba(214, 150, 20, 0.08);
}
.known-issues-title { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body); font-weight: var(--fw-medium); margin: 0 0 var(--space-2); color: var(--text-strong); }
.known-issues-title .icon { color: #B57A00; }
[data-theme="dark"] .known-issues-title .icon { color: #F2B544; }
.known-issues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.known-issues li { color: var(--text-strong); }
.known-issues li p { margin: var(--space-1) 0 0; font-size: var(--fs-body-sm); color: var(--text-muted); }
.known-issue-team { margin-left: var(--space-2); font-size: var(--fs-caption); color: var(--text-muted); }

/* "Searches with no results" on the dashboard KB page. */
.kb-gaps { margin-bottom: var(--space-5); }
.kb-gaps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.kb-gaps-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); }
.kb-gap-query { color: var(--text-strong); font-weight: var(--fw-medium); }

/* ============================================================
   Flow pages (sign-in "stage", front page, guided request form,
   confirmation, status lookup). Full-bleed rather than a centered card:
   .page-flow drops the 1100px reading-width cap and each section picks
   its own width via .flow-wrap.
   ============================================================ */
.page-flow { max-width: none; padding: 0; min-height: calc(100vh - var(--header-h) - 114px); }
.flow-wrap { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-5); }
.flow-body { padding-top: var(--space-6); padding-bottom: var(--space-8); }

.button-lg { height: 52px; font-size: var(--fs-body); }

/* ---- Sign-in stage: brand panel + form, filling the viewport ---- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-h) - 120px);
}
.stage-brand {
  position: relative;
  overflow: hidden;
  background: var(--velv-night);
  color: #fff;
  display: flex;
  align-items: center;
  padding: var(--space-8) var(--space-7);
}
.stage-orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; pointer-events: none; }
.stage-orb-a { width: 380px; height: 380px; background: #8276F1; top: -120px; right: -100px; }
.stage-orb-b { width: 300px; height: 300px; background: #00FF88; opacity: 0.16; bottom: -140px; left: -80px; }
.stage-brand-inner { position: relative; max-width: 480px; display: flex; flex-direction: column; gap: var(--space-5); }
.stage-logo { height: 26px; width: auto; align-self: flex-start; }
.stage-eyebrow { font-size: var(--fs-overline); letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--velv-light-purple); margin: 0; }
.stage-title { text-wrap: balance; color: #fff; font-size: clamp(1.9rem, 3.2vw, 2.7rem); line-height: 1.12; margin: 0; }
.stage-points, .stage-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.stage-points li, .stage-steps li { display: flex; gap: var(--space-3); align-items: flex-start; }
.stage-points strong, .stage-steps strong { display: block; color: #fff; font-weight: var(--fw-medium); }
.stage-points li div span, .stage-steps li div span { display: block; color: rgba(255, 255, 255, 0.7); font-size: var(--fs-body-sm); margin-top: 2px; }
.stage-point-dot { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--velv-green); box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.16); }
.stage-step-num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-body-sm);
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.28); color: #fff;
}
.stage-claim { margin: var(--space-4) 0 0; font-size: var(--fs-body-sm); color: rgba(255, 255, 255, 0.55); }

.stage-form { background: var(--surface-card); display: flex; align-items: center; padding: var(--space-7) var(--space-6); }
.stage-form-inner { width: 100%; max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.stage-form-inner h1 { margin: 0; }
.stage-lead { margin: 0; color: var(--text-muted); }
.stage-badge {
  align-self: flex-start; display: inline-flex; align-items: center; gap: var(--space-2);
  height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-pill);
  background: var(--velv-purple-050); color: var(--velv-electric);
  font-size: var(--fs-caption); font-weight: var(--fw-medium);
}
[data-theme="dark"] .stage-badge { background: rgba(130, 118, 241, 0.22); color: var(--velv-light-purple); }
.stage-badge .icon { width: 14px; height: 14px; }
.stage-assurances { list-style: none; margin: var(--space-2) 0 0; padding: var(--space-4) 0 0; border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--fs-body-sm); color: var(--text-muted); }
.stage-assurances li { display: flex; gap: var(--space-2); align-items: flex-start; }
.stage-assurances .icon { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; color: var(--status-success); }
.stage-alt { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); font-size: var(--fs-body-sm); color: var(--text-muted); }
.stage-form .dev-login-link { margin: 0; }
.stage-2fa { max-width: none; }
.code-input { font-size: 1.6rem; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; min-height: 0; }
  .stage-brand { padding: var(--space-6) var(--space-5); }
  .stage-points, .stage-claim { display: none; }
  .stage-title { font-size: 1.6rem; }
  .stage-form { padding: var(--space-6) var(--space-5); }
}

/* ---- Hero bands ---- */
.flow-hero { background: var(--velv-night); color: #fff; padding: var(--space-8) 0 var(--space-7); position: relative; overflow: hidden; }
.flow-hero::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: #8276F1; filter: blur(90px); opacity: 0.4; top: -200px; right: 6%; pointer-events: none; }
.flow-hero > .flow-wrap { position: relative; }
.flow-hero-compact { padding: var(--space-6) 0 var(--space-6); }
.flow-hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin: 0 0 var(--space-3); }
.flow-hero-compact h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.flow-eyebrow { font-size: var(--fs-overline); letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--velv-light-purple); margin: 0 0 var(--space-3); }
.flow-eyebrow a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.flow-eyebrow strong { color: #fff; }
.flow-lead { color: rgba(255, 255, 255, 0.78); max-width: 56ch; margin: 0 0 var(--space-5); font-size: 1.05rem; }
.flow-hero-compact .flow-lead { margin-bottom: var(--space-5); }
.flow-hero-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: var(--space-6); align-items: stretch; }
.flow-hero .alert { margin-bottom: var(--space-4); }

.hero-ask { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: var(--radius-lg); padding: var(--space-5); backdrop-filter: blur(6px); }
.hero-ask-label { color: #fff; font-size: var(--fs-body); font-weight: var(--fw-medium); margin: 0 0 var(--space-3); }
.hero-ask .field-hint, .hero-ask .known-issue-team { color: rgba(255, 255, 255, 0.65); }
.hero-ask #kb-suggestions { background: rgba(255, 255, 255, 0.06); border-radius: var(--radius-sm); padding: var(--space-3); }
.hero-ask #kb-suggestions a { color: #fff; }
.hero-ask #kb-suggestions .field-hint { color: rgba(255, 255, 255, 0.75); }
.hero-ask input { background: var(--surface-card); }

.hero-side { display: flex; flex-direction: column; gap: var(--space-3); }
/* Right column matches the left one's full height: the Quick fixes panel absorbs the slack. */
.hero-panel { flex: 1; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(6px); }
.hero-panel-head { display: flex; align-items: center; gap: var(--space-2); }
.hero-panel-head .icon { width: 20px; height: 20px; color: var(--velv-green); }
.hero-panel-head h2 { color: #fff; font-size: var(--fs-body); font-weight: var(--fw-medium); margin: 0; flex: 1; }
.hero-panel-head a { color: var(--velv-light-purple); font-size: var(--fs-body-sm); }
.hero-panel .front-help-search { margin: 0; }
.hero-panel .front-help-search input { background: var(--surface-card); }
.hero-articles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hero-articles li + li { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.hero-articles a { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); padding: var(--space-2) 0; color: #fff; text-decoration: none; }
.hero-articles a:hover .hero-article-title { text-decoration: underline; text-underline-offset: 3px; }
.hero-article-title { font-size: var(--fs-body-sm); }
.hero-article-cat { flex-shrink: 0; font-size: var(--fs-caption); color: rgba(255, 255, 255, 0.55); }
.hero-panel-empty { margin: 0; color: rgba(255, 255, 255, 0.65); font-size: var(--fs-body-sm); }
.hero-link-card {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4);
  border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff; text-decoration: none; transition: background var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.hero-link-card:hover { background: rgba(255, 255, 255, 0.13); transform: translateY(-1px); text-decoration: none; }
.hero-link-card > .icon { flex: 0 0 auto; width: 22px; height: 22px; color: var(--velv-green); margin-top: 2px; }
.hero-link-card strong { display: block; color: #fff; font-weight: var(--fw-medium); }
.hero-link-card span span { display: block; font-size: var(--fs-body-sm); color: rgba(255, 255, 255, 0.7); margin-top: 2px; }
@media (max-width: 900px) { .flow-hero-grid { grid-template-columns: 1fr; gap: var(--space-5); } }

.flow-hero-success { text-align: center; }
.flow-hero-success .flow-lead { margin-left: auto; margin-right: auto; }
.success-mark { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 255, 136, 0.16); color: var(--velv-green); margin-bottom: var(--space-4); box-shadow: 0 0 0 10px rgba(0, 255, 136, 0.07); }
.success-mark .icon { width: 30px; height: 30px; }

/* ---- Identity chip ---- */
.identity-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5); background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); }
.identity-avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--velv-electric); color: #fff; font-weight: var(--fw-bold); }
.identity-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: var(--fs-body-sm); line-height: 1.3; }
.identity-label { font-size: var(--fs-caption); color: var(--text-muted); }
.identity-text .muted { overflow: hidden; text-overflow: ellipsis; }
.identity-card .inline-form { margin: 0; }
.identity-card-dark { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; margin-bottom: 0; }
.identity-card-dark strong, .identity-card-dark .identity-label, .identity-card-dark .muted { color: #fff; }
.identity-card-dark .identity-label, .identity-card-dark .muted { opacity: 0.7; }
.identity-card-dark .link-button { color: var(--velv-light-purple); }

/* ---- Stepper ---- */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-2); flex-wrap: wrap; }
.stepper-item { display: flex; align-items: center; gap: var(--space-2); color: rgba(255, 255, 255, 0.55); font-size: var(--fs-body-sm); }
.stepper-item + .stepper-item::before { content: ""; width: 28px; height: 1px; background: rgba(255, 255, 255, 0.25); margin-right: var(--space-2); }
.stepper-dot { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-caption); font-weight: var(--fw-bold); border: 1px solid rgba(255, 255, 255, 0.3); transition: all var(--dur-base) var(--ease-out); }
.stepper-dot .icon { width: 16px; height: 16px; }
.stepper-item.is-done { color: rgba(255, 255, 255, 0.85); }
.stepper-item.is-done .stepper-dot { background: rgba(0, 255, 136, 0.16); border-color: var(--velv-green); color: var(--velv-green); }
.stepper-item.is-current { color: #fff; font-weight: var(--fw-medium); }
.stepper-item.is-current .stepper-dot { background: var(--velv-electric); border-color: var(--velv-electric); color: #fff; box-shadow: 0 0 0 4px rgba(130, 118, 241, 0.3); }
@media (max-width: 560px) { .stepper-label { display: none; } .stepper-item.is-current .stepper-label { display: inline; } .stepper-item + .stepper-item::before { width: 14px; } }

/* ---- Wizard layout ---- */
.wizard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-6); align-items: start; }
.wizard-main { min-width: 0; }
.wizard.stacked-form { max-width: none; gap: 0; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-6); }
.wizard-step { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.wizard-step + .wizard-step { margin-top: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--border-subtle); }
.wizard-step-legend { padding: 0; margin-bottom: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.wizard-step-kicker { font-size: var(--fs-overline); letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--text-accent); font-weight: var(--fw-medium); }
.wizard-step-title { font-size: 1.35rem; font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: var(--ls-tight); }
.wizard.js-wizard .wizard-step { display: none; margin-top: 0; padding-top: 0; border-top: 0; }
.wizard.js-wizard .wizard-step.is-active { display: flex; animation: wizard-in var(--dur-base) var(--ease-out); }
@keyframes wizard-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wizard.js-wizard .wizard-step.is-active { animation: none; } }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field[hidden] { display: none; }
.wizard .category-picker { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.wizard .category-card { padding: var(--space-4); min-height: 56px; }
.char-count { text-align: right; }
.wizard-nav { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--border-subtle); }
.wizard-nav button { margin-top: 0; }
.wizard-nav [hidden] { display: none; }
.wizard-nav [data-wizard-next], .wizard-nav [data-wizard-submit] { margin-left: auto; }
.wizard:not(.js-wizard) .wizard-nav [data-wizard-next], .wizard:not(.js-wizard) .wizard-nav [data-wizard-back] { display: none; }
.wizard.js-wizard .wizard-nav { position: static; }

.review-list { margin: 0 0 var(--space-4); display: flex; flex-direction: column; }
.review-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.review-row dt { color: var(--text-muted); font-size: var(--fs-body-sm); }
.review-row dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }
.review-edit { text-align: right; }
.wizard:not(.js-wizard) .review-edit { display: none; }

.wizard-aside { display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: calc(var(--header-h) + var(--space-4)); }
.aside-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: var(--space-5); }
.aside-card-quiet { background: var(--bg-subtle); box-shadow: none; }
.aside-title { font-size: var(--fs-body); font-weight: var(--fw-bold); margin: 0 0 var(--space-3); color: var(--text-strong); }
.aside-card p { margin: 0 0 var(--space-3); font-size: var(--fs-body-sm); color: var(--text-muted); }
.aside-steps { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--fs-body-sm); color: var(--text-body); }
.summary-list { margin: 0; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: var(--space-2) var(--space-3); font-size: var(--fs-body-sm); }
.summary-list dt { color: var(--text-muted); }
.summary-list dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }
.summary-list dd.is-empty { color: var(--text-muted); }
@media (max-width: 960px) {
  .wizard-layout { grid-template-columns: 1fr; }
  .wizard-aside { position: static; }
  .wizard.stacked-form { padding: var(--space-5); }
  .review-row { grid-template-columns: 1fr auto; }
  .review-row dt { grid-column: 1 / -1; }
}

/* ---- Front page ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.section-head h2 { margin: 0; font-size: 1.35rem; }
.flow-body .front-section + .front-section, .flow-body .security-report + .front-section { margin-top: var(--space-7); padding-top: 0; border-top: 0; }
.flow-body .security-report { margin-top: var(--space-7); }
.flow-body .known-issues { margin-bottom: var(--space-6); }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
/* One row on desktop however many teams there are; wraps to a grid on smaller screens. */
@media (min-width: 900px) {
  .team-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .team-card { padding: var(--space-4) var(--space-5); }
}
.team-card {
  position: relative; display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-5); background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); color: inherit; text-decoration: none;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.team-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--velv-electric); text-decoration: none; }
.team-card:focus-visible { outline: 2px solid var(--velv-electric); outline-offset: 3px; }
.team-card-mark { width: 44px; height: 44px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; font-weight: var(--fw-bold); font-size: 1.2rem; background: var(--velv-purple-050); color: var(--velv-electric); }
[data-theme="dark"] .team-card-mark { background: rgba(130, 118, 241, 0.22); color: var(--velv-light-purple); }
.team-card-name { font-size: 1.15rem; font-weight: var(--fw-bold); color: var(--text-strong); }
.team-card-desc { font-size: var(--fs-body-sm); color: var(--text-muted); }
.team-card-cats { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: auto; padding-top: var(--space-2); }
.mini-tag { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 20px; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--bg-subtle); border: 1px solid var(--border-subtle); font-size: var(--fs-caption); color: var(--text-body); }
.mini-tag-more { color: var(--text-muted); }
.team-card-go { position: absolute; top: var(--space-5); right: var(--space-5); color: var(--text-muted); transition: transform var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out); }
.team-card:hover .team-card-go { transform: translateX(4px); color: var(--velv-electric); }

/* ---- Confirmation + status ---- */
.confirm-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; max-width: 960px; margin: 0 auto; }
.ticket-number { display: flex; flex-direction: column; gap: 2px; padding: var(--space-4); margin-bottom: var(--space-4); border-radius: var(--radius-md); background: var(--velv-purple-050); }
[data-theme="dark"] .ticket-number { background: rgba(130, 118, 241, 0.18); }
.ticket-number-label { font-size: var(--fs-caption); color: var(--text-muted); }
.ticket-number-value { font-size: 2.2rem; font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); color: var(--text-strong); }
.confirm-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-5); }
.confirm-actions a { margin-top: 0; }
@media (max-width: 800px) { .confirm-layout { grid-template-columns: 1fr; } }
.flow-body .status-lookup { max-width: 560px; margin: 0 auto; text-align: left; }
.flow-body .status-lookup.aside-card { padding: var(--space-6); }
.flow-body .ticket-view { margin-top: var(--space-5); padding: var(--space-6); }

/* ---- Front page: compact enough that hero + teams + footer fit one screen ---- */
.flow-hero-front { padding: var(--space-6) 0 var(--space-6); }
.flow-hero-front h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); margin-bottom: var(--space-2); }
.flow-hero-front .flow-lead { margin-bottom: var(--space-4); }
.flow-hero-front .hero-ask { padding: var(--space-4); }
.flow-hero-front .hero-ask-label { margin-bottom: var(--space-2); }
.flow-hero-front .hero-link-card { padding: var(--space-3) var(--space-4); }
.flow-body-front { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.flow-body-front .section-head { margin-bottom: var(--space-3); }
.flow-body-front .section-head h2 { font-size: 1.15rem; }
.flow-body-front .team-grid { gap: var(--space-3); }
.flow-body-front .team-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--space-3); row-gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); }
.flow-body-front .team-card-mark { width: 34px; height: 34px; font-size: 1rem; border-radius: var(--radius-sm); }
.flow-body-front .team-card-name { font-size: 1.05rem; }
.flow-body-front .team-card-desc, .flow-body-front .team-card-cats { grid-column: 1 / -1; padding-top: 0; margin-top: 0; }
.flow-body-front .team-card-go { top: var(--space-4); right: var(--space-4); }
.flow-body-front .known-issues { margin-bottom: var(--space-4); }
.flow-body-front .security-report { margin-top: var(--space-4); padding: var(--space-3) var(--space-4); }
.flow-hero-front .flow-hero-grid > div:first-child { display: flex; flex-direction: column; }
.flow-hero-front .hero-ask { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.flow-hero-front { padding: var(--space-5) 0; }
.flow-body-front .team-card-cats { flex-wrap: nowrap; overflow: hidden; }
.flow-body-front .mini-tag { flex-shrink: 1; min-width: 0; }
.flow-body-front .mini-tag-more { flex-shrink: 0; }
/* Tall windows: spare height goes to the hero (content stays centered in it),
   so the team cards always sit right above the footer. */
.page-flow:has(.flow-hero-front) { display: flex; flex-direction: column; }
.flow-hero-front { flex: 1 0 auto; display: flex; align-items: center; }
.flow-hero-front > .flow-wrap { width: 100%; }
.page-flow:has(.flow-hero-front) .flow-body-front { flex: 0 0 auto; }

/* Front page: one continuous Night Sky backdrop from the hero down through
   the team cards and the footer (no light band in between). */
[data-theme="dark"] body:has(.flow-hero-front) { background: var(--velv-night); background-attachment: fixed; }
.flow-hero-front { background: none; }
[data-theme="dark"] .flow-body-front .section-head h2, [data-theme="dark"] .flow-body-front .section-head a { color: #fff; }
[data-theme="dark"] .flow-body-front .team-card { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); box-shadow: none; backdrop-filter: blur(6px); }
[data-theme="dark"] .flow-body-front .team-card:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--velv-light-purple); }
[data-theme="dark"] .flow-body-front .team-card-name { color: #fff; }
[data-theme="dark"] .flow-body-front .team-card-desc, [data-theme="dark"] .flow-body-front .team-card-go { color: rgba(255, 255, 255, 0.7); }
[data-theme="dark"] .flow-body-front .team-card-mark { background: rgba(130, 118, 241, 0.28); color: var(--velv-light-purple); }
[data-theme="dark"] .flow-body-front .mini-tag { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.85); }
[data-theme="dark"] .flow-body-front .security-report { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); border-left-color: var(--velv-green); }
[data-theme="dark"] .flow-body-front .security-report-title { color: #fff; }
[data-theme="dark"] .flow-body-front .security-report-text p { color: rgba(255, 255, 255, 0.7); }
[data-theme="dark"] .flow-body-front .security-report > .icon { color: var(--velv-green); }
body:has(.flow-hero-front) .site-footer { background: none; border-top: 1px solid rgba(255, 255, 255, 0.1); }
/* The header's frosted white would read gray over the dark backdrop. */
body:has(.flow-hero-front) .site-header { background: rgba(255, 255, 255, 0.97); }
[data-theme="dark"] body:has(.flow-hero-front) .site-header { background: rgba(7, 6, 26, 0.92); }

/* Even rhythm: hero + team cards stay together as one block, centered between
   the header and footer, so spare height splits equally above and below. */
.page-flow:has(.flow-hero-front) { justify-content: center; }
.flow-hero-front { flex: 0 0 auto; }
.flow-hero-front + .flow-body-front { padding-top: var(--space-5); padding-bottom: 0; }
/* The page backdrop already carries the glow; the hero's own clipped orb would show as a hard edge. */
.flow-hero-front { overflow: visible; }
.flow-hero-front::before { display: none; }

/* Staff entry point: deliberately quiet, tucked into the footer. */
.footer-staff-link { color: rgba(255, 255, 255, 0.45); text-decoration: none; }
.footer-staff-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ---- Front page, LIGHT theme: light sky backdrop, white glass cards, dark text ---- */
:root:not([data-theme="dark"]) .flow-hero-front h1 { color: var(--text-strong); }
:root:not([data-theme="dark"]) .flow-hero-front .flow-eyebrow { color: var(--text-accent); }
:root:not([data-theme="dark"]) .flow-hero-front .flow-lead { color: var(--text-muted); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-ask,
:root:not([data-theme="dark"]) .flow-hero-front .hero-panel,
:root:not([data-theme="dark"]) .flow-hero-front .hero-link-card { background: var(--surface-card); border-color: var(--border-subtle); box-shadow: var(--shadow-sm); backdrop-filter: none; color: var(--text-strong); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-link-card:hover { background: var(--bg-subtle); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-ask-label,
:root:not([data-theme="dark"]) .flow-hero-front .hero-link-card strong,
:root:not([data-theme="dark"]) .flow-hero-front .hero-panel-head h2 { color: var(--text-strong); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-ask .field-hint,
:root:not([data-theme="dark"]) .flow-hero-front .hero-link-card span span,
:root:not([data-theme="dark"]) .flow-hero-front .hero-article-cat,
:root:not([data-theme="dark"]) .flow-hero-front .hero-panel-empty { color: var(--text-muted); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-link-card > .icon,
:root:not([data-theme="dark"]) .flow-hero-front .hero-panel-head .icon { color: var(--velv-electric); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-panel-head a { color: var(--text-accent); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-articles li + li { border-top-color: var(--border-subtle); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-articles a { color: var(--text-body); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-ask #kb-suggestions { background: var(--bg-subtle); }
:root:not([data-theme="dark"]) .flow-hero-front .hero-ask #kb-suggestions a,
:root:not([data-theme="dark"]) .flow-hero-front .hero-ask #kb-suggestions .field-hint { color: var(--text-body); }
:root:not([data-theme="dark"]) body:has(.flow-hero-front) .site-footer { border-top-color: var(--border-subtle); color: var(--text-muted); }
:root:not([data-theme="dark"]) body:has(.flow-hero-front) .footer-claim { color: var(--text-body); }
:root:not([data-theme="dark"]) body:has(.flow-hero-front) .footer-staff-link { color: var(--text-muted); }
:root:not([data-theme="dark"]) body:has(.flow-hero-front) .footer-staff-link:hover { color: var(--text-strong); }
.footer-logo-light { display: none; }
:root:not([data-theme="dark"]) body:has(.flow-hero-front) .footer-logo-light { display: block; }
:root:not([data-theme="dark"]) body:has(.flow-hero-front) .footer-logo-dark { display: none; }

/* ---- Inner flow pages (request form, status, confirmation), LIGHT theme:
   the hero band follows the sky-wash page instead of staying Night Sky. ---- */
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) { background: none; color: var(--text-body); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front)::before { background: var(--velv-electric); opacity: 0.16; }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) h1,
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .flow-eyebrow strong,
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .flow-eyebrow a { color: var(--text-strong); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .flow-eyebrow { color: var(--text-accent); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .flow-lead { color: var(--text-muted); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .identity-card-dark { background: var(--surface-card); border-color: var(--border-subtle); color: var(--text-strong); box-shadow: var(--shadow-xs); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .identity-card-dark strong { color: var(--text-strong); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .identity-card-dark .identity-label,
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .identity-card-dark .muted { color: var(--text-muted); opacity: 1; }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) .identity-card-dark .link-button { color: var(--text-accent); }
:root:not([data-theme="dark"]) .flow-hero .stepper-item { color: var(--text-muted); }
:root:not([data-theme="dark"]) .flow-hero .stepper-item + .stepper-item::before { background: var(--border-strong, var(--border-subtle)); }
:root:not([data-theme="dark"]) .flow-hero .stepper-dot { border-color: var(--border-strong, var(--border-subtle)); background: var(--surface-card); }
:root:not([data-theme="dark"]) .flow-hero .stepper-item.is-done { color: var(--text-body); }
:root:not([data-theme="dark"]) .flow-hero .stepper-item.is-done .stepper-dot { background: rgba(0, 160, 90, 0.12); border-color: var(--status-success); color: var(--status-success); }
:root:not([data-theme="dark"]) .flow-hero .stepper-item.is-current { color: var(--text-strong); }
:root:not([data-theme="dark"]) .flow-hero .stepper-item.is-current .stepper-dot { background: var(--velv-electric); border-color: var(--velv-electric); color: #fff; }
:root:not([data-theme="dark"]) .flow-hero-success .success-mark { background: rgba(0, 160, 90, 0.12); color: var(--status-success); box-shadow: 0 0 0 10px rgba(0, 160, 90, 0.06); }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front) { overflow: visible; }
:root:not([data-theme="dark"]) .flow-hero:not(.flow-hero-front)::before { display: none; }

/* Review-step Edit: a quiet pill that reads as actionable. */
.review-edit button, button.review-edit { background: none; border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); padding: 2px var(--space-3); font-size: var(--fs-body-sm); color: var(--text-accent); cursor: pointer; }
.review-edit button:hover, button.review-edit:hover { background: var(--bg-subtle); border-color: var(--velv-electric); }

/* ---- Inner flow pages, DARK theme: one continuous Night Sky, no clipped hero band ---- */
[data-theme="dark"] .flow-hero:not(.flow-hero-front) { background: none; overflow: visible; }
[data-theme="dark"] .flow-hero:not(.flow-hero-front)::before { display: none; }
[data-theme="dark"] body:has(.flow-hero:not(.flow-hero-front)) { background: var(--velv-night); background-attachment: fixed; }
[data-theme="dark"] body:has(.flow-hero:not(.flow-hero-front)) .site-footer { background: none; border-top: 1px solid rgba(255, 255, 255, 0.1); }

/* ---- Status page, signed in: lookup / ticket on the left, ticket history on the right ---- */
.status-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-5); align-items: start; }
.status-main { min-width: 0; }
.status-layout .status-lookup { max-width: none; margin: 0; }
.status-layout .ticket-view { margin-top: var(--space-5); }
.status-history { position: sticky; top: calc(var(--header-h) + var(--space-4)); max-height: calc(100vh - var(--header-h) - var(--space-7)); overflow-y: auto; padding: var(--space-5); }
.status-history .aside-title { margin-bottom: var(--space-3); }
.status-history .my-tickets { margin: 0; }
.my-ticket.is-current { border-color: var(--velv-electric); background: var(--velv-purple-050); }
[data-theme="dark"] .my-ticket.is-current { background: rgba(130, 118, 241, 0.18); }
@media (max-width: 960px) {
  .status-layout { grid-template-columns: 1fr; }
  .status-history { position: static; max-height: none; }
}
.my-ticket { box-sizing: border-box; }
.my-tickets li { min-width: 0; }
.status-layout .ticket-view { margin-top: 0; }

/* Sidebar / shell icons */
.icon-list { -webkit-mask-image: url("/icons/list.svg"); mask-image: url("/icons/list.svg"); }
.icon-plus { -webkit-mask-image: url("/icons/plus.svg"); mask-image: url("/icons/plus.svg"); }
.icon-repeat { -webkit-mask-image: url("/icons/repeat.svg"); mask-image: url("/icons/repeat.svg"); }
.icon-file-text { -webkit-mask-image: url("/icons/file-text.svg"); mask-image: url("/icons/file-text.svg"); }
.icon-bar-chart { -webkit-mask-image: url("/icons/bar-chart.svg"); mask-image: url("/icons/bar-chart.svg"); }
.icon-book { -webkit-mask-image: url("/icons/book.svg"); mask-image: url("/icons/book.svg"); }
.icon-message { -webkit-mask-image: url("/icons/message.svg"); mask-image: url("/icons/message.svg"); }
.icon-megaphone { -webkit-mask-image: url("/icons/megaphone.svg"); mask-image: url("/icons/megaphone.svg"); }
.icon-laptop { -webkit-mask-image: url("/icons/laptop.svg"); mask-image: url("/icons/laptop.svg"); }
.icon-briefcase { -webkit-mask-image: url("/icons/briefcase.svg"); mask-image: url("/icons/briefcase.svg"); }
.icon-users { -webkit-mask-image: url("/icons/users.svg"); mask-image: url("/icons/users.svg"); }
.icon-building { -webkit-mask-image: url("/icons/building.svg"); mask-image: url("/icons/building.svg"); }
.icon-zap { -webkit-mask-image: url("/icons/zap.svg"); mask-image: url("/icons/zap.svg"); }
.icon-sliders { -webkit-mask-image: url("/icons/sliders.svg"); mask-image: url("/icons/sliders.svg"); }
.icon-link { -webkit-mask-image: url("/icons/link.svg"); mask-image: url("/icons/link.svg"); }
.icon-refresh { -webkit-mask-image: url("/icons/refresh.svg"); mask-image: url("/icons/refresh.svg"); }
.icon-clock { -webkit-mask-image: url("/icons/clock.svg"); mask-image: url("/icons/clock.svg"); }
.icon-calendar { -webkit-mask-image: url("/icons/calendar.svg"); mask-image: url("/icons/calendar.svg"); }
.icon-shield { -webkit-mask-image: url("/icons/shield.svg"); mask-image: url("/icons/shield.svg"); }
.icon-activity { -webkit-mask-image: url("/icons/activity.svg"); mask-image: url("/icons/activity.svg"); }
.icon-log-out { -webkit-mask-image: url("/icons/log-out.svg"); mask-image: url("/icons/log-out.svg"); }
.icon-chevrons-left { -webkit-mask-image: url("/icons/chevrons-left.svg"); mask-image: url("/icons/chevrons-left.svg"); }

/* ============================================================
   Agent shell: sidebar + slim top bar (views/partials/app-shell-open.ejs)
   ============================================================ */
:root { --sidebar-w: 256px; --sidebar-w-collapsed: 72px; --topbar-h: 64px; }
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar-collapsed .app-shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
body:has(.app-shell) { --header-h: var(--topbar-h); }

.app-sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  display: flex; flex-direction: column;
  background: var(--surface-card); border-right: 1px solid var(--border-subtle);
}
.app-sidebar-head { height: var(--topbar-h); display: flex; align-items: center; padding: 0 var(--space-5); border-bottom: 1px solid var(--border-subtle); flex: 0 0 auto; }
.app-brand { display: flex; align-items: center; gap: var(--space-3); color: inherit; text-decoration: none; min-width: 0; }
.app-brand:hover { text-decoration: none; }
.app-brand .brand-logo { height: 24px; width: auto; }
.app-nav { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-4); }
.app-nav-group { display: flex; flex-direction: column; gap: 2px; }
.app-nav-label { margin: 0 0 var(--space-1) var(--space-3); font-size: var(--fs-overline); font-weight: var(--fw-medium); letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.app-nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  color: var(--text-body); font-size: var(--fs-body-sm); font-weight: var(--fw-medium); text-decoration: none; white-space: nowrap;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.app-nav-link .icon { width: 18px; height: 18px; color: var(--text-muted); }
.app-nav-link:hover { background: var(--velv-purple-050); text-decoration: none; }
.app-nav-link.is-active { background: var(--velv-purple-050); color: var(--velv-electric); }
.app-nav-link.is-active .icon { color: var(--velv-electric); }
[data-theme="dark"] .app-nav-link:hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .app-nav-link.is-active { background: rgba(130, 118, 241, 0.18); color: var(--velv-light-purple); }
[data-theme="dark"] .app-nav-link.is-active .icon { color: var(--velv-light-purple); }

.app-sidebar-foot { flex: 0 0 auto; border-top: 1px solid var(--border-subtle); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.app-user { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); min-width: 0; }
.app-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.app-user-text strong { font-size: var(--fs-body-sm); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user-text span { font-size: var(--fs-caption); color: var(--text-muted); }
.app-logout { margin: 0; }
.app-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: var(--radius-md); background: none; color: var(--text-muted); cursor: pointer; }
.app-icon-btn:hover { background: var(--bg-subtle); color: var(--text-strong); }
.app-collapse { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md); background: none; color: var(--text-muted); font: inherit; font-size: var(--fs-body-sm); cursor: pointer; }
.app-collapse:hover { background: var(--bg-subtle); color: var(--text-strong); }
.app-collapse .icon { width: 18px; height: 18px; transition: transform var(--dur-base) var(--ease-out); }
.sidebar-collapsed .app-collapse .icon { transform: rotate(180deg); }

/* Collapsed: icons only. */
.sidebar-collapsed .app-nav-text, .sidebar-collapsed .app-user-text, .sidebar-collapsed .app-brand .brand-suffix, .sidebar-collapsed .app-nav-label { display: none; }
.sidebar-collapsed .app-sidebar-head { padding: 0; justify-content: center; }
.sidebar-collapsed .app-nav-link, .sidebar-collapsed .app-collapse { justify-content: center; padding: var(--space-2); }
.sidebar-collapsed .app-nav-group + .app-nav-group { border-top: 1px solid var(--border-subtle); padding-top: var(--space-3); }
.sidebar-collapsed .app-user { flex-direction: column; padding: var(--space-1) 0; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-6);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-subtle);
}
[data-theme="dark"] .app-topbar { background: rgba(7, 6, 26, 0.88); }
.app-menu-btn { display: none; }
.app-search { position: relative; flex: 1; max-width: 520px; margin: 0; }
.app-search .icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.app-search input { width: 100%; padding-left: calc(var(--space-3) * 2 + 1em); height: 40px; border-radius: var(--radius-pill); }
.app-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }
.app-new-ticket { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; white-space: nowrap; }
.app-new-ticket .icon { width: 16px; height: 16px; }

/* One content width across every agent page. */
.app-page { max-width: 1440px; width: 100%; margin: 0 auto; min-height: calc(100vh - var(--topbar-h)); padding: var(--space-6) var(--space-6) var(--space-8); }
.app-page.page-wide { max-width: 1440px; }
.app-page .settings-layout { display: block; }
.app-scrim { display: none; }

@media (max-width: 960px) {
  .app-shell, .sidebar-collapsed .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 86vw); transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-out); box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.25)); }
  .drawer-open .app-sidebar { transform: none; }
  .drawer-open .app-scrim { display: block; position: fixed; inset: 0; background: rgba(7, 6, 26, 0.5); z-index: 25; }
  /* The drawer is always the full layout, even if the desktop one is collapsed. */
  .sidebar-collapsed .app-nav-text, .sidebar-collapsed .app-user-text, .sidebar-collapsed .app-nav-label { display: revert; }
  .sidebar-collapsed .app-sidebar-head { padding: 0 var(--space-5); justify-content: flex-start; }
  .sidebar-collapsed .app-nav-link { justify-content: flex-start; padding: var(--space-2) var(--space-3); }
  .sidebar-collapsed .app-user { flex-direction: row; }
  .app-collapse { display: none; }
  .app-menu-btn { display: inline-flex; }
  .app-topbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .app-page { padding: var(--space-5) var(--space-4) var(--space-7); }
}
@media (max-width: 640px) {
  .app-search { display: none; }
  .app-new-ticket span:last-child { display: none; }
  .lights-label { display: none; }
}
.app-search input { border: 1px solid var(--border-default); background: var(--surface-card); color: var(--text-strong); box-shadow: none; }
.app-search input:focus { border-color: var(--velv-electric); outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.app-brand-mark { display: none; width: 36px; height: 36px; border-radius: var(--radius-md); align-items: center; justify-content: center; background: var(--velv-electric); color: #fff; font-weight: var(--fw-bold); font-size: 1.2rem; }
@media (min-width: 961px) {
  .sidebar-collapsed .app-brand .brand-logo { display: none; }
  .sidebar-collapsed .app-brand-mark { display: inline-flex; }
}
.app-avatar { position: relative; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--velv-electric); color: #fff; font-weight: var(--fw-bold); overflow: hidden; }
.app-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.app-avatar img[hidden] { display: none; }
@media (max-width: 640px) { .app-new-ticket { width: 40px; height: 40px; padding: 0; justify-content: center; } }

/* Reports page */
.dashboard-reports-page { margin-top: 0; padding-top: 0; border-top: 0; }
.dashboard-reports-page .report-headline { margin-bottom: var(--space-5); }
.dashboard-reports-page .report-headline:empty, .dashboard-reports-page .report-headline:not(:has(.stat-tile)) { display: none; }
.report-bento { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-bento .bento-capacity { grid-column: span 2; }
.hbar-row-cap { grid-template-columns: 140px 1fr auto; }
.hbar-row-cap .hbar-value { white-space: nowrap; font-size: var(--fs-caption); color: var(--text-muted); }
@media (max-width: 900px) { .report-bento .bento-capacity { grid-column: auto; } }
.dashboard-reports-page > .card { margin-top: var(--space-5); margin-bottom: 0; }
.report-range-form select, .report-range-form input[type="date"] { height: 40px; padding: 0 var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-pill); background: var(--surface-card); color: var(--text-strong); font: inherit; font-size: var(--fs-body-sm); }

/* ---- Ticket queue ---- */
.queue-tabs { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.queue-tab { padding: var(--space-2) var(--space-4); color: var(--text-muted); font-weight: var(--fw-medium); font-size: var(--fs-body-sm); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.queue-tab:hover { color: var(--text-strong); text-decoration: none; }
.queue-tab.is-active { color: var(--velv-electric); border-bottom-color: var(--velv-electric); }
[data-theme="dark"] .queue-tab.is-active { color: var(--velv-light-purple); border-bottom-color: var(--velv-light-purple); }
.queue-tab-count { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: var(--space-1); border-radius: var(--radius-pill); background: var(--bg-subtle); color: var(--text-body); font-size: var(--fs-caption); text-align: center; }
.queue-export { margin-left: auto; font-size: var(--fs-body-sm); color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); }
.queue-export:hover { color: var(--text-strong); text-decoration: none; }
a.stat-tile { text-decoration: none; color: inherit; }
a.stat-tile:hover { transform: translateY(-1px); text-decoration: none; }
a.stat-tile.is-active { box-shadow: 0 0 0 2px var(--velv-electric); }
.dashboard-head .stat-row { margin-top: var(--space-4); }
.ticket-sub { display: block; font-size: var(--fs-caption); color: var(--text-muted); margin-top: 2px; }
/* The bulk bar only appears once something is selected. */
#bulk-form .bulk-action-bar { display: none; }
#bulk-form:has(.row-select:checked) .bulk-action-bar { display: flex; }
#bulk-form .ticket-table td:last-child { white-space: nowrap; }

/* ---- Ticket page: conversation first, one narrow side column ---- */
.ticket-page-content { max-width: none; }
.ticket-grid:not(:has(> .ticket-main)) {
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: none;
  grid-template-rows: auto auto auto;
  align-items: start;
}
.ticket-grid:not(:has(> .ticket-main)) > .ticket-center { grid-area: auto; grid-column: 1; grid-row: 1 / span 3; }
.ticket-grid:not(:has(> .ticket-main)) > .ticket-left { grid-area: auto; grid-column: 2; grid-row: 1; }
.ticket-grid:not(:has(> .ticket-main)) > .ticket-right { grid-area: auto; grid-column: 2; grid-row: 2; }
.ticket-grid:not(:has(> .ticket-main)) > .ticket-bottom { grid-area: auto; grid-column: 2; grid-row: 3; grid-template-columns: 1fr; }
@media (max-width: 1100px) {
  .ticket-grid:not(:has(> .ticket-main)) { grid-template-columns: 1fr; grid-template-rows: none; }
  .ticket-grid:not(:has(> .ticket-main)) > * { grid-column: 1 !important; grid-row: auto !important; }
}
.collapsible-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.collapsible-card > summary::-webkit-details-marker { display: none; }
.collapsible-card > summary h2 { margin: 0; }
.collapsible-card > summary::after { content: "+"; color: var(--text-muted); font-size: 1.2rem; line-height: 1; }
.collapsible-card[open] > summary::after { content: "\2212"; }
.collapsible-card[open] > summary { margin-bottom: var(--space-2); }
.danger-zone { border-color: rgba(220, 38, 38, 0.35); }
.danger-zone > summary h2 { color: var(--status-danger, #b91c1c); }

/* ---- Agent pages: left-aligned add-forms, readable intros, tables that fit ---- */
.app-page .card-narrow, .app-page .card-wide { margin-left: 0; margin-right: 0; }
.app-page .card-narrow { max-width: 520px; }
.app-page .card-wide { max-width: 960px; }
.app-page h1 { margin-bottom: var(--space-3); }
.app-page > h1 + p.muted, .settings-content > h1 + p.muted, .settings-content > p.muted { max-width: 90ch; }
.settings-content { min-width: 0; }
.app-page .table-wrap { overflow-x: auto; }
.app-page .ticket-table td .inline-form { display: inline; }
.app-page .card-medium { margin-left: 0; margin-right: 0; }
.app-page .ticket-table td .property-row { min-width: 0; }
.app-page .ticket-table td .property-row input[type="text"] { flex: 1 1 140px; min-width: 120px; width: auto; }
.app-page .ticket-table td { vertical-align: middle; }
.app-page .ticket-table td .property-row input[type="text"] { width: 220px; max-width: 220px; flex: 0 1 220px; }
.app-page .ticket-table th { white-space: normal; }

.app-page .ticket-table td:last-child { white-space: normal; }
.app-page .ticket-table td:last-child .inline-form { display: block; margin-bottom: var(--space-1); }
.app-page .ticket-table th, .app-page .ticket-table td { padding-left: var(--space-3); padding-right: var(--space-3); overflow-wrap: anywhere; }
.app-page .ticket-table td input[type="text"], .app-page .ticket-table td input[type="email"], .app-page .ticket-table td select { max-width: 260px; }
.app-topbar .notif-dropdown { right: 0; left: auto; width: min(340px, calc(100vw - 2 * var(--space-4))); }
@media (max-width: 640px) {
  .hbar-row-cap { grid-template-columns: 90px 1fr; }
  .hbar-row-cap .hbar-value { grid-column: 1 / -1; }
  .report-bento .bento-capacity { grid-column: auto; }
  .hbar-chart, .hbar-row { min-width: 0; }
}
@media (max-width: 900px) { .report-bento { grid-template-columns: minmax(0, 1fr); } .report-row-3 { grid-template-columns: minmax(0, 1fr); } }
.alert { overflow-wrap: anywhere; }
.app-page .ticket-table th, .app-page .ticket-table td { overflow-wrap: normal; }
.app-page .ticket-table td .link-button, .app-page .ticket-table td .button-secondary { white-space: nowrap; }
.app-page .ticket-table td select { height: 36px; padding: 0 var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text-strong); font: inherit; font-size: var(--fs-body-sm); }
.app-page .ticket-table th { overflow-wrap: anywhere; }
@media (max-width: 1100px) { .ticket-grid:not(:has(> .ticket-main)) > .ticket-center { order: -1; } }

/* ---- Ticket composer tabs ---- */
.composer-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-pill); background: var(--bg-subtle); align-self: flex-start; }
.composer-tabs[hidden] { display: none; }
.composer-tab { border: 0; background: none; padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill); font: inherit; font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--text-muted); cursor: pointer; }
.composer-tab.is-active { background: var(--surface-card); color: var(--text-strong); box-shadow: var(--shadow-xs); }
.js-composer .composer-visibility { display: none; }
.composer.composer-reply textarea { border-color: var(--velv-electric); background: var(--velv-purple-050); }
[data-theme="dark"] .composer.composer-reply textarea { background: rgba(130, 118, 241, 0.12); }
.composer:not(.composer-reply) textarea { background: #fffbeb; border-color: #fcd34d; }
[data-theme="dark"] .composer:not(.composer-reply) textarea { background: rgba(252, 211, 77, 0.08); border-color: rgba(252, 211, 77, 0.4); }

/* ---- "Add a …" dialogs ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.page-head h1 { margin-bottom: 0; }
.page-head-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.add-trigger { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.add-trigger .icon { width: 16px; height: 16px; }
dialog.app-dialog { border: 0; padding: 0; background: none; max-width: min(560px, calc(100vw - 2 * var(--space-4))); width: 100%; max-height: calc(100vh - 2 * var(--space-5)); overflow: visible; color: var(--text-body); }
dialog.app-dialog::backdrop { background: rgba(7, 6, 26, 0.55); backdrop-filter: blur(2px); }
dialog.app-dialog .card { margin: 0; max-width: none; max-height: calc(100vh - 2 * var(--space-5)); overflow-y: auto; position: relative; box-shadow: var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, 0.35)); }
.app-dialog-close { position: absolute; top: var(--space-3); right: var(--space-3); z-index: 1; }
.app-page .ticket-table th { overflow-wrap: break-word; letter-spacing: 0.04em; }
