/* Raven control panel — one stylesheet, no build step. */

:root {
  --bg: #0b0c10;
  --bg-soft: #101219;
  --panel: #15171f;
  --panel-2: #1b1e28;
  --panel-3: #232733;
  --line: #2a2f3c;
  --line-soft: #20242f;
  --text: #e9ecf3;
  --muted: #949bab;
  --faint: #6a7285;

  --accent: #5865f2;
  --accent-soft: #7481ff;
  --accent-dim: rgba(88, 101, 242, .16);
  --green: #3fb96a;
  --yellow: #e8a020;
  --orange: #ef7a34;
  --red: #ed4245;
  --pink: #eb459e;

  /* Discord's link blue vibrates against this background; a soft indigo in
     the accent family reads as a link without shouting. */
  --link: #9aa9ff;
  --link-hover: #c2ccff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 22px rgba(0, 0, 0, .34);
  --shadow-lg: 0 26px 68px rgba(0, 0, 0, .58);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 560px at 10% -10%, rgba(88, 101, 242, .14), transparent 60%),
    radial-gradient(900px 460px at 92% -4%, rgba(235, 69, 158, .06), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.grow { flex: 1; min-width: 0; }
.error { color: var(--red); }
.ok-text { color: var(--green); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
h2 em, label em { font-style: normal; font-weight: 400; }

a { color: var(--link); text-decoration: none; border-bottom: 1px solid rgba(154, 169, 255, .28); }
a:hover { color: var(--link-hover); border-bottom-color: currentColor; }
a.plain { border-bottom: none; }

/* Fields that hide their content without being a password input — which is
   exactly what keeps password managers from noticing them. */
.masked { -webkit-text-security: disc; text-security: disc; letter-spacing: .08em; }
.masked.revealed { -webkit-text-security: none; text-security: none; letter-spacing: normal; }

/* --------------------------------------------------------------- icons */
.ic {
  width: 1.34em; height: 1.34em;
  flex: none;
  vertical-align: -.24em;
  stroke: currentColor;
  fill: none;
  /* An icon is never the thing you clicked — the button around it is. */
  pointer-events: none;
}
button .ic, .seg .ic, .nav-link .ic, .badge .ic, .pill .ic { margin-right: 0; }
button, .seg, .nav-link { display: inline-flex; align-items: center; gap: 7px; }
.badge, .pill { display: inline-flex; align-items: center; gap: 5px; }
h2[data-icon] { display: flex; align-items: center; gap: 8px; }
h2[data-icon] .ic { color: var(--accent-soft); width: 1.2em; height: 1.2em; }

/* ---------------------------------------------------------------- gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate-card { width: min(390px, 92vw); text-align: center; box-shadow: var(--shadow-lg); padding: 26px 24px 22px; }
.gate-mark {
  width: 54px; height: 54px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--accent), #8b5cf6);
  box-shadow: 0 8px 26px rgba(88, 101, 242, .4);
}
.gate-mark .ic { width: 33px; height: 33px; color: #fff; }
/* The refusal page: same card, unmistakably not the same outcome. */
.gate-mark.denied {
  background: linear-gradient(140deg, var(--red), #8b1d1f);
  box-shadow: 0 8px 26px rgba(237, 66, 69, .38);
}
.denied-who {
  display: flex; align-items: center; gap: 11px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 13px; margin: 16px 0;
}
.denied-who img { border-radius: 50%; background: var(--panel-3); }
.denied-who div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.denied-who code { word-break: break-all; }
.gate-card h1 { margin: 12px 0 4px; font-size: 24px; letter-spacing: -.4px; }
.gate-card input { width: 100%; margin: 18px 0 12px; text-align: center; }
.block { width: 100%; }
button.block { justify-content: center; }

/* -------------------------------------------------------------- layout */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 11px 22px;
  background: rgba(14, 16, 22, .86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}

.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, var(--accent), #8b5cf6);
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(88, 101, 242, .38);
}
.brand-mark .ic { width: 22px; height: 22px; color: #fff; }
.head-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ------------------------------------------------------------- sidebar */
#sidebar {
  width: 254px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: rgba(13, 15, 20, .92);
  border-right: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px; font-size: 15px;
  padding: 16px 16px 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.sidebar-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-brand small { font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-close-btn { display: none; margin-left: auto; }

#nav-groups { padding: 10px 8px 18px; display: flex; flex-direction: column; gap: 2px; }

.nav-group-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; color: var(--muted);
  padding: 9px 10px; cursor: pointer; font: inherit;
  font-weight: 650; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  border-radius: 9px; text-align: left;
  transition: color .13s, background .13s;
}
.nav-group-head:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-group.has-active > .nav-group-head { color: var(--accent-soft); }
.nav-group-chevron { flex: none; width: 15px; height: 15px; color: var(--faint); transition: transform .16s; }
.nav-group.open .nav-group-chevron { transform: rotate(180deg); }

.nav-group-items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .17s ease;
  overflow: hidden;
}
.nav-group.open .nav-group-items { grid-template-rows: 1fr; }
.nav-group-items-inner {
  overflow: hidden; min-height: 0;
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 4px 6px 21px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-radius: 9px;
  color: var(--muted); padding: 8px 10px;
  cursor: pointer; font: inherit; white-space: nowrap;
  transition: color .13s, background .13s;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav-link.active { color: #fff; background: var(--accent-dim); }
.nav-link .ic { opacity: .8; }
.nav-link.active .ic { color: var(--accent-soft); opacity: 1; }

#sidebar-backdrop { display: none; }

@media (max-width: 880px) {
  #sidebar-toggle { display: inline-flex !important; }
  .sidebar-close-btn { display: inline-flex; }
  #sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(0, 0, 0, .5);
  }
}

#sidebar-toggle { display: none; margin-right: auto; }

main { padding: 22px; max-width: 1240px; margin: 0 auto; width: 100%; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

/* --------------------------------------------------------------- cards */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 19px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.compact { padding: 14px 18px; }
.card > h2 { margin: 0 0 10px; font-size: 14px; font-weight: 650; letter-spacing: .2px; }
.card > h2:only-child, .row h2 { margin-bottom: 0; }
.card-head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }

.hero { padding: 18px 20px; }
.hero-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-mark {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--panel-3); border: 1px solid var(--line);
}
.hero-mark .ic { width: 27px; height: 27px; }
.hero.up .hero-mark { background: rgba(63, 185, 106, .14); border-color: rgba(63, 185, 106, .45); color: #62d68a; }
.hero.down .hero-mark { background: rgba(237, 66, 69, .13); border-color: rgba(237, 66, 69, .45); color: #ff8b8d; }
.hero-title { flex: 1; min-width: 200px; }
.hero-title strong { display: block; font-size: 17px; letter-spacing: -.2px; line-height: 1.35; }
.hero-title span { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.hero-title code { font-size: 11.5px; }
.hero-stats { display: flex; gap: 8px; flex-wrap: wrap; }
#bot-card.down { border-color: rgba(237, 66, 69, .4); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 17px;
  display: flex; gap: 13px; align-items: center;
  transition: border-color .14s;
}
.tile:hover { border-color: var(--line); }
.tile .tile-icon {
  width: 42px; height: 42px; flex: none; border-radius: 11px; display: grid; place-items: center;
  background: var(--panel-3); border: 1px solid var(--line-soft); color: var(--accent-soft);
}
.tile .tile-icon .ic { width: 24px; height: 24px; }
/* Label above value, both on their own line — as <span>s they would otherwise
   run together into "RECORDS12". */
.tile-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.tile .value {
  display: block;
  font-size: 21px; font-weight: 650; letter-spacing: -.4px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile .label {
  display: block;
  color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600;
  line-height: 1.4;
  overflow-wrap: break-word;
  white-space: normal;
}
.tile.good .tile-icon { color: #62d68a; background: rgba(63, 185, 106, .12); border-color: rgba(63, 185, 106, .3); }
.tile.bad .tile-icon { color: #ff8b8d; background: rgba(237, 66, 69, .1); border-color: rgba(237, 66, 69, .3); }
/* A yes/no tile value: a short badge instead of a word competing with the
   label for the same 160px, so it never truncates. */
.tile-badge { align-self: flex-start; font-size: 11.5px; padding: 3px 9px 3px 7px; gap: 5px; }
.tile-badge .ic { width: 13px; height: 13px; }

/* ------------------------------------------------------------ controls */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 9px 0; }
.row:last-child { margin-bottom: 0; }

input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font: inherit;
  outline: none;
  transition: border-color .13s, box-shadow .13s;
  max-width: 100%;
  /* One shared height for every control type, so a row mixing text, number
     and color inputs does not visibly step up and down. */
  min-height: 34px;
  box-sizing: border-box;
}
textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, .16);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=color] { padding: 3px; width: 46px; cursor: pointer; }
input[type=number] { max-width: 130px; }

.field { display: block; margin: 11px 0; }
.field > span:first-child {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
  /* A control label describes one setting, not a sentence - let it stay on
     one line and trim with an ellipsis rather than wrap and push the control
     below it down unevenly next to a shorter neighbour. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field > input, .field > select, .field > textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  cursor: pointer;
  font: inherit;
  transition: border-color .13s, background .13s, transform .08s, color .13s;
  white-space: nowrap;
}
button:hover { border-color: var(--accent); background: var(--panel-3); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }
button.primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
button.danger { background: transparent; border-color: rgba(237, 66, 69, .5); color: #ff8b8d; }
button.danger:hover { background: rgba(237, 66, 69, .14); border-color: var(--red); }
button.warn { border-color: rgba(232, 160, 32, .5); color: #f5c069; }
button.warn:hover { background: rgba(232, 160, 32, .13); }
button.ghost { background: none; }
button.small { padding: 4px 9px; font-size: 12px; gap: 5px; }
button.small .ic { width: 16px; height: 16px; }
button.icon-only { padding: 7px 8px; }
button.reveal { padding: 8px 10px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.pill { padding: 4px 11px; }

/* ------------------------------------------------------------ dropdown */
/* The native select stays as the source of truth, hidden behind the
   custom control that renders in its place. */
select.rv-native {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0; padding: 0; border: 0;
}
.rv-select {
  display: inline-flex; align-items: center; gap: 9px; justify-content: space-between;
  min-width: 150px; width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 12px;
  cursor: pointer;
  user-select: none;
  transition: border-color .13s, background .13s;
}
.field > .rv-select { width: 100%; }
/* Inside a flex row it has to behave like the input it replaced: grow into
   the free space, but never push the button next to it onto its own line. */
.row > .rv-select { width: auto; flex: 1 1 160px; }
.head-right > .rv-select { width: auto; flex: 0 0 auto; max-width: 230px; }
.rv-select:hover { border-color: var(--panel-3); background: var(--panel-3); }
.rv-select:focus-visible, .rv-select.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, .16);
  outline: none;
}
.rv-select.disabled { opacity: .55; cursor: not-allowed; }
.rv-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-value.placeholder { color: var(--faint); }
.rv-caret { width: 15px; height: 15px; color: var(--faint); transition: transform .16s; }
.rv-select.open .rv-caret { transform: rotate(180deg); color: var(--accent-soft); }

.rv-menu {
  position: fixed;
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: pop .12s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.rv-menu-search { padding: 8px; border-bottom: 1px solid var(--line-soft); }
.rv-menu-search input { width: 100%; padding: 6px 10px; font-size: 13px; }
/* `overscroll-behavior` keeps the page behind the menu from scrolling once
   the list hits its end. */
.rv-menu-list { overflow-y: auto; overscroll-behavior: contain; padding: 5px; }
.rv-option {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.rv-option-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.rv-value { display: inline-flex; align-items: center; gap: 8px; }
.rv-option-group { color: var(--faint); font-size: 11px; margin-left: 6px; font-style: normal; }
.rv-option-tick { width: 15px; height: 15px; opacity: 0; color: var(--accent-soft); }
.rv-option.selected .rv-option-tick { opacity: 1; }
.rv-option.active, .rv-option:hover { background: var(--panel-3); }
.rv-option.selected { color: #fff; }
.rv-option.disabled { opacity: .45; cursor: not-allowed; }
.rv-menu-empty { padding: 12px; color: var(--faint); font-size: 12px; text-align: center; }

/* Modern toggle — replaces the old checkboxes everywhere. */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 38px; height: 21px; border-radius: 999px;
  background: var(--panel-3); border: 1px solid var(--line);
  position: relative; flex: none; transition: background .18s, border-color .18s;
}
.toggle .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--faint); transition: transform .18s, background .18s;
}
.toggle input:checked + .track { background: rgba(88, 101, 242, .28); border-color: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(17px); background: var(--accent-soft); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(88, 101, 242, .22); }
.toggle.green input:checked + .track { background: rgba(63, 185, 106, .26); border-color: var(--green); }
.toggle.green input:checked + .track::after { background: var(--green); }

.segmented {
  display: flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 14px; overflow-x: auto;
}
.seg {
  background: none; border: none; color: var(--muted);
  padding: 7px 13px; border-radius: 9px; font-size: 13px;
}
.seg .ic { width: 17px; height: 17px; }
.seg em { font-style: normal; font-size: 11px; color: var(--faint); background: var(--panel-3); padding: 1px 6px; border-radius: 999px; }
.seg:hover { color: var(--text); background: var(--panel-2); border-color: transparent; }
.seg.active { background: var(--accent); color: #fff; }
.seg.active em { background: rgba(0, 0, 0, .25); color: #fff; }

/* --------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.item {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  transition: border-color .13s, background .13s;
}
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--panel-3); border-color: var(--line); border-left-color: var(--accent); }
.item.removed { opacity: .5; }
.item .head { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 3px; }
.item .actions { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.item .meta { color: var(--faint); font-size: 11.5px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item .meta .ic { width: 15px; height: 15px; }
.item .body { word-break: break-word; }

.sev-low { border-left-color: var(--green); }
.sev-medium { border-left-color: var(--yellow); }
.sev-high { border-left-color: var(--orange); }
.sev-critical { border-left-color: var(--red); }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.badge.sev { border-color: color-mix(in srgb, var(--sev) 45%, transparent); }

.empty { padding: 30px 14px; text-align: center; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty .ic.big { width: 34px; height: 34px; opacity: .5; margin-bottom: 4px; }
.empty strong { font-weight: 550; color: var(--muted); }
.empty span { font-size: 12px; }

.pill {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
}
.pill .ic { width: 16px; height: 16px; }
.pill.ok { border-color: rgba(63, 185, 106, .5); color: #62d68a; background: rgba(63, 185, 106, .1); }
.pill.bad { border-color: rgba(237, 66, 69, .5); color: #ff8b8d; background: rgba(237, 66, 69, .1); }
.pill.warn { border-color: rgba(232, 160, 32, .5); color: #f5c069; background: rgba(232, 160, 32, .1); }

.pill.live { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pill.live.up .dot { background: var(--green); animation: pulse 2s ease-in-out infinite; }
.pill.live.down .dot { background: var(--red); }
.pill.live.up { border-color: rgba(63, 185, 106, .5); color: #62d68a; }
.pill.live.down { border-color: rgba(237, 66, 69, .5); color: #ff8b8d; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 106, .7); }
  70% { box-shadow: 0 0 0 6px rgba(63, 185, 106, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .pill.live.up .dot, .flow-node, .drawer, .modal, .rv-menu { animation: none !important; transition: none !important; }
}

.badge {
  font-size: 10.5px; border-radius: 6px; padding: 2px 7px;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap; font-weight: 550;
}
.badge .ic { width: 12px; height: 12px; }
.badge.ai { border-color: rgba(88, 101, 242, .55); color: #aab2ff; background: rgba(88, 101, 242, .12); }
.badge.free { border-color: rgba(63, 185, 106, .5); color: #62d68a; background: rgba(63, 185, 106, .1); }
.badge.on { border-color: rgba(63, 185, 106, .5); color: #62d68a; }
.badge.off { border-color: var(--line); color: var(--faint); }
.badge.hot { border-color: rgba(237, 66, 69, .5); color: #ff8b8d; background: rgba(237, 66, 69, .1); }
.badge.wait { border-color: rgba(232, 160, 32, .5); color: #f5c069; background: rgba(232, 160, 32, .1); }

.results { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.result {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 13px 5px 5px; cursor: pointer;
  transition: border-color .13s;
}
.result:hover { border-color: var(--accent); }
.result img { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-3); }
.result.selected { border-color: var(--accent); background: rgba(88, 101, 242, .14); }

/* A list whose choices no longer apply — "every server" makes the picker moot. */
.dimmed { opacity: .38; pointer-events: none; filter: saturate(.4); }

/* A checkbox with its label, aligned the same way everywhere it appears
   (the scope matrix, and anywhere else that wants a plain labelled tick). */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }

/* ------------------------------------------------------------ scope matrix */
.scope-group { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; }
.scope-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scope-group-body {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
}
.scope-item span { color: var(--muted); }

/* The avatar in front of a name in a list row (Access). */
.row-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--panel-3); }

.warn-box {
  background: rgba(232, 160, 32, .1);
  border: 1px solid rgba(232, 160, 32, .4);
  color: #f5c069; border-radius: var(--radius-sm);
  padding: 10px 13px; margin: 0 0 12px; font-size: 13px;
  display: flex; align-items: flex-start; gap: 9px;
}
.info-box {
  background: rgba(88, 101, 242, .09);
  border: 1px solid rgba(88, 101, 242, .32);
  border-radius: var(--radius-sm); padding: 10px 13px; margin: 10px 0; font-size: 13px;
}

pre {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px; overflow-x: auto;
  font-size: 12px; margin: 8px 0 0; font-family: ui-monospace, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
code { font-family: ui-monospace, Consolas, monospace; font-size: 92%; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
tr:last-child td { border-bottom: none; }
th { color: var(--faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; }
.bar { height: 5px; border-radius: 999px; background: var(--panel-3); overflow: hidden; min-width: 60px; display: block; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); }

/* --------------------------------------------------------- statistics */
.chart-box { position: relative; height: 260px; margin-top: 10px; }
.chart-box.small { height: 230px; }

/* ------------------------------------------------------------- help "?" */
/* `button.icon-only` (element+class, specificity 0,1,1) otherwise beats
   `.help-btn` (class only, 0,1,0) regardless of source order, so its
   `padding: 7px 8px` won — with box-sizing: border-box and a 23px box, that
   left only ~7px of the icon actually inside the circle (the rest ran below
   it) while the round hover background stayed pinned to the button's real
   position, reading as offset up-left from the visible, clipped icon.
   `button.help-btn` matches that specificity so this rule reliably wins. */
button.help-btn {
  width: 24px; height: 24px; padding: 0; margin-left: 2px; flex: none;
  display: grid; place-items: center; box-sizing: border-box;
  border-radius: 50%; color: var(--faint); border-color: transparent; background: none;
}
.help-btn .ic { width: 15px; height: 15px; margin: 0; }
.help-btn:hover { color: var(--accent-soft); background: var(--accent-dim); }

.help-section { margin-top: 16px; }
.help-section:first-of-type { margin-top: 2px; }
.help-section h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--faint); margin: 0 0 8px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
}
.help-section h3::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.help-body { font-size: 13.5px; line-height: 1.65; color: var(--text); }
.help-body p { margin: 0 0 8px; }
.help-body p:last-child { margin-bottom: 0; }
.help-body ul { margin: 0 0 8px 18px; padding: 0; }
.help-body ul:last-child { margin-bottom: 0; }
.help-body code { color: var(--accent-soft); }

/* ---------------------------------------------------------- automod ui */
.rule-group-title {
  display: flex; align-items: center; gap: 9px;
  margin: 20px 2px 10px; font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .8px; color: var(--faint);
}
.rule-group-title::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.rule {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.rule.on { border-color: rgba(88, 101, 242, .32); }
.rule-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 17px; cursor: pointer; user-select: none;
}
.rule-head:hover { background: rgba(255, 255, 255, .022); }
.rule-icon {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--muted);
}
.rule-icon .ic { width: 20px; height: 20px; }
.rule.on .rule-icon { background: var(--accent-dim); border-color: rgba(88, 101, 242, .4); color: var(--accent-soft); }
.rule-title { flex: 1; min-width: 0; }
.rule-title strong { display: block; font-size: 14px; font-weight: 600; }
.rule-title span { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.rule-chevron { color: var(--faint); transition: transform .18s; width: 15px; height: 15px; }
.rule.open .rule-chevron { transform: rotate(90deg); }
.rule-body { padding: 0 17px 15px; border-top: 1px solid var(--line-soft); }
.rule-body > .field-row:first-child { margin-top: 13px; }
.rule-config { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-soft); }
.rule-config-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin-bottom: 8px; font-weight: 600; }
.rule-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.rule-toggles { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }

/* ladder */
.ladder-step {
  display: grid;
  grid-template-columns: 84px 1fr 1fr 1fr auto;
  gap: 9px; align-items: end;
  padding: 10px; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); background: var(--panel-2); margin-bottom: 7px;
}
.ladder-step .field { margin: 0; }
/* Kick and a permanent ban have no duration, but hiding that field with
   `display:none` would pull DO and SEVERITY one column to the left for just
   those rows — `visibility:hidden` keeps every row's columns lined up. */
.ladder-step .field.hidden[data-duration-field] { display: block !important; visibility: hidden; }
@media (max-width: 760px) { .ladder-step { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------- flow builder */
.flow-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.flow-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 9px;
  transition: border-color .14s, transform .14s;
}
.flow-card:hover { border-color: rgba(88, 101, 242, .4); transform: translateY(-1px); }
.flow-card.off { opacity: .62; }
.flow-card h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.flow-card h3 .ic { color: var(--accent-soft); }
.flow-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.flow-foot { display: flex; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

.builder { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .builder { grid-template-columns: 1fr; } }

.flow-canvas {
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .05) 1px, transparent 0) 0 0 / 20px 20px,
    var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  max-height: 68vh;
  overflow-y: auto;
}

.flow-node {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 15px;
  position: relative;
  box-shadow: var(--shadow);
}
.flow-node.trigger { border-color: rgba(88, 101, 242, .5); box-shadow: 0 0 0 1px rgba(88, 101, 242, .16), var(--shadow); }
.flow-node.condition { border-color: rgba(232, 160, 32, .38); }
.flow-node.action { border-color: rgba(63, 185, 106, .34); }
.flow-node-head { display: flex; align-items: center; gap: 10px; }
.flow-node-head .icon {
  width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: var(--panel-3); border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.flow-node-head .icon .ic { width: 19px; height: 19px; }
.flow-node.trigger .icon { background: rgba(88, 101, 242, .2); border-color: rgba(88, 101, 242, .45); color: var(--accent-soft); }
.flow-node.condition .icon { background: rgba(232, 160, 32, .16); border-color: rgba(232, 160, 32, .4); color: #f5c069; }
.flow-node.action .icon { background: rgba(63, 185, 106, .15); border-color: rgba(63, 185, 106, .4); color: #62d68a; }
.flow-node-head .title { flex: 1; min-width: 0; }
.flow-node-head .title strong { display: block; font-size: 13.5px; }
.flow-node-head .title span { font-size: 11.5px; color: var(--muted); }
.flow-node-head .tools { display: flex; gap: 4px; align-items: center; }
.flow-node-options { margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--line-soft); }

.flow-kind {
  font-size: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--faint); margin: 0 0 8px 2px;
}
.flow-connector { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 3px 0; }
.flow-connector .line { width: 2px; height: 14px; background: linear-gradient(var(--line), var(--accent)); }
.flow-connector .arrow { color: var(--accent); font-size: 11px; line-height: 1; }
.flow-connector .arrow .ic { width: 16px; height: 16px; }

.flow-group {
  border: 1px dashed rgba(232, 160, 32, .4);
  border-radius: 13px; padding: 11px; background: rgba(232, 160, 32, .035);
}
.flow-group + .flow-group { margin-top: 9px; }
.flow-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.flow-group .flow-node { margin-bottom: 7px; }
.flow-group .flow-node:last-child { margin-bottom: 0; }

.match-switch { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.match-switch button { background: none; border: none; padding: 3px 11px; font-size: 11.5px; border-radius: 6px; color: var(--muted); }
.match-switch button.on { background: var(--accent); color: #fff; }

.subject-switch { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.subject-switch button { background: none; border: none; padding: 3px 10px; font-size: 11px; border-radius: 6px; color: var(--muted); }
.subject-switch button.on { background: var(--panel-3); color: var(--text); }
/* This trigger has only one person — the switch still works, but it is not
   worth drawing attention to. */
.subject-switch.single { opacity: .6; }

/* Who is who for the selected trigger, spelled out under it — the words
   "actor" and "target" mean nothing without this. */
.subject-legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px;
  margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line-soft);
}
.subject-legend div { display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; }
.subject-legend b {
  flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--accent-soft); background: var(--accent-dim);
  border-radius: 5px; padding: 1px 6px;
}
.subject-legend span { color: var(--muted); }
.subject-hint { color: var(--accent-soft); }
.subject-hint.muted { color: var(--faint); }

/* placeholder reference */
.placeholder-group { margin-bottom: 14px; }
.placeholder-group:last-child { margin-bottom: 0; }
.placeholder {
  display: block; width: 100%; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 7px 10px; margin-bottom: 5px; cursor: pointer;
  white-space: normal;
}
.placeholder:hover { border-color: var(--accent); background: var(--panel-3); }
.placeholder code { display: block; color: var(--accent-soft); font-size: 12px; }
.placeholder span { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 2px; white-space: normal; }
.placeholder em { display: block; color: var(--faint); font-size: 10.5px; font-style: normal; margin-top: 3px; }
.placeholder em::before { content: '→ '; }
.placeholder.off { opacity: .45; }
.placeholder.off code { color: var(--muted); }

.picker-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 12px;
}
.chip b { font-weight: 500; }
.chip .x { cursor: pointer; color: var(--faint); padding: 0 3px; border-radius: 50%; display: inline-flex; }
.chip .x .ic { width: 13px; height: 13px; }
.chip .x:hover { color: var(--red); background: rgba(237, 66, 69, .14); }
.chip.role { border-color: currentColor; }
.chip-add { border-style: dashed; cursor: pointer; padding: 3px 11px; color: var(--muted); }
.chip-add:hover { border-color: var(--accent); color: var(--text); }

