:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #697586;
  --line: #dfe4ea;
  --accent: #157a6e;
  --accent-dark: #0f5f56;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent-dark); }
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}
.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}
.auth, .panel, .table-wrap, .empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.auth {
  max-width: 420px;
  margin: 80px auto;
}
h1, h2 { margin: 0 0 14px; line-height: 1.15; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.stack, .row-form, .inline { display: flex; gap: 10px; }
.stack { flex-direction: column; }
.row-form { flex-wrap: wrap; }
.inline { align-items: center; flex-wrap: wrap; }
label { display: grid; gap: 6px; color: var(--muted); }
input, select {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
button, .button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.secondary { background: #eef8f6; color: var(--accent-dark); }
.ghost { background: transparent; color: var(--accent-dark); }
.alert { color: var(--danger); font-weight: 700; }
.muted { color: var(--muted); }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}
.badge.ok { background: #e7f6ec; color: #067647; }
.badge.off { background: #fee4e2; color: var(--danger); }
.qr {
  width: min(320px, 100%);
  height: auto;
  aspect-ratio: 1;
  display: block;
  margin: 16px 0;
  border: 1px solid var(--line);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow: hidden;
}
.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.table-wrap { margin-top: 16px; overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}
th, td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
code {
  display: inline-block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef1f4;
}

@media (max-width: 700px) {
  .topbar { padding: 0 16px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .row-form, .inline { align-items: stretch; flex-direction: column; }
}
