/* =====================================================================
   PRISM — Bold Light + Gradient
   A token-driven design system for the Corsto support ticket area.
   Aesthetic: bright, crisp, airy light UI; bold modern grotesque type;
   a signature indigo to fuchsia gradient used surgically on the primary
   CTA, the brand mark and one hero accent; near-white surfaces; crisp
   14-18px rounding; very subtle layered shadows; vivid status chips.

   Structure of this file:
     1.  Reset / base
     2.  :root design tokens (colour, gradient, type, space, radius, shadow)
     3.  Typography helpers
     4.  App shell (sidebar + main)
     5.  Brand mark
     6.  Buttons
     7.  Form controls (search, inputs, composer)
     8.  Status / priority indicators + chips
     9.  Avatars
     10. Cards / bento surfaces
     11. Toolbar + filter tabs + segmented controls
     12. Ticket list (rows)
     13. Pagination / footer
     14. Detail header + meta
     15. Conversation thread + messages
     16. Meta rail cards
     17. Legend + staff-only marking
     18. Utilities
   ===================================================================== */


/* =====================================================================
   1. RESET / BASE
   ===================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink-900);
  background:
    radial-gradient(1200px 600px at 88% -8%, var(--glow-fuchsia) 0%, transparent 60%),
    radial-gradient(1000px 560px at -6% 4%, var(--glow-indigo) 0%, transparent 55%),
    var(--bg-app);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

img, svg { display: block; max-width: 100%; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

a { color: inherit; text-decoration: none; }

ul { list-style: none; }

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


/* =====================================================================
   2. :ROOT DESIGN TOKENS
   ===================================================================== */
:root {
  /* ---- Fonts ---- */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- Ink (text) palette — cool near-black, never muddy grey ---- */
  --ink-900: #0c0e1a;   /* headings */
  --ink-800: #1c1f33;
  --ink-700: #34384f;   /* body */
  --ink-600: #565b75;   /* secondary */
  --ink-500: #7a7f9a;   /* tertiary / placeholder */
  --ink-400: #9ea3bd;

  /* ---- Surfaces — bright, near-white, cool ---- */
  --bg-app: #f5f6fb;          /* app canvas */
  --surface: #ffffff;         /* cards */
  --surface-2: #fbfbff;       /* nested / subtle */
  --surface-sunken: #f1f2f9;  /* wells, search */
  --sidebar: #ffffff;

  /* ---- Lines ---- */
  --line: #e9eaf3;            /* default hairline */
  --line-strong: #dfe1ef;
  --line-soft: #f0f1f8;

  /* ---- Signature gradient (indigo to fuchsia) ---- */
  --grad-brand: linear-gradient(120deg, #6d5cff 0%, #8b3dff 42%, #e548ff 100%);
  --grad-brand-soft: linear-gradient(120deg, #7b6bff 0%, #c34dff 100%);
  --grad-hero: linear-gradient(135deg, #5b4bff 0%, #9b3cff 50%, #ff4fd8 100%);

  /* ---- Brand accent solids (for chips, focus, links) ---- */
  --indigo-600: #5b4bff;
  --indigo-500: #6d5cff;
  --indigo-50:  #eeecff;
  --fuchsia-600: #d63be8;
  --fuchsia-500: #e548ff;
  --fuchsia-50:  #fdeaff;

  /* ---- Glows (used in body bg + on primary action) ---- */
  --glow-indigo: rgba(109, 92, 255, 0.16);
  --glow-fuchsia: rgba(229, 72, 255, 0.13);

  /* ---- Status palette — vivid, saturated, glowing ---- */
  --st-new:        #6d5cff;  /* indigo  */
  --st-new-bg:     #efedff;
  --st-open:       #0aa86f;  /* emerald */
  --st-open-bg:    #e2f8ee;
  --st-awaiting:   #f59311;  /* amber   */
  --st-awaiting-bg:#fff1dc;
  --st-progress:   #2d8bff;  /* blue    */
  --st-progress-bg:#e4f0ff;
  --st-resolved:   #66708c;  /* slate   */
  --st-resolved-bg:#eef0f6;

  /* ---- Priority palette ---- */
  --pri-urgent: #ff3d6e;
  --pri-urgent-bg: #ffe6ec;
  --pri-high:   #ff7a18;
  --pri-high-bg:#fff0e2;
  --pri-normal: #2d8bff;
  --pri-normal-bg:#e4f0ff;
  --pri-low:    #8a90a8;
  --pri-low-bg: #eef0f6;

  /* ---- Domain dots ---- */
  --dot-affinity: #6d5cff;
  --dot-listing:  #0aa86f;
  --dot-northgate:#ff7a18;

  /* ---- Staff-only marking ---- */
  --staff: #8b3dff;
  --staff-bg: #f4ecff;
  --staff-line: #e7d6ff;

  /* ---- Online / presence ---- */
  --online: #16c47f;

  /* ---- Focus ring ---- */
  --ring: rgba(109, 92, 255, 0.45);

  /* ---- Type scale (bold, big headers) ---- */
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   17px;
  --text-xl:   20px;
  --text-2xl:  26px;
  --text-3xl:  34px;
  --text-4xl:  44px;

  /* ---- Weights ---- */
  --w-regular: 440;
  --w-medium:  520;
  --w-semibold:600;
  --w-bold:    700;
  --w-black:   840;

  /* ---- Spacing scale ---- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;
  --s-10: 72px;

  /* ---- Radius — crisp 14-18px ---- */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ---- Shadows — very subtle, layered, soft ---- */
  --sh-xs: 0 1px 2px rgba(16, 18, 45, 0.05);
  --sh-sm: 0 2px 6px rgba(16, 18, 45, 0.05), 0 1px 2px rgba(16, 18, 45, 0.04);
  --sh-md: 0 8px 24px -8px rgba(16, 18, 45, 0.12), 0 2px 6px rgba(16, 18, 45, 0.05);
  --sh-lg: 0 22px 50px -18px rgba(16, 18, 45, 0.22), 0 6px 16px -8px rgba(16, 18, 45, 0.10);
  --sh-glow: 0 10px 28px -8px rgba(123, 80, 255, 0.55), 0 2px 8px rgba(123, 80, 255, 0.32);

  /* ---- Layout ---- */
  --sidebar-w: 264px;
  --rail-w: 344px;
  --content-max: 1180px;
}


/* =====================================================================
   3. TYPOGRAPHY HELPERS
   ===================================================================== */
.display {
  font-size: var(--text-4xl);
  font-weight: var(--w-black);
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: var(--ink-900);
}
.h1 {
  font-size: var(--text-3xl);
  font-weight: var(--w-bold);
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--ink-900);
}
.h2 {
  font-size: var(--text-2xl);
  font-weight: var(--w-bold);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink-900);
}
.h3 {
  font-size: var(--text-lg);
  font-weight: var(--w-semibold);
  letter-spacing: -0.012em;
  color: var(--ink-900);
}
.subtitle {
  font-size: var(--text-md);
  color: var(--ink-600);
  font-weight: var(--w-regular);
}
.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--w-bold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.mono { font-family: var(--font-mono); font-feature-settings: "zero"; }

/* The gradient text used for the brand wordmark + one hero accent only */
.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}


/* =====================================================================
   4. APP SHELL
   ===================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-6) var(--s-5);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--sidebar); }
.sidebar .nav { gap: 1px; }
.sidebar .nav-label { margin-top: var(--s-3); }
.sidebar .nav-label:first-child { margin-top: 0; }

.main {
  min-width: 0;
  padding: var(--s-8) var(--s-9) var(--s-9);
}
.main-inner { max-width: var(--content-max); margin: 0 auto; }

/* Sidebar nav */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px;
  font-weight: var(--w-bold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 0 var(--s-3);
  margin-bottom: var(--s-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-3);
  border-radius: var(--r-sm);
  color: var(--ink-600);
  font-weight: var(--w-medium);
  font-size: var(--text-md);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-sunken); color: var(--ink-800); }
