:root {
  --bg: #f4f6f8; --card: #fff; --text: #1d2327; --muted: #646970; --line: #e3e6ea; --accent: #2f5bea; --accent-soft: #eaf0ff;
  --ok: #117a3d; --ok-soft: #e5f5ec; --warn: #9a5b00; --warn-soft: #fff4e0; --bad: #b3261e; --bad-soft: #fdeceb;
  --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,.07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121418; --card: #1b1e24; --text: #e7e9ec; --muted: #9aa1ab; --line: #2b3038; --accent: #7196ff; --accent-soft: #1f2a4a;
    --ok: #5fd08f; --ok-soft: #173325; --warn: #f0b458; --warn-soft: #3a2c14; --bad: #ff8a80; --bad-soft: #3d1b1a; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.app { max-width: 1080px; margin: 0 auto; padding: 16px; }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }

.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-right: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 16px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.who { color: var(--muted); font-size: 13px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top > select.inline { max-width: 150px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }
.narrow { max-width: 440px; margin: 40px auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

label.f { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
input, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.inline input, .inline select, select.inline { width: auto; }
button { font: inherit; border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600; }
button.sec { background: var(--accent-soft); color: var(--accent); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button:disabled { opacity: .6; cursor: default; }
a.button { display: inline-block; border-radius: 8px; padding: 9px 16px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }
a.button.sec { background: var(--accent-soft); color: var(--accent); }
.card h3 { margin: 16px 0 6px; font-size: 15px; }
.actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.info { background: var(--accent-soft); color: var(--accent); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.badge.benign { background: var(--ok-soft); color: var(--ok); }
.badge.suspicious { background: var(--warn-soft); color: var(--warn); }
.badge.urgent, .badge.error { background: var(--bad-soft); color: var(--bad); }
.badge.plain { background: var(--bg); color: var(--muted); }

.site h3 { margin: 0; font-size: 16px; word-break: break-all; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.code { font: 600 22px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 2px; padding: 12px; background: var(--bg); border-radius: 8px; text-align: center; user-select: all; }
.qr { display: block; margin: 12px auto; width: 220px; height: 220px; border-radius: 8px; background: #fff; }
.secret { font: 13px ui-monospace, Consolas, monospace; word-break: break-all; }

.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.list th { color: var(--muted); font-weight: 600; font-size: 13px; }
.inc-text { margin: 4px 0 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 640px) {
  .list thead { display: none; }
  .list tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .list td { display: block; border: 0; padding: 3px 0; }
  .nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}
