/* ============================================================
   SecureBoot — design system
   Dark, neutral surfaces, one accent, status colors carry meaning.
   No global zoom/scale tricks — fluid layout at every width.
   ============================================================ */

:root {
  /* native form controls (select dropdowns, checkboxes, scrollbars) render dark */
  color-scheme: dark;

  /* surfaces — depth comes from layered lightness, never from heavy effects */
  --canvas: #0a0c0f;
  --surface: #101318;
  --surface-2: #161a21;
  --inset: #0d1014;
  --raise: rgba(255, 255, 255, .03);
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);
  --ink: #e8ebef;
  --ink-dim: #9ba4b0;
  --ink-mute: #6b7581;
  --accent: #5b7cfa;
  --accent-hi: #7e97ff;
  --accent-soft: rgba(91, 124, 250, .14);
  --ok: #35c48d;
  --ok-soft: rgba(53, 196, 141, .13);
  --warn: #dfae3c;
  --warn-soft: rgba(223, 174, 60, .13);
  --bad: #ec5f6b;
  --bad-soft: rgba(236, 95, 107, .13);
  --info: #5b9cf9;
  --info-soft: rgba(91, 156, 249, .13);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  /* elevation — reserved for floating elements only */
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-m: 0 4px 16px -2px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow-l: 0 16px 48px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ring: 0 0 0 2px var(--canvas), 0 0 0 4px rgba(126, 151, 255, .55);
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;
  --sidebar-w: 232px;
  --topbar-h: 54px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; }
code, kbd { font-family: var(--mono); font-size: .92em; }
:focus-visible { box-shadow: var(--ring); outline: none; border-radius: 4px; }
::selection { background: var(--accent); color: #fff; }

/* slim, unobtrusive scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.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;
}

/* ---------- app shell ---------- */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #101318, #0d1014);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.side-brand {
  display: flex; align-items: center; gap: 9px;
  height: var(--topbar-h); padding: 0 14px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.side-brand img { width: 22px; height: 22px; border-radius: 6px; }
.side-brand b { font-size: 14px; letter-spacing: -.01em; }
.side-brand span { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--ink-mute); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; text-transform: uppercase; letter-spacing: .06em; }

.nav-groups { flex: 1; padding: 8px 10px 14px; }
.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label {
  padding: 0 8px 4px; font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute);
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 9px; border-radius: var(--radius-s);
  font-size: 13px; font-weight: 500; color: var(--ink-dim);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--ink); }
.nav-item.is-active { background: rgba(255, 255, 255, .06); color: var(--ink); font-weight: 600; }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 999px; background: var(--accent);
}
.nav-item svg { width: 16px; height: 16px; opacity: .78; transition: opacity .14s var(--ease), transform .14s var(--ease); }
.nav-item:hover svg, .nav-item.is-active svg { opacity: 1; }
.nav-item.is-active svg { color: var(--accent-hi); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); } .dot-idle { background: var(--line-strong); }

.side-foot { padding: 10px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 8px; padding: 4px 4px 8px; min-width: 0; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-2); color: var(--ink-dim);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.side-user div { min-width: 0; }
.side-user strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { display: block; font-size: 10.5px; color: var(--ink-mute); }
.side-foot .nav-item { color: var(--ink-mute); }
.side-foot .nav-item:hover { color: var(--ink-dim); }
.side-foot .nav-item.signout { width: 100%; }
.side-foot .nav-item.signout button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-size: 13px; font-weight: 500; color: inherit; text-align: left;
}
.side-foot .nav-item.signout:hover { background: rgba(236, 95, 107, .08); color: var(--bad); }

