/* Closer Engine v2: flat redesign layer.
   Loaded after styles/app.css on every tenant page (never on the admin portal).
   Everything is scoped to html[data-ce-v2], so removing that attribute
   (or this file) restores the previous look.

   Sections: 1 tokens (styles/tokens.css) | 2 base | 3 components | 4 shell | 5 support panel & overlays | 6 Home | 7 Books | 8 admin portal and older cards

   Rules of the system: one white panel on a pale canvas, hairline dividers,
   no shadows on cards, no gradients, Inter only, sentence case, 8px controls
   and 12px containers (the shell keeps its pill search and credits),
   one accent (orange) for primary actions and active states, and red / green /
   amber for status only. */
@import url("tokens.css");


/* =====================================================================
   1. TOKENS live in styles/tokens.css (the html[data-ce-v2] block at the end)
   ===================================================================== */

/* =====================================================================
   2. BASE
   ===================================================================== */
html[data-ce-v2] body {
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-feature-settings: normal;
  font-variant-numeric: normal;
  font-size: 14px;
  line-height: 1.5;
}
html[data-ce-v2] .ce-bg-layer { display: none; }

/* Inter only, sentence case, no tracking: the legacy pages still carry
   Archivo / IBM Plex Mono / uppercase labels, so this is enforced globally. */
html[data-ce-v2] body,
html[data-ce-v2] body * {
  font-family: var(--font) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

html[data-ce-v2] .ce-shell-content h1 { font-size: 24px; line-height: 32px; font-weight: 600; color: var(--text); }
html[data-ce-v2] .ce-shell-content h2 { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--text); }
html[data-ce-v2] .ce-shell-content h3 { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--text); }

html[data-ce-v2] .ce-text-large-title { font-size: 28px; line-height: 36px; font-weight: 600; }
html[data-ce-v2] .ce-text-title { font-size: 20px; line-height: 28px; font-weight: 600; }
html[data-ce-v2] .ce-text-headline { font-size: 16px; line-height: 24px; font-weight: 600; }
html[data-ce-v2] .ce-text-body { font-size: 14px; line-height: 22px; }
html[data-ce-v2] .ce-text-callout { font-size: 13px; line-height: 18px; font-weight: 500; }
html[data-ce-v2] .ce-text-caption { font-size: 12px; line-height: 16px; color: var(--text-2); }
html[data-ce-v2] .ce-text-overline { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-3); }
html[data-ce-v2] .ce-text-kpi { font-size: 32px; line-height: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* flatten the old glass surfaces wherever they still appear */
html[data-ce-v2] .ce-glass-1,
html[data-ce-v2] .ce-glass-2,
html[data-ce-v2] .ce-glass-3 {
  background: #fff;
  border: 1px solid var(--line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
html[data-ce-v2] .ce-glass-1::before { display: none; }

html[data-ce-v2] :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}
html[data-ce-v2] ::selection { background: var(--accent-tint); color: var(--text); }
html[data-ce-v2] :where(a:not([class])) { color: var(--accent-text); }
html[data-ce-v2] :where(a:not([class])):hover { color: var(--accent-hover); }
html[data-ce-v2] input[type="checkbox"],
html[data-ce-v2] input[type="radio"] { accent-color: var(--accent-solid); }

/* =====================================================================
   3. COMPONENTS
   ===================================================================== */

/* ---------- Button ----------
   Primary = filled accent. Secondary = outlined. Ghost = text only.
   Legacy .btn-primary / .btn-dark map onto primary / secondary. */
html[data-ce-v2] .ce-btn,
html[data-ce-v2] .btn-primary,
html[data-ce-v2] .btn-dark {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 20px; border-radius: var(--radius-control);
  border: 1px solid transparent; font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer; box-shadow: none; background-image: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; filter: none; transform: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
html[data-ce-v2] .ce-btn:active, html[data-ce-v2] .btn-primary:active, html[data-ce-v2] .btn-dark:active { transform: none; }

html[data-ce-v2] .ce-btn-primary,
html[data-ce-v2] .btn-primary {
  background: var(--accent-solid); border-color: var(--accent-solid); color: #fff;
}
html[data-ce-v2] .ce-btn-primary:hover,
html[data-ce-v2] .btn-primary:hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; filter: none; box-shadow: none;
}

html[data-ce-v2] .ce-btn-secondary,
html[data-ce-v2] .btn-dark {
  background: #fff; border-color: var(--line-strong); color: var(--text);
}
html[data-ce-v2] .ce-btn-secondary:hover,
html[data-ce-v2] .btn-dark:hover {
  background: var(--fill); border-color: var(--line-strong); color: var(--text);
}

html[data-ce-v2] .ce-btn-tertiary,
html[data-ce-v2] .ce-btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
html[data-ce-v2] .ce-btn-tertiary:hover,
html[data-ce-v2] .ce-btn-ghost:hover { background: var(--fill-2); color: var(--text); }

html[data-ce-v2] .ce-btn-destructive { background: #fff; border-color: #EFC2C2; color: var(--danger); }
html[data-ce-v2] .ce-btn-destructive:hover { background: var(--danger-tint); border-color: #E7A9A9; color: var(--danger); filter: none; }

html[data-ce-v2] .ce-btn-sm { height: var(--control-h-sm); padding: 0 14px; font-size: 13px; }
html[data-ce-v2] .ce-btn-lg { height: var(--control-h-lg); padding: 0 28px; font-size: 15px; }
html[data-ce-v2] .ce-btn-icon { width: var(--control-h); padding: 0; }
html[data-ce-v2] .ce-btn-icon.ce-btn-sm { width: var(--control-h-sm); }

html[data-ce-v2] .ce-btn[disabled], html[data-ce-v2] .ce-btn.is-disabled,
html[data-ce-v2] .btn-primary[disabled], html[data-ce-v2] .btn-primary.is-disabled,
html[data-ce-v2] .btn-dark[disabled], html[data-ce-v2] .btn-dark.is-disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none; box-shadow: none; transform: none;
}

html[data-ce-v2] .ce-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h); height: var(--control-h); border-radius: 50%;
  border: 0; background: transparent; color: var(--text-2); box-shadow: none; backdrop-filter: none;
  cursor: pointer; position: relative; transition: background-color 120ms ease, color 120ms ease;
}
html[data-ce-v2] .ce-icon-btn:hover { background: var(--fill-2); color: var(--text); }
html[data-ce-v2] .ce-icon-btn:active { transform: none; }

/* ---------- Input / Select / Textarea ----------
   Pill-shaped. Legacy .book-field controls follow. */
html[data-ce-v2] .ce-input,
html[data-ce-v2] .ce-select,
html[data-ce-v2] .ce-textarea,
html[data-ce-v2] .book-field input:not([type="checkbox"]):not([type="radio"]),
html[data-ce-v2] .book-field select,
html[data-ce-v2] .book-field textarea {
  width: 100%; height: var(--control-h); padding: 0 16px; border-radius: var(--radius-control);
  background: #fff; border: 1px solid var(--line-strong); color: var(--text);
  font-size: 14px; box-shadow: none; backdrop-filter: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
html[data-ce-v2] .ce-textarea,
html[data-ce-v2] .book-field textarea { height: auto; min-height: 88px; padding: 12px 16px; border-radius: var(--radius-control); line-height: 1.5; resize: vertical; }
html[data-ce-v2] .ce-input:hover, html[data-ce-v2] .ce-select:hover, html[data-ce-v2] .ce-textarea:hover { border-color: #AEB7C4; }
html[data-ce-v2] .ce-input:focus, html[data-ce-v2] .ce-select:focus, html[data-ce-v2] .ce-textarea:focus,
html[data-ce-v2] .book-field input:focus, html[data-ce-v2] .book-field select:focus, html[data-ce-v2] .book-field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); box-shadow: none;
}
html[data-ce-v2] .ce-input::placeholder, html[data-ce-v2] .ce-textarea::placeholder,
html[data-ce-v2] .book-field input::placeholder, html[data-ce-v2] .book-field textarea::placeholder { color: var(--text-3); }
html[data-ce-v2] .ce-input[disabled], html[data-ce-v2] .ce-select[disabled], html[data-ce-v2] .ce-textarea[disabled] { background: var(--fill); color: var(--text-3); cursor: not-allowed; }
html[data-ce-v2] .ce-input.is-error, html[data-ce-v2] .ce-select.is-error, html[data-ce-v2] .ce-textarea.is-error { border-color: var(--danger); }
html[data-ce-v2] .ce-field-error { margin-top: 4px; font-size: 12px; color: var(--danger); }
html[data-ce-v2] .book-field label { font-size: 13px; font-weight: 500; color: var(--text-2); }

html[data-ce-v2] .ce-select,
html[data-ce-v2] .book-field select {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234B5565' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}

html[data-ce-v2] .ce-input-wrap .ce-input-icon { left: 14px; color: var(--text-3); }
html[data-ce-v2] .ce-input-wrap .ce-input { padding-left: 40px; }
html[data-ce-v2] .ce-input-wrap .ce-input-clear { background: var(--fill-2); }

/* custom dropdown (the JS-driven select) */
html[data-ce-v2] .ce-dropdown-trigger { border-radius: var(--radius-control); }
html[data-ce-v2] .ce-dropdown-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--overlay-shadow); padding: 6px;
}
html[data-ce-v2] .ce-dropdown-opt { border-radius: 8px; }
html[data-ce-v2] .ce-dropdown-opt:hover, html[data-ce-v2] .ce-dropdown-opt.is-highlighted { background: var(--fill); }

