:root {
  color-scheme: dark;
  --bg: #08090a;
  --bg-elevated: #0c0d10;
  --surface: #111214;
  --surface-elevated: #15161a;
  --surface-hover: #1a1b21;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --text: #eeeef0;
  --muted: #8b8b96;
  --muted-2: #6b6b76;
  --primary: #ebebef;
  --primary-text: #0a0a0c;
  --accent: #6b9bff;
  --accent-soft: rgba(107, 155, 255, 0.13);
  --accent-border: rgba(107, 155, 255, 0.34);
  --success: #4ade80;
  --success-strong: #22a35a;
  --success-soft: rgba(34, 163, 90, 0.14);
  --warning: #e6c07b;
  --warning-soft: rgba(230, 192, 123, 0.14);
  --error: #f07178;
  --error-soft: rgba(240, 113, 120, 0.12);
  --discord: #5865F2;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --fast: 140ms ease;
  --sidebar-w: 248px;
  --font: "Inter", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.brand { letter-spacing: 0.28em; font-size: 12px; margin: 18px 0 8px; }

/* ——— Login · split screen (NGB) ——— */
.lg {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
}
.lg-brand {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  background:
    radial-gradient(ellipse 95% 70% at 15% 12%, var(--lg-glow-1), transparent 70%),
    radial-gradient(ellipse 75% 60% at 95% 100%, var(--lg-glow-2), transparent 72%),
    linear-gradient(150deg, #111214 0%, #0c0d0f 60%, #0f1012 100%);
}
.lg-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.2' filter='url(%23n)'/%3E%3C/svg%3E");
}
.lg-brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lg-line), transparent);
  pointer-events: none;
}
.lg-brand-content {
  position: relative;
  text-align: center;
  transform: translateY(-10px);
  animation: lg-in 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.lg-logo {
  display: block;
  width: clamp(220px, 26vw, 320px);
  height: auto;
  margin: 0 auto 34px;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
}
.lg-tagline {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: #a3a1ab;
}
.lg-note,
.lg-foot {
  position: absolute;
  left: 42px;
  margin: 0;
  color: #66646f;
}
.lg-note {
  top: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.lg-note b {
  font-weight: 500;
  color: var(--lg-accent);
}
.lg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lg-accent);
  box-shadow: 0 0 0 3px var(--lg-accent-soft), 0 0 12px var(--lg-accent);
}
.lg-foot {
  bottom: 33px;
  font-size: 11px;
  letter-spacing: 0.01em;
}
.lg-form-side {
  position: relative;
  display: grid;
  place-items: center;
  padding: 80px 28px;
}
.lg-stack {
  width: 356px;
  max-width: 100%;
  transform: translateY(-9px);
  animation: lg-in 500ms 80ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.lg-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--lg-accent-border);
  background: var(--lg-accent-soft);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lg-accent-text);
}
.lg-eyebrow svg {
  width: 13px;
  height: 13px;
}
.lg-title {
  margin: 0 0 9px;
  font-size: 29px;
  font-weight: 560;
  line-height: 1.25;
  letter-spacing: -0.035em;
  color: var(--text);
}
.lg-sub {
  margin: 0 0 34px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: -0.005em;
}
.lg-field {
  margin: 0 0 20px;
}
.lg-label {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: #c6c6cc;
  letter-spacing: 0;
  text-transform: none;
}
.lg-input-wrap {
  position: relative;
}
.lg .lg-input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 13px;
  background: #0c0d10;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.lg .lg-input.has-toggle {
  padding-right: 44px;
}
.lg .lg-input::placeholder {
  color: #5f5f69;
}
.lg .lg-input:hover {
  border-color: rgba(255, 255, 255, 0.15);
}
.lg .lg-input:focus {
  border-color: var(--lg-accent-border-strong);
  background: #0d0e11;
  box-shadow: 0 0 0 3px var(--lg-accent-soft);
}
.lg-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #73737e;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}
.lg-eye:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.lg-eye svg {
  width: 18px;
  height: 18px;
}
.lg-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  margin-top: 6px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: #eeeef0;
  color: #111214;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.lg-submit:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 12px 30px rgba(0, 0, 0, 0.32), 0 0 0 4px var(--lg-accent-soft);
}
.lg-submit:active {
  transform: translateY(0);
}
.lg-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.lg-submit .lg-arrow {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}
.lg-submit:hover .lg-arrow {
  transform: translateX(2px);
}
.lg-submit .lg-brand-icon {
  width: 18px;
  height: 18px;
  color: #5865f2;
}
.lg-error,
.lg-warn {
  margin: 4px 0 16px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.5;
}
.lg-error {
  color: #f4a3a8;
  border: 1px solid rgba(240, 113, 120, 0.28);
  background: rgba(240, 113, 120, 0.08);
}
.lg-warn {
  color: var(--warning, #e6c07b);
  border: 1px solid rgba(230, 192, 123, 0.28);
  background: rgba(230, 192, 123, 0.08);
}
.lg-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 24px 0 0;
  font-size: 11px;
  color: #71717c;
}
.lg-secure svg {
  width: 13px;
  height: 13px;
}
.lg-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
  margin: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #55555f;
  text-transform: uppercase;
}
.lg-bottom span {
  margin: 0 10px;
  color: #373740;
}
.lg :focus-visible {
  outline: 2px solid var(--lg-accent);
  outline-offset: 2px;
}
.lg .lg-input:focus-visible {
  outline: none;
}
@keyframes lg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@media (max-width: 860px) {
  .lg {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .lg-brand {
    min-height: 0;
    padding: 64px 24px 44px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  .lg-brand-content {
    transform: none;
  }
  .lg-logo {
    width: 168px;
    margin-bottom: 18px;
  }
  .lg-tagline {
    font-size: 12px;
  }
  .lg-note {
    left: 24px;
    top: 22px;
  }
  .lg-foot {
    display: none;
  }
  .lg-form-side {
    padding: 40px 24px 88px;
    align-items: start;
  }
  .lg-stack {
    transform: none;
  }
  .lg-bottom {
    bottom: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lg-brand-content,
  .lg-stack {
    animation: none;
  }
}

.theme-discord {
  --lg-accent: #6b9bff;
  --lg-accent-text: #a9c4ff;
  --lg-accent-soft: rgba(107, 155, 255, 0.12);
  --lg-accent-border: rgba(107, 155, 255, 0.26);
  --lg-accent-border-strong: rgba(107, 155, 255, 0.7);
  --lg-glow-1: rgba(72, 120, 235, 0.17);
  --lg-glow-2: rgba(72, 120, 235, 0.07);
  --lg-line: rgba(107, 155, 255, 0.4);
}
.lg.hidden { display: none !important; }

/* ——— Brand (sidebar) ——— */
.mark { display: block; height: 24px; width: auto; flex-shrink: 0; }
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  margin: 2px 0 22px;
  padding: 0 10px;
}
.brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-left: 12px;
  border-left: 1px solid var(--border-strong);
  height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.brand-tag i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ——— Shell / sidebar ——— */
.shell { min-height: 100vh; }

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 18px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  z-index: 10;
}

main {
  margin-left: var(--sidebar-w);
  padding: 28px 36px 56px;
  min-height: 100vh;
  max-width: none;
  width: auto;
}

.nav-label {
  margin: 20px 12px 8px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.nav-label:first-of-type { margin-top: 4px; }

nav { display: flex; flex-direction: column; gap: 2px; }

nav button {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 450;
  transition: background var(--fast), color var(--fast);
  position: relative;
}
nav button:hover {
  color: var(--text);
  background: var(--surface-hover);
}
nav button.active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}
nav button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.account {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid var(--border);
}
.account p { margin: 0; }
#who { font-size: 14px; font-weight: 500; }
.owner { color: var(--muted-2); font-size: 12px; margin-top: 2px; }
.account a {
  color: var(--muted);
  font-size: 13px;
  display: inline-block;
  margin-top: 10px;
  text-decoration: none;
  transition: color var(--fast);
}
.account a:hover { color: var(--text); }

/* ——— Page chrome ——— */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
}
.page-header h1 { margin-bottom: 4px; }
.page-header .lede { margin-bottom: 0; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 18px; }

