/* Closer Engine design system -- bundled build (tokens + base + components). Regenerate this file whenever any of the three source files change. */
/* Closer Engine design system — tokens.
   Apple-glass direction: translucent layered materials, hairline
   borders, soft shadows, one accent color, restraint over decoration.
   This file only defines variables — no selectors render anything. */

:root {
  /* ---------- light (default) ---------- */
  --bg: #F4F4F6;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #86868B;
  --separator: rgba(60, 60, 67, 0.12);

  --accent: #FF5A1F;
  --accent-solid: #D9420F; /* >=4.5:1 with white text — for filled buttons */
  --accent-tint: rgba(255, 90, 31, 0.12);
  --accent-rgb: 255, 90, 31;

  --success: #1F9D55;
  --success-tint: rgba(31, 157, 85, 0.12);
  --danger: #D93025;
  --danger-tint: rgba(217, 48, 37, 0.12);
  --warning: #B26A00;
  --warning-tint: rgba(178, 106, 0, 0.12);
  --info: #0A6CFF;
  --info-tint: rgba(10, 108, 255, 0.12);

  --blob-accent: rgba(255, 90, 31, 0.16);
  --blob-blue: rgba(10, 108, 255, 0.10);

  /* glass-1: cards */
  --glass-1-bg: rgba(255, 255, 255, 0.62);
  --glass-1-border: rgba(255, 255, 255, 0.75);
  --glass-1-highlight: rgba(255, 255, 255, 0.5);
  --glass-1-blur: 28px;
  --glass-1-sat: 1.6;
  /* glass-2: menus, popovers, modals */
  --glass-2-bg: rgba(255, 255, 255, 0.78);
  --glass-2-blur: 40px;
  --glass-2-sat: 1.8;
  /* glass-3: sidebar, top bar */
  --glass-3-bg: rgba(255, 255, 255, 0.5);
  --glass-3-blur: 32px;

  --glass-fallback-1: #FBFBFC;
  --glass-fallback-2: #FDFDFE;
  --glass-fallback-3: #F7F7F9;

  --shadow-s1: 0 1px 2px rgba(16, 16, 32, 0.05), 0 8px 24px rgba(16, 16, 32, 0.06);
  --shadow-s2: 0 2px 4px rgba(16, 16, 32, 0.06), 0 16px 40px rgba(16, 16, 32, 0.10);
  --shadow-s3: 0 30px 80px rgba(16, 16, 32, 0.22);

  --radius-modal: 28px;
  --radius-card: 22px;
  --radius-inner: 16px;
  --radius-btn: 12px;
  --radius-pill: 999px;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px; --space-9: 56px;
  --content-max: 1440px;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.32, .72, 0, 1);
  --dur-micro: 120ms;
  --dur-hover: 200ms;
  --dur-panel: 320ms;
  --dur-sheet: 480ms;
  --dur-chart: 700ms;

  --font-sans: -apple-system, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
}

:root[data-theme="dark"], [data-theme="dark"] {
  --bg: #0A0A0C;
  --text: #F5F5F7;
  --text-2: #A1A1A6;
  --text-3: #8A8A8E;
  --separator: rgba(255, 255, 255, 0.10);

  --accent: #FF7A45;
  --accent-solid: #FF7A45;
  --accent-tint: rgba(255, 122, 69, 0.18);
  --accent-rgb: 255, 122, 69;

  --success: #30D873;
  --success-tint: rgba(48, 216, 115, 0.18);
  --danger: #FF6257;
  --danger-tint: rgba(255, 98, 87, 0.18);
  --warning: #E3A32E;
  --warning-tint: rgba(227, 163, 46, 0.18);
  --info: #4C9AFF;
  --info-tint: rgba(76, 154, 255, 0.18);

  --blob-accent: rgba(255, 122, 69, 0.28);
  --blob-blue: rgba(76, 154, 255, 0.22);

  --glass-1-bg: rgba(30, 30, 34, 0.55);
  --glass-1-border: rgba(255, 255, 255, 0.08);
  --glass-1-highlight: rgba(255, 255, 255, 0.06);
  --glass-2-bg: rgba(30, 30, 34, 0.72);
  --glass-3-bg: rgba(20, 20, 23, 0.55);

  --glass-fallback-1: #0F0F12;
  --glass-fallback-2: #141417;
  --glass-fallback-3: #0C0C0E;

  --shadow-s1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-s2: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-s3: 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* Explicit light override — lets a nested container force light
   regardless of an ancestor's theme (used by styleguide.html's
   side-by-side light/dark preview). Values mirror the :root defaults. */
[data-theme="light"] {
  --bg: #F4F4F6; --text: #1D1D1F; --text-2: #6E6E73; --text-3: #86868B;
  --separator: rgba(60, 60, 67, 0.12);
  --accent: #FF5A1F; --accent-solid: #D9420F; --accent-tint: rgba(255, 90, 31, 0.12); --accent-rgb: 255, 90, 31;
  --success: #1F9D55; --success-tint: rgba(31, 157, 85, 0.12);
  --danger: #D93025; --danger-tint: rgba(217, 48, 37, 0.12);
  --warning: #B26A00; --warning-tint: rgba(178, 106, 0, 0.12);
  --info: #0A6CFF; --info-tint: rgba(10, 108, 255, 0.12);
  --blob-accent: rgba(255, 90, 31, 0.16); --blob-blue: rgba(10, 108, 255, 0.10);
  --glass-1-bg: rgba(255, 255, 255, 0.62); --glass-1-border: rgba(255, 255, 255, 0.75); --glass-1-highlight: rgba(255, 255, 255, 0.5);
  --glass-2-bg: rgba(255, 255, 255, 0.78); --glass-3-bg: rgba(255, 255, 255, 0.5);
  --glass-fallback-1: #FBFBFC; --glass-fallback-2: #FDFDFE; --glass-fallback-3: #F7F7F9;
  --shadow-s1: 0 1px 2px rgba(16, 16, 32, 0.05), 0 8px 24px rgba(16, 16, 32, 0.06);
  --shadow-s2: 0 2px 4px rgba(16, 16, 32, 0.06), 0 16px 40px rgba(16, 16, 32, 0.10);
  --shadow-s3: 0 30px 80px rgba(16, 16, 32, 0.22);
}

