/* ==========================================================================
   1D3R — Dashboard design system
   --------------------------------------------------------------------------
   One stylesheet for every dashboard page. Colors, type and spacing are
   tokens on :root so light and dark themes share all component rules.
   Sections:
     1. Tokens (dark default, light theme)
     2. Base elements
     3. App shell: sidebar, topbar, page
     4. Layout helpers
     5. Panels & settings blocks
     6. Forms: fields, toggles, multi-select picker, dropzone
     7. Buttons
     8. Badges, alerts, toasts, empty states
     9. Lists & tables
    10. Tabs, details, misc
    11. Discord previews
    12. Overview & community picker
    13. Command palette
    14. Page-specific pieces
    15. Legacy single-server staff pages
    16. Responsive & motion
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --font-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Surfaces: cool graphite, slightly blue */
  --bg: #0e1116;
  --bg-sunken: #0a0c10;
  --surface: #141820;
  --surface-2: #191e27;
  --surface-3: #202632;
  --surface-hover: #1d232d;
  --line: #232a35;
  --line-strong: #2f3744;

  /* Text */
  --text: #e9edf2;
  --text-2: #a4aebb;
  --text-3: #6f7a89;

  /* Brass accent — used for primary actions, focus and the active rail */
  --accent: #e7b04a;
  --accent-hover: #f0c063;
  --accent-ink: #1b1305;
  --accent-text: #f0c063;
  --accent-soft: rgba(231, 176, 74, .12);
  --accent-line: rgba(231, 176, 74, .35);

  /* Status */
  --ok: #3fbf86;
  --ok-soft: rgba(63, 191, 134, .12);
  --danger: #f0606a;
  --danger-strong: #d9434e;
  --danger-soft: rgba(240, 96, 106, .12);
  --warn: #f39a52;
  --warn-soft: rgba(243, 154, 82, .12);
  --info: #6aa5ff;
  --info-soft: rgba(106, 165, 255, .12);

  --input-bg: #0f131a;
  --overlay: rgba(4, 6, 9, .66);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --page-max: 1240px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 140ms var(--ease);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-sunken: #eceef2;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eef0f4;
  --surface-hover: #f1f3f6;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;
  --text: #11151b;
  --text-2: #4b5563;
  --text-3: #7b8592;
  --accent: #e2a83a;
  --accent-hover: #d69a28;
  --accent-ink: #1b1305;
  --accent-text: #9a6a0c;
  --accent-soft: rgba(226, 168, 58, .14);
  --accent-line: rgba(176, 124, 18, .4);
  --ok: #1f9d68;
  --ok-soft: rgba(31, 157, 104, .1);
  --danger: #d4343f;
  --danger-strong: #c22833;
  --danger-soft: rgba(212, 52, 63, .08);
  --warn: #c8641c;
  --warn-soft: rgba(200, 100, 28, .1);
  --info: #2f6fd6;
  --info-soft: rgba(47, 111, 214, .08);
  --input-bg: #ffffff;
  --overlay: rgba(17, 21, 27, .38);
  --shadow-sm: 0 1px 2px rgba(17, 21, 27, .06);
  --shadow-lg: 0 24px 64px rgba(17, 21, 27, .18);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -.012em; line-height: 1.25; }
h1 { font-size: 24px; letter-spacing: -.022em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4 { font-size: 13px; }
p { margin: 0; color: var(--text-2); }
small { font-size: 12px; color: var(--text-3); }
strong, b { font-weight: 600; color: var(--text); }
a { color: var(--accent-text); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-hover); }
code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }
code { padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 3. App shell ------------------------------------------------------------- */
.app { min-height: 100vh; }
.app-main { margin-left: var(--sidebar-w); min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-sunken);
  border-right: 1px solid var(--line);
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 18px;
  flex: 0 0 auto;
  color: var(--text);
}
.sb-brand:hover { color: var(--text); }
/* The 1D3R mark (the brass tile with its cut corner). The "1D" text stays in the markup but isn't drawn. */
.sb-mark {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  display: block;
  background: url("/site/img/brand/1d3r-mark.svg") center / contain no-repeat;
  color: transparent;
  font-size: 0;
}
.sb-brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.sb-brand-name span { color: var(--text-3); font-weight: 500; }

.sb-server {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 12px 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t), background var(--t);
}
.sb-server:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.sb-server-icon, .sb-server-fallback { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px; object-fit: cover; }
.sb-server-fallback { display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-weight: 600; font-size: 12px; }
.sb-server-copy { min-width: 0; flex: 1; display: grid; line-height: 1.25; }
.sb-server-copy strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-server-copy small { font-size: 11.5px; }
.sb-server svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-3); }

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; }
.sb-group + .sb-group { margin-top: 14px; }
.sb-group-label { display: block; padding: 0 10px 6px; color: var(--text-3); font-size: 11.5px; font-weight: 500; }
.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 31px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--t), color var(--t);
}
.sb-link svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sb-link:hover { color: var(--text); background: var(--surface-2); }
.sb-link.is-active { color: var(--text); background: var(--surface-3); }
.sb-link.is-active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-link.is-active svg { color: var(--accent-text); opacity: 1; }
.sb-footer { padding: 10px 12px 14px; border-top: 1px solid var(--line); }
/* Premium marker: gold pill used in the sidebar, page titles and module tiles */
:root {
  --gold-grad: linear-gradient(135deg, #fde7a4 0%, #f0c25e 45%, #d4932a 100%);
  --gold-ink: #2d1e04;
  --gold-ring: rgba(253, 222, 140, .45);
  --gold-glow: rgba(240, 186, 80, .28);
  --gold-text: #f2c766;
}
:root[data-theme="light"] { --gold-ring: rgba(170, 112, 18, .45); --gold-glow: rgba(212, 147, 42, .22); --gold-text: #a86e0e; }
.sb-pill, .badge-premium {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  padding: 0 7px 0 6px;
  border-radius: 999px;
  background: var(--gold-grad);
  color: var(--gold-ink);
  box-shadow: inset 0 0 0 1px var(--gold-ring), 0 1px 6px var(--gold-glow);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 18px;
  text-transform: uppercase;
  white-space: nowrap;
}
.sb-pill { margin-left: auto; }
.sb-link > span:not(.sb-pill) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-link .sb-pill svg, .badge-premium svg { width: 10px; height: 10px; flex: 0 0 10px; fill: currentColor; stroke: none; opacity: 1; }
.sb-pill::after, .badge-premium::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%);
  transform: translateX(-120%);
}
.sb-link:hover .sb-pill::after, .badge-premium:hover::after, .module:hover .badge-premium::after { transition: transform .7s ease; transform: translateX(120%); }
.sb-link.is-premium > svg { color: var(--gold-text); opacity: 1; }
.sb-link.is-premium.is-active::before { background: var(--gold-grad); }
.module .badge-premium { vertical-align: 1px; }
h1 .badge-premium { margin-left: 4px; vertical-align: 4px; font-size: 10.5px; line-height: 20px; }
@media (prefers-reduced-motion: reduce) { .sb-pill::after, .badge-premium::after { display: none; } }

/* Branding preview: Discord-style profile card */
.dc-profile { width: 100%; max-width: 340px; border-radius: 10px; overflow: hidden; background: #232428; color: #dbdee1; font-family: "gg sans", "Noto Sans", var(--font-sans); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.dc-profile-banner { height: 108px; background: #5865f2 center / cover no-repeat; }
.dc-profile-body { position: relative; padding: 48px 16px 16px; }
.dc-profile-avatar { position: absolute; top: -44px; left: 14px; width: 84px; height: 84px; border-radius: 50%; border: 6px solid #232428; background: #313338 center / cover no-repeat; }
.dc-profile-name { display: flex; align-items: center; gap: 6px; color: #f2f3f5; font-size: 19px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.dc-profile-user { margin-top: 2px; color: #b5bac1; font-size: 13px; }
.dc-profile-section { margin-top: 12px; padding: 12px; border-radius: 8px; background: #111214; font-size: 13px; }
.dc-profile-section h4 { margin: 0 0 6px; color: #f2f3f5; font-size: 12px; font-weight: 700; }
.dc-profile-section p { margin: 0; color: #dbdee1; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-avatar-img { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: #313338 center / cover no-repeat; }
.brand-file { display: flex; align-items: center; gap: 14px; }
.brand-thumb { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; background: var(--surface-3) center / cover no-repeat; box-shadow: 0 0 0 1px var(--line); }
.brand-thumb.wide { width: 120px; border-radius: 8px; flex-basis: 120px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset:disabled { opacity: .55; }
.sb-empty { padding: 10px; color: var(--text-3); font-size: 12.5px; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-3); font-size: 13px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--line-strong); }
.crumbs strong { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs > span:not(.sep) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  min-width: 220px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--t), color var(--t);
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--text-2); }
.search-trigger svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd, .kbd { padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text-3); font-size: 11px; line-height: 16px; background: var(--surface-2); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 10px; margin-left: 4px; border-left: 1px solid var(--line); }
.user-chip img, .user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-avatar { display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.user-chip-name { font-size: 13px; font-weight: 500; color: var(--text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; }

/* Page */
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 28px 28px 72px; }
.page-wide { max-width: 1480px; }
.page-narrow { max-width: 920px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-desc { margin-top: 6px; max-width: 70ch; color: var(--text-2); font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--text-3); font-size: 13px; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* 4. Layout helpers -------------------------------------------------------- */
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack-sm { display: grid; gap: 10px; min-width: 0; }
.stack-lg { display: grid; gap: 24px; min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 20px; align-items: start; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.split-rev { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.span-all { grid-column: 1 / -1; }
.sticky-col { position: sticky; top: calc(var(--topbar-h) + 20px); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.hidden, [hidden] { display: none !important; }
.inline-form { display: inline-flex; margin: 0; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 5. Panels ---------------------------------------------------------------- */
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 0; }
.panel-head h2 { font-size: 15px; }
.panel-head p { margin-top: 3px; font-size: 13px; }
.panel-head > .row, .panel-head > .page-actions, .panel-head > .btn, .panel-head > a.btn, .panel-head > form { flex: 0 0 auto; }
.panel-lead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.panel-lead > div:last-child { min-width: 0; }
.panel-body { padding: 18px 20px 20px; }
.panel-head + .panel-body { padding-top: 16px; }
.panel-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.panel-foot .grow, .panel-foot .faint { margin-right: auto; }
.panel-flush > .panel-body { padding: 0; }
.panel-tint { background: var(--surface-2); }
.panel + .panel { margin-top: 0; }
.panel-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* Settings block: label column + controls column */
.setting-block { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 24px; padding: 22px 20px; }
.setting-block + .setting-block { border-top: 1px solid var(--line); }
.setting-block.single { grid-template-columns: minmax(0, 1fr); }
.setting-meta h2, .setting-meta h3 { font-size: 14px; font-weight: 600; }
.setting-meta p { margin-top: 4px; font-size: 13px; line-height: 1.5; }
.setting-fields { display: grid; gap: 16px; min-width: 0; }
.subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 4px; }
.subhead h3 { font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

/* Section heading inside a stack (outside panels) */
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 -4px; }
.section-title h2 { font-size: 15px; }
.section-title p { font-size: 13px; }

/* 6. Forms ----------------------------------------------------------------- */
label { color: var(--text); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field-label { font-size: 13px; font-weight: 500; color: var(--text); }
.field-label .opt, .field > label .opt { color: var(--text-3); font-weight: 400; }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.hint code { font-size: 11.5px; }

input, select, textarea, button { font: inherit; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]):not([type="hidden"]),
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
textarea { min-height: 88px; resize: vertical; padding: 9px 11px; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover:not(:focus):not([readonly]), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--text-3)); }
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { color: var(--text-2); background: var(--surface-2); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  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='%238a94a3' 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 9px center;
  background-size: 16px;
  cursor: pointer;
}
select option { background: var(--surface); color: var(--text); }
select[multiple] { min-height: 150px; padding: 6px; }
select[multiple] option { padding: 5px 8px; border-radius: 4px; }
select[multiple] option:checked { background: var(--accent-soft); color: var(--text); }

input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--input-bg);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 5px; }
input[type="file"] { width: 100%; padding: 6px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--input-bg); color: var(--text-2); font-size: 13px; cursor: pointer; }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-3); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
input[type="number"] { font-variant-numeric: tabular-nums; }