/* ---------- Checkbox / switch ---------- */
html[data-ce-v2] .ce-checkbox { gap: 10px; font-size: 14px; }
html[data-ce-v2] .ce-checkbox-box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong); background: #fff;
}
html[data-ce-v2] .ce-checkbox input:checked ~ .ce-checkbox-box,
html[data-ce-v2] .ce-checkbox input:indeterminate ~ .ce-checkbox-box { background: var(--accent-solid); border-color: var(--accent-solid); }
html[data-ce-v2] .ce-checkbox input:focus-visible ~ .ce-checkbox-box { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }
html[data-ce-v2] .ce-switch { width: 40px; height: 24px; }
html[data-ce-v2] .ce-switch-track { background: var(--line-strong); }
html[data-ce-v2] .ce-switch input:checked ~ .ce-switch-track { background: var(--accent-solid); }
html[data-ce-v2] .ce-switch-knob { top: 2px; left: 2px; width: 20px; height: 20px; box-shadow: none; }
html[data-ce-v2] .ce-switch input:checked ~ .ce-switch-knob { transform: translateX(16px); }
html[data-ce-v2] .ce-switch input:focus-visible ~ .ce-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }

/* ---------- Badge ----------
   Status only. Neutral gray by default; red / green / amber / blue for state.
   .ce-badge-solid fills it (e.g. an "Inactive" pill). Legacy .ce-chip follows. */
