:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2630;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #2ea043;
  --accent-hover: #3fb950;
  --danger: #f85149;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.wrap { max-width: 420px; margin: 0 auto; padding: 48px 20px; }
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 28px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.3px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--panel-2); padding: 4px; border-radius: 8px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); border: 0; padding: 9px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.tabs button.active { background: var(--panel); color: var(--text); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input {
  width: 100%; padding: 11px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
input:focus { outline: none; border-color: var(--accent); }
button.primary {
  width: 100%; margin-top: 20px; padding: 12px; background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.6; cursor: default; }
.msg { margin-top: 16px; font-size: 14px; min-height: 20px; }
.msg.ok { color: var(--accent-hover); }
.msg.err { color: var(--danger); }
.hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 18px; line-height: 1.5; }
.hidden { display: none; }

/* --- admin dashboard --- */
.wrap.admin { max-width: 760px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.status .pill { background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; color: var(--text); }
.linkbtn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.linkbtn:hover { color: var(--text); }
textarea {
  width: 100%; min-height: 90px; resize: vertical; padding: 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px; font-family: inherit;
}
textarea:focus { outline: none; border-color: var(--accent); }
.history { margin-top: 28px; }
.history h2 { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.signal { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.signal .body { font-size: 15px; }
.signal .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.empty { color: var(--muted); font-size: 14px; }

/* --- admin users --- */
.users { margin-top: 28px; }
.users h2 { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.urow { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.urow-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.urow-bot { display: grid; grid-template-columns: auto auto auto 1fr; gap: 8px; align-items: center; }
.urow-bot .badge { justify-self: end; }
.urow .uemail { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow select, .urow input.udays { padding: 6px 8px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; }
.urow input.udays { width: 64px; }
.urow .usave { padding: 6px 12px; background: var(--accent); border: 0; color: #fff; border-radius: 6px; font-size: 13px; cursor: pointer; }
.urow .usave:hover { background: var(--accent-hover); }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.badge.ok { background: rgba(46,160,67,0.15); color: var(--accent-hover); }
.badge.exp { background: rgba(248,81,73,0.15); color: var(--danger); }

/* ===== admin dashboard v2 ===== */
:root {
  --mono: 'IBM Plex Mono', ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --gold: #f0c84b;
  --teal: #5eead4;
}

.wrap.admin { max-width: 1060px; }
.wrap.admin .brand { justify-content: flex-start; align-items: center; gap: 13px; margin-bottom: 22px; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-sub {
  font-family: 'Bricolage Grotesque', -apple-system, sans-serif;
  font-size: 13px; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase;
  border-left: 1px solid var(--border); padding-left: 13px;
}

/* keep the logged-out admin card narrow and centered */
.wrap.admin #login-view { max-width: 400px; margin: 7vh auto 0; }

/* header bar */
.topbar {
  background: linear-gradient(180deg, rgba(45,212,191,0.05), transparent);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 20px;
}
.status .livedot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(46,160,67,0.6); animation: livepulse 2.4s infinite;
}
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(46,160,67,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(46,160,67,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,160,67,0); }
}
.status .pill { font-family: var(--mono); font-weight: 600; }
.linkbtn { border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.linkbtn:hover { border-color: var(--muted); }

/* two-pane grid: signals left, users right */
.dash-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 20px; align-items: start; }
.dash-grid .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } }

/* section headings with an accent tick */
.history, .users { margin-top: 0; }
.history h2, .users h2 {
  display: flex; align-items: center; gap: 9px;
  font-family: 'Bricolage Grotesque', -apple-system, sans-serif;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text); margin-bottom: 14px;
}
.history h2::before, .users h2::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); }
.users h2::before { background: var(--gold); }

/* monospaced ticker numerals */
.signal .meta { font-family: var(--mono); }
.urow .udays { font-family: var(--mono); text-align: center; }
.badge { font-family: var(--mono); }

/* focus glow */
input:focus, textarea:focus, .urow select:focus, .urow input:focus {
  box-shadow: 0 0 0 3px rgba(46,160,67,0.14);
}
.fx { font-family: var(--mono); font-size: 10.5px; padding: 3px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fx-on { background: rgba(46,160,67,0.16); color: var(--accent-hover); }
.fx-off { background: rgba(154,167,180,0.12); color: var(--muted); }
.fx-stale { background: rgba(154,167,180,0.12); color: var(--muted); }
.fx-none { background: transparent; color: var(--border); }
.fx-time { color: var(--muted); opacity: 0.8; }

.cmd-hint { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.6; }
.cmd-hint code { font-family: var(--mono); background: var(--panel-2); padding: 1px 6px; border-radius: 5px; color: var(--text); font-size: 11px; }
.cmd-samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.cmd-samples .cs-label { font-size: 11px; color: var(--muted); width: 100%; margin-bottom: 2px; }
.cmd-samples .cs { width: auto; font-family: var(--mono); font-size: 11px; padding: 4px 9px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px; color: var(--text); cursor: pointer; font-weight: 400; }
.cmd-samples .cs:hover { border-color: var(--accent); background: rgba(46,160,67,0.1); filter: none; }