.nav-item .ico { width: 18px; text-align: center; color: var(--ink-400); font-size: 15px; }
.nav-item.is-active {
  background: var(--indigo-50);
  color: var(--indigo-600);
  font-weight: var(--w-semibold);
}
.nav-item.is-active .ico { color: var(--indigo-600); }
.nav-item .count-pill {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: var(--w-bold);
  color: var(--ink-500);
  background: var(--surface-sunken);
  padding: 1px 8px;
  border-radius: var(--r-pill);
}
.nav-item.is-active .count-pill { background: #fff; color: var(--indigo-600); }

/* Account / domain switcher */
.acct-switch {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%; box-sizing: border-box; /* a <button> is fit-content by default — cap it to the sidebar */
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.acct-switch:hover { border-color: var(--line-strong); box-shadow: var(--sh-xs); }
.acct-switch .acct-glyph {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  color: #fff; font-weight: var(--w-bold); font-size: var(--text-sm);
}
.acct-switch .acct-meta { flex: 1; min-width: 0; line-height: 1.25; overflow: hidden; }
.acct-switch .acct-name { font-weight: var(--w-semibold); font-size: var(--text-sm); color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-switch .acct-sub { font-size: var(--text-xs); color: var(--ink-500); }
.acct-switch .acct-fav { width: 34px; height: 34px; flex: none; border-radius: 9px; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.acct-switch .chev { margin-left: auto; color: var(--ink-400); font-size: 13px; }
/* Domain favicon inside a switcher dropdown option. */
.acct-opt-fav { width: 20px; height: 20px; flex: none; border-radius: 5px; object-fit: cover; background: #fff; }

/* Pinned user + role block */
.user-block {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.user-block .ub-meta { min-width: 0; line-height: 1.3; }
.user-block .ub-name { font-weight: var(--w-semibold); font-size: var(--text-sm); color: var(--ink-900); }
.user-block .ub-role {
  font-size: 11px; font-weight: var(--w-bold); letter-spacing: .04em;
  color: var(--staff); text-transform: uppercase;
}
.user-block .ub-cog { margin-left: auto; color: var(--ink-400); }


/* =====================================================================
   5. BRAND MARK
   ===================================================================== */
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-2);
}
.brand .mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: var(--sh-glow);
  position: relative;
  overflow: hidden;
}
.brand .mark::after {
  /* subtle prism shard highlight */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 45%);
}
.brand .mark span { color: #fff; font-weight: var(--w-black); font-size: 17px; position: relative; z-index: 1; }
.brand .word { font-size: var(--text-xl); font-weight: var(--w-black); letter-spacing: -0.03em; color: var(--ink-900); }
.brand .word em { font-style: normal; }
.brand-logo { height: 30px; width: auto; display: block; }
/* white logo treatment for dark/gradient surfaces (login hero, etc.) */
.brand-logo.on-dark { filter: brightness(0) invert(1); }


/* =====================================================================
   6. BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: var(--w-semibold);
  font-size: var(--text-md);
  letter-spacing: -0.006em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }

/* Primary — the gradient CTA with a glow. Used ONCE per screen. */
.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--sh-glow);
  position: relative;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 50%);
  pointer-events: none;
}
.btn-primary:hover { box-shadow: 0 14px 34px -8px rgba(123,80,255,.62), 0 3px 10px rgba(123,80,255,.34); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink-800);
  border-color: var(--line-strong);
  box-shadow: var(--sh-xs);
}
.btn-secondary:hover { border-color: var(--ink-400); background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--ink-600); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink-800); }

.btn-danger {
  background: var(--surface);
  color: var(--pri-urgent);
  border-color: var(--pri-urgent-bg);
}
.btn-danger:hover { background: var(--pri-urgent-bg); }

.btn-sm { height: 32px; padding: 0 var(--s-3); font-size: var(--text-sm); border-radius: var(--r-sm); }
.btn-lg { height: 46px; padding: 0 var(--s-6); font-size: var(--text-lg); }
.btn-icon { width: 40px; padding: 0; }
.btn .kbd { font-size: 11px; opacity: .85; }


/* =====================================================================
   7. FORM CONTROLS
   ===================================================================== */
.search {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: 44px;
  padding: 0 var(--s-3) 0 var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  min-width: 280px;
  flex: 1;
  max-width: 420px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--indigo-500); box-shadow: 0 0 0 4px var(--ring); }
.search .mag {
  width: 17px; height: 17px; flex: none; font-size: 0; color: transparent;
  background-color: var(--ink-400);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* site favicon (replaces the coloured domain dots, set by app.js) */
.favicon { width: 16px; height: 16px; flex: none; border-radius: 4px; object-fit: cover; display: inline-block; vertical-align: middle; background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--line); }
.favicon.sm { width: 14px; height: 14px; border-radius: 3px; }
.search input {
  flex: 1; border: 0; background: transparent;
  font-size: var(--text-md); color: var(--ink-800);
}
.search input::placeholder { color: var(--ink-500); }

/* keyboard hint chip */
.kbd {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: var(--w-semibold);
  color: var(--ink-500);
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 2px 7px;
  line-height: 1;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--ink-600); letter-spacing: .01em; }
.input, .textarea, .select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px var(--s-3);
  font-size: var(--text-md);
  color: var(--ink-800);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--indigo-500); box-shadow: 0 0 0 4px var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--ink-500); }
.input-money {
  font-family: var(--font-mono); font-weight: var(--w-semibold);
}
.input-prefix {
  display: flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); overflow: hidden;
}
.input-prefix .pfx { padding: 0 var(--s-3); color: var(--ink-500); font-weight: var(--w-semibold); background: var(--surface-sunken); align-self: stretch; display: grid; place-items: center; border-right: 1px solid var(--line); }
/* suffix variant (e.g. the "h" after a time value) — divider on the left, not the right */
.input-prefix .pfx:last-child { border-right: 0; border-left: 1px solid var(--line); }
.input-prefix input { border: 0; padding: 10px var(--s-3); flex: 1; background: transparent; }
.input-prefix:focus-within { border-color: var(--indigo-500); box-shadow: 0 0 0 4px var(--ring); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.toggle input { display: none; }
.toggle .track {
  position: absolute; inset: 0; border-radius: var(--r-pill);
  background: var(--line-strong); transition: background .18s;
}
.toggle .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-sm); transition: transform .18s;
}
.toggle input:checked + .track { background: var(--grad-brand-soft); }
.toggle input:checked + .track::after { transform: translateX(17px); }

/* Composer */
.composer {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--indigo-500); box-shadow: 0 0 0 4px var(--ring); }
.composer.is-note { border-color: var(--staff-line); background: var(--staff-bg); }
.composer-body {
  width: 100%; min-height: 104px; border: 0; resize: none;
  padding: var(--s-4) var(--s-5);
  font-size: var(--text-md); line-height: 1.55; color: var(--ink-800);
  background: transparent;
}
.composer-body:focus { outline: none; }
.composer-bar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
}
.composer.is-note .composer-bar { border-top-color: var(--staff-line); }
.composer-tools { display: flex; align-items: center; gap: 2px; }
.tool-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-500);
  background: transparent; border: 0; cursor: pointer; font-size: 15px;
  transition: background .15s, color .15s;
}
.tool-btn:hover { background: var(--surface-sunken); color: var(--ink-800); }
.note-switch {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-left: var(--s-2); padding: 5px var(--s-3);
  border-radius: var(--r-pill);
  background: var(--staff-bg); border: 1px solid var(--staff-line);
  font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--staff);
}


/* =====================================================================
   8. STATUS / PRIORITY INDICATORS + CHIPS
   ===================================================================== */
/* Glowing dot */
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; flex: none;
  background: var(--c, var(--ink-400));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--ink-400)) 18%, transparent);
}
.dot-sm { width: 7px; height: 7px; }

/* Status chip — saturated, modern, soft-tinted */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 11px 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--text-xs); font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  background: var(--chip-bg, var(--surface-sunken));
  color: var(--chip-fg, var(--ink-700));
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip-fg) 16%, transparent); background: var(--chip-fg); }

.chip.status-new       { --chip-bg: var(--st-new-bg);      --chip-fg: var(--st-new); }
.chip.status-open      { --chip-bg: var(--st-open-bg);     --chip-fg: var(--st-open); }
.chip.status-awaiting  { --chip-bg: var(--st-awaiting-bg); --chip-fg: #c4730a; }
.chip.status-progress  { --chip-bg: var(--st-progress-bg); --chip-fg: var(--st-progress); }
.chip.status-resolved  { --chip-bg: var(--st-resolved-bg); --chip-fg: var(--st-resolved); }
/* Closed / asleep — neutral grey (these now appear in their own tabs, clients included). */
.chip.status-archived  { --chip-bg: var(--surface-sunken);  --chip-fg: var(--ink-500); }

/* Interactive status/priority control (detail header) */
.control-chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 36px; padding: 0 var(--s-2) 0 var(--s-3);
  border-radius: var(--r-pill);
  font-size: var(--text-sm); font-weight: var(--w-semibold);
  background: var(--chip-bg, var(--surface)); color: var(--chip-fg, var(--ink-800));
  border: 1px solid color-mix(in srgb, var(--chip-fg, var(--ink-400)) 22%, transparent);
  cursor: pointer; transition: filter .15s, box-shadow .15s;
}
.control-chip:hover { box-shadow: var(--sh-xs); filter: saturate(1.1); }
.control-chip .chev { opacity: .65; font-size: 12px; margin-left: 2px; }
.control-chip.status-new      { --chip-bg: var(--st-new-bg);      --chip-fg: var(--st-new); }
.control-chip.status-open     { --chip-bg: var(--st-open-bg);     --chip-fg: var(--st-open); }
.control-chip.status-awaiting { --chip-bg: var(--st-awaiting-bg); --chip-fg: #c4730a; }
.control-chip.status-progress { --chip-bg: var(--st-progress-bg); --chip-fg: var(--st-progress); }
.control-chip.status-archived { --chip-bg: var(--surface-sunken);  --chip-fg: var(--ink-500); }
.control-chip.pri-high        { --chip-bg: var(--pri-high-bg);    --chip-fg: #d2540a; }
.control-chip.pri-urgent      { --chip-bg: var(--pri-urgent-bg);  --chip-fg: var(--pri-urgent); }
.control-chip.pri-normal      { --chip-bg: var(--pri-normal-bg);  --chip-fg: var(--pri-normal); }

/* Priority indicator (list) — bars + label */
.priority { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--p, var(--ink-500)); }
.priority .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.priority .bars i { width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--p) 25%, var(--line-strong)); display: block; }
.priority .bars i:nth-child(1) { height: 6px; }
.priority .bars i:nth-child(2) { height: 9px; }
.priority .bars i:nth-child(3) { height: 13px; }
.priority.lv1 .bars i:nth-child(1) { background: var(--p); }
.priority.lv2 .bars i:nth-child(1),
.priority.lv2 .bars i:nth-child(2) { background: var(--p); }
.priority.lv3 .bars i { background: var(--p); }
.priority.urgent { --p: var(--pri-urgent); }
.priority.high   { --p: var(--pri-high); }
.priority.normal { --p: var(--pri-normal); }
.priority.low    { --p: var(--pri-low); }


