/* CBW Design System - übernommen aus CBW Kompass (cbw-webcode-tool) und
   der Bestellliste (cbw-bestelltool), damit alle internen CBW-Werkzeuge
   erkennbar zusammengehören. Als eigenständiges Stylesheet ausgelagert
   (im Original lag es inline in den Templates). */

:root {
  --trust: #002F6D;
  --life: #38AA34;
  --sun: #FFC659;
  --sky: #4CC9E9;
  --white: #FFFFFF;

  --blue-50: #F4F8FD;
  --blue-100: #E6EFF9;
  --blue-200: #C9DAEE;
  --blue-300: #9FBCE0;
  --blue-600: #2B5C9F;

  --ink: #0E1726;
  --fg: #33465F;
  --fg-2: #6E7A8B;
  --fg-3: #98A3B2;
  --border: #DCE4EE;
  --line: #EDF1F7;
  --bg: #F7FAFD;

  --success: #1D7519;
  --warning: #7A5300;
  --error: #B0341F;

  /* Ampel */
  --ampel-rot: #C0392B;
  --ampel-rot-bg: #FCEAE8;
  --ampel-gelb: #B8860B;
  --ampel-gelb-bg: #FFF6E0;
  --ampel-gruen: #1E7A34;
  --ampel-gruen-bg: #E7F6EA;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 40px;
  --sp-8: 56px;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(0, 47, 109, 0.05);
  --sh-2: 0 2px 10px rgba(0, 47, 109, 0.08);
  --sh-3: 0 10px 30px rgba(0, 47, 109, 0.12);
  --sh-focus: 0 0 0 4px rgba(76, 201, 233, 0.28);

  --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Work Sans", system-ui, "Segoe UI", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Lexend", "Work Sans", sans-serif;
  color: var(--trust);
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 var(--sp-3);
}

a { color: var(--trust); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

/* --- Topbar / Navigation ------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.brand { display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; flex-shrink: 0; }
.brand img { height: 36px; }

.nav-main {
  display: flex;
  gap: 2px;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-main::-webkit-scrollbar { display: none; }

.nav-main a {
  text-decoration: none;
  color: var(--fg);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-pill);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-main a:hover { background: var(--blue-50); }
.nav-main a.active { background: var(--trust); color: var(--white); }

.nav-side { display: flex; align-items: center; gap: var(--sp-3); font-size: 14px; flex-shrink: 0; }
.nav-side .location-badge {
  background: var(--blue-100);
  color: var(--trust);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-weight: 600;
}

.search-form { display: flex; flex-shrink: 0; }
.search-form input {
  border: 1px solid var(--border);
  border-radius: var(--r-pill) 0 0 var(--r-pill);
  padding: 6px 14px;
  font-size: 14px;
  width: 140px;
}
.search-form button {
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  border: 1px solid var(--trust);
  background: var(--trust);
  color: var(--white);
  padding: 0 14px;
  cursor: pointer;
}

/* --- Buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: none;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 22px;
  cursor: pointer;
  background: var(--trust);
  color: var(--white);
  transition: background 0.15s var(--ease), transform 0.05s var(--ease);
  text-decoration: none;
}
.btn:hover { background: var(--blue-600); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--trust); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--blue-50); }

.btn-life { background: var(--life); }
.btn-life:hover { background: #2f8f2b; }

.btn-error { background: var(--error); }
.btn-error:hover { background: #8f2a19; }

.btn-big {
  font-size: 18px;
  padding: 20px 28px;
  border-radius: var(--r-lg);
  width: 100%;
}

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.btn-row.single { grid-template-columns: 1fr; }

/* --- Cards / Boxen ----------------------------------------------------- */

.box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-5);
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  padding: var(--sp-4);
  transition: box-shadow 0.15s var(--ease);
}
.card:hover { box-shadow: var(--sh-2); }

.section-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 700;
  margin: var(--sp-6) 0 var(--sp-3);
}

/* --- Ampel ------------------------------------------------------------ */

.ampel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 13px;
}
.ampel::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }

.ampel-rot { background: var(--ampel-rot-bg); color: var(--ampel-rot); }
.ampel-rot::before { background: var(--ampel-rot); }

.ampel-gelb { background: var(--ampel-gelb-bg); color: var(--ampel-gelb); }
.ampel-gelb::before { background: var(--ampel-gelb); }

.ampel-gruen { background: var(--ampel-gruen-bg); color: var(--ampel-gruen); }
.ampel-gruen::before { background: var(--ampel-gruen); }

.ampel-neu { background: var(--blue-50); color: var(--fg-2); }
.ampel-neu::before { background: var(--fg-3); }

.bgs-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--sun);
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

.badge-overdue {
  display: inline-block;
  background: var(--ampel-rot-bg);
  color: var(--ampel-rot);
  font-weight: 700;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

/* --- Forms -------------------------------------------------------------- */

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--fg); }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="time"], input[type="password"], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: var(--sh-focus);
}

.field { margin-bottom: var(--sp-4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

.choice-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.choice-group .chip {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.choice-group .chip.selected { background: var(--trust); color: var(--white); border-color: var(--trust); }

/* --- Tabellen / Listen --------------------------------------------------- */

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

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.list-item:hover { background: var(--blue-50); }
.list-item .time { font-weight: 700; color: var(--trust); width: 56px; flex-shrink: 0; }
.list-item .name { font-weight: 600; flex: 1; }
.list-item .meta { color: var(--fg-2); font-size: 13px; }

/* --- Flash-Meldungen ------------------------------------------------------ */

.flash { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); margin-bottom: var(--sp-4); font-weight: 600; }
.flash-success { background: #E7F6EA; color: var(--success); }
.flash-error { background: #FCEAE8; color: var(--error); }
.flash-info { background: var(--blue-50); color: var(--trust); }

/* --- Wizard -------------------------------------------------------------- */

.wizard-header { margin-bottom: var(--sp-5); }
.wizard-question {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--sp-4);
  text-align: center;
}
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadein 0.2s var(--ease); }

@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.wizard-done {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
}

/* --- Grid-Layout Recall/Dashboard ------------------------------------------ */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); }
.stat-tile { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); }
.stat-tile .value { font-size: 32px; font-weight: 700; color: var(--trust); font-family: "Lexend", sans-serif; }
.stat-tile .label { font-size: 13px; color: var(--fg-2); font-weight: 600; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: end;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.filter-bar .field { margin-bottom: 0; min-width: 160px; }

.empty-state { text-align: center; color: var(--fg-2); padding: var(--sp-7) var(--sp-4); }

/* --- Mobile -------------------------------------------------------------- */

@media (max-width: 720px) {
  body { overflow-x: hidden; }
  .wrap { padding: 0 var(--sp-3); }
  .topbar-inner { flex-wrap: wrap; padding: var(--sp-3); }
  .nav-main { order: 3; width: 100%; justify-content: space-between; }
  .nav-main a { flex: 1; text-align: center; padding: var(--sp-2); }
  .nav-side { width: 100%; order: 2; justify-content: space-between; }
  .search-form { flex: 1; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .btn-row { grid-template-columns: 1fr; }
  .brand img { height: 30px; }
  .search-form input { width: 100%; }

  /* Listenkarten stapeln auf schmalen Screens statt horizontal ueberzulaufen */
  .list-item { flex-wrap: wrap; row-gap: 4px; }
  .list-item .time { width: auto; }
  .list-item .name { flex: 1 1 100%; order: 1; }
  .list-item .time { order: 0; }
  .list-item .meta, .list-item .ampel { order: 2; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .field { min-width: 0; }
}
