/* =====================================================================
   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; }

/* Reserve the viewport scrollbar gutter so navigating between short and tall
   areas never shifts the layout sideways (and a modal opening on a tall page
   doesn't twitch either). Must stay on html with overflow:visible so the
   modal scroll-lock (body.is-locked{overflow:hidden}) still propagates. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

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-700: #4a3bee;
  --indigo-500: #6d5cff;
  /* #2888: compatibility tokens that templates referenced but were never defined here (silent breakage) */
  --indigo-400: #8b7bff;                                          /* lead-card dot */
  --indigo-100: #e0e3ff;                                          /* subtle tints / borders */
  --good: #0aa86f;                                                /* success green — Deploy "live" indicator */
  --sunken: var(--surface-sunken);                                /* alias used by file-health bars */
  --grad-soft: linear-gradient(135deg, #eef0ff 0%, #f6efff 100%); /* soft tint used by info cards */
  --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-open-line:  #bfe9d4;  /* #2874: green hairline tint — for the success banner/card border */
  --st-awaiting:   #f59311;  /* amber   */
  --st-awaiting-bg:#fff1dc; --st-awaiting:#c4730a; /* #2852: shared amber/warn (matches the --st-* family) */
  --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;
  --danger:     #d92d54;  /* #2873: destructive red — was only in mobile.css, so desktop var(--danger) fell back to grey */
  --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; }
.acct-opt-fav[hidden] { display: none; } /* the app's img display reset overrides the UA [hidden] rule, so restore it — keeps an unselected domain picker's empty favicon slot hidden instead of showing a broken-image icon (#2555). */

/* 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); }

/* Rich-text editor (reply + new-ticket message): formatting toolbar + contenteditable. */
.rte { border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--indigo-500); box-shadow: 0 0 0 4px var(--ring); }
.rte.is-invalid { border-color: var(--pri-urgent); box-shadow: 0 0 0 4px var(--pri-urgent-bg); }
.rte-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 1px; padding: 5px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rte-btn { min-width: 30px; height: 28px; padding: 0 8px; border: 0; border-radius: var(--r-xs, 7px); background: transparent; color: var(--ink-700); cursor: pointer; font-size: var(--text-sm); line-height: 1; display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.rte-btn:hover { background: var(--surface-sunken); color: var(--ink-900); }
.rte-btn.is-on { background: color-mix(in srgb, var(--indigo-500) 14%, transparent); color: var(--indigo-700, var(--indigo-600)); }
.rte-div { width: 1px; height: 16px; background: var(--line); margin: 0 4px; flex: none; }
.rte-body { min-height: 90px; max-height: 340px; overflow-y: auto; padding: 11px 14px; outline: none; font-size: var(--text-md); line-height: 1.6; color: var(--ink-800); position: relative; }
.rte.is-empty .rte-body::before { content: attr(data-placeholder); color: var(--ink-500); pointer-events: none; }
.rte-body p { margin: 0 0 .55em; }
.rte-body p:last-child { margin-bottom: 0; }
.rte-body ul, .rte-body ol { margin: .2em 0 .55em 1.4em; }
.rte-body a { color: var(--indigo-600); text-decoration: underline; }
/* Inside the reply composer the .composer is the bordered box, so the RTE sits flush. */
.composer .rte { border: 0; border-radius: 0; background: transparent; }
.composer .rte:focus-within { box-shadow: none; }
.composer .rte-toolbar { background: transparent; }
.composer .rte-body { min-height: 104px; padding: var(--s-4) var(--s-5); }
.composer.is-note .rte-toolbar { border-bottom-color: var(--staff-line); }
.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: var(--st-awaiting); }
.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: var(--st-awaiting); }
.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: var(--st-awaiting); }
.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;
  overflow: hidden; /* clip the photo right to the edge (crisp, like the old dashboard) */
}
.avatar:has(.presence) { overflow: visible; } /* keep the presence dot that overhangs the edge */
.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; image-rendering: auto; }
/* A crisp 1px inner hairline defines the circular edge on EVERY avatar. Without it a
   photo whose own edge is pale (e.g. an illustrated headshot on a light background)
   blends into the page and looks fuzzy. It sits on top of the image, inside the circle. */
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.16); pointer-events: none; }
/* ring avatar — no white-gap halo; the photo fills right to the crisp edge like the
   old dashboard. (The .avatar::after hairline provides the defined 1px border.) */
.avatar.ring { box-shadow: none; }
.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(0,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); }
/* Unread highlight (#2427; clearer per #2457 — the dot was too easy to miss). A solid indigo left
   accent bar + a subtle tint + a bolder subject, so a ticket with an unread reply clearly stands out. */
.trow.is-unread, .trow.is-unread:hover {
  border-color: transparent;
  box-shadow: inset 3px 0 0 0 var(--indigo-600);
  background: var(--indigo-50);
}
.trow.is-unread .subj-title { font-weight: var(--w-black); }

/* System Tools is Corsto's own internal queue — every task's requester is "Corsto Support" and
   assignment isn't used — so drop those two person columns and let the subject breathe (#2479). */
.trow.sys { grid-template-columns: minmax(220px,1fr) 96px 140px 84px 34px; }
.trow.sys .req, .trow.sys .assignee { display: none; }

/* Tool/system tickets: hide the time-log, price and snooze cards in the rail — not needed (#2433). */
.rail.is-system { display: none; }
.detail-grid:has(.rail.is-system) { grid-template-columns: minmax(0, 1fr); }

/* Live presence dock (#2432) — floating "who's online" pill, bottom-right, with a pulsing live dot. */
.presence-dock { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: inline-flex; align-items: center; gap: 9px; padding: 7px 15px 7px 13px; background: var(--surface); border: 1px solid var(--line); border-radius:var(--r-pill); box-shadow: var(--sh-lg, 0 14px 34px -12px rgba(11, 16, 32, .28)); animation: presenceIn .3s ease; }
/* An open modal/drawer overlay lives inside the sticky .rail stacking context, so its z-index can't
   lift it above this body-level dock — the dock would cover the drawer's Save button (bottom-right).
   Hide the dock whenever any modal/drawer is open (it's irrelevant while you're in a modal). */
body:has(.overlay.is-open) .presence-dock,
body:has(.rec-modal-overlay:not([hidden])) .presence-dock { display: none; }
@keyframes presenceIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.presence-pulse { width: 9px; height: 9px; border-radius: 50%; background: #16c47f; flex: none; animation: presencePulse 2s infinite; }
@keyframes presencePulse { 0% { box-shadow: 0 0 0 0 rgba(22, 196, 127, .5); } 70% { box-shadow: 0 0 0 7px rgba(22, 196, 127, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 196, 127, 0); } }
.presence-stack { display: inline-flex; }
.presence-stack .presence-av { margin-left: -9px; border: 2px solid var(--surface); }
.presence-stack .presence-av:first-child { margin-left: 0; }
.presence-more { font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--ink-600); }
.presence-label { font-size: var(--text-xs); font-weight: var(--w-medium); color: var(--ink-500); }
/* Hover the dock to see WHO is online (#2432). */
.presence-list { position: absolute; right: 0; bottom: calc(100% + 12px); min-width: 230px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg, 0 14px 34px -12px rgba(11, 16, 32, .28)); padding: 8px; display: none; }
.presence-dock:hover .presence-list, .presence-dock:focus-within .presence-list { display: block; }
.presence-list .pl-head { font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--ink-500); padding: 4px 8px 8px; }
.presence-list .pl-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.presence-list .pl-row:hover { background: rgba(109, 92, 255, .06); }
.presence-list .pl-name { font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--ink-800); }
.presence-list .pl-role { font-size: var(--text-xs); color: var(--ink-500); margin-left: auto; }

.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 { display: none; } /* the dot is replaced by the clearer row treatment above (#2457) */
.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 results are shown as discreet auto-dismissing toasts (see .toast) — rendered
   centrally by Cgs_Render and surfaced by app.js, so they never take up layout space. */

/* "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:var(--r-pill); 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;
}
/* Account page: the domain name reuses .detail-head .subject but a touch smaller and MUST break —
   long domains have no spaces, so without this they overflow the header column on a phone (#2451 R5). */
.detail-head .subject.dom-name { font-size: var(--text-2xl); line-height: 1.1; overflow-wrap: anywhere; }
.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); }

.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);
  overflow-wrap: anywhere; /* long URLs / unbroken strings wrap instead of hitting the edge */
}
.bubble p + p { margin-top: var(--s-3); }
.bubble a { word-break: break-word; }
/* Code / stack traces in a message body must WRAP inside the bubble, never overhang it (#2509).
   <pre> defaults to white-space:pre (no wrap), so a long path/URL spills past the card edge. */
.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); }
/* A clickable detail value (e.g. staff changing the requester via a dropdown). */
.dv-chip { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 3px 7px; margin: -3px -7px; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-weight: var(--w-semibold); color: var(--ink-900); transition: background .12s; }
.dv-chip:hover { background: var(--surface-sunken); }
.dv-chip .chev { margin-left: 1px; color: var(--ink-400); }
/* Time logging card (staff). */
.tl-form { display: flex; flex-direction: column; gap: 8px; }
.tl-form-row { display: flex; gap: 8px; }
.tl-form-row .input { flex: 1; min-width: 0; }
.tl-date { flex: 0 0 auto; max-width: 150px; }
.tl-note { resize: vertical; }
.tl-submit { align-self: flex-start; }
.tl-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.tl-item { display: flex; flex-direction: column; gap: 3px; }
.tl-item-head { display: flex; align-items: center; gap: 8px; }
.tl-hours { font-weight: var(--w-bold); color: var(--ink-900); font-size: var(--text-sm); }
.tl-meta { font-size: var(--text-xs); color: var(--ink-500); }
.tl-note-text { font-size: var(--text-sm); color: var(--ink-700); line-height: 1.5; }
.tl-rm { background: none; border: 0; color: var(--ink-400); cursor: pointer; font-size: 12px; line-height: 1; padding: 2px 5px; border-radius: 50%; }
.tl-rm:hover { color: var(--pri-urgent); background: var(--pri-urgent-bg); }
.tl-actions { display: inline-flex; align-items: center; gap: 6px; }
.tl-approve { padding: 3px 12px; }
.tl-remaining { font-size: var(--text-xs); color: var(--ink-500); margin: 9px 0 2px; }

/* 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; }
/* Feature-access Marketing row: group the ⚙ cog + toggle to the right so the toggle sits flush-right
   like the other rows, and only show the cog when Marketing is enabled (matches the Prism mockup). */
.notify-row .nr-ctl { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.notify-row .nr-ctl .toggle { margin-left: 0; }
/* Feature-row settings cog — a clean, subtle icon-button (tidied #2590), not a heavy bordered button. */
.notify-row .mkt-cog { display: none; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; background: none; border: 0; border-radius: 8px; color: var(--ink-500); font-size: 15px; line-height: 1; cursor: pointer; transition: background .12s, color .12s; }
.notify-row .mkt-cog:hover { background: var(--surface-sunken); color: var(--ink-900); }
/* Show the row's cog whenever that feature's toggle is on (Marketing's `marketing`, SEO's `content`, …). */
.notify-row.mkt-row:has(input:checked) .mkt-cog { display: inline-flex; }

/* 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: var(--st-awaiting);
  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 used to carry a purple gradient accent bar on the left; removed per Philip's
   request to drop the "purple line" motif from the design — the 🔒 staff-tag is the marker now (#2477). */
.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; }
/* When a <form> wraps the body + footer (most write modals, e.g. Edit quote), it must carry the flex column
   itself — otherwise it overflows the clipped modal and the footer's Save buttons get cut off + unreachable
   on a tall modal. This makes the body scroll and the footer stay pinned. (#quote-save) */
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow: hidden; }

.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);
  flex: none; /* never shrink — keep the header full-height when the body scrolls */
}
.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); }
/* row-x: the small inline delete on list rows (SEO recommendations / blog posts, #2583). */
.row-x { background: none; border: 0; cursor: pointer; color: var(--ink-500); font-size: 15px; line-height: 1; padding: 4px 7px; border-radius: 7px; transition: background .12s, color .12s; }
.row-x:hover, .row-x:focus-visible { color: var(--danger); background: var(--pri-urgent-bg); outline: none; }
.modal-body { padding: var(--s-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-5); flex: 1 1 auto; min-height: 0; /* the only part that scrolls when the modal is taller than the viewport */ }
.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);
  flex: none; /* always pinned + visible — the action buttons must never be clipped */
}
.modal-foot .note { font-size: var(--text-xs); color: var(--ink-500); }

