:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5c6370;
  --line: #e2e5ea;
  --accent: #2458d6;
  --accent-text: #ffffff;
  --danger: #c62828;
  --danger-bg: #fff5f5;
  --danger-line: #f3c6c6;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #e9ebef;
    --muted: #9aa1ad;
    --line: #2c3038;
    --accent: #7ea2ff;
    --accent-text: #0b1020;
    --danger: #ff7b72;
    --danger-bg: #241617;
    --danger-line: #5a2a2a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111317; --surface: #1a1d23; --text: #e9ebef; --muted: #9aa1ad; --line: #2c3038;
  --accent: #7ea2ff; --accent-text: #0b1020; --danger: #ff7b72; --danger-bg: #241617;
  --danger-line: #5a2a2a; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.back { font-size: 15px; text-decoration: none; white-space: nowrap; }
.back::before { content: "\2190\00a0"; }

main.wrap { flex: 1; padding-top: 24px; padding-bottom: 32px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card.center { text-align: center; }
.card.danger { border-color: var(--danger-line); background: var(--danger-bg); }
.card.warn { border-color: var(--danger-line); }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 4px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--danger); }
.email { word-break: break-all; font-size: 22px; margin: 0; }

.who { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.gsi { margin: 20px 0; min-height: 44px; }

.btn {
  font: inherit; font-size: 15px;
  padding: 8px 14px; min-height: 40px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); border-color: var(--danger); }
.btn-small { min-height: 32px; padding: 4px 10px; font-size: 14px; }

.list { list-style: none; margin: 12px 0 0; padding: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.list li:first-child { border-top: 0; }
.list .main { min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 14px; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; margin-left: 6px;
  border-radius: 99px; background: var(--accent); color: var(--accent-text); vertical-align: 2px;
}
.empty { color: var(--muted); font-size: 14px; }

.table-scroll { overflow-x: auto; margin-top: 12px; }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th, table.log td { text-align: left; padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.log th { color: var(--muted); font-weight: 600; border-top: 0; }
table.log td.nowrap { white-space: nowrap; }
table.log td.ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
table.log tr.bad td:nth-child(2) { color: var(--danger); font-weight: 600; }

.bullets { margin: 8px 0; padding-left: 20px; }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  width: min(520px, calc(100vw - 32px)); padding: 20px;
}
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog input {
  width: 100%; font: inherit; font-size: 18px; letter-spacing: .08em;
  margin: 8px 0 4px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-size: 15px; z-index: 10;
}
.toast.error { background: var(--danger); color: #fff; }

.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 16px 0; font-size: 14px; }
.foot p { margin: 4px 0; }

@media (max-width: 520px) {
  h1 { font-size: 21px; }
  .card { padding: 16px; }
  .list li { flex-wrap: wrap; }
  table.log th:nth-child(4), table.log td:nth-child(4) { display: none; }
}
