:root {
  --bg: #f5f6f8; --card: #ffffff; --text: #1d2330; --muted: #6b7280;
  --line: #e5e7eb; --accent: #e3000f; --accent-soft: #fde8ea; --ok: #16a34a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
header { background: var(--card); border-bottom: 1px solid var(--line); padding: 16px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
header h1 { font-size: 20px; margin: 0; }
.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.dot.live { background: var(--ok); }
header[hidden], main[hidden], .login[hidden] { display: none; }
.user { font-size: 13px; color: var(--muted); }
button.link { border: none; background: none; padding: 0; color: var(--accent); font-size: inherit; }
button.link:hover { text-decoration: underline; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 20px; margin: 0; text-align: center; }
.login-card .hint { text-align: center; margin: -6px 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.login-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.login-card button { padding: 10px 12px; }
.login-error { margin: 0; overflow-wrap: anywhere; font-size: 13px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }
.login-error[hidden] { display: none; }
main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select, button {
  font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
}
.toolbar input { flex: 1; min-width: 180px; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); padding: 4px 10px; font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: #fafafa; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.d1 { background: #dcfce7; color: #166534; }
.d2 { background: #fef9c3; color: #854d0e; }
.d3 { background: #fee2e2; color: #991b1b; }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.pager[hidden] { display: none; }
.pager button:disabled { opacity: .4; cursor: default; }
.section { margin-top: 32px; }
.section h2 { font-size: 16px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.section .count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--line); border-radius: 999px; padding: 1px 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.hint.ok { color: var(--ok); }
.modal { border: none; border-radius: 12px; padding: 20px 24px; width: calc(100% - 32px); max-width: 380px; color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.modal::backdrop { background: rgba(0, 0, 0, .4); }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 16px; font-size: 14px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.modal form { margin: 0; display: flex; justify-content: flex-end; gap: 8px; }
.modal form button[hidden] { display: none; }