html[data-ce-v2] .ce-badge,
html[data-ce-v2] .ce-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--fill-2); color: var(--text-2);
}
html[data-ce-v2] .ce-badge-neutral, html[data-ce-v2] .ce-chip-neutral { background: var(--fill-2); color: var(--text-2); }
html[data-ce-v2] .ce-badge-success, html[data-ce-v2] .ce-chip-success { background: var(--success-tint); color: var(--success); }
html[data-ce-v2] .ce-badge-danger, html[data-ce-v2] .ce-chip-danger { background: var(--danger-tint); color: var(--danger); }
html[data-ce-v2] .ce-badge-warning, html[data-ce-v2] .ce-chip-warning { background: var(--warning-tint); color: var(--warning); }
html[data-ce-v2] .ce-badge-info, html[data-ce-v2] .ce-chip-info { background: var(--info-tint); color: var(--info); }
html[data-ce-v2] .ce-badge-accent { background: var(--accent-tint); color: var(--accent-text); }
html[data-ce-v2] .ce-badge-solid.ce-badge-danger { background: var(--danger); color: #fff; }
html[data-ce-v2] .ce-badge-solid.ce-badge-success { background: var(--success); color: #fff; }
html[data-ce-v2] .ce-badge-solid.ce-badge-warning { background: var(--warning); color: #fff; }
html[data-ce-v2] .ce-badge-dot::before, html[data-ce-v2] .ce-chip-dot { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
html[data-ce-v2] .ce-tag-chip { background: var(--fill-2); color: var(--text-2); }
html[data-ce-v2] .ce-delta-chip { background: var(--fill-2); }

/* ---------- Table ----------
   Flat: a hairline border around the wrapper, hairline row dividers,
   muted sentence-case headers. No shadow, no sticky blur. */
html[data-ce-v2] .ce-table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: none; overflow: hidden; }
html[data-ce-v2] .ce-table { width: 100%; border-collapse: collapse; font-size: 14px; }
html[data-ce-v2] .ce-table thead th {
  background: #fff; backdrop-filter: none; padding: 0 16px; height: 44px;
  font-size: 13px; font-weight: 600; color: var(--text-2); text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
html[data-ce-v2] .ce-table tbody tr { height: 52px; border-bottom: 1px solid var(--line); }
html[data-ce-v2] .ce-table tbody tr:last-child { border-bottom: 0; }
html[data-ce-v2] .ce-table tbody tr:hover { background: #F8F9FC; }
html[data-ce-v2] .ce-table tbody tr.is-selected { background: var(--accent-tint); }
html[data-ce-v2] .ce-table td { padding: 0 16px; color: var(--text); }
html[data-ce-v2] .ce-table td.is-muted { color: var(--text-2); }
html[data-ce-v2] .ce-table .ce-cell-check { width: 48px; padding-right: 0; }
html[data-ce-v2] .ce-table .ce-num { text-align: right; font-variant-numeric: tabular-nums; }
html[data-ce-v2] .ce-table .ce-row-actions { opacity: 0; }
html[data-ce-v2] .ce-table tbody tr:hover .ce-row-actions, html[data-ce-v2] .ce-table tbody tr:focus-within .ce-row-actions { opacity: 1; }
html[data-ce-v2] .ce-bulk-bar { background: #fff; border: 1px solid var(--line); box-shadow: var(--overlay-shadow); }

/* ---------- Card (flat, for page content) ---------- */
html[data-ce-v2] .ce-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: none; padding: 20px; }
html[data-ce-v2] .ce-card.is-clickable:hover { transform: none; box-shadow: none; border-color: var(--line-strong); }
html[data-ce-v2] .ce-card-head { padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
html[data-ce-v2] .ce-card-title { font-size: 15px; line-height: 22px; font-weight: 600; }

/* ---------- Empty state ----------
   Own illustration, one line, one button. Put it on its own, or inside
   .ce-ghost-wrap so ghost rows show behind an empty table. */
html[data-ce-v2] .ce-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: 56px 24px; }
html[data-ce-v2] .ce-empty-art { display: block; width: 160px; height: 120px; }
html[data-ce-v2] .ce-empty p { margin: 0; max-width: 360px; font-size: 14px; line-height: 22px; color: var(--text-2); }
html[data-ce-v2] .ce-ghost-wrap { position: relative; min-height: 380px; border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff; overflow: hidden; }
html[data-ce-v2] .ce-ghost-rows { opacity: 0.7; pointer-events: none; }
html[data-ce-v2] .ce-ghost-row { display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); }
html[data-ce-v2] .ce-ghost-row:first-child { height: 44px; }
html[data-ce-v2] .ce-ghost-row i { display: block; height: 10px; border-radius: 5px; background: var(--fill-2); }
html[data-ce-v2] .ce-ghost-row i.cb { width: 18px; height: 18px; border-radius: 5px; flex: none; }
html[data-ce-v2] .ce-ghost-wrap > .ce-empty { position: absolute; inset: 0; justify-content: center; background: rgba(255, 255, 255, 0.55); }

/* ---------- Banner ----------
   A flat tinted strip, used only when there is something to act on. */
html[data-ce-v2] .ce-banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff;
  font-size: 14px; line-height: 20px; color: var(--text);
}
html[data-ce-v2] .ce-banner[hidden] { display: none; }
html[data-ce-v2] .ce-banner-text { flex: 1; min-width: 0; }
html[data-ce-v2] .ce-banner-actions { display: flex; align-items: center; gap: 8px; flex: none; }
html[data-ce-v2] .ce-banner-dismiss {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-2); cursor: pointer;
}
html[data-ce-v2] .ce-banner-dismiss:hover { background: rgba(23, 26, 33, 0.06); color: var(--text); }
html[data-ce-v2] .ce-banner.is-info { background: var(--info-tint); border-color: #CFE0F8; }
html[data-ce-v2] .ce-banner.is-warning { background: var(--warning-tint); border-color: #F3DFB4; }
html[data-ce-v2] .ce-banner.is-danger { background: var(--danger-tint); border-color: #F1CACA; }
html[data-ce-v2] .ce-banner.is-success { background: var(--success-tint); border-color: #C9E8D6; }
html[data-ce-v2] .ce-banner.is-accent { background: var(--accent-tint); border-color: #FFD9C8; }

/* ---------- Sub-navigation (second column inside the panel) ---------- */
html[data-ce-v2] .ce-split { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 56px - 14px); }
html[data-ce-v2] .ce-subnav { display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; border-right: 1px solid var(--line); }
html[data-ce-v2] .ce-subnav-title { padding: 4px 12px 12px; font-size: 16px; font-weight: 600; }
html[data-ce-v2] .ce-subnav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 999px; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 0; background: transparent; text-align: left; width: 100%;
}
html[data-ce-v2] .ce-subnav-item:hover { background: var(--fill); color: var(--text); }
html[data-ce-v2] .ce-subnav-item.is-active { background: var(--accent-tint); color: var(--accent-text); box-shadow: inset 3px 0 0 var(--accent); }
html[data-ce-v2] .ce-subnav-count { font-size: 12px; font-weight: 600; color: var(--text-3); }
html[data-ce-v2] .ce-subnav-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Info icon with tooltip ---------- */
html[data-ce-v2] .ce-info {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  color: var(--text-3); vertical-align: middle; cursor: help; border: 0; background: transparent; padding: 0;
}
html[data-ce-v2] .ce-info svg { width: 16px; height: 16px; }
html[data-ce-v2] .ce-info[data-tip]:hover::after,
html[data-ce-v2] .ce-info[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 60; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 240px; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line);
  box-shadow: var(--overlay-shadow); color: var(--text); font-size: 12px; font-weight: 400; line-height: 18px; text-align: left; white-space: normal;
}

/* ---------- Tooltip, toast, modal, palette: flat, one hairline ---------- */
html[data-ce-v2] .ce-tooltip { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: var(--overlay-shadow); border-radius: 8px; }
html[data-ce-v2] .ce-toast { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: var(--overlay-shadow); border-radius: var(--radius-card); }
html[data-ce-v2] .ce-modal-overlay { background: rgba(23, 26, 33, 0.4); backdrop-filter: none; }
html[data-ce-v2] .ce-modal { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-modal); box-shadow: var(--overlay-shadow); padding: 28px; backdrop-filter: none; }
html[data-ce-v2] .ce-modal-title { font-size: 18px; font-weight: 600; }
html[data-ce-v2] .ce-modal-body { font-size: 14px; }
html[data-ce-v2] .ce-modal-sticky-footer { background: #fff; }
html[data-ce-v2] .ce-palette-overlay { background: rgba(23, 26, 33, 0.4); backdrop-filter: none; }
html[data-ce-v2] .ce-palette { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: var(--overlay-shadow); backdrop-filter: none; }
html[data-ce-v2] .ce-palette-group-label { font-size: 12px; font-weight: 500; color: var(--text-3); }
html[data-ce-v2] .ce-palette-item { border-radius: 10px; }
html[data-ce-v2] .ce-palette-item.is-active { background: var(--fill); }
html[data-ce-v2] .ce-palette-item-icon { background: var(--fill); border-radius: 8px; }
html[data-ce-v2] .ce-segmented { background: var(--fill); border: 1px solid var(--line); backdrop-filter: none; }
html[data-ce-v2] .ce-segmented-thumb { background: #fff; box-shadow: none; border: 1px solid var(--line); }
html[data-ce-v2] .ce-avatar { background: var(--accent-tint); color: var(--accent-text); }

/* ---------- Page header, Panel, Segmented control, Tabs, small Toggle ----------
   Content-area primitives. Colors, radii and sizes come from the tokens. */
html[data-ce-v2] .ce-page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
html[data-ce-v2] h1.ce-page-title, html[data-ce-v2] .ce-page-title { margin: 0; font-size: var(--fs-24); line-height: 32px; font-weight: var(--fw-semibold); color: var(--c-text); }
html[data-ce-v2] .ce-page-tools { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }

html[data-ce-v2] .ce-panel { min-width: 0; padding: var(--space-5); background: var(--panel); border: 1px solid var(--c-border); border-radius: var(--radius-container); box-shadow: none; }
html[data-ce-v2] .ce-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); border-bottom: 1px solid var(--c-border); }
html[data-ce-v2] h2.ce-panel-title, html[data-ce-v2] .ce-panel-title { margin: 0; padding-bottom: var(--space-3); font-size: var(--fs-16); line-height: 24px; font-weight: var(--fw-semibold); color: var(--c-text); }
html[data-ce-v2] .ce-panel-tools { display: flex; align-items: center; gap: var(--space-4); padding-bottom: var(--space-3); font-size: var(--fs-13); line-height: 24px; color: var(--c-muted); }
html[data-ce-v2] .ce-link { color: var(--c-muted); font-size: var(--fs-13); text-decoration: none; }
html[data-ce-v2] .ce-link:hover { color: var(--c-text); text-decoration: underline; }

html[data-ce-v2] .ce-seg { display: inline-flex; padding: var(--space-1); background: var(--c-track); border-radius: var(--radius-control); }
html[data-ce-v2] .ce-seg-opt {
  height: 28px; padding: 0 var(--space-3); border: 1px solid transparent; border-radius: calc(var(--radius-control) - 2px);
  background: transparent; color: var(--c-muted); font-size: var(--fs-13); font-weight: 500; white-space: nowrap; cursor: pointer;
}
html[data-ce-v2] .ce-seg-opt:hover { color: var(--c-text); }
html[data-ce-v2] .ce-seg-opt.is-active { background: var(--panel); border-color: var(--c-border); color: var(--c-text); font-weight: var(--fw-semibold); }

html[data-ce-v2] .ce-tabs { display: flex; align-items: flex-end; gap: var(--space-5); }
html[data-ce-v2] .ce-tab {
  margin-bottom: -1px; padding: 0 0 var(--space-3); border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--c-muted); font-size: var(--fs-14); line-height: 24px; font-weight: 500; cursor: pointer;
}
html[data-ce-v2] .ce-tab:hover { color: var(--c-text); }
html[data-ce-v2] .ce-tab.is-active { color: var(--c-text); border-bottom-color: var(--accent); font-weight: var(--fw-semibold); }

html[data-ce-v2] .ce-switch.ce-switch-sm { width: 32px; height: 20px; }
html[data-ce-v2] .ce-switch.ce-switch-sm .ce-switch-knob { top: 2px; left: 2px; width: 16px; height: 16px; }
html[data-ce-v2] .ce-switch.ce-switch-sm input:checked ~ .ce-switch-knob { transform: translateX(12px); }
html[data-ce-v2] .ce-toggle-row { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--c-muted); font-size: var(--fs-13); cursor: pointer; user-select: none; }

html[data-ce-v2] .ce-kpi-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin-bottom: var(--space-5);
  background: var(--c-border); border: 1px solid var(--c-border); border-radius: var(--radius-container); overflow: hidden;
}
html[data-ce-v2] .ce-kpi { min-width: 0; padding: var(--space-4) var(--space-5); background: var(--panel); }
html[data-ce-v2] .ce-kpi-label { font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }
html[data-ce-v2] .ce-kpi-value { margin-top: var(--space-1); font-size: var(--fs-28); line-height: 36px; font-weight: var(--fw-semibold); color: var(--c-text); font-variant-numeric: tabular-nums; }
html[data-ce-v2] .ce-kpi-delta { margin-top: var(--space-1); font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }
html[data-ce-v2] .ce-kpi-delta.is-good { color: var(--success); }
html[data-ce-v2] .ce-kpi-delta.is-bad { color: var(--danger); }
@media (max-width: 1100px) { html[data-ce-v2] .ce-kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { html[data-ce-v2] .ce-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* =====================================================================
   4. SHELL: top bar, rail, panel
   ===================================================================== */
html[data-ce-v2] .ce-shell-main { margin-left: 72px; padding-top: 56px; min-height: 100vh; }
html[data-ce-v2].ce-no-rail .ce-shell-main { margin-left: 0; }

/* top bar: plain strip on the canvas. logo | centered search | bell, credits, avatar */
html[data-ce-v2] .ce-shell-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: 56px; margin: 0;
  display: grid; grid-template-columns: 1fr minmax(240px, 520px) 1fr; align-items: center; gap: 16px;
  padding: 0 16px 0 18px; border: 0; border-radius: 0; background: var(--canvas); box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-ce-v2] .ce-topbar-logo { display: inline-flex; align-items: center; gap: 10px; justify-self: start; color: var(--text); text-decoration: none; }
html[data-ce-v2] .ce-topbar-logo:hover { color: var(--text); }
html[data-ce-v2] .ce-topbar-logo svg { width: 28px; height: 28px; }
html[data-ce-v2] .ce-topbar-wordmark { font-size: 16px; font-weight: 600; white-space: nowrap; }
html[data-ce-v2] .ce-topbar-search {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: none; height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text-3);
  font-size: 14px; cursor: pointer; text-align: left;
}
html[data-ce-v2] .ce-topbar-search:hover { border-color: var(--line-strong); }
html[data-ce-v2] .ce-topbar-search span { flex: 1; }
html[data-ce-v2] .ce-topbar-search kbd { margin: 0; padding: 0; border: 0; background: transparent; color: var(--text-3); font-size: 12px; }
html[data-ce-v2] .ce-topbar-actions { display: flex; align-items: center; gap: 4px; justify-self: end; }

