/* TacForce dashboard – design tokens in three layers (primitive → semantic → component), then the components.
   Components only use semantic / component tokens, never raw values. Same palette as utils/brand.py (bot images). */

:root {
  /* ── Primitive ─────────────────────────────────────────────── */
  --ink-950: #0b0e0d; --ink-900: #101413; --ink-850: #141917; --ink-800: #19201d; --ink-700: #232b28;
  --ink-600: #2e3834; --ink-500: #3b4642; --ink-400: #5d6662;
  --sand-100: #ebe7dc; --sand-300: #c4b896; --sand-500: #958f7f;
  --amber-400: #f0b464; --amber-500: #e0a24c; --amber-600: #e88a2a; --orange-600: #ff5500; --amber-ink: #1a1004;
  --green-500: #43b581; --red-500: #e04747; --yellow-500: #f0a62e; --blurple-500: #5865f2; --white: #ffffff;

  --space-1: 2px; --space-2: 4px; --space-3: 6px; --space-4: 8px; --space-5: 12px; --space-6: 16px;
  --space-7: 20px; --space-8: 24px; --space-9: 32px;
  --radius-sm: 3px; --radius-md: 4px; --radius-lg: 6px; --radius-pill: 999px;
  --text-xs: 11px; --text-sm: 12.5px; --text-md: 14px; --text-lg: 16px; --text-xl: 20px; --text-2xl: 22px;
  --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Nasalization", "Segoe UI", system-ui, sans-serif;     /* tacforcehub.com's display face */
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --duration: .15s;

  /* ── Semantic ──────────────────────────────────────────────── */
  --surface-page: var(--ink-950);
  --surface-raised: var(--ink-900);
  --surface-overlay: var(--ink-850);
  --surface-hover: var(--ink-800);
  --surface-input: var(--ink-950);
  --border-subtle: var(--ink-700);
  --border-strong: var(--ink-500);
  --text-primary: var(--sand-100);
  --text-secondary: var(--sand-500);
  --text-accent: var(--amber-500);
  --accent: var(--amber-500);
  --accent-strong: var(--orange-600);
  --accent-soft: rgba(224, 162, 76, .13);
  --accent-ring: rgba(224, 162, 76, .45);
  --status-good: var(--green-500); --status-good-soft: rgba(67, 181, 129, .12); --status-good-line: rgba(67, 181, 129, .38);
  --status-bad: var(--red-500); --status-bad-soft: rgba(224, 71, 71, .1); --status-bad-line: rgba(224, 71, 71, .38);
  --status-warn: var(--yellow-500); --status-warn-soft: rgba(240, 166, 46, .1); --status-warn-line: rgba(240, 166, 46, .38);
  --status-info: var(--blurple-500); --status-info-soft: rgba(88, 101, 242, .1); --status-info-line: rgba(88, 101, 242, .35);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .45);

  /* ── Component ─────────────────────────────────────────────── */
  --sidebar-width: 232px;
  --page-max: 1080px;
  --page-pad: clamp(var(--space-6), 3vw, var(--space-9));
  --card-pad: var(--space-6);
  --control-height: 34px;
  --control-pad-x: var(--space-5);
  --button-primary-bg: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  --button-primary-fg: var(--amber-ink);
  --switch-off: var(--ink-600);
  --switch-knob: var(--sand-300);
  --topbar-height: 56px;
  --acc-members: #e0a24c; --acc-roles: #a594ff; --acc-moderation: #e2675a; --acc-protection: #5aa9e6;
  --acc-logging: #57c4a8; --acc-tickets: #94c45e; --acc-community: #e88ac8; --acc-tools: #c9b37a; --acc-alerts: #9d7bff; --acc-tournaments: #ff7a1a; --acc-stats: #4fc3d9; --acc-settings: #a8a29a;
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────── */
@font-face { font-family: "Nasalization"; src: url("/static/fonts/nasalization.otf") format("opentype");
  font-weight: 400; font-display: swap; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-page); color: var(--text-primary);
  font: var(--text-md)/1.45 var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: var(--text-accent); text-decoration: none; }
a:hover { color: var(--amber-400); }
h1 { font-size: var(--text-2xl); line-height: 1.2; margin: 0 0 var(--space-2); font-weight: 700; }
h2 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-secondary);
  margin: var(--space-8) 0 var(--space-4); font-weight: 600; }
p { margin: 0; }
small, .muted { color: var(--text-secondary); }
small { font-size: var(--text-sm); }
code { background: var(--surface-overlay); border: 1px solid var(--border-subtle); padding: 0 var(--space-3);
  border-radius: var(--radius-sm); font-size: var(--text-sm); }
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
::selection { background: rgba(224, 162, 76, .32); color: var(--white); }
html { scrollbar-color: var(--ink-600) transparent; scrollbar-width: thin; caret-color: var(--accent); accent-color: var(--accent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: var(--radius-pill); border: 3px solid var(--surface-page); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-500); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Layout ───────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface-raised); border-right: 1px solid var(--border-subtle); padding: var(--space-6) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-5); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
main { padding: var(--space-7) var(--page-pad) var(--space-9); max-width: var(--page-max); width: 100%; }
main.center { display: grid; place-items: center; min-height: 100vh; max-width: none; }
.page-head { margin-bottom: var(--space-6); }
.page-head p { margin-top: var(--space-1); }
.page-head.row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  margin: var(--space-8) 0 var(--space-4); }
.section-head h2 { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.back { display: inline-block; margin-bottom: var(--space-2); font-size: var(--text-sm); }

/* ── Brand & sidebar ──────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: var(--space-4); color: var(--text-primary); font-weight: 800;
  letter-spacing: 2px; font-size: var(--text-md); padding: 0 var(--space-2); }
.brand small { display: block; font-weight: 500; letter-spacing: .4px; font-size: var(--text-xs); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-md); font-weight: 900;
  background: var(--button-primary-bg); color: var(--button-primary-fg); letter-spacing: 0; font-size: var(--text-sm); }
.brand.big { justify-content: center; margin-bottom: var(--space-5); font-size: var(--text-lg); }
.brand.big .brand-mark { width: 44px; height: 44px; font-size: var(--text-lg); }
.server-name, .switcher summary { font-weight: 600; font-size: var(--text-sm); padding: var(--space-3) var(--space-4);
  background: var(--surface-overlay); border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher summary { cursor: pointer; list-style: none; }
.switcher summary::after { content: " ▾"; color: var(--text-secondary); }
.switcher a { display: block; padding: var(--space-3) var(--space-4); color: var(--text-primary); border-radius: var(--radius-md);
  font-size: var(--text-sm); }
.switcher a:hover, .switcher a.active { background: var(--surface-hover); }
.sidebar > * { flex-shrink: 0; }                     /* a long nav scrolls – it never squashes the header */
nav { display: flex; flex-direction: column; gap: 1px; flex: 1 0 auto; }
nav a { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); color: var(--text-primary); font-size: 13.5px; }
nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav a:hover { background: var(--surface-hover); color: var(--text-primary); }
nav a.active { background: var(--accent-soft); color: var(--text-accent); }
.nav-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-secondary);
  margin: var(--space-5) var(--space-4) var(--space-1); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.on { background: var(--status-good); }
