/* =========================================================================
   FiveApply — "Night Shift" design system
   Ink-indigo night, street-light gold, neon signal colours.
   Brand colours are injected as CSS variables from app/brand.php
   (--gold-light, --gold-medium, --gold-dark, --primary, --pink, --cyan, --violet).
   Dark by default; [data-theme="light"] switches to light.
   Marketing / public pages live in site.css.
   ========================================================================= */

:root {
  --gold-light: #FEEA6D;
  --gold-medium: #D2A12D;
  --gold-dark: #A68400;
  --primary: #EFBF04;
  --pink: #FF4F8B;
  --cyan: #2DD4EE;
  --violet: #8B6CFF;

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

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --sidebar-w: 268px;
  --header-h: 72px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --gold-grad: linear-gradient(120deg, var(--gold-light) 0%, var(--primary) 45%, #ff9f2e 100%);
  --sunset-grad: linear-gradient(100deg, var(--primary) 0%, #ff8a3d 40%, var(--pink) 75%, var(--violet) 110%);
  --neon-grad: linear-gradient(100deg, var(--pink), var(--violet) 50%, var(--cyan));

  /* Dark theme (default) */
  color-scheme: dark;
  --bg: #0c0b16;
  --bg-deep: #08070f;
  --surface: #14132a;
  --surface-2: #1c1a36;
  --surface-3: #27254a;
  --border: #29274a;
  --border-strong: #3c3966;
  --text: #f5f3ff;
  --text-muted: #aaa6cc;
  --text-faint: #716d97;
  --link: var(--gold-light);
  --primary-ink: #1a1300;
  --primary-soft: rgba(239, 191, 4, .13);
  --primary-ring: rgba(239, 191, 4, .45);
  --highlight: rgba(255, 255, 255, .045);
  --dots: rgba(170, 166, 220, .085);
  --shadow: 0 1px 0 var(--highlight) inset, 0 14px 34px -18px rgba(0, 0, 0, .8);
  --shadow-lg: 0 32px 80px -24px rgba(0, 0, 0, .85);
  --edge: rgba(0, 0, 0, .45);

  --green: #3ddc97; --green-soft: rgba(61, 220, 151, .13);
  --red: #ff5c6c; --red-soft: rgba(255, 92, 108, .13);
  --amber: #ffb020; --amber-soft: rgba(255, 176, 32, .14);
  --blue: #5aa2ff; --blue-soft: rgba(90, 162, 255, .13);
  --violet-soft: rgba(139, 108, 255, .16);
  --pink-soft: rgba(255, 79, 139, .14);
  --cyan-soft: rgba(45, 212, 238, .13);
  --slate: #9a98b8; --slate-soft: rgba(154, 152, 184, .13);
  --discord: #5865F2;

  /* --hue drives tinted components (stat tiles, icon chips, features). */
  --hue: var(--primary);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3fa;
  --bg-deep: #ebe9f5;
  --surface: #ffffff;
  --surface-2: #f3f1fa;
  --surface-3: #e7e4f3;
  --border: #e3e0f0;
  --border-strong: #cbc6e2;
  --text: #16132b;
  --text-muted: #59547a;
  --text-faint: #8a86a6;
  --link: #7c5a00;
  --primary-soft: rgba(239, 191, 4, .2);
  --primary-ring: rgba(166, 132, 0, .5);
  --highlight: rgba(255, 255, 255, .8);
  --dots: rgba(60, 50, 120, .09);
  --shadow: 0 1px 2px rgba(30, 20, 80, .05), 0 12px 30px -18px rgba(30, 20, 80, .25);
  --shadow-lg: 0 30px 70px -28px rgba(30, 20, 80, .35);
  --edge: rgba(30, 20, 80, .16);

  --green: #0d9f6e; --green-soft: rgba(13, 159, 110, .11);
  --red: #e0283f; --red-soft: rgba(224, 40, 63, .09);
  --amber: #c26a00; --amber-soft: rgba(230, 140, 0, .13);
  --blue: #2563eb; --blue-soft: rgba(37, 99, 235, .09);
  --violet-soft: rgba(139, 108, 255, .13);
  --pink-soft: rgba(255, 79, 139, .12);
  --cyan-soft: rgba(8, 145, 178, .11);
  --slate: #64618a; --slate-soft: rgba(100, 97, 138, .1);
}

/* Hue helpers: put on any tinted component. Doubled class = higher specificity, so a helper
   always beats a component's own default --hue (those defaults are written with :where()). */
.hue-gold.hue-gold { --hue: var(--primary); }
.hue-pink.hue-pink { --hue: var(--pink); }
.hue-cyan.hue-cyan { --hue: var(--cyan); }
.hue-violet.hue-violet { --hue: var(--violet); }
.hue-green.hue-green { --hue: var(--green); }
.hue-red.hue-red { --hue: var(--red); }
.hue-amber.hue-amber { --hue: var(--amber); }
.hue-blue.hue-blue { --hue: var(--blue); }
.hue-discord.hue-discord { --hue: var(--discord); }
.hue-slate.hue-slate { --hue: var(--slate); }
:root[data-theme="light"] .hue-gold.hue-gold { --hue: #c99a00; }
:root[data-theme="light"] .hue-cyan.hue-cyan { --hue: #0891b2; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--border-strong) transparent; }
body {
  margin: 0; min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 0% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 65%),
    radial-gradient(800px 520px at 100% -5%, color-mix(in srgb, var(--violet) 12%, transparent), transparent 60%),
    radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
  color: var(--text); font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-faint); }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 650; }
h1 { font-family: var(--font-display); font-size: clamp(1.55rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.035em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.display { font-family: var(--font-display); letter-spacing: -.04em; }
.gold, .text-grad { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.neon { background: var(--sunset-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .gold, :root[data-theme="light"] .text-grad { background-image: linear-gradient(115deg, #a37800, #c98a00 45%, #d9480f); }
p { margin: 0 0 1em; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: .86em; }
code { background: var(--surface-3); padding: .12em .45em; border-radius: 6px; }
pre { background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; line-height: 1.55; }
pre code { background: none; padding: 0; }
kbd { display: inline-block; min-width: 1.7em; text-align: center; padding: .1em .45em; border: 1px solid var(--border-strong); border-bottom-width: 3px; border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: .76em; font-weight: 600; line-height: 1.5; }
::selection { background: var(--primary); color: var(--primary-ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.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; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: var(--primary-ink); padding: 10px 16px; border-radius: 10px; font-weight: 650; }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; flex: none; }
.icon-lg { width: 22px; height: 22px; flex: none; }

/* ---------- Layout utilities ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 780px; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .grid-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-gold { color: var(--primary); }
:root[data-theme="light"] .text-gold { color: #a37800; }
@media (max-width: 640px) { .hidden-mobile { display: none; } }

/* ---------- Buttons ----------
   Tactile, game-style: a solid bottom edge that the button presses into. */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-border: var(--border-strong); --btn-edge: var(--edge);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-border);
  box-shadow: 0 1px 0 var(--highlight) inset, 0 3px 0 var(--btn-edge);
  font: inherit; font-weight: 600; font-size: .9rem; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none !important; user-select: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease), box-shadow .12s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--text-faint); transform: translateY(-1px); box-shadow: 0 1px 0 var(--highlight) inset, 0 4px 0 var(--btn-edge); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-edge); transition-duration: .04s; }
.btn:disabled, .btn[aria-disabled="true"], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  --btn-bg: var(--primary); --btn-fg: var(--primary-ink); --btn-border: transparent; --btn-edge: #9c7400;
  background: linear-gradient(180deg, var(--gold-light) -60%, var(--primary) 55%);
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(180deg, #fff6b8 -40%, var(--gold-light) 10%, var(--primary) 80%); border-color: transparent; box-shadow: 0 4px 0 var(--btn-edge), 0 14px 30px -12px rgba(239, 191, 4, .65); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-edge: transparent; color: var(--text-muted); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; transform: none; box-shadow: none; }
.btn-ghost:active { transform: none; }
.btn-danger { --btn-bg: var(--red-soft); --btn-fg: var(--red); --btn-border: color-mix(in srgb, var(--red) 30%, transparent); --btn-edge: color-mix(in srgb, var(--red) 35%, transparent); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); --btn-edge: #a3162a; }
.btn-success { --btn-bg: var(--green-soft); --btn-fg: var(--green); --btn-border: color-mix(in srgb, var(--green) 30%, transparent); --btn-edge: color-mix(in srgb, var(--green) 35%, transparent); }
.btn-success:hover { background: var(--green); color: #03140c; border-color: var(--green); --btn-edge: #0a7a50; }
.btn-discord { --btn-bg: var(--discord); --btn-fg: #fff; --btn-border: transparent; --btn-edge: #3a43b8; }
.btn-discord:hover { background: #6b77ff; border-color: transparent; }
.btn-danger-soft:hover { color: var(--red); background: var(--red-soft); }
.btn-sm { height: 32px; padding: 0 11px; font-size: .82rem; gap: 6px; border-radius: 10px; box-shadow: 0 1px 0 var(--highlight) inset, 0 2px 0 var(--btn-edge); }
.btn-sm:hover { box-shadow: 0 1px 0 var(--highlight) inset, 0 3px 0 var(--btn-edge); }
.btn-sm:active { transform: translateY(2px); }
.btn-sm.btn-ghost { box-shadow: none; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 1rem; border-radius: 15px; box-shadow: 0 1px 0 var(--highlight) inset, 0 4px 0 var(--btn-edge); }
.btn-lg:hover { box-shadow: 0 1px 0 var(--highlight) inset, 0 5px 0 var(--btn-edge); }
.btn-lg.btn-primary:hover { box-shadow: 0 5px 0 var(--btn-edge), 0 18px 40px -14px rgba(239, 191, 4, .7); }
.btn-lg:active { transform: translateY(4px); }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn.is-active { border-color: var(--primary); color: var(--text); background: var(--primary-soft); }
.btn-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn .icon, .btn svg { flex: none; display: block; }
.btn-closed { --btn-bg: var(--red-soft); --btn-fg: var(--red); --btn-border: color-mix(in srgb, var(--red) 30%, transparent); --btn-edge: transparent; cursor: not-allowed; }
.page-head > .btn-group { margin-left: auto; }
.page-head-builder { max-width: 780px; margin-left: auto; margin-right: auto; }
.page-head-settings { max-width: 860px; }
form.inline { display: inline; }

/* ---------- Cards ---------- */
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(180deg, var(--highlight), transparent 90px); }
:root[data-theme="light"] .card::after { display: none; }
.card > * { position: relative; z-index: 1; }
/* Each child is its own layer, so lift the one with an open dropdown above the rows/cards after it. */
.card > :has(.menu[open]), .card:has(.menu[open]) { z-index: 5; }
.card-pad { padding: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-link { display: block; color: inherit; text-decoration: none !important; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s var(--ease); }
.card-link:hover { border-color: color-mix(in srgb, var(--hue) 55%, var(--border-strong)); transform: translateY(-3px); box-shadow: var(--shadow), 0 6px 0 -1px color-mix(in srgb, var(--hue) 45%, transparent); }
.card-highlight { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: radial-gradient(520px 200px at 0% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%), radial-gradient(420px 200px at 100% 0%, color-mix(in srgb, var(--pink) 9%, transparent), transparent 70%), var(--surface); }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; margin: 0; }
.section-title .chip-icon { width: 30px; height: 30px; border-radius: 9px; }

/* Icon chip: a small rounded square tinted with --hue. */
.chip-icon { width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; flex: none; color: var(--hue); background: color-mix(in srgb, var(--hue) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 28%, transparent); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 18px; }
.field > label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 7px; }
.field .hint { display: block; color: var(--text-muted); font-size: .8rem; margin-top: 6px; }
.field-error { color: var(--red); font-size: .82rem; margin: 6px 0 0; font-weight: 550; }
.req { color: var(--pink); margin-left: 3px; }
.input, .select, .textarea, input[type=text].input, input[type=number].input {
  width: 100%; min-height: 42px; padding: 10px 13px;
  background: var(--bg-deep); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px;
  font: inherit; font-size: .93rem; line-height: 1.4;
  transition: border-color .15s, box-shadow .2s var(--ease), background .15s;
}
:root[data-theme="light"] .input, :root[data-theme="light"] .select, :root[data-theme="light"] .textarea { background: var(--surface); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input[readonly] { opacity: .75; }
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239a98b8' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .input.is-invalid { border-color: var(--red); }
.input-sm { min-height: 34px; padding: 6px 10px; font-size: .85rem; border-radius: 10px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 12px 0 0 12px; }
.input-group .btn { border-radius: 0 12px 12px 0; height: auto; box-shadow: none; }
.input-group .btn:active { transform: none; }
.input-prefix { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1.5px solid var(--border); border-right: 0; border-radius: 12px 0 0 12px; color: var(--text-muted); font-size: .86rem; white-space: nowrap; font-family: var(--font-mono); }
.input-prefix + .input { border-radius: 0 12px 12px 0; }
.check { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; margin-bottom: 8px; transition: border-color .15s, background .15s, transform .15s var(--ease); }
.check:hover { border-color: var(--border-strong); }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check input { margin-top: 2px; accent-color: var(--primary); width: 17px; height: 17px; flex: none; }
.check-plain { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.check-plain input { accent-color: var(--primary); width: 16px; height: 16px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); border: 1.5px solid var(--border-strong); position: relative; cursor: pointer; transition: background .2s, border-color .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--text-muted); transition: transform .35s var(--spring), background .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { transform: translateX(18px); background: var(--primary-ink); }
.switch input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.counter { font-size: .76rem; color: var(--text-faint); text-align: right; margin-top: 5px; font-variant-numeric: tabular-nums; }
.counter.is-short { color: var(--amber); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.form-section { padding: 24px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding-top: 8px; }
/* Save bar: a direct child of a tall form, it rides the bottom of the screen while the form is in
   view so Save never needs a scroll. (Higher specificity than `.card > *`, which sets position.) */
form[data-unsaved] .save-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 90%, transparent); backdrop-filter: blur(12px) saturate(150%); transition: border-color .2s, box-shadow .2s; }
form[data-unsaved].is-dirty .save-bar { border-color: color-mix(in srgb, var(--primary) 55%, transparent); box-shadow: var(--shadow-lg), 0 0 0 3px var(--primary-soft); }
.save-note { font-size: .84rem; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 7px; }
.save-note:empty { display: none; }
.save-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: dot-pulse 2.2s ease-in-out infinite; }
.admin-settings > .save-bar { margin: 6px 22px 22px; }
.color-input { width: 48px; height: 42px; padding: 3px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface-2); cursor: pointer; }

/* ---------- Badges & chips ---------- */
.badge { --b: var(--slate); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap; letter-spacing: .01em; background: color-mix(in srgb, var(--b) 14%, transparent); color: var(--b); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--b) 28%, transparent); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-in_review::before, .badge-interview::before, .badge-info_requested::before, .badge-pending::before { animation: dot-pulse 2.2s ease-in-out infinite; }
@keyframes dot-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); } }
.badge-plain::before { display: none; }
.badge-plain { padding-left: 10px; }
.badge-pending { --b: var(--cyan); }
.badge-in_review { --b: var(--blue); }
.badge-info_requested { --b: var(--amber); }
.badge-interview { --b: var(--violet); }
.badge-approved, .badge-open, .badge-ok { --b: var(--green); }
.badge-denied, .badge-error, .badge-danger { --b: var(--red); }
.badge-withdrawn, .badge-closed, .badge-draft { --b: var(--slate); }
.badge-warning { --b: var(--amber); }
.badge-gold { --b: var(--primary); }
.badge-pink { --b: var(--pink); }
:root[data-theme="light"] .badge-gold { --b: #a37800; }
:root[data-theme="light"] .badge-pending { --b: #0891b2; }
.badge-dept { --dept: var(--violet); --b: var(--dept); display: inline-flex; align-items: center; gap: 5px; }
.badge-dept img { width: 14px; height: 14px; border-radius: 4px; object-fit: cover; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: .8rem; color: var(--text-muted); }
.chip-link { text-decoration: none !important; transition: border-color .15s, color .15s; }
.chip-link:hover { border-color: var(--primary); color: var(--text); }

/* ---------- Stamps: the signature "decision" mark ---------- */
.stamp { --s: var(--slate); display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 3px double var(--s); border-radius: 10px; color: var(--s); font-family: var(--font-display); font-weight: 800; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; transform: rotate(-7deg); background: color-mix(in srgb, var(--s) 7%, transparent);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='120' height='60' filter='url(%23g)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='120' height='60' filter='url(%23g)'/%3E%3C/svg%3E");
}
.stamp-lg { font-size: clamp(1.3rem, 3vw, 1.9rem); padding: 8px 20px; border-width: 5px; border-radius: 14px; }
.stamp-approved { --s: var(--green); }
.stamp-denied { --s: var(--red); }
.stamp-interview { --s: var(--violet); }
.stamp-pending, .stamp-in_review { --s: var(--cyan); }
.stamp-info_requested { --s: var(--amber); }
.stamp-withdrawn { --s: var(--slate); }
.stamp.is-slam { animation: slam .55s cubic-bezier(.2, 1.4, .4, 1) backwards .25s; }
@keyframes slam { 0% { opacity: 0; transform: rotate(-7deg) scale(2.4); } 60% { opacity: 1; transform: rotate(-7deg) scale(.94); } 100% { transform: rotate(-7deg) scale(1); } }

/* ---------- Alerts ---------- */
.alert { --alert-c: var(--border-strong); position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--alert-c) 35%, var(--border)); background: color-mix(in srgb, var(--alert-c) 10%, var(--surface)); margin-bottom: 16px; font-size: .92rem; }
.alert > .icon { color: var(--alert-c); margin-top: 1px; flex: none; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { --alert-c: var(--green); }
.alert-error { --alert-c: var(--red); }
.alert-warning { --alert-c: var(--amber); }
.alert-info { --alert-c: var(--blue); }
.alert-gold { --alert-c: var(--primary); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(390px, calc(100vw - 32px)); }
.toast { --toast-c: var(--green); position: relative; overflow: hidden; display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px 15px 15px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface-2) 92%, transparent); backdrop-filter: blur(14px) saturate(150%); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg), inset 3px 0 0 var(--toast-c); font-size: .9rem; animation: toast-in .5s var(--spring); }
.toast > .icon { color: var(--toast-c); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--toast-c); transform-origin: left; animation: toast-timer 4.2s linear forwards; opacity: .7; }
.toast-error { --toast-c: var(--red); } .toast-error::after { animation-duration: 7s; }
.toast-info { --toast-c: var(--blue); } .toast-warning { --toast-c: var(--amber); }
.toast.is-leaving { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) scale(.97); } }
@keyframes toast-timer { to { transform: scaleX(0); } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 650; font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th.text-right { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { position: relative; transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table tr.is-selected { background: var(--primary-soft); }
.table tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table .row-link { color: inherit; text-decoration: none; font-weight: 620; }
.table .row-link::after { content: ""; position: absolute; inset: 0; }

/* ---------- Avatars & logos ---------- */
.avatar { width: 34px; height: 34px; max-width: none; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; }
.avatar-sm { width: 24px; height: 24px; }
.avatar-lg { width: 60px; height: 60px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in srgb, var(--primary) 60%, transparent); }
.avatar-xl { width: 76px; height: 76px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.community-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: var(--primary); flex: none; }
img.community-logo { object-fit: contain; background: transparent !important; border: 0 !important; }
img.community-logo.fit-cover { object-fit: cover; }
.community-logo-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.4rem; }
/* Monogram tile used when a community has no logo. */
.monogram { --hue: var(--accent, var(--primary)); width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; flex: none; font-family: var(--font-display); font-weight: 800; font-size: 1rem; letter-spacing: -.04em; color: #fff; background: linear-gradient(135deg, var(--hue), color-mix(in srgb, var(--hue) 40%, var(--violet))); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.monogram-sm { width: 28px; height: 28px; border-radius: 8px; font-size: .72rem; }
.monogram-lg { width: 72px; height: 72px; border-radius: 20px; font-size: 1.6rem; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; letter-spacing: -.045em; }
.brand-mark { width: 32px; height: 32px; flex: none; object-fit: contain; transition: transform .5s var(--spring); }
.brand:hover .brand-mark { transform: rotate(-10deg) scale(1.08); }

/* ---------- Dropdown menus (details/summary) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 3px; border-radius: 99px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--surface-2); }
.menu > summary.btn { border-radius: 10px; padding: 0 11px; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 60; padding: 6px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); transform-origin: top right; }
.menu[open] > .menu-panel { animation: pop-in .26s var(--spring); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.96); } }
.menu > summary .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--primary) 50%, transparent); transition: box-shadow .2s; }
.menu > summary:hover .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); }
.menu-panel a, .menu-panel button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); font: inherit; font-size: .9rem; background: none; border: 0; cursor: pointer; text-decoration: none; text-align: left; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel a .icon, .menu-panel button .icon { color: var(--text-muted); }
.menu-panel .menu-label { padding: 8px 10px 5px; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); font-weight: 650; }
.menu-panel hr { margin: 6px 0; }
.menu-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.menu-user strong { display: block; font-size: .92rem; }

/* ---------- Dashboard shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px 14px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; border-right: 1px solid var(--border); background: linear-gradient(180deg, color-mix(in srgb, var(--violet) 7%, transparent), transparent 260px), color-mix(in srgb, var(--bg-deep) 88%, transparent); }
.sidebar .brand { padding: 2px 8px 18px; }
.community-switch { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 14px; color: var(--text); text-decoration: none !important; transition: border-color .2s, background .2s; }
.community-switch .community-logo, .community-switch .monogram { width: 38px; height: 38px; border-radius: 11px; font-size: .85rem; }
.community-switch:hover, .menu > summary.community-switch:hover { border-color: var(--border-strong); background: var(--surface-2); }
.menu > summary.community-switch { border-radius: 16px; padding: 10px; }
.community-switch .cs-name { display: block; font-weight: 650; font-size: .92rem; }
.community-switch .cs-meta { font-size: .74rem; color: var(--text-muted); }
.community-switch > .icon-sm { color: var(--text-faint); }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); padding: 18px 10px 6px; font-weight: 700; }
.nav-link { --hue: var(--text-muted); position: relative; display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 12px; color: var(--text-muted); font-size: .9rem; font-weight: 550; text-decoration: none !important; transition: background .15s, color .15s; }
.nav-link > .icon { width: 30px; height: 30px; padding: 6px; border-radius: 9px; transition: background .2s, color .2s, transform .3s var(--spring); }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link:hover > .icon { color: var(--hue); background: color-mix(in srgb, var(--hue) 14%, transparent); }
.nav-link.is-active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: inset 0 0 0 1px var(--border); }
.nav-link.is-active > .icon { color: #fff; background: var(--hue); box-shadow: 0 6px 16px -6px var(--hue); }
:root[data-theme="light"] .nav-link.is-active > .icon { color: #fff; }
.nav-link .count { margin-left: auto; min-width: 24px; text-align: center; font-size: .72rem; font-weight: 750; padding: 2px 8px; border-radius: 99px; background: var(--pink); color: #fff; box-shadow: 0 4px 12px -4px var(--pink); font-variant-numeric: tabular-nums; }
.nav-link .lock { margin-left: auto; color: var(--text-faint); }
.nav-link .nav-kbd { margin-left: auto; }
/* Server dashboard: a raised shade so the nav reads apart from the page; its hovers step up one surface to match. */
.sidebar.sidebar-server { background: linear-gradient(180deg, color-mix(in srgb, var(--violet) 9%, transparent), transparent 260px), var(--surface); }
.sidebar-server .community-switch { background: var(--surface-2); }
.sidebar-server .community-switch:hover, .sidebar-server .menu > summary.community-switch:hover { background: var(--surface-3); }
.sidebar-server .nav-link:hover, .sidebar-server .sidebar-footer .nav-link:hover, .sidebar-server .nav-link.is-active { background: var(--surface-2); }
/* Quieter icons: muted tile instead of a full-strength one, and a short, faint shadow instead of the glow. */
.sidebar-server .nav-link:hover > .icon { color: color-mix(in srgb, var(--hue) 75%, var(--text-muted)); background: color-mix(in srgb, var(--hue) 9%, transparent); }
.sidebar-server .nav-link.is-active > .icon { color: color-mix(in srgb, #fff 88%, var(--hue)); background: color-mix(in srgb, var(--hue) 62%, var(--surface)); box-shadow: 0 2px 6px -3px color-mix(in srgb, var(--hue) 45%, transparent); }
.sidebar-footer { margin-top: auto; padding-top: 12px; display: grid; gap: 2px; }
.sidebar-footer .nav-link { width: 100%; border: 0; background: none; cursor: pointer; font: inherit; font-size: .9rem; }
.sidebar-footer .nav-link:hover { background: var(--surface); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 32px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(160%) blur(14px); }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--text-muted); min-width: 0; }
.topbar .crumbs a { color: var(--text-muted); }
.topbar .crumbs strong { color: var(--text); font-weight: 650; }
.topbar .crumbs .icon-sm { color: var(--text-faint); }
.cmdk-trigger { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 12px; min-width: 240px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-faint); font: inherit; font-size: .86rem; cursor: pointer; transition: border-color .15s, color .15s; }
.cmdk-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.cmdk-trigger .grow { text-align: left; }
@media (max-width: 760px) { .cmdk-trigger { min-width: 0; padding: 0 10px; } .cmdk-trigger .grow, .cmdk-trigger kbd { display: none; } }
.content { padding: 34px 32px 72px; max-width: 1260px; width: 100%; }
.content-narrow { max-width: 880px; }
/* Page entrance: top-level blocks rise in, lightly staggered. */
.content > *, .auth-wrap > * { animation: rise .5s var(--ease) backwards; }
.content > :nth-child(2) { animation-delay: .04s; }
.content > :nth-child(3) { animation-delay: .08s; }
.content > :nth-child(4) { animation-delay: .12s; }
.content > :nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--text-muted); }
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; z-index: 70; transform: translateX(-100%); transition: transform .25s var(--ease); background: var(--bg-deep); }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(5, 4, 12, .6); backdrop-filter: blur(3px); z-index: 65; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 22px 16px 64px; }
  .topbar { padding: 0 12px; }
}

