: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;
  /* NGB crimson (#9B111E, BRAND_COLOR_HEX), the only accent. */
  --accent: #9b111e;
  --accent-soft: rgba(155, 17, 30, 0.22);
  --accent-border: rgba(155, 17, 30, 0.6);
  --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-button.success { background: #248046; }
.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);}

/* Send test: destination picker next to the button */
.test-target { width: auto; max-width: 220px; min-width: 150px; margin: 0; padding: 0 10px; font-size: 13px; }

/* ——— Real Discord preview (Components V2, Discord dark theme) ——— */
.v2-preview {
  --v2-bg: #313338;
  --v2-card: #2b2d31;
  --v2-text: #dbdee1;
  --v2-head: #f2f3f5;
  --v2-muted: #949ba4;
  --v2-line: #3f4147;
  background: var(--v2-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px 16px 12px;
  color: var(--v2-text);
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.375;
  transition: opacity 120ms ease;
}
#preview.v2-loading .v2-preview, #ticketPreview.v2-loading .v2-preview { opacity: 0.82; }
.v2-message { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
.v2-avatar { width: 40px; height: 40px; border-radius: 50%; background: #9b111e; object-fit: cover; }
.v2-body { min-width: 0; }
.v2-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.v2-meta strong { color: #f2f3f5; font-weight: 600; font-size: 15px; }
.v2-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; line-height: 15px; padding: 0 4px; border-radius: 3px; }
.v2-meta time { color: var(--v2-muted); font-size: 12px; margin-left: 2px; }
.v2-components { display: grid; gap: 8px; margin-top: 2px; }
.v2-container {
  display: grid;
  gap: 8px;
  max-width: 100%;
  padding: 16px;
  background: var(--v2-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}
.v2-container.accent { border-left: 4px solid var(--v2-accent); padding-left: 14px; }
.v2-text { overflow-wrap: anywhere; }
.v2-line, .v2-li { white-space: pre-wrap; }
.v2-blank { height: 0.6em; }
.v2-h1, .v2-h2, .v2-h3 { color: var(--v2-head); font-weight: 700; line-height: 1.25; margin: 2px 0 4px; }
.v2-h1 { font-size: 24px; }
.v2-h2 { font-size: 20px; }
.v2-h3 { font-size: 16px; }
.v2-small { color: var(--v2-muted); font-size: 12px; line-height: 1.35; white-space: pre-wrap; }
.v2-quote { margin: 0; padding: 0 0 0 12px; border-left: 4px solid #4e5058; }
.v2-li { position: relative; padding-left: calc(18px + var(--indent, 0) * 18px); }
.v2-li::before { content: "•"; position: absolute; left: calc(4px + var(--indent, 0) * 18px); color: var(--v2-text); }
.v2-li.v2-ol::before { content: attr(data-n); left: calc(var(--indent, 0) * 18px); }
.v2-preview strong { color: inherit; font-weight: 700; }
.v2-preview a { color: #00a8fc; text-decoration: none; }
.v2-preview a:hover { text-decoration: underline; }
.v2-preview code {
  background: #1e1f22;
  border: 1px solid #1e1f22;
  border-radius: 4px;
  padding: 0 3px;
  font-family: "gg mono", Consolas, "Andale Mono WT", Monaco, monospace;
  font-size: 0.85em;
}
.v2-codeblock {
  margin: 4px 0;
  padding: 8px 10px;
  background: #1e1f22;
  border-radius: 4px;
  font-family: "gg mono", Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}
.v2-emoji { width: 1.375em; height: 1.375em; object-fit: contain; vertical-align: -0.3em; margin: 0 0.05em; }
.v2-h1 .v2-emoji, .v2-h2 .v2-emoji, .v2-h3 .v2-emoji { width: 1.2em; height: 1.2em; vertical-align: -0.2em; }
.v2-small .v2-emoji { width: 16px; height: 16px; vertical-align: -0.25em; }
.v2-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.v2-time { background: rgba(255, 255, 255, 0.06); border-radius: 3px; padding: 0 2px; }
.v2-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; }
.v2-spoiler:hover { color: inherit; }
.v2-sep { height: 1px; background: var(--v2-line); margin: 4px 0; }
.v2-sep.large { margin: 12px 0; }
.v2-sep.blank { background: transparent; }
.v2-section { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.v2-section-body { display: grid; gap: 8px; min-width: 0; }
.v2-thumb { width: 85px; height: 85px; object-fit: cover; border-radius: 8px; display: block; }
.v2-gallery { display: grid; gap: 4px; border-radius: 8px; overflow: hidden; }
.v2-gallery.n2, .v2-gallery.n4 { grid-template-columns: 1fr 1fr; }
.v2-gallery.n3 { grid-template-columns: 2fr 1fr; }
.v2-gallery-item { display: block; width: 100%; max-height: 360px; object-fit: cover; background: #1e1f22; }
.v2-gallery.n1 .v2-gallery-item { object-fit: contain; max-height: 420px; }
.v2-media-missing {
  display: grid;
  place-items: center;
  min-height: 90px;
  color: var(--v2-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #1e1f22;
  border-radius: 8px;
}
.v2-file { padding: 10px 12px; background: #1e1f22; border-radius: 8px; font-size: 14px; }
.v2-row { display: flex; flex-wrap: wrap; gap: 8px; }
.v2-row-select { display: grid; }
.v2-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  max-width: 100%;
  padding: 2px 16px;
  border-radius: 8px;
  background: #4e5058;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.v2-button.primary { background: #5865f2; }
.v2-button.success { background: #248046; }
.v2-button.danger { background: #da373c; }
.v2-button.link, .v2-button.secondary { background: #4e5058; }
.v2-button.disabled { opacity: 0.5; }
.v2-button .v2-emoji { width: 18px; height: 18px; margin: 0; vertical-align: middle; }
.v2-ext { width: 16px; height: 16px; flex: none; }
.v2-select { display: grid; gap: 6px; }
.v2-select-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 8px 8px 12px;
  background: #1e1f22;
  border: 1px solid #1e1f22;
  border-radius: 8px;
  color: var(--v2-text);
}
.v2-placeholder { color: var(--v2-muted); flex: 1; }
.v2-chevron { width: 22px; height: 22px; margin-left: auto; color: var(--v2-text); flex: none; }
.v2-options {
  display: none;
  padding: 4px;
  background: #2b2d31;
  border: 1px solid #1e1f22;
  border-radius: 8px;
}
.v2-select:hover .v2-options, .v2-select:focus-within .v2-options { display: grid; }
.v2-option { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 4px; font-size: 14px; }
.v2-option:hover { background: #393c41; }
.v2-option-desc { color: var(--v2-muted); font-size: 12px; }
.v2-emoji-text { font-size: 1.1em; }
.v2-warn {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(155, 17, 30, 0.18);
  border: 1px solid rgba(155, 17, 30, 0.6);
  color: #ffb3b9;
  font-size: 13px;
}

/* ——— Banner shown under the Image field (custom URL or bundled default) ——— */
.banner-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-2);
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.banner-preview {
  width: 168px;
  aspect-ratio: 19 / 7;
  object-fit: cover;
  border-radius: 6px;
  background: #1e1f22;
  display: block;
}
.banner-preview.broken { visibility: hidden; }
.banner-meta { display: grid; gap: 4px; min-width: 0; }
.banner-meta .ghost { justify-self: start; margin-top: 2px; }
.banner-caption { margin: 0; color: var(--text); font-size: 13px; font-weight: 520; overflow-wrap: anywhere; }
.banner-row .hint { margin: 0; }


/* ═══════════════════════════════════════════════════════════════════════════
   DES-38 · Panel redesign. Black + NGB crimson (#9B111E) as the only accent.
   Spacing instead of lines, one idea per group, one tab at a time, no glow.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #070708;
  --bg-elevated: #0b0b0d;
  --surface: #111114;
  --surface-elevated: #16161a;
  --surface-hover: #1b1b20;
  --border: rgba(255, 255, 255, 0.055);
  --text: #ededf0;
  --muted: #8d8d97;
  --muted-2: #66666f;
  --accent: #9b111e;
  --accent-hover: #ae1626;
  --accent-soft: rgba(155, 17, 30, 0.14);
  --accent-border: rgba(155, 17, 30, 0.55);
  --ok: #7fbf95;
  --draft: #d8b46a;
  --bad: #f07178;
  --radius: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 140ms var(--ease);
  --sidebar-w: 232px;
}

body { background: var(--bg); font-size: 14px; }
::selection { background: rgba(155, 17, 30, 0.45); color: #fff; }
:focus-visible { outline: 2px solid var(--accent-border); outline-offset: 2px; }

/* Motion: short, calm, and off for people who ask for less. */
@keyframes ngb-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes ngb-shimmer { from { background-position: -200px 0; } to { background-position: 200px 0; } }
.page-enter, .tab-panel:not([hidden]), .editor-page { animation: ngb-enter 180ms var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ——— Sidebar ——— */
aside { background: var(--bg-elevated); border-right: 0; padding: 22px 12px 16px; }
.brand-row { margin: 0 8px 18px; }
.nav-label { margin: 22px 12px 6px; color: var(--muted-2); font-size: 10.5px; letter-spacing: 0.14em; }
.nav-label:first-of-type { margin-top: 6px; }
nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-size: 13.5px; font-weight: 450;
}
nav button svg { width: 17px; height: 17px; flex: none; opacity: 0.8; }
nav button:hover { background: var(--surface); color: var(--text); }
nav button.active { background: var(--surface-elevated); color: var(--text); box-shadow: none; }
nav button.active svg { color: var(--accent-hover); opacity: 1; }
nav button.active::before { top: 9px; bottom: 9px; left: -12px; width: 3px; background: var(--accent); }
.account { border-top: 0; padding: 12px 12px 2px; }

/* ——— Pages ——— */
main { padding: 26px 40px 64px; max-width: 1480px; }
.page-header { border-bottom: 0; padding-bottom: 6px; margin-bottom: 22px; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.page-header h1, h1 { font-size: 23px; font-weight: 580; letter-spacing: -0.03em; }
.page-kicker { color: var(--muted-2); letter-spacing: 0.14em; }
.lede { color: var(--muted); max-width: 70ch; }
.lede code, .hint code { padding: 1px 5px; border-radius: 5px; background: var(--surface-elevated); color: var(--text); font-size: 12px; }
.page-actions { padding-top: 16px; }
.panel, .card { background: var(--surface); border: 0; box-shadow: none; border-radius: var(--radius-lg); }
.panel-section { margin-bottom: 26px; }
.panel.panel-section { padding: 18px 20px; }
.section-title { margin: 0 0 10px; color: var(--muted-2); font-size: 11px; font-weight: 560; letter-spacing: 0.12em; text-transform: uppercase; }
.hint { color: var(--muted-2); font-size: 12.5px; line-height: 1.45; margin: 6px 0 0; }
.notice { min-height: 0; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.notice:empty { display: none; }
.notice.error { color: var(--bad); background: rgba(240, 113, 120, 0.08); border: 0; padding: 8px 12px; border-radius: 8px; }

/* Loading placeholders (drawn instantly, replaced in place). */
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface) 0, var(--surface-elevated) 50%, var(--surface) 100%) var(--surface); background-size: 400px 100%; animation: ngb-shimmer 1.1s linear infinite; }
.sk-crumb { width: 90px; height: 14px; margin-bottom: 10px; }
.sk-title { width: 220px; height: 26px; margin-bottom: 14px; }
.sk-line { width: 50%; height: 14px; margin-bottom: 22px; }
.sk-box { height: 92px; margin-bottom: 12px; border-radius: 12px; }
.sk-box.short { width: 60%; }
.sk-btn { width: 92px; height: 36px; }
.sk-btn.solid { background: var(--accent-soft); }
.sk-tab { width: 80px; height: 30px; }
.sk-preview { height: 360px; border-radius: 12px; }
.skeleton .actions, .skeleton .tabs { display: flex; gap: 8px; }
.page-loading { max-width: 760px; padding-top: 22px; }

/* ——— Buttons ——— */
button.solid, .button, a.button { background: var(--accent); color: #fff; border: 0; border-radius: 9px; height: 36px; padding: 0 18px; font-weight: 560; box-shadow: none; transition: background var(--fast), transform var(--fast); }
button.solid:hover { background: var(--accent-hover); }
button.solid:active, button.ghost:active { transform: translateY(1px); }
button.ghost { background: var(--surface-elevated); border: 0; color: var(--text); border-radius: 9px; height: 36px; padding: 0 14px; transition: background var(--fast); }
button.ghost:hover { background: var(--surface-hover); }
button.quiet { background: transparent; border: 0; color: var(--muted); height: 36px; padding: 0 10px; border-radius: 9px; cursor: pointer; transition: color var(--fast), background var(--fast); }
button.quiet:hover { color: var(--text); background: var(--surface); }
button.quiet.danger-text:hover { color: var(--bad); }
.link-button { color: var(--muted-2); }

/* ——— Status chips ——— */
.chip, .state-chip { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 9px; border-radius: 999px; background: var(--surface-elevated); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip::before, .state-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.chip.ok::before, .state-chip[data-tone="ok"]::before { background: var(--ok); }
.chip.draft::before, .state-chip[data-tone="draft"]::before { background: var(--draft); }
.chip.off::before { background: var(--muted-2); }
.state-chip[data-tone="busy"]::before { background: var(--muted); animation: ngb-pulse 0.9s ease-in-out infinite alternate; }
.state-chip[data-tone="bad"] { color: var(--bad); }
.state-chip[data-tone="bad"]::before { background: var(--bad); }
.state-chip:empty { display: none; }
@keyframes ngb-pulse { from { opacity: 0.35; } to { opacity: 1; } }

/* ——— Home ——— */
.attention { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 26px; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.attention-title { margin: 0; font-weight: 560; }
.attention .hint { margin-top: 2px; }
.attention-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tile { display: grid; gap: 4px; text-align: left; padding: 16px 18px; border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); cursor: pointer; transition: background var(--fast), transform var(--fast); }
.tile:hover { background: var(--surface-elevated); transform: translateY(-1px); }
.tile strong { font-weight: 560; font-size: 14.5px; }
.tile span { color: var(--muted); font-size: 13px; }
.rows, .message-list { display: grid; gap: 2px; }
.row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto 150px; align-items: center; gap: 16px; padding: 12px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; transition: background var(--fast); }
.row-link:hover { background: var(--surface); }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-main strong { font-weight: 540; }
.row-main .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-when { font-size: 12.5px; text-align: right; }

/* ——— Messages ——— */
.message-item { display: grid; grid-template-columns: minmax(0, 1fr) 104px 200px; align-items: center; gap: 12px; padding: 0 10px 0 0; border-radius: 12px; transition: background var(--fast); }
.message-item:hover { background: var(--surface); }
.message-open { display: grid; grid-template-columns: minmax(0, 1fr) 170px 130px; align-items: center; gap: 16px; padding: 13px 14px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; border-radius: 12px; }
.row-where { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-item .actions { display: flex; gap: 2px; justify-content: flex-end; }
.message-item .edit-btn { opacity: 0; min-width: 0; height: 32px; transition: opacity var(--fast); }
.message-item:hover .edit-btn, .message-item:focus-within .edit-btn { opacity: 1; }
.message-item .quiet { height: 32px; font-size: 12.5px; opacity: 0; }
.message-item:hover .quiet, .message-item:focus-within .quiet { opacity: 1; }
.state-switch { height: 24px; border: 0; background: var(--surface-elevated); }
.badge { border: 0; }
#create-box { display: grid; gap: 6px; max-width: 520px; }

/* ——— Editor ——— */
.editor-page { width: 100%; }
.editor-head { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: -26px -40px 0; padding: 16px 40px 12px; border: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
.editor-title { display: grid; gap: 4px; min-width: 0; }
.editor-name { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.editor-name h1 { margin: 0; }
.editor-head .meta { margin: 0; }
.crumb { justify-self: start; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.crumb:hover { color: var(--text); }
.editor-head .actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.test-group { display: inline-flex; align-items: center; gap: 0; border-radius: 9px; background: var(--surface-elevated); }
.test-group:has(.hidden + .hidden) { display: none; }
.test-group .test-target { height: 36px; width: auto; max-width: 170px; border: 0; background: transparent; color: var(--muted); padding: 0 6px 0 12px; font-size: 13px; }
.test-group button.ghost { background: transparent; }
.test-group button.ghost:hover { background: var(--surface-hover); }

.tabs { display: flex; gap: 4px; margin: 8px 0 18px; padding: 0; border: 0; }
.tabs [role="tab"] { position: relative; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: color var(--fast), background var(--fast); }
.tabs [role="tab"]:hover { color: var(--text); background: var(--surface); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); background: var(--surface-elevated); }
.tabs [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-panel[hidden] { display: none !important; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); gap: 32px; align-items: start; }
.editor-main { min-width: 0; max-width: 720px; }
.fold { margin: 0 0 14px; border: 0; }
.fold-toggle { padding: 4px 0 10px; color: var(--muted-2); font-size: 11px; font-weight: 560; letter-spacing: 0.12em; text-transform: uppercase; }
.fold[data-fold="content"] > .fold-toggle { display: none; }
.fold-body { padding: 0; }
#messageBody > .fold[data-fold="author"], #messageBody > .fold[data-fold="footer"], #messageBody > .fold[data-fold="fields"], #messageBody > .fold[data-fold="components"], #messageBody > .fold[data-fold="message"] { padding: 4px 16px; border-radius: 12px; background: var(--surface); }
#messageBody > .fold[data-fold="author"] .fold-toggle, #messageBody > .fold[data-fold="footer"] .fold-toggle, #messageBody > .fold[data-fold="fields"] .fold-toggle, #messageBody > .fold[data-fold="components"] .fold-toggle, #messageBody > .fold[data-fold="message"] .fold-toggle { padding: 10px 0; }

label { color: var(--muted); font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; margin: 14px 0 6px; }
input, textarea, select { background: var(--bg); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 9px; transition: border-color var(--fast), background var(--fast); }
input:hover, textarea:hover, select:hover { border-color: rgba(255, 255, 255, 0.12); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-border); background: #09090b; }
input[readonly], textarea[readonly] { color: var(--muted); }
textarea { line-height: 1.5; }

.preview-pane { position: sticky; top: 92px; padding: 16px; border: 0; border-radius: var(--radius-lg); background: var(--bg-elevated); max-height: calc(100vh - 110px); overflow: auto; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-head .section-title { margin: 0; }
.preview-pane > .hint { margin: 4px 0 12px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: 11.5px; }
.live-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.preview-pane:has(.v2-loading) .live-dot::before { background: var(--muted); animation: ngb-pulse 0.6s ease-in-out infinite alternate; }
#preview .v2-preview, #ticketPreview .v2-preview { transition: opacity 120ms ease; }

.history { margin: 0; }
.history-row { border: 0; padding: 10px 12px; border-radius: 10px; }
.history-row:hover { background: var(--surface); }
.banner-row { border: 0; background: var(--surface); border-radius: 12px; }
.thumb-row { margin-top: 8px; }

/* ——— Structured card editor ——— */
.card-editor { display: grid; gap: 14px; }
.ce-group { display: grid; gap: 10px; padding: 16px 18px 18px; border-radius: var(--radius-lg); background: var(--surface); }
.ce-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ce-group-title { margin: 0; color: var(--text); font-size: 14px; font-weight: 580; letter-spacing: -0.01em; }
.ce-group-head .hint { margin-top: 3px; }
.ce-group > label:first-of-type, .ce-group .ce-field > label { margin-top: 0; }
.ce-group > label { margin: 4px 0 -4px; }
.card-editor .ce-field, .ce-group .ce-field { display: grid; gap: 6px; min-width: 0; }
.ce-field label { margin: 0; }
.ce-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ce-row > * { flex: 1 1 160px; min-width: 0; }
.ce-row > .ce-emoji, .ce-emoji-field { flex: 0 1 190px; }
.ce-grow { flex: 2 1 240px; }
.ce-title-row > .ce-field:nth-child(2) { flex: 0 1 190px; }
.ce-toggles { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.ce-list { display: grid; gap: 8px; }
.ce-list.spaced { gap: 8px; }
.ce-item { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; border-radius: 12px; background: var(--bg-elevated); transition: background var(--fast), box-shadow var(--fast); }
.ce-item:focus-within { background: #0e0e11; box-shadow: inset 2px 0 0 var(--accent); }
.ce-item.has-gap { margin-bottom: 22px; }
.ce-item.has-gap::after { content: "blank line"; position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); color: var(--muted-2); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.ce-body { display: grid; gap: 8px; min-width: 0; }
.ce-text { min-height: 38px; resize: vertical; }
.ce-badge, .ce-key { align-self: start; margin-top: 9px; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: #f0c4c8; font: 600 12px/1.4 ui-monospace, Consolas, monospace; }
.ce-badge-quiet { background: var(--surface-elevated); color: var(--muted); }
.ce-key { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface-elevated); color: var(--muted); }
.ce-tools { display: flex; gap: 2px; margin-top: 4px; opacity: 0.55; transition: opacity var(--fast); }
.ce-item:hover .ce-tools, .ce-item:focus-within .ce-tools { opacity: 1; }
.ce-icon { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.ce-icon:hover:not(:disabled), .ce-icon:focus-visible { background: var(--surface-hover); color: var(--text); }
.ce-icon:disabled { opacity: 0.25; cursor: default; }
.ce-add { justify-self: start; height: 34px; }
.ce-gap { justify-self: start; height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-2); font-size: 12px; cursor: pointer; transition: color var(--fast), background var(--fast); }
.ce-gap:hover { color: var(--text); background: var(--surface); }
.ce-gap[aria-pressed="true"] { color: #f0c4c8; background: var(--accent-soft); }
.card-editor .empty { margin: 0; color: var(--muted-2); }

/* Switch */
.ce-switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--text); font-size: 13.5px; cursor: pointer; user-select: none; }
.ce-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ce-track { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: var(--surface-hover); transition: background var(--fast); }
.ce-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #c9c9d0; transition: transform var(--fast), background var(--fast); }
.ce-switch input:checked + .ce-track { background: var(--accent); }
.ce-switch input:checked + .ce-track::after { transform: translateX(14px); background: #fff; }
.ce-switch input:focus-visible + .ce-track { outline: 2px solid var(--accent-border); outline-offset: 2px; }
.ce-switch-text { display: grid; gap: 1px; }
.ce-switch-text small { color: var(--muted-2); font-size: 12px; }

/* Segmented control */
.ce-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg-elevated); justify-self: start; }
.ce-seg-item { position: relative; display: inline-flex; align-items: center; margin: 0; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; cursor: pointer; transition: background var(--fast), color var(--fast); }
.ce-seg-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ce-seg-item:has(input:checked) { background: var(--surface-hover); color: var(--text); }
.ce-seg-item:has(input:focus-visible) { outline: 2px solid var(--accent-border); }

/* Discord preview: same gaps as Discord (8 px small, 16 px large, blank line = one text line). */
.v2-sep { margin: 8px 0; }
.v2-sep.large { margin: 16px 0; }
.v2-blank { height: 1.375em; }

/* Logs */
.filters { gap: 4px; }
.filters .ghost { background: transparent; color: var(--muted); }
.filters .ghost.active { background: var(--surface-elevated); color: var(--text); box-shadow: none; border: 0; }
.log-row { border: 0; border-radius: 10px; padding: 10px 12px; }
.log-row:hover { background: var(--surface-elevated); }
.kv { border: 0; background: var(--surface); border-radius: var(--radius-lg); }

/* Side by side when there is room, stacked below otherwise. */
@media (max-width: 1180px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview-pane { position: static; max-height: none; }
  .editor-main { max-width: none; }
}
@media (max-width: 860px) {
  main { margin-left: 0; padding: 18px 16px 48px; }
  aside { position: static; width: auto; }
  .editor-head { margin: -18px -16px 0; padding: 12px 16px; }
  .message-open { grid-template-columns: minmax(0, 1fr); }
  .row-where, .row-when { display: none; }
}
.link-button { display: inline-block; margin: 10px 0 0; padding: 0; border: 0; background: transparent; color: var(--muted-2); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button:hover, .link-button:focus-visible { color: var(--text); }
.row-when { white-space: nowrap; }
.state-switch { gap: 7px; padding: 0 10px 0 9px; font-size: 12px; color: var(--muted); }
.state-switch .state-label { letter-spacing: 0; }
.status-text > .fold-toggle { display: none; }
.status-text #statusHint { margin: 0 0 12px; }
/* Calmer status colours: switches use the crimson accent, results are muted text with a dot. */
.switch input { border: 0; background: var(--surface-hover); width: 36px; height: 20px; }
.switch input::after { top: 3px; left: 3px; width: 14px; height: 14px; background: #c9c9d0; }
.switch input:checked { background: var(--accent); border-color: transparent; }
.switch input:checked::after { left: 19px; }
.log-row em { color: var(--ok); letter-spacing: 0.02em; text-transform: none; }
.log-row em.bad { color: var(--bad); }
.log-row p { color: var(--muted-2); }
.action-bar { border: 0; background: transparent; }
.action-bar p.saved, .editor-head .meta.saved { color: var(--ok); }
.state-switch[data-enabled="true"] { color: var(--text); background: var(--surface-elevated); border: 0; }
.state-switch[data-enabled="true"] .state-dot { background: var(--ok); }
.kv { padding: 14px 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   DES-39 · Logs. Folders on the left, one quiet list on the right, level as a
   small dot + word (red = error, amber = warning, green = ok, grey = info).
   ═══════════════════════════════════════════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.log-tile { display: block; flex: none; border-radius: 6px; }
.log-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.log-folders { position: sticky; top: 18px; display: grid; gap: 14px; }
.log-folder-group { display: grid; gap: 2px; }
.log-folder-title { margin: 0 0 4px 10px; color: var(--muted-2); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.log-folder { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13.5px; text-align: left; cursor: pointer; transition: background var(--fast), color var(--fast); }
.log-folder span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-folder em { color: var(--muted-2); font-size: 12px; font-style: normal; font-variant-numeric: tabular-nums; }
.log-folder:hover { background: var(--surface); color: var(--text); }
.log-folder.active { background: var(--surface-elevated); color: var(--text); }
.log-folder.active em { color: var(--text); }
.log-folder.has-problems em { color: var(--bad); }
.log-pane { min-width: 0; background: var(--surface); border-radius: var(--radius-lg); padding: 16px 16px 10px; }
.log-toolbar { display: flex; align-items: center; gap: 12px; }
.log-pane-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 600; flex: none; }
.log-search { flex: 1; min-width: 0; margin: 0; }
.log-search input { width: 100%; height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: var(--bg-elevated); color: var(--text); font-size: 13.5px; }
.log-search input::placeholder { color: var(--muted-2); }
.log-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 2px 8px; font-size: 12px; }
.log-legend .muted { margin-left: auto; color: var(--muted-2); }
.sev-chip { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px 0 7px; border-radius: 999px; background: var(--surface-elevated); color: var(--muted); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.sev-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.sev-chip.sev-success::before { background: var(--ok); }
.sev-chip.sev-warning { color: var(--draft); }
.sev-chip.sev-warning::before { background: var(--draft); }
.sev-chip.sev-error { color: var(--bad); background: rgba(240, 113, 120, 0.08); }
.sev-chip.sev-error::before { background: var(--bad); }
.log-items { display: grid; gap: 2px; }
.log-item { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 12px; border-radius: 10px; cursor: pointer; transition: background var(--fast); }
.log-item:hover, .log-item.open { background: var(--surface-elevated); }
.log-item.sev-error::before, .log-item.sev-warning::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--bad); }
.log-item.sev-warning::before { background: var(--draft); }
.log-item .log-tile { margin-top: 1px; }
.log-main { min-width: 0; }
.log-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; }
.log-title strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-summary { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line; }
.log-item.open .log-summary { -webkit-line-clamp: unset; display: block; }
.log-detail { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 10px 0 2px; font-size: 12px; }
.log-detail dt { color: var(--muted-2); }
.log-detail dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; word-break: break-all; }
.log-side { display: grid; justify-items: end; gap: 3px; color: var(--muted-2); font-size: 12px; white-space: nowrap; }
.log-cat { color: var(--muted); }
.log-pane .empty-state { margin: 24px 0 18px; }

/* Settings → Log channels */
.lc { display: grid; gap: 4px; }
.lc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.lc-head .section-title { margin-bottom: 4px; }
.lc-head .muted { margin: 0; font-size: 13px; }
.lc-suggest, .lc-create { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.lc-suggest p, .lc-create p { margin: 0; }
.lc-create { display: grid; gap: 4px; background: var(--surface-elevated); margin-top: 12px; }
.lc-create code { margin-right: 6px; padding: 2px 6px; border-radius: 6px; background: var(--bg-elevated); font-size: 12px; }
.lc-group { display: grid; gap: 2px; margin-top: 12px; }
.lc-group-title { margin: 0 0 4px 2px; color: var(--muted-2); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.lc-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(220px, 300px) 64px; gap: 14px; align-items: center; padding: 10px 10px; border-radius: 10px; }
.lc-row:hover { background: var(--surface-elevated); }
.lc-general { background: var(--surface-elevated); }
.lc-text { display: grid; gap: 2px; min-width: 0; }
.lc-text strong { font-size: 13.5px; font-weight: 600; }
.lc-text small { color: var(--muted); font-size: 12px; }
.lc-pick { display: grid; gap: 4px; min-width: 0; }
.lc-pick select { width: 100%; height: 36px; padding-top: 0; padding-bottom: 0; line-height: 34px; }
.lc-uses { color: var(--muted-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-fallback .lc-uses { color: var(--muted-2); }
.lc-row:not(.lc-fallback):not(.lc-general) .lc-uses { color: var(--muted); }
.lc-missing .lc-uses { color: var(--bad); }
.lc-test { justify-self: end; }
.lc-save { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; padding-top: 14px; }
.lc-save .state-chip { margin-right: auto; }
@media (max-width: 1000px) {
  .log-layout { grid-template-columns: minmax(0, 1fr); }
  .log-folders { position: static; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .log-folder-group { display: flex; gap: 2px; }
  .log-folder-title { display: none; }
  .log-folder { width: auto; flex: none; }
  .lc-row { grid-template-columns: 28px minmax(0, 1fr); }
  .lc-pick, .lc-test { grid-column: 2; justify-self: start; }
}

/* DES-39 v2 · event filters (Activity) and per-event switches (Settings). */
.log-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 10px 0 2px; }
.log-filter { display: grid; gap: 4px; min-width: 200px; color: var(--muted-2); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.log-filter select { height: 34px; padding-top: 0; padding-bottom: 0; line-height: 32px; font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.log-event { color: var(--muted-2); font-size: 11.5px; }
.lc-events { margin: -4px 0 6px 52px; }
.lc-events-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.lc-events-toggle:hover, .lc-events.open .lc-events-toggle { background: var(--surface-elevated); color: var(--text); }
.lc-events-toggle em { font-style: normal; color: var(--muted-2); }
.lc-events-toggle b { font-weight: 400; color: var(--muted-2); }
.lc-new { padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 10.5px; font-style: normal; font-weight: 600; letter-spacing: 0.02em; }
.lc-ev-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 14px; padding: 8px 4px 4px; }
.lc-ev { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.lc-ev:hover { background: var(--surface-elevated); }
.lc-ev.off .lc-ev-text strong { color: var(--muted); }
.lc-ev-text { display: grid; gap: 1px; min-width: 0; }
.lc-ev-text strong { font-size: 13px; font-weight: 600; }
.lc-ev-text small { color: var(--muted-2); font-size: 11.5px; line-height: 1.35; }
.ce-switch.small { margin-top: 1px; }
@media (max-width: 1000px) { .lc-events { margin-left: 0; } }