/* ---------- topbar user menu (avatar + dropdown) ---------- */
.user-menu { position: relative; flex-shrink: 0; margin-left: 4px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 5px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.user-chip:hover { background: rgba(255, 255, 255, .05); border-color: var(--line); }
.user-chip .user-name {
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 550; color: var(--ink-dim);
}
.user-chip > svg { width: 13px; height: 13px; color: var(--ink-mute); transition: transform .16s var(--ease); }
.user-menu.is-open .user-chip { background: rgba(255, 255, 255, .06); border-color: var(--line-strong); }
.user-menu.is-open .user-chip > svg { transform: rotate(180deg); }
.avatar.avatar-md { width: 28px; height: 28px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.avatar.avatar-lg { width: 38px; height: 38px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }

.user-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 224px;
  background: #14181f;
  border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-l), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.user-pop-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 9px 11px; margin-bottom: 3px;
  border-bottom: 1px solid var(--line);
}
.user-pop-id { min-width: 0; }
.user-pop-id strong {
  display: block; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-pop-id small { display: block; font-size: 11px; color: var(--accent-hi); margin-top: 2px; }
a.user-pop-item, form.user-pop-item button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: var(--radius-s);
  font-size: 13px; font-weight: 500; color: var(--ink-dim); text-align: left;
  transition: background .12s var(--ease), color .12s var(--ease);
}
a.user-pop-item:hover, form.user-pop-item button:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.user-pop-item svg { width: 14px; height: 14px; opacity: .75; flex-shrink: 0; }
form.user-pop-item.signout button { color: var(--bad); }
form.user-pop-item.signout button:hover { background: var(--bad-soft); color: var(--bad); }
.user-pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 20px;
  background: rgba(10, 12, 15, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; color: var(--ink-dim); padding: 6px; margin-left: -6px; border-radius: var(--radius-s); }
.menu-btn svg { width: 20px; height: 20px; }
.menu-btn:hover { background: var(--surface-2); color: var(--ink); }
.crumb { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.crumb span { font-size: 12px; color: var(--ink-mute); white-space: nowrap; }
.crumb h1 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-status { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; font-weight: 500; color: var(--ink-dim);
  background: var(--surface); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pill.is-online { border-color: rgba(53, 196, 141, .35); }
.pill.is-offline { border-color: rgba(236, 95, 107, .35); }

.guild-select { position: relative; }
.guild-select select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); color: var(--ink);
  font-size: 12.5px; font-weight: 500;
  padding: 5px 26px 5px 10px; max-width: 190px;
  cursor: pointer;
}
.guild-select select:hover { border-color: var(--line-strong); }
.guild-select svg { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; pointer-events: none; color: var(--ink-mute); }

.content { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.content-body {
  flex: 1; width: 100%;
  padding: 26px 28px 40px;
  max-width: 1680px;
  margin: 0 auto;
}
.page-head { margin-bottom: 20px; }
.page-head .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); }
.page-head h2 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.page-head p { margin-top: 5px; font-size: 13.5px; color: var(--ink-dim); max-width: 62ch; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.footer {
  border-top: 1px solid var(--line);
  padding: 14px 28px; font-size: 12px; color: var(--ink-mute);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.footer a:hover { color: var(--ink-dim); }

.drawer-scrim {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(4, 5, 7, .6);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }

/* ---------- panels & stats ---------- */
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .022), rgba(255, 255, 255, 0) 56px),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-s);
}
.panel + .panel { margin-top: 16px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 13.5px; font-weight: 600; }
.panel-head .hint { font-size: 12px; color: var(--ink-mute); }
.panel-body { padding: 16px; }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }

/* Panel header: small icon + title on the left, hint on the right (reference layout). */
.panel-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.panel-title svg { width: 15px; height: 15px; color: var(--ink-mute); flex-shrink: 0; }
.panel-head .panel-hint { font-size: 12px; color: var(--ink-mute); }

/* Responsive grid placing settings panels side by side (1 col below ~900px). */
.settings-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}
.settings-grid .panel + .panel { margin-top: 0; }

/* Carl-bot style settings rows: title + hint left, toggle switch right. */
.check-list { display: flex; flex-direction: column; }
.check-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 0; cursor: pointer; border-bottom: 1px solid var(--line);
}
.check-item:first-child { padding-top: 2px; }
.check-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.check-text { min-width: 0; }
.check-text strong { display: block; font-size: 13.5px; font-weight: 550; line-height: 1.35; }
.check-text small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-mute); line-height: 1.45; }

