/* Wanted monitor. The Stealth Phantom look of Solana Ghost's monitor (graphite surfaces, thin borders, DM Sans +
   Space Grotesk, letter-spaced eyebrows, small pills), with Wanted's own accent: poster amber. Dark only. */

:root {
  color-scheme: dark;
  --bg: #090c11;
  --top: #0e1216;
  --panel: #11161e;
  --raised: #161c25;
  --border: #29313e;
  --line: #222a35;
  --text: #edf3f3;
  --muted: #9aa7b4;
  --subtle: #8491a0;
  --acc: #eac18a;
  --acc-soft: #251f18;
  --acc-line: #745b3f;
  --mint: #9cf6d4;
  --green: #91deb7;
  --red: #ee91a1;
  --violet: #c2a8ff;
  --cyan: #8ddcec;
  --font: "DM Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pad: clamp(16px, 1.7vw, 40px);
  --gap: clamp(12px, 1.1vw, 24px);
  --radius: 12px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
@media (min-width: 1900px) { :root { font-size: 15px; } }

*, *::before, *::after { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); margin: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ---- top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--gap);
  padding: 10px var(--pad); padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--top) 94%, transparent); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--display); font-size: 1.15rem; letter-spacing: 0.14em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; border: 1px solid transparent; }
.nav a:hover { color: var(--text); text-decoration: none; background: var(--raised); }
.nav a[aria-current="page"] { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.light { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.9rem; }
.light::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); }
.light[data-state="ok"]::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.light[data-state="warn"]::before { background: var(--acc); }
.light[data-state="bad"]::before { background: var(--red); }

main { flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; padding: var(--pad); padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom, 0px)); }

/* ---- building blocks */
.eyebrow { color: var(--subtle); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap); margin-bottom: var(--gap); flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; }
.sub { color: var(--muted); }
.grid { display: grid; gap: var(--gap); }
.cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.panel h2 { font-size: 1.05rem; margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.card .v { font-family: var(--display); font-size: 1.45rem; margin-top: 4px; overflow-wrap: anywhere; }
.card .n { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.card .v.small-v { font-size: 1rem; line-height: 1.4; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.dim { color: var(--muted); }
.warn-text { color: var(--acc); }
.bar { height: 6px; border-radius: 6px; background: var(--raised); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 6px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; border: 1px solid var(--border); color: var(--muted); background: var(--raised); white-space: nowrap; }
.pill[data-s="tracking"], .pill[data-s="done"], .pill[data-s="ok"], .pill[data-s="closed"] { color: var(--green); border-color: #36573f; background: #16271e; }
.pill[data-s="running"], .pill[data-s="open"] { color: var(--cyan); border-color: #2f4b58; background: #152029; }
.pill[data-s="paused"], .pill[data-s="queued"], .pill[data-s="waiting_credits"] { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.pill[data-s="failed"], .pill[data-s="bad"] { color: var(--red); border-color: #6d3947; background: #341c24; }
.pill[data-s="retired"], .pill[data-s="cancelled"] { color: var(--subtle); }
.tag { display: inline-block; padding: 0 8px; margin: 0 4px 4px 0; border-radius: 6px; background: var(--raised); border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }

/* ---- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--subtle); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--top); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--raised); }
tbody tr.click { cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 18px 4px; }
.more { margin-top: 10px; }

/* ---- forms and buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--raised); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--acc-line); }
.btn.primary { background: var(--acc); color: #1d160c; border-color: var(--acc); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--red); border-color: #6d3947; }
.btn.small { padding: 3px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions select, .actions input[type] { width: auto; flex: 0 1 auto; }
form.stack { display: grid; gap: 14px; max-width: 760px; }
label.field { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
textarea { min-height: 110px; font-family: var(--mono); font-size: 0.9rem; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.hint { color: var(--subtle); font-size: 0.85rem; }
.msg { min-height: 1.4em; font-size: 0.9rem; }
.msg[data-kind="error"] { color: var(--red); }
.msg[data-kind="ok"] { color: var(--green); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filters select, .filters input { width: auto; min-width: 120px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 5px 12px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--acc-soft); color: var(--acc); }

/* ---- bot page */
.poster { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.poster .badge { width: 64px; height: 64px; border-radius: 14px; background: var(--acc-soft); border: 1px solid var(--acc-line); display: grid; place-items: center; font-family: var(--display); font-size: 1.5rem; color: var(--acc); }
.wallets { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.wallet { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 0.86rem; color: var(--muted); overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: var(--gap) 0; flex-wrap: wrap; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--acc); border-bottom-color: var(--acc); }
.chart { width: 100%; height: 150px; display: block; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--subtle); font-size: 10px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--subtle); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- drawer and modal */
.scrim { position: fixed; inset: 0; background: rgba(4, 6, 9, 0.66); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--panel); border-left: 1px solid var(--border); z-index: 41; overflow-y: auto; padding: 20px var(--pad); padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
.drawer pre, pre.json { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 420px; font-size: 0.8rem; }
.modal { position: fixed; left: 50%; top: 22vh; transform: translateX(-50%); width: min(420px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; z-index: 42; }
.close { float: right; }
details summary { cursor: pointer; color: var(--muted); }

/* ---- login */
.login-wrap { flex: 1; display: grid; place-items: center; padding: var(--pad); }
.login { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px; display: grid; gap: 14px; }
.login .brand { justify-content: center; font-size: 1.4rem; }

@media (max-width: 640px) {
  .top { gap: 10px; }
  .top-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .poster { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .card .v { font-size: 1.2rem; }
}