html[data-ce-v2] #notif-btn .ce-sidebar-link-badge { top: 2px; right: 0; left: auto; }

html[data-ce-v2] .ce-credit-meter-wrap { position: relative; margin: 0 6px; }
html[data-ce-v2] .ce-credit-meter {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none;
}
html[data-ce-v2] .ce-credit-meter:hover { background: var(--fill); color: var(--text); }
html[data-ce-v2] .ce-credit-meter-icon { width: auto; height: auto; background: transparent; color: var(--text-2); display: inline-flex; }
html[data-ce-v2] .ce-credit-meter-text { font-size: 13px; font-weight: 600; }
html[data-ce-v2] .ce-credit-dropdown { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--overlay-shadow); }
html[data-ce-v2] .ce-credit-dropdown-bar { background: var(--fill-2); }
html[data-ce-v2] .ce-credit-dropdown-bar span { background: var(--accent); }
html[data-ce-v2] .ce-credit-dropdown-link { color: var(--accent-text); border-top-color: var(--line); }

html[data-ce-v2] .ce-avatar-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
html[data-ce-v2] .ce-avatar-btn:hover .ce-avatar { background: #FFE1D3; }

/* the shell's own buttons keep their pill shape (content controls are 8px) */
html[data-ce-v2] #app-topbar .ce-btn,
html[data-ce-v2] .ce-profile-popover .ce-btn { border-radius: 999px; }

/* popovers (account, notifications) */
html[data-ce-v2] .ce-profile-popover,
html[data-ce-v2] .ce-notif-popover {
  background: #fff !important; border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--overlay-shadow); top: calc(100% + 8px);
}
html[data-ce-v2] .ce-notif-popover { width: 360px; }
html[data-ce-v2] .ce-profile-popover { width: 280px; padding: 16px 8px 8px; }
html[data-ce-v2] .ce-profile-head-name { font-size: 14px; font-weight: 600; }
html[data-ce-v2] .ce-profile-head-email { font-size: 13px; color: var(--text-2); }
html[data-ce-v2] .ce-profile-divider { background: var(--line); margin: 8px 0; }
html[data-ce-v2] .ce-profile-plan .ce-text-overline { color: var(--text-3); }
html[data-ce-v2] .ce-workspace-plan { background: var(--accent-tint); color: var(--accent-text); font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
html[data-ce-v2] .ce-profile-popover .ce-dropdown-opt,
html[data-ce-v2] .ce-notif-popover .ce-dropdown-opt { border-radius: 8px; min-height: 36px; font-size: 14px; }
html[data-ce-v2] .ce-notif-popover .ce-dropdown-opt.is-unread { background: var(--accent-tint); }
html[data-ce-v2] .ce-notif-popover .ce-dropdown-opt:hover { background: var(--fill); }

/* rail: 72px, icon with a label under it, Settings at the bottom */
html[data-ce-v2] .ce-shell-sidebar {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 72px; z-index: 30;
  display: flex; flex-direction: column; padding: 4px 4px 12px; overflow: visible;
  background: transparent; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none;
}
html[data-ce-v2] .ce-sidebar-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
html[data-ce-v2] .ce-sidebar-scroll::-webkit-scrollbar { display: none; }
html[data-ce-v2] .ce-sidebar-overline { display: none; }
html[data-ce-v2] .ce-sidebar-link {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; height: 58px; padding: 6px 2px; border: 0; border-radius: 12px; background: transparent;
  color: var(--text-2); text-decoration: none; font-size: 11px; font-weight: 500; line-height: 14px; cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
html[data-ce-v2] .ce-sidebar-link:hover { background: rgba(23, 26, 33, 0.05); color: var(--text); }
html[data-ce-v2] .ce-sidebar-link.is-active {
  background: var(--accent-tint); color: var(--accent-text); box-shadow: none; transform: none;
}
html[data-ce-v2] .ce-sidebar-link.is-active svg { color: var(--accent-text); }
html[data-ce-v2] .ce-sidebar-label { display: block; max-width: 100%; white-space: nowrap; }
html[data-ce-v2] .ce-sidebar-link-badge {
  position: absolute; top: 4px; left: calc(50% + 4px); right: auto; margin: 0;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--accent-solid); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; display: flex; align-items: center; justify-content: center;
}
html[data-ce-v2] .ce-sidebar-link.is-active .ce-sidebar-link-badge { background: var(--accent-solid); color: #fff; }
html[data-ce-v2] .ce-sidebar-footer { flex: none; margin: 0; padding: 8px 0 0; border-top: 0; }

/* More menu (opens beside the rail) */
html[data-ce-v2] .ce-more-menu {
  position: fixed; z-index: 70; width: 240px; padding: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--overlay-shadow);
}
html[data-ce-v2] .ce-more-link {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: left;
}
html[data-ce-v2] .ce-more-link svg { flex: none; color: var(--text-2); }
html[data-ce-v2] .ce-more-link:hover { background: var(--fill); color: var(--text); }
html[data-ce-v2] .ce-more-link.is-active { background: var(--accent-tint); color: var(--accent-text); }
html[data-ce-v2] .ce-more-link.is-active svg { color: var(--accent-text); }
html[data-ce-v2] .ce-more-sep { height: 1px; margin: 6px 4px; background: var(--line); }
html[data-ce-v2] .ce-more-link .ce-sidebar-link-badge { position: static; margin-left: auto; }

/* the one white panel */
html[data-ce-v2] .ce-shell-content {
  min-height: calc(100vh - 56px - 12px); margin: 0 12px 12px 0; padding: 8px 0 32px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel);
  box-shadow: none; animation: none;
}
html[data-ce-v2].ce-no-rail .ce-shell-content { margin-left: 12px; }
html[data-ce-v2] .ce-shell-content .section-wrap { max-width: none; padding-left: 32px; padding-right: 32px; }

/* setup / credit banners above the panel, only when there is something to do */
html[data-ce-v2] #app-topbar { padding: 0 12px 0 0; }
html[data-ce-v2].ce-no-rail #app-topbar { padding-left: 12px; }
html[data-ce-v2] .ce-credit-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 0 8px; padding: 10px 12px 10px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff; box-shadow: none;
  font-size: 14px; line-height: 20px; color: var(--text); animation: none;
}
html[data-ce-v2] .ce-credit-banner > span:first-child { flex: 1; min-width: 0; }
html[data-ce-v2] .ce-credit-banner.is-warning { background: var(--warning-tint); border-color: #F3DFB4; color: var(--text); }
html[data-ce-v2] .ce-credit-banner.is-critical { background: var(--danger-tint); border-color: #F1CACA; color: var(--text); }
html[data-ce-v2] .ce-credit-banner-dismiss {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-2); opacity: 1; cursor: pointer;
}
html[data-ce-v2] .ce-credit-banner-dismiss:hover { background: rgba(23, 26, 33, 0.06); color: var(--text); }

/* mobile: bottom tab bar, no rail */
html[data-ce-v2] .ce-shell-tabbar {
  left: 0; right: 0; bottom: 0; height: 60px; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: #fff; box-shadow: none; backdrop-filter: none; padding: 0 4px;
}
html[data-ce-v2] .ce-tabbar-link { flex: 1; height: 100%; justify-content: center; background: transparent; border: 0; color: var(--text-2); font-size: 11px; font-weight: 500; cursor: pointer; }
html[data-ce-v2] .ce-tabbar-link.is-active { color: var(--accent-text); }
html[data-ce-v2] .ce-tabbar-link .ce-sidebar-link-badge { top: 6px; left: calc(50% + 6px); right: auto; }

@media (max-width: 900px) {
  html[data-ce-v2] .ce-shell-sidebar { display: none; }
  html[data-ce-v2] .ce-shell-main { margin-left: 0; }
  html[data-ce-v2] .ce-shell-topbar { grid-template-columns: 1fr auto; padding: 0 8px 0 14px; }
  html[data-ce-v2] .ce-topbar-search { display: none; }
  html[data-ce-v2] .ce-shell-content { margin: 0 8px 72px; border-radius: 14px; padding-top: 4px; }
  html[data-ce-v2] #app-topbar { padding: 0 8px; }
  html[data-ce-v2] .ce-shell-content .section-wrap { padding-left: 16px; padding-right: 16px; }
  html[data-ce-v2] .ce-split { grid-template-columns: 1fr; }
  html[data-ce-v2] .ce-subnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  html[data-ce-v2] .ce-subnav-title, html[data-ce-v2] .ce-subnav-foot { display: none; }
  html[data-ce-v2] .ce-subnav-item { width: auto; flex: none; }
}
@media (max-width: 560px) {
  html[data-ce-v2] .ce-topbar-wordmark { display: none; }
  html[data-ce-v2] .ce-credit-meter-wrap { display: none; }
}

/* =====================================================================
   5. SUPPORT PANEL (no floating button) AND OTHER OVERLAYS
   ===================================================================== */
/* The floating chat button is gone. Support opens from More > Help and
   support, from the account menu, and from bell notifications. */
html[data-ce-v2] .ce-chat-bubble { display: none !important; }
html[data-ce-v2] .ce-chat-panel {
  top: 64px; right: 12px; bottom: 12px; left: auto; width: 392px; max-width: calc(100vw - 24px); height: auto; max-height: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: var(--overlay-shadow);
}
html[data-ce-v2] .ce-chat-panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
html[data-ce-v2] .ce-chat-panel-title { font-size: 16px; font-weight: 600; }
html[data-ce-v2] .ce-chat-panel-sub { font-size: 13px; color: var(--text-2); }
html[data-ce-v2] .ce-chat-panel-head button { width: 32px; height: 32px; border-radius: 50%; color: var(--text-2); }
html[data-ce-v2] .ce-chat-panel-head button:hover { background: var(--fill-2); color: var(--text); }
html[data-ce-v2] .ce-chat-tabs { padding: 0 12px; border-bottom: 1px solid var(--line); }
html[data-ce-v2] .ce-chat-tab { font-size: 14px; font-weight: 500; color: var(--text-2); }
html[data-ce-v2] .ce-chat-tab:hover { color: var(--text); }
html[data-ce-v2] .ce-chat-tab.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
html[data-ce-v2] .ce-tab-badge { background: var(--accent-solid); }
html[data-ce-v2] .ce-chat-empty, html[data-ce-v2] .ce-chat-empty-state { color: var(--text-2); }
html[data-ce-v2] .ce-chat-empty-state strong { color: var(--text); font-size: 15px; font-weight: 600; }
html[data-ce-v2] .ce-chat-bubble-msg.is-out { background: var(--accent-tint); color: var(--text); }
html[data-ce-v2] .ce-chat-bubble-msg.is-in { background: var(--fill); color: var(--text); }
html[data-ce-v2] .ce-chat-compose { border-top: 1px solid var(--line); padding: 12px 16px; }
html[data-ce-v2] .ce-chat-compose textarea { border: 1px solid var(--line-strong); border-radius: 20px; padding: 9px 14px; background: #fff; color: var(--text); }
html[data-ce-v2] .ce-chat-compose textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
html[data-ce-v2] .ce-chat-compose button { background: var(--accent-solid); color: #fff; }
html[data-ce-v2] .ce-tk-row { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); color: var(--text); }
html[data-ce-v2] .ce-tk-row:hover, html[data-ce-v2] .ce-tk-row:focus-visible { border-color: var(--line-strong); background: var(--fill); outline: none; }
html[data-ce-v2] .ce-tk-title { color: var(--text); }
html[data-ce-v2] .ce-tk-group { font-size: 12px; font-weight: 500; color: var(--text-3); }
html[data-ce-v2] .ce-tk-pill { height: 22px; display: inline-flex; align-items: center; background: var(--info-tint); color: var(--info); }
html[data-ce-v2] .ce-tk-pill.is-in_progress { background: var(--warning-tint); color: var(--warning); }
html[data-ce-v2] .ce-tk-pill.is-waiting_on_customer { background: var(--danger-tint); color: var(--danger); }
html[data-ce-v2] .ce-tk-pill.is-resolved { background: var(--success-tint); color: var(--success); }
html[data-ce-v2] .ce-tk-pill.is-closed { background: var(--fill-2); color: var(--text-2); }
html[data-ce-v2] .ce-tk-desc { background: var(--fill); }
html[data-ce-v2] .ce-tk-update { background: var(--accent-tint); }
html[data-ce-v2] .ce-tk-steps li.is-done::before, html[data-ce-v2] .ce-tk-steps li.is-done::after { background: var(--text); border-color: var(--text); }
html[data-ce-v2] .ce-tk-banner { background: var(--danger-tint); color: var(--danger); }
html[data-ce-v2] .ce-tk-banner.is-good { background: var(--success-tint); color: var(--success); }

@media (max-width: 900px) {
  html[data-ce-v2] .ce-chat-panel { top: 56px; right: 0; bottom: 60px; width: 100%; max-width: none; border-radius: 16px 16px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ce-v2] * { transition-duration: 0.001ms !important; }
}

/* =====================================================================
   6. HOME
   Flat: no box-shadow anywhere in the page content. Every value is a token.
   ===================================================================== */
html[data-ce-v2] .ce-home { padding: var(--space-6) var(--space-8) var(--space-8); }
html[data-ce-v2] .ce-home *,
html[data-ce-v2] .ce-home *::before,
html[data-ce-v2] .ce-home *::after { box-shadow: none !important; }

html[data-ce-v2] .ce-home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
html[data-ce-v2] .ce-home-stack { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
@media (max-width: 1100px) { html[data-ce-v2] .ce-home-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { html[data-ce-v2] .ce-home { padding: var(--space-4); } }

html[data-ce-v2] .ce-home .ce-custom-range { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin: calc(-1 * var(--space-2)) 0 var(--space-4); font-size: var(--fs-13); color: var(--c-muted); }
html[data-ce-v2] .ce-home .ce-custom-range input[type="date"] {
  height: 32px; padding: 0 var(--space-2); border: 1px solid var(--c-border); border-radius: var(--radius-control);
  background: var(--panel); color: var(--c-text); font-size: var(--fs-13);
}

html[data-ce-v2] .ce-home .announcement-banner {
  margin-bottom: var(--space-5); padding: var(--space-3) var(--space-4); background: var(--panel); border: 1px solid var(--c-border);
  border-radius: var(--radius-container); color: var(--c-text); font-size: var(--fs-14);
}
html[data-ce-v2] .ce-home .announcement-banner button { color: var(--c-muted); font-size: var(--fs-16); }

/* SMS activity */
html[data-ce-v2] .ce-legend { display: flex; align-items: center; gap: var(--space-4); }
html[data-ce-v2] .ce-legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
html[data-ce-v2] .ce-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
html[data-ce-v2] .ce-legend-item strong { font-weight: var(--fw-semibold); color: var(--c-text); }
html[data-ce-v2] .ce-legend-dot.is-sent { background: var(--accent); }
html[data-ce-v2] .ce-legend-dot.is-replies { background: var(--c-series-muted); }
html[data-ce-v2] .ce-chart-flat { position: relative; width: 100%; }
html[data-ce-v2] .ce-chart-flat svg { display: block; width: 100%; height: 100%; overflow: hidden; }
html[data-ce-v2] .ce-chart-flat .ce-chart-tick { font-size: var(--fs-13); fill: var(--c-muted); }
html[data-ce-v2] .ce-chart-flat .ce-chart-tooltip {
  padding: var(--space-2) var(--space-3); background: var(--panel); color: var(--c-text); border: 1px solid var(--c-border);
  border-radius: var(--radius-control); font-size: var(--fs-13); backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none;
}
html[data-ce-v2] .ce-chart-flat .ce-chart-tooltip .ce-tip-sub { color: var(--c-muted); opacity: 1; font-size: var(--fs-13); }
html[data-ce-v2] .ce-home .ce-empty { padding: var(--space-8) var(--space-4); }

/* Quick actions */
html[data-ce-v2] .ce-quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
@media (max-width: 700px) { html[data-ce-v2] .ce-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html[data-ce-v2] .ce-quick {
  display: flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-3); min-width: 0;
  background: var(--panel); border: 1px solid var(--c-border); border-radius: var(--radius-control);
  color: var(--c-text); font-size: var(--fs-14); text-decoration: none; white-space: nowrap; transition: background-color 120ms ease;
}
html[data-ce-v2] .ce-quick:hover { background: var(--c-track); color: var(--c-text); }
html[data-ce-v2] .ce-quick svg { width: 16px; height: 16px; flex: none; color: var(--c-muted); }
html[data-ce-v2] .ce-quick .ce-badge { margin-left: auto; height: 20px; padding: 0 var(--space-2); }

/* Credits and usage */
html[data-ce-v2] .ce-rows { display: flex; flex-direction: column; }
html[data-ce-v2] .ce-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 40px; border-bottom: 1px solid var(--c-border); font-size: var(--fs-14); }
html[data-ce-v2] .ce-row:last-child { border-bottom: 0; }
html[data-ce-v2] .ce-row > :first-child { color: var(--c-muted); }
html[data-ce-v2] .ce-row > :last-child { color: var(--c-text); font-weight: 500; }

/* Live feed */
html[data-ce-v2] .ce-feed-panel { display: flex; flex-direction: column; height: 480px; min-height: 0; }
html[data-ce-v2] .ce-feed-list {
  flex: 1; min-height: 0; overflow-y: auto; margin-right: calc(-1 * var(--space-2)); padding-right: var(--space-2);
  scrollbar-width: thin; scrollbar-color: var(--c-scroll) transparent;
}
html[data-ce-v2] .ce-feed-list::-webkit-scrollbar { width: 6px; }
html[data-ce-v2] .ce-feed-list::-webkit-scrollbar-track { background: transparent; }
html[data-ce-v2] .ce-feed-list::-webkit-scrollbar-thumb { background: var(--c-scroll); border-radius: 3px; }
html[data-ce-v2] .ce-feed-day { padding: var(--space-3) 0 var(--space-1); font-size: var(--fs-13); line-height: 20px; font-weight: var(--fw-semibold); color: var(--c-muted); }
html[data-ce-v2] .ce-feed-day:first-child { padding-top: 0; }
html[data-ce-v2] .ce-feed-row {
  display: flex; align-items: center; gap: var(--space-3); min-height: 36px; margin: 0 calc(-1 * var(--space-2)); padding: 0 var(--space-2);
  border-radius: var(--radius-control); color: var(--c-text); font-size: var(--fs-14); text-decoration: none;
}
html[data-ce-v2] a.ce-feed-row:hover { background: var(--c-track); color: var(--c-text); }
html[data-ce-v2] .ce-feed-icon { display: inline-flex; flex: none; width: 16px; height: 16px; color: var(--c-muted); }
html[data-ce-v2] .ce-feed-icon svg { width: 16px; height: 16px; }
html[data-ce-v2] .ce-feed-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ce-v2] .ce-feed-time { flex: none; font-size: var(--fs-13); color: var(--c-muted); white-space: nowrap; }
html[data-ce-v2] .ce-feed-empty { margin: 0; padding: var(--space-4) 0; font-size: var(--fs-14); color: var(--c-muted); }
html[data-ce-v2] .ce-feed-more { margin-top: var(--space-3); width: 100%; }

/* =====================================================================
   7. BOOKS (form pattern, automatic-entry rows, year picker)
   ===================================================================== */
html[data-ce-v2] .ce-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
html[data-ce-v2] .ce-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
html[data-ce-v2] .ce-field > span { font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }
html[data-ce-v2] .ce-field-wide { grid-column: 1 / -1; }
html[data-ce-v2] .ce-form-foot { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }
html[data-ce-v2] .ce-form-msg { font-size: var(--fs-13); color: var(--c-muted); }
html[data-ce-v2] .ce-form-msg.is-error { color: var(--danger); }
html[data-ce-v2] .ce-hint { margin: var(--space-3) 0 0; font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }
@media (max-width: 900px) { html[data-ce-v2] .ce-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { html[data-ce-v2] .ce-form-grid { grid-template-columns: minmax(0, 1fr); } }

html[data-ce-v2] .ce-year { display: inline-flex; align-items: center; gap: var(--space-2); }
html[data-ce-v2] .ce-year-label { min-width: 48px; text-align: center; font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--c-text); }

html[data-ce-v2] .ce-auto-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--c-border); }
html[data-ce-v2] .ce-auto-row:last-of-type { border-bottom: 0; }
html[data-ce-v2] .ce-auto-title { font-size: var(--fs-14); line-height: 20px; font-weight: 500; color: var(--c-text); }
html[data-ce-v2] .ce-auto-desc { margin-top: var(--space-1); font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }
html[data-ce-v2] .ce-auto-row .ce-switch { margin-top: var(--space-1); }