/* =====================================================================
   9. AVATARS
   ===================================================================== */
.avatar {
  --size: 38px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  line-height: 1;
  font-weight: var(--w-bold); font-size: calc(var(--size) * 0.36);
  color: #fff;
  background: var(--av, var(--indigo-500));
  position: relative;
}
.avatar > span { line-height: 1; display: block; transform: translateY(0.06em); }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
/* ring avatar */
.avatar.ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--av) 55%, transparent); }
.avatar.sm { --size: 30px; }
.avatar.lg { --size: 44px; }
.avatar.xl { --size: 52px; }
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--online); border: 2.5px solid var(--surface);
}
/* avatar colour variants */
.av-a { --av: linear-gradient(135deg,#6d5cff,#9b3cff); }
.av-b { --av: linear-gradient(135deg,#0aa86f,#16c47f); }
.av-c { --av: linear-gradient(135deg,#ff7a18,#ff3d6e); }
.av-d { --av: linear-gradient(135deg,#2d8bff,#22d3ee); }
.av-e { --av: linear-gradient(135deg,#e548ff,#ff4f9a); }
.av-f { --av: linear-gradient(135deg,#7a7f9a,#565b75); }
.av-staff { --av: linear-gradient(135deg,#8b3dff,#5b4bff); }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -9px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }


/* =====================================================================
   10. CARDS / BENTO
   ===================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-pad { padding: var(--s-5); }
.card-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: var(--text-md); font-weight: var(--w-bold); letter-spacing: -0.01em; }
.card-head .hint { margin-left: auto; font-size: var(--text-xs); color: var(--ink-500); }

/* Staff-tinted card */
.card.staff-card { border-color: var(--staff-line); background: linear-gradient(180deg, var(--staff-bg), var(--surface) 70%); }
.card.staff-card .card-head { border-bottom-color: var(--staff-line); }

/* Client-context card with a soft gradient edge */
.card.quote-card {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--grad-brand) border-box;
  box-shadow: var(--sh-md);
}


/* =====================================================================
   11. TOOLBAR + FILTER TABS + SEGMENTED
   ===================================================================== */
.toolbar {
  display: flex; align-items: center; gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}

/* Filter tabs with counts */
.tabs {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 4px; border-radius: var(--r-md);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
}
.tab {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: var(--w-medium);
  color: var(--ink-600); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--ink-900); }
.tab .n { font-size: 11px; font-weight: var(--w-bold); color: var(--ink-400); }
.tab.is-active {
  background: var(--surface); color: var(--ink-900);
  box-shadow: var(--sh-xs); font-weight: var(--w-semibold);
}
.tab.is-active .n { color: var(--indigo-600); }

/* Segmented control (staff scope switch) */
.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--staff-bg); border: 1px solid var(--staff-line);
  border-radius: var(--r-md);
}
.segmented .seg {
  height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--staff);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  opacity: .72; transition: opacity .15s, background .15s;
}
.segmented .seg:hover { opacity: 1; }
.segmented .seg.is-active { background: #fff; opacity: 1; font-weight: var(--w-semibold); box-shadow: var(--sh-xs); }

/* STAFF-ONLY toolbar strip — tinted to read as staff zone */
.staff-strip {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: 10px var(--s-4);
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--staff-bg), color-mix(in srgb, var(--staff-bg) 40%, var(--surface)));
  border: 1px solid var(--staff-line);
}

/* Assignee avatar filter */
.assignee-filter { display: inline-flex; align-items: center; gap: var(--s-2); }
.assignee-filter .af-avatars { display: inline-flex; gap: 6px; }
.assignee-filter .af-avatars .avatar { cursor: pointer; box-shadow: 0 0 0 2px var(--surface); transition: transform .12s; }
.assignee-filter .af-avatars .avatar:hover { transform: translateY(-2px); }
.assignee-filter .af-avatars .avatar.is-dim { filter: grayscale(.6); opacity: .5; }
.assignee-filter .af-avatars .avatar.is-sel { outline: 2px solid var(--indigo-600); outline-offset: 1px; filter: none; opacity: 1; position: relative; z-index: 1; transform: translateY(-2px); }


/* =====================================================================
   12. TICKET LIST (ROWS)
   ===================================================================== */
.ticket-list { display: flex; flex-direction: column; gap: var(--s-3); }

.trow {
  display: grid;
  grid-template-columns: 150px minmax(220px,1fr) 96px 140px 84px 108px 34px;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: transform .12s, box-shadow .18s, border-color .15s;
  cursor: pointer;
  position: relative;
}
.trow:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.trow.is-unread { border-left: 3px solid transparent; border-image: var(--grad-brand) 1; }

.trow .req { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.trow .req-name { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.trow .subj { min-width: 0; }
.trow .subj-line { display: flex; align-items: center; gap: var(--s-2); }
.trow .subj-title {
  font-size: var(--text-md); font-weight: var(--w-bold); color: var(--ink-900);
  letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trow .unread-pip { width: 7px; height: 7px; border-radius: 50%; background: var(--grad-brand); flex: none; }
.trow .subj-sub { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: var(--text-xs); color: var(--ink-500); white-space: nowrap; }
.trow .subj-sub .domain { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--w-medium); color: var(--ink-600); }
.trow .subj-sub .sep { color: var(--ink-400); }

.trow .updated { font-size: var(--text-xs); color: var(--ink-500); text-align: right; white-space: nowrap; }
.trow .assignee { display: flex; align-items: center; gap: 7px; }
.trow .assignee .nm { font-size: var(--text-xs); font-weight: var(--w-medium); color: var(--ink-600); white-space: nowrap; }
.trow .view {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-400);
  background: var(--surface-sunken); transition: background .15s, color .15s, transform .12s;
}
.trow:hover .view { background: var(--indigo-50); color: var(--indigo-600); transform: translateX(2px); }

/* staff-only column wrapper */
.staff-col { position: relative; }


/* =====================================================================
   13. PAGINATION / FOOTER
   ===================================================================== */
.list-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--s-6); padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.list-footer .count { font-size: var(--text-sm); color: var(--ink-600); }
.list-footer .count b { color: var(--ink-900); font-weight: var(--w-semibold); }
.pager { display: inline-flex; align-items: center; gap: 4px; }
.pager .pg {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: grid; place-items: center; border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--ink-600);
  cursor: pointer; transition: background .15s, color .15s;
}
.pager .pg:hover { background: var(--surface-sunken); color: var(--ink-900); }
.pager .pg.is-active { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-glow); font-weight: var(--w-semibold); }
.pager .pg.is-disabled { opacity: .4; cursor: default; }


/* =====================================================================
   14. DETAIL HEADER + META
   ===================================================================== */
.back-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--ink-600);
  padding: 6px 10px 6px 8px; border-radius: var(--r-sm);
  transition: background .15s, color .15s; margin-bottom: var(--s-5);
}
.back-link:hover { background: var(--surface-sunken); color: var(--ink-900); }

/* post-action notice banner */
.cgs-notice {
  margin-bottom: var(--s-5); padding: 10px 14px; border-radius: var(--r-md);
  font-size: var(--text-sm); font-weight: var(--w-medium); border: 1px solid transparent;
}
.cgs-notice-ok { background: var(--st-resolved-bg, #e8f7ef); color: #0a7d4f; border-color: #b6e6cd; }
.cgs-notice-warn { background: #fff4e5; color: #9a5b00; border-color: #ffd9a8; }

/* "coming next" cards — visible per the mockup, clearly not yet wired (no dead buttons) */
.card.is-soon { opacity: .82; }
.soon-badge {
  font-size: 10px; font-weight: var(--w-bold); letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-sunken); color: var(--ink-500);
  border: 1px solid var(--line);
}

.detail-head { margin-bottom: var(--s-6); }
.detail-head .subject {
  font-size: var(--text-3xl); font-weight: var(--w-black);
  letter-spacing: -0.028em; line-height: 1.06; color: var(--ink-900);
  max-width: 760px;
}
.detail-controls { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-4); }
.detail-meta {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  margin-top: var(--s-4); font-size: var(--text-sm); color: var(--ink-600);
}
.detail-meta .mi { display: inline-flex; align-items: center; gap: 7px; }
.detail-meta .mi b { color: var(--ink-800); font-weight: var(--w-semibold); }
.detail-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-400); }
.detail-meta .ref { font-family: var(--font-mono); font-weight: var(--w-semibold); color: var(--ink-700); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) var(--rail-w);
  gap: var(--s-6);
  align-items: start;
}


/* =====================================================================
   15. CONVERSATION THREAD + MESSAGES
   ===================================================================== */
.thread { display: flex; flex-direction: column; gap: var(--s-4); }

/* conversation container (defines the messages section; composer sits above it) */
.thread-panel { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.thread-panel-head { display: flex; align-items: baseline; gap: var(--s-3); padding: 12px var(--s-5); background: var(--surface); border-bottom: 1px solid var(--line); }
.thread-panel-head h3 { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-900); }
.thread-panel-head .tp-count { font-size: var(--text-xs); color: var(--ink-500); }
.thread-panel-body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-5); }

