/* ==================================================================
   Sparq Admin — operator console styles
   ------------------------------------------------------------------
   Shares the wallet's palette so the two apps read as one product,
   but the layout is a console rather than a phone: a fixed sidebar,
   a dense content grid, and monospace for every number and hash.
   ================================================================== */

:root {
  --bg: #0b0d12;
  --bg-elev: #12151d;
  --bg-elev-2: #191d28;
  --bg-elev-3: #1f2431;
  --border: #242938;
  --border-soft: #1c202b;
  --text: #e8ebf2;
  --text-dim: #9aa3b5;
  --text-faint: #6b7488;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --ok: #2ecc71;
  --ok-soft: rgba(46, 204, 113, 0.13);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.13);
  --err: #ff5c5c;
  --err-soft: rgba(255, 92, 92, 0.13);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --side-w: 236px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fb;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef1f7;
    --bg-elev-3: #e4e9f2;
    --border: #dde3ee;
    --border-soft: #e8edf5;
    --text: #12151d;
    --text-dim: #5a6478;
    --text-faint: #8b95a8;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --shadow: 0 6px 20px rgba(18, 21, 29, 0.08);
  }
}

* { box-sizing: border-box; }

/* The UA rule `[hidden] { display: none }` loses to any author rule that
   sets `display`, so restate it with enough weight to actually win. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- */
/* Shell                                                             */
/* ---------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100%; }

.side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-head { display: flex; align-items: center; gap: 11px; padding: 0 4px; }

.mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; color: #fff;
  background: linear-gradient(145deg, #4f8cff, #7b5cff);
}

.side-title { font-weight: 650; letter-spacing: -0.01em; }
.side-sub { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.side-nav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13.5px; text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.side-nav button:hover { background: var(--bg-elev-2); color: var(--text); }
.side-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav .ico { width: 17px; text-align: center; font-size: 14px; opacity: .9; }

.side-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 11px 6px 2px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
}
.conn { display: flex; align-items: center; gap: 7px; color: var(--text-dim); }
.side-link { font-size: 12px; color: var(--text-faint); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--text-faint); }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.offline { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---------------------------------------------------------------- */
/* Main                                                              */
/* ---------------------------------------------------------------- */

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.topbar-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-dim); }
.topbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.pill {
  display: flex; align-items: baseline; gap: 7px;
  padding: 6px 11px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.pill-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.pill-v { font-family: var(--mono); font-size: 13px; font-weight: 600; }

.content { padding: 22px 26px 60px; }

/* ---------------------------------------------------------------- */
/* Buttons, inputs                                                   */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer;
  transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #06210f; }
.btn.danger { background: var(--err); border-color: var(--err); color: #2a0505; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

input, select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: 13px;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input::placeholder { color: var(--text-faint); }

.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 200px; }

/* ---------------------------------------------------------------- */
/* Cards and grids                                                   */
/* ---------------------------------------------------------------- */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px;
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -0.005em; }
.card-note { font-size: 12px; color: var(--text-dim); }

.grid { display: grid; gap: 13px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }

.tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
}
.tile-k {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); margin-bottom: 7px;
}
.tile-v { font-family: var(--mono); font-size: 22px; font-weight: 600; line-height: 1.15; }
.tile-v.sm { font-size: 15px; }
.tile-sub { margin-top: 5px; font-size: 11.5px; color: var(--text-dim); }
.tile.ok .tile-v { color: var(--ok); }
.tile.warn .tile-v { color: var(--warn); }
.tile.err .tile-v { color: var(--err); }

/* ---------------------------------------------------------------- */
/* Key/value list                                                    */
/* ---------------------------------------------------------------- */

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }

/* ---------------------------------------------------------------- */
/* Tables                                                            */
/* ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -18px -17px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; padding: 9px 12px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); font-family: var(--mono); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-elev-2); }
td.num, th.num { text-align: right; }

.empty { padding: 26px 12px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* ---------------------------------------------------------------- */
/* Badges                                                            */
/* ---------------------------------------------------------------- */

.badge {
  display: inline-block; padding: 2.5px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  font-family: var(--sans);
  background: var(--bg-elev-3); color: var(--text-dim);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- */
/* Log                                                               */
/* ---------------------------------------------------------------- */

.log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  height: min(58vh, 520px);
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
}
.log-line { display: flex; gap: 10px; padding: 1.5px 0; }
.log-t { color: var(--text-faint); flex: 0 0 62px; }
.log-e { flex: 0 0 74px; font-weight: 600; }
.log-m { color: var(--text-dim); word-break: break-all; }
.log-e.block { color: var(--accent); }
.log-e.tx { color: var(--ok); }
.log-e.mempool { color: var(--warn); }
.log-e.invoice { color: #c084fc; }
.log-e.error { color: var(--err); }
.log-e.info { color: var(--text-faint); }

/* ---------------------------------------------------------------- */
/* Misc                                                              */
/* ---------------------------------------------------------------- */

.boot { display: flex; flex-direction: column; align-items: center; gap: 13px; padding: 70px 0; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  padding: 11px 19px; border-radius: 999px;
  background: var(--bg-elev-3); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--err); color: var(--err); }
.toast.ok { border-color: var(--ok); color: var(--ok); }

.bar { height: 7px; border-radius: 999px; background: var(--bg-elev-3); overflow: hidden; margin-top: 9px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.warnbox {
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--warn-soft); border: 1px solid var(--warn);
  color: var(--warn); font-size: 12.5px; margin-bottom: 14px;
}

/* ---------------------------------------------------------------- */
/* Operator key dialog                                               */
/* ---------------------------------------------------------------- */

.side-foot .opkey { width: 100%; justify-content: center; }
.side-foot .opkey.accent { color: var(--accent); border-color: var(--accent-soft); }

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(6, 8, 12, 0.62); backdrop-filter: blur(3px);
}
.modal-card {
  width: 100%; max-width: 420px; padding: 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-msg { margin: 0 0 14px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.modal-note { margin: 10px 0 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.55; }
.modal-note code {
  font-family: var(--mono); font-size: 10.5px; padding: 1px 4px;
  background: var(--bg-elev-3); border-radius: 4px;
}
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }

.field { display: block; }
.field > span {
  display: block; margin-bottom: 6px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
}
.field input { width: 100%; font-family: var(--mono); font-size: 12.5px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav button { width: auto; }
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 14px; }
}
