/* Hostel-App Kali Code Home – ruhig, warm, wenig auf einmal. */

:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --text: #1f1e1d;
  --muted: #6f6b63;
  --line: #e7e3d8;
  --accent: #c96442;
  --accent-strong: #b5583a;
  --accent-soft: #f6e6de;
  --ok: #4f6f45;
  --ok-soft: #e6eedf;
  --danger: #b4432f;
  --danger-soft: #f8e3dd;
  --shadow: 0 1px 2px rgba(31, 30, 29, 0.04), 0 6px 20px rgba(31, 30, 29, 0.04);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Charter, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b19;
    --surface: #262522;
    --surface-2: #31302c;
    --text: #f2f0ea;
    --muted: #a6a29a;
    --line: #3a3834;
    --accent: #d97757;
    --accent-strong: #e38a6c;
    --accent-soft: #3d2a22;
    --ok: #9cbc8b;
    --ok-soft: #26301f;
    --danger: #e98a74;
    --danger-soft: #3e2520;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.block { display: block; }
.center { text-align: center; }
.lead { font-size: 17px; color: var(--muted); margin-bottom: 18px; }

/* Rahmen der App */
.app {
  max-width: 640px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 16px;
}
.topbar-text { min-width: 0; }
.topbar h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
.subtitle { color: var(--muted); margin: 4px 0 0; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 6px -6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 16px;
}
.back svg { width: 22px; height: 22px; }

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.avatar.small { width: 34px; height: 34px; font-size: 14px; }

/* Untere Leiste mit den fünf Bereichen */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 4px;
  list-style: none;
}
.tabbar li { flex: 1; min-width: 0; }
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 26px; height: 26px; }

/* Karten und Listen */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card h2, .section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.section-title { margin: 24px 4px 8px; }
.card-title { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 8px; }
.card.highlight { border-color: var(--accent); }
.big {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.1;
  margin: 0 0 2px;
  font-variant-numeric: tabular-nums;
}
progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  margin: 14px 0 12px;
  border: 0;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.list > * + * { border-top: 1px solid var(--line); }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
a.row:active, button.row:active, summary.row:active { background: var(--surface-2); }
.row .label { flex: 1; min-width: 0; }
.row .value { color: var(--muted); font-size: 15px; white-space: nowrap; }
.row .icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.row .icon svg { width: 19px; height: 19px; }
.row .icon-danger { background: var(--danger-soft); color: var(--danger); }
.row .chev { flex: none; color: var(--muted); display: grid; }
.row .chev svg { width: 18px; height: 18px; }
.row .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.danger-text { color: var(--danger); }

details.person > summary { list-style: none; }
details.person > summary::-webkit-details-marker { display: none; }
details.person[open] .chev svg { transform: rotate(90deg); }
.person-actions { padding: 4px 16px 16px 62px; display: grid; gap: 10px; }
.person-actions form.inline { display: flex; gap: 8px; }
.person-actions select { min-height: 40px; padding: 6px 10px; }

/* Leere Bereiche (kommen in späteren Stufen) */
.empty { text-align: center; padding: 36px 22px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }
.bigicon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.bigicon svg { width: 32px; height: 32px; }
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* Knöpfe */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: 600 16px/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: scale(0.985); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { width: auto; min-height: 38px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.card .btn + .btn, .card .btn + form, .card form + .btn, .stack > * + * { margin-top: 10px; }
.link {
  background: none;
  border: 0;
  padding: 12px;
  color: var(--accent);
  font: 500 15px var(--font);
  cursor: pointer;
}

/* Formulare (Django rendert jedes Feld in einem div) */
form > div { margin-bottom: 16px; }
label { display: block; font-size: 15px; font-weight: 500; margin: 0 0 6px; }
input[type="text"], input[type="password"], input[type="email"], input:not([type]), select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 16px var(--font);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[autocomplete="one-time-code"] {
  font: 600 28px var(--mono);
  letter-spacing: 0.35em;
  text-align: center;
  padding-left: calc(14px + 0.35em);
}
.helptext { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.helptext ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { list-style: none; padding: 0; margin: 0 0 6px; color: var(--danger); font-size: 14px; }
.errorlist.nonfield { background: var(--danger-soft); padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; }

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin: 0 0 6px;
  border-radius: 12px;
  background: var(--surface-2);
}
.segmented button {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: 500 14px var(--font);
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }

/* Meldungen */
.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li {
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 500;
}
.messages li.error, .messages li.warning { background: var(--danger-soft); color: var(--danger); }

/* Zwei-Faktor, Einladungen */
.steps { padding-left: 22px; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
.qr {
  display: block;
  width: 220px;
  height: 220px;
  margin: 14px auto;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
  image-rendering: pixelated;
}
.secret {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font: 15px/1.5 var(--mono);
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-all;
}
.push-status { font-weight: 500; }
.hint { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 15px; }
.plain { margin: 0; padding-left: 18px; }
.plain li { margin-bottom: 4px; }

/* Anmeldeseiten */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.auth-card { width: 100%; max-width: 400px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; text-align: center; }
.brand img { width: 64px; height: 64px; border-radius: 16px; }
.brand h1 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 4px 0 0; }
.langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 22px; }
.langs button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: none;
  color: var(--muted);
  font: 500 13px var(--font);
  cursor: pointer;
}
.langs button[aria-current="true"] { border-color: var(--accent); color: var(--accent); }

@media (min-width: 700px) {
  .topbar h1 { font-size: 36px; }
  .tabbar a { flex-direction: row; justify-content: center; gap: 8px; padding: 12px 0; font-size: 13px; }
  .tabbar svg { width: 22px; height: 22px; }
}