/* ---------- Command palette ---------- */
dialog.cmdk { width: min(620px, calc(100vw - 24px)); margin-top: 12vh; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--violet) 25%, transparent), 0 30px 100px -30px color-mix(in srgb, var(--violet) 60%, transparent); overflow: hidden; }
dialog.cmdk::backdrop { background: rgba(5, 4, 12, .55); backdrop-filter: blur(5px); }
dialog.cmdk[open] { animation: modal-in .3s var(--spring); }
.cmdk-search { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmdk-search .icon { color: var(--text-faint); }
.cmdk-search input { flex: 1; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.05rem; outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: 8px; max-height: 52vh; overflow-y: auto; }
.cmdk-group { padding: 10px 10px 4px; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); font-weight: 700; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 11px; color: var(--text); cursor: pointer; text-decoration: none !important; font-size: .93rem; }
.cmdk-item .icon { width: 30px; height: 30px; padding: 6px; border-radius: 9px; color: var(--hue, var(--text-muted)); background: color-mix(in srgb, var(--hue, var(--slate)) 14%, transparent); }
.cmdk-item.is-active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.cmdk-item .cmdk-go { margin-left: auto; color: var(--text-faint); opacity: 0; }
.cmdk-item.is-active .cmdk-go { opacity: 1; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: .9rem; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: .76rem; color: var(--text-faint); background: color-mix(in srgb, var(--surface-2) 50%, transparent); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); width: fit-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; color: var(--text-muted); font: inherit; font-size: .88rem; font-weight: 600; border: 0; background: none; border-radius: 10px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: color .15s, background .15s; }
.tabs a:hover, .tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs .is-active { color: var(--text); background: var(--surface-3); box-shadow: 0 2px 0 var(--edge); }
.tabs .count { font-size: .7rem; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tabs .is-active .count { background: var(--primary); color: var(--primary-ink); }

/* ---------- Stats ---------- */
.stat { padding: 20px 22px; overflow: hidden; }
.stat::before { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--hue) 22%, transparent), transparent 70%); pointer-events: none; transition: transform .5s var(--ease); }
.stat:hover::before { transform: scale(1.4); }
.stat-label { font-size: .74rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .09em; display: flex; align-items: center; gap: 8px; }
.stat-label .icon, .stat-label .icon-sm { color: var(--hue); }
.stat-value { font-family: var(--font-display); font-size: 2.3rem; font-weight: 700; letter-spacing: -.05em; margin-top: 8px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .8rem; color: var(--text-faint); margin-top: 6px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--gold-grad); border-radius: inherit; transition: width .8s var(--ease); animation: grow-x 1s var(--ease) backwards .2s; transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } }
.meter.is-warn > span { background: var(--amber); }
.meter.is-full > span { background: var(--red); }