input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  display: inline-grid;
  place-content: center;
  vertical-align: -3px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 9px; height: 9px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--accent-ink); transform: scale(0); transition: transform 120ms var(--ease); }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="radio"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-ink); transform: scale(0); }
input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="radio"]:checked::before { transform: scale(1); }

/* Toggle: a label wrapping a checkbox that renders as a switch */
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle input[type="checkbox"] {
  width: 34px;
  height: 20px;
  margin-top: 1px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  place-content: center start;
  padding: 0 3px;
}
.toggle input[type="checkbox"]::before { width: 14px; height: 14px; clip-path: none; border-radius: 50%; background: var(--text-2); transform: none; transition: transform 160ms var(--ease), background 160ms var(--ease); }
.toggle input[type="checkbox"]:checked { background: var(--accent); box-shadow: none; }
.toggle input[type="checkbox"]:checked::before { transform: translateX(14px); background: var(--accent-ink); }
.toggle-text { display: grid; gap: 2px; min-width: 0; }
.toggle-text strong, .toggle-text > span:first-child { font-size: 13.5px; font-weight: 500; color: var(--text); }
.toggle-text small, .toggle-text .hint { font-size: 12.5px; color: var(--text-3); }
.toggle-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); transition: border-color var(--t); }
.toggle-card:hover { border-color: var(--line-strong); }
.toggle-card:has(input:checked) { border-color: var(--accent-line); }
.toggle-list { display: grid; }
.toggle-list > .toggle { padding: 12px 0; }
.toggle-list > .toggle + .toggle { border-top: 1px solid var(--line); }
.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.toggle-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Plain checkbox row */
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check-tile { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); font-size: 13px; cursor: pointer; transition: border-color var(--t), background var(--t); }
.check-tile:hover { border-color: var(--line-strong); }
.check-tile:has(input:checked) { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 5%, var(--surface-2)); }

/* Inline field groups like "3 within 10 seconds" */
.inline-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.inline-fields input[type="number"] { width: 92px !important; }
.input-suffix { position: relative; }
.input-suffix > span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12.5px; pointer-events: none; }
.input-suffix > input { padding-right: 64px !important; }

/* Searchable multi-select (enhanced from a native select[multiple] by dashboard-ui.js) */
.ms { position: relative; min-width: 0; }
.ms-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.ms-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 36px;
  padding: 4px 32px 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--input-bg);
  cursor: text;
  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='%238a94a3' 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 9px center;
  background-size: 16px;
  transition: border-color var(--t), box-shadow var(--t);
}
.ms.is-open .ms-control, .ms-control:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.ms-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 24px; padding: 0 4px 0 8px; border-radius: 5px; background: var(--surface-3); color: var(--text); font-size: 12.5px; }
.ms-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-chip button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-3); cursor: pointer; font-size: 14px; line-height: 1; }
.ms-chip button:hover { background: var(--line-strong); color: var(--text); }
.ms-search { flex: 1; min-width: 90px; height: 26px; min-height: 0 !important; padding: 0 4px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--text); font-size: 13.5px; outline: none; }
.ms-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); }
.ms-option { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
.ms-option:hover, .ms-option.is-active { background: var(--surface-3); }
.ms-option .ms-tick { width: 16px; height: 16px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 4px; flex: 0 0 auto; }
.ms-option.is-selected .ms-tick { background: var(--accent); border-color: var(--accent); }
.ms-option.is-selected .ms-tick::before { content: ""; width: 9px; height: 9px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--accent-ink); }
.ms-empty { padding: 10px; color: var(--text-3); font-size: 13px; }
.ms-meta { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px 4px; color: var(--text-3); font-size: 12px; }
.ms-meta button { padding: 0; border: 0; background: none; color: var(--accent-text); font-size: 12px; cursor: pointer; }

/* Dropzone */
.dropzone, .drop-zone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 22px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.dropzone:hover, .drop-zone:hover, .dropzone.dragover, .drop-zone.dragover, .drop-zone.drag-over { border-color: var(--accent-line); background: var(--accent-soft); }
.dropzone svg { width: 22px; height: 22px; fill: none; stroke: var(--text-3); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.upload-name { display: block; color: var(--text); font-size: 12.5px; overflow-wrap: anywhere; }
.upload-name:empty { display: none; }

/* Save bar that sticks to the bottom of long forms */
.savebar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
}
.savebar p { font-size: 13px; color: var(--text-3); }
.savebar.is-dirty p { color: var(--text); }
.savebar.is-dirty p::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }

/* 7. Buttons --------------------------------------------------------------- */
.btn, button, .button, .danger-button, .edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t), opacity var(--t);
}
.btn:hover, button:hover, .button:hover, .edit-button:hover { background: var(--surface-3); color: var(--text); }
.btn svg, button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary, button[type="submit"]:not(.btn):not(.icon-btn), .button {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover, button[type="submit"]:not(.btn):not(.icon-btn):hover, .button:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); font-weight: 500; }
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger, .danger-button { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn-danger:hover, .danger-button:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger-solid { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }
.btn-danger-solid:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #04130c; font-weight: 600; }
.btn-ok:hover { filter: brightness(1.08); background: var(--ok); color: #04130c; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 30px; padding: 0; }
button:disabled, .btn:disabled, .is-loading { opacity: .55; cursor: not-allowed; }
.is-loading { cursor: progress; }

/* 8. Badges, alerts, toasts, empty states --------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0;
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: var(--surface-3); color: var(--text-3); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13.5px; color: var(--text); }
.alert svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert-success { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.alert-success svg { color: var(--ok); }
.alert-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
.alert-error svg { color: var(--danger); }
.alert-info { border-color: color-mix(in srgb, var(--info) 30%, transparent); background: var(--info-soft); }
.alert-info svg { color: var(--info); }
.alert-warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.alert-warn svg { color: var(--warn); }
.alerts { display: grid; gap: 10px; margin-bottom: 20px; }

.toast-stack { position: fixed; right: 20px; top: calc(var(--topbar-h) + 12px); z-index: 300; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.ui-toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); font-size: 13.5px; color: var(--text); animation: toastIn 220ms var(--ease) both; }
.ui-toast svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ui-toast.is-leaving { animation: toastOut 180ms var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

.empty { display: grid; justify-items: center; gap: 6px; padding: 32px 20px; text-align: center; }
.empty svg { width: 28px; height: 28px; margin-bottom: 4px; fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty strong { font-size: 14px; }
.empty p { max-width: 44ch; font-size: 13px; }
.empty .btn { margin-top: 8px; }
.empty-inline { padding: 14px 0; color: var(--text-3); font-size: 13px; }

/* 9. Lists & tables -------------------------------------------------------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 20px; border-top: 1px solid var(--line); min-width: 0; }
.list-item:first-child { border-top: 0; }
.panel-body > .list .list-item, .list-tight .list-item { padding-left: 0; padding-right: 0; }
.list-item-main { min-width: 0; display: grid; gap: 3px; flex: 1; }
.list-item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; color: var(--text); font-size: 13.5px; }
.list-item-meta { color: var(--text-3); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.list-item-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.list-item-actions form { margin: 0; display: inline-flex; }
a.list-item { color: inherit; transition: background var(--t); }
a.list-item:hover { background: var(--surface-2); color: inherit; }
a.list-item > svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-3); }
.list-item { align-items: center; }
.list-item > .badge-icon, .list-item > .type-emoji { align-self: flex-start; }
.list-item.is-current { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.item-preview { margin-top: 6px; color: var(--text-2); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 9px 16px; text-align: left; color: var(--text-3); font-weight: 500; font-size: 12px; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: top; }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { color: var(--text-3); font-variant-numeric: tabular-nums; }

.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.kv > div:first-child { border-top: 0; }
.kv dt, .kv > div > span:first-child { color: var(--text-3); }
.kv dd { margin: 0; }
.id-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 4px 2px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--text-2); font: 12px var(--font-mono); }
.id-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-3); cursor: pointer; }
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn svg { width: 12px; height: 12px; }

/* 10. Tabs, details, misc -------------------------------------------------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tabs a, .tabs button, .tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.tabs a:hover, .tabs button:hover, .tab:hover { color: var(--text); background: var(--surface-2); }
.tabs .active, .tabs .is-active, .tabs [aria-selected="true"] { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs-line { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs-line a, .tabs-line button { position: relative; height: 38px; padding: 0 2px; border: 0; border-radius: 0; background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.tabs-line a:hover, .tabs-line button:hover { background: transparent; color: var(--text); }
.tabs-line .active, .tabs-line .is-active { color: var(--text); }
.tabs-line .active::after, .tabs-line .is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

details.disclosure { border-top: 1px solid var(--line); }
details.disclosure > summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; list-style: none; cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 500; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--t); margin: 0 3px; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { color: var(--text); }
details.disclosure > .disclosure-body { padding: 4px 0 16px; }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.callout { padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 0 var(--r) var(--r) 0; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.callout strong { color: var(--text); }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: 0 0 auto; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* 11. Discord previews ----------------------------------------------------- */
/* Previews intentionally use Discord's own palette so they look like the real client in either theme. */
.dc {
  --dc-bg: #313338;
  --dc-embed: #2b2d31;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-head: #f2f3f5;
  padding: 16px;
  border-radius: var(--r);
  background: var(--dc-bg);
  color: var(--dc-text);
  font-family: "gg sans", "Noto Sans", var(--font-sans);
  font-size: 14px;
  line-height: 1.375;
  overflow: hidden;
}
.dc-msg { display: flex; gap: 14px; }
.dc-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.dc-body { min-width: 0; flex: 1; }
.dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dc-name { color: var(--dc-head); font-weight: 600; font-size: 15px; }
.dc-bot { padding: 0 4px; border-radius: 3px; background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; line-height: 15px; }
.dc-time { color: var(--dc-muted); font-size: 12px; }
.dc-content { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--dc-text); }
.dc-content:empty { display: none; }
.dc-mention { padding: 0 2px; border-radius: 3px; background: rgba(88, 101, 242, .3); color: #c9cdfb; font-weight: 500; }
.dc-embed { display: flex; max-width: 520px; margin-top: 6px; border-radius: 4px; background: var(--dc-embed); overflow: hidden; }
.dc-embed-bar { width: 4px; flex: 0 0 4px; background: #5865f2; }
.dc-embed-body { min-width: 0; flex: 1; padding: 10px 14px 14px 12px; overflow: hidden; }
.dc-embed-author { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; color: var(--dc-head); font-size: 13px; font-weight: 600; }
.dc-embed-author img { width: 22px; height: 22px; border-radius: 50%; }
.dc-embed-title { margin: 4px 0 6px; color: var(--dc-head); font-size: 15px; font-weight: 600; }
.dc-embed-desc { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--dc-text); font-size: 14px; }
.dc-embed-thumb { float: right; width: 80px; height: 80px; margin: 4px 0 8px 14px; border-radius: 4px; object-fit: cover; }
.dc-embed-image { display: block; width: 100%; max-height: 300px; margin-top: 14px; border-radius: 4px; object-fit: cover; }
.dc-embed-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--dc-muted); font-size: 12px; }
.dc-embed-footer img { width: 20px; height: 20px; border-radius: 50%; }
.dc-select { display: flex; justify-content: space-between; align-items: center; max-width: 520px; margin-top: 8px; padding: 10px 12px; border: 1px solid #1e1f22; border-radius: 4px; background: #1e1f22; color: var(--dc-muted); font-size: 14px; white-space: pre-wrap; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btn, .fakebtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 4px; background: #4e5058; color: #fff; font-size: 14px; font-weight: 500; }
.preview-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.preview-label h2 { font-size: 14px; }

/* 12. Overview & community picker ----------------------------------------- */
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.ov-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ov-icon, .ov-icon-fallback { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 14px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.ov-icon-fallback { display: grid; place-items: center; background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 18px; }
.ov-identity h1 { font-size: 26px; }
.ov-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--text-3); font-size: 13px; }
.ov-greeting { color: var(--text-2); font-size: 13.5px; margin-bottom: 2px; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 20px; }
.stat { padding: 16px 20px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat dt, .stat-label { color: var(--text-3); font-size: 12.5px; }
.stat dd, .stat-value { margin: 4px 0 0; color: var(--text); font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-note { margin-top: 2px; color: var(--text-3); font-size: 12px; }

.setup-ring { --p: 0; position: relative; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.setup-ring::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.setup-ring span { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.checklist { display: grid; }
.checklist-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line); }
.checklist-mark { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed var(--line-strong); color: transparent; }
.checklist-item.is-done .checklist-mark { border: 0; background: var(--ok-soft); color: var(--ok); }
.checklist-mark svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.checklist-item strong { font-size: 13.5px; font-weight: 500; }
.checklist-item.is-done strong { color: var(--text-2); }
.checklist-item p { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; color: inherit; border-top: 1px solid var(--line); transition: background var(--t); }
.module:hover { background: var(--surface-2); color: inherit; }
.module-grid .module:nth-child(-n+3) { border-top: 0; }
.module-grid .module:not(:nth-child(3n+1)) { border-left: 1px solid var(--line); }
.module-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.module:hover .module-icon { color: var(--accent-text); }
.module-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.module strong { display: block; font-size: 13.5px; font-weight: 500; }
.module p { margin-top: 2px; font-size: 12.5px; color: var(--text-3); line-height: 1.4; }

/* Community picker (no sidebar) */
.picker { min-height: 100vh; display: flex; flex-direction: column; }
.picker-top { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 24px; border-bottom: 1px solid var(--line); }
.picker-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 56px 24px 80px; }
.picker-main h1 { font-size: 28px; }
.picker-main > .page-desc { margin-bottom: 28px; }
.community-list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.community-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; color: inherit; border-top: 1px solid var(--line); transition: background var(--t); }
.community-row:first-child { border-top: 0; }
.community-row:hover { background: var(--surface-2); color: inherit; }
.community-row img, .community-row .community-fallback { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; object-fit: cover; }
.community-fallback { display: grid; place-items: center; background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 16px; }
.community-row .grow strong { display: block; font-size: 14.5px; font-weight: 500; }
.community-row .grow span { color: var(--text-3); font-size: 12.5px; }
.community-row > svg { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 2; transition: transform var(--t), stroke var(--t); }
.community-row:hover > svg { transform: translateX(2px); stroke: var(--accent-text); }
.picker-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* 13. Command palette ------------------------------------------------------ */
.command-palette { position: fixed; inset: 0; z-index: 400; display: none; }
.command-palette.is-open { display: block; }
.command-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); }
.command-dialog { position: relative; width: min(560px, calc(100vw - 24px)); margin: 14vh auto 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); animation: paletteIn 160ms var(--ease) both; }
@keyframes paletteIn { from { opacity: 0; transform: translateY(-6px) scale(.99); } }
.command-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.command-input svg { width: 17px; height: 17px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; }
.command-input input { height: 50px; min-height: 50px !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 15px !important; }
.command-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.command-heading { display: block; padding: 8px 10px 6px; color: var(--text-3); font-size: 12px; }
.command-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); font-size: 13.5px; }
.command-item svg { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.command-item small { margin-left: auto; color: var(--text-3); }
.command-item:hover, .command-item.is-selected { background: var(--surface-3); color: var(--text); }
.command-item.is-selected svg { stroke: var(--accent-text); }
.command-empty { padding: 18px 10px; color: var(--text-3); font-size: 13px; text-align: center; }

/* 14. Page-specific pieces ------------------------------------------------- */
/* Knowledge base search */
.kb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.kb-search-wrap { position: relative; flex: 1; max-width: 520px; }
.kb-search-wrap > svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.kb-search-wrap input { padding-left: 34px !important; }
.kb-search-results { display: none; position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: 420px; overflow: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); }
.kb-search-results.open { display: grid; gap: 2px; }
.kb-search-results .entry { padding: 10px; color: var(--text-3); font-size: 13px; }
.kb-search-result { display: block; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); }
.kb-search-result:hover { background: var(--surface-3); color: var(--text); }
.kb-search-result-title { font-weight: 500; font-size: 13.5px; }
.kb-search-result-meta { margin-top: 1px; color: var(--text-3); font-size: 12px; }
.kb-search-result-preview { margin-top: 3px; color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Reaction roles option rows */
.option-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) 90px minmax(0, 1fr) 36px; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.option-row + .option-row { margin-top: 8px; }
.option-row .field > label { font-size: 12px; color: var(--text-2); }
.option-row .stack-sm { gap: 6px; }
.option-row .remove { width: 36px; height: 36px; padding: 0; font-size: 18px; }
.option-row .option-desc { grid-column: 1 / 5; }

/* Level reward rows */
.reward-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.reward-row + .reward-row { margin-top: 8px; }

/* Ticket type list */
.type-emoji { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); font-size: 16px; }

/* Resource status */
.res-card .panel-head { align-items: center; }
.res-state { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.res-state .dot { background: currentColor; }
.res-state.busy { background: var(--danger-soft); color: var(--danger); }
.res-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; max-height: 196px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--input-bg); }
.res-roles label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.res-roles label:hover { background: var(--surface-2); }

/* Dashboard access */
.access-role { border-top: 1px solid var(--line); }
.access-role:first-of-type { border-top: 0; }
.access-role > summary { display: flex; align-items: center; gap: 12px; padding: 13px 20px; list-style: none; cursor: pointer; }
.access-role > summary::-webkit-details-marker { display: none; }
.access-role > summary:hover { background: var(--surface-2); }
.access-role > summary .chev { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2; transition: transform var(--t); }
.access-role[open] > summary .chev { transform: rotate(90deg); }
.access-role-body { padding: 4px 20px 18px 48px; }
.perm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }

/* Voice recordings */
.recording audio { display: block; width: 100%; height: 40px; margin: 0 0 4px; }
.recording .rec-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recording .rec-title .badge { flex: 0 0 auto; }
.recording .rec-note { margin: 0; }
.recording.is-live { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.recording-foot { flex-wrap: wrap; gap: 10px; }
.recording-foot > form:first-child { margin-right: auto; }
.recording-rename { display: flex; gap: 6px; flex: 0 1 340px; min-width: 220px; }
.recording-rename input { min-height: 30px; height: 30px; }
.rec-pulse::before { animation: rec-pulse 1.4s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-pulse::before { animation: none; } }

/* Application builder (JS renders .apps-* markup) */
.apps-q { padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.apps-q + .apps-q { margin-top: 10px; }
.apps-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.apps-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 500; vertical-align: 1px; }
.apps-field { display: grid; gap: 6px; margin-top: 14px; min-width: 0; }
.apps-field > label { font-size: 13px; font-weight: 500; }
.apps-option { display: flex; gap: 6px; margin-top: 6px; }
.apps-option input { flex: 1; }
.apps-question-controls { display: flex; gap: 6px; }
.apps-btn { height: 30px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-3); color: var(--text); font-size: 12.5px; font-weight: 500; }
.apps-btn:hover { background: var(--line-strong); }
.apps-btn.secondary { background: var(--surface-3); color: var(--text); }
.apps-btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.apps-btn.danger:hover { background: var(--danger-soft); }
.apps-panel, .apps-section { display: none; }
.apps-panel.active, .apps-section.active { display: block; }
.apps-role-picker { position: relative; }
.apps-role-trigger { width: 100%; height: 36px; justify-content: space-between; padding: 0 11px; border: 1px solid var(--line-strong); background: var(--input-bg); color: var(--text-2); font-weight: 400; }
.apps-role-trigger:hover { background: var(--input-bg); border-color: var(--text-3); }
.apps-role-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); }
.apps-role-options { max-height: 240px; overflow-y: auto; margin-top: 6px; }
.apps-role-option { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.apps-role-option:hover { background: var(--surface-3); }
.apps-role-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.apps-role-tags:empty { display: none; }
.apps-role-tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 8px; border-radius: 5px; background: var(--surface-3); font-size: 12.5px; }
.apps-role-tag button { width: 18px; height: 18px; padding: 0; border: 0; background: transparent; color: var(--text-3); font-size: 14px; }
.apps-role-tag button:hover { background: var(--line-strong); color: var(--text); }
.apps-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.apps-preview-thumb { float: right; width: 80px; height: 80px; margin: 4px 0 8px 14px; border-radius: 4px; object-fit: cover; }
.apps-preview-banner { display: block; max-width: 100%; max-height: 240px; margin-top: 14px; border-radius: 4px; object-fit: cover; }
.answer { padding: 18px 20px; border-top: 1px solid var(--line); }
.answer:first-child { border-top: 0; }
.answer h3 { font-size: 13px; color: var(--text-2); font-weight: 500; }
.answer h3 span { color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: 6px; }
.answer p { margin-top: 6px; color: var(--text); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 15. Legacy single-server staff pages (/dashboard, /tickets, /kb, …) ------ */
body.legacy .layout { display: block; }
body.legacy .main-content { margin-left: var(--sidebar-w); padding: 0 28px 72px; }
body.legacy .navbar { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); margin: 0 -28px 24px; padding: 0 28px; border-bottom: 1px solid var(--line); }
body.legacy .navbar h1 { font-size: 15px; font-weight: 500; }
body.legacy .card { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
body.legacy .card + .card, body.legacy .card + br + .card { margin-top: 16px; }
body.legacy form.card { display: grid; gap: 8px; }
body.legacy form label { margin-top: 6px; font-size: 13px; font-weight: 500; }
body.legacy .builder-grid, body.legacy .sticky-grid, body.legacy .command-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 20px; align-items: start; }
body.legacy .success-card { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
body.legacy .error-card { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
body.legacy .discord-message-preview { padding: 16px; border-radius: var(--r); background: #313338; color: #dbdee1; }
body.legacy .discord-embed-preview { display: flex; margin-top: 6px; border-radius: 4px; background: #2b2d31; overflow: hidden; }
body.legacy .preview-color-bar { width: 4px; flex: 0 0 4px; background: #5865f2; }
body.legacy .discord-embed-preview .preview-content { padding: 12px 14px; flex: 1; min-width: 0; }
body.legacy .discord-embed-preview h3 { color: #f2f3f5; margin-bottom: 6px; }
body.legacy .discord-embed-preview p { color: #dbdee1; white-space: pre-wrap; }
body.legacy .preview-image { width: 100%; margin-top: 12px; border-radius: 4px; }
body.legacy .preview-thumbnail { float: right; width: 80px; height: 80px; margin-left: 12px; border-radius: 4px; object-fit: cover; }
body.legacy .preview-footer { margin-top: 8px; color: #949ba4; font-size: 12px; }
body.legacy .preview-ping { color: #c9cdfb; }
body.legacy .card-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
body.legacy .card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
body.legacy .card h3 { color: var(--text-3); font-weight: 500; font-size: 12.5px; margin-bottom: 6px; }
body.legacy form[action$="/delete"] button { background: transparent !important; border-color: color-mix(in srgb, var(--danger) 45%, transparent) !important; color: var(--danger) !important; }
body.legacy form[action$="/delete"] button:hover { background: var(--danger-soft) !important; }
.mobile-nav-toggle { display: none; }
body.legacy .user-box { display: flex; align-items: center; gap: 8px; font-size: 13px; }
body.legacy .avatar { width: 28px; height: 28px; border-radius: 50%; }

/* Scrollbars */
* { scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; background-clip: padding-box; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); border: 3px solid transparent; background-clip: padding-box; }

/* 16. Responsive & motion -------------------------------------------------- */
.sidebar-overlay { display: none; }
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-grid .module:nth-child(-n+3) { border-top: 1px solid var(--line); }
  .module-grid .module:nth-child(-n+2) { border-top: 0; }
  .module-grid .module:not(:nth-child(3n+1)) { border-left: 0; }
  .module-grid .module:nth-child(2n) { border-left: 1px solid var(--line); }
  .perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1020px) {
  .split, .split-even, .split-rev { grid-template-columns: minmax(0, 1fr); }
  .sticky-col { position: static; }
  .setting-block { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .option-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .option-row .remove { justify-self: end; }
  .option-row .option-desc { grid-column: 1 / -1; }
  body.legacy .builder-grid, body.legacy .sticky-grid, body.legacy .command-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 54px; }
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-102%); transition: transform 220ms var(--ease); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .nav-toggle { display: inline-grid; margin-left: -6px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .crumbs > span:not(.sep), .crumbs > a, .crumbs > .sep { display: none; }
  .search-trigger { min-width: 0; width: 32px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .user-chip-name { display: none; }
  .page { padding: 20px 16px 64px; }
  body.legacy .main-content { margin-left: 0; padding: 0 16px 64px; }
  body.legacy .navbar { margin: 0 -16px 20px; padding: 0 16px 0 60px; }
  body.legacy .mobile-nav-toggle { display: inline-grid; place-items: center; position: fixed; top: 11px; left: 12px; z-index: 70; width: 32px; height: 32px; padding: 0; }
  body.legacy .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  h1 { font-size: 21px; }
  .page-head, .ov-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-actions { justify-content: flex-start; }
  .grid-2, .grid-3, .grid-4, .toggle-grid, .toggle-grid-3, .perm-grid { grid-template-columns: minmax(0, 1fr); }
  .module-grid { grid-template-columns: minmax(0, 1fr); }
  .module-grid .module { border-left: 0 !important; border-top: 1px solid var(--line) !important; }
  .module-grid .module:first-child { border-top: 0 !important; }
  .panel-head, .panel-body, .setting-block, .panel-foot { padding-left: 16px; padding-right: 16px; }
  .list-item { flex-direction: column; align-items: stretch; padding-left: 16px; padding-right: 16px; }
  .list-item-actions { justify-content: flex-start; }
  .checklist-item { padding-left: 16px; padding-right: 16px; grid-template-columns: 22px minmax(0, 1fr); }
  .checklist-item > a { grid-column: 2; justify-self: start; }
  .option-row { grid-template-columns: minmax(0, 1fr); }
  .reward-row { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .access-role-body { padding-left: 20px; }
  .kb-toolbar { flex-direction: column; align-items: stretch; }
  .kb-search-wrap { max-width: none; }
  .savebar { bottom: 10px; }
  .savebar p { display: none; }
  .savebar .btn { flex: 1; }
  td, th { padding-left: 12px; padding-right: 12px; }
  .stat { padding: 14px 16px; }
  body.legacy .card-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Three-tile stat strip (voice recordings) */
.stat-strip.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-strip.cols-3 .stat:nth-child(3) { border-left: 1px solid var(--line); border-top: 0; }
@media (max-width: 640px) {
  .stat-strip.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .stat-strip.cols-3 .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
  .recording-rename { flex: 1 1 100%; min-width: 0; }
}

/* Voice recordings: search, transcript settings, snippets */
.rec-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; margin-bottom: 16px; }
.rec-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.rec-search svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-3); fill: none; stroke: currentColor; stroke-width: 1.8; }
/* The base input rule is very specific, so the borderless search field needs !important. */
.rec-search input[type="search"] { flex: 1; min-width: 0; height: 34px !important; min-height: 34px !important; border: 0 !important; background: none !important; box-shadow: none !important; padding: 0 !important; }
.rec-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.rec-settings { margin: 0; min-width: 300px; }
.rec-settings > summary { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 500; }
.rec-settings > summary::-webkit-details-marker { display: none; }
.rec-settings > summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; color: var(--text-3); }
.rec-settings > summary .badge { margin-left: auto; }
.rec-settings[open] { position: relative; z-index: 5; }
.rec-settings[open] > form { border-top: 1px solid var(--line); max-width: 420px; }
.rec-link { color: inherit; }
.rec-link:hover { color: var(--accent-text); }
.rec-snippets { list-style: none; margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); display: grid; gap: 6px; font-size: 13px; }
.rec-snippets a { color: var(--text-2); display: flex; gap: 8px; }
.rec-snippets a:hover { color: var(--text); }
mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Voice recordings: transcript page */
.tx-panel { padding: 0; overflow: hidden; }
.tx-player { position: sticky; top: 0; z-index: 2; padding: 16px 18px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tx-player audio { display: block; width: 100%; height: 40px; }
.tx-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.tx-find { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.tx-find svg { width: 15px; height: 15px; color: var(--text-3); fill: none; stroke: currentColor; stroke-width: 1.8; }
.tx-find input { height: 32px; min-height: 32px; flex: 1; }
.tx-lines { list-style: none; margin: 0; padding: 8px 8px 16px; max-height: 70vh; overflow-y: auto; }
.tx-line { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; transition: background var(--t); }
.tx-line:hover { background: var(--surface-2); }
.tx-line:focus-visible { outline: 2px solid var(--accent-line); outline-offset: -2px; }
.tx-line.is-current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tx-line.is-current .tx-time { color: var(--accent-text); }
.tx-time { border: 0; background: none; padding: 2px 0 0; text-align: left; color: var(--text-3); font-size: 12px; cursor: pointer; }
.tx-speaker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.tx-speaker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--speaker, var(--accent)); flex: 0 0 8px; }
.tx-text { margin: 2px 0 0; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.tx-line.is-current .tx-text { color: var(--text); }
.notes h3 { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-3); text-transform: none; }
.notes ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; }
.notes-summary { margin: 0; font-size: 14px; line-height: 1.55; }
.notes-actions { list-style: none; padding-left: 0 !important; }
.notes-actions li { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.speaker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.speaker-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 760px) {
  .rec-tools { grid-template-columns: minmax(0, 1fr); }
  .rec-settings { min-width: 0; }
  .tx-line { grid-template-columns: 46px minmax(0, 1fr); padding: 8px 6px; }
  .tx-lines { max-height: none; }
}

/* Ticket transcripts */
.tt-filters { grid-template-columns: minmax(0, 1fr) 220px; }
.tt-item-summary { margin: 4px 0 2px; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tt-item .list-item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tt-panel { padding: 0; overflow: hidden; }
.tt-toolbar { position: sticky; top: 0; z-index: 2; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tt-log { padding: 8px 0 18px; }
.tt-day { display: flex; align-items: center; gap: 10px; margin: 14px 16px 6px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.tt-day::before, .tt-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tt-group { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 6px 16px; }
.tt-group:hover { background: var(--surface-2); }
.tt-avatar { position: relative; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.tt-avatar-fallback { display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-weight: 600; }
.tt-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tt-body { min-width: 0; }
.tt-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 1px; }
.tt-name { font-weight: 600; font-size: 14.5px; color: var(--text); }
.tt-time { font-size: 11.5px; color: var(--text-3); }
.tt-msg { padding: 1px 0; scroll-margin-top: 80px; }
.tt-msg:target { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; }
.tt-msg.tt-dim { opacity: .28; }
.tt-text { font-size: 14px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.tt-text a, .tt-embed a { color: var(--info); }
.tt-reply { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); margin: 2px 0; min-width: 0; }
.tt-reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-image { position: relative; display: inline-block; margin-top: 6px; max-width: min(420px, 100%); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.tt-image img { display: block; max-width: 100%; max-height: 320px; }
.tt-image .tt-expired { display: none; }
.tt-image.is-expired img { display: none; }
.tt-image.is-expired .tt-expired, .tt-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.tt-file { margin-top: 6px; max-width: 420px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.tt-file svg, .tt-expired svg { width: 22px; height: 22px; flex: 0 0 22px; fill: none; stroke: currentColor; stroke-width: 1.6; color: var(--text-3); }
.tt-file strong, .tt-expired strong { display: block; font-size: 13px; font-weight: 600; }
.tt-file small, .tt-expired small { display: block; font-size: 12px; color: var(--text-3); }
.tt-embed { margin-top: 6px; max-width: 520px; padding: 10px 14px 12px; border-left: 4px solid var(--embed); border-radius: 4px; background: var(--surface-2); font-size: 13.5px; }
.tt-embed-author { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.tt-embed-title { font-weight: 700; margin-bottom: 4px; }
.tt-embed-desc { color: var(--text-2); line-height: 1.45; }
.tt-embed-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin-top: 8px; }
.tt-embed-fields > div { grid-column: 1 / -1; }
.tt-embed-fields > div.inline { grid-column: auto; }
.tt-embed-fname { font-weight: 600; margin-bottom: 2px; }
.tt-embed-image { display: block; max-width: 100%; max-height: 260px; margin-top: 8px; border-radius: 4px; }
.tt-embed-footer { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.tt-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tt-buttons span { padding: 4px 10px; border-radius: 4px; background: var(--surface-3); font-size: 12.5px; color: var(--text-2); }
.dc-mention { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, #5865f2 22%, transparent); color: #7d8bff; font-weight: 500; }
.dc-role { color: var(--role, #7d8bff); background: color-mix(in srgb, var(--role, #5865f2) 16%, transparent); }
.dc-code { margin: 4px 0; padding: 8px 10px; border-radius: 4px; background: var(--surface-3); font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; }
.tt-text code, .tt-embed code { padding: 1px 4px; border-radius: 3px; background: var(--surface-3); font-family: var(--font-mono); font-size: .9em; }
.dc-quote { display: block; padding-left: 10px; border-left: 3px solid var(--line-strong, var(--line)); color: var(--text-2); }
.dc-li { display: block; padding-left: 14px; position: relative; }
.dc-li::before { content: "•"; position: absolute; left: 2px; }
.dc-h1 { display: block; font-size: 1.4em; font-weight: 700; }
.dc-h2 { display: block; font-size: 1.2em; font-weight: 700; }
.dc-h3 { display: block; font-size: 1.05em; font-weight: 700; }
.dc-subtext { display: block; font-size: 12px; color: var(--text-3); }
.dc-spoiler { background: var(--text-3); color: transparent; border-radius: 3px; cursor: pointer; }
.dc-spoiler.is-shown { background: var(--surface-3); color: inherit; }
.dc-emoji { width: 1.35em; height: 1.35em; vertical-align: -.3em; }
.dc-ts { padding: 0 2px; border-radius: 3px; background: var(--surface-3); }
.tt-topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.tt-topbar-name { font-weight: 600; }
.tt-shell > div > .page { max-width: 1200px; margin: 0 auto; }
@media (max-width: 760px) {
  .tt-filters { grid-template-columns: minmax(0, 1fr); }
  .tt-group { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 6px 12px; }
  .tt-avatar { width: 32px; height: 32px; }
  .tt-embed-fields { grid-template-columns: minmax(0, 1fr); }
  .tt-topbar .text-sm { display: none; }
}

/* Applications: AI pre-screen */
.prescreen-flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prescreen-flags li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 1.45; }
.prescreen-flags svg { width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; }
.prescreen-flags li.is-warn svg { color: var(--warn); }
.prescreen-flags li.is-info svg { color: var(--text-3); }
.prescreen h2 .badge-premium { margin-left: 4px; vertical-align: 2px; }

/* ---------- Server insights ---------- */
.ins-since { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; }
.ins-since svg, .ins-allgood svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: 0 0 auto; }
.ins-allgood { display: flex; align-items: center; gap: 8px; margin: 0; }
.ins-allgood svg { color: var(--ok); }
.ins-stats .stat-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ins-net { color: var(--text); font-weight: 600; }
.ins-delta { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ins-delta.is-flat { color: var(--text-3); }
.ins-panel { margin-bottom: 16px; }
.ins-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ins-two > .panel { margin-bottom: 16px; }

/* Column charts: HTML bars on a recessive grid. */
.ins-chart { position: relative; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: 180px auto; column-gap: 8px; }
.ins-grid { grid-column: 1 / -1; grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.ins-grid span { position: relative; height: 0; border-top: 1px solid var(--line); margin-left: 52px; }
.ins-grid span::before { content: attr(data-v); position: absolute; right: calc(100% + 8px); top: -8px; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ins-bars { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; align-items: end; height: 180px; position: relative; z-index: 1; }
.ins-col { position: relative; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.ins-col::after { content: ""; position: absolute; inset: 0 -1px; border-radius: 4px; }
.ins-col.is-hover::after { background: var(--surface-hover); z-index: -1; }
.ins-col i { display: block; width: 100%; min-height: 0; background: var(--accent); border-radius: 4px 4px 0 0; transition: opacity var(--t); }
.ins-col i[style*="height:0.00%"] { visibility: hidden; }
.ins-bars:hover .ins-col:not(.is-hover) i { opacity: .55; }
.ins-x { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; margin-top: 6px; }
.ins-x span { color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: visible; }
/* Joins above the line, leaves below it. */
.ins-mirror .ins-col { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: stretch; }
.ins-mirror .ins-col i.is-join { align-self: end; border-radius: 4px 4px 0 0; }
.ins-mirror .ins-col i.is-leave { align-self: start; border-radius: 0 0 4px 4px; background: var(--text-3); }
.ins-legend { display: flex; gap: 14px; color: var(--text-2); font-size: 12.5px; flex: 0 0 auto; }
.ins-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ins-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.ins-legend i.is-leave { background: var(--text-3); }

.ins-table { margin-top: 14px; }
.ins-table > summary { cursor: pointer; color: var(--text-2); font-size: 13px; width: max-content; }
.ins-table > summary:hover { color: var(--text); }
.ins-table .table-wrap { margin-top: 10px; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }

/* Heatmap: one hue, more gold means busier. */
.ins-heat { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.ins-heat[hidden] { display: none; }
.ins-heat-h { color: var(--text-3); font-size: 10.5px; white-space: nowrap; overflow: visible; }
.ins-heat-d { color: var(--text-2); font-size: 12px; }
.ins-cell { aspect-ratio: 1 / 1; min-height: 12px; max-height: 30px; border-radius: 4px; background: color-mix(in srgb, var(--accent) var(--v), var(--surface-2)); box-shadow: inset 0 0 0 1px var(--line); }
.ins-cell.is-hover { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--text-2); }
.ins-scale { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; color: var(--text-3); font-size: 11.5px; }
.ins-scale i { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--accent)); box-shadow: inset 0 0 0 1px var(--line); }

/* Ranked lists and meters. */
.ins-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ins-rank-sm { margin-top: 18px; gap: 10px; }
.ins-rank-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; margin-bottom: 6px; min-width: 0; }
.ins-rank-n { display: inline-flex; gap: 8px; align-items: center; color: var(--text); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.ins-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ins-meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.ins-retention { display: grid; gap: 18px; }
.ins-ret-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 13.5px; color: var(--text-2); }
.ins-ret-head strong { color: var(--text); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ins-ret small { display: block; margin-top: 6px; font-size: 12px; }
.ins-ret-note { display: flex; gap: 12px; align-items: baseline; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.ins-ret-note strong { color: var(--text); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ins-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 0; }
.ins-mini dt { color: var(--text-3); font-size: 12.5px; }
.ins-mini dd { margin: 4px 0 0; display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ins-settings { max-width: 560px; }
.ins-panel .list { margin: 0; padding: 0; list-style: none; }
.ins-settings[open] > form { max-width: none; }

.ins-tip { position: fixed; z-index: 60; display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-3); box-shadow: var(--shadow-lg); color: var(--text-2); font-size: 12px; pointer-events: none; white-space: nowrap; }
.ins-tip strong { color: var(--text); font-size: 12.5px; }
.ins-tip span { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .ins-two { grid-template-columns: 1fr; gap: 0; }
  .ins-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-stats .stat:nth-child(3) { border-left: 0; }
  .ins-stats .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .ins-heat { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .ins-heat-h { font-size: 9px; }
  .ins-cell { border-radius: 2px; min-height: 8px; }
  .ins-chart { grid-template-columns: 34px 1fr; }
  .ins-grid span { margin-left: 42px; }
}

/* ---------- Staff performance ---------- */
.st-table td { vertical-align: middle; }
.st-table tr.is-selected td { background: var(--accent-soft); }
.st-person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 240px; color: var(--text); font-weight: 500; }
.st-person:hover { color: var(--accent-text); }
.st-person img, .st-initials { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; }
.st-initials { display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; }
.st-stars { display: inline-flex; gap: 1px; font-size: 13px; line-height: 1; letter-spacing: 0; }
.st-stars i { font-style: normal; color: var(--line-strong); }
.st-stars i.on { color: var(--accent); }
.st-rating { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.st-more { display: flex; justify-content: center; padding-top: 14px; border-top: 1px solid var(--line); }
.ins-stats .stat-note .ins-delta, .stat-note .ins-delta { margin-right: 6px; }
.st-split > .panel { margin-bottom: 16px; }
.st-dist { display: grid; gap: 10px; }
.st-dist-row { display: grid; grid-template-columns: 34px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.st-dist-label { color: var(--text-2); white-space: nowrap; }
.st-dist-n { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.st-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.st-feed li { padding: 14px 0; border-top: 1px solid var(--line); }
.st-feed li:first-child { border-top: 0; padding-top: 0; }
.st-feed li.is-low { box-shadow: inset 3px 0 0 var(--danger); padding-left: 14px; }
.st-feed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.st-feed-comment { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.st-feed .list-item-meta a { color: var(--accent-text); }
.panel-head .tabs { flex: 0 0 auto; }
@media (max-width: 900px) { .st-split { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Help menu editor ---------- */
.hm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.hm-topic > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; }
.hm-topic > summary::-webkit-details-marker { display: none; }
.hm-topic > summary .hm-emoji { width: 22px; text-align: center; }
.hm-topic > summary strong { font-weight: 600; }
.hm-topic > summary .badge { margin-left: auto; }
.hm-topic[open] > summary { border-bottom: 1px solid var(--line); }
.hm-topic + .hm-topic { margin-top: 10px; }
.hm-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 120px; gap: 12px; align-items: end; }
.hm-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hm-actions .grow { flex: 1; }
.hm-preview { position: sticky; top: calc(var(--topbar-h) + 20px); }
.hmp-msg { background: #313338; color: #dbdee1; border-radius: var(--r-lg); padding: 16px; font-family: "gg sans", "Noto Sans", var(--font-sans); font-size: 14px; }
.hmp-embed { border-left: 4px solid var(--hmp-color, #E9B44C); background: #2b2d31; border-radius: 4px; padding: 10px 14px 14px; }
.hmp-author { font-size: 12.5px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.hmp-title { font-weight: 700; color: #fff; margin-bottom: 6px; }
.hmp-desc { white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
.hmp-desc strong { color: #fff; }
.hmp-field { margin-top: 10px; }
.hmp-field b { display: block; color: #fff; font-size: 13px; margin-bottom: 2px; }
.hmp-field span { display: block; white-space: pre-wrap; font-size: 13.5px; }
.hmp-code { background: #1e1f22; border-radius: 3px; padding: 0 3px; font-family: var(--font-mono); font-size: 12.5px; }
.hmp-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.hmp-footer { margin-top: 10px; font-size: 12px; color: #b5bac1; }
.hmp-select { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; background: #1e1f22; border-radius: 4px; padding: 9px 12px; color: #b5bac1; font-size: 13.5px; }
@media (max-width: 1100px) { .hm-grid { grid-template-columns: 1fr; } .hm-preview { position: static; } }
@media (max-width: 640px) { .hm-row { grid-template-columns: 1fr; } }

/* ---------- Privacy policy and terms ---------- */
.lg-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.lg-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.lg-top .sb-brand { padding: 0; border: 0; }
.lg-doc { width: min(760px, 100%); margin: 0 auto; padding: 40px 24px 56px; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.lg-doc h1 { color: var(--text); font-size: 30px; letter-spacing: -.02em; margin-bottom: 4px; }
.lg-doc h2 { color: var(--text); font-size: 18px; margin: 34px 0 8px; scroll-margin-top: 80px; }
.lg-doc h3 { color: var(--text); font-size: 15px; margin: 20px 0 4px; }
.lg-doc p, .lg-doc ul { margin: 0 0 12px; }
.lg-doc ul { padding-left: 20px; }
.lg-doc li { margin: 4px 0; }
.lg-doc strong { color: var(--text); }
.lg-doc a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.lg-doc code { font-size: 13px; }
.lg-meta { color: var(--text-3); font-size: 13px; margin-bottom: 24px !important; }
.lg-callout { padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: var(--r); background: var(--accent-soft); color: var(--text); }
.lg-foot { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }
.lg-foot a { color: var(--text-3); }
.lg-foot a:hover { color: var(--text); }
.sb-legal { display: flex; gap: 10px; padding: 6px 10px 0; font-size: 11.5px; }
.sb-legal a { color: var(--text-3); }
.sb-legal a:hover { color: var(--text); }
@media (max-width: 640px) { .lg-top { padding: 10px 16px; } .lg-doc { padding: 28px 16px 40px; font-size: 14.5px; } .lg-doc h1 { font-size: 25px; } }

/* ---------- Premium page and upgrade prompts ---------- */
.pm-hero { margin-bottom: 18px; overflow: hidden; background: radial-gradient(700px 240px at 0% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.pm-hero.is-premium { border-color: var(--accent-line); }
.pm-hero-body { padding: 28px; }
.pm-hero-body h1 { font-size: 26px; letter-spacing: -.02em; margin: 12px 0 6px; }
.pm-redeem { margin-bottom: 18px; }
.pm-redeem-body { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 20px 24px; }
.pm-redeem-body h2 { font-size: 16px; margin: 0 0 4px; }
.pm-redeem-body p { margin: 0; max-width: 56ch; }
.pm-redeem-form { display: flex; gap: 10px; flex: 0 1 380px; }
.pm-redeem-form input { flex: 1; min-width: 0; font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.pm-redeem-msg { margin: 0 24px 20px; }
.pm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pm-card { display: grid; gap: 6px; padding: 18px; margin: 0; color: var(--text-2); transition: border-color var(--t), transform var(--t); }
.pm-card:hover { border-color: var(--accent-line); color: var(--text-2); }
.pm-card h3 { color: var(--text); font-size: 15px; }
.pm-card p { font-size: 13px; line-height: 1.5; margin: 0; }
.pm-card.is-locked { opacity: .85; }
.pm-card-head { display: flex; align-items: center; justify-content: space-between; }
.pm-emoji { font-size: 22px; }
.pu-panel { margin-bottom: 18px; background: radial-gradient(600px 220px at 50% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.pu-inner { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 24px; }
.pu-inner h2 { font-size: 18px; }
.pu-inner p { max-width: 520px; color: var(--text-2); font-size: 14px; margin: 0 0 6px; }
.pu-badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.pu-badge svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.pu-banner { align-items: center; flex-wrap: wrap; }
.pu-banner svg { fill: currentColor; stroke: none; }
@media (max-width: 1000px) { .pm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pm-grid { grid-template-columns: 1fr; } .pm-hero-body { padding: 20px; } }

/* ---------- Announcement bar ---------- */
.ann-bar { position: relative; display: flex; align-items: stretch; height: 34px; background: var(--ann-bg); color: var(--ann-fg); overflow: hidden; font-size: 13px; font-weight: 500; z-index: 20; }
.ann-viewport { flex: 1; min-width: 0; overflow: hidden; }
.ann-track { display: flex; width: max-content; height: 100%; animation: ann-scroll 45s linear infinite; will-change: transform; }
.ann-bar:hover .ann-track, .ann-bar:focus-within .ann-track { animation-play-state: paused; }
@keyframes ann-scroll { from { transform: translateX(0); } to { transform: translateX(var(--ann-shift, -50%)); } }
.ann-group { display: flex; height: 100%; }
.ann-item { display: inline-flex; align-items: center; gap: 8px; height: 100%; padding: 0 28px; background: var(--ann-bg); color: var(--ann-fg); white-space: nowrap; }
.ann-item + .ann-item, .ann-group + .ann-group .ann-item:first-child { box-shadow: inset 1px 0 0 color-mix(in srgb, var(--ann-fg) 22%, transparent); }
.ann-emoji { font-size: 14px; }
.ann-link { color: inherit !important; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ann-close { flex: 0 0 34px; width: 34px; height: 34px !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: color-mix(in srgb, var(--ann-bg) 80%, #000) !important; color: var(--ann-fg) !important; font-size: 18px; line-height: 1; cursor: pointer; }
.ann-close:hover { background: color-mix(in srgb, var(--ann-bg) 65%, #000) !important; }
.ann-bar.is-static .ann-track { animation: none; width: 100%; }
.ann-bar.is-static .ann-item { width: 100%; justify-content: center; white-space: normal; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Feedback dialog ---------- */
.fb-open { gap: 6px; }
.fb-open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
@media (max-width: 760px) { .fb-open span { display: none; } }
.fb-dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.fb-dialog::backdrop { background: var(--overlay); }
.fb-form { display: grid; gap: 14px; padding: 20px; }
.fb-head { display: flex; justify-content: space-between; align-items: center; }
.fb-head h2 { font-size: 17px; }
.fb-kinds { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-kinds label { cursor: pointer; }
.fb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kinds span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--text-2); }
.fb-kinds input:checked + span { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.fb-kinds input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-status { margin: 0; color: var(--text-2); }

/* ---------- Public status page ---------- */
.st-hero { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; margin: 8px 0 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.st-hero strong { display: block; color: var(--text); font-size: 18px; }
.st-hero p { margin: 2px 0 0 !important; font-size: 14px; }
.st-dot { flex: none; width: 12px; height: 12px; margin-top: 7px; border-radius: 50%; background: var(--st, #22C55E); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st, #22C55E) 22%, transparent); }
.st-ok { --st: #22C55E; } .st-warn { --st: #F59E0B; } .st-down { --st: #EF4444; } .st-maint { --st: #EF4444; }
.st-hero.st-ok { border-color: color-mix(in srgb, #22C55E 40%, var(--line)); }
.st-hero.st-down, .st-hero.st-maint { border-color: color-mix(in srgb, #EF4444 45%, var(--line)); }
.st-hero.st-warn { border-color: color-mix(in srgb, #F59E0B 45%, var(--line)); }
.st-faint { color: var(--text-3); font-size: 13px; }
.st-notices { display: grid; gap: 8px; margin-bottom: 18px; }
.st-notice { padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid; border-radius: var(--r); background: var(--surface); color: var(--text); font-size: 14px; }
.st-rows { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.st-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); }
.st-row:first-child { border-top: 0; }
.st-name { color: var(--text); font-weight: 600; font-size: 14.5px; }
.st-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); text-align: right; }
.st-state i { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; flex: none; }
.st-state.st-warn i { background: #F59E0B; } .st-state.st-down i, .st-state.st-maint i { background: #EF4444; }
.st-uptime { margin-top: 26px; }
.st-uptime-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.st-uptime-head h2 { margin: 0 !important; }
.st-uptime-head span { font-size: 13.5px; } .st-uptime-head strong { font-size: 15px; }
.st-bars { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 38px; margin-top: 12px; }
.st-bar { border-radius: 3px; background: #22C55E; }
.st-bar-warn { background: #F59E0B; } .st-bar-down { background: #EF4444; } .st-bar-none { background: var(--line-strong); }
.st-axis { display: flex; justify-content: space-between; margin: 6px 0 10px; color: var(--text-3); font-size: 12px; }
@media (max-width: 640px) { .st-bars { gap: 2px; height: 32px; } .st-row { padding: 12px 14px; } }
.rec-access { margin: 0 0 16px !important; width: 100%; }

/* ---------- Status page: incidents and maintenance ---------- */
.st-section { margin-top: 30px; }
.st-section h2 { margin: 0 0 12px !important; }
.st-day { margin: 18px 0 10px !important; color: var(--text); font-size: 15px; font-weight: 600; }
.st-card { padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.st-card-live { border-color: color-mix(in srgb, #F59E0B 45%, var(--line)); }
.st-card-live.st-impact-outage { border-color: color-mix(in srgb, #EF4444 50%, var(--line)); }
.st-empty { color: var(--text-2); text-align: center; padding: 26px 18px; }
.st-affects { margin: 0 0 12px !important; color: var(--text-3); font-size: 13px; }
.st-up { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.st-up:first-of-type, .st-affects + .st-up { border-top: 0; padding-top: 0; }
.st-pill { justify-self: start; padding: 4px 10px; border-radius: 6px; background: var(--pill); color: #fff; font-size: 12.5px; font-weight: 600; text-align: center; min-width: 96px; }
.st-up-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.st-up-head strong { color: var(--text); font-size: 14px; }
.st-up-head time { color: var(--text-3); font-size: 12.5px; }
.st-up-body p { margin: 4px 0 0 !important; color: var(--text-2); font-size: 14.5px; }
@media (max-width: 640px) { .st-up { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* Applications: free-plan usage */
.apps-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.apps-usage { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.apps-usage.is-full { border-color: var(--accent-line); color: var(--accent-text, var(--accent)); }

/* Member history */
.mh-search { padding: 18px 20px; display: grid; gap: 10px; }
.mh-search-form { display: flex; align-items: center; gap: 10px; position: relative; }
.mh-search-form > svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2; pointer-events: none; }
.mh-search-form input { flex: 1; min-width: 0; padding-left: 36px !important; height: 40px; }
.mh-search-form .btn { height: 40px; }
.mh-person { gap: 12px; }
.mh-av { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.mh-av-fallback { display: grid; place-items: center; color: var(--text-2); font-size: 12px; font-weight: 600; }
.mh-av-lg { width: 64px; height: 64px; flex-basis: 64px; font-size: 20px; }
.mh-head { padding: 20px; margin-bottom: 20px; }
.mh-id { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.mh-id-text { flex: 1; min-width: 0; }
.mh-id-text h1 { font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.mh-id-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; color: var(--text-2); font-size: 13.5px; }
.mh-id-text .badge { max-width: 100%; height: auto; min-height: 20px; white-space: normal; line-height: 1.35; padding-top: 2px; padding-bottom: 2px; }
.mh-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.mh-facts dt { color: var(--text-3); font-size: 12px; margin-bottom: 3px; }
.mh-facts dd { margin: 0; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.mh-facts .span-all { grid-column: 1 / -1; }
.mh-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.mh-role { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.mh-role i { width: 8px; height: 8px; border-radius: 50%; }
.mh-filter { padding: 0 20px; margin-bottom: 0; overflow-x: auto; scrollbar-width: none; }
.mh-filter a { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.mh-filter a svg { width: 13px; height: 13px; fill: none; stroke: var(--accent-text); stroke-width: 2; }
.mh-filter a.is-locked { color: var(--text-3); }
.mh-n { padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); font-size: 11.5px; line-height: 18px; }
.mh-tl { list-style: none; margin: 0; padding: 8px 20px 20px; }
.mh-day { padding: 16px 0 6px 26px; color: var(--text-3); font: 500 11.5px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mh-ev { --tone: var(--text-3); position: relative; display: flex; gap: 14px; padding: 8px 0 12px; }
.mh-ev::before { content: ""; position: absolute; left: 5px; top: 22px; bottom: -6px; width: 1px; background: var(--line); }
.mh-ev:last-child::before, .mh-ev:has(+ .mh-day)::before { display: none; }
.mh-dot { flex: 0 0 11px; width: 11px; height: 11px; margin-top: 5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 18%, transparent); }
.mh-ev.tone-red { --tone: var(--danger); } .mh-ev.tone-amber { --tone: var(--warn); } .mh-ev.tone-green { --tone: var(--ok); }
.mh-ev.tone-blue { --tone: var(--info); } .mh-ev.tone-brass { --tone: var(--accent); } .mh-ev.tone-neutral { --tone: var(--text-3); }
.mh-ev.tone-red .mh-dot, .mh-ev.tone-brass .mh-dot { background: var(--tone); }
.mh-ev.is-cleared .mh-ev-top strong { color: var(--text-2); }
.mh-ev-body { flex: 1; min-width: 0; }
.mh-ev-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mh-ev-top strong { font-size: 14px; font-weight: 600; }
.mh-ev-top time { flex: 0 0 auto; color: var(--text-3); font: 12px var(--font-mono); }
.mh-ev-text { margin-top: 4px; color: var(--text); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mh-ev.tone-brass .mh-ev-text { padding: 8px 12px; border-left: 2px solid var(--accent-line); background: var(--accent-soft); border-radius: 0 6px 6px 0; }
.mh-ev-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; color: var(--text-3); font-size: 12.5px; }
.mh-ev-meta b { color: var(--text-2); font-weight: 500; }
.mh-ev-meta a { color: var(--accent-text); }
.mh-note-form { display: grid; gap: 10px; }
.mh-note-form textarea { min-height: 76px; }
.mh-notes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.mh-note { padding: 14px 20px; border-top: 1px solid var(--line); }
.mh-note:first-child { border-top: 0; }
.mh-note-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.mh-note-head b { color: var(--text); font-weight: 600; }
.mh-note p { margin-top: 6px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mh-note-actions { display: flex; gap: 4px; margin: 6px 0 0 -8px; }
.mh-note-actions form { margin: 0; }
.mh-note-actions svg { width: 13px; height: 13px; }
.mh-notes-locked { display: grid; gap: 12px; justify-items: start; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.mh-notes-locked svg { width: 14px; height: 14px; vertical-align: -2px; fill: none; stroke: var(--accent-text); stroke-width: 2; }
.mh-tips { display: grid; gap: 8px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
@media (max-width: 1020px) { .mh-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 680px) {
  .mh-id { flex-wrap: wrap; }
  .mh-actions { width: 100%; }
  .mh-facts { grid-template-columns: minmax(0, 1fr); }
  .mh-search-form { flex-wrap: wrap; }
  .mh-search-form .btn { width: 100%; }
  .mh-tl { padding: 4px 16px 16px; }
}

/* Knowledge base: bulk upload */
.kb-drop { display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:16px; border:1px dashed var(--line-strong); border-radius:var(--r); background:var(--surface-2); }
.kb-drop > svg { width:22px; height:22px; flex:none; fill:none; stroke:var(--text-3); stroke-width:1.8; }
.kb-drop-text { display:grid; gap:2px; flex:1; min-width:180px; }
.kb-drop-text strong { font-size:13.5px; overflow-wrap:anywhere; }
.kb-drop-actions { display:flex; gap:6px; }
.kb-drop-actions label { cursor:pointer; }
.sb-link .sb-ext { width:12px !important; height:12px !important; margin-left:auto; opacity:.6; }
.pm-supporter { display:flex; gap:8px; align-items:flex-start; margin-top:12px; color:var(--text-2); font-size:13.5px; line-height:1.5; }
.pm-supporter svg { width:15px; height:15px; flex:none; margin-top:2px; fill:none; stroke:var(--accent-text); stroke-width:2; }
.pm-supporter a { color:var(--accent-text); }

/* Searchable single-choice select (select[data-searchable]) */
.ms-single .ms-chip { background: transparent; padding-left: 2px; font-size: 13.5px; height: auto; }
.ms-single .ms-control { cursor: pointer; flex-wrap: nowrap; }
.ms-single .ms-chip { min-width: 0; flex: 0 1 auto; }
.ms-single .ms-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-single .ms-chip ~ .ms-search { min-width: 24px; }
.ms.is-invalid .ms-control { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.ms-option.is-disabled { opacity: .45; cursor: not-allowed; }

/* Embed builder templates */
.tpl-save { display: flex; gap: 8px; }
.tpl-save input { flex: 1; min-width: 0; }
.tpl-actions { margin-top: 10px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Choice cards (a radio with a title and a line of explanation) */
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--surface); }
.radio-card + .radio-card { margin-top: 8px; }
.radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.radio-card input { margin-top: 3px; accent-color: var(--accent); }
.radio-card strong { display: block; font-size: 14px; }
.radio-card small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }

/* 1DShop role discounts */
.sh-rd-list { display: grid; gap: 8px; }
.sh-rd { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 8px; align-items: center; }
.sh-rd-pct { display: flex; align-items: center; gap: 6px; }
.sh-rd-pct input { width: 72px; }
.sh-rd-pct span { color: var(--text-3); font-size: 13px; white-space: nowrap; }
@media (max-width: 560px) { .sh-rd { grid-template-columns: minmax(0, 1fr) auto; } .sh-rd-pct { grid-column: 1; } }
.sh-section-head { margin: 28px 0 12px; }
.sh-section-head h2 { font-size: 16px; }
.sh-section-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }

/* 1DShop: per-method instructions, reviews */
.sh-method-howto { grid-column: 1 / -1; min-height: 0; font-size: 13px; }
.sh-reviews { display: grid; }
.sh-review { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sh-review:last-child { border-bottom: 0; }
.sh-review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.sh-review-text { margin: 8px 0 4px; white-space: pre-wrap; line-height: 1.5; }
.sh-stars { color: #e9b44c; letter-spacing: 1px; font-size: 15px; }
.sh-avg { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sh-avg .n { font-size: 32px; font-weight: 700; line-height: 1; }
.sh-dist { display: grid; gap: 6px; font-size: 13px; }
.sh-dist > div { display: grid; grid-template-columns: 34px 1fr 28px; gap: 8px; align-items: center; }
.sh-dist .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.sh-dist .bar i { display: block; height: 100%; background: #e9b44c; border-radius: 99px; }
.rec-expiring { color: var(--warn, #e9b44c); font-weight: 600; }
.sh-logo-pick { display: grid; gap: 8px; }
.sh-logo-pick .radio-card + .radio-card { margin-top: 0; }
.sh-logo-pick.is-locked { opacity: .6; }
.sh-logo-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sh-logo-upload img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }

/* Under construction (switched on the admin site) */
.cx { position: fixed; inset: var(--topbar-h, 60px) 0 0 var(--sidebar-w); z-index: 40; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--bg) 35%, transparent); }
@media (max-width: 900px) { .cx { left: 0; } }
.cx-card { width: min(460px, 100%); text-align: center; padding: 28px 28px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); color: var(--text); }
.cx-art { width: 220px; max-width: 80%; height: auto; display: block; margin: 0 auto 10px; color: var(--text); }
.cx-kicker { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.cx-card h2 { font-size: 22px; margin: 0 0 8px; }
.cx-card p { color: var(--text-2); line-height: 1.55; margin: 0 0 8px; }
.cx-note { font-size: 13.5px; color: var(--text-3) !important; }
.cx-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.cx-preview { position: fixed; right: 16px; bottom: 16px; z-index: 40; max-width: 360px; padding: 10px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--surface); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 13px; line-height: 1.45; }
.sb-pill-build { background: transparent; border: 0; padding: 0; font-size: 13px; }
.sb-pill-beta { background: color-mix(in srgb, #8b7cf6 18%, transparent); border-color: color-mix(in srgb, #8b7cf6 50%, transparent); color: #b9adff; }
:root[data-theme="light"] .sb-pill-beta { color: #5b45d6; }
.cx-beta .cx-kicker { color: #8b7cf6; }
.cx-beta .cx-card { border-color: color-mix(in srgb, #8b7cf6 35%, var(--line)); }
.cx-preview-beta { border-color: color-mix(in srgb, #8b7cf6 50%, transparent); }
.sb-link.is-building > span:not(.sb-pill) { opacity: .75; }

/* Switches locked by the master AI switch (Settings → AI) */
.is-ai-locked { cursor: not-allowed; }
.is-ai-locked input[type="checkbox"] { opacity: .55; }
.is-ai-locked .toggle-text small { opacity: .75; }
.ai-lock-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; vertical-align: 1px; color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.ai-lock-note { margin: 8px 0 4px; padding: 10px 12px; border-radius: var(--r); font-size: 13px; color: var(--text); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.ai-lock-note a { font-weight: 600; margin-left: 2px; }
.ai-lock-note.is-flash { animation: aiLockFlash .6s var(--ease, ease); }
@keyframes aiLockFlash { 0% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .ai-lock-note.is-flash { animation: none; } }
.ai-off-banner { margin-bottom: 20px; }
.ai-master-warn[hidden] { display: none; }
.ai-master-list { margin: 6px 0 8px 18px; padding: 0; display: grid; gap: 2px; }

/* Support access (Dashboard access page + the strip on every page while it's open) */
.support-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 20px; background: var(--accent-soft); color: var(--accent-text); border-bottom: 1px solid var(--accent-line); font-size: 13px; line-height: 1.4; }
.support-strip svg { width: 15px; height: 15px; flex: none; }
.support-strip span { flex: 1 1 260px; min-width: 0; }
.support-strip a { color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.support-now { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: var(--r); background: color-mix(in srgb, var(--accent) 5%, var(--surface-2)); }
.support-now p { margin: 0; }
.support-form .row { flex-wrap: wrap; gap: 8px; }

/* ---------- Help desk (inbox, ticket, settings) ---------- */
.hd-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.hd-back:hover { color: var(--text); }
.hd-back svg { width: 15px; height: 15px; }
.hd-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hd-views { flex-wrap: wrap; max-width: 100%; }
.hd-n { font-size: 11px; color: var(--text-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.tabs a.active .hd-n { color: inherit; opacity: .8; }
.hd-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hd-filters .kb-search-wrap { min-width: 220px; flex: 1 1 240px; }
.hd-filters select { width: auto; }
.hd-list { overflow: hidden; }
.hd-rows { list-style: none; margin: 0; padding: 0; }
.hd-row + .hd-row { border-top: 1px solid var(--line); }
.hd-row a { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 18px; color: inherit; text-decoration: none; }
.hd-row a:hover { background: var(--surface-hover); }
.hd-dot { width: 8px; height: 8px; border-radius: 50%; }
.hd-row.is-unread .hd-dot { background: var(--accent); }
.hd-row.is-unread .hd-subj { color: var(--text); }
.hd-main, .hd-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hd-side { align-items: flex-end; text-align: right; }
.hd-line1 { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.hd-num { color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.hd-subj { font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-line2 { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--text-2); }
.hd-chip.is-tag { border-color: var(--accent-line); color: var(--accent-text); }
.hd-badges { display: flex; gap: 6px; }
.hd-late { color: var(--danger); font-weight: 500; }
.hd-pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .hd-row a { grid-template-columns: 8px minmax(0, 1fr); padding: 12px 14px; }
  .hd-side { grid-column: 2; align-items: flex-start; text-align: left; }
}
/* the ticket page */
.hd-title { font-size: 24px; line-height: 1.25; }
.hd-status { align-self: flex-start; }
.hd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .hd-grid { grid-template-columns: 1fr; } }
.hd-convo { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hd-thread { padding: 18px; display: flex; flex-direction: column; gap: 14px; max-height: 64vh; overflow-y: auto; }
.hd-aside { display: flex; flex-direction: column; gap: 14px; }
.hd-aside .panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.hd-aside .field { margin: 0; }
.hd-save-tags { align-self: flex-start; }
.hd-info dl { margin: 0; display: grid; gap: 10px; }
.hd-info dl > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; font-size: 13px; }
.hd-info dt { color: var(--text-3); }
.hd-info dd { margin: 0; overflow-wrap: anywhere; }
.hd-h3 { font-size: 13px; margin: 0; color: var(--text-2); font-weight: 500; }
.hd-others { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.hd-closed-box { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.hd-closed-box p { margin: 0; }
/* messages (shared with the portal) */
.hd-msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; max-width: 760px; }
.hd-msg.is-team { margin-left: auto; grid-template-columns: minmax(0, 1fr) 32px; }
.hd-msg.is-team .hd-av { order: 2; }
.hd-av { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text-2); overflow: hidden; }
.hd-av img { width: 100%; height: 100%; object-fit: cover; }
.hd-bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; min-width: 0; }
.hd-msg.is-staff .hd-bubble { background: color-mix(in srgb, var(--info) 8%, var(--surface-2)); border-color: color-mix(in srgb, var(--info) 25%, var(--line)); }
.hd-msg.is-note .hd-bubble { background: var(--warn-soft); border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); }
.hd-msg.is-bot .hd-bubble { background: var(--surface); }
.hd-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.hd-meta strong { color: var(--text); font-size: 13px; font-weight: 600; }
.hd-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.hd-msg.is-note .hd-tag { color: var(--warn); }
.hd-src { font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 99px; }
.hd-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.hd-body a { color: var(--accent-text); }
.hd-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hd-img img { max-width: 220px; max-height: 160px; border-radius: 8px; display: block; border: 1px solid var(--line); }
.hd-file { font-size: 13px; color: var(--accent-text); }
.hd-sys { text-align: center; font-size: 12px; color: var(--text-3); }
.hd-sys span { padding: 3px 10px; border-radius: 99px; background: var(--surface-2); }
/* reply box */
.hd-compose { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.hd-compose textarea { min-height: 110px; resize: vertical; }
.hd-compose.is-note textarea { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.hd-compose-tabs { display: flex; gap: 4px; }
.hd-compose-tabs label { position: relative; cursor: pointer; }
.hd-compose-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.hd-compose-tabs span { display: inline-block; padding: 5px 12px; border-radius: var(--r-sm); font-size: 13px; color: var(--text-2); }
.hd-compose-tabs input:checked + span { background: var(--surface-3); color: var(--text); }
.hd-compose-tabs input:focus-visible + span { outline: 2px solid var(--accent); }
.hd-compose-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hd-compose-foot select { width: auto; max-width: 220px; }
.hd-compose-foot .grow { flex: 1; }
.hd-where { margin: 0; }
/* settings */
.hd-slug { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hd-slug input { flex: 1 1 160px; max-width: 280px; }
.hd-arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 360px; overflow: auto; padding: 2px; }
.hd-art-cat { grid-column: 1 / -1; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-top: 6px; }
.hd-snippet { display: flex; gap: 8px; }
.hd-snippet input { font-family: var(--font-mono); font-size: 12px; }
.hd-saved { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.hd-saved.is-new { border-style: dashed; }
/* 1D3R support (community side) and the admin inbox extras */
.hd-new { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.hd-new h2, .hd-suggest h2 { font-size: 16px; margin: 0; }
.hd-new .field { margin: 0; }
.hd-suggest { padding: 18px; display: flex; flex-direction: column; gap: 12px; border-color: var(--accent-line); }
.hd-answer { background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; }
.hd-answer-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 4px; }
.hd-guides { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hd-guides a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--text); text-decoration: none; }
.hd-guides a:hover { border-color: var(--accent-line); }
.hd-guides small { color: var(--text-3); font-size: 12.5px; }
.hd-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hd-mini a { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; color: var(--text); text-decoration: none; font-size: 13.5px; }
.hd-mini a:hover strong { color: var(--accent-text); }
.hd-mini .badge { flex: none; }
.hd-mini small { display: block; font-size: 12px; margin-top: 2px; }
.hd-ctx { margin: 0; display: grid; gap: 6px; font-size: 13px; }
.hd-ctx li { color: var(--text-2); }
.hd-link-server { display: flex; gap: 6px; }
.hd-link-server input { font-family: var(--font-mono); font-size: 12.5px; }
.hd-access-on { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; font-size: 13px; padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-line); }