/* Sticky save bar closing every module form — Save stays reachable while scrolling. */
.save-bar {
  position: sticky; bottom: 12px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 11px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0) 40px), var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-m);
  backdrop-filter: blur(6px);
}
.save-bar p { margin: 0; font-size: 12px; color: var(--ink-mute); min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0) 40px),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.stat:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.stat dt { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); }
.stat dd { margin-top: 5px; font-size: 21px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat dd small { font-size: 12px; font-weight: 500; color: var(--ink-mute); margin-left: 5px; }
.stat dd.is-ok { color: var(--ok); } .stat dd.is-warn { color: var(--warn); } .stat dd.is-bad { color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

/* ---------- badges & status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  border-radius: 4px; padding: 2.5px 8px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--ink-dim); background: var(--inset);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-ok { border-color: rgba(53, 196, 141, .35); color: var(--ok); background: var(--ok-soft); }
.badge-warn { border-color: rgba(223, 174, 60, .35); color: var(--warn); background: var(--warn-soft); }
.badge-bad { border-color: rgba(236, 95, 107, .35); color: var(--bad); background: var(--bad-soft); }
.badge-info { border-color: rgba(91, 156, 249, .35); color: var(--info); background: var(--info-soft); }
.badge-ultra { border-color: rgba(122, 108, 255, .45); color: #a99dff; background: rgba(122, 108, 255, .12); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.dim { color: var(--ink-dim); }
.mute { color: var(--ink-mute); }

/* ---------- notices ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-s); padding: 11px 14px;
  font-size: 13.5px; margin-bottom: 16px; background: var(--surface);
}
.notice svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.notice-ok { border-left-color: var(--ok); } .notice-ok svg { color: var(--ok); }
.notice-error { border-left-color: var(--bad); } .notice-error svg { color: var(--bad); }
.notice-info { border-left-color: var(--info); } .notice-info svg { color: var(--info); }
.notice-warn { border-left-color: var(--warn); } .notice-warn svg { color: var(--warn); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--radius-s); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; line-height: 1;
  padding: 9px 14px; white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), transform .1s var(--ease), box-shadow .14s var(--ease);
}
.btn:active:not([disabled]) { transform: scale(.98); }
.btn-accent { background: linear-gradient(180deg, #6d8aff, var(--accent)); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-s); }
.btn-accent:hover { background: linear-gradient(180deg, #7e97ff, var(--accent-hi)); }
.btn-accent:active:not([disabled]) { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-outline { border-color: var(--line-strong); color: var(--ink); background: rgba(255, 255, 255, .03); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.btn-outline:hover { border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .055); }
.btn-danger { background: transparent; border-color: rgba(236, 95, 107, .4); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: rgba(236, 95, 107, .6); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-s);
  border: 1px solid var(--line); color: var(--ink-dim); background: var(--surface);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.panel-body { padding: 16px; }
.sec-title {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 10px;
}
.panel-hint { font-size: 12px; color: var(--ink-mute); }
.create-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px 15px; margin-top: 12px; min-width: 0;
  background: var(--surface);
}
.create-panel > legend { font-size: 12.5px; font-weight: 600; color: var(--ink-dim); padding: 0 6px; }
.create-panel + .create-panel { margin-top: 14px; }
.field-hint { display: block; margin-top: 8px; font-size: 11.5px; color: var(--ink-mute); }
.field { display: block; }
.field > span {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px;
}
.field small { display: block; margin-top: 5px; font-size: 11.5px; color: var(--ink-mute); line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; background: var(--inset);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink); padding: 8px 11px; font-size: 13.5px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .22);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .22), 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-mute); }
.textarea { resize: vertical; min-height: 90px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2369737f' 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;
}
.select option { background: var(--surface); color: var(--ink); }
.select option:disabled { color: var(--ink-mute); }

/* Native pickers (date / time / colour) need dark scheme so the dropdown menu
   is readable. The colour input also benefits from a clear border. */
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: dark; }
input[type="color"] { color-scheme: dark; padding: 2px; height: 34px; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.check-row label { font-size: 13.5px; cursor: pointer; }
.check-row small { display: block; font-size: 11.5px; color: var(--ink-mute); }

.switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  width: 36px; height: 20px; border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3), inset 0 0 0 1px var(--line);
  transition: background .16s var(--ease), box-shadow .16s var(--ease);
  position: relative;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  transition: transform .16s var(--ease);
}
.switch input:checked + .track { background: var(--ok); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2), 0 0 8px rgba(53, 196, 141, .25); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* Button-based switches (module toggles) mirror their logical state via
   aria-checked — the visual MUST always match the enabled state. */