.dot.off { background: var(--ink-600); }
.menu-toggle { display: none; }

/* ── Surfaces ─────────────────────────────────────────────────── */
.card { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--card-pad); }
.login { width: min(400px, 100%); text-align: center; display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-8); }
.banner { background: var(--status-info-soft); border: 1px solid var(--status-info-line); padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md); margin-bottom: var(--space-6); font-size: var(--text-sm); }

/* Status strip (one line instead of metric tiles) */
.statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-6);
  padding: var(--space-4) var(--space-6); background: var(--surface-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); font-size: var(--text-sm); color: var(--text-secondary); }
.statusbar b { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 600; }
.statusbar .live { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--status-good); font-weight: 600; }
.statusbar span + span { padding-left: var(--space-6); border-left: 1px solid var(--border-subtle); }

/* Row lists – the overview and every list of panels / categories */
.list { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  overflow: hidden; }
.row-item { position: relative; display: flex; align-items: center; gap: var(--space-5); padding: var(--space-4) var(--space-6);
  min-height: 52px; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration); }
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--surface-overlay); color: var(--text-primary); }
.row-item .cover { position: absolute; inset: 0; }
.row-item .cover:focus-visible { outline-offset: -2px; }
.row-item form, .row-item .flag { position: relative; z-index: 1; }
.row-item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-item .txt b { font-weight: 600; font-size: var(--text-md); }
.row-item .txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .chev { color: var(--text-secondary); display: inline-flex; }
.row-item.is-on .ico { color: var(--status-good); background: var(--status-good-soft); border-color: var(--status-good-line); }
.ico { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--radius-md);
  background: var(--surface-overlay); border: 1px solid var(--border-subtle); color: var(--text-secondary); }
.ico .i { width: 17px; height: 17px; }
.ico.emoji { font-size: var(--text-lg); }
.flag { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--status-warn); font-size: var(--text-sm);
  font-weight: 600; }
.flag .i { width: 15px; height: 15px; }
.title-ico { display: flex; align-items: center; gap: var(--space-5); }
.title-ico .ico { width: 36px; height: 36px; color: var(--text-accent); background: var(--accent-soft);
  border-color: transparent; }
.title-ico .ico .i { width: 19px; height: 19px; }
.empty { padding: var(--space-6); color: var(--text-secondary); font-size: var(--text-sm); }
section > h2 { margin-top: var(--space-8); }

/* Alerts */
.alert { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); margin: 0 0 var(--space-4);
  border: 1px solid; font-size: var(--text-sm); }
.alert.good { background: var(--status-good-soft); border-color: var(--status-good-line); }
.alert.bad { background: var(--status-bad-soft); border-color: var(--status-bad-line); }
.alert.warn { background: var(--status-warn-soft); border-color: var(--status-warn-line); }
.alert.info { background: var(--status-info-soft); border-color: var(--status-info-line); }

/* ── Icons ────────────────────────────────────────────────────── */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round;
  stroke-linejoin: round; }
nav a span { display: inline-flex; align-items: center; gap: var(--space-4); min-width: 0; }
nav a .i { color: var(--text-secondary); }
nav a.active .i, nav a:hover .i { color: inherit; }
.back { display: inline-flex; align-items: center; gap: var(--space-2); }
.back .i { width: 14px; height: 14px; }
.icon-btn { width: var(--control-height); padding: 0; }

/* ── Controls ─────────────────────────────────────────────────── */
button, .button { font: inherit; font-size: var(--text-sm); font-weight: 600; border: 0; border-radius: var(--radius-md);
  min-height: var(--control-height); padding: 0 var(--space-6); cursor: pointer; color: var(--text-primary);
  background: var(--surface-overlay); display: inline-flex; justify-content: center; align-items: center; gap: var(--space-3);
  transition: background var(--duration), border-color var(--duration), filter var(--duration); }
button:hover, .button:hover { background: var(--surface-hover); color: var(--text-primary); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary, .primary:hover { background: var(--button-primary-bg); color: var(--button-primary-fg); }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; border: 1px solid var(--border-subtle); }
.ghost:hover { border-color: var(--border-strong); background: transparent; }
.ghost.danger { color: var(--status-bad); border-color: var(--status-bad-line); }
.small { min-height: 28px; padding: 0 var(--space-5); font-size: var(--text-sm); }
.discord, .discord:hover { background: var(--status-info); color: var(--white); min-height: 40px; }
.switch { width: 38px; height: 22px; min-height: 0; padding: 0; border-radius: var(--radius-pill); background: var(--switch-off);
  position: relative; flex: none; }
.switch:hover { background: var(--border-strong); }
.switch i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--switch-knob);
  transition: left var(--duration), background var(--duration); }
.switch.on, .switch.on:hover { background: var(--status-good); }
.switch.on i { left: 19px; background: var(--white); }
.switch.big { width: 48px; height: 26px; }
.switch.big i { width: 20px; height: 20px; }
.switch.big.on i { left: 25px; }
.toggle-big { display: flex; align-items: center; gap: var(--space-4); }
.state { font-weight: 700; font-size: var(--text-sm); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.state.on { color: var(--status-good); }
.pill { font-size: var(--text-xs); font-weight: 600; padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill);
  background: var(--surface-hover); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .6px; }
.pill.on { background: var(--status-good-soft); color: var(--status-good); }

