/* StockSense Admin — shared design tokens with the app, own build. */
:root {
  --bg: #0b0f1a; --panel: #121829; --panel-2: #0f1424; --border: #222b44; --text: #e6ebf5;
  --muted: #8b94a8; --accent: #00d4aa; --warn: #f5b642; --danger: #ff5d6c; --info: #6aa7ff;
  --focus: #7fe8d3;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f7f9fd; --border: #d5dbe8; --text: #141a2a;
          --muted: #56607a; --accent: #00806a; --warn: #8a5a00; --danger: #c42b3a; --info: #2458c9;
          --focus: #005a4a; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { font-size: 15px; }
.spacer { flex: 1; }
.env { font-size: 11px; font-weight: 800; letter-spacing: .6px; padding: 2px 8px; border-radius: 999px; }
.env-test { background: rgba(106,167,255,.15); color: var(--info); }
.env-production { background: rgba(255,93,108,.15); color: var(--danger); }
.who, .mfa { font-size: 12px; color: var(--muted); }
.mfa.stale { color: var(--warn); }
.banner { background: rgba(245,182,66,.12); border-bottom: 1px solid var(--warn); color: var(--warn);
  padding: 8px 16px; font-weight: 600; }
.banner small { display: block; font-weight: 400; color: var(--muted); }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 50px); }
.sidebar { width: 240px; background: var(--panel-2); border-right: 1px solid var(--border); padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px; }
.sidebar a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.sidebar a:hover { background: var(--panel); }
.sidebar a[aria-current="page"] { background: var(--panel); color: var(--accent); font-weight: 700; }
main { padding: 20px 24px; min-width: 0; }
main:focus { outline: none; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.card .n { font-size: 24px; font-weight: 800; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 9px; }
textarea { width: 100%; min-height: 90px; }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer;
  background: var(--accent); color: #04130f; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn { display: none; font-size: 18px; background: none; color: var(--text); border: 0; cursor: pointer; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); }
.pill.ok { color: var(--accent); } .pill.bad { color: var(--danger); } .pill.warn { color: var(--warn); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 14px 0; flex-wrap: wrap; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 12px; cursor: pointer; font: inherit; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom: 2px solid var(--accent); font-weight: 700; }
pre.code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  overflow: auto; max-height: 60vh; font-size: 12px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text);
  width: min(560px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin-top: 0; }
#dialog-body { display: grid; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.diff { font-size: 12px; background: var(--panel-2); border-radius: 8px; padding: 8px; }
.codes { columns: 2; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.auth { max-width: 380px; margin: 40px auto; display: grid; gap: 12px; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .icon-btn { display: inline-block; }
  .sidebar { position: fixed; top: var(--top-h, 50px); left: 0; bottom: 0; z-index: 30; transform: translateX(-100%);
    transition: transform .15s ease; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .sidebar.open { transform: none; }
  main { padding: 16px; }
  .who { display: none; }
}
@media (max-width: 480px) {
  .brand { font-size: 13px; }
  .mfa { display: none; }
  .top { gap: 8px; padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* The hidden attribute always wins (the sidebar's display rule used to beat it). */
[hidden] { display: none !important; }
/* Before sign-in and the passkey check: only the sign-in box, no sections. */
body.signed-out .layout { grid-template-columns: 1fr; }
body.signed-out #menu, body.signed-out #nav, body.signed-out #switch-banner { display: none !important; }

/* Access checkboxes */
fieldset.access { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; display: grid; gap: 10px; }
fieldset.access legend { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; }
label.check input { width: auto; margin-top: 2px; }
label.check small { display: block; font-size: 12px; }
label.check:has(input:disabled) { opacity: .7; cursor: default; }
.hint { margin-top: -6px; font-size: 12px; }
.secret-row { display: flex; gap: 8px; }
.secret { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.access-wrap { display: grid; gap: 10px; }
fieldset.access.perf { border-color: var(--accent, var(--border)); }
/* Providers & Jobs: the overall status banner. */
.card.status-ok { border-left: 4px solid var(--accent); }
.card.status-warn { border-left: 4px solid var(--warn); }
.card.status-bad { border-left: 4px solid var(--danger); }
.card[class*="status-"] strong { font-size: 16px; display: block; margin-bottom: 4px; }
.card[class*="status-"] ul { margin: 4px 0 6px 18px; }