.page-kicker {
  margin: 0 0 6px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.lede { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ——— Cards / panels ——— */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast), background var(--fast);
}
.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
}
.card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.card strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  font-weight: 560;
  letter-spacing: -0.03em;
}
.panel-section { margin-bottom: 20px; }
.panel-section > .section-title:first-child { margin-top: 0; }

.section-title {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 550;
}

/* ——— Tables ——— */
.list {
  width: 100%;
  border-collapse: collapse;
}
.list th, .list td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
  vertical-align: middle;
}
.list th {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 4px;
  padding-bottom: 10px;
}
.list tbody tr { transition: background var(--fast); }
.list tbody tr:last-child td { border-bottom: 0; }
.list tr:hover td { background: var(--surface-hover); }
.list td strong { font-weight: 520; }
.list .muted { font-size: 12.5px; margin-top: 2px; }

.empty { color: var(--muted); padding: 4px 0 0; margin: 0; }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.015);
  margin: 8px 0 20px;
}
.empty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 520;
  color: var(--text);
}
.empty-state .empty { color: var(--muted); }

/* ——— Pills / badges ——— */
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: capitalize;
  background: rgba(255, 255, 255, 0.03);
}
.pill-published, .pill-active {
  color: var(--success);
  border-color: rgba(34, 163, 90, 0.35);
  background: var(--success-soft);
}
.pill-draft {
  color: var(--warning);
  border-color: rgba(230, 192, 123, 0.3);
  background: var(--warning-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.03);
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8a3a3a;
}
.badge.on {
  color: var(--success);
  border-color: rgba(34, 163, 90, 0.35);
  background: var(--success-soft);
}
.badge.on::before { background: var(--success-strong); }
.badge.off { color: var(--muted); }
.badge.off::before { background: #8a3a3a; }

/* ——— Buttons ——— */
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.button, button.solid, a.button {
  background: var(--primary);
  color: var(--primary-text);
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 520;
  font-size: 13.5px;
  transition: background var(--fast), transform var(--fast), opacity var(--fast);
}
.button:hover, button.solid:hover, a.button:hover {
  background: #fff;
}
.button:active, button.solid:active { transform: translateY(1px); }

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 450;
  transition: background var(--fast), border-color var(--fast);
}
button.ghost:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.16);
}

