:root {
  /* Matrix brand: black, white and greys; colour only for status. */
  --bg: #0a0a0a;
  --panel: #171717;
  --panel-2: #242424;
  --line: #3d3d3d;
  --text: #f5f5f5;
  --muted: #b0b0b0;
  --accent: #ffffff;
  --accent-2: #d9d9d9;
  --top: #000000;
  --ok: #34c77b;
  --warn: #f5a524;
  --danger: #ef3d5a;
  --bot: #2e2e2e;
  --page: #1f1f1f;
  --in: #202020;
  --radius: 10px;
  --display: "Archivo", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--text); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.btn { background: var(--accent); color: #000; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; background: var(--panel-2); border: 1px solid #555; border-radius: 8px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: #8a8a8a; }
select.inline { width: auto; max-width: 180px; padding: 4px 8px; font-size: 13px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Shell */
.shell { display: grid; grid-template-columns: 84px 1fr; grid-template-rows: 56px 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; background: var(--top); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.topbar .brand { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: -.2px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }
.nav { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px 6px; gap: 4px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 12px; }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav svg { width: 24px; height: 24px; }
.main { overflow: auto; min-width: 0; }
.page { padding: 20px; max-width: 1400px; }
.page h1 { font: 800 24px/1.1 var(--display); text-transform: uppercase; letter-spacing: -.3px; margin: 0 0 16px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 52px 1fr 60px; }
  .nav { grid-row: 3; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 4px; }
  .nav a { flex: 1; padding: 6px 2px; }
  .page { padding: 16px; }
}

/* Notices */
.notice { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px; }
.notice.error { border-left-color: var(--danger); }
.notice.ok { border-left-color: var(--ok); }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 40px 16px; text-align: center; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px;
  display: grid; gap: 12px; }
.login h1 { margin: 0 0 4px; font: 800 26px/1.1 var(--display); text-transform: uppercase; letter-spacing: -.3px; }

/* Channel cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; }
.card .head { display: flex; gap: 12px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.card .head img, .avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none;
  display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.card .title { font-size: 17px; color: var(--text); font-weight: 700; }
.card .sub { color: var(--muted); font-size: 13px; }
.card .count { margin-left: auto; background: var(--panel-2); border-radius: 999px; min-width: 28px; height: 28px; display: grid;
  place-items: center; font-size: 13px; padding: 0 8px; }
.card .foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
.card.add { align-items: center; justify-content: center; min-height: 150px; border-style: dashed; color: var(--text); text-decoration: none;
  font-weight: 600; gap: 6px; }
.card.add .plus { font-size: 32px; color: var(--muted); line-height: 1; }
.pill { font-size: 12px; border-radius: 999px; padding: 3px 9px; background: var(--panel-2); color: var(--muted); }
.pill.ok { color: var(--ok); }
.pill.off { color: var(--danger); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }

/* Pick pages */
.picklist { display: grid; gap: 8px; max-width: 640px; }
.pick { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); }
.pick img { width: 40px; height: 40px; border-radius: 50%; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.ok { color: var(--ok); }
.warn, .pill.warn { color: var(--warn); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h1 { margin: 0; }

.table { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tr.th { border-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.tr .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
@media (max-width: 760px) {
  .tr { grid-template-columns: 1fr 1fr; }
  .tr.th { display: none; }
  .tr .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .tr .clamp { grid-column: 1 / -1; }
}

.form { display: grid; gap: 14px; max-width: 640px; }
.form.wide { max-width: 980px; }
.form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.form label :is(input, select, textarea), .form label .muted { font-weight: 400; }
.form label.inline { display: flex; align-items: center; gap: 8px; }
.toggle.block { display: flex !important; gap: 10px; align-items: flex-start; color: var(--text); font-size: 14px; }
.toggle.block input { margin-top: 2px; flex: none; }
.toggle.big { font-size: 16px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; background: var(--panel); margin: 0; }
fieldset.killed { border-color: var(--danger); }
legend { padding: 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
fieldset h3 { margin: 10px 0 0; font-size: 15px; }
.buttons { display: flex; gap: 10px; align-items: center; }
.buttons.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }

/* Group Leads */
textarea { width: 100%; background: var(--panel-2); border: 1px solid #555; border-radius: 8px; padding: 10px 12px; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; color: inherit; }
input[type=number], input[type=url] { width: 100%; background: var(--panel-2); border: 1px solid #555; border-radius: 8px; padding: 10px 12px; }
.nav-ext img { border-radius: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font: 800 28px/1.1 var(--display); }
.stat span { color: var(--muted); font-size: 13px; }
.card .body { padding: 14px 16px; display: grid; gap: 6px; font-size: 14px; }
.card .body .kv { display: flex; justify-content: space-between; gap: 12px; }
.card .body .kv span:first-child { color: var(--muted); }
.card.stopped { border-color: var(--danger); }
.lt { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 14px; }
.lt th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.lt td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.lt tr.open td { background: var(--panel-2); }
.lt .answers { white-space: pre-wrap; color: var(--muted); font-size: 13px; }
.scroll-x { overflow-x: auto; }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters-row > * { width: auto; min-width: 140px; }
.filters-row input[type=search] { flex: 1; min-width: 200px; }
.pill.queued, .pill.approving { color: var(--warn); }
.pill.approved { color: var(--ok); }
.pill.failed, .pill.error { color: var(--danger); }
.log { display: grid; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.log .item { display: grid; grid-template-columns: 110px 130px 1fr; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.log .item:first-child { border-top: 0; }
.log .item.warn { border-left: 3px solid var(--warn); }
.log .item.error { border-left: 3px solid var(--danger); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h2 { font: 800 16px/1.2 var(--display); text-transform: uppercase; margin: 0 0 12px; }
.keybox { background: #000; border: 1px dashed var(--accent); border-radius: 8px; padding: 10px; word-break: break-all; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: 100%; max-width: 720px; max-height: 90vh; overflow: auto; }
.modal h2 { font: 800 20px/1.1 var(--display); text-transform: uppercase; margin: 0 0 14px; }
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .log .item { grid-template-columns: 1fr; gap: 2px; }
  .desk-only { display: none !important; }
}
.pill { white-space: nowrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); }
.chip.on { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