/* ── Forms ────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: var(--space-6); }
.field { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.field > label { font-weight: 600; font-size: var(--text-sm); }
.field > small { margin-top: calc(-1 * var(--space-1)); }
input[type=text], input[type=number], input[type=search], select, textarea { font: inherit; font-size: var(--text-md);
  color: var(--text-primary); background: var(--surface-input); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); min-height: var(--control-height); padding: var(--space-3) var(--control-pad-x); width: 100%;
  transition: border-color var(--duration); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-ring); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; line-height: 1.45; }
input[type=color] { width: 46px; height: var(--control-height); padding: 2px; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); background: var(--surface-input); cursor: pointer; }
.color-row { display: flex; align-items: center; gap: var(--space-5); }
.placeholders { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.placeholders code { cursor: pointer; transition: border-color var(--duration), color var(--duration); }
.placeholders code:hover { border-color: var(--accent); color: var(--text-accent); }
.check { display: flex; align-items: center; gap: var(--space-4); font-size: var(--text-md); font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.segmented { display: inline-flex; flex-wrap: wrap; align-self: flex-start; background: var(--surface-input);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-1); gap: var(--space-1); }
.segmented input { display: none; }
.segmented span { display: block; padding: var(--space-2) var(--space-5); border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary); font-size: var(--text-sm); font-weight: 600; }
.segmented span:hover { color: var(--text-primary); }
.segmented input:checked + span { background: var(--accent-soft); color: var(--text-accent); }
.role-picker { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-input); }
.role-picker input[type=search] { border: 0; border-bottom: 1px solid var(--border-subtle); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.role-list { max-height: 220px; overflow-y: auto; padding: var(--space-2); }
.role { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  cursor: pointer; font-size: var(--text-sm); }
.role:hover { background: var(--surface-hover); }
.role input { accent-color: var(--accent); }
.role i { width: 9px; height: 9px; border-radius: 50%; background: var(--sand-500); flex: none; }
.role small { margin-left: auto; color: var(--status-warn); font-size: var(--text-xs); }
.role small.muted { color: var(--text-secondary); }
.role.blocked { opacity: .55; }
.actions { display: flex; gap: var(--space-4); padding-top: var(--space-2); }
.test-form { display: flex; align-items: center; gap: var(--space-5); margin-top: var(--space-5); flex-wrap: wrap; }
.search-row { display: flex; gap: var(--space-3); align-items: center; }
.search-row input { width: 200px; min-height: 28px; padding: var(--space-1) var(--space-4); font-size: var(--text-sm); }

/* Role panel editor rows, ticket questions */
.opt-head, .opt-row { display: grid; grid-template-columns: 1.4fr 1fr .6fr 1.3fr .8fr 28px; gap: var(--space-3); align-items: center; }
.opt-head { color: var(--text-secondary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 1px; }
.opt-row { margin-bottom: var(--space-3); }
.opt-row input, .opt-row select { font-size: var(--text-sm); }
.opt-row .small { padding: 0; width: 28px; }
#options:empty::before { content: "No roles yet – add one below."; color: var(--text-secondary); display: block;
  padding: var(--space-2) 0; font-size: var(--text-sm); }
.q-row { display: grid; grid-template-columns: 1.3fr 1fr auto auto; gap: var(--space-3); align-items: center; }
.q-row .check { font-size: var(--text-sm); white-space: nowrap; }

/* ── Lists ────────────────────────────────────────────────────── */
.table { padding: var(--space-1) 0; }
.tr { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); min-height: 44px; }
.tr:last-child { border-bottom: 0; }
.tr:hover { background: var(--surface-overlay); }
.tr .when { color: var(--text-secondary); font-variant-numeric: tabular-nums; min-width: 118px; }
.tr .who { font-weight: 600; min-width: 120px; }
.tr .rank { color: var(--text-secondary); min-width: 34px; font-variant-numeric: tabular-nums; }
.tr small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tr .push, .tr form.push { margin-left: auto; flex: none; }
.table > p { padding: var(--space-5) var(--space-6); font-size: var(--text-sm); }
.server-row { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md); color: var(--text-primary); background: var(--surface-overlay); text-align: left;
  border: 1px solid var(--border-subtle); }
.server-row:hover { border-color: var(--accent); color: var(--text-primary); }
.server-row img, .server-row .ph { width: 36px; height: 36px; border-radius: var(--radius-md); display: grid; place-items: center;
  background: var(--surface-input); font-weight: 700; }
.server-row small { display: block; }

/* ── Phone ────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 10; transform: translateX(-105%);
    transition: transform .2s; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  main { padding-top: var(--space-6); }
  .two { grid-template-columns: 1fr; }
  .statusbar span + span { padding-left: 0; border-left: 0; }
  .tr { flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
  .opt-head { display: none; }
  .opt-row { grid-template-columns: 1fr 1fr; padding: var(--space-4); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); }
  .q-row { grid-template-columns: 1fr 1fr; }
  .q-row input[type=text] { grid-column: span 2; }
}

/* ══ MEE6-style frame with the TacForce HUD ═════════════════════════════════ */
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; height: var(--topbar-height); display: flex; align-items: center;
  gap: var(--space-5); padding: 0 var(--page-pad); background: rgba(11, 14, 13, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle); }
.crumb { display: flex; align-items: center; gap: var(--space-3); min-width: 0; font-size: var(--text-sm);
  color: var(--text-secondary); }
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.crumb b { color: var(--text-primary); font-weight: 600; white-space: nowrap; }
.crumb .i { width: 14px; height: 14px; }
.me { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); text-align: right; }
.me img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border-strong); }
.me div { font-size: var(--text-sm); line-height: 1.25; }
.me b, .me small { display: block; white-space: nowrap; }
.server-name, .switcher summary { display: flex; align-items: center; gap: var(--space-4); }
.server-name img, .switcher summary img { width: 22px; height: 22px; border-radius: var(--radius-sm); flex: none; }
.server-name span, .switcher summary span { overflow: hidden; text-overflow: ellipsis; }

/* HUD material: map contours + corner brackets */
.hero, .page-head { position: relative; isolation: isolate; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 85, 0, .16), transparent 55%),
              url("/static/topo.png") center / cover no-repeat, var(--surface-raised);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.hud { position: absolute; width: 18px; height: 18px; border: 0 solid var(--accent-strong); opacity: .9; }
.hud.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.hud.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.hud.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.hud.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: var(--space-8);
  padding: var(--space-8) var(--space-9); margin-bottom: var(--space-6); flex-wrap: wrap; }
.hero-main { display: flex; align-items: center; gap: var(--space-7); min-width: 0; }
.hero-icon { width: 84px; height: 84px; border-radius: 22px; flex: none; border: 2px solid rgba(255, 85, 0, .55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); object-fit: cover; }
.hero-icon.ph { display: grid; place-items: center; font-size: 34px; font-weight: 800; background: var(--surface-overlay); }
.hero-text { min-width: 0; }
.hero-text h1 { font-size: 30px; letter-spacing: -.01em; margin: var(--space-2) 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.hero-text p { color: var(--text-secondary); font-size: var(--text-md); }
.hero-tag { display: inline-flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--status-good); background: var(--status-good-soft);
  border: 1px solid var(--status-good-line); padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill); }