.switch[aria-checked='true'] { cursor: pointer; }
.switch[aria-checked='true'] .track { background: var(--ok); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2), 0 0 8px rgba(53, 196, 141, .25); }
.switch[aria-checked='true'] .track::after { transform: translateX(16px); }
.switch:focus-visible .track { box-shadow: var(--ring); }

.inline-form { display: inline-flex; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; text-align: left; font-size: 13px; }
.data-table th {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-mute); padding: 9px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--inset);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.td-actions { text-align: right; white-space: nowrap; }

.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chip {
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4.5px 12px; font-size: 12px; font-weight: 500; color: var(--ink-dim);
  background: var(--surface); cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.is-on { background: var(--accent-soft); border-color: rgba(91, 124, 250, .4); color: var(--accent-hi); }
.search-box { position: relative; margin-left: auto; }
.search-box input {
  width: 220px; max-width: 100%;
  background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink); font-size: 12.5px; padding: 6.5px 10px 6.5px 30px;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); }

/* ---------- rows / lists ---------- */
.row-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.row-list li:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { font-size: 13.5px; font-weight: 600; }
.row-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; word-break: break-all; }
.row-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Icon chip in front of a row title (module list on the overview page). */
.row-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-dim); flex-shrink: 0;
}
.row-icon .icon { width: 15px; height: 15px; }

.server-mark {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 650; color: var(--ink-dim); overflow: hidden;
}
.server-mark img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- server grid (servers list page) ---------- */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.server-card {
  display: flex; align-items: center; gap: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0) 48px),
    var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.server-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-m);
}
.server-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.server-info strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.server-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }

/* ---------- module header ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  margin-bottom: 12px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-mute); text-decoration: none;
}
.back-link .icon { width: 14px; height: 14px; transform: rotate(180deg); transition: transform .18s var(--ease); }
.back-link:hover, .back-link:focus-visible { color: var(--accent); }
.back-link:hover .icon, .back-link:focus-visible .icon { transform: rotate(180deg) translateX(-2px); }
.module-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.module-head h2 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; margin: 0; }
.module-head p { margin-top: 4px; font-size: 13.5px; color: var(--ink-dim); max-width: 62ch; }
.module-head-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Module enable/disable control: textual state label next to the switch. */
.toggle-group { display: inline-flex; align-items: center; gap: 8px; }
.toggle-state { font-size: 12px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.toggle-group.is-off .toggle-state { color: var(--ink-mute); }
.pill.is-off { border-color: var(--line-strong); }

/* Ambient owner-console background: fixed blurred orbs behind all content.
   Purely decorative — pointer-events none, hidden from AT, reduced-motion aware. */
.admin-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.admin-bg-orb {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(64px); opacity: .45; will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .admin-bg { display: none; }
}

/* ---------- inline row inside panels (used outside .row-list) ---------- */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.row:last-child { border-bottom: 0; }

/* ---------- matrix (role / permission table) ---------- */
.data-table.matrix th, .data-table.matrix td { vertical-align: middle; }
.data-table.matrix td.is-yes { color: var(--ok); font-weight: 600; text-align: center; }
.data-table.matrix td.is-no  { color: var(--ink-mute); text-align: center; }

/* ---------- duration field (paired number+select) ---------- */
.duration { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- danger icon button ---------- */
.icon-btn.is-danger { color: var(--bad); border-color: rgba(236, 95, 107, .35); }
.icon-btn.is-danger:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }

/* ---------- bare form controls (for inputs rendered without .input class) ---------- */
.form-grid input[type="number"]:not([class]),
.form-grid input[type="text"]:not([class]),
.form-grid input[type="color"]:not([class]) {
  width: 100%; background: var(--inset);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink); padding: 8px 11px; font-size: 13.5px;
  font-family: inherit;
}
.form-grid input[type="color"]:not([class]) { padding: 2px; height: 36px; cursor: pointer; }
.form-grid input[type="number"]:not([class]):focus,
.form-grid input[type="text"]:not([class]):focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.duration > input[type="number"]:not([class]) { width: 92px; flex-shrink: 0; }

