:root {
  --rot: #7a1f1f;
  --rot-dunkel: #5c1616;
  --pergament: #f7f1e3;
  --karte: #ffffff;
  --text: #2b2320;
  --text-hell: #7a6f66;
  --rand: #e3d9c6;
  --radius: 14px;
  --schatten: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--pergament);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

/* Kopfzeile */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--rot);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.app-header h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.app-header h1 span { display: block; font-size: .72rem; font-weight: 400; opacity: .85; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.3rem; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,.3); }
.icon-btn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view { padding: 14px 14px 4px; max-width: 720px; margin: 0 auto; }

/* Karten */
.card {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 14px 16px;
  margin-bottom: 12px;
}

/* Login */
.login-card { margin-top: 10vh; text-align: center; }
.login-card input {
  width: 100%; padding: 12px; margin: 12px 0 8px;
  font-size: 1rem; border: 1px solid var(--rand); border-radius: 10px;
}
button.primary {
  width: 100%; padding: 12px; font-size: 1rem; font-weight: 600;
  background: var(--rot); color: #fff; border: none; border-radius: 10px; cursor: pointer;
}
button.primary:active { background: var(--rot-dunkel); }
.error { color: #b00020; font-size: .9rem; }

/* Suche */
.searchbox input {
  width: 100%; padding: 13px 16px; font-size: 1.05rem;
  border: 1px solid var(--rand); border-radius: 12px;
  background: var(--karte); box-shadow: var(--schatten);
}
.suggestions {
  background: var(--karte); border: 1px solid var(--rand);
  border-radius: 12px; margin-top: 6px; overflow: hidden; box-shadow: var(--schatten);
}
.suggestions button {
  display: block; width: 100%; text-align: left;
  padding: 12px 16px; border: none; background: none;
  font-size: 1rem; cursor: pointer; border-bottom: 1px solid var(--rand);
}
.suggestions button:last-child { border-bottom: none; }
.suggestions button:active { background: var(--pergament); }

/* Personen-Plan */
.person-name {
  font-size: 1.25rem; font-weight: 700; margin: 16px 2px 10px;
}
.day-block h3 {
  margin: 14px 2px 8px; font-size: 1rem; color: var(--rot);
  text-transform: uppercase; letter-spacing: .04em;
}
.shift {
  display: flex; align-items: center; gap: 12px;
  background: var(--karte); border: 1px solid var(--rand);
  border-left: 6px solid var(--stationsfarbe, var(--rot));
  border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 12px 14px; margin-bottom: 8px;
}
.shift .time { font-weight: 700; white-space: nowrap; min-width: 105px; }
.shift .station { font-size: 1.02rem; }
.free-note { color: var(--text-hell); font-size: .92rem; margin: 4px 2px 12px; }

/* Tages-Chips */
.chips { display: flex; gap: 8px; margin-bottom: 14px; }
.chips button {
  flex: 1; padding: 10px 0; font-size: .95rem; font-weight: 600;
  border: 1px solid var(--rand); border-radius: 999px;
  background: var(--karte); cursor: pointer; color: var(--text);
}
.chips button.active { background: var(--rot); border-color: var(--rot); color: #fff; }

/* Stations-Karten im Tagesplan */
.station-card { padding: 0; overflow: hidden; }
.station-card h3 {
  margin: 0; padding: 10px 16px; font-size: 1rem; color: #fff;
  background: var(--stationsfarbe, var(--rot));
}
.station-card .range {
  padding: 10px 16px; border-top: 1px solid var(--rand);
}
.station-card .range .rtime { font-weight: 700; font-size: .92rem; }
.station-card .range .rnames { font-size: .95rem; color: var(--text); margin-top: 2px; line-height: 1.45; }
.station-card .range .rnames b { background: #fff3bf; border-radius: 4px; padding: 0 3px; }

.empty-hint { text-align: center; color: var(--text-hell); padding: 30px 10px; }

/* Fußzeile / Meta */
.meta {
  text-align: center; font-size: .78rem; color: var(--text-hell);
  padding: 8px 0 4px;
}

/* Tab-Leiste */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex;
  background: var(--karte); border-top: 1px solid var(--rand);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab {
  flex: 1; padding: 9px 0 7px; border: none; background: none;
  font-size: .8rem; color: var(--text-hell); cursor: pointer;
}
.tabbar .tab .tab-icon { display: block; font-size: 1.25rem; margin-bottom: 2px; }
.tabbar .tab.active { color: var(--rot); font-weight: 700; }

.offline {
  position: fixed; bottom: calc(64px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: #4a4137; color: #fff; font-size: .82rem;
  padding: 7px 14px; border-radius: 999px; box-shadow: var(--schatten);
}

@media (min-width: 720px) {
  .chips { max-width: 420px; }
}