.hero-meter { display: grid; gap: var(--space-2); min-width: 190px; padding: var(--space-5) var(--space-6);
  background: rgba(11, 14, 13, .6); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.hero-meter b { font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-meter b small { font-size: var(--text-lg); color: var(--text-secondary); font-weight: 600; }
.hero-meter > span { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-secondary); }
.meter { height: 6px; border-radius: var(--radius-pill); background: var(--ink-700); overflow: hidden; margin-top: var(--space-2); }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--amber-500), var(--orange-600)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* Category tabs */
.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 var(--space-2); padding: var(--space-1);
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.tab { min-height: 32px; background: transparent; color: var(--text-secondary); padding: 0 var(--space-5); }
.tab:hover { background: var(--surface-hover); color: var(--text-primary); }
.tab.active, .tab.active:hover { background: var(--accent-soft); color: var(--text-accent); }
.tab span { font-size: var(--text-xs); background: var(--status-good-soft); color: var(--status-good); border-radius: var(--radius-pill);
  padding: 0 var(--space-3); line-height: 18px; }
.mod-group[hidden] { display: none; }

/* Module cards (MEE6 / Dyno plugin grid) */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--space-5); }
.mod { --acc: var(--accent); position: relative; display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-6); background: var(--surface-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); transition: border-color var(--duration), transform var(--duration), background var(--duration); }
.mod::before, .mod::after { content: ""; position: absolute; width: 14px; height: 14px; border: 0 solid var(--acc);
  opacity: 0; transition: opacity var(--duration); pointer-events: none; }
.mod::before { top: 6px; left: 6px; border-top-width: 2px; border-left-width: 2px; }
.mod::after { bottom: 6px; right: 6px; border-bottom-width: 2px; border-right-width: 2px; }
.mod:hover { background: var(--surface-overlay); border-color: var(--border-strong); transform: translateY(-2px); }
.mod:hover::before, .mod:hover::after { opacity: 1; }
.mod .cover { position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.mod form { position: relative; z-index: 1; }
.mod-top { display: flex; align-items: flex-start; justify-content: space-between; }
.mod-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; color: var(--acc);
  background: color-mix(in srgb, var(--acc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent); }
.mod-ico .i { width: 22px; height: 22px; stroke-width: 1.6; }
.mod-name { font-size: var(--text-lg); font-weight: 700; margin-top: var(--space-2); }
.mod p { color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.45; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mod-foot { display: flex; align-items: center; gap: var(--space-4); padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle); margin-top: var(--space-2); }
.mod-go { margin-left: auto; display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm);
  font-weight: 600; color: var(--text-secondary); transition: color var(--duration); }
.mod-go .i { width: 14px; height: 14px; }
.mod:hover .mod-go { color: var(--acc); }
.mod.is-on { border-color: color-mix(in srgb, var(--acc) 40%, var(--border-subtle)); }
.acc-members { --acc: var(--acc-members); } .acc-roles { --acc: var(--acc-roles); }
.acc-moderation { --acc: var(--acc-moderation); } .acc-protection { --acc: var(--acc-protection); }
.acc-logging { --acc: var(--acc-logging); } .acc-tickets { --acc: var(--acc-tickets); }
.acc-community { --acc: var(--acc-community); }
.acc-tools { --acc: var(--acc-tools); }
.acc-alerts { --acc: var(--acc-alerts); }
.acc-tournaments { --acc: var(--acc-tournaments); }
.acc-stats { --acc: var(--acc-stats); }
.acc-settings { --acc: var(--acc-settings); }

/* Module / editor page header gets the same HUD strip */
.page-head { padding: var(--space-7) var(--space-8); margin-bottom: var(--space-6); }
.page-head .title-ico .ico { width: 44px; height: 44px; border-radius: 12px; }
.page-head .title-ico .ico .i { width: 22px; height: 22px; }
.page-head.row > div:first-child { flex: 1 1 360px; min-width: 0; }
.page-head .toggle-big { flex: none; padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill);
  background: rgba(11, 14, 13, .6); border: 1px solid var(--border-subtle); }
.page-head[class*="acc-"] .title-ico .ico { color: var(--acc); background: color-mix(in srgb, var(--acc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent); }

@media (max-width: 860px) {
  .topbar { padding: 0 var(--space-6); }
  .me div { display: none; }
  .crumb span, .crumb > .i { display: none; }
  .hero { padding: var(--space-7); }
  .hero-text h1 { font-size: var(--text-2xl); }
  .hero-icon { width: 60px; height: 60px; border-radius: 16px; }
  .hero-meter { width: 100%; }
  .page-head { padding: var(--space-6); }
}

/* ══ tacforcehub.com look: wordmark, display face, grid ground, map banners, briefing labels ══════════ */
body { background-color: var(--surface-page);
  background-image: linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 44px 44px; background-attachment: fixed; }
.sidebar { background: rgba(13, 18, 16, .94); }
.brand { padding: var(--space-2) var(--space-2) var(--space-3); }
.brand .wordmark { width: 150px; height: auto; display: block; }
.brand.big .wordmark { width: 230px; margin: 0 auto; }
.nav-title, h2, .hero-tag, .hero-meter > span, .pill, .mod-go, .state, .crumb, .tab, .statusbar {
  font-family: var(--font-mono); }
.nav-title { color: var(--orange-600); opacity: .85; letter-spacing: 1.6px; }
h1, .hero-text h1, .mod-name { font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  letter-spacing: .03em; }
h1 { font-size: 24px; }

/* Section headings like the site's panels: orange, mono, with a rule */
section > h2, .section-head h2 { display: flex; align-items: center; gap: var(--space-5); color: var(--orange-600);
  letter-spacing: 2px; font-size: var(--text-xs); }
section > h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

/* Map banner behind the hero and every page header */
.hero, .page-head { --map: url("/static/maps/overview.webp");
  background: linear-gradient(90deg, rgba(10, 13, 12, .96) 0%, rgba(10, 13, 12, .78) 45%, rgba(10, 13, 12, .35) 100%),
              radial-gradient(90% 120% at 100% 0%, rgba(255, 85, 0, .22), transparent 60%),
              var(--map) center / cover no-repeat, var(--surface-raised);
  border-color: var(--border-strong); }
.page-head.acc-members { --map: url("/static/maps/members.webp"); }
.page-head.acc-roles { --map: url("/static/maps/roles.webp"); }
.page-head.acc-moderation { --map: url("/static/maps/moderation.webp"); }
.page-head.acc-protection { --map: url("/static/maps/protection.webp"); }
.page-head.acc-logging { --map: url("/static/maps/logging.webp"); }
.page-head.acc-tickets { --map: url("/static/maps/tickets.webp"); }
.page-head.acc-community { --map: url("/static/maps/members.webp"); }
.page-head.acc-tools { --map: url("/static/maps/logging.webp"); }
.page-head.acc-alerts { --map: url("/static/maps/protection.webp"); }
.page-head.acc-tournaments { --map: url("/static/maps/overview.webp"); }
.page-head.acc-stats { --map: url("/static/maps/logging.webp"); }
.page-head.acc-settings { --map: url("/static/maps/settings.webp"); }
.hero { min-height: 220px; padding: var(--space-9) var(--space-9); }
.hero-text h1 { font-size: 38px; letter-spacing: .04em; line-height: 1.05; margin: var(--space-4) 0 var(--space-3); }
.hero-text p { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--sand-300); letter-spacing: .5px; }
.hero-icon { border-radius: var(--radius-lg); border-color: var(--orange-600); }
.hero-tag { letter-spacing: 1.6px; }
.hero-meter { border-radius: var(--radius-md); backdrop-filter: blur(4px); }
.hero-meter b { font-family: var(--font-mono); color: var(--orange-600); }
.page-head h1 { font-size: 26px; }