/* ---------- Bar chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 170px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column-reverse; gap: 1px; height: 100%; justify-content: flex-start; position: relative; }
.bars .bar span { display: block; border-radius: 5px 5px 2px 2px; min-height: 0; transform-origin: bottom; animation: grow-y .8s var(--ease) backwards; }
.bars .bar:nth-child(odd) span { animation-delay: .08s; }
.bars .bar:nth-child(3n) span { animation-delay: .16s; }
@keyframes grow-y { from { transform: scaleY(0); } }
.bars .bar .seg-submitted { background: linear-gradient(180deg, var(--pink), color-mix(in srgb, var(--violet) 70%, transparent)); transition: filter .2s; }
.bars .bar:hover .seg-submitted { filter: brightness(1.25) drop-shadow(0 0 8px color-mix(in srgb, var(--pink) 60%, transparent)); }
.bars-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-faint); margin-top: 8px; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--text-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 52px 20px; color: var(--text-muted); }
:where(.empty .empty-icon) { --hue: var(--violet); }
.empty .empty-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; color: var(--hue); background: color-mix(in srgb, var(--hue) 14%, var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 30%, transparent), 0 6px 0 -1px color-mix(in srgb, var(--hue) 30%, transparent); transform: rotate(-6deg); animation: float 5s ease-in-out infinite; }
.empty .empty-icon .icon { width: 26px; height: 26px; }
@keyframes float { 50% { transform: translateY(-6px) rotate(3deg); } }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 1.12rem; }
.empty p { max-width: 430px; margin: 0 auto 18px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.is-loading { position: relative; pointer-events: none; opacity: .7; }

/* ---------- Checklist (onboarding) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: ck; }
.checklist li { counter-increment: ck; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); transition: border-color .2s, transform .25s var(--ease); }
.checklist li:not(.is-done):hover { border-color: var(--border-strong); transform: translateX(3px); }
.checklist .tick { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; border: 2px dashed var(--border-strong); flex: none; color: transparent; position: relative; }
.checklist li:not(.is-done) .tick::after { content: counter(ck); position: absolute; color: var(--text-muted); font-weight: 700; font-size: .8rem; }
.checklist li:not(.is-done) .tick svg { display: none; }
.checklist li.is-done .tick { background: var(--green); border: 0; color: #03140c; }
.checklist li.is-done .step-title { color: var(--text-muted); text-decoration: line-through; }
.checklist .step-title { font-weight: 620; }
.checklist .step-body { font-size: .82rem; color: var(--text-muted); }
.progress-ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex: none; }
.progress-ring::after { content: attr(data-label); width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: .78rem; font-weight: 700; font-family: var(--font-display); letter-spacing: -.04em; }

/* ---------- Status checks (bot diagnostics) ---------- */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.checks li:last-child { border-bottom: 0; }
.checks .dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.checks .is-ok .dot { background: var(--green-soft); color: var(--green); }
.checks .is-error .dot { background: var(--red-soft); color: var(--red); }
.checks .is-warning .dot { background: var(--amber-soft); color: var(--amber); }
.checks .fix { margin-top: 6px; font-size: .84rem; padding: 9px 11px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.hierarchy { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.hierarchy li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: .88rem; border-bottom: 1px solid var(--border); }
.hierarchy li:last-child { border-bottom: 0; }
.hierarchy .role-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-faint); flex: none; }
.hierarchy li.is-bot { background: var(--primary-soft); font-weight: 650; }
.hierarchy li.is-problem { background: var(--red-soft); }
.hierarchy li.is-good { background: var(--green-soft); }
.hierarchy .pos { margin-left: auto; font-size: .74rem; color: var(--text-faint); }
.hierarchy .divider { padding: 4px 12px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); background: var(--surface-2); }