.msg {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: var(--s-3);
}
.msg-body-wrap { min-width: 0; }
.msg-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: 7px; flex-wrap: wrap; }
.msg-author { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-900); }
.role-tag {
  font-size: 10px; font-weight: var(--w-bold); letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: var(--r-pill);
}
.role-tag.client { color: var(--st-open); background: var(--st-open-bg); }
.role-tag.staff  { color: var(--staff); background: var(--staff-bg); }
/* Per-message staff actions (edit / delete a reply). */
.msg-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.msg-act { font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--ink-500); cursor: pointer; background: none; border: 0; padding: 2px 2px; }
.msg-act:hover { color: var(--ink-800); }
.msg-act.danger { color: var(--pri-urgent); opacity: .85; }
.msg-act.danger:hover { opacity: 1; }
/* Edit a reply IN PLACE — the bubble itself becomes the editor (same box), not a separate field. */
.bubble-edit { display: none; }
.bubble-edit-input { width: 100%; min-height: 84px; border: 0; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: 1.6; resize: vertical; outline: none; }
.bubble-edit-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.msg.is-editing .bubble-view { display: none; }
.msg.is-editing .bubble-edit { display: block; }
.msg.is-editing .bubble { max-width: 100%; }
.msg-time { font-size: var(--text-xs); color: var(--ink-500); }
.msg-actions { margin-left: auto; display: inline-flex; gap: 2px; }
.msg-actions .ma { font-size: var(--text-xs); color: var(--ink-400); padding: 3px 7px; border-radius: 6px; cursor: pointer; transition: background .15s, color .15s; }
.msg-actions .ma:hover { background: var(--surface-sunken); color: var(--ink-700); }

.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  border-top-left-radius: 5px;
  padding: var(--s-4) var(--s-4);
  font-size: var(--text-md); line-height: 1.6; color: var(--ink-700);
  box-shadow: var(--sh-xs);
}
.bubble p + p { margin-top: var(--s-3); }
/* Code / stack traces in a message body must WRAP inside the bubble, never overhang it (#2509). */
.bubble pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; margin-top: var(--s-2); font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.55; }
.bubble code { overflow-wrap: anywhere; word-break: break-word; }

/* staff message — gradient-edge accent on the left */
.msg.is-staff .bubble {
  background: var(--surface-2);
  border-color: var(--line);
}
.msg.is-staff .avatar { order: 2; }
.msg.is-staff { grid-template-columns: minmax(0,1fr) auto; }
.msg.is-staff .msg-body-wrap { text-align: left; }
.msg.is-staff .bubble { border-top-left-radius: var(--r-md); border-top-right-radius: 5px; }
.msg.is-staff .msg-head { flex-direction: row-reverse; }
.msg.is-staff .msg-actions { margin-left: 0; margin-right: auto; }

/* internal note — visually distinct staff-only */
.msg.is-note .bubble {
  background: repeating-linear-gradient(135deg, var(--staff-bg), var(--staff-bg) 14px, #f7f0ff 14px, #f7f0ff 28px);
  border: 1px solid var(--staff-line);
  border-left: 3px solid var(--staff);
  color: var(--ink-800);
}
.note-banner {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: var(--w-bold); letter-spacing: .06em; text-transform: uppercase;
  color: var(--staff); margin-bottom: 6px;
}

/* attachment chip */
.attach {
  display: inline-flex; align-items: center; gap: var(--s-3);
  margin-top: var(--s-3); padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); box-shadow: var(--sh-xs);
}
.attach .file-ico {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: var(--w-bold);
  background: var(--grad-brand-soft);
}
.attach .file-meta { line-height: 1.3; }
.attach .file-name { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); }
.attach .file-size { font-size: var(--text-xs); color: var(--ink-500); }
.attach .dl { margin-left: var(--s-2); color: var(--ink-400); }

.composer-wrap { margin-top: var(--s-2); }
.composer-meta { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }


/* =====================================================================
   16. META RAIL CARDS
   ===================================================================== */
.rail { display: flex; flex-direction: column; gap: var(--s-5); position: sticky; top: var(--s-6); }

.detail-list { display: flex; flex-direction: column; }
.detail-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.detail-row:last-child { border-bottom: 0; }
.detail-row .dk { font-size: var(--text-sm); color: var(--ink-500); }
.detail-row .dv { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); display: inline-flex; align-items: center; gap: 7px; text-align: right; }
.detail-row.is-staff { background: var(--staff-bg); margin: 0 calc(var(--s-5) * -1); padding-left: var(--s-5); padding-right: var(--s-5); border-bottom-color: var(--staff-line); }
.detail-row.is-staff .dk { color: var(--staff); font-weight: var(--w-medium); }

/* manage card body */
.manage-grid { display: flex; flex-direction: column; gap: var(--s-4); }
.notify-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0;
}
.notify-row .nr-meta { line-height: 1.3; min-width: 0; }
.notify-row .nr-name { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); }
.notify-row .nr-mail { font-size: var(--text-xs); color: var(--ink-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-row .toggle { margin-left: auto; flex: none; }

/* quote approval */
.quote-amount {
  display: flex; align-items: baseline; gap: var(--s-2);
  font-weight: var(--w-black); letter-spacing: -0.02em;
}
.quote-amount .num { font-size: var(--text-3xl); color: var(--ink-900); }
.quote-amount .cur { font-size: var(--text-lg); color: var(--ink-500); font-weight: var(--w-bold); }
.quote-amount .vat { font-size: var(--text-xs); color: var(--ink-500); font-weight: var(--w-medium); margin-left: 2px; }
.quote-pending {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--text-xs); font-weight: var(--w-semibold); color: #c4730a;
  background: var(--st-awaiting-bg); border-radius: var(--r-pill); padding: 3px 10px;
}


/* =====================================================================
   17. LEGEND + STAFF-ONLY MARKING
   ===================================================================== */
/* small inline staff-only tag */
.staff-tag {
  /* Staff "🔒" labels are hidden from the UI but kept in the DOM so the
     client-view toggle can still find + hide staff-only controls. */
  display: none;
  align-items: center; gap: 5px;
  font-size: 10px; font-weight: var(--w-bold); letter-spacing: .05em; text-transform: uppercase;
  color: var(--staff); background: var(--staff-bg); border: 1px solid var(--staff-line);
  border-radius: var(--r-pill); padding: 2px 8px; line-height: 1.4;
}
.staff-tag .lk { font-size: 10px; }

/* Staff-only zones marker — the purple gradient accent bar was removed per #2477 (no "purple lines");
   the 🔒 staff-tag is the marker now. */
.staff-zone { position: relative; }

.legend {
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.legend .lg-lead { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--ink-700); }
.legend .lg-lead b { color: var(--ink-900); font-weight: var(--w-bold); }
.legend .lg-item { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-xs); color: var(--ink-600); }
.legend .swatch { width: 12px; height: 12px; border-radius: 4px; }
.legend .swatch.staff { background: var(--staff-bg); border: 1px solid var(--staff-line); }
.legend .swatch.shared { background: var(--surface); border: 1px solid var(--line-strong); }


/* =====================================================================
   18. UTILITIES
   ===================================================================== */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.center { align-items: center; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); } .mb-6 { margin-bottom: var(--s-6); }