html[data-ce-v2] .ce-table .ce-amount-in { color: var(--success); font-weight: var(--fw-semibold); }
html[data-ce-v2] .ce-table .ce-amount-out { color: var(--danger); font-weight: var(--fw-semibold); }
html[data-ce-v2] .ce-table .ce-notes { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-muted); }
html[data-ce-v2] .ce-table tr.is-total td { font-weight: var(--fw-semibold); background: var(--c-track); }
html[data-ce-v2] .ce-scroll-x { overflow-x: auto; }
html[data-ce-v2] .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html[data-ce-v2] .ce-table .ce-nowrap { white-space: nowrap; }

/* =====================================================================
   8. ADMIN PORTAL, and the older cards, tables and tabs still used on
      some pages. Same flat look as the customer app; values are tokens.
   ===================================================================== */
html[data-ce-v2] .ce-topbar-admin-badge { margin-left: var(--space-1); }

/* admin rail: the same icon + label rail as the customer app (these beat the old #admin-sidebar rules) */
html[data-ce-v2] #admin-sidebar { padding: 4px 4px 12px; }
html[data-ce-v2] #admin-sidebar .ce-sidebar-scroll { gap: 4px; }
html[data-ce-v2] #admin-sidebar button.ce-sidebar-link {
  flex: none; width: 100%; height: 58px; padding: 6px 2px; border: 0; border-radius: 12px; justify-content: center;
  text-align: center; font: inherit; font-size: 11px; font-weight: 500; line-height: 14px;
}
html[data-ce-v2] #admin-sidebar .ce-sidebar-link svg { width: 22px; height: 22px; }
html[data-ce-v2] #admin-sidebar button.ce-sidebar-link:not(.is-active):hover { background: rgba(23, 26, 33, 0.05); }
html[data-ce-v2] #admin-sidebar button.ce-sidebar-link.is-active { background: var(--accent-tint); color: var(--accent-text); box-shadow: none; transform: none; }
html[data-ce-v2] .admin-tab.has-mention .ce-sidebar-label { color: var(--accent-text); font-weight: var(--fw-semibold); }
html[data-ce-v2] .ce-more-menu .ce-more-link.admin-tab { border: 0; }

