/* Jarvis: dark only, blue accent */
:root {
  --bg: #070d1a; --panel: #0f1829; --panel-2: #16223a; --text: #e5ecf8; --muted: #8b9ab5; --line: #1f2d4a;
  --accent: #3b82f6; --accent-ink: #ffffff; --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --ok-bg: #0f2e24; --warn-bg: #33270a; --bad-bg: #3a1518; --info-bg: #13254a;
  --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 8px 24px rgb(0 0 0 / 30%);
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--info); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
code, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--panel-2); padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
pre { background: var(--panel-2); padding: .75rem; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

/* shell */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.view { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 1100px; width: 100%; margin: 0 auto; outline: none; }
.nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; padding: 4px 0; border-radius: 10px; }
.nav a .ico { font-size: 1.2rem; line-height: 1; }
.nav a.active { color: var(--accent); }
.nav a.active .ico { text-shadow: 0 0 12px rgb(59 130 246 / 60%); }
.nav .brand, .nav .me { display: none; }
@media (min-width: 860px) {
  .shell { grid-template-columns: 220px 1fr; }
  .nav { position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0; border-right: 1px solid var(--line); padding: 16px 12px; }
  .nav a { flex: none; flex-direction: row; gap: 12px; font-size: .95rem; padding: 10px 12px; }
  .nav a.active { background: var(--panel-2); }
  .nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; padding: 4px 12px 16px; }
  .nav .me { display: flex; margin-top: auto; align-items: center; gap: 10px; padding: 8px 12px; font-size: .9rem; }
  .view { padding: 28px 32px 48px; }
}
.me img { border-radius: 50%; }
.me button { margin-left: auto; }

/* pieces */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card, .stack > * + * { margin-top: 12px; }
.tile .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 1.35rem; font-weight: 650; margin: 2px 0; overflow-wrap: anywhere; }
.section { margin-top: 24px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.feed li { font-size: .9rem; overflow-wrap: anywhere; }
.feed time, .when { color: var(--muted); font-size: .78rem; white-space: nowrap; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

select, textarea, input[type="search"] { width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }

.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 12px; margin-bottom: 14px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

.md { overflow-wrap: anywhere; }
.md table { border-collapse: collapse; width: 100%; font-size: .88rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.md li { margin: 4px 0; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.skeleton { height: 64px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgb(0 0 0 / 45%); }
.toasts { position: fixed; z-index: 20; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 860px) { .toasts { left: auto; bottom: 24px; align-items: flex-end; } }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 480px; font-size: .9rem; }
.toast.bad { background: var(--bad); color: #fff; }

.login, .plain { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card, .plain-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 24px; width: min(380px, 100%); text-align: center; box-shadow: var(--shadow); }
.login-card img { border-radius: 18px; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.tile-link { text-decoration: none; color: inherit; }
.mt { margin-top: 12px; } .mt-s { margin-top: 6px; } .mb { margin-bottom: 12px; }
.grid > .card, .grid > .card + .card { margin-top: 0; }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
@media (min-width: 860px) { .grid.tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.tile .value { font-size: 1.2rem; }
.nav a.desktop-only { display: none; }
@media (min-width: 860px) { .nav a.desktop-only { display: flex; } }
.pair { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.qr { background: #fff; border-radius: 12px; padding: 6px; max-width: 100%; height: auto; }
.code { font-family: var(--mono); font-size: 1.8rem; font-weight: 700; letter-spacing: .12em; margin: 4px 0; }
