/* ============================================================================
   SCRP design system
   One dark base, white as the primary action colour, SCRP cyan as a restrained
   brand accent, a small set of status colours, one typeface, hairline panels.
   Every page inherits these tokens and components, which is what keeps the
   site reading as one product instead of a set of templates.

   Legacy token names (--bg2, --accent, --gold ...) are kept and re-pointed at
   this palette so older markup upgrades without edits.
   ========================================================================== */

:root {
  /* Native controls (select popups, pickers, scrollbars) render dark. */
  color-scheme: dark;

  /* ---- Canvas ---- */
  --bg:            #08080B;
  --bg-elev:       #0d0d11;
  --panel:         rgba(255,255,255,0.028);   /* base panel fill            */
  --panel-2:       rgba(255,255,255,0.05);    /* raised panel / input       */
  --panel-3:       rgba(255,255,255,0.08);    /* hover / pressed            */
  --bg2:           rgba(255,255,255,0.028);
  --bg3:           rgba(255,255,255,0.05);
  --bg4:           rgba(255,255,255,0.08);
  --glass:         rgba(255,255,255,0.04);
  --glass-2:       rgba(255,255,255,0.07);

  /* ---- Hairlines ---- */
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --hairline:      rgba(255,255,255,0.08);

  /* ---- Primary action = white (from the reference) ---- */
  --primary:       #F4F4F6;
  --primary-hover: #ffffff;
  --primary-ink:   #0b0b0e;

  /* ---- Brand accent = SCRP cyan, used sparingly ---- */
  --brand:         #1EE6FD;
  --brand-soft:    rgba(30,230,253,0.14);
  --brand-line:    rgba(30,230,253,0.30);

  /* ---- Status colours (muted) ---- */
  --accent:        #F4F4F6;   --accent-hover: #ffffff;   /* legacy alias -> white */
  --blue:          #3B82F6;
  --red:           #FF453A;
  --green:         #32D74B;
  --gold:          #FFD60A;   --yellow: #FFD60A;
  --orange:        #FF9F0A;
  --purple:        #BF5AF2;
  --indigo:        #5E5CE6;
  --teal:          #40C8E0;
  --pink:          #FF375F;

  /* Tinted text that clears 4.5:1 on the dark base */
  --blue-text:   #6ba5f5;
  --red-text:    #ff7a70;
  --green-text:  #4fd869;
  --amber-text:  #ffb340;
  --purple-text: #cf95f5;
  --gold-text:   #ffd54a;

  /* ---- Text ---- */
  --text:          #F5F5F7;
  --text-soft:     rgba(235,235,240,0.78);
  --text-dim:      rgba(235,235,240,0.56);
  --text-dim2:     rgba(235,235,240,0.34);
  --text-muted:    rgba(235,235,240,0.56);

  /* ---- Type ---- */
  --sf:      'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --sf-mono: ui-monospace, 'SF Mono', 'IBM Plex Mono', 'Menlo', monospace;
  --font:      var(--sf);
  --font-body: var(--sf);
  --font-display: var(--sf);

  /* ---- Radii (subtle, per the reference) ---- */
  --r-xs:  8px;
  --r-sm:  10px;
  --r:     13px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 26px;
  --r-pill: 980px;

  /* ---- Spacing scale ---- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-24: 96px;

  /* ---- Elevation (soft, no glow) ---- */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 12px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 30px 70px rgba(0,0,0,0.55);
  --inset-hi:  inset 0 1px 0 rgba(255,255,255,0.05);

  /* ---- Motion ---- */
  --ease:     cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.22, .9, .3, 1);
  --spring:   cubic-bezier(.34, 1.4, .5, 1);
  --island:   cubic-bezier(.5, 0, .2, 1);
  --t-fast: .16s;
  --t-base: .24s;
  --t-slow: .4s;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(30,230,253,0.30); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); background-clip: content-box; }

a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
strong, b { font-weight: 650; }
h1, h2, h3, h4 { font-family: var(--font); letter-spacing: -0.025em; line-height: 1.12; text-wrap: balance; }
p { text-wrap: pretty; }

/* Focus ring: neutral to match the monochrome system, always visible */
:focus-visible { outline: 2px solid rgba(255,255,255,0.65); outline-offset: 3px; border-radius: 6px; }

/* ============================ PAGE TRANSITION ============================ */
html.js body { opacity: 0; }
html.js body.is-ready { opacity: 1; transition: opacity .35s var(--ease); }
html.js body.is-leaving { opacity: 0; transition: opacity .14s var(--ease); }