/* cards */
html[data-ce-v2] .billing-card {
  padding: var(--space-5); background: var(--panel); border: 1px solid var(--c-border); border-radius: var(--radius-container);
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; transform: none;
}
html[data-ce-v2] .billing-card:hover { transform: none; box-shadow: none; }
html[data-ce-v2] .billing-card-title { margin-bottom: var(--space-3); font-size: var(--fs-16); line-height: 24px; font-weight: var(--fw-semibold); color: var(--c-text); }
html[data-ce-v2] .billing-wallet-amount { margin-bottom: var(--space-3); font-size: var(--fs-28); line-height: 36px; font-weight: var(--fw-semibold); font-stretch: 100%; color: var(--c-text); }
html[data-ce-v2] .billing-grid { gap: var(--space-5); }

/* card headings: text only, a hairline underneath (no icon tile) */
html[data-ce-v2] .dash-card-head { display: block; margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--c-border); }
html[data-ce-v2] .dash-card-icon { display: none; }
html[data-ce-v2] .dash-card-head-title { font-size: var(--fs-16); line-height: 24px; font-weight: var(--fw-semibold); color: var(--c-text); }
html[data-ce-v2] .dash-card-head-sub { margin-top: 2px; font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }

/* tables */
html[data-ce-v2] .admin-table-scroll { background: var(--panel); border: 1px solid var(--c-border); border-radius: var(--radius-container); box-shadow: none; }
html[data-ce-v2] .admin-table { background: var(--panel); }
html[data-ce-v2] .admin-table th {
  padding: 0 var(--space-4); height: 44px; background: var(--panel); border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--c-muted); white-space: nowrap;
}
html[data-ce-v2] .admin-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--c-border); font-size: var(--fs-14); color: var(--c-text); }
html[data-ce-v2] .admin-table tbody tr:last-child td { border-bottom: 0; }
html[data-ce-v2] .admin-table-row:hover { background: var(--c-track); }
html[data-ce-v2] .admin-details-cell { color: var(--c-muted); font-size: var(--fs-13); }