/* Email template "Preview & edit" modal (#2625): branded iframe preview + in-place editable copy blocks. */
.email-preview-frame {
  width: 100%; height: 360px; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: #eef0f6; flex: none;
}
.email-edit-fields { display: flex; flex-direction: column; gap: var(--s-2); }
.eef-label {
  font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  color: var(--ink-400); margin-top: var(--s-3);
}
.email-block {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 12px; font-size: var(--text-sm); line-height: 1.55; color: var(--ink-800);
  background: var(--surface); min-height: 38px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.email-block:focus { border-color: var(--indigo-400); box-shadow: 0 0 0 3px var(--indigo-100); }
.eef-subject {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 12px; font: inherit; font-size: var(--text-sm); color: var(--ink-800);
  background: var(--surface); outline: none;
}
.eef-subject:focus { border-color: var(--indigo-400); box-shadow: 0 0 0 3px var(--indigo-100); }
.email-block.is-btn {
  text-align: center; font-weight: 700; color: #fff; background: #23232d;
  border-color: #23232d; max-width: 280px; margin: 2px auto 0; border-radius: 10px;
}
.tok {
  display: inline-block; padding: 0 6px; margin: 0 1px; border-radius: 5px;
  background: var(--indigo-100); color: var(--indigo-700);
  font-size: .9em; font-weight: 700; white-space: nowrap; user-select: none;
}
.email-block.is-btn .tok { background: rgba(255,255,255,.22); color: #fff; }

/* 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-pill .up-name { color: var(--ink-700); text-decoration: none; }
.up-pill .up-name:hover { text-decoration: underline; }
.up-pill .up-del { display: inline-flex; margin: 0; }
.up-x { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-500); font-size: 14px; line-height: 1; cursor: pointer; padding: 0; transition: background .12s, color .12s; }
.up-x:hover, .up-x:focus-visible { background: var(--pri-urgent-bg, #fde8e8); color: var(--danger, #d33); outline: none; }
.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; }
/* Staff "Copy GPT prompt" tool in the reply composer. */
.tool-btn.gpt-btn { width: auto; height: 30px; padding: 0 9px; margin-left: 8px; opacity: 1; display: inline-flex; align-items: center; gap: 5px; color: var(--indigo-600); font-weight: var(--w-semibold); font-size: var(--text-sm); }
.tool-btn.gpt-btn:hover { background: color-mix(in srgb, var(--indigo-500) 10%, transparent); color: var(--indigo-700, var(--indigo-600)); }
.gpt-status { font-size: var(--text-xs); color: var(--st-open); font-weight: var(--w-medium); opacity: 0; transition: opacity .18s ease; white-space: nowrap; }
.gpt-status.is-show { opacity: 1; }
/* Crisp CSS dropdown / disclosure caret — replaces the U+2304 "⌄" glyph, which
   renders thin and mis-aligned across fonts. The .chev spans are empty; this draws
   them as two strokes (a square showing only its right + bottom edges, rotated 45°).
   Sized in em so it tracks the surrounding text; colour follows currentColor. */
.chev {
  display: inline-block;
  width: 0.46em;
  height: 0.46em;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-0.18em) rotate(45deg);
  flex: none;
}
.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; }
/* A closed dropdown is position:absolute and still extends its container's scrollable
   area. Inside the scrolling modal body that shows as a big blank gap below the content
   (e.g. the Assign-to menu at the foot of the staff new-ticket form). Collapse a closed
   menu to a zero footprint; the open state restores it. */
.modal-body .menu { max-height: 0; overflow: hidden; }
.modal-body .pop.is-open > .menu,
.modal-body .menu.is-open { max-height: none; overflow: visible; }
.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); }
/* data-hide-on-tab (e.g. the SEO summary stats hidden on the Search Console tab): the [hidden] attribute
   must beat a class that sets display:grid/flex, so make it authoritative for these elements. */
[data-hide-on-tab][hidden] { display: none !important; }
.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; }

