:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --accent: #2563eb;
  --error: #b91c1c;
  --border: #e2e4e8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card-bg: #1d2025;
    --text: #e7e9ec;
    --muted: #9aa1ac;
    --accent: #5b8def;
    --error: #f87171;
    --border: #2b2f36;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 360px;
  text-align: center;
}
.auth-card h1 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.muted { color: var(--muted); font-size: 0.875rem; }
.error { color: var(--error); font-size: 0.875rem; }
form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; text-align: left; }
label { font-size: 0.8rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.25rem; }
input {
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
button {
  padding: 0.6rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
}
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 1rem; }
.qr { display: block; margin: 1rem auto; border-radius: 8px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; }
.who { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.inline { display: inline; margin: 0; }
.link-button { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 0.85rem; }
.content { padding: 2rem; }

/* --- authenticated shell (sidebar + topbar) --- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
}
.sidebar .brand { padding: 0 1.25rem 1rem; font-weight: 600; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar nav a {
  padding: 0.55rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-col > .content { flex: 1; }

/* --- cards / grid --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.card .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.card .value { font-size: 1.5rem; font-weight: 600; margin-top: 0.25rem; }
.card .sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }

/* --- tables --- */
.table-wrap { overflow-x: auto; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* --- badges --- */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-ok { background: #16a34a22; color: #16a34a; }
.badge-warn { background: #d9770622; color: #d97706; }
.badge-bad { background: #dc262622; color: #dc2626; }
.badge-unknown { background: #6b728022; color: var(--muted); }

.section-title { font-size: 1.1rem; font-weight: 600; margin: 1.75rem 0 0.75rem; }
.section-title:first-child { margin-top: 0; }
.empty-state { color: var(--muted); font-size: 0.875rem; padding: 1.5rem; text-align: center; }
.evidence { font-size: 0.75rem; color: var(--muted); }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.attention-list li:last-child { border-bottom: none; }
a.rowlink { color: var(--text); text-decoration: none; }
a.rowlink:hover { color: var(--accent); }
.chart { width: 100%; height: 160px; }
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tabs a { padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.8rem; text-decoration: none; color: var(--muted); border: 1px solid var(--border); }
.tabs a.active { background: var(--accent); color: white; border-color: var(--accent); }

/* --- storage section: page header row, inline action buttons, secret reveal --- */
.section-row { display: flex; align-items: center; justify-content: space-between; margin: 1.75rem 0 0.75rem; }
.section-row .section-title { margin: 0; }
.btn-link {
  display: inline-block; padding: 0.5rem 0.9rem; border-radius: 8px;
  background: var(--accent); color: white; text-decoration: none; font-size: 0.875rem;
}
.card.form-card { text-align: left; padding: 1.5rem; max-width: 640px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
textarea {
  font: inherit; padding: 0.5rem 0.6rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical;
}
.btn-row { display: flex; gap: 0.6rem; margin: 1rem 0; flex-wrap: wrap; }
.btn-row button, .btn-row .btn-link { width: auto; }
.btn-danger { background: var(--error) !important; }
.btn-secondary { background: var(--muted) !important; }
.secret-box {
  background: var(--bg); border: 1px dashed var(--error); border-radius: 8px;
  padding: 1rem; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.85rem;
  white-space: pre-wrap; word-break: break-all; margin: 0.75rem 0;
}
.secret-warning { color: var(--error); font-weight: 600; font-size: 0.875rem; }
dl.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; font-size: 0.9rem; margin: 0; }
dl.detail-list dt { color: var(--muted); }
dl.detail-list dd { margin: 0; }