/* Dark mode removed by request -- this app is light-only now. (The
   [data-theme="dark"] variable block above is unreachable dead code
   left in place rather than deleted, since nothing in app-shell.js
   sets that attribute anymore; safe to delete later if desired.) */

/* Closer Engine design system — base: reset, typography, scrollbars,
   selection, the fixed background blob layer, glass mixins-as-classes. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

html[data-ce-shell] body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out);
}

html[data-ce-shell] ::selection { background: var(--accent-tint); color: var(--text); }

/* ---------- fixed background blob layer ---------- */
.ce-bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
  overflow: hidden;
}
.ce-bg-layer::before,
.ce-bg-layer::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}
.ce-bg-layer::before {
  width: 720px; height: 720px;
  top: -200px; right: -120px;
  background: var(--blob-accent);
}
.ce-bg-layer::after {
  width: 640px; height: 640px;
  left: -160px; bottom: -200px;
  background: var(--blob-blue);
}

/* ---------- type scale ---------- */
html[data-ce-shell] h1, html[data-ce-shell] h2, html[data-ce-shell] h3 { margin: 0; }
.ce-text-large-title { font-size: 34px; line-height: 40px; font-weight: 650; letter-spacing: -0.025em; }
.ce-text-title { font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -0.02em; }
.ce-text-headline { font-size: 17px; line-height: 22px; font-weight: 600; }
.ce-text-body { font-size: 15px; line-height: 22px; font-weight: 400; letter-spacing: -0.01em; }
.ce-text-callout { font-size: 13px; line-height: 18px; font-weight: 500; }
.ce-text-caption { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-2); }
.ce-text-kpi { font-size: 40px; line-height: 44px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ce-text-overline { font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.ce-text-2 { color: var(--text-2); }
.ce-text-3 { color: var(--text-3); }

/* ---------- glass base (solid fallback unless both blur + transparency are OK) ---------- */
.ce-glass-1, .ce-glass-2, .ce-glass-3 {
  position: relative;
  background: var(--glass-fallback-1);
  border: 1px solid var(--glass-1-border);
}
@media (prefers-reduced-transparency: no-preference) {
  @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .ce-glass-1 { background: var(--glass-1-bg); backdrop-filter: blur(var(--glass-1-blur)) saturate(var(--glass-1-sat)); -webkit-backdrop-filter: blur(var(--glass-1-blur)) saturate(var(--glass-1-sat)); }
    .ce-glass-2 { background: var(--glass-2-bg); backdrop-filter: blur(var(--glass-2-blur)) saturate(var(--glass-2-sat)); -webkit-backdrop-filter: blur(var(--glass-2-blur)) saturate(var(--glass-2-sat)); border-color: var(--glass-1-border); }
    .ce-glass-3 { background: var(--glass-3-bg); backdrop-filter: blur(var(--glass-3-blur)); -webkit-backdrop-filter: blur(var(--glass-3-blur)); border-color: var(--glass-1-border); }
  }
}
.ce-glass-1::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 50%;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--glass-1-highlight), transparent 42%);
  opacity: 0.6;
  pointer-events: none;
}

/* ---------- scrollbars ---------- */
html[data-ce-shell] * {
  scrollbar-width: thin;
  scrollbar-color: var(--text-3) transparent;
}
html[data-ce-shell] *::-webkit-scrollbar { width: 8px; height: 8px; }
html[data-ce-shell] *::-webkit-scrollbar-track { background: transparent; }
html[data-ce-shell] *::-webkit-scrollbar-thumb { background: var(--separator); border-radius: 999px; }
html[data-ce-shell] *::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- focus ---------- */
html[data-ce-shell]:not([data-ce-v2]) :focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-tint);
  border-radius: var(--radius-btn);
}

/* ---------- motion ---------- */
.ce-fade-rise { animation: ce-fade-rise var(--dur-panel) var(--ease-out) both; }
@keyframes ce-fade-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .ce-fade-rise { animation: none; }
  html[data-ce-shell] *, html[data-ce-shell] *::before, html[data-ce-shell] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- skeleton shimmer ---------- */
.ce-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--separator);
  border-radius: var(--radius-inner);
}
.ce-skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: ce-shimmer 1.4s infinite;
}
:root[data-theme="dark"] .ce-skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); }
@keyframes ce-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- cross-document view transitions ---------- */
/* This is a multi-page app (every nav link is a real navigation, not
   client-side routing), so page-to-page motion can't be done with
   ordinary CSS transitions across two separate page loads. The
   browser's native cross-document view transition bridges that gap:
   `navigation: auto` keeps the old page's pixels on screen until the
   new page is ready (no blank flash), cross-dissolving the whole page
   by default, and the active sidebar link additionally gets a shared
   view-transition-name so it slides from its old position to its new
   one instead of just cross-fading in place. Chromium-based browsers
   only, for now; everywhere else this rule is simply unused and
   navigation behaves as it already did (no error, no missing
   feature, just no animation). */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
}
::view-transition-group(active-nav-pill) {
  animation-duration: 320ms;
  animation-timing-function: var(--spring, cubic-bezier(.32, .72, 0, 1));
}
::view-transition-old(active-nav-pill),
::view-transition-new(active-nav-pill) {
  animation-duration: 320ms;
  animation-timing-function: var(--spring, cubic-bezier(.32, .72, 0, 1));
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(active-nav-pill),
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}

/* Closer Engine design system — components.
   Every component: hover / active / focus-visible / disabled / loading. */

/* ========== BUTTONS ========== */
.ce-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 36px; padding: 0 16px; border-radius: var(--radius-btn);
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; line-height: 1;
  border: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out),
    background var(--dur-hover) var(--ease-out), filter var(--dur-hover) var(--ease-out), opacity var(--dur-hover) var(--ease-out);
}
.ce-btn:active { transform: scale(0.98); }
.ce-btn[disabled], .ce-btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.ce-btn-lg { height: 44px; padding: 0 22px; }
.ce-btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