/* Search Console (#2551): connect bar, search-position pill, content-opportunity cards. */
.gsc-conn { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gsc-g { width: 38px; height: 38px; border-radius: 11px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; flex: none; box-shadow: var(--sh-sm); }
.gsc-prop { font-family: var(--font-mono); font-weight: var(--w-semibold); color: var(--ink-900); overflow-wrap: anywhere; word-break: break-word; }
/* A real Search Console property is an unbreakable token (sc-domain:… / full URL) — let it wrap in the connect bar + Manage modal instead of overflowing at phone width (#2551). */
.detail-row .dv.mono { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.pos-pill { font-family: var(--font-mono); font-weight: var(--w-semibold); }
.opp { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.opp + .opp { margin-top: 10px; }
.opp-why { color: var(--ink-600); font-size: var(--text-sm); margin-top: 3px; line-height: 1.5; }
.opp-why b { color: var(--ink-900); }


/* =====================================================================
   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); }
.banner.success { background: linear-gradient(90deg, var(--st-open-bg), color-mix(in srgb, var(--st-open-bg) 40%, var(--surface))); border-color: var(--st-open-line); } /* #2874: shared green "locked-in / approved" banner */
.banner.success .bn-ico { background: #fff; color: var(--st-open); }

.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: var(--st-awaiting); }
.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; }
.toast.is-warn .tn-ico { background: var(--st-awaiting); }

/* Profile photo cropper (Settings) — drag to pan, slider to zoom; saves a square */
.cropper { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.crop-stage {
  position: relative; width: 260px; height: 260px; border-radius: var(--r-lg);
  overflow: hidden; background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--line);
  touch-action: none; cursor: grab; user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; -webkit-user-drag: none; }
/* circular guide so you can see how the round avatar will frame the square crop */
.crop-stage::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 9999px rgba(17,20,40,.40); pointer-events: none; }
.crop-zoom { width: 260px; accent-color: var(--indigo-500); }


/* =====================================================================
   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); }
/* The client Approve/Changes block when it sits at the bottom of the page chat thread (#approve-in-chat). */
.chat-decide { padding: var(--s-4); margin-top: var(--s-5); }
.chat-decide .approve-actions { margin-top: 0; }
.chat-decide .approve-actions .btn { white-space: nowrap; }
.approve-prompt { font-size: var(--text-sm); color: var(--ink-700); line-height: 1.45; margin-bottom: var(--s-3); }


/* =====================================================================
   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: var(--st-awaiting); }
.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; } .auth-form { min-width: 0; padding: var(--s-6) var(--s-4); } .auth-card { max-width: 100%; } }

/* 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; }


/* 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; }

/* =====================================================================
   RESPONSIVE FOUNDATION (#2451)
   ---------------------------------------------------------------------
   Whole-dashboard mobile/tablet support. Keep to these conventions as new
   areas are built ("we are doing this as we go along"):
     • Breakpoints — 1080px tablet (side rails drop), 860px mobile (sidebar
       becomes an off-canvas drawer; every grid goes single-column),
       540px phone (tighter padding + densest grids stacked).
     • Any NEW multi-column grid MUST be added to the "stack everything"
       rule below so it collapses on mobile.
     • The sidebar is an off-canvas drawer < 860px; the hamburger top bar
       and backdrop are injected by app.js (renderShell → setupMobileNav).
   Desktop is unchanged — every rule below is inside a max-width query,
   except the global safety nets, which only ever help narrow screens.
   ===================================================================== */

/* Global safety nets so new content is responsive by default. */
img, svg, video, canvas { max-width: 100%; }
/* min-width:0 lets these flex/grid children shrink below their content's min-content instead of forcing
   a horizontal page scroll. .detail-grid > * (the account page's content section + rail) was missing it,
   so a wide child (activity table) pushed the whole page past the viewport on mobile (#2475). */
.main-inner, .card, .trow, .modal, .composer, .detail-grid > *, .grid-2 > *, .grid-3 > * { min-width: 0; }

.mobile-bar, .sb-backdrop { display: none; }

/* The 7-column ticket row needs ~1200px of viewport once the fixed sidebar is taken out; below that it
   would crush the columns / overflow (the time + assignee column spilled past the card). Switch to the
   stacked card — subject on top, key meta wraps below — well before it gets cramped, not just on phones. */
@media (max-width: 1200px) {
  .trow {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 7px var(--s-3); padding: var(--s-4);
  }
  .trow > .subj { flex: 1 1 100%; order: -1; }
  .trow .req-name { display: none; }
  .trow > .updated { margin-left: auto; }
  .trow > .assignee, .trow > .view { display: none; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }

  /* Hamburger top bar (mobile only). */
  .mobile-bar {
    display: flex; align-items: center; gap: var(--s-3);
    position: sticky; top: 0; z-index: 90;
    padding: 9px var(--s-4);
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mobile-bar .sb-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; font-size: 19px; line-height: 1;
    background: var(--surface-sunken, #f1f2f6); border: 1px solid var(--line);
    border-radius: var(--r-md); color: var(--ink-800); cursor: pointer;
  }
  .mobile-bar .mb-logo { height: 22px; width: auto; }

  /* Sidebar becomes an off-canvas drawer. */
  .sidebar {
    position: fixed; left: 0; top: 0;
    width: min(84vw, 320px); height: 100vh; height: 100dvh;
    z-index: 120; transform: translateX(-100%);
    transition: transform .26s ease;
    box-shadow: 0 0 60px -10px rgba(11, 16, 32, .4);
  }
  .sidebar.is-open { transform: none; }

  .sb-backdrop {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(11, 16, 32, .45);
    opacity: 0; pointer-events: none; transition: opacity .26s ease;
  }
  .sb-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .main { padding: var(--s-5) var(--s-4) var(--s-7); }

  /* Stack every multi-column content layout (add new grids here). */
  .detail-grid,
  .grid-2, .grid-2.wide-rail, .grid-3,
  .settings-grid, .split, .form-row, .alert-metrics { grid-template-columns: 1fr; }

  /* Toolbars / filters / composer wrap or scroll — never overflow. Scrollable tab rows read cleanly:
     no visible scrollbar (touch devices auto-hide anyway) and a little trailing room so the last label
     isn't harshly flush-cut at the edge (#2475 usability pass). */
  .tabs, .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
  .tabs::-webkit-scrollbar, .segmented::-webkit-scrollbar { display: none; }
  .tabs { padding-right: var(--s-3); }
  .composer-bar { flex-wrap: wrap; }
  .detail-head .subject { font-size: var(--text-2xl, 1.6rem); }

  /* Domain table → label + action only. */
  .dom-thead { display: none; }
  .dom-row { grid-template-columns: 1fr auto; gap: var(--s-3); }

  /* Modals + floating UI fit a small screen. */
  .modal { width: 94vw; max-width: 94vw; }
  .presence-dock { right: 12px; bottom: 12px; }
  .toast-wrap { right: var(--s-4); left: var(--s-4); bottom: var(--s-4); }
}

@media (max-width: 540px) {
  .main { padding: var(--s-4) var(--s-3) var(--s-6); }
  .grid-3 { grid-template-columns: 1fr; }
  .detail-head .subject { font-size: var(--text-xl, 1.35rem); }
  .modal-foot { flex-wrap: wrap; }
}

/* =====================================================================
   MOBILE RE-AUDIT (#2451, round 2) — remaining overflow / cut-off fixes
   from a per-area audit (wide data tables, detail-header popovers,
   pagination, the enquiry stepper, ticket sub-line, attachment chips).
   Desktop is untouched — all inside max-width queries.
   ===================================================================== */
@media (max-width: 860px) {
  /* Detail-header popover menus (status / priority / requester / snooze) must not push past the edge. */
  .detail-controls .menu, .detail-meta .menu, .snooze-card .menu {
    min-width: 0; width: max-content; max-width: calc(100vw - var(--s-6)); overflow-x: hidden;
  }
  /* Wide data tables (Corsto staff, Billing ready/billed) scroll rather than widen the whole page. */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-card .dtable { min-width: 520px; }
  /* Pagination footer wraps instead of overflowing. */
  .list-footer { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .pager { flex-wrap: wrap; max-width: 100%; }
  /* Enquiry-form stepper wraps on small screens. */
  .stepper { flex-wrap: wrap; gap: var(--s-2) var(--s-3); }
  .stepper .step-sep { display: none; }
  .stepper .step { font-size: var(--text-xs); }
}

@media (max-width: 540px) {
  /* Ticket-row sub-line wraps (long client domains) instead of clipping. */
  .trow .subj-sub { white-space: normal; flex-wrap: wrap; row-gap: 2px; }
  /* Long attachment file names truncate inside the message bubble. */
  .attach { max-width: 100%; }
  .attach .file-meta { min-width: 0; }
  .attach .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* =====================================================================
   MODAL MOBILE-AUDIT (#2451, round 3) — verified modal / drawer / popover
   fixes from a per-modal audit. ROOT CAUSE of the reported "modals on
   mobile" breakage: modals capped their height with 100vh, which on a phone
   is the LARGEST (URL-bar-retracted) viewport — so a tall modal (New ticket,
   New task, Marketing settings, Edit user…) laid out taller than the VISIBLE
   area and pushed its sticky footer buttons (Cancel / Create / Save) below the
   browser chrome, unreachable. Switching the cap to dvh (the dynamic, visible
   viewport) lets the already-scrollable .modal-body scroll within reach.
   All mobile-only; desktop (>860px) untouched.
   ===================================================================== */
@media (max-width: 860px) {
  /* Cap modals to the DYNAMIC visible viewport + trim the overlay padding so a
     tall modal's header and footer stay on-screen; .modal-body scrolls inside. */
  .overlay { padding: var(--s-3); align-items: flex-start; }
  .modal {
    max-height: calc(100vh - var(--s-6));    /* fallback for browsers without dvh */
    max-height: calc(100dvh - var(--s-6));
  }
  .modal-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  /* Marketing settings drawer: let its body shrink + scroll (min-height:0) so the
     Save / Cancel footer stays visible instead of being clipped off the bottom. */
  #mktDrawer .drawer .modal-body { min-height: 0; overflow-y: auto; }
}

@media (max-width: 540px) {
  /* Ticket-detail header popovers (status / priority / requester) + the snooze
     menu: pin to the viewport so a menu opened from a right-side (wrapped) trigger
     can't run off the right edge; cap height so a tall menu stays scrollable. */
  .detail-controls .pop, .detail-meta .pop, .snooze-card .pop { position: static; }
  .detail-controls .menu, .detail-meta .menu, .snooze-card .menu {
    position: fixed; left: var(--s-3); right: var(--s-3); top: auto;
    min-width: 0; width: auto; max-width: none;
    max-height: 70dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
}

/* =====================================================================
   MOBILE DROPDOWNS / SETTINGS AUDIT (#2451, round 4) — verified fixes for
   the Settings profile header (long email overflowed the card), the domain
   members list (Edit/Remove squeezed the name+email to a few chars), and the
   New-ticket "Assign to" popover (its menu ran off the modal's right edge).
   All mobile-only @540; desktop untouched.
   ===================================================================== */
@media (max-width: 540px) {
  /* Settings > Profile header: wrap the avatar + identity + button row, let the
     identity column shrink, and break the long email so it can't widen the card. */
  .settings-grid .card.mb-5 .row.center { flex-wrap: wrap; }
  .settings-grid .card.mb-5 .row.center .grow { min-width: 0; flex: 1 1 60%; }
  .settings-grid .card.mb-5 .row.center .grow .subtitle { overflow-wrap: anywhere; word-break: break-word; }
  .settings-grid .card.mb-5 .row.center .btn { margin-left: auto; }

  /* Account members list: give the name/email the full width and drop the
     Edit / Remove buttons onto their own line so neither gets squeezed. */
  .notify-row:has(.acct-nr-actions) { flex-wrap: wrap; }
  .notify-row .acct-nr-actions {
    margin-left: calc(38px + var(--s-3)); /* align under the meta, past the 38px avatar */
    /* basis MUST subtract that left margin — flex-basis:100% + a left margin overflowed the row by the
       margin width (~50px), which cascaded into a whole-page horizontal scroll on the account page (#2475). */
    flex-basis: calc(100% - 38px - var(--s-3));
    min-width: 0;
    justify-content: flex-start;
    gap: var(--s-2);
  }

  /* New-ticket modal "Assign to" popover: the one select not on .pop.block, so its
     left:0 / 210px menu opened from a wrapped offset and ran off the modal's right
     edge. Make it block-level and pin the menu within the .staff-strip. */
  .staff-strip .pop { display: block; width: 100%; }
  .staff-strip .pop .select-display { width: 100%; }
  .staff-strip .pop > .menu { left: 0; right: 0; min-width: 0; width: auto; max-width: 100%; }
}

/* =====================================================================
   MOBILE ACCOUNT / DOMAIN PAGE (#2451, round 5) — the domain name used an
   inline font-size that defeated the responsive shrink, so a long domain
   stayed large and overflowed the header on a phone. It now shrinks + wraps
   (handled via .dom-name), and the header "Manage" dropdown is clamped.
   ===================================================================== */
@media (max-width: 860px) {
  .detail-head .menu { max-width: calc(100vw - var(--s-6)); }
}
@media (max-width: 540px) {
  .detail-head .subject.dom-name { font-size: var(--text-xl); }
}

/* =====================================================================
   MOBILE TICKET-DETAIL HEADER (#2451, round 6) — the requester / assignee /
   Reassign / Delete band was cramped on a phone, and round 3's header menus
   used `top:auto` with no anchor so an opened dropdown could land OVER the
   top content. Fix: drop the staff-controls group onto its own line, and
   anchor those header menus to the bottom (a defined position, on-screen).
   ===================================================================== */
@media (max-width: 540px) {
  /* Meta reads cleanly on a phone — items wrap with even spacing and NO dangling
     "·" separators (which used to hang at the end of a wrapped line), and the staff
     controls (assignee · Reassign · Delete) sit on their own tidy left-aligned row
     instead of one orphaned, stretched button (#2475). */
  .detail-meta { flex-wrap: wrap; column-gap: var(--s-3); row-gap: 6px; align-items: center; }
  .detail-meta .dot-sep { display: none; }
  .detail-meta .ml-auto { margin: var(--s-2) 0 0; flex-basis: 100%;
    display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end;
    border-top: 1px solid var(--line-soft); padding-top: var(--s-3); }
  /* Anchor the header dropdowns to the bottom so they never sit over the top content. */
  .detail-controls .menu, .detail-meta .menu, .snooze-card .menu {
    bottom: var(--s-3); box-shadow: 0 -10px 40px -10px rgba(11, 16, 32, .35);
  }
}

/* Button loading state (#2463) — a minimal spinner shown while a form submits, so it's
   clear something is happening. Uses currentColor so it suits every button variant. */
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading::before {
  content: ""; display: inline-block; width: 13px; height: 13px;
  margin-right: 7px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: cgsspin .6s linear infinite;
}
@keyframes cgsspin { to { transform: rotate(360deg); } }

/* Settings sub-nav → a horizontal, scrollable tab strip on mobile (#2451). On a phone the
   224px vertical sticky list covered content and pushed the panes far down; now it's a tab bar. */
@media (max-width: 860px) {
  .subnav {
    flex-direction: row; position: static; top: auto;
    gap: var(--s-2); overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: 0 0 var(--s-4); padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--line);
  }
  .subnav .sn-item { white-space: nowrap; flex: 0 0 auto; }
}

/* ===== SHARED MOBILE PATTERN (approved mobile style) — tab strips & subnavs become tidy segmented
   controls at phone width, so they read consistently across every area (#2504). ===== */
@media (max-width: 540px) {
  .subnav { background: var(--surface-sunken); border-radius: var(--r-md); padding: 5px; gap: 4px; border-bottom: 0; }
  .subnav .sn-item { border-radius: var(--r-sm); padding: 9px 13px; font-weight: var(--w-semibold); white-space: nowrap; }
  .subnav .sn-item.is-active { background: var(--surface); color: var(--ink-900); box-shadow: var(--sh-xs); }
  .mtabs { display: flex; width: 100%; flex-wrap: nowrap; }
  .mtabs .mtab { flex: 1 1 0; justify-content: center; padding-left: 8px; padding-right: 8px; }
  /* Tickets toolbar: the search goes full-width and the status filter becomes a full-width,
     scrollable segmented strip beneath it (matches the approved mobile design). */
  .toolbar { flex-direction: column; align-items: stretch; gap: var(--s-3); }
  .toolbar .search { width: 100%; }
  .toolbar .tabs { margin-left: 0; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .toolbar .tabs .tab { flex: 0 0 auto; }
  /* Mobile declutter (approved mockups, Philip 2026-06-19): drop controls that duplicate other UI.
     Tickets — the All/Assigned-to-me scope is covered by the assignee avatars below it.
     Accounts — the All/Live/Pending status filter (its .tab[data-filter] form) is desktop-only;
     on mobile the search finds domains and the "Domains N" tab shows the total. */
  .staff-strip .segmented { display: none; }
  .staff-strip .assignee-filter.ml-auto { margin-left: 0; }
  .toolbar .tabs:has(.tab[data-filter]) { display: none; }
}

/* =====================================================================
   MOBILE DATA TABLES (#2475) — on a phone, the wide data tables used to
   scroll sideways inside their card, which clipped the last column (the
   account ledger's "Balance", the Billing "Amount"/"Reference") off the
   edge — it read as broken / "not mobile friendly". Below ≤540px each row
   now STACKS into a label-and-value card so nothing is cut off and there
   is no horizontal scrolling. Every <td> carries a data-label (its column
   name); it's shown to the left of the value. Covers the Billing tables,
   the Corsto-staff list and the support-hours ledger. Desktop + tablet
   keep the normal table — this block is phones only.
   ===================================================================== */
@media (max-width: 540px) {
  /* drop the horizontal-scroll-in-card; the stacked layout already fits */
  .table-card { overflow-x: visible; }
  .table-card .dtable { min-width: 0; }
  .ledger-wrap { overflow-x: visible; }

  .dtable, .ledger, .dtable tbody, .dtable tfoot, .ledger tbody, .ledger tfoot { display: block; width: auto; }
  .dtable thead, .ledger thead { display: none; }       /* labels move into each cell */

  .dtable tbody tr, .ledger tbody tr {
    display: block; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 2px var(--s-3); margin-bottom: var(--s-3);
  }
  .dtable tbody tr:hover td, .ledger tbody tr:hover td { background: transparent; }

  .dtable tbody td, .ledger tbody td {
    display: block; width: auto; min-width: 0;
    text-align: right; white-space: normal;
    padding: 8px 0; border: 0; border-bottom: 1px solid var(--line-soft);
    font-family: var(--font-sans);
  }
  .dtable tbody tr td:last-child, .ledger tbody tr td:last-child { border-bottom: 0; }

  /* the column name, floated to the left of the value (classic responsive-table pattern) */
  .dtable tbody td::before, .ledger tbody td::before {
    content: attr(data-label); float: left; margin-right: var(--s-4);
    text-align: left; text-transform: none; letter-spacing: 0;
    font-weight: var(--w-semibold); color: var(--ink-500); font-size: var(--text-xs);
  }
  .ledger tbody td:not(.lead) { font-family: var(--font-mono); }   /* keep numerics monospaced */

  /* an action / label-less cell → a full-width button, no label */
  .dtable tbody td[data-label=""]::before, .ledger tbody td[data-label=""]::before { content: ""; float: none; margin: 0; }
  .dtable tbody td[data-label=""], .ledger tbody td[data-label=""] { text-align: left; }
  .dtable tbody td[data-label=""] .btn, .ledger tbody td[data-label=""] .btn { width: 100%; }

  /* totals row (tfoot) stacks too — as a highlighted summary block so it never overflows (#2504) */
  .dtable tfoot tr, .ledger tfoot tr { display: block; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 2px var(--s-3); margin-top: var(--s-3); }
  .dtable tfoot td, .ledger tfoot td { display: block; width: auto; min-width: 0; text-align: right; white-space: normal; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line-soft); font-family: var(--font-sans); }
  .dtable tfoot td:last-child, .ledger tfoot td:last-child { border-bottom: 0; }
  .dtable tfoot td::before, .ledger tfoot td::before { content: attr(data-label); float: left; margin-right: var(--s-4); text-align: left; font-weight: var(--w-semibold); color: var(--ink-500); font-size: var(--text-xs); }
  .dtable tfoot td:first-child, .ledger tfoot td:first-child { text-align: left; font-weight: var(--w-bold); color: var(--ink-900); border-bottom: 1px solid var(--line); padding-bottom: 7px; }
  .dtable tfoot td:first-child::before, .ledger tfoot td:first-child::before { content: ""; float: none; margin: 0; }

  /* Marketing tables: the first cell (the Month) reads as the card's HEADING — left-aligned + bold with a
     divider — instead of a stranded right-aligned value at the top of each stacked card (#2504). */
  .mk-perf tbody td:first-child { text-align: left; font-weight: var(--w-bold); color: var(--ink-900); font-size: var(--text-sm); border-bottom: 1px solid var(--line); padding: 6px 0 8px; margin-bottom: 2px; }
  .mk-perf tbody td:first-child::before { content: ""; float: none; margin: 0; }
}

/* =====================================================================
   MOBILE ACCOUNTS LIST + WEB-APP BANNER (#2491, #2493) — Philip: the
   accounts list and the Web-app "Install" card looked untidy/cramped on a
   phone. Each account row now lays out as a clean 2×2 block (domain · status
   on top, people · hours below; the → affordance is dropped since the whole
   row is tappable), and the install banner wraps so its button + hint stack
   under the text instead of being squeezed into a narrow column.
   ===================================================================== */
@media (max-width: 540px) {
  .dom-row {
    display: flex; flex-wrap: wrap; align-items: center;
    column-gap: var(--s-3); row-gap: 9px; padding: var(--s-4);
  }
  .dom-row .dom { flex: 1 1 100%; }                       /* domain identity on its own line */
  .dom-row .dom-name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .dom-row .view { display: none; }                       /* whole row is tappable */
  .dom-row .avatar-stack + span { margin-left: auto; }    /* hours pushed to the right of line 2 */

  .banner { flex-wrap: wrap; align-items: center; row-gap: var(--s-3); }
  .banner .bn-text { flex: 1 1 60%; min-width: 0; }                              /* icon + text share line 1 */
  .banner .bn-act { order: 3; flex: 0 0 100%; margin-left: 0; }                   /* CTA on its own full-width line */
  .banner [data-pwa-hint], .banner [data-pwa-installed] { order: 4; flex: 1 1 100%; }
}

/* =====================================================================
   MARKETING AREA (Option B — "at a glance") — ported verbatim from the
   approved mockup prism/marketing-b.html <style> block. Drives templates/
   area-marketing.php: the hero, four result cards, year-on-year charts,
   the monthly Performance/Submit tabs, the By-channel tabs and the staff
   Billing tabs. Nothing here existed in system.css before this banner.
   ===================================================================== */
.mk-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: var(--s-6); align-items: center; padding: var(--s-6); position: relative; overflow: hidden; }
.mk-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--indigo-500) 8%, transparent), transparent 60%); pointer-events: none; }
.mk-hero .eyebrow { color: var(--indigo-600); }
.mk-hero-num { font-size: 3.1rem; font-weight: var(--w-black); line-height: 1; color: var(--ink-900); letter-spacing: -1.5px; margin: 6px 0 10px; }
.mk-hero-sub { font-size: var(--text-md); color: var(--ink-600); }
.mk-hero-sub b { color: var(--ink-900); }
.mk-hero-canvas { position: relative; height: 160px; }
.roi-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 14px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--st-open) 14%, transparent); color: var(--st-open); font-weight: var(--w-bold); font-size: var(--text-sm); }