/* status badges */
html[data-ce-v2] .admin-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 var(--space-3); border-radius: 999px;
  font-size: 12px; font-weight: var(--fw-semibold); line-height: 1; background: var(--fill-2); color: var(--text-2);
}
html[data-ce-v2] .admin-badge-good { background: var(--success-tint); color: var(--success); }
html[data-ce-v2] .admin-badge-bad, html[data-ce-v2] .admin-badge-risk { background: var(--danger-tint); color: var(--danger); }
html[data-ce-v2] .admin-badge-crit { background: var(--danger); color: #fff; }
html[data-ce-v2] .admin-badge-warn { background: var(--warning-tint); color: var(--warning); }
html[data-ce-v2] .admin-badge-info { background: var(--info-tint); color: var(--info); }

/* tab bars and date ranges */
html[data-ce-v2] .analytics-tabbar { position: static; display: flex; flex-wrap: wrap; gap: var(--space-5); margin: 0 0 var(--space-5); padding: 0; background: transparent; border-bottom: 1px solid var(--c-border); }
html[data-ce-v2] .analytics-tab-btn {
  margin-bottom: -1px; padding: 0 0 var(--space-3); border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  color: var(--c-muted); font-size: var(--fs-14); line-height: 24px; font-weight: 500; cursor: pointer;
}
html[data-ce-v2] .analytics-tab-btn:hover { color: var(--c-text); }
html[data-ce-v2] .analytics-tab-btn.is-active { background: transparent; color: var(--c-text); border-color: transparent; border-bottom-color: var(--accent); font-weight: var(--fw-semibold); }
html[data-ce-v2] .dash-range-picker { display: inline-flex; gap: 0; padding: var(--space-1); background: var(--c-track); border: 0; border-radius: var(--radius-control); backdrop-filter: none; box-shadow: none; }
html[data-ce-v2] .dash-range-btn {
  height: 28px; padding: 0 var(--space-3); border: 1px solid transparent; border-radius: calc(var(--radius-control) - 2px); background: transparent;
  color: var(--c-muted); font-size: var(--fs-13); font-weight: 500; white-space: nowrap; cursor: pointer; box-shadow: none;
}
html[data-ce-v2] .dash-range-btn:hover { color: var(--c-text); border-color: transparent; }
html[data-ce-v2] .dash-range-btn.is-active { background: var(--panel); border-color: var(--c-border); color: var(--c-text); font-weight: var(--fw-semibold); box-shadow: none; }

/* KPI tiles */
html[data-ce-v2] .dash-kpi-grid { gap: var(--space-4); }
html[data-ce-v2] .dash-kpi-card,
html[data-ce-v2] .dash-kpi-card.is-featured {
  padding: var(--space-4) var(--space-5); background: var(--panel); color: var(--c-text); border: 1px solid var(--c-border);
  border-radius: var(--radius-container); box-shadow: none; transform: none;
}
html[data-ce-v2] .dash-kpi-card:hover { transform: none; box-shadow: none; }
html[data-ce-v2] .dash-kpi-label, html[data-ce-v2] .dash-kpi-card.is-featured .dash-kpi-label { font-size: var(--fs-13); line-height: 20px; color: var(--c-muted); }
html[data-ce-v2] .dash-kpi-value, html[data-ce-v2] .dash-kpi-card.is-featured .dash-kpi-value { margin-top: var(--space-1); font-size: var(--fs-28); line-height: 36px; font-weight: var(--fw-semibold); font-stretch: 100%; color: var(--c-text); }
html[data-ce-v2] .dash-kpi-sub, html[data-ce-v2] .dash-kpi-delta, html[data-ce-v2] .dash-kpi-delta-row { font-size: var(--fs-13); color: var(--c-muted); }
html[data-ce-v2] .dash-kpi-sparkline { display: none; }

/* small text and sub-headings */
html[data-ce-v2] .book-note { color: var(--c-muted); }
html[data-ce-v2] .profile-subhead { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--c-muted); }
html[data-ce-v2] .ce-kv-row { border-bottom-color: var(--c-border); font-size: var(--fs-14); }
html[data-ce-v2] .ce-kv-row > span:first-child { color: var(--c-muted); }
html[data-ce-v2] .admin-search { max-width: 420px; height: var(--control-h); padding: 0 var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--panel); font-size: var(--fs-14); }
html[data-ce-v2] .admin-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