/* ---------- Steps (bot setup wizard) ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps > li { counter-increment: step; position: relative; padding: 20px 22px 20px 70px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.steps > li::before { content: counter(step); position: absolute; left: 20px; top: 18px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: .9rem; background: var(--surface-3); color: var(--text-muted); }
.steps > li.is-done::before { content: "✓"; background: var(--green); color: #03140c; }
.steps > li.is-current { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.steps > li.is-current::before { background: var(--primary); color: var(--primary-ink); }
.steps h3 { margin-bottom: 4px; }

/* ---------- Review queue ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .select, .filters .input { width: auto; min-height: 38px; padding-top: 7px; padding-bottom: 7px; font-size: .86rem; }
.filters .input { min-width: 220px; }
.age-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.age-ok { background: var(--green); }
.age-amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.age-red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); animation: dot-pulse 2s infinite; color: var(--red); }
.flag-pill { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: var(--red); padding: 1px 7px; border-radius: 99px; background: var(--red-soft); }
.vote-mini { display: inline-flex; gap: 10px; font-size: .8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.vote-mini .up { color: var(--green); } .vote-mini .down { color: var(--red); }
.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .app-layout { grid-template-columns: minmax(0, 1fr); } }
.app-aside { position: sticky; top: 80px; display: grid; gap: 16px; }
@media (max-width: 1100px) { .app-aside { position: static; } }
.answer { padding: 16px 0; border-bottom: 1px solid var(--border); }
.answer:last-child { border-bottom: 0; }
.answer-label { font-size: .78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; letter-spacing: .01em; }
.answer-value { white-space: pre-wrap; word-wrap: break-word; font-size: .96rem; line-height: 1.6; }
.answer-value.is-empty { color: var(--text-faint); font-style: italic; }
.answer-section { margin: 22px 0 2px; padding: 8px 12px; border-radius: 10px; font-family: var(--font-display); font-weight: 600; font-size: .78rem; letter-spacing: .02em; text-transform: uppercase; color: var(--primary); background: var(--primary-soft); }
:root[data-theme="light"] .answer-section { color: #8a6400; }
.quiz-right { color: var(--green); } .quiz-wrong { color: var(--red); }
.flag { display: flex; gap: 10px; padding: 11px 13px; border-radius: 12px; margin-bottom: 8px; font-size: .87rem; border: 1px solid transparent; }
.flag-danger { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); } .flag-danger .icon { color: var(--red); }
.flag-warning { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 25%, transparent); } .flag-warning .icon { color: var(--amber); }
.flag-info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 25%, transparent); } .flag-info .icon { color: var(--blue); }
.flags .flag:last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: .88rem; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.vote-bar { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.vote-bar .a { background: var(--green); border-radius: 99px; } .vote-bar .d { background: var(--red); border-radius: 99px; }
.vote-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.vote-list li { display: flex; align-items: flex-start; gap: 10px; font-size: .86rem; }
/* Applicant aside: earlier applications, game identifiers, linked (alt) accounts */
.aside-label { font-size: .7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.aside-label.text-red { color: var(--red); }
.history-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.history-list > li { padding-left: 10px; border-left: 2px solid var(--border-strong); display: grid; gap: 3px; }
.history-reason { font-size: .78rem; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.ident-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ident-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ident-list .ident-value { height: auto; padding: 0 4px; }
.icon-xs { width: 12px; height: 12px; flex: none; vertical-align: -1px; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: repeating-linear-gradient(180deg, var(--border-strong) 0 4px, transparent 4px 8px); }
.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 20px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .t-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border-strong); position: relative; z-index: 1; flex: none; color: var(--text-muted); }
.timeline li.is-done .t-dot { background: var(--green); border-color: var(--green); color: #03140c; }
.timeline li.is-current .t-dot { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); animation: dot-pulse 2.2s ease-in-out infinite; }
.timeline li.is-bad .t-dot { background: var(--red); border-color: var(--red); color: #fff; }
.note { padding: 13px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; }
.note-head { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--text-muted); margin-bottom: 5px; }
.note-body { white-space: pre-wrap; font-size: .92rem; }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-muted); }
.presence .live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.decision-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.decision { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }

/* ---------- Modal (native dialog) ---------- */
dialog.modal { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(5, 4, 12, .6); backdrop-filter: blur(5px); }
dialog.modal[open] { animation: modal-in .38s var(--spring); }
dialog[open]::backdrop { animation: fade-in .25s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes fade-in { from { opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 1.08rem; }
.modal-body { padding: 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 11px 18px; align-items: center; font-size: .9rem; }

/* ---------- Form builder ---------- */
.builder { max-width: 780px; margin: 0 auto; display: grid; gap: 14px; }
.builder-note { max-width: 780px; margin-left: auto; margin-right: auto; }
.q-head { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 24px 18px; display: grid; gap: 6px; overflow: hidden; }
.q-head::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--sunset-grad); }
.q-head-title { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; letter-spacing: -.035em; color: var(--text); background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 4px 0; width: 100%; }
.q-head-title:hover { border-bottom-color: var(--border-strong); }
.q-head-title:focus { outline: 0; border-bottom-color: var(--primary); }
.q-head-desc { font: inherit; font-size: .92rem; color: var(--text-muted); background: transparent; border: 0; border-bottom: 1px solid transparent; resize: vertical; min-height: 44px; padding: 4px 0; width: 100%; }
.q-head-desc:hover { border-bottom-color: var(--border-strong); }
.q-head-desc:focus { outline: 0; border-bottom: 2px solid var(--primary); color: var(--text); }
.q-head-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.q-wrap { position: relative; }
.field-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 80px; }
.q-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px 14px; cursor: pointer; transition: border-color .12s, box-shadow .15s, opacity .12s; }
.q-card:hover { border-color: var(--border-strong); }
.q-card.is-selected { cursor: default; border-color: color-mix(in srgb, var(--primary) 45%, var(--border-strong)); box-shadow: inset 4px 0 0 var(--primary), var(--shadow); }
.q-card.is-dragging { opacity: .4; }
.q-card.drop-before { box-shadow: 0 -3px 0 var(--primary); }
.q-card.drop-after { box-shadow: 0 3px 0 var(--primary); }
.q-card.is-section { background: var(--surface-2); border-left: 4px solid var(--violet); }
.q-grip { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); border: 0; background: none; color: var(--text-faint); cursor: grab; padding: 0 12px; opacity: 0; transition: opacity .12s; line-height: 0; rotate: 90deg; }
.q-card:hover .q-grip, .q-card.is-selected .q-grip, .q-grip:focus-visible { opacity: 1; }
.q-grip:active { cursor: grabbing; }
.q-preview { display: grid; gap: 6px; pointer-events: none; }
.q-preview a, .q-preview button { pointer-events: auto; }
.q-title { font-weight: 600; font-size: 1rem; }
.q-req { color: var(--pink); }
.q-section-title { font-size: 1.15rem; margin: 0; }
.q-line { color: var(--text-faint); font-size: .88rem; border-bottom: 1px dotted var(--border-strong); padding: 6px 0; max-width: 60%; }
.q-choice { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--text-muted); }
.q-bullet { width: 15px; height: 15px; border: 2px solid var(--border-strong); border-radius: 50%; flex: none; display: inline-block; }
.q-bullet.is-square { border-radius: 4px; }
.q-bullet.is-correct { border-color: var(--green); background: var(--green); }
.q-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: .74rem; color: var(--text-faint); }
.q-edit { display: grid; gap: 12px; }
.q-top { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 10px; align-items: stretch; }
.q-top .q-label, .q-top .q-type { height: 46px; min-height: 46px; margin: 0; box-sizing: border-box; }
.q-edit .q-label { font-size: 1.02rem; font-weight: 600; background: var(--surface-2); border-radius: 12px 12px 0 0; border: 0; border-bottom: 2px solid var(--border-strong); min-height: 46px; }
.q-edit .q-label:focus { border-bottom-color: var(--primary); outline: 0; box-shadow: none; }
.q-edit .q-help { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding-left: 0; }
.q-edit .q-help:focus { border-bottom-color: var(--primary); box-shadow: none; outline: 0; }
.q-choices { display: grid; gap: 4px; }
.choice-row { display: flex; gap: 8px; align-items: center; margin-bottom: 0; }
.choice-row input[type=radio] { accent-color: var(--green); width: 16px; height: 16px; flex: none; }
.choice-row .input { background: transparent; border-color: transparent; border-bottom: 1px solid var(--border); border-radius: 0; }
.choice-row .input:hover { border-bottom-color: var(--border-strong); }
.choice-row .input:focus { border-bottom-color: var(--primary); box-shadow: none; }
.q-add-choice { justify-self: start; color: var(--text-muted); }
.q-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; flex-wrap: wrap; }
.q-foot-sep { width: 1px; height: 22px; background: var(--border); margin: 0 8px; }
.q-more-btn { margin-left: auto; color: var(--text-muted); }
.q-more { display: grid; gap: 12px; border-top: 1px dashed var(--border); padding-top: 12px; }
.q-logic .label { margin-bottom: 8px; }
.builder-rail { position: absolute; right: -60px; top: 0; display: grid; gap: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: top .15s var(--ease); z-index: 2; }
.builder-rail.is-static { position: static; display: flex; justify-content: center; margin-top: 12px; }
.rail-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; color: var(--text-muted); border-radius: 10px; cursor: pointer; }
.rail-btn:hover { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 1000px) { .builder-rail { position: static; display: flex; justify-content: center; margin-top: 12px; right: auto; } }
@media (max-width: 620px) { .q-top { grid-template-columns: 1fr; } .q-card { padding: 16px 14px 12px; } .q-line { max-width: 100%; } }
.preview-frame { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 24px; background: var(--bg); }