.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--s-4); }
.result-card { padding: var(--s-5); display: flex; flex-direction: column; gap: 2px; }
.result-card .rc-num { font-size: var(--text-2xl); font-weight: var(--w-black); color: var(--ink-900); line-height: 1.1; letter-spacing: -.5px; }
.result-card .rc-spark { position: relative; height: 42px; margin-top: 10px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: var(--w-bold); }
.delta.up { color: var(--st-open); } .delta.down { color: var(--pri-urgent); }
.delta.muted-good { color: var(--st-open); }

.mk-charts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--s-5); }
.mk-chart-canvas { position: relative; height: 290px; margin-top: 6px; }

.perf-bar { display: inline-block; height: 7px; border-radius: var(--r-pill); background: var(--grad-brand); vertical-align: middle; margin-left: 8px; min-width: 4px; }
.cos-pill { display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: var(--w-bold); }
.cos-good { background: color-mix(in srgb, var(--st-open) 15%, transparent); color: var(--st-open); }
.cos-warn { background: color-mix(in srgb, var(--pri-high) 16%, transparent); color: var(--pri-high); }

/* Monthly performance table (#2472) — tells the same story as the hero: a clean comparable
   sales bar, a Return (sales ÷ spend) column, and the best month called out. */
.mk-perf td, .mk-perf th { vertical-align: middle; }
.mk-perf .gs { display: block; width: 132px; margin-left: auto; }
.mk-perf .gs-fig { display: block; text-align: right; font-variant-numeric: tabular-nums; }
.mk-perf .gs-track { display: block; height: 5px; margin-top: 5px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.mk-perf .gs-fill { display: block; height: 100%; width: var(--w, 0%); border-radius: var(--r-pill); background: var(--grad-brand); }
.mk-perf .roas { font-weight: var(--w-bold); color: var(--indigo-600); font-variant-numeric: tabular-nums; }
.mk-perf .roas-hi { color: var(--st-open); }
.mk-perf .row-best td { background: color-mix(in srgb, var(--indigo-500) 6%, transparent); }
.mk-perf .row-best td:first-child { box-shadow: inset 3px 0 0 var(--indigo-500); }
.mk-perf .best-tag { display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: var(--r-pill); font-size: 10px; font-weight: var(--w-bold); text-transform: uppercase; letter-spacing: .04em; background: var(--grad-brand); color: #fff; vertical-align: middle; }

/* pane tabs (Performance/Submit, Google/Facebook/Bing) */
.mtabs { display: inline-flex; gap: 4px; padding: 5px; background: var(--surface-sunken, #f1f2f6); border-radius: var(--r-md); flex-wrap: wrap; }
.mtab { border: 0; background: transparent; padding: 9px 16px; border-radius: var(--r-sm); font: inherit; font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--ink-600); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.mtab.is-active { background: var(--surface); color: var(--ink-900); box-shadow: var(--sh-xs); }
/* CTA tab (e.g. "Submit your numbers") — solid brand purple so it clearly stands out as the place to act. */
.mtab.mtab-cta { color: #fff; background: var(--grad-brand); box-shadow: var(--sh-xs); }
.mtab.mtab-cta .ico, .mtab.mtab-cta svg { color: #fff; }
.mtab.mtab-cta:hover { filter: brightness(1.06); }
.mtab.mtab-cta.is-active { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-glow); }
.mpane { display: none; }
.mpane.is-active { display: block; }
/* AI Monthly reports list (in the hero, replacing the sales-trend chart) + reader modal (#2501). */
.rec-admin { font-size: var(--text-xs); color: var(--ink-500); display: inline-flex; align-items: center; gap: 6px; }
.rec-vis { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.rec-vis input { margin: 0; cursor: pointer; }
/* The list must fit the same footprint the sales-trend chart used (~160px) — cap height + scroll. */
.rec-list { display: flex; flex-direction: column; gap: 6px; max-height: 168px; overflow-y: auto; padding-right: 4px; }
.rec-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 8px 12px; cursor: pointer; font: inherit; transition: border-color .12s, transform .12s, box-shadow .12s; }
.rec-item:hover { border-color: color-mix(in srgb, #6d5cff 40%, var(--line)); box-shadow: var(--sh-xs); transform: translateX(2px); }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rec-title { font-weight: var(--w-semibold); color: var(--ink-900); font-size: var(--text-sm); }
.rec-sum { font-size: var(--text-xs); color: var(--ink-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-count { font-size: var(--text-xs); font-weight: var(--w-semibold); color: var(--indigo-600); background: color-mix(in srgb, #6d5cff 12%, transparent); padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.rec-chev { color: var(--ink-400); font-size: var(--text-lg); }
.rec-modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(11,16,32,.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.rec-modal-overlay[hidden] { display: none; }
.rec-modal { background: var(--surface); border-radius: var(--r-lg); width: min(640px, 100%); max-height: 86vh; display: flex; flex-direction: column; box-shadow: var(--sh-lg, 0 24px 60px rgba(11,16,32,.28)); }
.rec-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.rec-modal-month { font-size: var(--text-lg); font-weight: var(--w-black); color: var(--ink-900); }
.rec-modal-x { border: 0; background: none; font-size: var(--text-lg); color: var(--ink-500); cursor: pointer; line-height: 1; }
.rec-modal-body { padding: 18px 20px; overflow-y: auto; line-height: 1.6; color: var(--ink-700); }
.rec-modal-recs { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.rec-modal-recs-h { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; font-weight: var(--w-semibold); color: var(--ink-500); }
.rec-modal-rec { border-left: 3px solid var(--indigo-500, #6d5cff); padding: 2px 0 2px 12px; }
.rec-modal-rec-t { font-weight: var(--w-semibold); color: var(--ink-900); }
.rec-modal-rec-d { font-size: var(--text-sm); color: var(--ink-600); }
.rec-modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
/* Admin edit fields inside the report modal */
.rec-edit-label { display: block; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; font-weight: var(--w-semibold); color: var(--ink-500); margin: 12px 0 5px; }
.rec-edit-label:first-child { margin-top: 0; }
.rec-edit-input { width: 100%; 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); }
.rec-edit-input:focus { outline: none; border-color: var(--indigo-500, #6d5cff); }
.rec-edit-summary, .rec-edit-detail { resize: vertical; line-height: 1.5; }
.rec-edit-rec { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.rec-edit-rec-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rec-rec-x { border: 0; background: none; color: var(--ink-400); font-size: var(--text-lg); cursor: pointer; line-height: 1; padding: 4px 2px; flex: none; }
.rec-rec-x:hover { color: var(--danger, #e5484d); }
/* Hero list: admin-only (unreleased) reports read dimmer + a small tag */
.rec-hidden { opacity: .7; }
.rec-hidden-tag { font-size: 10px; font-weight: var(--w-semibold); color: var(--ink-400); background: var(--surface-sunken, #f1f2f6); padding: 1px 6px; border-radius: var(--r-pill); margin-left: 6px; text-transform: uppercase; letter-spacing: .03em; }
.rec-rerun-tag { font-size: 10px; font-weight: var(--w-semibold); color: #92400e; background: #fde68a; padding: 1px 6px; border-radius: var(--r-pill); margin-left: 6px; letter-spacing: .02em; }
/* The month's headline stats inside the report modal — a neat tile grid (read-only, both staff + client). */
.rec-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 18px; }
.rec-stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface-sunken, #f6f7fb); }
.rec-stat-v { font-size: var(--text-lg); font-weight: var(--w-bold); color: var(--ink-900); letter-spacing: -.3px; line-height: 1.15; }
.rec-stat-l { font-size: 10px; color: var(--ink-500); margin-top: 3px; text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 540px) { .rec-stats { grid-template-columns: repeat(2, 1fr); } }

/* ============ MONTHLY REPORT — proper report layout (modal + PDF), signed off in prism/marketing-report.html (#2501) ============ */
.rp-modal { width: 640px; max-width: calc(100vw - 36px); max-height: calc(100vh - 48px); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-lg, 0 24px 60px -22px rgba(11,16,32,.30)); overflow: auto; display: flex; flex-direction: column; }
.rp-cover { position: relative; padding: 26px 30px 22px; border-bottom: 1px solid var(--line); }
.rp-eyebrow { font-size: 11px; font-weight: var(--w-bold); text-transform: uppercase; letter-spacing: .14em; color: var(--indigo-600); display: flex; align-items: center; gap: 10px; }
.rp-title { font-size: 30px; font-weight: var(--w-black); letter-spacing: -1px; line-height: 1.05; margin: 7px 0 6px; color: var(--ink-900); }
.rp-sub { font-size: 15px; color: var(--ink-700, #3a3f57); }
.rp-sub b { color: var(--ink-900); }
.rp-meta { font-size: 12px; color: var(--ink-500); margin-top: 9px; }
.rp-x { position: absolute; top: 20px; right: 22px; border: 0; background: var(--surface-sunken); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--ink-600); font-size: 15px; }
.rp-body { padding: 24px 30px 8px; }
.rp-section { margin-bottom: 26px; }
.rp-section-label { font-size: 11px; font-weight: var(--w-bold); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-500); margin: 0 0 13px; display: flex; align-items: center; gap: 10px; }
.rp-section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.rp-headline { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; background: linear-gradient(120deg, #f6f4ff, #fdf3ff); border: 1px solid #ece8ff; border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 11px; }
.rp-headline .hl-l .k { font-size: 11px; font-weight: var(--w-bold); text-transform: uppercase; letter-spacing: .08em; color: var(--indigo-600); }
.rp-headline .hl-l .v { font-size: 38px; font-weight: var(--w-black); letter-spacing: -1.4px; line-height: 1; margin: 5px 0 4px; color: var(--ink-900); }
.rp-headline .hl-l .s { font-size: 13px; color: var(--ink-600); }
.rp-headline .hl-l .s b { color: var(--ink-900); }
.rp-chip { display: inline-flex; align-items: center; gap: 6px; background: #e7f7ef; color: #0aa86f; font-size: 12px; font-weight: var(--w-bold); padding: 6px 12px; border-radius:var(--r-pill); white-space: nowrap; }
.rp-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rp-kpi { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); }
.rp-kpi .v { font-size: 21px; font-weight: var(--w-bold); letter-spacing: -.4px; color: var(--ink-900); line-height: 1.1; }
.rp-kpi .l { font-size: 10.5px; font-weight: var(--w-semibold); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); margin-top: 4px; }
.rp-lead { font-size: 15px; line-height: 1.72; color: var(--ink-700, #3a3f57); margin: 0 0 11px; }
.rp-lead:last-child { margin-bottom: 0; }
.rp-lead b { color: var(--ink-900); }
.rp-recs { display: flex; flex-direction: column; gap: 11px; }
.rp-rec { display: flex; gap: 13px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; background: var(--surface); }
.rp-rec .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--grad-brand); color: #fff; font-weight: var(--w-bold); font-size: 13px; display: grid; place-items: center; margin-top: 1px; }
.rp-rec .t { font-size: 14.5px; font-weight: var(--w-bold); color: var(--ink-900); }
.rp-rec .d { font-size: 13.5px; color: var(--ink-600); margin-top: 3px; line-height: 1.55; }
.rp-foot { display: flex; align-items: center; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--line); background: #fcfcfe; flex-wrap: wrap; }
.rp-foot .spacer { flex: 1; }
.rp-admin-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: var(--w-bold); color: #b06b00; background: #fdeccd; padding: 4px 10px; border-radius:var(--r-pill); text-transform: none; letter-spacing: 0; }
.rp-vis { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-700, #3a3f57); }
.rp-vis input { accent-color: var(--indigo-600); width: 15px; height: 15px; }
/* admin edit fields */
.rp-field-label { display: block; font-size: 11px; font-weight: var(--w-bold); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); margin: 0 0 6px; }
.rp-input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm, 10px); padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink-900); background: var(--surface); }
.rp-input:focus { outline: none; border-color: var(--indigo-500); box-shadow: 0 0 0 3px rgba(109,92,255,.14); }
textarea.rp-input { resize: vertical; line-height: 1.5; }
.rp-edit-rec { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 9px; }
.rp-edit-rec .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-sunken); color: var(--ink-600); font-weight: var(--w-bold); font-size: 13px; display: grid; place-items: center; margin-top: 7px; }
.rp-edit-rec .fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rp-rm { border: 0; background: none; color: var(--ink-500); font-size: 18px; cursor: pointer; padding: 6px 2px; flex: none; }
.rp-rm:hover { color: var(--danger, #e5484d); }
.rp-add-rec { font-size: 13px; font-weight: var(--w-semibold); color: var(--indigo-600); background: none; border: 1px dashed #d8d4ff; border-radius: 10px; padding: 9px; width: 100%; cursor: pointer; margin-top: 2px; }
@media (max-width: 540px) { .rp-kpis { grid-template-columns: repeat(2, 1fr); } .rp-title { font-size: 25px; } .rp-cover, .rp-body { padding-left: 18px; padding-right: 18px; } }
/* Billing "Invoiced" tick box (#2472) — a simple checkbox in place of the old dropdown. */
.mk-perf th.inv-col, .mk-perf td.inv-col { text-align: left; }
.inv-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--text-sm); color: var(--ink-400); white-space: nowrap; }
.inv-check input { width: 17px; height: 17px; accent-color: var(--st-open); cursor: pointer; flex: none; margin: 0; }
.inv-check input:checked + span { color: var(--st-open); font-weight: var(--w-semibold); }
/* Table totals (YTD) row — a clear, heavier summary so it reads as a total, not another data row (#2472).
   The last body row drops its divider so the total's top border is the only separator. */
.mk-perf tbody tr:last-child td { border-bottom: 0; }
.mk-perf tfoot td { border-top: 2px solid var(--line-strong); background: var(--surface-sunken, #f1f2f9); padding: 15px var(--s-3); font-size: var(--text-md); font-weight: var(--w-bold); color: var(--ink-900); }
/* "YTD" cell → a clear pill label; hide the raw text with font-size:0 and show the pill via ::before. */
.mk-perf tfoot td:first-child { font-size: 0; border-bottom-left-radius: var(--r-md); }
.mk-perf tfoot td:first-child::before { content: "Year to date"; display: inline-block; font-size: 10px; font-weight: var(--w-bold); letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--grad-brand); padding: 4px 10px; border-radius: var(--r-pill); box-shadow: var(--sh-glow); }
.mk-perf tfoot td:last-child { border-bottom-right-radius: var(--r-md); }
/* Billing table matches the By channel layout: Month left, data right-aligned, balanced widths (#2472). */
.bill-table { table-layout: fixed; }
.bill-table th:nth-child(1), .bill-table td:nth-child(1) { width: 16%; }
.bill-table th:nth-child(2), .bill-table td:nth-child(2) { width: 28%; }
.bill-table th:nth-child(3), .bill-table td:nth-child(3) { width: 28%; }
.bill-table th:nth-child(4), .bill-table td:nth-child(4) { width: 28%; }
.bill-table td.inv-col, .bill-table th.inv-col { text-align: right; }
.bill-table .inv-check { justify-content: flex-end; }
.ch-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cell-input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; font: inherit; font-size: var(--text-sm); color: var(--ink-900); background: var(--surface); }
.cell-input::placeholder { color: var(--ink-400); }
.cell-input:focus { outline: none; border-color: var(--indigo-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo-500) 14%, transparent); }
@media (max-width: 1000px) { .mk-hero { grid-template-columns: 1fr; min-width: 0; } .mk-hero > * { min-width: 0; } .result-grid { grid-template-columns: repeat(2, 1fr); } .mk-charts { grid-template-columns: 1fr; } }
/* phone: the hero number wraps long values + the reports list/items shrink rather than clip (#2504) */
@media (max-width: 540px) {
  .mk-hero { padding: var(--s-5); }
  .mk-hero-num { font-size: 2.4rem; letter-spacing: -1px; overflow-wrap: anywhere; }
  .rec-list, .rec-item, .rec-main, .rec-title, .rec-sum { min-width: 0; }
  .rec-title, .rec-sum { white-space: normal; overflow-wrap: anywhere; }
}

/* =====================================================================
   PROJECTS — the website-project flow (Sitemap → Quote → Project build).
   Ported from prism/project-sitemap.html, project-quote.html and
   project-builder-4a.html. New components; reuse existing tokens. The tree
   row is scoped under .b-tree so it never clashes with the ticket .trow.
   ===================================================================== */
.main.builder { padding: var(--s-5) var(--s-6) var(--s-7); }
.builder .main-inner { max-width: 1360px; }
.proj-narrow { max-width: 1120px; margin: 0 auto; } /* unified project-stage width (sitemap/quote); builder stays full (#2815) */

.stageflow { display:flex; align-items:center; gap:0; flex-wrap:wrap; margin-bottom:var(--s-5); }
.stageflow .stage { display:inline-flex; align-items:center; gap:8px; padding:7px 14px; border-radius:var(--r-pill); font-size:var(--text-sm); font-weight:var(--w-semibold); color:var(--ink-500); background:var(--surface); border:1px solid var(--line); box-shadow:var(--sh-xs); transition:background .14s,color .14s,border-color .14s; }
.stageflow a.stage:hover { border-color:var(--line-strong); color:var(--ink-800); }
.stageflow .sdot { width:20px; height:20px; border-radius:50%; display:grid; place-items:center; font-size:11px; font-weight:var(--w-bold); background:var(--surface-sunken); color:var(--ink-500); }
.stageflow .stage.done { color:var(--indigo-600); border-color:#e0dcff; background:var(--indigo-50); }
.stageflow .stage.done .sdot { background:var(--grad-brand); color:#fff; }
/* the stage you're ON — a bold brand-filled pill so it's unmistakable, even when that stage is also locked (#2819) */
.stageflow .stage.cur { color:#fff; border-color:transparent; background:var(--grad-brand); box-shadow:var(--sh-sm); font-weight:var(--w-bold); }
.stageflow .stage.cur .sdot { background:rgba(255,255,255,.26); color:#fff; box-shadow:none; }
/* A locked-in input stage (sitemap/features/assets) — green, with a 🔒 in the dot, so it's clear at a glance. */
.stageflow .stage.is-locked { color:var(--st-open); border-color:#bfe9d4; background:var(--st-open-bg); }
.stageflow .stage.is-locked .sdot { background:var(--st-open); color:#fff; font-size:10px; }
/* current AND locked → keep the bold brand pill (it wins over the green) so "you are here" stays obvious */
.stageflow .stage.cur.is-locked { color:#fff; border-color:transparent; background:var(--grad-brand); box-shadow:var(--sh-sm); }
.stageflow .stage.cur.is-locked .sdot { background:rgba(255,255,255,.26); color:#fff; font-size:10px; }
/* #2838: once the quote is approved the done input/quote steps collapse to just their icon (the project build is the focus) */
.stageflow .stage.collapsed { padding:7px; gap:0; }
.stageflow .stage.collapsed .sdot { width:18px; height:18px; }
.stageflow .sline { width:26px; height:2px; background:var(--line-strong); margin:0 3px; border-radius:2px; }
.stageflow .sline.done { background:var(--grad-brand); }
body.builder-fs .stageflow { display:none; }

.pane { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--sh-sm); }
.pane-head { display:flex; align-items:center; gap:var(--s-2); padding:14px var(--s-5); border-bottom:1px solid var(--line); }
.pane-head h3 { font-size:var(--text-md); font-weight:var(--w-bold); }
.pane-head .ct { margin-left:auto; font-size:var(--text-xs); font-weight:var(--w-bold); color:var(--ink-400); }
.ctrl { padding:var(--s-5); }
.ctrl h4 { font-size:var(--text-xs); font-weight:var(--w-bold); letter-spacing:.04em; text-transform:uppercase; color:var(--ink-500); margin-bottom:12px; display:flex; align-items:center; gap:7px; }

.plan-grid { display:grid; grid-template-columns: minmax(0,1fr) 332px; gap: var(--s-5); align-items:start; }
.plan-rail { position:sticky; top:var(--s-6); display:flex; flex-direction:column; gap:var(--s-4); }
.smlist { padding: var(--s-4) var(--s-5) var(--s-5); }
.smgroup-label { font-size:10px; font-weight:var(--w-bold); letter-spacing:.08em; text-transform:uppercase; color:var(--ink-400); margin:var(--s-3) 0 var(--s-2); }
.smrow { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); margin-bottom:8px; box-shadow:var(--sh-xs); transition:border-color .14s, box-shadow .14s; }
.smrow:hover { border-color:var(--line-strong); }
.smrow.sm-dragging { opacity:.5; box-shadow:var(--sh-md); cursor:grabbing; }
.drag { cursor:grab; color:var(--ink-400); font-size:14px; flex:none; }
.sm-name { border:0; background:transparent; font-weight:var(--w-semibold); font-size:var(--text-md); color:var(--ink-900); flex:1; min-width:0; padding:5px 8px; border-radius:7px; transition:background .12s, box-shadow .12s; }
.sm-name:hover { background:var(--surface-sunken); }
.sm-name:focus { outline:none; background:var(--surface-sunken); box-shadow:0 0 0 2px var(--ring); }
.sm-path { font-family:var(--font-mono); font-size:12px; color:var(--ink-400); flex:none; white-space:nowrap; }
.sm-actions { display:inline-flex; align-items:center; gap:4px; flex:none; }
.sm-mini { width:30px; height:30px; border-radius:var(--r-sm); border:0; background:transparent; color:var(--ink-400); cursor:pointer; font-size:14px; display:grid; place-items:center; transition:background .12s, color .12s; }
.sm-mini:hover { background:var(--surface-sunken); color:var(--ink-800); }
.sm-mini.del:hover { background:var(--pri-urgent-bg); color:var(--pri-urgent); }
.smchildren { margin-left:28px; padding-left:16px; border-left:1px solid var(--line-strong); }
.adder { display:flex; gap:10px; align-items:center; margin-top:6px; }
.adder .input { flex:1; }
.sugg { display:flex; flex-wrap:wrap; gap:8px; }
.sugg .chip { cursor:pointer; }
.sugg .chip:hover { box-shadow:var(--sh-xs); }
.big-count { font-size:var(--text-4xl); font-weight:var(--w-black); letter-spacing:-.03em; line-height:1; color:var(--ink-900); }

.tstate { width:9px; height:9px; border-radius:50%; flex:none; background:var(--st-new); box-shadow:0 0 0 3px var(--st-new-bg); }
.st-done { background:var(--st-open); box-shadow:0 0 0 3px var(--st-open-bg); }
.st-build { background:var(--st-progress); box-shadow:0 0 0 3px var(--st-progress-bg); }
.st-you { background:var(--st-awaiting); box-shadow:0 0 0 3px var(--st-awaiting-bg); }

.locked-banner { display:none; }
.smap.is-locked .locked-banner { display:flex; }
.smap.is-locked .sm-edit { display:none !important; }
.smap.is-locked .adder { display:none; }
.smap.is-locked .sm-name { pointer-events:none; color:var(--ink-800); }
.smap.is-locked .smrow { background:var(--surface-2); }
.smap.is-locked .lock-cta { display:none; }
.locked-only { display:none; }
.smap.is-locked .locked-only { display:block; }

.quote-grid { display:grid; grid-template-columns: minmax(0,1fr) 340px; gap: var(--s-5); align-items:start; }
.q-rail { position:sticky; top:var(--s-6); display:flex; flex-direction:column; gap:var(--s-4); }
.total-amount { display:flex; align-items:baseline; gap:6px; font-weight:var(--w-black); letter-spacing:-.02em; }
.total-amount .cur { font-size:var(--text-xl); color:var(--ink-500); font-weight:var(--w-bold); }
.total-amount .num { font-size:var(--text-4xl); color:var(--ink-900); }
.total-amount .vat { font-size:var(--text-xs); color:var(--ink-500); font-weight:var(--w-medium); }

/* ===== Quote document sheet (the fancy printable quote — prism/project-quote.html) ===== */
/* Quote document — matches quote-design-mockup.html (#2819) */
.qdoc { background:#fff; border:1px solid var(--line); border-radius:24px; box-shadow:var(--sh-md); overflow:hidden; position:relative; }
.qdoc-accent { display:none; }
.qdoc-inner { padding:34px 46px 40px; position:relative; }
/* masthead — full-bleed gradient band (breaks out of the inner padding), white logo + QUOTE mark */
.qd-mast { background:var(--grad-brand); color:#fff; margin:-34px -46px 32px; padding:26px 46px; position:relative; overflow:hidden; }
.qd-mast::after { content:""; position:absolute; right:-70px; top:-90px; width:320px; height:320px; border-radius:50%; background:radial-gradient(circle at center,rgba(255,255,255,.20),transparent 70%); pointer-events:none; }
.qd-mast-row { display:flex; justify-content:space-between; align-items:center; gap:24px; position:relative; }
.qd-mast .brand-logo { height:30px; width:auto; display:block; filter:brightness(0) invert(1); }
.qd-mark { font-size:13px; font-weight:var(--w-black); letter-spacing:.32em; color:rgba(255,255,255,.85); }
/* hero */
.qd-hero { display:flex; justify-content:space-between; align-items:flex-start; gap:36px; }
.qd-hero .qd-eyebrow { font-size:11px; font-weight:var(--w-black); letter-spacing:.16em; text-transform:uppercase; background:var(--grad-brand); -webkit-background-clip:text; background-clip:text; color:transparent; }
.qd-hero h1 { font-size:52px; font-weight:var(--w-black); letter-spacing:-.045em; line-height:.92; margin:8px 0 0; color:var(--ink-900); }
.qd-hero .prop { font-size:18px; font-weight:var(--w-semibold); color:var(--ink-700); line-height:1.4; max-width:30ch; margin-top:14px; letter-spacing:-.01em; }
.qd-hero .prop b { color:var(--ink-900); font-weight:var(--w-black); }
.qd-ref { flex:none; text-align:right; font-size:12px; color:var(--ink-600); min-width:170px; }
.qd-ref .rr { display:flex; justify-content:space-between; gap:18px; padding:6px 0; }
.qd-ref .k { color:var(--ink-500); }
.qd-ref .v { color:var(--ink-900); font-weight:var(--w-bold); font-family:var(--font-mono); font-size:12px; }
.qd-status { display:inline-flex; align-items:center; gap:6px; margin-top:10px; font-size:10.5px; font-weight:var(--w-black); padding:4px 11px; border-radius:var(--r-pill); background:var(--surface-sunken); color:var(--ink-600); }
.qd-status i { width:6px; height:6px; border-radius:50%; background:var(--ink-400); display:inline-block; }
/* parties — clean 3-column card */
.qd-parties { display:grid; grid-template-columns:1fr 1fr 1fr; margin-top:28px; background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-lg); overflow:hidden; }
.qd-party { padding:18px 22px; border-left:1px solid var(--line); }
.qd-party:first-child { border-left:0; }
.qd-party .lbl { font-size:9.5px; font-weight:var(--w-black); letter-spacing:.13em; text-transform:uppercase; color:var(--indigo-500); margin-bottom:9px; }
.qd-party .nm { font-size:14.5px; font-weight:var(--w-black); color:var(--ink-900); line-height:1.25; }
.qd-party .ln { font-size:12px; color:var(--ink-600); line-height:1.7; margin-top:5px; }
/* section heading */
.qd-h { font-size:21px; font-weight:var(--w-bold); letter-spacing:-.02em; margin:32px 0 14px; color:var(--ink-900); }
.qd-h .a { background:var(--grad-brand); -webkit-background-clip:text; background-clip:text; color:transparent; }
.qd-sec-label { font-size:10px; font-weight:var(--w-bold); letter-spacing:.1em; text-transform:uppercase; color:var(--ink-500); margin:30px 0 12px; }
.qd-table { width:100%; border-collapse:collapse; }
.qd-table thead th { text-align:left; font-size:9.5px; font-weight:var(--w-black); letter-spacing:.1em; text-transform:uppercase; color:var(--ink-400); padding:0 0 11px; border-bottom:2px solid var(--ink-900); }
.qd-table thead th.num { text-align:right; }
.qd-table tbody td { padding:15px 0; border-bottom:1px solid var(--line); vertical-align:top; font-size:12.5px; color:var(--ink-600); }
.qd-table td .ti { font-weight:var(--w-black); color:var(--ink-900); font-size:14px; }
.qd-table td .src { font-size:11px; color:var(--indigo-500); font-weight:var(--w-bold); margin-top:3px; }
.qd-table td.num { text-align:right; font-family:var(--font-mono); font-weight:var(--w-bold); color:var(--ink-900); white-space:nowrap; font-size:13.5px; }
.qd-table td.num.free { color:var(--st-open); }
.qd-table td.num .qd-incl-life { color:var(--st-open); font-weight:var(--w-bold); } /* #2829: lifetime → "Included" (all in the monthly, no upfront) */
.qd-num-i { width:26px; color:var(--ink-400); font-family:var(--font-mono); font-size:12px; font-weight:var(--w-semibold); }
.qd-foot { display:grid; grid-template-columns:1fr 300px; gap:20px; margin-top:24px; align-items:start; }
.qd-monthly { align-self:start; border:1px solid var(--line); background:var(--surface-2); border-radius:var(--r-md); padding:18px 20px; }
.qd-monthly .mh { font-size:10px; font-weight:var(--w-black); letter-spacing:.1em; text-transform:uppercase; color:var(--indigo-500); margin-bottom:12px; }
.qd-monthly .mv { font-size:var(--text-2xl); font-weight:var(--w-black); letter-spacing:-.02em; color:var(--ink-900); margin:4px 0; }
.qd-monthly .ms { font-size:11.5px; color:var(--ink-600); line-height:1.55; margin-top:12px; }
.qd-monthly .mline { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:13px; color:var(--ink-700); padding:6px 0; }
.qd-monthly .mline .n { font-family:var(--font-mono); font-weight:var(--w-semibold); color:var(--ink-900); white-space:nowrap; }
.qd-monthly .mline.mtot { margin-top:6px; padding-top:11px; border-top:1px solid var(--line); font-weight:var(--w-black); color:var(--ink-900); }
/* included checklist + testimonial + CTA (#2819) */
.qd-incl { display:grid; grid-template-columns:1fr 1fr; gap:9px 26px; margin-top:4px; }
.qd-incl .it { display:flex; gap:9px; font-size:13px; color:var(--ink-700); align-items:flex-start; line-height:1.4; }
.qd-incl .it .tk { color:var(--st-open); font-weight:var(--w-black); flex:none; }
.qd-pull { margin-top:32px; padding-left:24px; border-left:4px solid; border-image:var(--grad-brand) 1; }
.qd-pull p { font-size:17px; line-height:1.5; color:var(--ink-900); font-weight:var(--w-semibold); font-style:italic; margin:0; letter-spacing:-.01em; }
.qd-pull .by { margin-top:9px; font-size:12px; color:var(--ink-500); font-weight:var(--w-bold); }
.qd-cta { margin-top:36px; border-radius:var(--r-lg); background:var(--grad-brand); color:#fff; padding:28px 32px; display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap; position:relative; overflow:hidden; }
.qd-cta::after { content:""; position:absolute; left:-50px; bottom:-100px; width:280px; height:280px; border-radius:50%; background:radial-gradient(circle at center,rgba(255,255,255,.16),transparent 70%); pointer-events:none; }
.qd-cta .ch { font-size:24px; font-weight:var(--w-black); letter-spacing:-.025em; line-height:1.06; position:relative; }
.qd-cta .cs { font-size:13px; opacity:.94; margin-top:7px; max-width:430px; line-height:1.5; position:relative; }
.qd-cta .qd-cta-act { position:relative; }
.qd-cta .cbtn { background:#fff; color:var(--indigo-600); border:0; border-radius:var(--r-md); padding:15px 30px; font:inherit; font-size:15px; font-weight:var(--w-black); cursor:pointer; white-space:nowrap; box-shadow:0 8px 22px rgba(0,0,0,.18); }
@media (max-width:680px){ .qd-foot{ grid-template-columns:1fr; } .qd-incl{ grid-template-columns:1fr; } }
/* Quote pay-mode toggle — Pay once <-> Monthly for life (#quote-toggle) */
.qmode-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.qmode-cap { font-size:var(--text-sm); font-weight:var(--w-semibold); color:var(--ink-700); }
.qmode-toggle { display:inline-flex; background:var(--surface-sunken); border:1px solid var(--line); border-radius:var(--r-pill); padding:4px; gap:2px; }
.qmode-toggle button { border:0; background:none; cursor:pointer; padding:8px 18px; border-radius:var(--r-pill); font-size:var(--text-sm); font-weight:var(--w-semibold); color:var(--ink-600); transition:background .15s, color .15s, box-shadow .15s; }
.qmode-toggle button:hover { color:var(--ink-900); }
.qmode-toggle button.is-active { background:var(--surface); color:var(--ink-900); box-shadow:0 1px 3px rgba(16,24,40,.14); }
.mode-oneoff .qm-life { display:none !important; }
.mode-lifetime .qm-once { display:none !important; }
.qd-totals { width:auto; }
.qd-totals .tr { display:flex; justify-content:space-between; padding:7px 2px; font-size:13px; color:var(--ink-600); }
.qd-totals .tr .num { font-family:var(--font-mono); font-weight:var(--w-semibold); color:var(--ink-900); }
.qd-totals .due { display:flex; justify-content:space-between; align-items:center; margin-top:10px; padding:13px 16px; border-radius:var(--r-md); background:var(--grad-brand); color:#fff; } /* #2819: shadow removed per Philip */
.qd-totals .due .l { font-size:12px; font-weight:var(--w-bold); letter-spacing:.04em; text-transform:uppercase; opacity:.92; }
.qd-totals .due .v { font-size:var(--text-xl); font-weight:var(--w-black); letter-spacing:-.02em; font-family:var(--font-mono); white-space:nowrap; text-align:right; }
.qd-totals .due { gap:14px; }
.qd-support { margin-top:24px; border:1px solid var(--line); border-radius:var(--r-md); padding:14px 16px; background:var(--surface-2); }
.qd-support .sh { display:flex; align-items:center; justify-content:space-between; }
.qd-support .sh .lbl { font-size:10px; font-weight:var(--w-bold); letter-spacing:.08em; text-transform:uppercase; color:var(--ink-500); }
.qd-support .feats { display:flex; flex-wrap:wrap; gap:14px; margin-top:10px; }
.qd-support .feats span { font-size:12px; color:var(--ink-700); }
.qd-terms { display:grid; grid-template-columns:1fr 1fr; gap:24px; margin-top:28px; padding-top:22px; border-top:1px solid var(--line); }
.qd-terms .tt { font-size:12.5px; color:var(--ink-700); line-height:1.6; }
.qd-terms .tt b { color:var(--ink-900); }
.qd-end { margin-top:30px; padding-top:18px; border-top:1px solid var(--line); text-align:center; font-size:11px; color:var(--ink-500); line-height:1.7; }
@media (max-width:640px){ .qdoc-inner{ padding:24px 22px 30px; } .qd-mast{ margin:-24px -22px 24px; padding:20px 22px; } .qd-hero{ flex-direction:column; gap:18px; } .qd-hero h1{ font-size:40px; } .qd-ref{ text-align:left; } .qd-parties{ grid-template-columns:1fr; } .qd-party{ border-left:0; border-top:1px solid var(--line); } .qd-party:first-child{ border-top:0; } .qd-terms, .qd-sign{ grid-template-columns:1fr; } .qd-cta{ padding:22px 24px; } }

.qdoc .print-only { display:none; } /* CTA wording that only belongs in the printed/PDF version (#2819) */
/* Print / Save-as-PDF (#2819): output ONLY the quote document, A4, full width, no app chrome, clean page breaks
   — matches quote-QT-644-print.html. */
@media print {
  .qdoc .print-only { display:block !important; }
  .qdoc .screen-only { display:none !important; }
  @page { size: A4; margin: 12mm; }
  body { background:#fff !important; }
  body * { visibility:hidden !important; }
  /* show ONLY the quote document, and force every colour/background to render so the PDF matches the screen */
  .qdoc, .qdoc * { visibility:visible !important; -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }
  .qdoc { position:absolute; left:0; top:0; width:100%; box-shadow:none !important; border:0 !important; border-radius:0 !important; }
  .qdoc-inner { padding:0 !important; }
  /* the masthead is full-bleed on screen via negative margins — that overflows a 0-padding print sheet, so reset it
     to a clean rounded band with the logo/QUOTE inset (not flush to the edges) */
  .qd-mast { margin:0 0 26px !important; padding:22px 40px !important; border-radius:14px !important; }
  /* interactive controls never belong in the PDF */
  .qd-cta-act, .qd-cta .cbtn { display:none !important; }
  /* keep each block whole across page breaks; don't strand a heading at the foot of a page */
  .qd-parties, .qd-cover, .qd-foot, .qd-incl, .qd-pull, .qd-cta, .qd-terms, .qd-end, .qd-table tr { page-break-inside:avoid; }
  .qd-h { page-break-after:avoid; }
}
/* Cover note / intro — the persuasive opening (staff- or AI-written) at the top of the quote (#quote-cover) */
.qd-cover { white-space:pre-line; font-size:13.5px; line-height:1.65; color:var(--ink-700); background:var(--surface-sunken); border-radius:12px; padding:14px 16px; margin:6px 0 2px; border-left:3px solid var(--indigo-500, #6d5ef0); }
.qd-cover p { margin:0 0 8px; }
.qd-cover p:last-child { margin-bottom:0; }

.approved-only { display:none; }
.quote.is-approved .approved-only { display:block; }
.quote.is-approved .pre-approve { display:none; }
.quote-approved-banner { display:none; }
.quote.is-approved .quote-approved-banner { display:flex; }

.build-grid { display:grid; grid-template-columns: 296px minmax(0,1fr) 320px; gap: var(--s-4); align-items:start; }
.b-tree { position:sticky; top:var(--s-5); }
.b-rail { position:sticky; top:var(--s-5); display:flex; flex-direction:column; gap:var(--s-4); }
/* "Hide controls" — collapse BOTH side panels so the centre canvas/preview takes the full width (#collapse-panels). */
.build-grid.solo { grid-template-columns: minmax(0,1fr); }
.build-grid.solo > .b-tree, .build-grid.solo > .b-rail { display:none; }
.build-grid .pane-head { padding:12px var(--s-4); }
.build-grid .pane-head h3 { font-size:var(--text-sm); }
.build-grid .pane-head .ct { font-size:11px; }
.build-grid .ctrl { padding:var(--s-4); }
.build-grid .ctrl h4 { margin-bottom:10px; }

.tree { padding:8px 10px 12px; }
.tnode { position:relative; }
.b-tree .trow { display:flex; align-items:center; gap:8px; padding:8px 8px; border-radius:var(--r-sm); cursor:pointer; transition:background .12s; position:relative; }
.b-tree .trow:hover { background:var(--surface-sunken); }
.b-tree .trow.is-sel { background:var(--indigo-50); }
.tcaret { width:16px; height:16px; flex:none; display:grid; place-items:center; color:var(--ink-400); font-size:10px; transition:transform .18s; border-radius:4px; }
.tcaret:hover { background:var(--line); }
.tcaret.spacer { visibility:hidden; }
.tnode.open > .trow .tcaret { transform:rotate(90deg); }
.tname { font-size:var(--text-sm); font-weight:var(--w-semibold); color:var(--ink-800); flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.b-tree .trow.is-sel .tname { color:var(--indigo-600); }
.tchildren { display:none; margin-left:15px; padding-left:14px; border-left:1px solid var(--line-strong); margin-top:2px; }
.tnode.open > .tchildren { display:block; }
.b-tree .tchildren .trow::before { content:""; position:absolute; left:-14px; top:50%; width:11px; height:1px; background:var(--line-strong); }
.tree-progress { padding:12px 16px; border-top:1px solid var(--line); }
.tree-add { margin:6px 6px 0; }

.canvas-top { display:flex; align-items:center; gap:var(--s-3); padding:var(--s-4) var(--s-5); border-bottom:1px solid var(--line); flex-wrap:wrap; }
.device-tabs { margin-left:auto; }
.canvas-stage { padding:var(--s-5); background:var(--surface-sunken); display:flex; justify-content:center; }
.canvas-frame { width:100%; max-width:100%; border:1px solid var(--line-strong); border-radius:var(--r-md); overflow:hidden; box-shadow:var(--sh-md); background:#fff; transition:max-width .35s cubic-bezier(.2,.85,.25,1); }
.canvas-frame.tablet { max-width:768px; }
.canvas-frame.mobile { max-width:390px; }
.cf-bar { display:flex; align-items:center; gap:8px; padding:9px 13px; background:var(--surface-sunken); border-bottom:1px solid var(--line); }
.cf-dot { width:10px; height:10px; border-radius:50%; background:var(--line-strong); }
.cf-url { margin-left:8px; font-family:var(--font-mono); font-size:11px; color:var(--ink-500); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cf-body { min-height:300px; background:linear-gradient(135deg,#0aa86f,#16c47f); position:relative; display:flex; align-items:flex-end; padding:var(--s-6); }
.cf-body::after { content:""; position:absolute; inset:0; background:linear-gradient(160deg,rgba(255,255,255,.18),transparent 55%); }
.cf-hero { position:relative; z-index:1; color:#fff; }
.cf-hero h5 { font-size:30px; font-weight:var(--w-black); letter-spacing:-.025em; line-height:1.05; }
.cf-hero .pill { display:inline-block; margin-top:14px; background:rgba(255,255,255,.92); color:var(--ink-800); font-weight:var(--w-bold); font-size:var(--text-sm); padding:8px 16px; border-radius:var(--r-pill); }
.cf-empty { min-height:300px; display:grid; place-items:center; color:var(--ink-400); font-size:var(--text-sm); padding:var(--s-6); text-align:center; }
/* Live staging preview embedded right inside the canvas browser-frame (#preview-in-window). */
.cf-body.cf-live { display:block; height:560px; min-height:0; padding:0; background:#fff; }
.cf-body.cf-live::after { content:none; }
.cf-frame { display:block; width:100%; height:100%; border:0; background:#fff; }
.cf-max { display:inline-flex; align-items:center; justify-content:center; width:26px; height:22px; border:0; background:none; color:var(--ink-500); font-size:13px; line-height:1; cursor:pointer; border-radius:var(--r-sm); transition:background .12s, color .12s; }
.cf-max:hover { background:var(--surface); color:var(--indigo-600); }

.pseg { display:inline-flex; padding:3px; gap:2px; background:var(--surface-sunken); border:1px solid var(--line); border-radius:var(--r-md); }
.pseg button { height:30px; padding:0 11px; border:0; background:none; border-radius:var(--r-sm); font:inherit; font-size:var(--text-xs); font-weight:var(--w-semibold); color:var(--ink-600); cursor:pointer; display:inline-flex; align-items:center; gap:6px; white-space:nowrap; transition:background .14s, color .14s, box-shadow .14s; }
.pseg button .n { font-size:10px; font-weight:var(--w-bold); color:var(--ink-400); }
.pseg button.is-active { background:var(--surface); color:var(--ink-900); box-shadow:var(--sh-xs); }
.pseg button.is-active .n { color:var(--indigo-600); }
.pseg.full { display:flex; }
.pseg.full button { flex:1; justify-content:center; }
.pseg.owner button[data-owner-set="you"].is-active { background:var(--st-awaiting-bg); color:var(--st-awaiting); box-shadow:inset 0 0 0 1px #f6e1bd; }
.pseg.owner button[data-owner-set="corsto"].is-active { background:var(--st-progress-bg); color:var(--st-progress); box-shadow:inset 0 0 0 1px #cfe4ff; }
/* Bigger, bolder "Who has the next move?" toggle so it stands out in the project rail (#owner-toggle). */
.pseg.owner.big { width:100%; padding:4px; }
.pseg.owner.big button { height:44px; font-size:var(--text-sm); gap:8px; border-radius:var(--r-md); }
.pseg.owner.big button.is-active { background:var(--indigo-500); color:#fff; font-weight:var(--w-bold); box-shadow:0 2px 8px rgba(109,92,255,.32); }
.own { display:inline-flex; align-items:center; gap:5px; height:21px; padding:0 8px; border-radius:var(--r-pill); font-size:11px; font-weight:var(--w-bold); white-space:nowrap; flex:none; }
.own-you { background:var(--st-awaiting-bg); color:var(--st-awaiting); }
.own-corsto { background:var(--st-progress-bg); color:var(--st-progress); }
.own-done { background:var(--st-open-bg); color:var(--st-open); }
.owner-filter { padding:10px 10px 4px; }
.owner-legend { display:flex; gap:14px; padding:8px 14px 0; flex-wrap:wrap; }
.owner-legend span { display:inline-flex; align-items:center; gap:6px; font-size:11px; color:var(--ink-500); }
.tdim { display:none !important; }
.owner-banner { display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:var(--r-md); margin:0 0 var(--s-4); border:1px solid; }
.owner-banner .ob-ico { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; font-size:15px; flex:none; }
.owner-banner.you { background:var(--st-awaiting-bg); border-color:#f6e1bd; }
.owner-banner.you .ob-ico { background:#fff; color:var(--st-awaiting); }
.owner-banner.corsto { background:var(--st-progress-bg); border-color:#cfe4ff; }
.owner-banner.corsto .ob-ico { background:#fff; color:var(--st-progress); }
.owner-banner .ob-t { font-size:var(--text-sm); color:var(--ink-800); }
.owner-banner .ob-t b { color:var(--ink-900); }

body.builder-fs .sidebar { display:none; }
body.builder-fs .app { grid-template-columns: 1fr; }
body.builder-fs .crumbs { display:none; }
body.builder-fs .main.builder { padding: 64px var(--s-7) var(--s-7); }
body.builder-fs .builder .main-inner { max-width: 1640px; }
.fs-exit { position:fixed; top:14px; right:18px; z-index:160; display:none; align-items:center; gap:8px; }
body.builder-fs .fs-exit { display:inline-flex; }

.enq-sec + .enq-sec { margin-top:var(--s-6); }
.enq-label { font-size:var(--text-xs); font-weight:var(--w-bold); letter-spacing:.06em; text-transform:uppercase; color:var(--ink-500); margin-bottom:var(--s-3); display:flex; align-items:center; gap:7px; }
.enq-quote { background:var(--surface-2); border:1px solid var(--line); border-left:3px solid var(--indigo-500); border-radius:var(--r-sm); padding:12px 14px; font-size:var(--text-sm); color:var(--ink-700); line-height:1.55; }

@media (max-width:1240px){ .build-grid{ grid-template-columns: 264px minmax(0,1fr); } .build-grid .b-rail{ grid-column:1/-1; } }
@media (max-width:980px){ .plan-grid, .quote-grid{ grid-template-columns:1fr; } .plan-rail, .q-rail{ position:static; } }

/* ---- STAGE: Features (tap-to-add catalogue; staff price/edit) — from prism/project-features.html ---- */
.proj-feat { max-width:1120px; margin:0 auto; } /* unified to match the other stages (#2815) */
.feat-layout { display:grid; grid-template-columns: 224px minmax(0,1fr) 312px; gap: var(--s-4); align-items:start; }
.cat-pane { position:sticky; top:var(--s-6); padding:8px; }
.cat-item { display:flex; align-items:center; gap:10px; padding:9px 11px; border-radius:var(--r-sm); cursor:pointer; color:var(--ink-600); font-weight:var(--w-medium); font-size:var(--text-sm); transition:background .12s,color .12s; }
.cat-item:hover { background:var(--surface-sunken); color:var(--ink-900); }
.cat-item.is-active { background:var(--indigo-50); color:var(--indigo-600); font-weight:var(--w-semibold); }
.cat-item .ci { width:18px; text-align:center; }
.cat-item .cn { margin-left:auto; min-width:18px; height:18px; padding:0 6px; border-radius:var(--r-pill); background:var(--grad-brand); color:#fff; font-size:10px; font-weight:var(--w-bold); display:none; align-items:center; justify-content:center; }
.cat-item .cn.show { display:inline-flex; }
.feat-search { margin-bottom:var(--s-4); }
.feat-search .search { max-width:none; height:48px; }
.cat-title { font-size:var(--text-lg); font-weight:var(--w-bold); letter-spacing:-.01em; margin:var(--s-2) 0 var(--s-4); display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.cat-title .sub { font-size:var(--text-sm); font-weight:var(--w-regular); color:var(--ink-500); }
.feat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(228px,1fr)); gap:12px; }
.featc { position:relative; display:flex; gap:12px; padding:14px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); box-shadow:var(--sh-xs); cursor:pointer; transition:border-color .14s, box-shadow .14s, transform .12s, background .14s; }
.featc:hover { border-color:var(--line-strong); box-shadow:var(--sh-sm); transform:translateY(-2px); }
.featc.is-on { border-color:var(--indigo-500); background:linear-gradient(180deg,var(--indigo-50),var(--surface) 70%); box-shadow:0 0 0 3px var(--ring); }
.featc .fi { width:38px;height:38px;border-radius:10px; flex:none; display:grid;place-items:center; font-size:18px; background:var(--surface-sunken); }
.featc.is-on .fi { background:var(--grad-brand); color:#fff; }
.featc .fmeta { min-width:0; padding-right:18px; }
.featc .fname { font-weight:var(--w-bold); font-size:var(--text-sm); color:var(--ink-900); }
.featc .fdesc { font-size:var(--text-xs); color:var(--ink-500); line-height:1.45; margin-top:2px; }
.featc .fadd { position:absolute; top:11px; right:11px; width:22px;height:22px;border-radius:50%; display:grid;place-items:center; border:1px solid var(--line-strong); color:var(--ink-400); font-size:13px; background:var(--surface); transition:background .14s,color .14s,border-color .14s; }
.featc.is-on .fadd { background:var(--grad-brand); color:#fff; border-color:transparent; }
.fprice { display:inline-flex; align-items:center; gap:5px; margin-top:8px; height:22px; padding:0 9px; border-radius:var(--r-pill); font-size:11px; font-weight:var(--w-bold); background:var(--surface-sunken); color:var(--ink-700); border:1px solid var(--line); }
.fprice.free { background:var(--st-open-bg); color:var(--st-open); border-color:#bfe9d4; }
body:not(.is-client) .fprice { cursor:pointer; }
body:not(.is-client) .fprice:hover { border-color:var(--indigo-500); color:var(--indigo-600); }
.fprice .pen { opacity:.55; font-size:10px; }
.fprice .vat-mini { font-size:9px; font-weight:var(--w-bold); color:var(--ink-400); letter-spacing:.02em; }
/* Prices render only when visible; in "preview as client" hide them unless the client-prices toggle is on,
   and never show the edit pen to a client. */
body.is-client:not(.cgs-client-prices) .fprice { display:none; }
body.is-client .fprice { cursor:default; }
body.is-client .fprice .pen { display:none; }
.up-pill.is-uploading { opacity:.65; }
.up-pill .up-state { font-size:11px; }
/* SEO & Content bulk-approve bar: staff tick the Corsto-review drafts, approve them all at once. */
.seo-bulk-bar { display:none; align-items:center; gap:12px; margin:0 0 16px; padding:10px 14px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--sh-xs); }
.seo-bulk-bar.is-on { display:flex; }
.seo-bulk-bar .sbb-text { font-size:var(--text-sm); color:var(--ink-700); font-weight:var(--w-medium); }
body.is-client .feat-staffonly { display:none !important; }
.grp-label { font-size:11px; font-weight:var(--w-bold); letter-spacing:.06em; text-transform:uppercase; color:var(--ink-400); margin:var(--s-5) 0 var(--s-3); }
.grp-label:first-child { margin-top:0; }
.feat-empty { text-align:center; padding:var(--s-8) var(--s-5); color:var(--ink-500); }
.sel-rail { position:sticky; top:var(--s-6); display:flex; flex-direction:column; gap:var(--s-4); }
.sel-card { padding:var(--s-5); }
.sel-big { font-size:var(--text-4xl); font-weight:var(--w-black); letter-spacing:-.03em; line-height:1; color:var(--ink-900); }
.sel-chips { display:flex; flex-wrap:wrap; gap:7px; margin-top:4px; max-height:240px; overflow-y:auto; }
.sel-chip { display:inline-flex; align-items:center; gap:6px; padding:5px 6px 5px 11px; border:1px solid var(--line-strong); border-radius:var(--r-pill); font-size:var(--text-xs); font-weight:var(--w-semibold); color:var(--ink-700); background:var(--surface); }
.sel-chip .x { width:16px;height:16px;border-radius:50%; display:grid;place-items:center; color:var(--ink-400); cursor:pointer; font-size:11px; }
.sel-chip .x:hover { background:var(--pri-urgent-bg); color:var(--pri-urgent); }
.sel-empty { font-size:var(--text-sm); color:var(--ink-500); padding:8px 0; }
.subtotal-row { display:flex; align-items:baseline; justify-content:space-between; }
.subtotal-row .st-amt { font-size:var(--text-2xl); font-weight:var(--w-black); letter-spacing:-.02em; color:var(--ink-900); }
@media (max-width:1180px){ .feat-layout{ grid-template-columns: 200px minmax(0,1fr); } .feat-layout .sel-rail{ grid-column:1/-1; } }
@media (max-width:760px){ .feat-layout{ grid-template-columns:1fr; } .feat-layout .cat-pane{ display:none; } }

/* ---- STAGE: Assets (provide vs create; uploads) — from prism/project-assets.html ---- */
.proj-assets { max-width:1120px; margin:0 auto; }
/* #2824: when Assets are locked for a client, the provide/create toggle is hidden (choices frozen) but the
   upload zone stays — the client may still add files. */
.proj-assets.is-locked .ac-choice { display:none; }
.assets-grid { display:grid; grid-template-columns: minmax(0,1fr) 312px; gap: var(--s-5); align-items:start; }
/* #2822: Assets stage is a grouped scannable list (you give us / Corsto creates) — clearer for the client than a mixed card grid. */
.asset-list { display:flex; flex-direction:column; gap:24px; }
.ag-head { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:12px; padding-bottom:9px; border-bottom:1px solid var(--line); }
.ag-title { font-weight:var(--w-bold); font-size:var(--text-md); color:var(--ink-900); }
.ag-sub { font-size:var(--text-xs); color:var(--ink-500); }
.ag-rows { display:flex; flex-direction:column; gap:8px; }
.ag-empty { display:none; font-size:var(--text-sm); color:var(--ink-400); padding:8px 2px; }
.asset-card { display:grid; grid-template-columns:1fr minmax(248px,300px); align-items:center; gap:16px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); box-shadow:var(--sh-xs); padding:12px 16px; transition:border-color .14s; }
.asset-card:hover { border-color:var(--line-strong); }
.ac-head { display:flex; align-items:center; gap:12px; min-width:0; }
.ac-ico { width:38px;height:38px;border-radius:10px; flex:none; display:grid;place-items:center; font-size:17px; background:var(--surface-sunken); }
.asset-card.choose-have .ac-ico { background:linear-gradient(135deg,#0aa86f,#16c47f); color:#fff; }
.ac-meta { min-width:0; }
.ac-name { font-weight:var(--w-bold); font-size:var(--text-md); color:var(--ink-900); }
.ac-desc { font-size:var(--text-xs); color:var(--ink-500); line-height:1.4; margin-top:1px; }
.ac-side { min-width:0; display:flex; flex-direction:column; gap:8px; }
.ac-side .up-zone { padding:10px 12px; }
.ac-choice button[data-choice="have"].is-active { color:var(--st-open); }
.ac-choice button[data-choice="create"].is-active { color:var(--staff); }
.asset-card.choose-create .ac-provide { display:none; }
/* #2828: the linked-feature price under a "Corsto creates" asset — its own clean row, only when "create". */
.ac-price { display:none; }
.asset-card.choose-create .ac-price { display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:9px 13px; border-radius:var(--r-md); background:var(--surface-2); border:1px solid var(--line); }
/* #2822: a "Corsto creates" card with no price still needs a footer so it doesn't render bare. */
.ac-note { display:none; }
.asset-card.choose-create .ac-note { display:flex; align-items:center; gap:8px; padding:9px 13px; border-radius:var(--r-md); background:var(--surface-2); border:1px dashed var(--line); color:var(--ink-600); font-size:12px; font-weight:var(--w-medium); }
.ac-note .acn-i { color:var(--staff); font-size:14px; line-height:1; }
.ac-price .apx { font-weight:var(--w-black); color:var(--ink-900); font-size:14px; white-space:nowrap; }
.ac-price .apv { font-weight:var(--w-semibold); color:var(--ink-500); font-size:11px; }
.ac-price .apn { font-size:11px; color:var(--ink-500); text-align:right; line-height:1.35; }
.ac-text .input { font-family:var(--font-mono); font-size:var(--text-sm); }
.a-rail { position:sticky; top:var(--s-6); display:flex; flex-direction:column; gap:var(--s-4); }
.a-card { padding:var(--s-5); }
.a-stat { display:flex; align-items:center; gap:12px; padding:10px 0; }
/* #2824: match the Sitemap/Features rail count style so the three stage cards look alike (one dark, bold number). */
.a-stat .num { font-size:var(--text-4xl); font-weight:var(--w-black); letter-spacing:-.03em; line-height:1; min-width:28px; color:var(--ink-900); }
@media (max-width:960px){ .assets-grid{ grid-template-columns:1fr; } .a-rail{ position:static; } }
@media (max-width:600px){ .asset-card{ grid-template-columns:1fr; gap:10px; } }