.muted { color: var(--ink-500); }
.strong { font-weight: var(--w-semibold); color: var(--ink-900); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.hr { height: 1px; background: var(--line); border: 0; margin: var(--s-4) 0; }
.divider-soft { height: 1px; background: var(--line-soft); }
.pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--r-pill); font-size: 11px; font-weight: var(--w-bold);
  background: var(--indigo-50); color: var(--indigo-600);
}
.w-full { width: 100%; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.items-start { align-items: flex-start; }
.grow { flex: 1; }
.rel { position: relative; }


/* =====================================================================
   19. MODAL / OVERLAY
   ===================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: var(--s-6);
  background: rgba(12, 14, 26, 0.40);
  backdrop-filter: blur(7px) saturate(1.1);
  -webkit-backdrop-filter: blur(7px) saturate(1.1);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s;
}
.overlay.is-open { opacity: 1; visibility: visible; }
body.is-locked { overflow: hidden; }

.modal {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  max-height: calc(100vh - var(--s-9));
  display: flex; flex-direction: column;
  transform: translateY(10px) scale(.985);
  transition: transform .24s cubic-bezier(.2,.85,.25,1);
  overflow: hidden;
}
.overlay.is-open .modal { transform: none; }
.modal.modal-sm { max-width: 440px; }
.modal.modal-lg { max-width: 720px; }

.modal-head {
  display: flex; align-items: flex-start; gap: var(--s-4);
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--line);
}
.modal-head .mh-icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: var(--grad-brand); box-shadow: var(--sh-glow);
  display: grid; place-items: center; color: #fff; font-size: 18px;
  position: relative; overflow: hidden;
}
.modal-head .mh-icon::after { content: ""; position: absolute; inset: 0; background: linear-gradient(150deg, rgba(255,255,255,.5), rgba(255,255,255,0) 45%); }
.modal-head .mh-text { min-width: 0; padding-top: 1px; }
.modal-head h2 { font-size: var(--text-xl); font-weight: var(--w-bold); letter-spacing: -0.02em; color: var(--ink-900); }
.modal-head p { font-size: var(--text-sm); color: var(--ink-600); margin-top: 3px; line-height: 1.4; }
.modal-x {
  margin-left: auto; width: 34px; height: 34px; flex: none;
  border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--ink-500); background: transparent; border: 0; cursor: pointer;
  font-size: 17px; transition: background .15s, color .15s;
}
.modal-x:hover { background: var(--surface-sunken); color: var(--ink-900); }
.modal-body { padding: var(--s-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-5); }
.modal-foot {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-foot .note { font-size: var(--text-xs); color: var(--ink-500); }

/* form row helpers used inside modals/cards */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.select-display {
  display: flex; align-items: center; gap: var(--s-2);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 10px var(--s-3);
  font-size: var(--text-md); color: var(--ink-800); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.select-display:hover { border-color: var(--ink-400); }
/* Locked display (e.g. a client's requester = themselves) — static, not a dropdown. */
.select-display.is-locked { cursor: default; background: var(--surface-sunken); pointer-events: none; }
/* Staff user-search typeahead (Add a user) — results dropdown under the search input. */
[data-user-search-wrap] { position: relative; }
.us-results { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--sh-lg, 0 16px 40px -12px rgba(16,24,40,.28)); max-height: 248px; overflow-y: auto; padding: 4px; }
.us-results.is-open { display: block; }
.us-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; border-radius: var(--r-xs, 8px); cursor: pointer; text-align: left; }
.us-item:hover { background: var(--surface-sunken); }
.us-meta { display: flex; flex-direction: column; min-width: 0; }
.us-name { font-weight: var(--w-semibold); color: var(--ink-800); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-mail { color: var(--ink-500); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-empty { padding: 12px 10px; color: var(--ink-500); font-size: var(--text-sm); }
/* CC ("also notify") chips — toggleable domain colleagues on the new-ticket form. */
.cc-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); cursor: pointer; font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--ink-700); user-select: none; transition: border-color .12s, background .12s, color .12s; }
.cc-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cc-chip:hover { border-color: var(--ink-400); }
.cc-chip.is-on, .cc-chip:has(input:checked) { background: color-mix(in srgb, var(--indigo-500) 12%, transparent); border-color: var(--indigo-500); color: var(--ink-900); }
/* File upload — drag/drop + paste + browse (new-ticket form & reply composer). */
.up-zone { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--ink-500); font-size: var(--text-sm); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.up-zone:hover, .up-zone.is-dragover { border-color: var(--indigo-500); background: color-mix(in srgb, var(--indigo-500) 5%, transparent); color: var(--ink-700); }
.up-ico { font-size: 17px; }
.up-browse, .up-attach { background: none; border: 0; color: var(--indigo-600); font-weight: var(--w-semibold); cursor: pointer; padding: 0; font: inherit; }
.up-browse:hover, .up-attach:hover { text-decoration: underline; }
.up-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.composer-tools .up-list { margin-top: 0; }
.up-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; background: var(--surface-sunken); border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: var(--w-medium); color: var(--ink-700); max-width: 220px; }
.up-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-rm { background: none; border: 0; color: var(--ink-400); cursor: pointer; font-size: 12px; line-height: 1; padding: 2px 3px; border-radius: 50%; }
.up-rm:hover { color: var(--pri-urgent); background: var(--pri-urgent-bg); }
.tool-btn.up-attach { width: auto; padding: 0 4px; opacity: 1; }
.select-display .chev, .select-display .ml-auto { color: var(--ink-500); }
.pop.is-open .select-display { border-color: var(--indigo-500); box-shadow: 0 0 0 4px var(--ring); }


/* =====================================================================
   20. DROPDOWN MENU / POPOVER
   ===================================================================== */
.pop { position: relative; display: inline-flex; }
.pop.block { display: block; }
.pop.block > .menu { left: 0; right: 0; min-width: 0; }

.menu {
  position: absolute; z-index: 130; top: calc(100% + 7px); left: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: var(--s-2);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97);
  transform-origin: top left;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.pop.is-open > .menu, .menu.is-open { opacity: 1; visibility: visible; transform: none; }
.menu.menu-right { left: auto; right: 0; transform-origin: top right; }
.menu.menu-up { top: auto; bottom: calc(100% + 7px); transform-origin: bottom left; }
.menu.menu-wide { min-width: 280px; }

.menu-label { font-size: 10px; font-weight: var(--w-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); padding: 6px var(--s-3) 5px; }
.menu-item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  padding: 9px var(--s-3); border: 0; border-radius: var(--r-sm);
  background: none; text-align: left; font-family: inherit;
  font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--ink-700);
  cursor: pointer; white-space: nowrap; transition: background .12s, color .12s;
}
/* menu-items can be <button> (status/priority/reassign) — kill the native button border/outline. */
.menu-item:focus { outline: none; }
.menu-item:focus-visible { outline: none; background: var(--surface-sunken); }
.menu-item:hover { background: var(--surface-sunken); color: var(--ink-900); }
.menu-item .mi-ico { width: 18px; text-align: center; color: var(--ink-400); font-size: 14px; }
.menu-item .check { margin-left: auto; color: var(--indigo-600); opacity: 0; font-size: 13px; }
.menu-item.is-active { color: var(--ink-900); font-weight: var(--w-semibold); }
.menu-item.is-active .check { opacity: 1; }
.menu-item.danger { color: var(--pri-urgent); }
.menu-item.danger:hover { background: var(--pri-urgent-bg); }
.menu-item.danger .mi-ico { color: var(--pri-urgent); }
.menu-sep { height: 1px; background: var(--line); margin: var(--s-2) calc(var(--s-2) * -1); }

/* Account switcher dropdown: fixed so it escapes the sidebar's scroll-clip, comes to the
   front, and takes the width it needs (no more clipped/overhanging long domains). */
.pop.block > .menu.acct-menu {
  position: fixed;
  left: auto; right: auto;
  width: max-content;
  min-width: 240px;
  max-width: min(420px, 92vw);
  max-height: 72vh;
  overflow-y: auto;
  z-index: 300;
}
.acct-menu .menu-item { white-space: nowrap; }
.acct-menu .acct-opt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.acct-search { position: sticky; top: 0; background: var(--surface); padding: 2px 2px 8px; z-index: 1; }
.acct-search input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; font: inherit; font-size: var(--text-sm); color: var(--ink-900);
  background: var(--surface); outline: none;
}
.acct-search input:focus { border-color: var(--indigo-500); box-shadow: 0 0 0 3px rgba(109, 92, 255, .12); }


/* =====================================================================
   21. DATA TABLE (airy, modern — never dense)
   ===================================================================== */
.table-card { padding: var(--s-2) var(--s-5) var(--s-3); }
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; }
.dtable thead th {
  text-align: left; font-size: var(--text-xs); font-weight: var(--w-bold);
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-500);
  padding: var(--s-4) var(--s-3) var(--s-3); white-space: nowrap;
}
.dtable thead th.num, .dtable td.num { text-align: right; }
.dtable tbody td {
  padding: 14px var(--s-3); border-top: 1px solid var(--line);
  font-size: var(--text-sm); color: var(--ink-700); vertical-align: middle;
}
.dtable tbody tr { transition: background .12s; cursor: pointer; }
.dtable tbody tr:hover td { background: var(--surface-2); }
.dtable td .t-strong { font-weight: var(--w-semibold); color: var(--ink-900); }
.dtable td.num { font-family: var(--font-mono); font-weight: var(--w-semibold); color: var(--ink-900); }
.dtable .cell { display: inline-flex; align-items: center; gap: var(--s-3); }