/* ---------- Upgrade prompt / locks ---------- */
.upgrade { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border)); background: linear-gradient(100deg, var(--primary-soft), transparent 70%), var(--surface); flex-wrap: wrap; }
.upgrade .icon-lg { color: var(--primary); }
.locked { position: relative; }
.locked-overlay { padding: 44px 20px; text-align: center; }
.needs-bot { position: relative; }
.needs-bot .needs-bot-body { opacity: .35; filter: grayscale(1); pointer-events: none; user-select: none; }
.needs-bot-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; text-align: center; padding: 1rem; }
.needs-bot-overlay p { margin: 0; max-width: 34rem; }

/* ---------- Departments ---------- */
.dept-logo { color: var(--dept, var(--violet)); }
.dept-logo-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.2rem; }
.dept-card { border-top: 4px solid var(--dept, var(--border)); }
.dept-head, .dept-public { --dept: var(--violet); position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; }
.dept-banner { position: relative; height: 80px; background: linear-gradient(120deg, var(--dept) 0%, color-mix(in srgb, var(--dept) 40%, var(--bg-deep)) 100%); background-size: cover; background-position: center; }
.dept-banner.has-image { background-image: var(--dept-banner); height: 120px; background-size: var(--banner-size, cover); background-position: var(--banner-pos, center); background-repeat: no-repeat; background-color: var(--surface-2); }
.dept-banner:not(.has-image)::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 12px); }
.dept-head-body { display: flex; gap: 14px; align-items: flex-end; padding: 0 22px 18px; margin-top: -26px; flex-wrap: wrap; position: relative; }
.dept-head-body .community-logo, .dept-head-body .monogram { border: 3px solid var(--surface); background: var(--surface-2); }
.dept-head-body h1 { font-size: 1.5rem; }
.dept-public .card-body { padding-top: 0; }
.list-row { padding: 12px 0; gap: 12px; flex-wrap: wrap; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.card > .list-row { padding: 14px 22px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.perm-grid .is-locked { color: var(--text-faint); }
.role-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: grid; gap: 2px; }
.role-list .check-plain { padding: 4px 6px; }
@media (max-width: 620px) { .dept-head-body { padding: 0 14px 14px; } .dept-head-body .btn { width: 100%; } }

/* ---------- Role picker chips, ranks, department settings ---------- */
.role-picker .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.role-picker .chips:empty { display: none; }
.role-picker select { max-width: 320px; }
.chip .chip-label { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.chip.is-locked { opacity: .7; }
.chip-x { border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; border-radius: 50%; }
.chip-x:hover { color: var(--red); }
.option-row + .option-row { margin-top: 14px; }
.option-row p { margin: 4px 0 0 52px; }
.admin-settings { padding: 0; }
.settings-block { padding: 20px 22px; border-top: 1px solid var(--border); }
.settings-block h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: 14px; font-weight: 700; }
.settings-block .field:last-child { margin-bottom: 0; }
.rank-list { display: grid; gap: 10px; }
.rank-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .12s, box-shadow .12s, opacity .12s; }
.rank-item:hover { border-color: var(--border-strong); }
.rank-item.is-open { border-color: var(--border-strong); box-shadow: var(--shadow); }
.rank-item.is-dragging { opacity: .45; border-color: var(--primary); }
.rank-item.is-head { box-shadow: inset 4px 0 0 var(--primary); }
.rank-top { display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 4px; }
.rank-grip { display: grid; place-items: center; width: 34px; height: 40px; border: 0; background: none; color: var(--text-faint); border-radius: 9px; flex: none; }
button.rank-grip { cursor: grab; }
button.rank-grip:hover { color: var(--text); background: var(--surface-2); }
button.rank-grip:active { cursor: grabbing; }
.rank-grip.is-off { color: var(--text-faint); opacity: .7; }
.rank-summary { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 8px 6px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 9px; }
.rank-name { font-weight: 650; font-size: 1rem; }
.rank-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.rank-meta .icon-sm { vertical-align: -2px; }
.rank-chev { color: var(--text-faint); transition: transform .15s; display: grid; }
.rank-summary[aria-expanded="true"] .rank-chev { transform: rotate(90deg); }
.rank-move { display: inline-flex; flex: none; }
.rank-body { padding: 16px 20px 18px; border-top: 1px solid var(--border); }
.rank-body[hidden] { display: none; }
.perm-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); margin: 16px 0 8px; font-weight: 700; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.perm-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface-2); transition: border-color .15s; }
.perm-row:hover { border-color: var(--border-strong); }
.perm-row:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.perm-row .switch { flex: none; margin-top: 1px; }
.perm-row .perm-hint { display: block; }
.perm-row.is-locked { opacity: .6; }
.rank-new > summary { list-style: none; cursor: pointer; border-style: dashed; }
.rank-new > summary::-webkit-details-marker { display: none; }
@media (max-width: 620px) { .rank-meta { display: none; } .rank-body { padding: 14px; } }
.placeholders { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholders .chip { cursor: pointer; font-family: var(--font-mono); font-size: .78rem; }
.placeholders .chip:hover { border-color: var(--primary); color: var(--text); }
.msg-block { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }

/* Staff drag handle on the public applications page */
.form-grip { display: grid; place-items: center; width: 30px; height: 40px; border: 0; background: none; color: var(--text-faint); border-radius: 9px; flex: none; cursor: grab; margin: -4px 0 0 -8px; }
.form-grip:hover { color: var(--text); background: var(--surface-2); }
.form-grip:active { cursor: grabbing; }
.form-tile.is-dragging { opacity: .45; border-color: var(--primary); }

/* Categories pop-out */
.cat-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.cat-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .12s, opacity .12s; }
.cat-item:hover, .cat-item.is-open { border-color: var(--border-strong); }
.cat-item.is-dragging { opacity: .45; border-color: var(--primary); }
.cat-top { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; }
.cat-toggle { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; color: inherit; text-align: left; padding: 10px 6px; border-radius: 9px; cursor: pointer; font: inherit; }
.cat-toggle strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-toggle .icon-sm { transition: transform .15s; color: var(--text-faint); }
.cat-toggle[aria-expanded="true"] .icon-sm { transform: rotate(180deg); }
/* Height animates via grid rows (0fr → 1fr); visibility keeps the closed fields out of the tab order. */
.cat-body { display: grid; grid-template-rows: 0fr; visibility: hidden; opacity: 0; border-top: 1px solid transparent; transition: grid-template-rows .28s var(--ease), opacity .2s var(--ease), border-color .2s, visibility 0s .28s; }
.cat-body-inner { overflow: hidden; min-height: 0; padding: 0 14px; }
.cat-body-inner > form { padding: 14px 0; }
.cat-item.is-open .cat-body { grid-template-rows: 1fr; visibility: visible; opacity: 1; border-top-color: var(--border); transition-delay: 0s; }
@media (prefers-reduced-motion: reduce) { .cat-body, .cat-toggle .icon-sm { transition: none; } }
.cat-add { padding-top: 14px; border-top: 1px solid var(--border); }
.cat-add-row { display: flex; align-items: stretch; gap: 8px; }
.cat-add-row .input { flex: 1; min-width: 0; }
.cat-add-row .btn { flex: none; }
.cat-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--surface-2); color: var(--primary); }
.cat-icon .icon { width: 16px; height: 16px; }
/* Category icon picker: a grid of radio tiles (the input stays focusable, just invisible). */
.icon-picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.icon-picker legend { padding: 0; margin-bottom: 6px; font-size: .85rem; font-weight: 600; }
.cat-add .icon-picker { margin-top: 12px; }
.icon-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.icon-pick { position: relative; display: block; }
.icon-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.icon-pick > span { display: grid; place-items: center; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); transition: border-color .12s, color .12s, background .12s; pointer-events: none; }
.icon-pick:hover > span { border-color: var(--border-strong); color: var(--text); }
.icon-pick input:checked + span { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.icon-pick input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Clamped form description → opens full overview dialog when truncated */
.form-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-align: left; background: none; border: 0; padding: 0; margin-bottom: 0; font: inherit; font-size: .875rem; color: var(--text-muted); cursor: default; max-width: 100%; white-space: pre-line; }
.form-desc.is-clamped { cursor: pointer; }
.form-desc.is-clamped:hover { color: var(--text); }
.form-desc.is-clamped:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Form description formatting */
.fmt-bar { display: flex; flex-wrap: wrap; gap: 2px; margin: 4px 0 2px; }
.rich-text p { margin: 0 0 .5rem; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul { margin: 0 0 .6rem; padding-left: 1.25rem; }
.rich-text .rt-h { font-weight: 700; margin-top: .5rem; }
.rich-text .rt-h1 { font-size: 1.3rem; }
.rich-text .rt-h2 { font-size: 1.1rem; }
.rich-text .rt-h3 { font-size: 1rem; }
.rich-text a { color: var(--accent, var(--link)); text-decoration: underline; }
.form-list.is-sortable { min-height: 56px; padding: 4px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.form-list.is-sortable:empty::before { content: 'Drop forms here'; display: block; color: var(--text-faint); font-size: .85rem; text-align: center; padding: 14px; }
.form-category { margin-bottom: 24px; }

/* Form tiles (staff Forms page, My applications) */
.form-tile { --hue: var(--accent, var(--primary)); display: flex; gap: 14px; align-items: flex-start; padding: 18px; }
.form-tile.has-banner { flex-wrap: wrap; overflow: hidden; }
.form-tile .tile-banner { flex: 0 0 100%; height: 90px; margin: -18px -18px 4px; width: calc(100% + 36px); max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background-size: var(--banner-size, cover); background-position: var(--banner-pos, center); background-repeat: no-repeat; background-color: var(--surface-2); }
.form-tile .tile-divider { height: 2px; width: 100%; margin: 10px 0 2px; border-radius: 2px; background: linear-gradient(90deg, var(--hue) 0, color-mix(in srgb, var(--hue) 25%, transparent) 45%, transparent 100%); }
.form-tile .tile-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.form-tile .tile-logo { width: 48px; height: 48px; border-radius: 0; flex: none; }
.form-tile .tile-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--hue) 15%, transparent); color: var(--hue); flex: none; transition: transform .4s var(--spring); }
.form-tile:hover .tile-icon { transform: rotate(-8deg) scale(1.06); }