/* ============================ ICONS ============================
   Stroke-icon sprite lives in base.html. Reference with
   <svg class="ic"><use href="#i-name"/></svg>. Icons size to 1em.
   ================================================================ */
.ic {
  width: 1em; height: 1em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.125em; display: inline-block;
}
.ic-fill { fill: currentColor; stroke: none; }
.ic-sm { width: .85em; height: .85em; }
.ic-lg { width: 1.25em; height: 1.25em; }

/* Tinted square behind an icon (used for section/stat markers). Neutral by
   default so colour stays rare. */
.ic-tile {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 11px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); font-size: 17px;
}
.ic-tile.is-red    { background: rgba(255,59,48,.12);  border-color: rgba(255,59,48,.24);  color: var(--red-text); }
.ic-tile.is-green  { background: rgba(50,215,75,.12);  border-color: rgba(50,215,75,.24);  color: var(--green-text); }
.ic-tile.is-blue   { background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.28); color: var(--blue-text); }
.ic-tile.is-amber  { background: rgba(255,159,10,.12); border-color: rgba(255,159,10,.26); color: var(--amber-text); }
.ic-tile.is-purple { background: rgba(191,90,242,.12); border-color: rgba(191,90,242,.26); color: var(--purple-text); }
.ic-tile.is-gold   { background: rgba(255,214,10,.11); border-color: rgba(255,214,10,.24); color: var(--gold-text); }
.ic-tile.is-sm     { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
.ic-tile.is-lg     { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
.ic-tile.is-xl     { width: 70px; height: 70px; border-radius: 20px; font-size: 30px; }

/* Circular icon button, the arrow-in-a-ring from the reference panels */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-strong);
  color: var(--text); text-decoration: none;
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.icon-btn .ic { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); transform: translateY(-1px); }

/* ============================ LAYOUT ============================ */
.main-content { max-width: 1200px; margin: 0 auto; padding: 48px 32px; }

/* ============================ PAGE HEADER ============================ */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 32px; gap: 20px; flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font); font-size: 27px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--text); line-height: 1.15;
  display: flex; align-items: center; gap: 12px;
}
.page-header .sub, .page-header .subtitle, .page-header p {
  color: var(--text-dim); font-size: 14.5px; margin-top: 6px; max-width: 640px; line-height: 1.6;
}

/* Eyebrow: quiet uppercase label, not a coloured pill */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-family: var(--font); font-size: 11.5px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); flex-shrink: 0;
}
.eyebrow.is-neutral::before { background: var(--text-dim2); }
.eyebrow.is-blue::before    { background: var(--blue); }
.eyebrow.is-green::before   { background: var(--green); }
.eyebrow .ic { display: none; }   /* legacy inline icons in eyebrows are dropped for cleanliness */

/* ============================ SECTIONS ============================ */
.section { margin-bottom: 40px; }
.section h2 {
  font-family: var(--font); font-size: 18px; font-weight: 650;
  letter-spacing: -0.02em; margin-bottom: 18px;
}

/* ============================ PANEL / CARD ============================
   The reference's floating dark panel: hairline border, near-flat fill,
   subtle radius. This is the site's primary container.
   ==================================================================== */
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.panel-hover, .card-hover {
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.panel-hover:hover, .card-hover:hover {
  border-color: var(--border-strong); background: var(--panel-2); transform: translateY(-2px);
}
.card-title {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
/* Reference panel label + value pairing */
.panel-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-dim); }
.panel-value { font-family: var(--font); font-size: 21px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
/* Thin progress meter (the reference's 96% bar) */
.meter { height: 3px; border-radius: 100px; background: rgba(255,255,255,0.1); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 100px; background: var(--text); }

/* ============================ STAT CARDS ============================ */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 40px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 22px 20px; text-align: left;
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 16px;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); background: var(--panel-2); }
.stat-card.danger  { border-color: rgba(255,69,58,.24); }
.stat-card.warning { border-color: rgba(255,159,10,.24); }
.stat-card.gold    { border-color: rgba(255,214,10,.22); }
.stat-card.red     { border-color: rgba(255,69,58,.3); }
.stat-icon {
  width: 36px; height: 36px; border-radius: 10px; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-soft);
}
.stat-card.danger .stat-icon, .stat-card.red .stat-icon { background: rgba(255,69,58,.12); border-color: rgba(255,69,58,.24); color: var(--red-text); }
.stat-card.warning .stat-icon { background: rgba(255,159,10,.12); border-color: rgba(255,159,10,.26); color: var(--amber-text); }
.stat-card.gold .stat-icon    { background: rgba(255,214,10,.11); border-color: rgba(255,214,10,.24); color: var(--gold-text); }
.stat-value { font-family: var(--font); font-size: 32px; font-weight: 750; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-dim); font-size: 12px; margin-top: 6px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* ============================ TABLES ============================ */
.log-table-wrap {
  overflow-x: auto; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--panel);
}
.log-table { width: 100%; border-collapse: collapse; background: transparent; }
.log-table thead { background: rgba(255,255,255,0.02); }
.log-table th {
  text-align: left; padding: 13px 18px;
  font-family: var(--font); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.log-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.log-table tbody tr { transition: background .12s var(--ease); }
.log-table tbody tr:last-child td { border-bottom: none; }
.log-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.detail-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--text-dim); padding: 40px !important; }