/* =====================================================================
   22. STAT / METRIC CARDS
   ===================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: var(--s-4); }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--sh-sm);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.stat .stat-label { font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--ink-500); display: inline-flex; align-items: center; gap: 7px; }
.stat .stat-value { font-size: var(--text-3xl); font-weight: var(--w-black); letter-spacing: -0.03em; color: var(--ink-900); line-height: 1; }
.stat .stat-value .unit { font-size: var(--text-lg); color: var(--ink-500); font-weight: var(--w-bold); margin-left: 1px; }
.stat .stat-foot { font-size: var(--text-xs); color: var(--ink-500); display: inline-flex; align-items: center; gap: 7px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: var(--w-bold); padding: 2px 7px; border-radius: var(--r-pill); }
.trend.up { color: var(--st-open); background: var(--st-open-bg); }
.trend.down { color: var(--pri-urgent); background: var(--pri-urgent-bg); }
.trend.flat { color: var(--ink-600); background: var(--surface-sunken); }
/* gradient hero stat — one per screen */
.stat.stat-hero { background: var(--grad-hero); border: 0; color: #fff; box-shadow: var(--sh-glow); position: relative; overflow: hidden; }
.stat.stat-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,0) 42%); pointer-events: none; }
.stat.stat-hero .stat-label, .stat.stat-hero .stat-foot { color: rgba(255,255,255,.86); }
.stat.stat-hero .stat-value, .stat.stat-hero .stat-value .unit { color: #fff; }
.stat.stat-hero .trend { background: rgba(255,255,255,.22); color: #fff; }


/* =====================================================================
   23. PROGRESS / METERS
   ===================================================================== */
.meter { height: 8px; border-radius: var(--r-pill); background: var(--surface-sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); }
.meter.thin { height: 6px; }
.meter.warn > span { background: linear-gradient(90deg, var(--st-awaiting), var(--pri-high)); }
.meter.good > span { background: linear-gradient(90deg, var(--st-open), var(--online)); }
.meter-row { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-xs); margin-bottom: 8px; }
.meter-row .mr-k { color: var(--ink-600); font-weight: var(--w-medium); }
.meter-row .mr-v { color: var(--ink-900); font-weight: var(--w-bold); }


/* =====================================================================
   24. BENTO / PROJECT CARDS
   ===================================================================== */
.bento { display: grid; grid-template-columns: repeat(auto-fill, minmax(304px, 1fr)); gap: var(--s-4); }
.pcard { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: transform .14s, box-shadow .18s, border-color .15s; }
.pcard:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.pcard .thumb {
  height: 116px; position: relative; overflow: hidden;
  background: var(--grad-hero); display: flex; align-items: flex-end;
  padding: var(--s-4);
}
.pcard .thumb.alt-1 { background: linear-gradient(135deg,#0aa86f,#22d3ee); }
.pcard .thumb.alt-2 { background: linear-gradient(135deg,#ff7a18,#ff3d6e); }
.pcard .thumb.alt-3 { background: linear-gradient(135deg,#2d8bff,#6d5cff); }
.pcard .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,0) 50%); }
.pcard .thumb .badge { position: relative; z-index: 1; background: rgba(255,255,255,.9); color: var(--ink-800); backdrop-filter: blur(4px); }
.pcard .pc-body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }


/* =====================================================================
   25. SETTINGS LAYOUT + ROWS
   ===================================================================== */
.settings-grid { display: grid; grid-template-columns: 224px minmax(0,1fr); gap: var(--s-7); align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: var(--s-6); }
.subnav .sn-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 9px var(--s-3); border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--ink-600);
  cursor: pointer; transition: background .12s, color .12s;
}
.subnav .sn-item:hover { background: var(--surface-sunken); color: var(--ink-900); }
.subnav .sn-item.is-active { background: var(--indigo-50); color: var(--indigo-600); font-weight: var(--w-semibold); }
.subnav .sn-item .ico { width: 16px; text-align: center; color: var(--ink-400); font-size: 14px; }
.subnav .sn-item.is-active .ico { color: var(--indigo-600); }

.set-row {
  display: flex; align-items: center; gap: var(--s-5);
  padding: var(--s-4) 0; border-bottom: 1px solid var(--line-soft);
}
.set-row:last-child { border-bottom: 0; }
.set-row .sr-meta { min-width: 0; }
.set-row .sr-name { font-size: var(--text-md); font-weight: var(--w-semibold); color: var(--ink-900); }
.set-row .sr-desc { font-size: var(--text-sm); color: var(--ink-600); margin-top: 3px; line-height: 1.45; }
.set-row .sr-control { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: var(--s-3); }


/* =====================================================================
   26. SECTION HEAD / BANNER / BADGE / BREADCRUMB / EMPTY / TOAST
   ===================================================================== */
.section-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.section-head h2 { font-size: var(--text-xl); font-weight: var(--w-bold); letter-spacing: -0.02em; }
.section-head .sub { font-size: var(--text-sm); color: var(--ink-600); }
.section-head .sh-actions { margin-left: auto; display: inline-flex; gap: var(--s-2); align-items: center; }

.banner {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5); border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-xs);
}
.banner .bn-ico { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 16px; background: var(--st-progress-bg); color: var(--st-progress); }
.banner .bn-text { font-size: var(--text-sm); color: var(--ink-700); line-height: 1.45; }
.banner .bn-text b { color: var(--ink-900); font-weight: var(--w-semibold); }
.banner .bn-act { margin-left: auto; flex: none; }
.banner.warn { background: linear-gradient(90deg, var(--st-awaiting-bg), color-mix(in srgb, var(--st-awaiting-bg) 35%, var(--surface))); border-color: #f6e1bd; }
.banner.warn .bn-ico { background: #fff; color: var(--pri-high); }
.banner.brand { background: linear-gradient(90deg, var(--indigo-50), color-mix(in srgb, var(--indigo-50) 35%, var(--surface))); border-color: #e0dcff; }
.banner.brand .bn-ico { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-glow); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: var(--w-semibold); background: var(--surface-sunken); color: var(--ink-700); white-space: nowrap; }
.badge.ok { background: var(--st-open-bg); color: var(--st-open); }
.badge.warn { background: var(--st-awaiting-bg); color: #c4730a; }
.badge.info { background: var(--st-progress-bg); color: var(--st-progress); }
.badge.brand { background: var(--indigo-50); color: var(--indigo-600); }
.badge.danger { background: var(--pri-urgent-bg); color: var(--pri-urgent); }

.crumbs { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ink-500); margin-bottom: var(--s-4); }
.crumbs a:hover { color: var(--ink-800); }
.crumbs .sep { color: var(--ink-400); }
.crumbs .cur { color: var(--ink-900); font-weight: var(--w-semibold); }

.empty { text-align: center; padding: var(--s-9) var(--s-6); }
.empty .em-ico { width: 62px; height: 62px; border-radius: var(--r-lg); display: grid; place-items: center; margin: 0 auto var(--s-4); font-size: 26px; background: var(--indigo-50); color: var(--indigo-600); }
.empty h3 { font-size: var(--text-lg); margin-bottom: 6px; }
.empty p { font-size: var(--text-sm); color: var(--ink-600); max-width: 360px; margin: 0 auto; }

.toast-wrap { position: fixed; right: var(--s-6); bottom: var(--s-6); z-index: 200; display: flex; flex-direction: column; gap: var(--s-3); }
.toast {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 12px var(--s-4) 12px var(--s-3); min-width: 270px; max-width: 380px;
  background: var(--ink-900); color: #fff;
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
  font-size: var(--text-sm); font-weight: var(--w-medium);
  transform: translateY(14px); opacity: 0;
  transition: transform .26s cubic-bezier(.2,.85,.25,1), opacity .26s;
}
.toast.is-show { transform: none; opacity: 1; }
.toast .tn-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--grad-brand-soft); font-size: 12px; color: #fff; }


/* =====================================================================
   27. PAGE-LEVEL TAB BAR (.ptabs) — distinct from .tabs filters + .subnav
   ===================================================================== */
.ptabs { display: flex; align-items: stretch; gap: var(--s-6); border-bottom: 1px solid var(--line); margin-bottom: var(--s-6); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.ptabs::-webkit-scrollbar { display: none; }

/* ===== Accounts area: domain list (floating row-cards) + detail ===== */
.dom-thead { display: grid; grid-template-columns: minmax(260px,1.7fr) 150px 120px 168px 40px; gap: var(--s-4); padding: 0 var(--s-5) 6px; font-size: 10px; font-weight: var(--w-bold); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400); }
.dom-list { display: flex; flex-direction: column; gap: var(--s-3); }
.dom-row { display: grid; grid-template-columns: minmax(260px,1.7fr) 150px 120px 168px 40px; align-items: center; gap: var(--s-4); padding: 13px var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-xs); cursor: pointer; transition: transform .12s, box-shadow .18s, border-color .15s; }
.dom-row:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.dom-row .dom { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.dom-row .dom-name { font-size: var(--text-md); font-weight: var(--w-bold); color: var(--ink-900); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dom-row .view { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--ink-400); background: var(--surface-sunken); transition: background .15s, color .15s, transform .12s; }
.dom-row:hover .view { background: var(--indigo-50); color: var(--indigo-600); transform: translateX(2px); }
.dom-fav { width: 34px; height: 34px; flex: none; border-radius: 9px; border: 1px solid var(--line); background: #fff; object-fit: contain; padding: 5px; }
.dom-fav-lg { width: 46px; height: 46px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: #fff; object-fit: contain; padding: 7px; }
.hours-mini { display: inline-flex; align-items: center; gap: 8px; }
.hours-mini .bar { width: 52px; height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; flex: none; }
.hours-mini .bar > span { display: block; height: 100%; background: var(--st-open); border-radius: 3px; }
.hours-mini .bar.low > span { background: var(--pri-high); }
.acct-nr-actions { display: inline-flex; align-items: center; gap: var(--s-3); margin-left: auto; flex: none; }
.acct-am-row { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 15px; }
@media (max-width: 900px) { .dom-thead { display: none; } .dom-row { grid-template-columns: 1fr auto; gap: var(--s-3); } }
.ptab {
  position: relative; padding: 0 2px var(--s-4); flex: none;
  font-size: var(--text-md); font-weight: var(--w-semibold); color: var(--ink-500);
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s;
}
.ptab:hover { color: var(--ink-800); }
.ptab .n { font-size: 11px; font-weight: var(--w-bold); color: var(--ink-400); background: var(--surface-sunken); padding: 1px 7px; border-radius: var(--r-pill); }
.ptab.is-active { color: var(--indigo-600); }
.ptab.is-active .n { color: var(--indigo-600); background: var(--indigo-50); }
.ptab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad-brand); border-radius: 2px; }


/* =====================================================================
   28. DRAWER / SIDE SHEET (reuses .modal-head/body/foot + overlay JS)
   ===================================================================== */
.overlay.is-drawer { place-items: stretch; padding: 0; }
.drawer {
  margin-left: auto; height: 100%; width: 480px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--sh-lg); display: flex; flex-direction: column;
  transform: translateX(28px); transition: transform .26s cubic-bezier(.2,.85,.25,1);
  overflow: hidden;
}
.overlay.is-open .drawer { transform: none; }
.drawer .modal-body { flex: 1; }
.drawer.drawer-wide { width: 620px; }