/* Preview banner: full-width, stays at the top while scrolling. */
.preview-bar { position: sticky; top: 0; z-index: 50; background: repeating-linear-gradient(-45deg, var(--primary) 0 18px, #f7cc2a 18px 36px); color: var(--primary-ink); box-shadow: 0 2px 12px rgba(0, 0, 0, .3); }
.preview-bar-inner { position: relative; width: 100%; max-width: 780px; box-sizing: border-box; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; justify-content: center; text-align: center; gap: 12px; flex-wrap: wrap; font-size: .9rem; min-height: 48px; }
.preview-bar-inner .btn { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); }
@media (max-width: 720px) { .preview-bar-inner { padding-right: 20px; } .preview-bar-inner .btn { position: static; transform: none; } }
.preview-bar .btn { --btn-bg: rgba(0, 0, 0, .18); --btn-fg: var(--primary-ink); --btn-border: rgba(0, 0, 0, .25); --btn-edge: rgba(0, 0, 0, .3); }
.preview-bar .btn:hover { background: rgba(0, 0, 0, .28); border-color: rgba(0, 0, 0, .4); }

/* ---------- Overview (dashboard home) ---------- */
.welcome { position: relative; overflow: hidden; padding: 28px; margin-bottom: 20px; border-radius: var(--radius-xl); border: 1px solid var(--border); background:
  radial-gradient(500px 260px at 100% 0%, color-mix(in srgb, var(--pink) 22%, transparent), transparent 65%),
  radial-gradient(420px 260px at 70% 120%, color-mix(in srgb, var(--violet) 25%, transparent), transparent 65%),
  radial-gradient(400px 240px at 0% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 65%),
  var(--surface); }
.welcome::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(var(--dots) 1px, transparent 1.2px); background-size: 18px 18px; mask-image: linear-gradient(90deg, transparent, #000); -webkit-mask-image: linear-gradient(90deg, transparent, #000); }
.welcome > * { position: relative; z-index: 1; }
.welcome-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.welcome .eyebrow-sm { font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.welcome h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: 8px; }
.welcome p { color: var(--text-muted); margin: 0 0 18px; max-width: 520px; }
.welcome-count { text-align: center; padding: 18px 26px; border-radius: 22px; background: color-mix(in srgb, var(--bg-deep) 70%, transparent); border: 1px solid var(--border); min-width: 170px; }
.welcome-count strong { display: block; font-family: var(--font-display); font-size: 3.4rem; font-weight: 800; letter-spacing: -.06em; line-height: 1; background: var(--sunset-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.welcome-count span { display: block; margin-top: 6px; font-size: .8rem; color: var(--text-muted); font-weight: 600; }
@media (max-width: 720px) { .welcome { padding: 22px; } .welcome-grid { grid-template-columns: 1fr; } .welcome-count { display: none; } }
.app-row { display: flex; align-items: center; gap: 12px; padding: 12px 22px; color: inherit; text-decoration: none !important; border-top: 1px solid var(--border); transition: background .12s; }
.app-row:first-child { border-top: 0; }
.app-row:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.app-row:hover .app-row-go { transform: translateX(3px); color: var(--text); }
.app-row-name { font-weight: 620; }
.app-row-go { color: var(--text-faint); transition: transform .2s var(--ease), color .2s; }
.interview-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.interview-row:first-child { border-top: 0; padding-top: 0; }
.date-chip { width: 46px; flex: none; text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); font-weight: 700; line-height: 1.1; }
.date-chip span { display: block; background: var(--cyan); color: #04212a; font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; padding: 2px 0; }
.date-chip b { display: block; font-family: var(--font-display); font-size: 1.05rem; padding: 4px 0 5px; letter-spacing: -.04em; }

/* ---------- Platform team: support-session bar + staff console (/staff) ---------- */
.platform-bar { --hue: var(--cyan); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 18px; border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--hue) 55%, var(--border)); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--hue) 9%, var(--surface)) 0 12px, var(--surface) 12px 24px); font-size: .88rem; }
.platform-bar > .icon-sm { color: var(--hue); }
.ops-shell .sidebar { --ops-stripe: var(--cyan); box-shadow: inset 3px 0 0 var(--ops-stripe); }
.ops-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #04212a; background: var(--cyan); }
.ops-search { display: flex; gap: 8px; }
.ops-search .input { flex: 1; }
.ops-result { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.ops-result:first-child { border-top: 0; }
.ops-result:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.ops-kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 16px; font-size: .88rem; margin: 0; }
.ops-kv dt { color: var(--text-muted); }
.ops-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ops-level { --hue: var(--slate); }
.ops-level-warn { --hue: var(--amber); } .ops-level-restrict, .ops-level-suspend { --hue: var(--red); }
.ops-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-family: var(--font-mono); font-size: 1rem; letter-spacing: .06em; }
.ops-codes span { padding: 8px 10px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--border); text-align: center; }
.ticket-msg.is-staff { --hue: var(--cyan); box-shadow: inset 3px 0 0 var(--hue); }
.ticket-msg.is-internal { --hue: var(--amber); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--amber) 6%, var(--surface)) 0 12px, var(--surface) 12px 24px); }
.ticket-shot img { display: block; width: 140px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.ops-diag { font-family: var(--font-mono); font-size: .78rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); max-height: 260px; overflow: auto; }
.ops-secret { font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: .12em; word-break: break-all; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .site-header, .site-footer, .app-aside .decision-bar { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Phone: trim secondary table columns */
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .table td, .table th { padding: 11px 10px; }
  .page-head { margin-bottom: 18px; }
  .filters .input, .filters .select { flex: 1 1 140px; min-width: 0; }
  .tabs { width: 100%; }
}