.empty {
  padding: 38px 20px; text-align: center;
}
.empty strong { display: block; font-size: 14px; font-weight: 600; }
.empty p { margin-top: 5px; font-size: 12.5px; color: var(--ink-mute); max-width: 42ch; margin-left: auto; margin-right: auto; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--radius-s); min-height: 14px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.04), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }

/* ---------- kv list ---------- */
.kv { display: grid; grid-template-columns: 170px 1fr; row-gap: 9px; column-gap: 16px; font-size: 13px; }
.kv dt { color: var(--ink-mute); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; row-gap: 2px; } .kv dd { margin-bottom: 9px; } }

kbd.key {
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-size: 11px; background: var(--inset);
}

/* ---------- modal ---------- */
dialog.modal {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-l);
  padding: 0; width: min(430px, calc(100vw - 32px));
  box-shadow: var(--shadow-l), inset 0 1px 0 rgba(255, 255, 255, .05);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .6); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 14.5px; font-weight: 600; }
.modal-body { padding: 18px; font-size: 13.5px; color: var(--ink-dim); }
.modal-body .mono { color: var(--ink); word-break: break-all; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 18px; border-top: 1px solid var(--line); }
.modal[data-state="error"] .modal-head h3 { color: var(--bad); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 8px);
  z-index: 90; opacity: 0; pointer-events: none;
  background: #161a21; border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: var(--ink);
  box-shadow: var(--shadow-l);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 15px; height: 15px; color: var(--ok); flex-shrink: 0; }
.toast.is-error svg { color: var(--bad); }

/* ---------- auth card ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.auth-logo img { width: 46px; height: 46px; border-radius: 10px; }
.auth-logo h1 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.auth-logo p { font-size: 13px; color: var(--ink-dim); max-width: 30ch; }
.auth-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0) 64px),
    var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-l); padding: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-m);
}
.discord-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: linear-gradient(180deg, #6472f3, #5865f2); color: #fff; border-radius: var(--radius-s);
  font-size: 14px; font-weight: 600; padding: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-s);
  transition: background .14s var(--ease), transform .1s var(--ease);
}
.discord-btn:hover { background: linear-gradient(180deg, #7482f5, #6673f4); }
.discord-btn:active { transform: translateY(1px); }
.auth-note { margin-top: 14px; text-align: center; font-size: 12px; color: var(--ink-mute); line-height: 1.5; }
.auth-alert { margin-bottom: 16px; }

/* ---------- module page bits ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.module-card {
  display: flex; flex-direction: column; gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0) 48px),
    var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.module-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-m);
}
.module-card .mc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.module-card h3 { font-size: 13.5px; font-weight: 600; }
.module-card p { font-size: 12.5px; color: var(--ink-dim); flex: 1; }

.command-guide {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-s); padding: 12px 14px; margin-bottom: 16px;
  background: var(--surface);
}
.command-guide h3 { font-size: 13.5px; font-weight: 600; }
.command-guide p { font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; }
.guide-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.guide-chips code {
  border: 1px solid var(--line); background: var(--inset);
  border-radius: 4px; padding: 2.5px 8px; font-size: 11.5px; color: var(--accent-hi);
}
.guide-chips code.guide-alias { color: var(--ink-mute); }

.hint-list { font-size: 12.5px; color: var(--ink-mute); line-height: 1.6; }
.hint-list b { color: var(--ink-dim); font-weight: 600; }

.mapping-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 110px; gap: 8px; align-items: start; }
.mapping-row + .mapping-row { margin-top: 8px; }
.mapping-row > input[max-width="90px"] { max-width: none; width: 100%; }
.mapping-row > .map-index {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--inset); border: 1px solid var(--line);
  font-size: 11px; font-weight: 600; color: var(--ink-mute);
}
.mapping-row > .map-arrow { align-self: center; color: var(--ink-mute); font-size: 14px; text-align: center; }
/* Variant with leading index chip (reaction-role mapping rows). */
.mapping-row.has-index { grid-template-columns: 30px minmax(0, .9fr) 20px minmax(0, 1fr); }
@media (max-width: 720px) {
  .mapping-row, .mapping-row.has-index { grid-template-columns: 72px 1fr; grid-auto-rows: auto; }
  .mapping-row > .select, .mapping-row.has-index > .map-index,
  .mapping-row.has-index > .map-arrow { display: none; }
  .mapping-row.has-index { grid-template-columns: 30px 1fr; }
}
@media (max-width: 560px) { .mapping-row, .mapping-row.has-index { grid-template-columns: 1fr; } }