.ce-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-solid) 100%, white 6%), var(--accent-solid));
  box-shadow: 0 1px 2px rgba(var(--accent-rgb), 0.3);
}
.ce-btn-primary:hover { filter: brightness(1.04); }

.ce-btn-secondary {
  color: var(--text);
  background: var(--glass-fallback-1);
  border: 1px solid var(--separator);
}
@supports (backdrop-filter: blur(1px)) { .ce-btn-secondary { background: var(--glass-1-bg); backdrop-filter: blur(var(--glass-1-blur)) saturate(var(--glass-1-sat)); } }
.ce-btn-secondary:hover { background: var(--accent-tint); border-color: transparent; }

.ce-btn-tertiary { color: var(--text); background: transparent; }
.ce-btn-tertiary:hover { background: var(--separator); }

.ce-btn-destructive { color: var(--danger); background: var(--danger-tint); }
.ce-btn-destructive:hover { filter: brightness(0.96); }

.ce-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--separator);
  background: var(--glass-fallback-1); color: var(--text-2); cursor: pointer; position: relative;
  transition: background var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) { .ce-icon-btn { background: var(--glass-1-bg); backdrop-filter: blur(var(--glass-1-blur)); } }
.ce-icon-btn:hover { color: var(--text); background: var(--accent-tint); }
.ce-icon-btn:active { transform: scale(0.94); }

/* ---------- legacy button classes, redirected to the design system ----------
   .btn-primary / .btn-dark are the marketing site's big 999px-radius
   pill buttons (800-weight, flat saturated fill, big lift-on-hover).
   Every app page still calls them, so instead of touching dozens of
   files, they're redirected here -- scoped to html[data-ce-shell], so
   the marketing site (which never loads this file) is untouched -- to
   the same calmer, smaller ce-btn-primary / ce-btn-secondary look used
   by the rest of the design system. Any inline `style="padding:…"` an
   individual button still carries keeps working (just sizing the same
   shape), so this is a safe, page-by-page-free fix. */
html[data-ce-shell] .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-btn); font-family: var(--font-sans);
  font-size: 14px; font-weight: 600; line-height: 1.1; text-decoration: none; cursor: pointer; border: none;
  color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--accent-solid) 100%, white 6%), var(--accent-solid));
  box-shadow: 0 1px 2px rgba(var(--accent-rgb), 0.3);
  transition: filter var(--dur-hover) var(--ease-out), transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out), opacity var(--dur-hover) var(--ease-out);
}
html[data-ce-shell] .btn-primary:hover { color: #fff; filter: brightness(1.05); transform: none; box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.35); background: linear-gradient(180deg, color-mix(in srgb, var(--accent-solid) 100%, white 6%), var(--accent-solid)); }
html[data-ce-shell] .btn-primary:active { transform: scale(0.98); }
html[data-ce-shell] .btn-primary.is-disabled, html[data-ce-shell] .btn-primary[disabled] { opacity: 0.45; pointer-events: none; cursor: not-allowed; }
html[data-ce-shell] .btn-primary.is-disabled:hover, html[data-ce-shell] .btn-primary[disabled]:hover { transform: none; box-shadow: none; }

html[data-ce-shell] .btn-dark {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-btn); font-family: var(--font-sans);
  font-size: 14px; font-weight: 600; line-height: 1.1; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--glass-fallback-1); border: 1px solid var(--separator);
  box-shadow: none; transition: background var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out), border-color var(--dur-hover) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) { html[data-ce-shell] .btn-dark { background: var(--glass-1-bg); backdrop-filter: blur(var(--glass-1-blur)) saturate(var(--glass-1-sat)); } }
html[data-ce-shell] .btn-dark:hover { color: var(--text); background: var(--accent-tint); border-color: transparent; box-shadow: none; }
html[data-ce-shell] .btn-dark.is-disabled, html[data-ce-shell] .btn-dark[disabled] { opacity: 0.45; pointer-events: none; cursor: not-allowed; }

/* ---------- legacy form fields, redirected to the design system ----------
   .book-field is the marketing checkout page's style: a 2px solid-black
   border, monospace input text, harsh uppercase labels. Every modal
   and form across the app (New lead, New event, bulk actions, ...)
   still uses it unmodified. Redirected here the same way buttons were
   above, scoped to html[data-ce-shell] so checkout.html itself (which
   doesn't load this file) is untouched. */
html[data-ce-shell] .book-field { gap: 6px; }
html[data-ce-shell] .book-field label {
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 600; letter-spacing: 0;
  text-transform: none; color: var(--text-2, var(--mono-muted));
}
html[data-ce-shell] .book-field input,
html[data-ce-shell] .book-field select,
html[data-ce-shell] .book-field textarea {
  border: 1px solid var(--separator); border-radius: var(--radius-btn); background: var(--glass-fallback-1);
  padding: 10px 13px; font-family: var(--font-sans); font-size: 14.5px; color: var(--text, var(--ink));
  transition: border-color var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out);
}
html[data-ce-shell] .book-field input::placeholder,
html[data-ce-shell] .book-field textarea::placeholder { color: var(--text-3); }
html[data-ce-shell] .book-field textarea { font-family: var(--font-sans); }
html[data-ce-shell] .book-field input:focus,
html[data-ce-shell] .book-field select:focus,
html[data-ce-shell] .book-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint);
}
html[data-ce-shell] .book-field-row { gap: 14px; }

/* A modal whose body can outgrow the viewport keeps its action button
   pinned to the bottom instead of requiring a scroll to find it.
   .ce-modal becomes a bounded-height flex column; wrap the scrollable
   fields in .ce-modal-scroll (flexes + scrolls) and the action row in
   .ce-modal-sticky-footer (a plain flex item that lands at the
   bottom of that fixed height -- no actual sticky positioning
   needed once the modal itself no longer scrolls as a whole). */
