:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #17202a;
  --muted: #687386;
  --border: #d7dde6;
  --primary: #166534;
  --primary-dark: #14532d;
  --danger: #b42318;
  --focus: #2563eb;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  background: #111827;
  color: #fff;
  border-bottom: 1px solid #0b1220;
}

.topbar-inner {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  padding: 14px 24px;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.nav {
  align-items: center;
  display: flex;
  gap: 8px;
}

.nav a,
.nav button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #d1d5db;
  cursor: pointer;
  font: inherit;
  padding: 8px 10px;
  text-decoration: none;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  background: #1f2937;
  color: #fff;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 24px 48px;
}

.page-header {
  align-items: start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  margin-bottom: 8px;
}

h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}

.metric-value {
  font-size: 28px;
  font-weight: 750;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 440px;
  padding: 26px;
  width: 100%;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  color: #374151;
  font-size: 14px;
  font-weight: 650;
}

input,
select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.button {
  align-items: center;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  text-decoration: none;
}

.button:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.alert {
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 12px;
}

.alert.error {
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: var(--danger);
}

.alert.success {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: var(--primary-dark);
}

.qr-code {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
  height: 220px;
  margin: 0 auto 16px;
  width: 220px;
}

.code-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}

.code-list code {
  background: var(--surface-muted);
  border-radius: 6px;
  display: block;
  font-size: 15px;
  padding: 9px 10px;
  text-align: center;
}

.section {
  margin-bottom: 26px;
}

.settings-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 760px) {
  .topbar-inner,
  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    flex-wrap: wrap;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