/* ---------- multi-select chip picker (sb_multiselect + app.js) ----------
   The native <select multiple> stays in the DOM for no-JS POSTs but is
   visually hidden; the .ms shell renders chips + filter + checkbox list. */
select.ms-native {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
.ms {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.ms-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 9px 11px; border-bottom: 1px solid var(--line);
  background: var(--inset); min-height: 40px;
}
.ms-chips:empty, .ms-chips > .ms-placeholder:only-child { padding-bottom: 9px; }
.ms-placeholder { font-size: 12px; color: var(--ink-mute); }
.chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 3px; padding: 0;
  border: 0; border-radius: 50%; background: transparent;
  color: inherit; font-size: 13px; line-height: 1; cursor: pointer;
}
.chip-x:hover { background: rgba(255, 255, 255, .14); }
.ms-filter { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.ms-filter:focus { box-shadow: none; border-bottom-color: var(--accent); }
.input-sm { padding: 7px 11px; font-size: 12.5px; }
.ms-list { max-height: 190px; overflow-y: auto; overscroll-behavior: contain; }
.ms-option {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 11px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.ms-option:last-child { border-bottom: 0; }
.ms-option:hover { background: var(--surface-2); }
.ms-option input[type="checkbox"] { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.ms-option-text { font-size: 13px; min-width: 0; }
.ms-option-text small { display: block; font-size: 11.5px; color: var(--ink-mute); }

/* ---------- visual emoji picker (tickets) ---------- */
.emoji-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 3px; padding: 10px 11px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--inset); max-height: 168px; overflow-y: auto;
}
.emoji-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border: 1px solid transparent;
  border-radius: 7px; background: transparent; font-size: 17px;
  cursor: pointer; line-height: 1; transition: background .12s var(--ease), border-color .12s var(--ease), transform .12s var(--ease);
}
.emoji-cell:hover { background: var(--surface-2); border-color: var(--line-strong); transform: scale(1.12); }
.emoji-cell:active { transform: scale(.95); }

/* ---------- reveal-on-scroll (app.js + animejs) ----------
   Panels start hidden only while JS is armed to animate them;
   every code path removes the class, so no-JS users never lose content. */