html[data-ce-shell] .ce-modal.has-sticky-footer {
  display: flex; flex-direction: column; max-height: 82vh; overflow: hidden;
}
html[data-ce-shell] .ce-modal-scroll { flex: 1; overflow-y: auto; padding-right: 4px; margin-right: -4px; }
html[data-ce-shell] .ce-modal-sticky-footer {
  flex: none; margin: 16px -24px -24px; padding: 16px 24px;
  background: var(--glass-fallback-1, #fff); border-top: 1px solid var(--separator);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 0 0 16px 16px;
}

/* ========== SEGMENTED CONTROL ========== */
.ce-segmented {
  position: relative; display: inline-flex; padding: 3px; border-radius: var(--radius-pill);
  background: var(--glass-fallback-3); border: 1px solid var(--separator); height: 32px;
}
@supports (backdrop-filter: blur(1px)) { .ce-segmented { background: var(--glass-3-bg); backdrop-filter: blur(var(--glass-3-blur)); } }
.ce-segmented-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px;
  border-radius: var(--radius-pill); background: var(--glass-fallback-1);
  box-shadow: var(--shadow-s1);
  transition: transform var(--dur-hover) var(--spring), width var(--dur-hover) var(--spring);
  z-index: 0;
}
.ce-segmented-opt {
  position: relative; z-index: 1; border: none; background: transparent; cursor: pointer;
  padding: 0 14px; font-size: 13px; font-weight: 600; color: var(--text-2); border-radius: var(--radius-pill);
  transition: color var(--dur-hover) var(--ease-out);
}
.ce-segmented-opt.is-active { color: var(--text); }

/* ========== INPUTS ========== */
.ce-input, .ce-select, .ce-textarea {
  width: 100%; height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-btn);
  background: var(--glass-fallback-1); border: 1px solid var(--separator); color: var(--text);
  font-family: var(--font-sans); font-size: 15px;
  transition: border-color var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) { .ce-input, .ce-select, .ce-textarea { background: rgba(255, 255, 255, 0.7); } }
:root[data-theme="dark"] .ce-input, :root[data-theme="dark"] .ce-select, :root[data-theme="dark"] .ce-textarea { background: var(--glass-1-bg); }
.ce-input::placeholder, .ce-textarea::placeholder { color: var(--text-3); }
.ce-input:focus, .ce-select:focus, .ce-textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint);
}
.ce-textarea { height: auto; min-height: 40px; padding: 10px var(--space-3); resize: none; line-height: 1.4; }
.ce-input-wrap { position: relative; }
.ce-input-wrap .ce-input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.ce-input-wrap .ce-input { padding-left: 36px; }
.ce-input-wrap .ce-input-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--separator);
  color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* custom dropdown */
.ce-dropdown { position: relative; }
.ce-dropdown-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); cursor: pointer;
}
.ce-dropdown-panel {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; z-index: 40;
  border-radius: var(--radius-inner); padding: 6px; max-height: 280px; overflow-y: auto;
  box-shadow: var(--shadow-s2);
}
.ce-dropdown-opt {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 8px 10px; border-radius: 10px; font-size: 14px; cursor: pointer; color: var(--text);
}
.ce-dropdown-opt:hover, .ce-dropdown-opt.is-highlighted { background: var(--accent-tint); }
.ce-dropdown-opt .ce-check { color: var(--accent); opacity: 0; }
.ce-dropdown-opt.is-selected .ce-check { opacity: 1; }

/* checkbox */
.ce-checkbox { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: 14px; }
.ce-checkbox input { position: absolute; opacity: 0; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.ce-checkbox-box {
  width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--separator);
  background: var(--glass-fallback-1); display: flex; align-items: center; justify-content: center; flex: none;
  transition: background var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}
.ce-checkbox input:checked ~ .ce-checkbox-box,
.ce-checkbox input:indeterminate ~ .ce-checkbox-box { background: var(--accent-solid); border-color: var(--accent-solid); }
.ce-checkbox-box svg { opacity: 0; color: #fff; transform: scale(0.6); transition: opacity var(--dur-micro), transform var(--dur-micro); }
.ce-checkbox input:checked ~ .ce-checkbox-box svg, .ce-checkbox input:indeterminate ~ .ce-checkbox-box svg { opacity: 1; transform: scale(1); }
.ce-checkbox input:focus-visible ~ .ce-checkbox-box { box-shadow: 0 0 0 4px var(--accent-tint); }

/* switch */
.ce-switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.ce-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.ce-switch-track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--separator);
  transition: background var(--dur-hover) var(--ease-out);
}
.ce-switch input:checked ~ .ce-switch-track { background: var(--success); }
.ce-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur-hover) var(--spring);
}
.ce-switch input:checked ~ .ce-switch-knob { transform: translateX(20px); }
.ce-switch input:focus-visible ~ .ce-switch-track { box-shadow: 0 0 0 4px var(--accent-tint); }

/* ========== CHIPS / BADGES ========== */
.ce-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
}
.ce-chip-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.ce-chip-dot.is-pulsing { animation: ce-pulse-dot 1.6s ease-in-out infinite; }
@keyframes ce-pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.ce-chip-success { background: var(--success-tint); color: var(--success); }
.ce-chip-info { background: var(--info-tint); color: var(--info); }
.ce-chip-warning { background: var(--warning-tint); color: var(--warning); }
.ce-chip-neutral { background: var(--separator); color: var(--text-2); }
.ce-chip-danger { background: var(--danger-tint); color: var(--danger); }

.ce-tag-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; }

.ce-delta-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.ce-delta-chip.is-good { background: var(--success-tint); color: var(--success); }
.ce-delta-chip.is-bad { background: var(--danger-tint); color: var(--danger); }

/* ========== CARDS ========== */
.ce-card {
  border-radius: var(--radius-card); padding: var(--space-6); box-shadow: var(--shadow-s1);
  transition: transform var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out);
}
.ce-card-compact { padding: var(--space-4); }
.ce-card.is-clickable { cursor: pointer; }
.ce-card.is-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-s2); }
.ce-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.ce-card-title { font-size: 17px; line-height: 22px; font-weight: 600; }
.ce-card-caption { margin-top: 2px; font-size: 12px; color: var(--text-2); }