.catalog-groups { display: flex; flex-direction: column; gap: 16px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 7px; }
.catalog-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); cursor: pointer;
}
.catalog-item:hover { border-color: var(--accent); background: var(--panel-3); }
.catalog-item .icon { flex: none; color: var(--accent-soft); display: inline-flex; }
.catalog-item .icon .ic { width: 20px; height: 20px; }
.catalog-item div { min-width: 0; }
.catalog-item strong { display: block; font-size: 13px; font-weight: 550; }
.catalog-item span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------- message builder */
.msg-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .msg-builder { grid-template-columns: 1fr; } }

.dc-preview {
  background: #313338;
  border: 1px solid #232428;
  border-radius: var(--radius);
  padding: 16px;
  font-family: "gg sans", "Segoe UI", system-ui, sans-serif;
  color: #dbdee1;
  font-size: 15px;
  line-height: 1.375;
  overflow-x: auto;
}
.dc-msg { display: flex; gap: 15px; }
.dc-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, var(--accent), #8b5cf6);
  display: grid; place-items: center; color: #fff;
}
.dc-avatar .ic { width: 21px; height: 21px; }
.dc-content { min-width: 0; flex: 1; }
.dc-author { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.dc-name { color: #f2f3f5; font-weight: 500; font-size: 15px; }
.dc-bot-tag {
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 600;
  padding: 1px 4px; border-radius: 3px; text-transform: uppercase; letter-spacing: .2px;
}
.dc-time { color: #949ba4; font-size: 12px; }
.dc-text { white-space: pre-wrap; word-wrap: break-word; }
.dc-text a { color: #00a8fc; text-decoration: none; border-bottom: none; }
.dc-text a:hover { text-decoration: underline; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.dc-text code { background: #1e1f22; border-radius: 3px; padding: .2em .3em; font-size: 85%; font-family: ui-monospace, Consolas, monospace; }
.dc-text pre { background: #1e1f22; border: 1px solid #2b2d31; border-radius: 4px; padding: 8px; margin: 6px 0; font-size: 13px; }
.dc-text blockquote { border-left: 4px solid #4e5058; margin: 3px 0; padding-left: 10px; }
.dc-text h1, .dc-text h2, .dc-text h3 { margin: 8px 0 4px; color: #f2f3f5; }
.dc-text h1 { font-size: 20px; } .dc-text h2 { font-size: 17px; } .dc-text h3 { font-size: 15px; }
.dc-spoiler { background: #202225; color: transparent; border-radius: 3px; cursor: pointer; }
.dc-spoiler.shown { background: rgba(255,255,255,.08); color: inherit; }

.dc-embed {
  display: grid; grid-template-columns: auto 1fr; max-width: 520px;
  background: #2b2d31; border-radius: 4px; margin-top: 8px;
  border-left: 4px solid var(--accent); overflow: hidden;
}
.dc-embed-inner { padding: 8px 16px 16px 12px; display: flex; gap: 12px; grid-column: 1 / -1; }
.dc-embed-main { flex: 1; min-width: 0; }
.dc-embed-author { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-embed-author img { width: 24px; height: 24px; border-radius: 50%; }
.dc-embed-title { margin-top: 8px; font-size: 16px; font-weight: 600; color: #f2f3f5; }
.dc-embed-title a { color: #00a8fc; text-decoration: none; border-bottom: none; }
.dc-embed-desc { margin-top: 8px; font-size: 14px; color: #dbdee1; white-space: pre-wrap; }
.dc-embed-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.dc-embed-field { grid-column: span 3; min-width: 0; }
.dc-embed-field.inline { grid-column: span 1; }
.dc-embed-field .n { font-size: 14px; font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.dc-embed-field .v { font-size: 14px; white-space: pre-wrap; }
.dc-embed-img { margin-top: 12px; border-radius: 4px; max-width: 100%; display: block; }
.dc-embed-thumb { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; flex: none; margin-top: 8px; }
.dc-embed-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #949ba4; }
.dc-embed-footer img { width: 20px; height: 20px; border-radius: 50%; }

.dc-container {
  max-width: 560px; margin-top: 8px; background: #2b2d31;
  border-radius: 8px; border-left: 4px solid var(--accent); padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.dc-sep { height: 1px; background: #3f4147; margin: 4px 0; }
.dc-sep.large { margin: 12px 0; }
.dc-sep.invisible { background: none; }
.dc-section { display: flex; gap: 12px; align-items: flex-start; }
.dc-section .body { flex: 1; min-width: 0; }
.dc-section img.thumb { width: 68px; height: 68px; border-radius: 6px; object-fit: cover; flex: none; }

.dc-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dc-btn {
  border-radius: 3px; padding: 2px 16px; height: 32px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: #fff; border: none;
}
.dc-btn.primary { background: #5865f2; }
.dc-btn.secondary { background: #4e5058; }
.dc-btn.success { background: #248046; }
.dc-btn.danger { background: #da373c; }
.dc-btn.link { background: #4e5058; }
.dc-btn.disabled { opacity: .5; }

.builder-block {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; margin-bottom: 8px; background: var(--panel-2);
}
.builder-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.builder-block-head strong { flex: 1; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); }

/* --------------------------------------------------- bot profile card */
.bot-live-card {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  width: min(320px, 100%); background: var(--panel-2);
}
.bot-live-banner { height: 76px; }
.bot-live-body { padding: 0 14px 14px; }
.bot-live-avatar {
  width: 66px; height: 66px; border-radius: 50%; margin-top: -33px;
  border: 5px solid var(--panel-2); background: var(--panel-3);
  display: grid; place-items: center; color: var(--muted);
}
.bot-live-avatar .ic { width: 30px; height: 30px; }
.bot-live-body strong { display: block; margin-top: 8px; }

/* ---------------------------------------------------- drawer & modal */
.drawer {
  position: fixed; inset: 0 0 0 auto;
  width: min(640px, 100vw);
  background: linear-gradient(180deg, var(--panel), var(--bg));
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 60; overflow-y: auto;
  animation: slide-in .2s ease;
}
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } }
.drawer-body { padding: 20px 22px 40px; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.drawer-head h2 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 9px; }
.drawer-close { margin-left: auto; }
.drawer h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--faint); margin: 20px 0 8px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
}
.drawer h3::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.kv { display: grid; grid-template-columns: 148px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; word-break: break-word; }

.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 6px; }
.action-grid button { width: 100%; justify-content: flex-start; }

#modal-stack { position: fixed; inset: 0; z-index: 70; }
#modal-stack.hidden { display: none; }
.modal {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 22px;
  animation: fade-in .14s ease;
}
/* A stacked dialog dims what is behind it a little less — the builder
   underneath should stay readable while a picker is open. */
.modal + .modal { background: rgba(0, 0, 0, .45); }
@keyframes fade-in { from { opacity: 0; } }
.modal-body {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(1000px, 100%); max-height: 88vh; overflow-y: auto; padding: 22px;
  animation: rise .16s ease;
}
@keyframes rise { from { transform: translateY(8px); opacity: .6; } }
.modal-body.narrow { width: min(560px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.modal-head h2 { margin: 0; font-size: 18px; flex: 1; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent);
  padding: 11px 18px; border-radius: 12px; z-index: 90;
  box-shadow: var(--shadow-lg); max-width: min(560px, 92vw);
  display: flex; align-items: center; gap: 9px;
}
.toast .ic { width: 19px; height: 19px; color: var(--accent-soft); }
.toast.bad { border-color: var(--red); }
.toast.bad .ic { color: #ff8b8d; }
.toast.good { border-color: var(--green); }
.toast.good .ic { color: #62d68a; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #333846; }

/* ------------------------------------------------------- feature pages */
/*
   The twelve feature pages are drawn from a schema, so they share four
   shapes: a list of editable cards, a fixed group of switchable modules,
   a small icon button and a note. Everything else reuses .card and .field.
*/
.list-field { grid-column: 1 / -1; }
.list-field > span { display: block; margin-bottom: 6px; }
.list-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.group-field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }

.list-item {
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 11px; padding: 10px 12px;
}
.list-item.on { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.list-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item-head strong { font-size: 13.5px; }
.list-item-head .actions { margin-left: auto; display: flex; gap: 4px; }
.list-item-head .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-body { margin-top: 10px; }
.list-item-body.hidden { display: none; }

.icon-btn {
  padding: 4px; border-radius: 8px; background: transparent;
  border: 1px solid transparent; color: var(--faint);
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.danger:hover { color: #ff8b8d; border-color: rgba(237, 66, 69, .4); }
.icon-btn .ic { width: 17px; height: 17px; margin: 0; }

.field-note {
  grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-start;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 9px 11px; color: var(--muted); font-size: 12.5px;
}
.field-note .ic { width: 17px; height: 17px; flex: none; margin-top: 1px; }

.placeholder-help {
  font-size: 11.5px; color: var(--muted); line-height: 1.9;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px 11px;
}
.placeholder-help code {
  background: var(--panel-3); border-radius: 5px; padding: 1px 5px; font-size: 11px;
}

#who .ic { width: 15px; height: 15px; }