/* =====================================================================
   29. APPROVAL ACTION CARD (reusable approve / reject)
   ===================================================================== */
.approve-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); background: var(--surface); box-shadow: var(--sh-sm); }
.approve-card.is-pending { border-color: #f6e1bd; background: linear-gradient(180deg, var(--st-awaiting-bg), var(--surface) 60%); }
.approve-card.is-approved { border-color: #bfe9d4; background: linear-gradient(180deg, var(--st-open-bg), var(--surface) 60%); }
.approve-card.is-rejected { border-color: #f4c4cf; background: linear-gradient(180deg, var(--pri-urgent-bg), var(--surface) 60%); }
.approve-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.approve-actions { display: flex; gap: var(--s-3); margin-top: var(--s-4); }


/* =====================================================================
   30. CHARTS — bar / line (SVG) / donut (SVG) + legend
   ===================================================================== */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--sh-sm); }
.chart-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.chart-head .ch-title { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-900); }
.chart-head .ch-sub { font-size: var(--text-xs); color: var(--ink-500); }
.chart-head .ch-val { margin-left: auto; font-size: var(--text-xl); font-weight: var(--w-black); color: var(--ink-900); letter-spacing: -.02em; }

.barchart { display: flex; align-items: flex-end; gap: var(--s-2); height: 132px; padding-top: var(--s-3); }
.barchart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; height: 100%; min-width: 0; }
.barchart .bar > i { width: 100%; max-width: 28px; border-radius: 6px 6px 3px 3px; background: var(--grad-brand-soft); display: block; }
.barchart .bar.alt > i { background: var(--surface-sunken); }
.barchart .bar.hot > i { background: linear-gradient(180deg, var(--fuchsia-500), var(--indigo-500)); }
.barchart .bar .bx { font-size: 10px; color: var(--ink-500); font-weight: var(--w-semibold); white-space: nowrap; }

.linechart { width: 100%; height: 150px; display: block; overflow: visible; }
.linechart .grid line { stroke: var(--line); stroke-width: 1; }
.linechart .area { opacity: .16; }
.linechart .line { fill: none; stroke: var(--indigo-500); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.linechart .line.proj { stroke-dasharray: 5 5; stroke: var(--fuchsia-500); }
.linechart .pt { fill: var(--indigo-500); stroke: #fff; stroke-width: 2; }

.donut { width: 132px; height: 132px; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 15; }
.donut .track { stroke: var(--surface-sunken); }
.donut .val { stroke-linecap: round; }
.donut-wrap { position: relative; display: inline-grid; place-items: center; }
.donut-center { position: absolute; text-align: center; }
.donut-center .dc-val { font-size: var(--text-2xl); font-weight: var(--w-black); color: var(--ink-900); letter-spacing: -.02em; }
.donut-center .dc-lab { font-size: var(--text-xs); color: var(--ink-500); }

.chart-legend { display: flex; gap: var(--s-4); flex-wrap: wrap; margin-top: var(--s-4); }
.chart-legend .cl { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-xs); color: var(--ink-600); }
.chart-legend .cl .sw { width: 11px; height: 11px; border-radius: 3px; }
.chart-legend .cl b { color: var(--ink-900); font-weight: var(--w-bold); }


/* =====================================================================
   31. DATA LEDGER — dense multi-group table with editable cells + totals
   ===================================================================== */
.ledger-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.ledger thead .grp th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: var(--w-bold); color: var(--ink-500); padding: 0 var(--s-3) 7px; text-align: center; }
.ledger thead .grp th.g-perf { color: var(--indigo-600); }
.ledger thead .grp th.g-bill { color: var(--st-open); }
.ledger thead .cols th { font-size: 11px; font-weight: var(--w-semibold); color: var(--ink-600); padding: 9px var(--s-3); text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
.ledger thead .cols th.lead { text-align: left; }
.ledger tbody td { padding: 11px var(--s-3); text-align: right; border-bottom: 1px solid var(--line-soft); font-family: var(--font-mono); color: var(--ink-800); white-space: nowrap; }
.ledger tbody td.lead { text-align: left; font-family: var(--font-sans); font-weight: var(--w-semibold); color: var(--ink-900); }
.ledger tbody td.edit { cursor: pointer; position: relative; }
.ledger tbody td.edit:hover { color: var(--indigo-600); box-shadow: inset 0 0 0 1.5px var(--indigo-500); border-radius: 6px; }
.ledger tbody tr:hover td { background: var(--surface-2); }
.ledger tfoot td { padding: 12px var(--s-3); text-align: right; font-family: var(--font-mono); font-weight: var(--w-bold); color: var(--ink-900); border-top: 2px solid var(--line-strong); background: var(--surface-2); }
.ledger tfoot td.lead { text-align: left; font-family: var(--font-sans); }


/* =====================================================================
   32. KANBAN BOARD
   ===================================================================== */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(266px, 1fr); gap: var(--s-4); overflow-x: auto; padding-bottom: var(--s-3); align-items: start; }
.kcol { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-3); min-height: 140px; }
.kcol-head { display: flex; align-items: center; gap: var(--s-2); padding: 4px var(--s-2); }
.kcol-head .kc-dot { width: 8px; height: 8px; border-radius: 50%; }
.kcol-head .kc-title { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-800); }
.kcol-head .kc-n { margin-left: auto; font-size: 11px; font-weight: var(--w-bold); color: var(--ink-500); background: var(--surface); border: 1px solid var(--line); padding: 1px 8px; border-radius: var(--r-pill); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-4); box-shadow: var(--sh-xs); cursor: pointer; display: flex; flex-direction: column; gap: var(--s-3); transition: transform .12s, box-shadow .15s, border-color .12s; }
.kcard:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.kcard .kc-top { display: flex; align-items: center; gap: var(--s-2); }
.kcard .kc-name { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-900); }
.kcard .kc-meta { font-size: var(--text-xs); color: var(--ink-500); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.kcard .kc-foot { display: flex; align-items: center; justify-content: space-between; }


/* =====================================================================
   33. SPLIT-DETAIL LAYOUT (master list + detail pane)
   ===================================================================== */
.split { display: grid; grid-template-columns: 326px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.split-list { display: flex; flex-direction: column; gap: 5px; position: sticky; top: var(--s-6); max-height: calc(100vh - var(--s-9)); overflow-y: auto; padding-right: 2px; }
.split-item { display: flex; align-items: center; gap: var(--s-3); padding: 11px var(--s-3); border-radius: var(--r-md); border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s; }
.split-item:hover { background: var(--surface); border-color: var(--line); }
.split-item.is-active { background: var(--surface); border-color: var(--indigo-500); box-shadow: var(--sh-sm); }
.split-item .si-meta { min-width: 0; flex: 1; }
.split-item .si-name { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split-item .si-sub { font-size: var(--text-xs); color: var(--ink-500); }


/* =====================================================================
   34. SITEMAP / TREE
   ===================================================================== */
.tree { display: flex; flex-direction: column; gap: 5px; }
.tree-node { display: flex; align-items: center; gap: var(--s-3); padding: 9px var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); transition: border-color .12s; }
.tree-node:hover { border-color: var(--line-strong); }
.tree-node.child { margin-left: var(--s-6); }
.tree-node.child2 { margin-left: calc(var(--s-6) * 2); }
.tree-node .tn-handle { color: var(--ink-400); cursor: grab; }
.tree-node .tn-name { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); }
.tree-node .tn-path { font-size: var(--text-xs); color: var(--ink-500); font-family: var(--font-mono); }
.tree-node .tn-actions { margin-left: auto; display: inline-flex; gap: 4px; }


/* =====================================================================
   35. ALERT BOARD CARD (severity-tinted)
   ===================================================================== */
.alert-card { border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); padding: var(--s-4); box-shadow: var(--sh-xs); border-left-width: 3px; }
.alert-card.crit { border-left-color: var(--pri-urgent); }
.alert-card.warn { border-left-color: var(--pri-high); }
.alert-card.watch { border-left-color: var(--st-progress); }
.alert-card .al-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.alert-card .al-title { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-900); }
.alert-card .al-sev { font-size: 10px; font-weight: var(--w-bold); text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: var(--r-pill); }
.alert-card.crit .al-sev { background: var(--pri-urgent-bg); color: var(--pri-urgent); }
.alert-card.warn .al-sev { background: var(--pri-high-bg); color: #d2540a; }
.alert-card.watch .al-sev { background: var(--st-progress-bg); color: var(--st-progress); }
.alert-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px var(--s-4); margin-top: var(--s-3); }
.alert-metrics .am { display: flex; justify-content: space-between; font-size: var(--text-xs); }
.alert-metrics .am .k { color: var(--ink-500); }
.alert-metrics .am .v { color: var(--ink-900); font-weight: var(--w-semibold); font-family: var(--font-mono); }