/* ========== TABLES ========== */
.ce-table-wrap { border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-s1); }
.ce-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ce-table thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 12px 16px; background: var(--glass-fallback-3); border-bottom: 1px solid var(--separator);
}
@supports (backdrop-filter: blur(1px)) { .ce-table thead th { background: var(--glass-3-bg); backdrop-filter: blur(var(--glass-3-blur)); } }
.ce-table th.is-sortable { cursor: pointer; user-select: none; }
.ce-table th .ce-sort-arrow { display: inline-block; margin-left: 4px; opacity: 0.5; transition: transform var(--dur-micro) var(--ease-out); }
.ce-table th.is-sorted-desc .ce-sort-arrow { transform: rotate(180deg); }
.ce-table tbody tr { height: 56px; border-bottom: 1px solid var(--separator); transition: background var(--dur-micro) var(--ease-out); }
.ce-table tbody tr:last-child { border-bottom: none; }
.ce-table tbody tr:hover { background: var(--accent-tint); }
.ce-table td { padding: 0 16px; color: var(--text); }
.ce-table .ce-row-actions { opacity: 0; transition: opacity var(--dur-micro) var(--ease-out); }
.ce-table tbody tr:hover .ce-row-actions { opacity: 1; }

.ce-bulk-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--space-4); padding: 10px 18px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-s3); z-index: 50; font-size: 13px; font-weight: 600;
}

/* ========== TOOLTIP ========== */
.ce-tooltip {
  position: fixed; z-index: 80; padding: 6px 10px; border-radius: var(--radius-inner);
  font-size: 12px; font-weight: 500; box-shadow: var(--shadow-s2); pointer-events: none;
  opacity: 0; transform: translateY(4px) scale(0.98); transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
  max-width: 240px;
}
.ce-tooltip.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* ========== TOAST ========== */
.ce-toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90; align-items: center;
}
.ce-toast {
  display: flex; align-items: center; gap: var(--space-3); padding: 12px 16px; border-radius: var(--radius-inner);
  box-shadow: var(--shadow-s2); font-size: 14px; min-width: 240px;
  animation: ce-toast-in var(--dur-hover) var(--ease-out);
}
.ce-toast.is-leaving { animation: ce-toast-out var(--dur-hover) var(--ease-out) forwards; }
@keyframes ce-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ce-toast-out { to { opacity: 0; transform: translateY(12px); } }
.ce-toast-undo { color: var(--accent); font-weight: 700; cursor: pointer; background: none; border: none; font-size: 14px; }

/* ========== MODAL / SHEET ========== */
.ce-modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 12, 0.32);
}
@supports (backdrop-filter: blur(1px)) { .ce-modal-overlay { backdrop-filter: blur(8px); } }
.ce-modal {
  border-radius: var(--radius-modal); box-shadow: var(--shadow-s3); max-width: 480px; width: calc(100% - 32px);
  padding: var(--space-7); transform: scale(0.96); opacity: 0;
  animation: ce-modal-in var(--dur-panel) var(--spring) forwards;
}
@keyframes ce-modal-in { to { transform: scale(1); opacity: 1; } }
.ce-modal-title { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: var(--space-2); }
.ce-modal-body { font-size: 15px; color: var(--text-2); margin-bottom: var(--space-6); }
.ce-modal-actions { display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ========== AVATAR ========== */
.ce-avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  font-weight: 700; color: #fff; flex: none; width: 32px; height: 32px; font-size: 13px;
  background: var(--text-2);
}
.ce-avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ========== EMPTY / ERROR STATES ========== */
.ce-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--space-8) var(--space-4); gap: var(--space-4); }
.ce-empty svg { color: var(--text-3); }
.ce-empty p { margin: 0; font-size: 14px; color: var(--text-2); max-width: 320px; }

/* ========== COMMAND PALETTE ========== */
.ce-palette-overlay { position: fixed; inset: 0; z-index: 110; display: flex; justify-content: center; padding-top: 12vh; background: rgba(10, 10, 12, 0.32); }
@supports (backdrop-filter: blur(1px)) { .ce-palette-overlay { backdrop-filter: blur(8px); } }
.ce-palette {
  width: 100%; max-width: 560px; height: fit-content; max-height: 60vh; border-radius: var(--radius-modal);
  box-shadow: var(--shadow-s3); display: flex; flex-direction: column; overflow: hidden;
  transform: scale(0.97); opacity: 0; animation: ce-modal-in var(--dur-panel) var(--spring) forwards;
}
.ce-palette-input-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--separator); flex: none; }
.ce-palette-input { flex: 1; border: none; background: transparent; font-size: 17px; outline: none; color: var(--text); }
.ce-palette-input::placeholder { color: var(--text-3); }
.ce-palette-list { overflow-y: auto; padding: 8px; }
.ce-palette-group-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.ce-palette-item {
  display: flex; align-items: center; gap: var(--space-3); padding: 10px; border-radius: var(--radius-inner);
  cursor: pointer; font-size: 14px; color: var(--text);
}
.ce-palette-item.is-active { background: var(--accent-tint); }
.ce-palette-item-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--separator); display: flex; align-items: center; justify-content: center; flex: none; color: var(--text-2); }
.ce-palette-empty { padding: 24px; text-align: center; color: var(--text-2); font-size: 14px; }

/* ========== APP SHELL: sidebar ========== */
/* Permanently icon-only by request -- no expand/collapse toggle, no
   stored preference, no width transition, so there's nothing for a
   page-load race to flash wide before narrowing. */
.ce-shell-sidebar {
  position: fixed; top: 16px; left: 16px; bottom: 16px; width: 72px; z-index: 30;
  display: flex; flex-direction: column; border-radius: var(--radius-card); box-shadow: var(--shadow-s1);
  padding: var(--space-4) var(--space-3); overflow: hidden;
}
.ce-sidebar-label,
.ce-sidebar-overline { display: none; }

/* Reused inside the profile popover's "Your plan" section now that
   the sidebar's own workspace switcher is gone. */
.ce-workspace-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-workspace-plan { display: inline-block; margin-top: 2px; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--accent-tint); color: var(--accent-solid); }

