:root {
  --bg: #0e1117;
  --panel: #161b24;
  --panel-2: #1d2431;
  --line: #263041;
  --text: #e6edf6;
  --muted: #8b98ab;
  --accent: #4f8cff;
  --accent-2: #6f5cff;
  --good: #3fb96b;
  --warn: #e0a63c;
  --bad: #e5544e;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 22px; margin-bottom: 4px; }
.brand .logo { width: 30px; height: 30px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 11px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 15px; }
.field input:focus { outline: none; border-color: var(--accent); }
.btn { width: 100%; padding: 12px; border: none; border-radius: 10px; background: var(--accent); color: white; font-weight: 600; font-size: 15px; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; }
.switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.switch a { cursor: pointer; }
.err { background: rgba(229,84,78,.12); color: #ff9c97; border: 1px solid rgba(229,84,78,.3); padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }

/* ---------- shell ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 10; }
.top .brand { font-size: 17px; margin: 0; }
.top .spacer { flex: 1; }
.top .who { color: var(--muted); font-size: 13px; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100dvh - 53px); }
.side { border-right: 1px solid var(--line); padding: 14px; background: var(--panel); }
.side h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px 10px; }
.dev { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; cursor: pointer; margin-bottom: 4px; border: 1px solid transparent; }
.dev:hover { background: var(--panel-2); }
.dev.active { background: var(--panel-2); border-color: var(--line); }
.dev .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dev.online .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.dev .nm { font-size: 14px; font-weight: 500; }
.dev .st { font-size: 11px; color: var(--muted); }
.main { padding: 20px 24px; max-width: 1100px; }

/* ---------- controls ---------- */
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagehead { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead h1 { font-size: 22px; margin: 0; }
.datepick { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; color: var(--text); font-size: 14px; }
.tabs { display: flex; gap: 6px; margin: 18px 0; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; font-size: 14px; color: var(--muted); border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.card .v { font-size: 30px; font-weight: 700; margin-top: 6px; }
.card .v.time { color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 64px; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 14px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--panel-2); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; }
.bar-row .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: var(--panel-2); }
.time-cell { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.url-cell { color: var(--text); word-break: break-all; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shot { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; }
.shot img { width: 100%; display: block; aspect-ratio: 16/10; object-fit: cover; background: var(--panel-2); }
.shot .meta { padding: 8px 10px; font-size: 11.5px; color: var(--muted); }
.shot .meta .t { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { color: var(--muted); text-align: center; padding: 40px; font-size: 14px; }
.muted { color: var(--muted); }

/* flags */
.card.alert { border-color: rgba(229,84,78,.5); background: linear-gradient(180deg, rgba(229,84,78,.08), var(--panel)); }
.card.alert .v { color: var(--bad); }
.card.alert.medium { border-color: rgba(224,166,60,.5); }
.card.alert.medium .v { color: var(--warn); }
.flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 20px; border: 1px solid; white-space: nowrap; }
.flag-high { color: #ff9c97; border-color: rgba(229,84,78,.45); background: rgba(229,84,78,.12); }
.flag-medium { color: #f0c070; border-color: rgba(224,166,60,.45); background: rgba(224,166,60,.12); }
.flag-low { color: var(--muted); border-color: var(--line); background: var(--panel-2); }
tr.flagged td { background: rgba(229,84,78,.06); }
tr.flagged.medium td { background: rgba(224,166,60,.06); }
.flag-item { display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.flag-item:last-child { border-bottom: none; }
.flag-item .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.flag-item .what { min-width: 0; }
.flag-item .what .t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag-item .what .u { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .tab-count { display: inline-block; min-width: 17px; text-align: center; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 20px; background: var(--bad); color: #fff; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 560px; width: 100%; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal p { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.code { background: #0a0d12; border: 1px solid var(--line); border-radius: 9px; padding: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: #9fd0ff; word-break: break-all; margin: 10px 0; white-space: pre-wrap; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: grid; place-items: center; z-index: 60; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 90dvh; border-radius: 8px; }
.lightbox .cap { position: fixed; bottom: 16px; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-right: none; border-bottom: 1px solid var(--line); display: flex; gap: 8px; overflow-x: auto; }
  .side h3 { display: none; }
  .dev { margin: 0; white-space: nowrap; }
  .bar-row { grid-template-columns: 110px 1fr 56px; }
}