/* ============================ EMPTY STATE ============================ */
.empty-state {
  text-align: center; padding: 64px 24px; border-radius: var(--r-xl);
  border: 1px solid var(--border); background: var(--panel);
}
.empty-state .ic-tile { margin: 0 auto 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.empty-state p { color: var(--text-dim); font-size: 14px; max-width: 440px; margin: 0 auto; line-height: 1.6; }

/* ============================ BADGES ============================
   Quiet status markers only. Flat tint, hairline, no glow. Colour never
   the sole signal (label text, optional dot). Sentence case, not shouty.
   ================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; min-width: 0;
  padding: 3px 9px; border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  line-height: 1.4; white-space: nowrap;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: middle;
}
.badge .ic { width: 12px; height: 12px; }
.badge > .badge-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: currentColor; }
.badge-sm { padding: 2px 8px; font-size: 10.5px; }
.badge-lg { padding: 5px 12px; font-size: 12.5px; }

.badge-ok, .badge-approved, .badge-verification, .badge-green, .badge-resolved {
  background: rgba(50,215,75,.12); border-color: rgba(50,215,75,.26); color: var(--green-text);
}
.badge-danger, .badge-punishment-applied, .badge-blacklist-add, .badge-red, .badge-denied, .badge-punished {
  background: rgba(255,69,58,.12); border-color: rgba(255,69,58,.26); color: var(--red-text);
}
.badge-warning, .badge-pending, .badge-warning-issued, .badge-amber {
  background: rgba(255,159,10,.12); border-color: rgba(255,159,10,.26); color: var(--amber-text);
}
.badge-gold, .badge-appeal-submitted {
  background: rgba(255,214,10,.11); border-color: rgba(255,214,10,.24); color: var(--gold-text);
}
.badge-blue, .badge-info, .badge-login, .badge-application {
  background: rgba(59,130,246,.13); border-color: rgba(59,130,246,.28); color: var(--blue-text);
}
.badge-purple, .badge-config {
  background: rgba(191,90,242,.12); border-color: rgba(191,90,242,.26); color: var(--purple-text);
}
.badge-live .badge-dot { animation: badgePulse 2.4s var(--ease) infinite; }
@keyframes badgePulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* .pill: quiet metadata chip. Transparent, hairline, sentence case. */
.pill {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 5px 12px; border-radius: var(--r-pill);
  font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: .005em;
  color: var(--text-soft);
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.pill .ic { width: 13px; height: 13px; opacity: .85; }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.is-red    { color: var(--red-text);    border-color: rgba(255,59,48,.26); }
.pill.is-green  { color: var(--green-text);  border-color: rgba(50,215,75,.26); }
.pill.is-blue   { color: var(--blue-text);   border-color: rgba(59,130,246,.3); }
.pill.is-amber  { color: var(--amber-text);  border-color: rgba(255,159,10,.26); }
.pill.is-gold   { color: var(--gold-text);   border-color: rgba(255,214,10,.24); }
.pill.is-purple { color: var(--purple-text); border-color: rgba(191,90,242,.26); }
.pill.is-quiet  { color: var(--text-dim); }
.pill.is-caps   { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 4px 11px; }
a.pill:hover, button.pill:hover { border-color: var(--border-strong); transform: translateY(-1px); }

/* ============================ BUTTONS ============================
   Primary = white. Secondary = ghost. Colour reserved for destructive
   (red) and confirm (green). No gradients, no glow.
   ================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  letter-spacing: -0.005em; cursor: pointer; border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  text-decoration: none; white-space: nowrap; user-select: none;
}
.btn .ic { width: 15px; height: 15px; }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }

/* Primary (white) covers every legacy primary class */
.btn-primary, .btn-cta, .btn-brand, .btn-primary-red {
  background: var(--primary); color: var(--primary-ink); border-color: var(--primary);
}
.btn-primary:hover, .btn-cta:hover, .btn-brand:hover, .btn-primary-red:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* Secondary (ghost) */
.btn-outline, .btn-ghost {
  background: rgba(255,255,255,0.04); color: var(--text); border-color: var(--border-strong);
}
.btn-outline:hover, .btn-ghost:hover { background: rgba(255,255,255,0.09); border-color: var(--border-strong); transform: translateY(-1px); }

.btn-danger  { background: transparent; color: var(--red-text); border-color: rgba(255,69,58,.4); }
.btn-danger:hover { background: rgba(255,69,58,.14); border-color: rgba(255,69,58,.6); transform: translateY(-1px); }
.btn-ok      { background: rgba(50,215,75,.16); color: var(--green-text); border-color: rgba(50,215,75,.4); }
.btn-ok:hover { background: rgba(50,215,75,.24); transform: translateY(-1px); }

.btn-sm      { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg      { min-height: 48px; padding: 0 26px; font-size: 15px; }
.btn-icon    { width: 40px; padding: 0; border-radius: 50%; }

/* ============================ FORMS ============================ */
.input, .form-input, .form-select, .form-textarea {
  display: block; width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  padding: 11px 14px; font-size: 15px;
  font-family: var(--font-body);
  outline: none; transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}
.input { margin-bottom: 12px; }
.input::placeholder, .form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim2); }
.input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-strong); background: var(--panel-3); box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}
.input.is-invalid, .form-input.is-invalid { border-color: rgba(255,69,58,.55); box-shadow: 0 0 0 3px rgba(255,69,58,.12); }
.input-sm { max-width: 280px; display: inline-block; width: auto; }
/* Option lists are painted by the OS; without this they come up white with
   our light text on top, which is unreadable. */
