/* ============ Mein Smoles Zuhause — Apple-inspired UI ============ */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --blue: #0071e3;
  --blue-tint: rgba(0, 113, 227, 0.1);
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --separator: rgba(60, 60, 67, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.18);
  --blur-bg: rgba(245, 245, 247, 0.72);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --blue: #0a84ff;
    --blue-tint: rgba(10, 132, 255, 0.16);
    --separator: rgba(84, 84, 88, 0.48);
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
    --blur-bg: rgba(0, 0, 0, 0.72);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ---------- Navbar (frosted glass) ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--blur-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.navbar-inner {
  max-width: 980px; margin: 0 auto; padding: 0 22px;
  height: 52px; display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 20px; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { font-size: 14px; color: var(--text-2); transition: color .2s; font-weight: 450; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); font-weight: 600; }

/* ---------- Bottom tab bar (mobile, iOS style) ---------- */
.tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--blur-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 10px; color: var(--text-3); font-weight: 500;
}
.tabbar a.active { color: var(--blue); }
.tab-icon { font-size: 20px; line-height: 1; }

/* ---------- Layout ---------- */
main { max-width: 980px; margin: 0 auto; padding: 28px 22px 90px; }
.page-title { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 4px; }
.page-sub { font-size: 16px; color: var(--text-2); margin-bottom: 28px; }
.section-title { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; margin: 34px 0 14px; }
.breadcrumb { font-size: 14px; color: var(--text-3); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--blue); }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 740px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Room tiles ---------- */
.room-tile {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; cursor: pointer; transition: transform .25s cubic-bezier(.2,.8,.3,1), box-shadow .25s;
  display: block; color: var(--text);
}
.room-tile:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }
.room-tile:active { transform: scale(0.98); }
.room-emoji { font-size: 34px; display: block; margin-bottom: 12px; }
.room-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.room-meta { font-size: 13px; color: var(--text-3); margin-top: 3px; }

/* ---------- Stat cards ---------- */
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-3); text-transform: none; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value.green { color: var(--green); }
.stat-value.orange { color: var(--orange); }

/* ---------- Progress bar ---------- */
.progress-track { height: 6px; background: var(--separator); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width .6s cubic-bezier(.2,.8,.3,1); }

/* ---------- Item rows ---------- */
.item-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 14px 16px; cursor: pointer; color: var(--text);
  transition: transform .2s cubic-bezier(.2,.8,.3,1);
}
.item-row:hover { transform: scale(1.01); }
.item-thumb {
  width: 52px; height: 52px; border-radius: 10px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  object-fit: cover; overflow: hidden; flex-shrink: 0;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.item-sub { font-size: 13px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-right { text-align: right; flex-shrink: 0; }
.item-price { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chevron { color: var(--text-3); font-size: 14px; margin-left: 4px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.badge.kandidat { background: rgba(142,142,147,.14); color: var(--text-2); }
.badge.ausgewaehlt { background: var(--blue-tint); color: var(--blue); }
.badge.bestellt { background: rgba(255,149,0,.14); color: var(--orange); }
.badge.geliefert { background: rgba(52,199,89,.15); color: var(--green); }
.badge.verworfen { background: rgba(255,59,48,.12); color: var(--red); }

/* ---------- Variant cards ---------- */
.variant-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  border: 2px solid transparent; transition: border-color .25s, transform .2s;
  position: relative;
}
.variant-card.chosen { border-color: var(--blue); }
.variant-card.dimmed { opacity: .55; }
.variant-img {
  width: 100%; aspect-ratio: 4/3; background: var(--bg); object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--text-3);
}
img.variant-img { object-fit: cover; }
.variant-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.variant-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.variant-shop { font-size: 13px; color: var(--text-3); }
.variant-price { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.variant-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }
.check-ring {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ---------- Buttons (Apple pills) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 500; padding: 8px 18px; border-radius: 999px;
  transition: transform .15s, opacity .2s, background .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: var(--blue-tint); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--blue); padding: 8px 10px; }
.btn-danger { background: rgba(255,59,48,.1); color: var(--red); }
.btn-sm { font-size: 13px; padding: 6px 14px; }
.btn-lg { font-size: 16px; padding: 12px 26px; font-weight: 600; }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex; background: rgba(118,118,128,.12); border-radius: 10px; padding: 2px; gap: 2px;
}
.segmented button {
  font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 8px; color: var(--text-2);
  transition: all .2s;
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); font-weight: 600; }

