:root {
  --bg: #EEF2F5;
  --header-bg: #16232E;
  --header-text: #E8EEF2;
  --header-text-muted: #9BB0BE;
  --accent: #3D7CA6;
  --accent-dark: #2A5A7D;
  --surface: #FFFFFF;
  --border: #DAE2E8;
  --text: #16232E;
  --text-muted: #5C7080;
  --danger: #C0392B;
  --danger-bg: #FBEAE8;
  --success: #2E7D5B;
  --success-bg: #E7F4EE;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Auth-Seiten (Login) ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #16232E 0%, #1F3346 55%, #2A4A63 100%);
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.auth-card .brand {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--header-bg);
}

.auth-card .tagline {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-card input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61,124,166,0.15);
}

.auth-card button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.auth-card button:hover { background: var(--accent-dark); }

.auth-footer-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-small { font-weight: 700; font-size: 17px; }

.topbar-right { display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--header-text-muted); }
.topbar-right a.btn-link { color: var(--header-text); }

.admin-nav {
  background: #1F3346;
  padding: 0 28px;
  display: flex;
  gap: 4px;
}

.admin-nav a {
  color: var(--header-text-muted);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.admin-nav a.active, .admin-nav a:hover {
  color: #fff;
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* ---------- Layout ---------- */
main.dashboard, main.content, main.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* ---------- Box-Grid (Fachbetrieb-Dashboard) ---------- */
.box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.box-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: block;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.box-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(22,35,46,0.12);
  text-decoration: none;
}

.box-card h2 { margin: 0 0 6px; font-size: 17px; color: var(--header-bg); }
.box-card p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* ---------- Box-Detail ---------- */
.back-link { display: inline-block; margin-bottom: 16px; font-size: 14px; }
.content h1 { margin: 0 0 4px; }
.content .subtitle { color: var(--text-muted); margin: 0 0 28px; }

.item-list { display: flex; flex-direction: column; gap: 12px; }

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.item-card h3 { margin: 0; font-size: 15px; }
.item-card p { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }

.btn-download {
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-download:hover { background: var(--accent-dark); text-decoration: none; }

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

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---------- Admin: Tabellen & Karten ---------- */
.admin-section { margin-bottom: 40px; }
.admin-section h1 { font-size: 20px; margin-bottom: 4px; }
.admin-section .desc { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-disabled { background: var(--danger-bg); color: var(--danger); }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-row { flex: 1; min-width: 180px; margin-bottom: 0; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-secondary { background: #E4EAEE; color: var(--text); }
.btn-secondary:hover { background: #D3DBE1; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a03024; }
.btn-small { padding: 5px 10px; font-size: 12px; }

.access-code-banner {
  background: var(--success-bg);
  border: 1px solid #BFE3D0;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.access-code-banner .code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--success);
  margin-top: 6px;
  display: block;
}

.box-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.box-list a.card { display: block; margin-bottom: 0; }
.box-list a.card h3 { margin: 0 0 4px; font-size: 15px; }
.box-list a.card p { margin: 0; font-size: 13px; color: var(--text-muted); }

.item-type-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.item-type-toggle label {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.item-type-toggle input { margin-right: 6px; }

.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--danger-bg);
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 14px;
}