.ce-sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.ce-sidebar-overline { padding: 14px 10px 4px; }
.ce-sidebar-overline:first-child { padding-top: 2px; }
.ce-sidebar-link {
  display: flex; align-items: center; gap: var(--space-3); height: 40px; padding: 0 10px; border-radius: var(--radius-btn);
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; position: relative;
  transition: background var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.ce-sidebar-link svg { flex: none; }
.ce-sidebar-link:hover { background: var(--separator); color: var(--text); }
.ce-sidebar-link.is-active {
  background: var(--accent); color: #fff; box-shadow: 0 6px 16px -4px rgba(var(--accent-rgb), .45);
  transform: scale(1.03); transition: transform var(--dur-hover) var(--spring), box-shadow var(--dur-hover) var(--ease-out);
}
.ce-sidebar-link.is-active svg { color: #fff; }
.ce-sidebar-link-badge { margin-left: auto; background: var(--accent-solid); color: #fff; font-size: 10px; font-weight: 700; border-radius: var(--radius-pill); min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.ce-sidebar-link.is-active .ce-sidebar-link-badge { background: #fff; color: var(--accent-solid); }
.ce-sidebar-link-badge { position: absolute; top: 2px; right: 2px; margin-left: 0; }

.ce-sidebar-footer { flex: none; border-top: 1px solid var(--separator); padding-top: var(--space-3); margin-top: var(--space-3); }

/* ========== APP SHELL: top bar ========== */
.ce-shell-main { margin-left: 104px; min-height: 100vh; }
.ce-shell-topbar {
  /* The topbar stays full-width (just a 40px gutter, no cap) --
     .section-wrap below is widened to match this exact box instead
     of the other way around, so the topbar is never the thing that
     has to shrink to meet the content. */
  margin: 16px 40px 0;
  position: sticky; top: 16px; z-index: 20; height: 56px; border-radius: var(--radius-card);
  box-shadow: var(--shadow-s1); display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-5);
}
.ce-topbar-title { font-size: 15px; font-weight: 650; white-space: nowrap; }
.ce-topbar-logo { display: flex; align-items: center; flex: none; color: var(--text); }
.ce-topbar-logo svg { height: 26px; width: 26px; display: block; }
.ce-topbar-search {
  flex: 1; max-width: 360px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: var(--radius-pill); background: var(--separator); color: var(--text-3); font-size: 13px;
  cursor: pointer; border: none;
}
.ce-topbar-search kbd { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--glass-fallback-1); color: var(--text-2); font-family: var(--font-sans); }
.ce-topbar-spacer { flex: 1; }
.ce-topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.ce-credit-meter-wrap { position: relative; }
.ce-credit-meter { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); padding: 4px 12px 4px 4px; border-radius: var(--radius-pill); transition: background var(--dur-hover) var(--ease-out); }
.ce-credit-meter:hover { background: var(--separator); }
.ce-credit-meter-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-solid); flex: none; }
.ce-credit-meter-text { font-size: 12px; font-weight: 600; white-space: nowrap; }

.ce-credit-dropdown {
  display: none; position: absolute; top: calc(100% + 10px); right: 0; width: 260px; z-index: 40;
  background: var(--glass-fallback-1, #fff); border: 1px solid var(--separator); border-radius: var(--radius-card, 16px);
  box-shadow: var(--shadow-s1); padding: 14px 16px;
}
.ce-credit-meter-wrap:hover .ce-credit-dropdown { display: block; }
.ce-credit-dropdown-row + .ce-credit-dropdown-row { margin-top: 12px; }
.ce-credit-dropdown-row-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; color: var(--text); }
.ce-credit-dropdown-row-head span:last-child { font-size: 11px; font-weight: 500; color: var(--text-3, var(--mono-muted)); }
.ce-credit-dropdown-bar { height: 6px; border-radius: 4px; background: var(--separator); overflow: hidden; margin-top: 5px; }
.ce-credit-dropdown-bar span { display: block; height: 100%; background: var(--accent, #FF5A1F); border-radius: 4px; }
.ce-credit-dropdown-link { display: block; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--separator); font-size: 12px; font-weight: 700; color: var(--accent-solid, #D9420F); text-decoration: none; }

.ce-topbar-status-pill {
  display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text);
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill);
  background: var(--glass-fallback-3); border: 1px solid var(--separator); white-space: nowrap;
  transition: background var(--dur-hover) var(--ease-out);
}
.ce-topbar-status-pill:hover { background: var(--accent-tint); }
.ce-topbar-status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-3); }
.ce-topbar-status-pill.is-success .ce-topbar-status-dot { background: var(--success); }
.ce-topbar-status-pill.is-info .ce-topbar-status-dot { background: var(--info); }
.ce-topbar-status-pill.is-warn .ce-topbar-status-dot { background: var(--warning); }
.ce-topbar-status-pill.is-danger .ce-topbar-status-dot { background: var(--danger); }

