:root {
  --bg: #0b0f14;
  --panel: #131a22;
  --panel-2: #18212b;
  --border: #24303d;
  --text: #e6edf3;
  --muted: #8b9bab;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--blue); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 16px 18px 60px; }

/* ------------------------------- header ------------------------------- */

header.top {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}

header.top h1 {
  font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px;
}

header.top h1 span { color: var(--muted); font-weight: 400; }

.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel);
  white-space: nowrap;
}

.pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
}

.pill.on  { color: var(--green); border-color: #1f4d33; background: #0e1f16; }
.pill.on .dot  { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pill.off { color: var(--muted); }
.pill.err { color: var(--red); border-color: #4d1f1f; background: #1f0e0e; }
.pill.err .dot { background: var(--red); }

/* ------------------------------- layout ------------------------------- */

.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: minmax(0, 2.1fr) minmax(320px, 1fr); }

@media (max-width: 1000px) {
  .grid.two, .grid.side { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.panel h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--muted); margin: 0 0 12px; font-weight: 600;
}

.panel .hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* -------------------------------- cards ------------------------------- */

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px;
}

.card .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 6px;
}

.card .value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.dim { color: var(--muted); }

/* ------------------------------- tables ------------------------------- */

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th {
  text-align: right; font-size: 11px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); font-weight: 600;
  padding: 7px 9px; border-bottom: 1px solid var(--border); white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; }

td { padding: 9px; border-bottom: 1px solid #1a232e; text-align: right; white-space: nowrap; }

tbody tr:hover { background: #16202a; }
tbody tr:last-child td { border-bottom: none; }

.sym { font-weight: 650; }
.dir { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 5px; }
.dir.LONG  { color: var(--green); background: #0e1f16; }
.dir.SHORT { color: var(--red);   background: #1f0e0e; }

.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.badge.ok  { color: var(--green); border-color: #1f4d33; }
.badge.bad { color: var(--red);   border-color: #4d1f1f; }

/* ------------------------------- buttons ------------------------------ */

button {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  transition: filter .12s, background .12s;
}
button:hover:not(:disabled) { filter: brightness(1.25); }
button:disabled { opacity: .45; cursor: not-allowed; }

button.primary { background: #14532d; border-color: #1f7a45; color: #d7f5e2; }
button.danger  { background: #5a1616; border-color: #8b1f1f; color: #ffd9d9; }
button.warn    { background: #5a3d0e; border-color: #8b6316; color: #ffe9c2; }
button.ghost   { background: transparent; }
button.tiny    { padding: 4px 9px; font-size: 11.5px; }
button.confirm { background: #7f1d1d; border-color: #b91c1c; color: #fff; }

/* -------------------------------- forms ------------------------------- */

label.radio {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; cursor: pointer;
  background: var(--panel-2);
}
label.radio:hover { border-color: #35465a; }
label.radio input { margin-top: 3px; }
label.radio .t { font-weight: 650; }
label.radio .d { color: var(--muted); font-size: 12px; }

input[type=text], input[type=password], select {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: #0f151c; color: var(--text);
  font-family: inherit; font-size: 14px;
}
input:focus, select:focus { outline: 1px solid var(--blue); border-color: var(--blue); }

label.field {
  display: block; margin-top: 10px;
}
label.field > span {
  display: block; margin-bottom: 5px;
  color: var(--muted); font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .04em;
}

.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* -------------------------------- modal ------------------------------- */

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.68);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; z-index: 50;
}
.overlay[hidden] { display: none; }

.modal {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto;
}
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal p  { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.checklist {
  max-height: 230px; overflow: auto; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px; margin-bottom: 10px; background: #0f151c;
}
.checklist label {
  display: flex; gap: 9px; align-items: center; padding: 7px 9px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.checklist label:hover { background: var(--panel-2); }

/* --------------------------------- log -------------------------------- */

pre.log {
  margin: 0; padding: 12px; background: #070a0e; border: 1px solid var(--border);
  border-radius: 8px; max-height: 320px; overflow: auto;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px; line-height: 1.55; color: #a9bacb; white-space: pre-wrap;
}

.error-bar {
  border: 1px solid #4d1f1f; background: #1f0e0e; color: #ffd9d9;
  padding: 9px 13px; border-radius: 8px; margin-bottom: 12px; font-size: 13px;
}
.error-bar[hidden] { display: none; }

/* Amber, not red: an open dashboard is a deliberate setting, not a fault. */
.notice {
  border: 1px solid #6b4a12; background: #1f1808; color: #ffe9c2;
  padding: 9px 13px; border-radius: 8px; margin-bottom: 12px; font-size: 13px;
}
.notice[hidden] { display: none; }

.login { max-width: 420px; margin: 12vh auto; }