button.danger {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
button.danger:hover {
  color: var(--error);
  border-color: rgba(240, 113, 120, 0.4);
  background: var(--error-soft);
}

button.danger-solid {
  background: #8f2d2d;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 520;
}
button.danger-solid:disabled { opacity: 0.45; cursor: not-allowed; }

.edit-btn { min-width: 64px; }

/* ——— Editor ——— */
.editor-page { width: 100%; max-width: none; }
.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.editor-head h1 { margin-bottom: 2px; }
.editor-head .meta { margin: var(--space-1) 0 0; color: var(--muted); font-size: 13px; }
.editor-head .actions { align-items: center; flex-wrap: wrap; }
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, min(520px, 34vw));
  gap: var(--space-5);
  align-items: start;
  width: 100%;
}
.editor-main { min-width: 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }

.action-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.action-bar p { margin: 0; color: var(--muted); }
.action-bar p.saved { color: var(--success); }
.action-bar p.warn { color: var(--warning); }
.action-bar.dock {
  top: auto;
  bottom: 0;
  z-index: 4;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding: 12px 0;
  border-bottom: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.action-bar .notice { margin: 2px 0 0; }
.action-bar .notice:empty { display: none; }
.action-bar .actions { flex-wrap: wrap; }

.kv {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0 0 20px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.kv dt { margin: 0; color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 450; }
.editor-main .section-title { margin-top: 22px; }
.editor-main .section-title:first-child { margin-top: 0; }

/* ——— Forms ——— */
label {
  display: block;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
input, select { height: 38px; }
textarea { min-height: 72px; resize: vertical; line-height: 1.45; overflow-y: hidden; }
textarea.grow-lg { min-height: 140px; }
textarea.grow-md { min-height: 96px; }
textarea.grow-sm { min-height: 64px; }
input:hover, textarea:hover, select:hover { border-color: rgba(255, 255, 255, 0.16); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] {
  width: 42px;
  height: 38px;
  padding: 4px;
  flex: none;
  cursor: pointer;
}
.color-row input[type="text"], .color-row input:not([type]) { flex: 1; }
.field-group { margin-top: 12px; padding-top: 4px; }
.field-group h2, .group-label {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.state-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 520;
  letter-spacing: 0.04em;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.state-switch .state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a3a3a;
}
.state-switch[data-enabled="true"] {
  color: var(--success);
  border-color: rgba(34, 163, 90, 0.4);
  background: var(--success-soft);
}
.state-switch[data-enabled="true"] .state-dot { background: var(--success-strong); }
.state-switch[data-enabled="false"] .state-dot { background: #8a3a3a; }
.state-line { margin: 0 0 8px; }

.message-list { display: grid; gap: 0; margin-top: 8px; border-top: 1px solid var(--border); }
.message-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}
.message-row h2 { margin: 0; font-size: 15px; font-weight: 500; }
.message-row p { margin: 0; color: var(--muted); font-size: 13px; }
.where { color: var(--muted); font-size: 13px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
}
.filters .ghost.active {
  color: var(--text);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.log-list { display: grid; }
.log-row {
  display: grid;
  grid-template-columns: 148px minmax(80px, 140px) minmax(100px, 160px) auto;
  gap: 8px 12px;
  align-items: baseline;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.log-row:last-child { border-bottom: 0; }
.log-row time, .log-row span { color: var(--muted); font-size: 13px; }
.log-row em {
  font-style: normal;
  color: var(--success);
  font-size: 12px;
  font-weight: 520;
  letter-spacing: 0.04em;
}
.log-row em.bad { color: var(--error); }
.log-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
}

.hint {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  cursor: pointer;
}
.switch input {
  width: 44px;
  height: 24px;
  margin: 0;
  appearance: none;
  border: 1px solid #333;
  border-radius: 99px;
  background: #1c1c1c;
  position: relative;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8a8a8a;
  transition: left var(--fast), background var(--fast);
}
.switch input:checked {
  background: var(--success-strong);
  border-color: var(--success-strong);
}
.switch input:checked::after { left: 22px; background: #fff; }

.row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.notice { margin: 12px 0 0; min-height: 0; white-space: pre-wrap; color: #cfcfcf; }
.notice.error {
  color: var(--error);
  border: 1px solid rgba(240, 113, 120, 0.3);
  background: var(--error-soft);
  border-radius: 8px;
  padding: 10px 12px;
}

.component-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 8px;
  display: grid;
  gap: 8px;
  background: var(--surface);
}
.component-card .row { margin-top: 0; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  color: #d0d0d0;
  cursor: pointer;
}
.check input { width: auto; height: auto; }

/* ——— Preview ——— */
.preview-pane {
  position: sticky;
  top: 16px;
  align-self: start;
  width: 100%;
  min-width: 0;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.preview-pane .section-title { margin-bottom: var(--space-3); }
.preview-pane .discord-preview {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.thumb-row { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-2); }
.thumb-preview {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.thumb-preview.empty { display: none; }

.discord-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.discord-message { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
.discord-avatar { width: 40px; height: 40px; border-radius: 50%; background: #2a2a2a; }
.discord-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.discord-meta strong { font-size: 15px; }
.discord-meta time { color: var(--muted); font-size: 12px; }
.discord-content { margin: 0 0 8px; white-space: pre-wrap; }
.discord-embed {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 6px;
  padding: 8px 12px 12px;
  background: #0d0d0d;
  border-left: 4px solid #fff;
  border-radius: 4px;
}
.discord-embed:has(.discord-thumb) { grid-template-columns: minmax(0, 1fr) auto; }
.discord-author { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.discord-author img, .author-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a2a2a;
}
.discord-title { margin: 0 0 6px; font-weight: 650; }
.discord-description, .discord-field-value, .discord-footer, .discord-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.discord-description { color: #ddd; }
.discord-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.discord-field { flex: 1 1 100%; min-width: 0; }
.discord-field.inline { flex: 1 1 40%; }
.discord-field-name { font-size: 12px; font-weight: 650; margin-bottom: 2px; }
.discord-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; }
.discord-image { display: block; max-width: 100%; margin-top: 10px; border-radius: 4px; }
.discord-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.discord-footer img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.discord-button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.discord-button {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 4px;
  background: #4e5058;
  color: #fff;
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.discord-button.primary { background: #5865f2; }
.discord-button.danger { background: #da373c; }
.discord-preview a { color: #f5f5f5; }
.discord-preview strong { font-weight: 650; }
.discord-preview code {
  background: #1c1c1c;
  padding: 0 4px;
  border-radius: 3px;
  font-family: Consolas, monospace;
  font-size: 0.92em;
}

/* ——— Folds / history ——— */
.fold { border-top: 1px solid var(--border); }
.fold-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 12px 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 520;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.fold-toggle::after { content: "▾"; color: var(--muted); font-size: 12px; }
.fold[data-open="false"] .fold-toggle::after { content: "▸"; }
.fold-body { padding: 0 0 12px; }

.emoji { height: 1.15em; width: auto; vertical-align: -0.2em; }
.history { margin-top: 22px; }
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.history-row:last-child { border-bottom: 0; }
.history-row p { margin: 0; color: var(--muted); }
.group { margin-bottom: 22px; }
.group h2 { margin: 0 0 8px; font-size: 15px; font-weight: 520; letter-spacing: -0.01em; }

/* ——— Modal ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(440px, 100%);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 12px; font-size: 18px; font-weight: 560; letter-spacing: -0.02em; }
.modal p { margin: 0 0 8px; color: var(--muted); }
.modal-name { color: var(--text); font-weight: 560; overflow-wrap: anywhere; }
.modal label {
  display: block;
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}
.modal input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
}
.modal .match { color: var(--success); margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ——— Responsive ——— */
@media (max-width: 1240px) {
  .editor { grid-template-columns: 1fr; }
  .editor-head { flex-direction: column; }
  .editor-head .actions { justify-content: flex-start; }
  .preview-pane { position: static; }
}
@media (max-width: 1100px) {
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  aside {
    position: relative;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .action-bar.dock { position: static; }
  .page-header {
    position: static;
    flex-direction: column;
    backdrop-filter: none;
  }
  .page-actions { padding-top: 0; }
  main { margin-left: 0; padding: 24px 16px 48px; }
  .account { margin-top: 18px; }
  .log-row, .message-row { grid-template-columns: 1fr; }
  .brand-row { margin-bottom: 14px; }
}

/* Selected background B — Precision grid */

.lg-brand{isolation:isolate;background:#090c11;}
.lg-brand:before,.lg-brand:after{display:none!important}
.lg-brand-content{z-index:3;animation:none!important;}
.lg-logo{filter:none!important}
.lg-note{z-index:4}.lg-note .lg-dot{box-shadow:none}
.lg-note b{color:var(--tone)}
.lg-stack{animation:none!important}
.bg-art{position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden;}
.bg-dither{position:absolute;inset:0;pointer-events:none;z-index:2;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='192' height='192'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.94' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.5' d='M0 0h192v192H0z'/%3E%3C/svg%3E");opacity:.055;mix-blend-mode:soft-light;}
.lg-brand{--tone:#6394ff}/* Precision grid, vanishing to black; one crisp horizon. */
.lg-brand{background:radial-gradient(ellipse 90% 65% at 0% 0%,rgba(99,148,255,.095),transparent 74%),#080b10;}
.bg-art:before{content:"";position:absolute;inset:0;background-image:linear-gradient(rgba(99,148,255,.16) 1px,transparent 1px),linear-gradient(90deg,rgba(99,148,255,.16) 1px,transparent 1px);background-size:48px 48px;background-position:-1px -1px;mask-image:radial-gradient(ellipse 100% 80% at 0% 0%,#000,transparent 82%);}
.bg-art:after{content:"";position:absolute;left:47px;top:95px;width:calc(100% - 94px);height:1px;background:linear-gradient(90deg,var(--tone),rgba(99,148,255,.45) 44%,transparent);box-shadow:0 0 18px rgba(99,148,255,.2);}
.grid-tick{position:absolute;top:91px;left:43px;width:9px;height:9px;background:#0b0e13;border:1px solid var(--tone);}