/* legends (dots with inline colors from older code) follow the chart palette */
html[data-ce-v2] .sms-activity-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-3); font-size: var(--fs-13); color: var(--c-muted); }
html[data-ce-v2] .sms-activity-legend strong { font-weight: var(--fw-semibold); color: var(--c-text); }
html[data-ce-v2] .sms-activity-legend .dot { width: 8px; height: 8px; margin-right: var(--space-2); border-radius: 50%; }
html[data-ce-v2] .sms-activity-legend .dot[style*="7B61FF" i], html[data-ce-v2] .sms-activity-legend .dot[style*="FF5A1F" i] { background: var(--accent) !important; }
html[data-ce-v2] .sms-activity-legend .dot[style*="4A90D9" i], html[data-ce-v2] .sms-activity-legend .dot[style*="86868B" i] { background: var(--c-series-muted) !important; }
html[data-ce-v2] .sms-activity-legend .dot[style*="4A4A4A" i] { background: var(--c-muted) !important; }

/* quick action buttons (admin Overview) */
html[data-ce-v2] .quick-actions-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
@media (max-width: 700px) { html[data-ce-v2] .quick-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html[data-ce-v2] .quick-action-btn {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--space-2); height: 36px; padding: 0 var(--space-3);
  background: var(--panel); border: 1px solid var(--c-border); border-radius: var(--radius-control); box-shadow: none; transform: none;
  color: var(--c-text); font-size: var(--fs-14); font-weight: 400; text-align: left; text-decoration: none; white-space: nowrap;
}
html[data-ce-v2] .quick-action-btn:hover { background: var(--c-track); color: var(--c-text); transform: none; box-shadow: none; }
html[data-ce-v2] .quick-action-btn svg { width: 16px; height: 16px; flex: none; color: var(--c-muted); }

/* selected states that used a black fill now use the accent tint, like the rail */
html[data-ce-v2] .sp-seg input:checked + label,
html[data-ce-v2] .sp-kind-btn.is-active,
html[data-ce-v2] .sp-chip.is-active,
html[data-ce-v2] .tc-chan.is-active,
html[data-ce-v2] .tc-pk.is-active,
html[data-ce-v2] .followup-tab-btn.is-active,
html[data-ce-v2] .campaign-wizard-steps span.is-active { background: var(--accent-tint); color: var(--accent-text); border-color: transparent; }
html[data-ce-v2] .tc-chan.is-active .tc-hash { color: var(--accent-text); }
html[data-ce-v2] .tc-msg.is-mine .tc-avatar { background: var(--accent-tint); color: var(--accent-text); }
html[data-ce-v2] .sp-count { background: var(--c-track); color: var(--c-muted); }
html[data-ce-v2] .analytics-tab-btn.is-active .sp-count { background: var(--accent-tint); color: var(--accent-text); }
html[data-ce-v2] .sp-count.is-crit { background: var(--danger); color: #fff; }

/* primary actions that were black buttons */
html[data-ce-v2] .spd-bar .btn-dark,
html[data-ce-v2] .tc-compose .btn-dark,
html[data-ce-v2] .tc-modal .btn-dark,
html[data-ce-v2] .tc-welcome .btn-dark { background: var(--accent-solid); color: #fff; border-color: var(--accent-solid); }
html[data-ce-v2] .spd-bar .btn-dark:hover,
html[data-ce-v2] .tc-compose .btn-dark:hover,
html[data-ce-v2] .tc-modal .btn-dark:hover,
html[data-ce-v2] .tc-welcome .btn-dark:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

/* drawers, dialogs and toasts: white, one hairline, the overlay shadow */
html[data-ce-v2] .sp-drawer, html[data-ce-v2] .tc-modal { background: var(--panel); border: 1px solid var(--c-border); box-shadow: var(--overlay-shadow); }
html[data-ce-v2] .sp-toast { background: var(--panel); color: var(--c-text); border: 1px solid var(--c-border); box-shadow: var(--overlay-shadow); }
html[data-ce-v2] .bulk-bar { background: var(--panel); color: var(--c-text); border: 1px solid var(--c-border); border-radius: var(--radius-container); }

/* search boxes: 8px controls like every other input */
html[data-ce-v2] .inbox-search-input { height: var(--control-h); padding: 0 var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--panel); font-size: var(--fs-14); }
html[data-ce-v2] .inbox-search-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