/* =====================================================================
   36. STEPPER / WIZARD HEADER
   ===================================================================== */
.stepper { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-6); }
.step { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-500); }
.step .sx { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: var(--text-xs); background: var(--surface-sunken); color: var(--ink-500); border: 1px solid var(--line); }
.step.is-active { color: var(--ink-900); }
.step.is-active .sx { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--sh-glow); }
.step.is-done .sx { background: var(--st-open-bg); color: var(--st-open); border-color: transparent; }
.step-sep { flex: 1; height: 2px; background: var(--line); border-radius: 2px; min-width: 20px; }
.step-sep.is-done { background: var(--grad-brand); }


/* =====================================================================
   37. ACCORDION / EXPANDABLE LOG
   ===================================================================== */
.acc { display: flex; flex-direction: column; gap: var(--s-2); }
.acc-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.acc-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); cursor: pointer; transition: background .12s; }
.acc-head:hover { background: var(--surface-2); }
.acc-head .acc-chev { margin-left: auto; color: var(--ink-400); transition: transform .18s; }
.acc-item.is-open .acc-head .acc-chev { transform: rotate(90deg); }
.acc-body { display: none; padding: 0 var(--s-4) var(--s-4); }
.acc-item.is-open .acc-body { display: block; }
.acc-body pre { background: #0f1120; color: #d8dcf0; border-radius: var(--r-sm); padding: var(--s-3); font-family: var(--font-mono); font-size: var(--text-xs); overflow-x: auto; line-height: 1.6; margin-top: var(--s-2); }


/* =====================================================================
   38. UPLOAD DROPZONE + FILE CHIPS
   ===================================================================== */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); padding: var(--s-6); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--indigo-500); background: var(--indigo-50); }
.dropzone .dz-ico { font-size: 24px; color: var(--indigo-500); margin-bottom: 7px; }
.dropzone .dz-main { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-800); }
.dropzone .dz-main b { color: var(--indigo-600); }
.dropzone .dz-sub { font-size: var(--text-xs); color: var(--ink-500); margin-top: 3px; }
.file-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.file-chip { display: inline-flex; align-items: center; gap: var(--s-2); padding: 5px 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: var(--w-medium); color: var(--ink-700); }
.file-chip .x { color: var(--ink-400); cursor: pointer; }


/* =====================================================================
   39. PRESENCE ROSTER (inside a .menu)
   ===================================================================== */
.roster { min-width: 268px; }
.roster .ro { display: flex; align-items: center; gap: var(--s-3); padding: 8px var(--s-3); border-radius: var(--r-sm); }
.roster .ro:hover { background: var(--surface-sunken); }
.roster .ro .ro-meta { min-width: 0; line-height: 1.3; }
.roster .ro .ro-name { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); }
.roster .ro .ro-sub { font-size: var(--text-xs); color: var(--ink-500); }


/* =====================================================================
   40. OVERVIEW — action queue, activity feed, quick-launch tiles
   ===================================================================== */
.queue-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-xs); transition: border-color .12s, transform .12s; cursor: pointer; }
.queue-item:hover { border-color: var(--line-strong); transform: translateX(2px); }
.queue-item .qi-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 16px; }
.queue-item .qi-meta { flex: 1; min-width: 0; }
.queue-item .qi-title { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-900); }
.queue-item .qi-sub { font-size: var(--text-xs); color: var(--ink-500); }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .fi-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 13px; background: var(--surface-sunken); color: var(--ink-600); }
.feed-item .fi-body { min-width: 0; flex: 1; }
.feed-item .fi-text { font-size: var(--text-sm); color: var(--ink-700); line-height: 1.45; }
.feed-item .fi-text b { color: var(--ink-900); font-weight: var(--w-semibold); }
.feed-item .fi-time { font-size: var(--text-xs); color: var(--ink-500); margin-top: 2px; }

.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: var(--s-3); }
.launch-tile { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-xs); cursor: pointer; transition: transform .12s, box-shadow .15s, border-color .12s; }
.launch-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.launch-tile .lt-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: var(--indigo-50); color: var(--indigo-600); }
.launch-tile .lt-name { font-size: var(--text-sm); font-weight: var(--w-bold); color: var(--ink-900); }
.launch-tile .lt-sub { font-size: var(--text-xs); color: var(--ink-500); }


/* =====================================================================
   41. AUTH / LOGIN LAYOUT
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand { position: relative; overflow: hidden; background: var(--grad-hero); color: #fff; padding: var(--s-10) var(--s-9); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-8); }
.auth-brand::after { content: ""; position: absolute; inset: 0; background: radial-gradient(820px 420px at 82% 8%, rgba(255,255,255,.28), transparent 60%); pointer-events: none; }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .ab-kicker { font-size: var(--text-xs); font-weight: var(--w-bold); letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.8); }
.auth-brand .ab-head { font-size: var(--text-4xl); font-weight: var(--w-black); letter-spacing: -.03em; line-height: 1.04; margin-top: var(--s-3); }
.auth-brand .ab-sub { font-size: var(--text-lg); color: rgba(255,255,255,.85); margin-top: var(--s-4); max-width: 440px; line-height: 1.5; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: var(--s-8); }
.auth-card { width: 100%; max-width: 408px; }
@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* generic two-column content split used by several pages */
.grid-2 { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: var(--s-6); align-items: start; }
.grid-2.wide-rail { grid-template-columns: minmax(0,1fr) 400px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
@media (max-width: 1080px) { .grid-2, .grid-2.wide-rail { grid-template-columns: 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }


/* =====================================================================
   42. CLIENT VIEW MODE — preview the dashboard as a client (hide staff bits)
   ===================================================================== */
.view-banner {
  display: flex; align-items: center; gap: 7px;
  margin: calc(var(--s-3) * -1) var(--s-2) 0;
  padding: 8px var(--s-3); border-radius: var(--r-sm);
  background: var(--st-open-bg); color: var(--st-open);
  border: 1px solid #bfe9d4;
  font-size: var(--text-xs); font-weight: var(--w-bold); cursor: pointer;
}
.view-banner .vb-exit { margin-left: auto; font-weight: var(--w-semibold); opacity: .85; }
.view-banner:hover { filter: brightness(.98); }

/* hide staff-only nodes in client view (deliberate mode override → !important) */
body.is-client .staff-only,
body.is-client .staff-strip,
body.is-client .staff-card,
body.is-client .staff-zone,
body.is-client .staff-tag,
body.is-client .segmented,
body.is-client .detail-row.is-staff,
body.is-client .msg.is-note,
body.is-client .btn:has(.staff-tag),
body.is-client .field:has(.staff-tag),
body.is-client .ptab:has(.staff-tag),
body.is-client .set-row:has(.staff-tag),
body.is-client .notify-row:has(.staff-tag),
body.is-client .menu-item:has(.staff-tag),
body.is-client .queue-item:has(.staff-tag),
body.is-client .detail-row:has(.staff-tag),
body.is-client .legend .lg-item:has(.staff-tag),
body.is-client [data-staff] { display: none !important; }

/* ticket list: drop the staff assignee column cleanly (no empty grid track) */
body.is-client .trow { grid-template-columns: 150px minmax(220px,1fr) 96px 140px 84px 34px; }
body.is-client .trow .staff-col { display: none !important; }

/* client-view identity tint */
body.is-client .user-block .ub-role { color: var(--st-open); }
body.is-client .acct-switch .acct-glyph { background: linear-gradient(135deg,#0aa86f,#16c47f); }

/* whole staff-only page → friendly lock notice */
.client-lock { display: none; }
body.is-client.staff-locked .main-inner > * { display: none !important; }
body.is-client.staff-locked .main-inner > .client-lock { display: grid !important; place-items: center; min-height: 64vh; }