.reveal-pending { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .reveal-pending { opacity: 1; }
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  body.drawer-open .sidebar { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .content { margin-left: 0; }
  .content-body { padding: 20px 16px 32px; }
  .footer { padding: 12px 16px; }
}
@media (max-width: 720px) {
  .crumb span { display: none; }
  .pill.hide-sm { display: none; }
  .user-chip .user-name, .user-chip > svg { display: none; }
  .user-chip { padding: 3px; border-radius: 50%; }
  .user-pop { position: fixed; top: calc(var(--topbar-h) + 6px); right: 10px; left: auto; }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { width: 100%; }
  /* module settings stack on narrow screens */
  .save-bar { position: static; flex-wrap: wrap; }
  .save-bar .btn { flex: 1 1 auto; }
  /* stacked table cards */
  .data-table.responsive-cards thead { display: none; }
  .data-table.responsive-cards tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .data-table.responsive-cards tr:last-child { border-bottom: 0; }
  .data-table.responsive-cards td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border-bottom: 0; padding: 5px 14px;
  }
  .data-table.responsive-cards td::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-mute); flex-shrink: 0;
  }
  .data-table.responsive-cards td.td-actions::before { content: none; }
  .data-table.responsive-cards td.td-actions { justify-content: flex-end; }
  .module-head { flex-direction: column; align-items: stretch; }
  .module-head-side { justify-content: space-between; }
  .row-side { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  /* server cards stack: mark+info on top, actions in a full-width footer row */
  .server-card { flex-wrap: wrap; }
  .server-side { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
}

/* ============================================================
   Landing page (logged out)
   ============================================================ */

/* default dot color when no inline status background is set */
.pill .dot { background: var(--ink-mute); }

.landing-inner { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.landing-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 12, 15, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.landing-nav .landing-inner {
  display: flex; align-items: center; gap: 28px;
  height: 60px;
}
.landing-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; letter-spacing: -.01em;
}
.landing-brand b { font-weight: 700; }
.landing-brand img { border-radius: 6px; }
.landing-brand .pill { margin-left: 6px; }
.landing-links { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.landing-links a {
  font-size: 13px; color: var(--ink-dim);
  transition: color .12s ease;
}
.landing-links a:hover { color: var(--ink); }
.landing-actions { display: flex; align-items: center; gap: 18px; }
.landing-actions > a:not(.btn) { font-size: 13px; color: var(--ink-dim); }
.landing-actions > a:not(.btn):hover { color: var(--ink); }

.landing-hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 48px; align-items: center;
  padding-top: 72px; padding-bottom: 80px;
}
.hero-status {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; font-size: 12px; color: var(--ink-mute);
}
.hero-copy h1 {
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.08; letter-spacing: -.02em; font-weight: 700;
}
.hero-copy h1 span { color: var(--accent-hi); }
.hero-sub {
  margin-top: 18px; max-width: 54ch;
  font-size: 15px; line-height: 1.65; color: var(--ink-dim);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-cta.center { justify-content: center; }
.hero-note { margin-top: 14px; font-size: 12px; color: var(--ink-mute); }

.hero-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0) 72px),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l); overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow-m);
}
.hero-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute);
}
.hero-feed { padding: 8px 16px 12px; }
.hero-feed p {
  display: flex; gap: 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dashed var(--line);
  font-size: 12.5px; color: var(--ink-dim); line-height: 1.5;
}
.hero-feed p:last-child { border-bottom: 0; }
.hero-feed time { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); flex-shrink: 0; }
.hero-feed b { font-weight: 600; flex-shrink: 0; }
.hero-cmd {
  margin: 0 16px 14px; padding: 9px 12px;
  background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-s);
}
.hero-cmd code { color: var(--accent-hi); font-size: 12px; }
.hero-facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.hero-facts > div { padding: 12px 16px; border-right: 1px solid var(--line); min-width: 0; }
.hero-facts > div:last-child { border-right: 0; }
.hero-facts dd { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.hero-facts dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); margin-top: 2px; }

.text-tone b { font-weight: 600; }
b.t-bad { color: var(--bad); }
b.t-warn { color: var(--warn); }
b.t-ok { color: var(--ok); }
b.t-accent { color: var(--accent-hi); }

