:root {
  --red: #dd142c;
  --red-dim: #a50f21;
  --bg: #080b16;
  --surface: #0f1427;
  --raised: #161d35;
  --line: #243054;
  --text: #eef1f8;
  --muted: #8d99bb;
  --ok: #2fbf71;
  --warn: #e9a23b;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  /* The 2026 artwork is red on near-black; the glow echoes it without art. */
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(221, 20, 44, .20), transparent 70%),
    radial-gradient(760px 380px at 92% 0%, rgba(44, 62, 160, .22), transparent 70%);
  background-attachment: fixed;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(8, 11, 22, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-size: 16px; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.brand strong { color: var(--red); }
.mark {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 4px rgba(221, 20, 44, .18);
}
.eventpick { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.tabs { margin-left: auto; display: flex; gap: 4px; }
.tabs button {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 13px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.tabs button:hover { color: var(--text); background: var(--raised); }
.tabs button.on { color: var(--text); background: var(--raised); box-shadow: inset 0 -2px 0 var(--red); }

/* ---------- controls ---------- */
select, input[type="text"], input[type="search"], input[type="number"],
input[type="email"], input[type="password"], textarea {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 13px;
}
select:focus, input:focus, textarea:focus { outline: 2px solid rgba(221, 20, 44, .55); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; line-height: 1.5; }

button { font: inherit; cursor: pointer; border-radius: 8px; }
button.primary {
  background: var(--red); color: #fff; border: 1px solid var(--red);
  padding: 9px 18px; font-weight: 600;
}
button.primary:hover { background: var(--red-dim); }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); padding: 9px 14px;
}
button.ghost:hover { border-color: var(--red); }
button.sm { padding: 6px 11px; font-size: 12px; }
button.danger { background: transparent; border: 1px solid var(--red); color: var(--red); padding: 7px 12px; }

main { padding: 20px 22px 110px; }
.panel { display: none; }
.panel.on { display: block; }

h2 { font-size: 17px; margin: 0 0 4px; font-weight: 600; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
.sub { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; max-height: 74px; overflow-y: auto; padding-right: 4px; }
.pill {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.pill:hover { color: var(--text); }
.pill.on { background: var(--red); border-color: var(--red); color: #fff; }
.pill .n { opacity: .7; margin-left: 5px; }
.search { min-width: 240px; flex: 1; max-width: 360px; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }

/* ---------- grid ---------- */
.tablewrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 290px);
}
table.grid { width: 100%; border-collapse: collapse; }
.grid th {
  position: sticky; top: 0; z-index: 5; background: var(--raised);
  text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 11px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid td { padding: 10px; border-bottom: 1px solid rgba(36, 48, 84, .5); white-space: nowrap; }
.grid tbody tr:hover td { background: rgba(255, 255, 255, .025); }
.grid tbody tr.sel td { background: rgba(221, 20, 44, .1); }
.grid th.c, .grid td.c { text-align: center; width: 46px; }
.grid .name { font-weight: 500; }
.grid .co { color: var(--muted); font-size: 12.5px; }
.grid .mail { color: var(--muted); font-size: 12px; }

.dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  background: transparent; border: 2px solid var(--line); cursor: pointer; vertical-align: middle;
}
.dot:hover { border-color: var(--red); }
.dot.on { background: var(--ok); border-color: var(--ok); }
td .dash { color: #44507a; }
.legend { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 12px; padding: 12px 2px; flex-wrap: wrap; }
.legend .hint { margin-left: auto; }
.legend .dot { cursor: default; }

/* ---------- send bar ---------- */
.sendbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; gap: 12px; align-items: center;
  padding: 14px 22px;
  background: rgba(15, 20, 39, .97);
  border-top: 1px solid var(--red);
  backdrop-filter: blur(10px);
}

/* ---------- cards & forms ---------- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.card.pick { cursor: pointer; }
.card.pick:hover { border-color: var(--red); }
.card.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.card h4 { margin: 0 0 6px; font-size: 14px; }
.tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.tag.red { border-color: var(--red); color: #ff8494; }
.tag.draft { border-color: var(--warn); color: var(--warn); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.gap { margin-top: 12px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select { width: 100%; }
.grid2 { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(4, 6, 12, .74);
}
.modal .sheet {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  width: min(840px, 100%); max-height: 88vh; display: flex; flex-direction: column;
}
.modal header { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { flex: 1; }
.modal .x { background: none; border: none; color: var(--muted); font-size: 24px; line-height: 1; }
.modal .body { padding: 18px; overflow: auto; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- report lists ---------- */
.report { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 22px; font-weight: 600; }
.stat span { font-size: 11.5px; color: var(--muted); }
.stat.bad b { color: var(--red); }
.stat.warn b { color: var(--warn); }
.list { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.list div { padding: 8px 11px; border-bottom: 1px solid rgba(36, 48, 84, .5); font-size: 12.5px; display: flex; gap: 10px; align-items: center; }
.list div:last-child { border-bottom: none; }
.list .why { color: var(--warn); margin-left: auto; font-size: 11.5px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 86px; z-index: 80; display: grid; gap: 8px; }
.toast {
  background: var(--raised); border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: 8px; padding: 11px 15px; font-size: 13px; max-width: 420px;
}
.toast.bad { border-left-color: var(--red); }

/* ---------- builder ---------- */
.builder { display: grid; grid-template-columns: 150px 1fr 230px; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 460px; }
.palette { border-right: 1px solid var(--line); padding: 12px; background: var(--surface); }
.palette h5, .inspector h5 { margin: 0 0 9px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.palette button {
  display: block; width: 100%; margin-bottom: 5px; padding: 7px; font-size: 12px;
  background: transparent; border: 1px dashed var(--line); color: var(--text);
}
.palette button:hover { border-color: var(--red); border-style: solid; }
.canvas { padding: 14px; background: #0b1020; overflow: auto; max-height: 560px; }
.inspector { border-left: 1px solid var(--line); padding: 12px; background: var(--surface); overflow: auto; max-height: 560px; }
.node {
  position: relative; background: var(--raised); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 7px; cursor: pointer; font-size: 13px;
}
.node.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.node .kind { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: block; margin-bottom: 3px; }
.node .ops { position: absolute; top: 7px; right: 8px; display: flex; gap: 3px; }
.node .ops button { background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 11px; padding: 1px 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chips button { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; background: rgba(221,20,44,.14); border: 1px solid rgba(221,20,44,.4); color: #ff9aa6; }
.tabstrip { display: flex; gap: 4px; margin-bottom: 12px; }
.tabstrip button { padding: 7px 14px; font-size: 12.5px; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tabstrip button.on { background: var(--raised); color: var(--text); border-color: var(--red); }
.preview { background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.preview iframe { width: 100%; height: 620px; border: 0; border-radius: 8px; display: block; }

/* ---------- drop zone ---------- */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 34px; text-align: center; color: var(--muted); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.drop.hot { border-color: var(--red); background: rgba(221, 20, 44, .07); color: var(--text); }
.drop b { color: var(--text); display: block; margin-bottom: 5px; font-size: 15px; }

.steps { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.steps span { font-size: 11.5px; color: var(--muted); padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; }
.steps span.on { color: #fff; border-color: var(--red); background: var(--red); }

.maptable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
.maptable th, .maptable td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.maptable th { background: var(--raised); color: var(--muted); font-weight: 600; }
.maptable select { width: 100%; padding: 4px 6px; font-size: 12px; }

.bar { height: 7px; background: var(--raised); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .palette, .inspector { border: none; border-bottom: 1px solid var(--line); }
  .grid2 { grid-template-columns: 1fr; }
}

/* The hidden attribute must win over the display rules above. */
[hidden] { display: none !important; }

/* A table cell that opens the row's editor. */
.linky {
  background: none; border: none; padding: 0; font: inherit; font-weight: 500;
  color: var(--text); cursor: pointer; text-align: left;
  border-bottom: 1px dotted transparent;
}
.linky:hover { color: #ff8494; border-bottom-color: #ff8494; }
.modal .sheet .list .ghost.sm { flex: none; }

/* ---------- stage filter ---------- */
.stagerow { margin-top: -4px; }
.flabel {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600;
}
.pill .state {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; border: 1.5px solid currentColor;
}
.pill.has { border-color: var(--ok); color: var(--ok); background: rgba(47, 191, 113, .12); }
.pill.has .state { background: var(--ok); border-color: var(--ok); }
.pill.missing { border-color: var(--warn); color: var(--warn); background: rgba(233, 162, 59, .12); }
.pill.missing .state { background: transparent; border-color: var(--warn); }
.count { margin-left: auto; font-size: 12px; color: var(--muted); }