.ce-notif-popover, .ce-profile-popover {
  position: absolute; top: calc(100% + 10px); right: 0; width: 320px; border-radius: var(--radius-inner);
  box-shadow: var(--shadow-s2); z-index: 40; overflow: hidden;
}
.ce-profile-popover, .ce-notif-popover {
  /* Opaque by request -- neither should show content bleeding
     through the glass blur. Uses the theme's own opaque fallback
     instead of a literal #fff so it stays dark (and its light text
     stays legible) in dark mode. */
  background: var(--glass-fallback-2) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
.ce-profile-popover { width: 272px; padding: 14px 10px 8px; }
.ce-popover-wrap { position: relative; }

/* Profile popover: avatar/name/email + "Go to profile", then the
   workspace + plan that used to live in the sidebar's own switcher. */
.ce-profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 4px 8px 14px; }
.ce-profile-head .ce-avatar-lg { margin-bottom: 4px; }
.ce-profile-head-name { font-size: 14px; font-weight: 700; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-profile-head-email { font-size: 12px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-profile-go-btn { margin-top: 8px; height: 32px; padding: 0 18px; font-size: 13px; text-decoration: none; }
.ce-profile-divider { height: 1px; background: var(--separator); margin: 6px 2px; }
.ce-profile-plan { padding: 6px 8px 8px; }
.ce-profile-plan .ce-text-overline { margin-bottom: 4px; }
.ce-profile-plan .ce-workspace-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: normal; }
.ce-profile-plan .ce-workspace-plan { margin-top: 6px; }

.ce-credit-banner {
  margin: 10px 16px 0; padding: 10px 16px; border-radius: var(--radius-inner); display: flex; align-items: center;
  justify-content: space-between; gap: var(--space-4); font-size: 13px; box-shadow: var(--shadow-s1);
  animation: ce-fade-rise var(--dur-panel) var(--ease-out) both;
}
.ce-credit-banner.is-warning { background: var(--warning-tint); color: var(--warning); }
.ce-credit-banner.is-critical { background: var(--danger-tint); color: var(--danger); }
.ce-credit-banner-dismiss { background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; flex: none; }
.ce-credit-banner-dismiss:hover { opacity: 1; }

/* Horizontal padding lives only on each page's own .section-wrap now
   -- this used to also add var(--space-4) on each side, stacking on
   top of section-wrap's padding, while the topbar (moved out of
   .page to be ce-shell-main's direct child, see app-shell.js) never
   got that extra layer. That mismatch is exactly what pushed the
   topbar's edges further out than the cards below it. */
.ce-shell-content { padding: var(--space-4) 0 var(--space-7); max-width: none; }
/* .section-wrap's own 1280px cap (shared with the public marketing
   site) is narrower than .ce-shell-topbar's full-width box above it
   on a wide screen. Rather than shrink the topbar to match, widen the
   content here instead -- same 40px side gutter as the topbar, no
   cap -- scoped to .ce-shell-content so the public site's own use of
   .section-wrap is untouched. */
.ce-shell-content .section-wrap { max-width: none; padding-left: 40px; padding-right: 40px; }

/* bottom tab bar (<900px) */
.ce-shell-tabbar {
  display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; height: 64px;
  border-radius: var(--radius-card); box-shadow: var(--shadow-s2); align-items: center; justify-content: space-around;
}
.ce-tabbar-link { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-3); text-decoration: none; font-size: 10px; font-weight: 600; position: relative; }
.ce-tabbar-link.is-active { color: var(--accent); }
.ce-tabbar-link .ce-sidebar-link-badge { position: absolute; top: -4px; right: 6px; }

@media (max-width: 900px) {
  .ce-shell-sidebar { display: none; }
  .ce-shell-main { margin-left: 0; }
  .ce-shell-topbar { margin: 12px 12px 0; }
  .ce-shell-content { padding: var(--space-5) 0 88px; }
  .ce-shell-tabbar { display: flex; }
  .ce-topbar-search { display: none; }
}

@media (max-width: 1150px) {
  .ce-topbar-status-pill { display: none; }
}