/* ---------- List (Einkaufsliste, iOS grouped) ---------- */
.ios-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ios-list-header {
  padding: 10px 18px 6px; font-size: 13px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.ios-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-top: 0.5px solid var(--separator);
}
.ios-row:first-of-type { border-top: none; }
.ios-row-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--bg); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px; overflow: hidden; }
.ios-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ios-row-main { flex: 1; min-width: 0; }
.ios-row-title { font-size: 15px; font-weight: 550; }
.ios-row-sub { font-size: 13px; color: var(--text-3); }
.ios-row-price { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.room-total-row { background: rgba(118,118,128,.06); font-weight: 600; }

/* ---------- Status select (inline) ---------- */
.status-select {
  appearance: none; -webkit-appearance: none;
  border: none; border-radius: 999px; font-size: 12px; font-weight: 600;
  padding: 4px 22px 4px 10px; cursor: pointer;
  background-repeat: no-repeat; background-position: right 8px center; background-size: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.status-select.ausgewaehlt { background-color: var(--blue-tint); color: var(--blue); }
.status-select.bestellt { background-color: rgba(255,149,0,.14); color: var(--orange); }
.status-select.geliefert { background-color: rgba(52,199,89,.15); color: var(--green); }

/* ---------- Sheet (modal, iOS style) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .25s;
}
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } }
.sheet {
  background: var(--card); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  animation: slideUp .35s cubic-bezier(.2,.8,.3,1);
}
@media (min-width: 600px) { .sheet { border-radius: 22px; padding-bottom: 24px; } }
.sheet-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 18px; }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--separator); margin: -8px auto 14px; }
@media (min-width: 600px) { .sheet-grabber { display: none; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--separator); background: var(--bg); color: var(--text);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- File drop ---------- */
.file-drop {
  border: 1.5px dashed var(--separator); border-radius: var(--radius-sm);
  padding: 18px; text-align: center; color: var(--text-3); font-size: 14px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.file-drop:hover, .file-drop.drag { border-color: var(--blue); background: var(--blue-tint); color: var(--blue); }
.file-drop img { max-height: 120px; border-radius: 8px; margin-top: 10px; }

/* ---------- Tasks ---------- */
.task-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-top: .5px solid var(--separator); }
.task-row:first-child { border-top: none; }
.task-check {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--text-3);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 13px; font-weight: 700; transition: all .2s;
}
.task-check.done { background: var(--green); border-color: var(--green); color: #fff; }
.task-title { flex: 1; font-size: 15px; }
.task-title.done { text-decoration: line-through; color: var(--text-3); }
.task-meta { font-size: 12px; color: var(--text-3); flex-shrink: 0; }

/* ---------- Collage ---------- */
.collage { columns: 3; column-gap: 12px; }
@media (max-width: 640px) { .collage { columns: 2; } }
.collage-item { break-inside: avoid; margin-bottom: 12px; border-radius: var(--radius-sm); overflow: hidden; position: relative; box-shadow: var(--shadow); }
.collage-item img { width: 100%; display: block; }
.collage-caption {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 20px 12px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: 12px; font-weight: 600;
}

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty-icon { font-size: 44px; margin-bottom: 12px; display: block; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty p { font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 550;
  padding: 11px 22px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 200;
  animation: toastIn .3s cubic-bezier(.2,.8,.3,1);
}
@keyframes toastIn { from { transform: translate(-50%, 16px); opacity: 0; } }

/* ---------- Page transition ---------- */
.page { animation: pageIn .35s cubic-bezier(.2,.8,.3,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550;
  background: var(--bg); border-radius: 999px; padding: 5px 12px; color: var(--text-2);
}
.doc-chip a { color: var(--blue); }
.hint { font-size: 12px; color: var(--text-3); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .tabbar { display: flex; }
  .page-title { font-size: 28px; }
  main { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