select option, .form-select option, select optgroup {
  background-color: #141418; color: #F5F5F7;
}
select.input, .form-select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-label, .field-label {
  display: block; font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 7px; letter-spacing: .01em;
}
.form-help { font-size: 12.5px; color: var(--text-dim2); margin-top: 7px; line-height: 1.5; }
.form-error { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--red-text); line-height: 1.5; }
.form-error .ic { margin-top: 2px; }
.form-feedback { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin-top: 12px; min-height: 20px; }
.form-feedback.error   { color: var(--red-text); }
.form-feedback.success { color: var(--green-text); }

/* ============================ NOTICES ============================ */
.notice {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 14px; line-height: 1.6;
}
.notice strong { color: var(--text); }
.notice .ic-tile { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
.notice.is-success { background: rgba(50,215,75,.07);  border-color: rgba(50,215,75,.24); }
.notice.is-error   { background: rgba(255,69,58,.07);  border-color: rgba(255,69,58,.26); }
.notice.is-warning { background: rgba(255,159,10,.07); border-color: rgba(255,159,10,.26); }
.notice.is-info    { background: rgba(59,130,246,.07); border-color: rgba(59,130,246,.26); }

/* ============================ GROUPED SETTINGS ============================ */
.settings-section { max-width: 720px; }
.settings-group {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px; margin-bottom: 18px;
}
.settings-group h3 {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 18px;
}
.form-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.form-row:last-child { margin-bottom: 0; }
.form-row label { min-width: 200px; font-size: 14px; font-weight: 500; }
.hint { color: var(--text-dim); font-size: 13px; }
.save-feedback { color: var(--green-text); font-size: 13px; margin-left: 12px; font-weight: 600; }

/* ============================ TOGGLE ============================ */
.ios-switch { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; }
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-switch .track {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(255,255,255,0.14); border-radius: var(--r-pill);
  transition: background .28s var(--ease);
}
.ios-switch .track::before {
  content: ''; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform .28s var(--spring);
}
.ios-switch input:checked + .track { background: var(--green); }
.ios-switch input:checked + .track::before { transform: translateX(18px); }
.ios-switch input:focus-visible + .track { outline: 2px solid rgba(255,255,255,0.65); outline-offset: 3px; }

/* ============================ SEGMENTED CONTROL ============================ */
.seg {
  display: inline-flex; background: rgba(255,255,255,0.04);
  border-radius: var(--r); padding: 3px; gap: 2px; border: 1px solid var(--border);
}
.seg button, .seg label {
  border: none; background: transparent; color: var(--text-dim);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px 15px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .2s var(--ease), background .22s var(--ease);
}
.seg button.active, .seg label.active, .seg input:checked + label, .seg button[aria-selected="true"] {
  background: rgba(255,255,255,0.1); color: var(--text);
}

/* ============================ MODALS ============================ */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; animation: modalFade .2s var(--ease); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #141418;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 28px; min-width: 400px; max-width: 95vw;
  box-shadow: var(--shadow-lg);
  animation: modalPop .28s var(--ease-out);
}
@keyframes modalPop { from { opacity: 0; transform: scale(.97) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-lg { min-width: 600px; max-height: 82vh; overflow-y: auto; }
.modal h2 { font-family: var(--font); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 20px; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ============================ GUILD LIST ============================ */
.guild-list { display: flex; flex-direction: column; gap: 6px; }
.guild-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r); background: var(--panel-2); transition: background .15s var(--ease); }
.guild-item:hover { background: var(--panel-3); }
.guild-item.guild-blacklisted { background: rgba(255,69,58,.1); border: 1px solid rgba(255,69,58,.26); }
.guild-name { flex: 1; font-size: 14px; }
.guild-id { font-size: 12px; }
.guild-icon { display: inline-flex; color: var(--green-text); }
.guild-blacklisted .guild-icon { color: var(--red-text); }

/* ============================ HERO (generic) ============================ */
.hero { text-align: center; padding: 90px 20px; }
.hero h1 { font-family: var(--font); font-size: clamp(36px, 5vw, 52px); font-weight: 750; letter-spacing: -0.04em; margin-bottom: 16px; }
.hero p { color: var(--text-dim); font-size: 16px; max-width: 520px; margin: 0 auto 32px; line-height: 1.6; }

/* ============================ UTILITIES ============================ */
.mono { font-family: var(--sf-mono); font-size: 13px; }
.dim { color: var(--text-dim); }
.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; }
.stack-4 > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }

.reveal { opacity: 0; transform: translateY(12px); animation: revealUp .6s var(--ease-out) forwards; }
@keyframes revealUp { to { opacity: 1; transform: none; } }

/* ============================ SCROLL REVEAL ============================ */
html.js [data-reveal] {
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  will-change: opacity, transform;
}
html.js [data-reveal="left"]  { transform: translateX(-16px); }
html.js [data-reveal="right"] { transform: translateX(16px); }
html.js [data-reveal="scale"] { transform: scale(.98); }
html.js [data-reveal].is-revealed { opacity: 1; transform: none; will-change: auto; }
html.js [data-reveal-group] > * {
  opacity: 0; transform: translateY(12px);
  transition: opacity .5s var(--ease-out), transform .55s var(--ease-out);
  transition-delay: calc(var(--reveal-i, 0) * 55ms);
}
html.js [data-reveal-group].is-revealed > * { opacity: 1; transform: none; }

/* ============================ SURFACES ============================ */
.island-surface {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow);
}

/* ============================ NAV CTA (shared fallbacks) ============================ */
.btn-connect {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px;
  background: var(--primary); color: var(--primary-ink); font-family: var(--font); font-weight: 600;
  font-size: 14px; border-radius: var(--r-pill); text-decoration: none;
  transition: background .2s var(--ease), transform .2s var(--ease); margin-left: 8px;
}
.btn-connect:hover { background: #fff; transform: translateY(-1px); }
.btn-discord-login {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px;
  background: rgba(255,255,255,0.04); color: var(--text); border: 1px solid var(--border-strong);
  font-family: var(--font); font-weight: 600;
  font-size: 14px; border-radius: var(--r-pill); text-decoration: none;
  transition: background .2s var(--ease), transform .2s var(--ease); margin-left: 8px; white-space: nowrap;
}
.btn-discord-login:hover { background: rgba(255,255,255,0.09); transform: translateY(-1px); }

.dept-selector { align-items: stretch; }
.dept-option { display: flex; }
.dept-option label { height: 100%; justify-content: center; box-sizing: border-box; }

/* ============================ MOBILE ============================ */
@media (max-width: 640px) {
  .main-content { padding: 32px 18px; }
  .page-header h1 { font-size: 23px; }
  .modal, .modal-lg { min-width: 0; width: 100%; }
  .form-row label { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  html.js body { opacity: 1 !important; }
  html.js [data-reveal],
  html.js [data-reveal-group] > * { opacity: 1 !important; transform: none !important; }
}