/* floating support chat widget */
.ce-chat-bubble {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 52px; height: 52px; border-radius: 50%;
  background: var(--ink); color: var(--paper); border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-s2); transition: transform .15s ease;
}
.ce-chat-bubble:hover { transform: scale(1.06); }
.ce-chat-bubble.is-open { background: var(--text-3); }
.ce-chat-bubble-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  background: var(--danger, #d64545); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.ce-chat-panel {
  position: fixed; right: 20px; bottom: 84px; z-index: 60; width: 380px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - 120px); border-radius: var(--radius-card); box-shadow: var(--shadow-s3);
  display: flex; flex-direction: column; overflow: hidden;
}
.ce-chat-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 14px 16px;
  border-bottom: 1px solid var(--separator, rgba(18,18,18,.08)); flex: none;
}
.ce-chat-panel-title { font-weight: 800; font-size: 14px; }
.ce-chat-panel-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ce-chat-panel-head button { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-3); line-height: 1; }
.ce-chat-panel-head button:hover { color: var(--ink); }
.ce-chat-thread { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ce-chat-empty { font-size: 13px; color: var(--text-3); line-height: 1.5; }
.ce-chat-bubble-msg {
  max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.4; position: relative;
}
.ce-chat-bubble-msg.is-out { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.ce-chat-bubble-msg.is-in { align-self: flex-start; background: var(--surface-2, rgba(18,18,18,.06)); border-bottom-left-radius: 4px; }
.ce-chat-msg-time { display: block; margin-top: 4px; font-size: 10px; opacity: .65; }
.ce-chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--separator, rgba(18,18,18,.08)); flex: none; }
.ce-chat-compose textarea {
  flex: 1; resize: none; border: 1px solid var(--separator, rgba(18,18,18,.12)); border-radius: 10px; padding: 8px 10px;
  font: inherit; font-size: 13px; max-height: 80px;
}
.ce-chat-compose button {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.ce-chat-compose button:disabled { opacity: .5; cursor: default; }

@media (max-width: 900px) {
  .ce-chat-bubble { bottom: 92px; }
  .ce-chat-panel { bottom: 156px; right: 16px; }
}

/* support widget: tabs, tickets, history */
.ce-chat-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--separator, rgba(18,18,18,.08)); flex: none; }
.ce-chat-tab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 6px 10px; font: inherit; font-size: 13px; font-weight: 700; color: var(--text-3, #77766f); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ce-chat-tab:hover { color: var(--ink); }
.ce-chat-tab.is-active { color: var(--ink); border-bottom-color: var(--accent, #FF5A1F); }
.ce-chat-tab:focus-visible { outline: 2px solid var(--accent, #FF5A1F); outline-offset: -2px; border-radius: 6px; }
.ce-tab-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--accent, #FF5A1F); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.ce-chat-views { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ce-chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.ce-chat-view[hidden] { display: none; }
#ce-v-chat .ce-chat-thread { flex: 1; min-height: 0; }
.ce-chat-empty-state { padding: 36px 24px; text-align: center; color: var(--text-3, #77766f); font-size: 13px; line-height: 1.5; }
.ce-chat-empty-state strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 6px; }
.ce-tk-list { padding: 6px 10px 12px; }
.ce-tk-group { font: 700 10.5px 'IBM Plex Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3, #77766f); padding: 12px 6px 6px; }
.ce-tk-row { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: var(--surface-2, rgba(18,18,18,.04)); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.ce-tk-row:hover, .ce-tk-row:focus-visible { border-color: var(--accent, #FF5A1F); outline: none; }
.ce-tk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ce-tk-title { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ce-tk-row.is-unread .ce-tk-title { color: var(--ink); }
.ce-tk-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent, #FF5A1F); margin-right: 6px; vertical-align: middle; }
.ce-tk-meta { font-size: 11.5px; color: var(--text-3, #77766f); }
.ce-tk-prev { font-size: 12px; color: var(--text-2, #55554F); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-tk-pill { flex: none; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #E6EEF8; color: #1F4E8C; white-space: nowrap; }
.ce-tk-pill.is-in_progress { background: #FFF1D6; color: #7A4F00; }
.ce-tk-pill.is-waiting_on_customer { background: #FCE4EC; color: #9D174D; }
.ce-tk-pill.is-resolved { background: #E1F3E7; color: #17703A; }
.ce-tk-pill.is-closed { background: #E6E4DC; color: #2B2A26; }
.ce-tk-detail { padding: 10px 14px 16px; }
.ce-tk-back { background: none; border: none; padding: 4px 0; font: inherit; font-size: 12.5px; color: var(--text-3, #77766f); cursor: pointer; }
.ce-tk-back:hover { color: var(--ink); }
.ce-tk-dtitle { font-size: 15px; font-weight: 800; margin: 6px 0 2px; overflow-wrap: anywhere; }
.ce-tk-num { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3, #77766f); white-space: nowrap; }
.ce-tk-steps { display: flex; list-style: none; margin: 14px 0 10px; padding: 0; }
.ce-tk-steps li { flex: 1; position: relative; text-align: center; font-size: 10.5px; color: var(--text-3, #77766f); padding-top: 18px; }
.ce-tk-steps li::before { content: ""; position: absolute; top: 3px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; border: 2px solid var(--separator, rgba(18,18,18,.18)); background: transparent; }
.ce-tk-steps li::after { content: ""; position: absolute; top: 7px; left: calc(50% + 9px); right: calc(-50% + 9px); height: 2px; background: var(--separator, rgba(18,18,18,.12)); }
.ce-tk-steps li:last-child::after { display: none; }
.ce-tk-steps li.is-done::before { background: var(--ink); border-color: var(--ink); }
.ce-tk-steps li.is-done::after { background: var(--ink); }
.ce-tk-steps li.is-current { color: var(--ink); font-weight: 700; }
.ce-tk-steps li.is-current::before { background: var(--accent, #FF5A1F); border-color: var(--accent, #FF5A1F); }
.ce-tk-steps li.is-attn.is-current::before { background: #C2185B; border-color: #C2185B; }
.ce-tk-banner { padding: 9px 12px; border-radius: 10px; background: #FCE4EC; color: #9D174D; font-size: 12.5px; margin: 8px 0; }
.ce-tk-banner.is-good { background: #E1F3E7; color: #17703A; }
.ce-tk-link { background: none; border: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 700; }
.ce-tk-section { font: 700 10.5px 'IBM Plex Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3, #77766f); margin: 14px 0 6px; }
.ce-tk-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.ce-tk-desc { padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(18,18,18,.04)); }
.ce-tk-update { padding: 10px 12px; border-radius: 12px; background: var(--accent-tint, rgba(255,90,31,.08)); margin-bottom: 8px; }
.ce-tk-update-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3, #77766f); margin-bottom: 3px; }
.ce-tk-update-head b { color: var(--ink); }
.ce-tk-evt { text-align: center; font: 11px 'IBM Plex Mono', monospace; color: var(--text-3, #77766f); margin: 8px 0; }
.ce-hist-thread { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
body[data-theme="dark"] .ce-tk-pill { background: rgba(31,78,140,.35); color: #A9C8F2; }
body[data-theme="dark"] .ce-tk-pill.is-in_progress { background: rgba(224,160,40,.2); color: #F0B84A; }
body[data-theme="dark"] .ce-tk-pill.is-waiting_on_customer { background: rgba(236,72,153,.2); color: #F9A8D4; }
body[data-theme="dark"] .ce-tk-pill.is-resolved { background: rgba(46,158,107,.2); color: #6FD39E; }
body[data-theme="dark"] .ce-tk-pill.is-closed { background: #2A2A26; color: #B9B8B1; }
body[data-theme="dark"] .ce-tk-banner { background: rgba(236,72,153,.16); color: #F9A8D4; }
body[data-theme="dark"] .ce-tk-banner.is-good { background: rgba(46,158,107,.16); color: #6FD39E; }
body[data-theme="dark"] .ce-tk-steps li::before { border-color: #3A3935; }
body[data-theme="dark"] .ce-tk-steps li::after { background: #3A3935; }
body[data-theme="dark"] .ce-tk-steps li.is-done::before, body[data-theme="dark"] .ce-tk-steps li.is-done::after { background: var(--paper); border-color: var(--paper); }
body[data-theme="dark"] .ce-tk-steps li.is-current::before { background: var(--accent, #FF5A1F); border-color: var(--accent, #FF5A1F); }
body[data-theme="dark"] .ce-tk-steps li.is-attn.is-current::before { background: #F472B6; border-color: #F472B6; }
body[data-theme="dark"] .ce-tk-row, body[data-theme="dark"] .ce-tk-desc { background: #1B1B19; }
body[data-theme="dark"] .ce-tk-row { color: var(--paper); }
body[data-theme="dark"] .ce-tk-update-head b, body[data-theme="dark"] .ce-chat-tab.is-active, body[data-theme="dark"] .ce-chat-empty-state strong { color: var(--paper); }

/* support widget: dark-mode fixes */
body[data-theme="dark"] .ce-tk-row.is-unread .ce-tk-title,
body[data-theme="dark"] .ce-tk-steps li.is-current,
body[data-theme="dark"] .ce-chat-tab:hover,
body[data-theme="dark"] .ce-tk-back:hover,
body[data-theme="dark"] .ce-chat-panel-head button:hover { color: var(--paper); }
body[data-theme="dark"] .ce-chat-bubble-msg.is-in { background: #232320; color: var(--paper); }
body[data-theme="dark"] .ce-chat-bubble-msg.is-out { background: #34332E; color: var(--paper); }
body[data-theme="dark"] .ce-chat-compose textarea { background: #131313; color: var(--paper); border-color: #2E2D29; }
body[data-theme="dark"] .ce-tk-update { background: rgba(255, 90, 31, .12); }