/* Module cards: square-cut, faint corner ticks that light up in the section colour */
.mod { border-radius: var(--radius-md); background: linear-gradient(180deg, rgba(22, 28, 25, .96), rgba(16, 20, 19, .96)); }
.mod::before, .mod::after { opacity: .28; border-color: var(--acc); }
.mod:hover::before, .mod:hover::after { opacity: 1; }
.mod-ico { border-radius: var(--radius-md); }
.mod-name { font-size: 14.5px; margin-top: var(--space-4); }
.mod-foot .pill { border-radius: var(--radius-sm); letter-spacing: 1px; }
.mod.is-on { box-shadow: inset 0 2px 0 var(--acc); }
.switch.on, .switch.on:hover { background: var(--orange-600); }
.tabs { border-radius: var(--radius-md); }
.tab { border-radius: var(--radius-sm); font-size: var(--text-xs); letter-spacing: 1.2px; text-transform: uppercase; }
.button.primary, button.primary { text-transform: uppercase; letter-spacing: 1px; font-size: var(--text-xs); }
@media (max-width: 860px) {
  .hero-text h1 { font-size: 26px; }
  .hero { padding: var(--space-7); min-height: 0; }
}

/* ══ Settings (module pages): Discord-style rows, real toggles, floating save bar ═════════════════ */
.settings { --acc: var(--accent); position: relative; background: var(--surface-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 0 0 var(--space-2); }
.settings::before { content: ""; position: absolute; top: -1px; left: 24px; width: 64px; height: 2px; background: var(--acc); }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  padding: var(--space-5) var(--space-7); border-bottom: 1px solid var(--border-subtle); }
.settings-head h2 { margin: 0; }
.setting { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 1.25fr); gap: var(--space-6) var(--space-8);
  align-items: center; padding: var(--space-6) var(--space-7); border-bottom: 1px solid var(--border-subtle); }
.setting:last-of-type { border-bottom: 0; }
.setting.wide { grid-template-columns: 1fr; gap: var(--space-4); }
.setting.is-bool .setting-control { justify-self: end; }
.setting-info { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.setting-info label { font-weight: 600; font-size: var(--text-md); color: var(--text-primary); }
.setting-info small { line-height: 1.4; }
.setting-control { min-width: 0; }
.setting-control .num { max-width: 140px; font-family: var(--font-mono); }

/* Select with its own chevron */
.select { position: relative; }
.select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.75px solid var(--text-secondary); border-bottom: 1.75px solid var(--text-secondary); transform: rotate(45deg);
  pointer-events: none; }
.select select { appearance: none; padding-right: 36px; cursor: pointer; }
select option, select optgroup { background: var(--ink-850); color: var(--text-primary); }

/* Toggle (checkbox styled as a switch) */
.toggle { position: relative; display: inline-flex; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle span { width: 44px; height: 24px; border-radius: var(--radius-pill); background: var(--switch-off); position: relative;
  transition: background var(--duration); }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--switch-knob); transition: left var(--duration), background var(--duration); }
.toggle input:checked + span { background: var(--orange-600); }
.toggle input:checked + span::after { left: 23px; background: var(--white); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.toggle input:disabled + span { opacity: .45; }

/* Pickers */
.picker-head { display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.picker-head input[type=search] { border: 0; background: transparent; padding-left: 0; min-height: 38px; }
.picker-head input[type=search]:focus { outline: 0; }
.picker-count { font-family: var(--font-mono); font-size: var(--text-xs); white-space: nowrap; color: var(--text-accent); }
.role-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px var(--space-2); }
.role:has(input:checked) { background: var(--accent-soft); color: var(--text-primary); }
.role .hash { color: var(--text-secondary); font-family: var(--font-mono); }

/* Message editor */
.editor { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-input); overflow: hidden; }
.editor:focus-within { outline: 2px solid var(--accent-ring); border-color: transparent; }
.editor textarea { border: 0; border-radius: 0; background: transparent; min-height: 110px; }
.editor textarea:focus { outline: 0; }
.editor .placeholders { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border-subtle); align-items: center;
  background: rgba(255, 255, 255, .015); }
.editor .placeholders > span { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 1px; margin-right: var(--space-2); }
.segmented { border-radius: var(--radius-md); }

/* Floating save bar – shows up as soon as something changed */
.savebar { position: sticky; bottom: var(--space-6); z-index: 4; display: flex; align-items: center; gap: var(--space-4);
  margin: var(--space-4) var(--space-5) var(--space-3); padding: var(--space-4) var(--space-4) var(--space-4) var(--space-6);
  background: rgba(16, 20, 19, .96); backdrop-filter: blur(8px); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); transition: border-color var(--duration); }
.savebar-text { display: inline-flex; align-items: center; gap: var(--space-4); margin-right: auto; font-size: var(--text-sm);
  color: var(--text-secondary); font-family: var(--font-mono); }
.savebar .dot { background: var(--status-good); }
.savebar [data-savebar-reset] { visibility: hidden; }
.savebar.dirty { border-color: var(--orange-600); }
.savebar.dirty .dot { background: var(--orange-600); }
.savebar.dirty .savebar-text { color: var(--text-primary); }
.savebar.dirty [data-savebar-reset] { visibility: visible; }
.test-note { margin-top: var(--space-4); }
@media (max-width: 860px) {
  .setting { grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-5); }
  .setting.is-bool { grid-template-columns: 1fr auto; }
  .settings-head { padding: var(--space-5); }
  .savebar { margin: var(--space-4) var(--space-3) var(--space-2); }
}
.settings { margin-top: var(--space-6); }

