:root {
  --bg: #f5f6f8; --card: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-text: #ffffff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --pill: #eef2ff; --pill-text: #3730a3; --code: #f3f4f6; --hit: #fef3c7; --spark: #2563eb;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #171a21; --text: #e6e8ec; --muted: #9aa3b2; --line: #272b35;
    --accent: #3b82f6; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
    --pill: #1e2540; --pill-text: #c7d2fe; --code: #11141a; --hit: #3a2f10; --spark: #60a5fa;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
a { color: var(--accent); text-decoration: none; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--code); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
pre { background: var(--code); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.err { color: var(--bad); }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.top nav a.on, .top nav a:hover { color: var(--text); background: var(--bg); }
.logout { margin: 0; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.authcard { width: 100%; max-width: 360px; display: grid; gap: 12px; }
.authcard h1 { display: flex; gap: 10px; align-items: center; font-size: 18px; }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; justify-self: center; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; display: inline-block; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.bad { color: var(--bad); } .btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: default; }
.flash { background: var(--pill); color: var(--pill-text); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

.head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 10px; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row label { flex: 1 1 160px; }
.form .row { margin-bottom: 10px; }
.chk { display: flex; align-items: center; gap: 6px; flex: 0 0 auto !important; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 180px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.bulkbar { display: flex; gap: 6px; align-items: center; padding: 6px 2px 10px; flex-wrap: wrap; }

.pill { display: inline-block; background: var(--pill); color: var(--pill-text); border-radius: 999px;
  padding: 1px 8px; font-size: 11.5px; white-space: nowrap; }
.pill.mute { background: var(--code); color: var(--muted); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.issues { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.issue { display: grid; grid-template-columns: 22px 1fr 130px 80px 130px; gap: 12px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.issue:last-child { border-bottom: 0; }
.issue.lvl-error, .issue.lvl-fatal { border-left-color: var(--bad); }
.issue.lvl-warning { border-left-color: var(--warn); }
.issue .main { min-width: 0; color: var(--text); display: grid; gap: 3px; }
.issue .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue .sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.issue .culprit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; font-family: var(--mono); font-size: 11.5px; }
.num, .when { display: grid; text-align: right; font-size: 13px; }
.num small, .when small { color: var(--muted); font-size: 11px; }
.spark rect { fill: var(--spark); } .spark rect.z { fill: var(--line); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }

.issuehead { border-left: 4px solid var(--accent); padding-left: 14px; margin-bottom: 16px; }
.issuehead.lvl-error, .issuehead.lvl-fatal { border-color: var(--bad); }
.issuehead.lvl-warning { border-color: var(--warn); }
.issuehead h1 { word-break: break-word; }
.issuehead p { margin: 4px 0 10px; font-family: var(--mono); font-size: 12.5px; }
.inline { display: inline-flex; gap: 6px; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(240px, 2fr); gap: 12px; }
.stat { display: grid; gap: 4px; } .stat small { color: var(--muted); } .stat b { font-size: 18px; }
.stat .spark { width: 100%; height: 36px; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; }
.evnav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 10px; flex-wrap: wrap; font-size: 13px; }
.msg { white-space: pre-wrap; word-break: break-word; }
.frames { display: grid; gap: 4px; }
.frame { border: 1px solid var(--line); border-radius: 8px; }
.frame summary { padding: 7px 10px; cursor: pointer; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.frame.lib summary { color: var(--muted); }
.frame.app summary .file { font-weight: 600; }
.code { margin: 0; padding: 6px 0; background: var(--code); font-family: var(--mono); font-size: 12px;
  overflow-x: auto; list-style-position: inside; }
.code li { padding: 0 10px; white-space: pre; color: var(--muted); }
.code li.hit { background: var(--hit); color: var(--text); }
.frame .kv, .frame p { margin: 6px 10px 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 12px 4px 0; vertical-align: top; width: 1%; white-space: nowrap; }
.kv td { padding: 4px 0; word-break: break-word; }
.crumbs { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.crumbs th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.crumbs td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; word-break: break-word; }
.crumbs tr.lvl-error td:first-child { box-shadow: inset 3px 0 var(--bad); }
.crumbs tr.lvl-warning td:first-child { box-shadow: inset 3px 0 var(--warn); }
.raw summary { cursor: pointer; } .raw pre { max-height: 600px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.proj { display: grid; gap: 6px; color: var(--text); } .proj:hover { border-color: var(--accent); }
.copyrow { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copyrow code { flex: 1; padding: 6px 8px; }
details > summary { cursor: pointer; padding: 6px 0; }
.danger { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.danger form { margin-bottom: 10px; }

.hbs { list-style: none; padding: 0; margin: 0 0 14px; }
.hbmain { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stdot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.st-up .stdot { background: var(--ok); } .st-down .stdot { background: var(--bad); }
.st-error .stdot { background: var(--warn); }
.hb.st-down { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }

@media (max-width: 760px) {
  .issue { grid-template-columns: 22px 1fr 70px; }
  .issue .sparkcell, .issue .when { display: none; }
  .stats { grid-template-columns: 1fr 1fr; } .stat.wide { grid-column: 1 / -1; }
  .grid2 { grid-template-columns: 1fr; }
  .top { gap: 10px; }
}