.landing-section { padding: 64px 0; }
.landing-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sec-head { max-width: 62ch; margin-bottom: 36px; }
.sec-head h2 {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.18; letter-spacing: -.015em; font-weight: 700;
}
.sec-head h2 span { color: var(--accent-hi); }
.sec-head p:not(.eyebrow) { margin-top: 12px; font-size: 14px; color: var(--ink-dim); line-height: 1.6; }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-hi); margin-bottom: 10px;
}

.mod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mod-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, 0) 56px),
    var(--inset);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.mod-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.mod-card h3 { font-size: 14.5px; font-weight: 600; }
.mod-card p { margin-top: 8px; font-size: 13px; line-height: 1.6; color: var(--ink-dim); }
.mod-wide { grid-column: span 3; }
.mod-demo {
  margin-top: 14px; padding: 12px 14px;
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-s);
}
.mod-demo p { display: flex; gap: 8px; align-items: baseline; margin: 0; padding: 3px 0; font-size: 12px; color: var(--ink-dim); }
.mod-demo p span { color: var(--ink-mute); }

.cmd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cmd-card {
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; transition: border-color .12s ease;
}
.cmd-card:hover { border-color: var(--line-strong); }
.cmd-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cmd-meta code { color: var(--accent-hi); font-size: 12.5px; overflow-wrap: anywhere; }
.cmd-meta span { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); flex-shrink: 0; }
.cmd-card p { margin-top: 9px; font-size: 12.5px; line-height: 1.55; color: var(--ink-dim); }
.cmd-ref { margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--canvas); }
.cmd-ref summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; font-size: 13px; font-weight: 600; color: var(--ink-dim);
}
.cmd-ref summary::-webkit-details-marker { display: none; }
.cmd-ref summary::after { content: '+'; font-size: 16px; color: var(--ink-mute); }
.cmd-ref[open] summary::after { content: '−'; }
.cmd-ref summary:hover { color: var(--ink); }
.cmd-ref .table-wrap { border-top: 1px solid var(--line); max-height: 420px; overflow-y: auto; }

.sec-steps { counter-reset: step; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.sec-steps li {
  counter-increment: step;
  background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.sec-steps li::before {
  content: '0' counter(step);
  font-family: var(--mono); font-size: 11px; color: var(--accent-hi); letter-spacing: .1em;
}
.sec-steps h3 { margin-top: 10px; font-size: 14px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.sec-steps h3 code {
  font-size: 10.5px; color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 4px; padding: 1.5px 7px; background: var(--canvas);
}
.sec-steps p { margin-top: 7px; font-size: 12.5px; line-height: 1.6; color: var(--ink-dim); }

.landing-final { text-align: center; padding-top: 56px; padding-bottom: 56px; }
.landing-final h2 { font-size: clamp(22px, 3vw, 30px); letter-spacing: -.015em; font-weight: 700; }
.landing-final p { margin-top: 12px; font-size: 14px; color: var(--ink-dim); }
.landing-final code { color: var(--accent-hi); }

.landing-footer { border-top: 1px solid var(--line); background: var(--canvas); }
.footer-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 20px; padding-bottom: 20px;
  font-size: 12.5px; color: var(--ink-mute);
}
.footer-row strong { color: var(--ink-dim); }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-row nav a:hover { color: var(--ink); }

@media (max-width: 1024px) {
  .landing-hero { grid-template-columns: 1fr; gap: 36px; padding-top: 48px; padding-bottom: 56px; }
  .mod-grid { grid-template-columns: repeat(2, 1fr); }
  .mod-wide { grid-column: span 2; }
  .sec-steps { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .landing-links { display: none; }
  .landing-nav .landing-inner { justify-content: space-between; }
  .cmd-grid { grid-template-columns: 1fr; }
  .hero-facts { grid-template-columns: repeat(2, 1fr); }
  .hero-facts > div:nth-child(2n) { border-right: 0; }
  .hero-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .landing-inner { padding: 0 16px; }
  .mod-grid { grid-template-columns: 1fr; }
  .mod-wide { grid-column: span 1; }
}