/* Editors: sub-headings inside a settings panel, ticket question rows */
.settings-head.sub { border-top: 1px solid var(--border-subtle); margin-top: var(--space-2); }
.settings-head.sub small { font-size: var(--text-xs); }
.setting.wide > .setting-control:only-child { grid-column: 1 / -1; }
.q-setting { grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-5); }
.q-num { font-family: var(--font-mono); color: var(--orange-600); font-size: var(--text-sm); align-self: start; padding-top: 9px; }
.q-fields { display: grid; grid-template-columns: 1.3fr 1fr auto auto; gap: var(--space-4); align-items: center; }
.mini-toggle { display: inline-flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-secondary);
  white-space: nowrap; cursor: pointer; }
.mini-toggle .toggle span { width: 34px; height: 20px; }
.mini-toggle .toggle span::after { width: 14px; height: 14px; }
.mini-toggle .toggle input:checked + span::after { left: 17px; }
@media (max-width: 860px) {
  .q-setting { grid-template-columns: 28px minmax(0, 1fr); }
  .q-fields { grid-template-columns: 1fr 1fr; }
  .q-fields input[type=text] { grid-column: span 2; }
}

/* ══ Embed builder (Discohook-style): JSON-driven editor + sticky Discord live preview ═════════════════ */
.builder { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: var(--space-6); align-items: start; }
.builder .settings { margin-top: 0; }
.eb-tools { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.eb-editor { display: grid; gap: var(--space-5); padding: var(--space-6) var(--space-7) var(--space-4);
  border-top: 1px solid var(--border-subtle); }
.eb-editor > .empty { padding: var(--space-2) 0; }
.eb-note { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.45; margin-bottom: var(--space-4); }
.eb-help { display: block; margin-top: var(--space-2); font-size: var(--text-xs); line-height: 1.4; }

/* Inputs: label + counter above the control */
.eb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--space-5); }
.eb-grid-3 { grid-template-columns: 1.2fr .8fr; }
.eb-input { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.eb-input.wide { grid-column: 1 / -1; }
.eb-input > label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4);
  font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-mono); }
.eb-input input[type=text], .eb-input textarea { font-size: var(--text-sm); }
.eb-input textarea { min-height: 0; }
.eb-count { font-size: var(--text-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.eb-count.over, [data-eb-total].over { color: var(--status-bad); }
.eb-color { justify-self: start; }
.eb-inline { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.eb-inline input[type=datetime-local] { width: auto; min-width: 210px; font: inherit; font-size: var(--text-sm); color: var(--text-primary);
  background: var(--surface-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  min-height: var(--control-height); padding: var(--space-2) var(--space-5); color-scheme: dark; }

/* Foldable sections (Profile, Flags, …, and inside every embed) */
.eb-sec { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(255, 255, 255, .012); }
.eb-sec > summary, .eb-card > summary { display: flex; align-items: center; gap: var(--space-4); cursor: pointer; list-style: none;
  padding: var(--space-4) var(--space-5); font-weight: 600; font-size: var(--text-sm); user-select: none; }
.eb-sec > summary::-webkit-details-marker, .eb-card > summary::-webkit-details-marker { display: none; }
.eb-sec > summary::before, .eb-card > summary::before { content: ""; width: 6px; height: 6px; flex: none; margin: 0 var(--space-2);
  border-right: 1.75px solid var(--text-secondary); border-bottom: 1.75px solid var(--text-secondary); transform: rotate(-45deg);
  transition: transform var(--duration); }
.eb-sec[open] > summary::before, .eb-card[open] > summary::before { transform: rotate(45deg); }
.eb-sec > summary:hover, .eb-card > summary:hover { color: var(--text-accent); }
.eb-sec-body { padding: var(--space-2) var(--space-5) var(--space-5); display: grid; gap: var(--space-4); }
.eb-sec .eb-sec { background: transparent; }

/* Embed cards – a coloured bar like the embed itself */
.eb-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); margin-top: var(--space-4); }
.eb-group-head h2 { margin: 0; color: var(--orange-600); letter-spacing: 2px; }
.eb-cards, .eb-items { display: grid; gap: var(--space-4); }
.eb-card { position: relative; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-overlay);
  overflow: hidden; }
.eb-card[open] { border-color: var(--border-strong); }
.eb-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.eb-card > summary b { white-space: nowrap; font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 1.4px; }
.eb-sum { flex: 1; min-width: 0; color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-card-body { display: grid; gap: var(--space-4); padding: 0 var(--space-5) var(--space-5) var(--space-6); }
.eb-acts { display: inline-flex; gap: var(--space-1); margin-left: auto; flex: none; }
.eb-acts .icon-btn { width: 28px; min-height: 28px; border-color: transparent; color: var(--text-secondary); }
.eb-acts .icon-btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-subtle); }
.eb-acts .icon-btn.danger:hover:not(:disabled) { color: var(--status-bad); border-color: var(--status-bad-line); }
.eb-acts .i { width: 14px; height: 14px; }
.eb-item { display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-5); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); background: var(--surface-input); }
.eb-item-head { display: flex; align-items: center; gap: var(--space-5); }
.eb-item-head .q-num { padding: 0; }
.eb-btn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); align-items: start;
  padding-top: var(--space-4); border-top: 1px dashed var(--border-subtle); }
.eb-btn .eb-acts { margin-top: 18px; }
.eb-add { justify-self: start; }
.eb-add .i { width: 14px; height: 14px; }

/* Toggles with a title + help line (flags, mentions, inline) */
.eb-toggles { display: grid; gap: var(--space-4); }
.eb-toggle { display: flex; align-items: center; gap: var(--space-5); cursor: pointer; }
.eb-toggle-text { display: flex; flex-direction: column; min-width: 0; }
.eb-toggle-text b { font-size: var(--text-sm); font-weight: 600; }
.eb-toggle-text small { font-size: var(--text-xs); }
.eb-item-head .eb-toggle .toggle span { width: 34px; height: 20px; }
.eb-item-head .eb-toggle .toggle span::after { width: 14px; height: 14px; }
.eb-item-head .eb-toggle .toggle input:checked + span::after { left: 17px; }
.eb-item-head .eb-toggle-text b { font-weight: 500; color: var(--text-secondary); }

