:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --text: #1c1f24;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #2554c7;
  --danger: #b42318;
  --ok: #067647;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #eef0f4; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }

label { display: block; margin: 0 0 12px; font-weight: 500; }
label.check { display: flex; gap: 8px; align-items: baseline; font-weight: normal; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, a.button {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 500; cursor: pointer;
}
a.button:hover { text-decoration: none; }
button.secondary { background: #fff; color: var(--text); border-color: var(--line); }
button.danger { background: #fff; color: var(--danger); border-color: #f0c4c0; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button.link.danger-text, .danger-text { color: var(--danger); }

.alert { padding: 10px 12px; border-radius: 6px; background: #eef2ff; border: 1px solid #d5ddfb; }
.alert.error { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
.alert.ok { background: #ecfdf3; border-color: #abefc6; color: var(--ok); }

/* sign-in pages */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.auth-card .brand { font-weight: 700; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 18px; }
.auth-card button { width: 100%; }
.auth-card form.choice { margin-bottom: 8px; }
.qr { display: flex; justify-content: center; margin: 12px 0; }
.codes { columns: 2; padding-left: 18px; }

/* admin console */
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 18px; flex: 1; }
.topbar form.inline { display: flex; gap: 12px; align-items: center; }
.page { max-width: 1100px; margin: 0 auto; padding: 24px; }
.crumbs { margin: 0 0 4px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
table.compact td { padding: 6px 10px; font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.panel h2:first-child, .panel h2:first-of-type { margin-top: 0; }
.panel input[type=text], .panel input[type=email], .panel select { max-width: 420px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.row.spread { justify-content: space-between; }
.row form { margin: 0; }
.row label { margin: 0; }
.row input[type=search] { max-width: 320px; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--text); }
.stat strong { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }

.status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef0f4; color: var(--muted); }
.status.active, .status.success { background: #ecfdf3; color: var(--ok); }
.status.suspended, .status.pending { background: #fffaeb; color: #b54708; }
.status.closed, .status.disabled, .status.denied, .status.error { background: #fef3f2; color: var(--danger); }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: #eef2ff; color: var(--accent); }
.secret code { display: block; padding: 10px; word-break: break-all; user-select: all; }

@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } .topbar { flex-wrap: wrap; } }
