:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --border: #e2e2e5;
  --accent: #1a56db;
  --danger: #b42318;
  --warning: #92400e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topnav {
  display: flex;
  gap: 1.25rem;
  padding: 0.9rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topnav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.topnav a.logout { margin-left: auto; color: var(--danger); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 { font-size: 1.4rem; margin-bottom: 1rem; }
h2 { font-size: 1.1rem; margin-top: 2rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

label.checkbox { flex-direction: row; align-items: center; gap: 0.4rem; }

input, select, textarea, button {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

textarea { min-height: 5rem; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  width: fit-content;
}

button:hover { opacity: 0.9; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--card);
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.qr {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  width: fit-content;
  margin: 0.75rem 0;
}
.qr svg { display: block; width: 220px; height: 220px; }

.error { color: var(--danger); }
.warning { color: var(--warning); }
.hint { color: var(--muted); font-size: 0.85rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.stat-value { font-size: 1.6rem; font-weight: 600; }
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: capitalize; }

code {
  background: #f0f0f2;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  word-break: break-all;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101012;
    --card: #1a1a1d;
    --text: #f2f2f3;
    --muted: #9a9a9e;
    --border: #2c2c30;
  }
  code { background: #26262a; }
}