/* Dialogs: JSON editor, code generator, load message */
.eb-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-pop); }
.eb-dialog::backdrop { background: rgba(5, 7, 6, .72); backdrop-filter: blur(2px); }
.eb-dialog-box { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.eb-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  padding: var(--space-5) var(--space-7); border-bottom: 1px solid var(--border-subtle); }
.eb-dialog-head h2 { margin: 0; color: var(--orange-600); letter-spacing: 2px; }
.eb-dialog-body { display: grid; gap: var(--space-4); padding: var(--space-6) var(--space-7); overflow-y: auto; }
.eb-dialog-body .eb-note { margin: 0; }
.eb-dialog-foot { display: flex; justify-content: flex-end; gap: var(--space-4); padding: var(--space-5) var(--space-7);
  border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.eb-dialog-foot:empty { display: none; }
.eb-code { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; white-space: pre; tab-size: 2; min-height: 320px; }
.eb-status { font-family: var(--font-mono); font-size: var(--text-xs); min-height: 1em; }
.eb-status.good { color: var(--status-good); }
.eb-status.bad { color: var(--status-bad); }

/* Preview: Discord's own dark message look */
.preview { position: sticky; top: calc(var(--topbar-height) + var(--space-5)); background: #313338; border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6) var(--space-7); border: 1px solid var(--border-subtle); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.preview-head h2 { margin: 0; }
.preview-head small { font-family: var(--font-mono); font-size: var(--text-xs); }
.dc-scroll { max-height: calc(100vh - var(--topbar-height) - 110px); overflow-y: auto; margin-right: calc(-1 * var(--space-4));
  padding-right: var(--space-4); }
.dc-msg { display: flex; gap: var(--space-5); font-family: "gg sans", "Noto Sans", var(--font-sans); font-size: 15px; color: #dbdee1;
  line-height: 1.375; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; }
.dc-body { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); justify-items: start; }
.dc-body > * { max-width: 100%; }
.dc-head { display: flex; align-items: center; gap: var(--space-3); }
.dc-head b { color: #f2f3f5; font-weight: 600; }
.dc-head small { color: #949ba4; font-size: 12px; }
.dc-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; line-height: 15px; }
.dc-flag { border: 1px solid #4e5058; border-radius: 3px; padding: 0 4px; }
.dc-content, .dc-desc, .dc-field > div { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.dc-content { justify-self: stretch; }
.dc-embed { --bar: #e0a24c; display: flex; gap: var(--space-6); width: 520px; max-width: 100%; background: #2b2d31;
  border-radius: var(--radius-sm); box-shadow: inset 4px 0 0 var(--bar); padding: var(--space-4) var(--space-6) var(--space-6) 16px; }
.dc-embed-main { min-width: 0; flex: 1; display: grid; gap: var(--space-4); align-content: start; }
.dc-author { display: flex; align-items: center; gap: var(--space-4); font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-author a { color: #f2f3f5; }
.dc-author-icon { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dc-title { font-weight: 600; color: #f2f3f5; font-size: 16px; }
.dc-title a { color: #00a8fc; }
.dc-desc { font-size: 14px; }
.dc-msg a { color: #00a8fc; }
.dc-msg a:hover { text-decoration: underline; color: #00a8fc; }
.dc-fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4) var(--space-5); }
.dc-field { font-size: 14px; min-width: 0; }
.dc-field > b { display: block; color: #f2f3f5; margin-bottom: 2px; font-weight: 600; }
.dc-image { max-width: 100%; max-height: 300px; border-radius: var(--radius-sm); object-fit: contain; justify-self: start; }
.dc-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }
.dc-footer { display: flex; align-items: center; gap: var(--space-4); font-size: 12px; color: #949ba4; }
.dc-footer-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.dc-button { display: inline-flex; align-items: center; gap: var(--space-3); background: #4e5058; color: #fff; font-size: 14px;
  font-weight: 500; min-height: 32px; padding: 2px 16px; border-radius: 8px; }
.dc-button .i { width: 14px; height: 14px; }
.dc-button .dc-emoji { width: 18px; height: 18px; }
.dc-hidden { font-size: 13px; color: #949ba4; font-style: italic; margin-top: var(--space-4); }
.dc-h1, .dc-h2, .dc-h3, .dc-sub, .dc-quote, .dc-li { display: block; }
.dc-h1 { font-size: 22px; font-weight: 700; color: #f2f3f5; margin: 6px 0 2px; }
.dc-h2 { font-size: 19px; font-weight: 700; color: #f2f3f5; margin: 6px 0 2px; }
.dc-h3 { font-size: 16px; font-weight: 700; color: #f2f3f5; margin: 6px 0 2px; }
.dc-sub { font-size: 12px; color: #949ba4; }
.dc-quote { border-left: 4px solid #4e5058; padding-left: 12px; }
.dc-li { padding-left: 18px; position: relative; }
.dc-li::before { content: "•"; position: absolute; left: 4px; }
.dc-code { margin: 4px 0; padding: 8px; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; font-size: 13px;
  white-space: pre-wrap; font-family: var(--font-mono); }
.dc-embed .dc-code { background: #1e1f22; }
.dc-inline { background: #2b2d31; border: 0; padding: 0 3px; font-size: 13px; font-family: var(--font-mono); }
.dc-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; transition: color var(--duration); cursor: pointer; }
.dc-spoiler:hover { color: inherit; background: #3a3c42; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-time { background: rgba(255, 255, 255, .06); border-radius: 3px; padding: 0 2px; }
.dc-emoji { width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }

@media (max-width: 1100px) { .builder { grid-template-columns: 1fr; } .preview { position: static; } .dc-scroll { max-height: none; } }
@media (max-width: 860px) {
  .eb-editor { padding: var(--space-5); }
  .eb-grid, .eb-grid-3 { grid-template-columns: 1fr; }
  .eb-card-body { padding: 0 var(--space-4) var(--space-4) var(--space-5); }
  .dc-embed { width: auto; }
}
.setting[hidden] { display: none; }

/* ══ Tournaments: event + registration pages ════════════════════════════════════════════════════ */
input[type=datetime-local], input[type=date], input[type=time] { font: inherit; font-size: var(--text-md); color: var(--text-primary);
  background: var(--surface-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  min-height: var(--control-height); padding: var(--space-2) var(--space-5); color-scheme: dark; }
.setting-control .num.dt { max-width: 230px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.mode-card { position: relative; cursor: pointer; }
.mode-card input { position: absolute; opacity: 0; }
.mode-card span { display: flex; flex-direction: column; gap: var(--space-2); height: 100%; padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-input);
  transition: border-color var(--duration), background var(--duration); }
.mode-card b { font-size: var(--text-md); }
.mode-card small { font-size: var(--text-xs); line-height: 1.4; }
.mode-card:hover span { border-color: var(--border-strong); }
.mode-card input:checked + span { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 9%, var(--surface-input)); }
.mode-card input:focus-visible + span { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.ico.eb-place { width: auto; min-width: 40px; padding: 0 var(--space-3); font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--orange-600); }
.actions-card { display: grid; padding: 0; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle); }
.action-row:last-child { border-bottom: 0; }
.action-row > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.action-row small { font-size: var(--text-sm); }
.fold { margin-top: var(--space-6); }
.inline-control { display: flex; gap: var(--space-4); align-items: center; }
.inline-control > .select, .inline-control > input { flex: 1; min-width: 0; }
.roster { display: grid; gap: var(--space-3); }
.roster-row { display: grid; grid-template-columns: 34px minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr) auto auto; gap: var(--space-4);
  align-items: center; padding: var(--space-4) var(--space-5); background: var(--surface-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); }
.roster-row.empty { border-style: dashed; background: transparent; }
.roster-row .q-num { padding: 0; }
.mono { font-family: var(--font-mono); }
@media (max-width: 860px) {
  .roster-row { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr); }
  .roster-row input[name=member] { grid-column: 2 / -1; }
  .action-row { flex-direction: column; align-items: flex-start; }
}

.checkin-grid, .stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-5); }
.checkin-grid { padding: var(--space-6) var(--space-7); }
.checkin-group, .stage-group { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-input); }
.checkin-group > b, .stage-group > b { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--orange-600); margin-bottom: var(--space-2); }
.checkin-team { font-size: var(--text-sm); color: var(--text-secondary); }
.checkin-team.in { color: var(--text-primary); }
.checkin-team small { font-size: var(--text-xs); }
.stage-group .role small { margin-left: auto; color: var(--text-secondary); }
p.empty.card { margin-top: var(--space-6); }

.results-top { margin-top: var(--space-2); }
.inline-form { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; margin-top: var(--space-5); padding: var(--space-5); }
.inline-form .select { flex: 1 1 220px; }
.result-row { grid-template-columns: 34px minmax(0, 1.6fr) 70px 130px 70px auto auto; }
.link-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto; }
.result-who { display: flex; flex-direction: column; min-width: 0; }
.result-who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-xs); }
.mini-field { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 1px; }
.mini-field input { min-height: 30px; padding: var(--space-1) var(--space-3); font-size: var(--text-sm); font-family: var(--font-mono); }
.settings-note { margin: var(--space-4) var(--space-7) 0; }
.card.table.flat { border: 0; border-radius: 0; background: transparent; }
@media (max-width: 860px) {
  .result-row { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr); }
  .result-row .result-who { grid-column: 2 / -1; }
  .link-row { grid-template-columns: minmax(0, 1fr) auto; }
}

.mb-matches { display: grid; gap: var(--space-3); padding: var(--space-5) var(--space-7); }
.mb-match { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--space-5); align-items: center;
  padding: var(--space-4) var(--space-5); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-input); }
.mb-side { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mb-side small { font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-side a { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.mb-side a .i { width: 12px; height: 12px; }
.mb-vs { font-family: var(--font-mono); color: var(--orange-600); font-size: var(--text-xs); }
.mb-manager { margin: 0 var(--space-7); }
.mb-manager input { flex: 1 1 200px; width: auto; }
.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-4); padding: var(--space-6) var(--space-7); }
.rank-cell { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); background: var(--surface-input); }
.rank-cell b { font-size: var(--text-sm); }
.rank-cell small { font-size: var(--text-xs); }
.flat-card { border: 0; background: transparent; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-5); padding: var(--space-6) var(--space-7); }
.bg-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-input); }
.bg-card img { display: block; width: 100%; aspect-ratio: 1000 / 560; object-fit: cover; }
.bg-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--space-4); align-items: center; padding: var(--space-4) var(--space-5); }
.bg-meta small { grid-column: 1; font-size: var(--text-xs); }
.bg-meta form { grid-column: 2; grid-row: 1 / 3; }
.bg-add { border-top: 1px solid var(--border-subtle); }
input[type=file] { font: inherit; font-size: var(--text-sm); color: var(--text-secondary); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); cursor: pointer;
  background: var(--surface-overlay); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-3) var(--space-5);
  margin-right: var(--space-4); }
.savebar form { display: contents; }
@media (max-width: 860px) {
  .mb-match { grid-template-columns: 1fr; }
  .mb-vs { display: none; }
  .mb-manager { margin: 0 var(--space-5); }
}

/* ══ Server stats: server-drawn SVG charts ══════════════════════════════════════════════════════ */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); margin-top: var(--space-6); }
.stat-tile { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-5) var(--space-6);
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.stat-tile small { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 1.2px; }
.stat-tile b { font-size: 24px; font-variant-numeric: tabular-nums; font-family: var(--font-mono); color: var(--text-primary); }
.stat-tile span { font-size: var(--text-xs); color: var(--text-secondary); }
.stat-tile .up { color: var(--status-good); }
.stat-tile .down { color: var(--status-bad); }
.chart-card { padding: var(--space-5) var(--space-6) var(--space-4); }
.chart-card h2 { margin: 0 0 var(--space-4); }
.chart-legend { display: flex; gap: var(--space-5); font-size: var(--text-xs); color: var(--text-secondary); margin-bottom: var(--space-3); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: var(--space-2); background: var(--acc-stats); }
.chart-legend i.alt { background: var(--status-bad); }
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--border-subtle); stroke-width: 1; }
.chart .tick { fill: var(--text-secondary); font-size: 10px; font-family: var(--font-mono); }
.chart .bar { fill: var(--acc-stats); }
.chart .bar.alt { fill: var(--status-bad); fill-opacity: .8; }
.chart .bar:hover { fill-opacity: .75; }
.chart .line { fill: none; stroke: var(--acc-stats); stroke-width: 2; }
.chart .area { fill: var(--acc-stats); fill-opacity: .12; }
.chart .dot { fill: var(--acc-stats); }
.chart .heat { fill: var(--acc-stats); }
.chart.heatmap { max-width: 720px; }
.stats-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); margin-top: var(--space-5); }
.stats-two .card, .chart-card { margin-top: 0; }
.stats-stack { display: grid; gap: var(--space-5); margin-top: var(--space-5); }
.range-tabs { margin-top: var(--space-6); }
@media (max-width: 860px) { .stats-two { grid-template-columns: 1fr; } }
