/* Finca El Redós – App-Design */
:root {
  --green: #2E3A1F;
  --olive: #556B2F;
  --olive-soft: #EEF0E6;
  --gold: #8C6A2C;
  --gold-light: #C9A75F;
  --gold-soft: #F3ECDD;
  --ink: #161616;
  --text: #3A3A35;
  --muted: #5E5E57;
  --faint: #8A8A82;
  --line: #E2E2DC;
  --line-soft: #EFEFEA;
  --bg: #F4F4F1;
  --field: #FAFAF8;
  --white: #FFFFFF;
  --warn: #8A4A12;
  --warn-soft: #F7EADC;
  --danger: #A23B4B;
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--olive); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }

/* ---------- Grundlayout ---------- */
#app { min-height: 100%; display: flex; }
.sidebar { display: none; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
#view { flex: 1 1 auto; padding-bottom: calc(96px + var(--safe-bottom)); }
.wrap { padding: 16px; display: flex; flex-direction: column; gap: 14px; max-width: 1100px; width: 100%; margin: 0 auto; }

/* Mobile Tab-Leiste: wischbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  background: var(--white); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-bottom));
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a {
  flex: 0 0 76px; scroll-snap-align: start; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; font-weight: 500; color: #6A6A63; text-decoration: none;
}
.tabbar a.on { color: var(--green); font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 22px; flex: 0 0 250px;
    background: var(--green); padding: 26px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .sidebar img { width: 176px; margin: 0 10px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px;
    color: #D9DCCD; font-size: 15px; font-weight: 500; text-decoration: none;
  }
  .sidebar nav a svg { width: 20px; height: 20px; opacity: .85; }
  .sidebar nav a:hover { background: rgba(255,255,255,.07); }
  .sidebar nav a.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
  .sidebar .who { margin-top: auto; color: #B8BDA8; font-size: 13px; padding: 0 12px; }
  .tabbar { display: none; }
  #view { padding-bottom: 32px; }
  .wrap { padding: 28px 32px; }
}

/* ---------- Seitenkopf ---------- */
.pagehead {
  background: var(--white); border-bottom: 1px solid var(--line);
  padding: calc(14px + var(--safe-top)) 16px 12px; display: flex; flex-direction: column; gap: 10px;
}
.pagehead .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pagehead h1, .hero h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--green); line-height: 1.1; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; font-size: 15px; font-weight: 500; color: var(--olive); text-decoration: none; }
.back svg { width: 20px; height: 20px; }
@media (min-width: 900px) { .pagehead { padding: 24px 32px 16px; } .pagehead h1 { font-size: 36px; } }

.hero { background: var(--green); padding: calc(18px + var(--safe-top)) 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.hero h1 { color: #fff; }
.hero p { color: #D9DCCD; font-size: 14px; margin-top: 2px; }
.hero .logo { width: 128px; }
.hero.dark .back { color: #D9DCCD; }
@media (min-width: 900px) { .hero .logo { display: none; } .hero { padding: 28px 32px; } }

.iconbtn {
  width: 44px; height: 44px; border-radius: 22px; flex: 0 0 auto; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--white); color: var(--green);
}
.hero .iconbtn { border-color: rgba(255,255,255,.25); background: transparent; color: #fff; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bausteine ---------- */
.card { background: var(--white); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card h2, .sect { font-size: 16px; font-weight: 600; }
.sect-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-caps { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .grid3.tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > .main-col { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cols > .side-col { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.btn {
  min-height: 48px; padding: 0 16px; border-radius: 12px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green); color: #fff; font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn.secondary { background: var(--white); color: var(--green); border: 1.5px solid var(--olive); }
.btn.soft { background: var(--olive-soft); color: var(--green); }
.btn.danger { background: var(--white); color: var(--danger); border: 1.5px solid #E5C3C9; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 12px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .55; }
.wa { background: #1F7A4A; }

.tile {
  background: var(--white); border-radius: var(--radius); min-height: 88px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; text-align: center;
}
.tile svg { width: 26px; height: 26px; color: var(--olive); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrapit { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: 0 0 auto; min-height: 36px; padding: 0 12px; border-radius: 18px;
  border: 1.5px solid #D6D6CF; background: var(--white); color: var(--text);
  font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
}
.chip.on { background: var(--olive); border-color: var(--olive); color: #fff; }
.chip.add { border-style: dashed; border-color: var(--gold); color: #6B4F1D; }
.chip.off { background: var(--bg); color: var(--faint); border-style: dashed; }
.dot { width: 12px; height: 12px; border-radius: 6px; flex: 0 0 auto; display: inline-block; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: #ECECE6; padding: 4px; border-radius: 12px; }
.seg button { min-height: 40px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; }
.seg button.on { background: var(--white); color: var(--green); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.badge { font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; background: var(--olive-soft); color: #3F5222; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.late { background: #F6DEE2; color: #8A2435; }

.row-item {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px;
  border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; width: 100%;
  text-align: left; text-decoration: none; color: var(--ink);
}
.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1 1 auto; min-width: 0; }
.row-item .t { font-size: 16px; font-weight: 600; }
.row-item .s { font-size: 14px; color: var(--muted); }
.chev { width: 18px; height: 18px; color: #9A9A92; flex: 0 0 auto; }

.next-item { background: var(--white); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.next-item .bar { width: 8px; align-self: stretch; min-height: 40px; border-radius: 4px; flex: 0 0 auto; }
.next-item .t { font-size: 16px; font-weight: 600; }
.next-item .s { font-size: 14px; color: var(--muted); }

.avatar {
  width: 44px; height: 44px; border-radius: 22px; border: 3px solid var(--olive); background: var(--bg);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  font-weight: 600; font-size: 17px; color: var(--green); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 84px; height: 84px; border-radius: 42px; border-width: 4px; font-size: 32px; font-family: var(--serif); position: relative; overflow: visible; }
.avatar.big img { border-radius: 50%; }
.avatar .cam {
  position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; border-radius: 15px;
  background: var(--gold-light); border: 2px solid var(--green); display: flex; align-items: center; justify-content: center;
}
.avatar .cam svg { width: 15px; height: 15px; color: var(--ink); }

.progress { height: 10px; border-radius: 5px; background: #ECECE6; overflow: hidden; }
.progress > div { height: 100%; border-radius: 5px; background: var(--olive); }
.progress.warn > div { background: #B5651D; }

.kv { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 40px; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv span:last-child { color: var(--muted); font-size: 14px; text-align: right; }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 4px -20px -20px; }
.tabs button { min-height: 46px; border: 0; background: transparent; color: #B8BDA8; font-size: 14px; font-weight: 600; }
.tabs button.on { color: #fff; box-shadow: inset 0 -3px 0 var(--gold-light); }
@media (min-width: 900px) { .tabs { margin: 4px -32px -28px; max-width: 640px; } }

.filechip { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 9px; background: var(--olive-soft); color: var(--green); font-size: 14px; font-weight: 600; border: 0; }
.filechip svg { width: 16px; height: 16px; }
.empty { text-align: center; color: var(--muted); font-size: 15px; padding: 18px 8px; }
.note { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- Formulare & Dialoge ---------- */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 0 14px; font-size: 16px;
  border: 1.5px solid #D6D6CF; border-radius: 12px; background: var(--field); color: var(--ink);
}
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #6A6A63 50%), linear-gradient(135deg, #6A6A63 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; }
.input:focus { outline: 2px solid var(--olive); outline-offset: 0; border-color: var(--olive); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--olive); margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 36px; height: 36px; border-radius: 18px; border: 3px solid #fff; box-shadow: 0 0 0 1px #D6D6CF; }
.swatches input:checked + span { border-color: var(--ink); }
.swatches input:focus-visible + span { outline: 2px solid var(--olive); outline-offset: 2px; }

dialog.sheet {
  border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh;
  margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--white); color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(22,22,22,.45); }
@media (min-width: 900px) { dialog.sheet { margin: auto; border-radius: 20px; } }
.sheet form { display: flex; flex-direction: column; max-height: inherit; }
.sheet .sh-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.sheet .sh-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--green); }
.sheet .sh-body { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.sheet .sh-foot { padding: 12px 16px calc(16px + var(--safe-bottom)); display: flex; gap: 8px; border-top: 1px solid var(--line-soft); }
.sheet .sh-foot .btn { flex: 1 1 auto; }

/* ---------- Toast / Rückgängig ---------- */
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(84px + var(--safe-bottom)); z-index: 50; max-width: 520px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast .grow { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600; }
.toast .sub { font-size: 13px; color: #CFCFC8; font-weight: 400; }
.toast button { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--gold-light); color: var(--ink); font-weight: 600; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Einkaufsliste ---------- */
.shop-item {
  width: 100%; min-height: 50px; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  border: 0; background: transparent; text-align: left;
}
.shop-item .box { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; border: 2px solid #B9B9B0; background: #fff; }
.shop-item .n { flex: 1 1 auto; font-size: 16px; }
.shop-item .q { font-size: 13px; color: #6A6A63; }
.shop-item.done .n { color: var(--faint); text-decoration: line-through; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: #3F5222; background: var(--olive-soft); padding: 6px 10px; border-radius: 20px; }
.live i { width: 8px; height: 8px; border-radius: 4px; background: #4E8A2E; }
.live.off { color: var(--muted); background: #ECECE6; } .live.off i { background: #9A9A92; }

/* ---------- Kalender ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal .wd { padding: 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6A6A63; text-align: center; }
.cal .day { min-height: 50px; padding: 4px; border-radius: 9px; background: var(--field); border: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: left; }
.cal .day.out { background: #F1F1EC; }
.cal .day.out .num { color: #9A9A92; }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--olive); }
.cal .num { width: 24px; height: 24px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--text); }
.cal .today .num { background: var(--green); color: #fff; }
.cal .dots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.cal .dots i { width: 7px; height: 7px; border-radius: 4px; }
.cal .ev { display: none; }
@media (min-width: 900px) {
  .cal { gap: 4px; }
  .cal .day { min-height: 96px; align-items: stretch; padding: 6px; }
  .cal .dots { display: none; }
  .cal .ev { display: block; margin-top: 2px; padding: 2px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.daylist .ev-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); width: 100%; border-left: 0; border-right: 0; border-top: 0; background: transparent; text-align: left; }
.daylist .ev-row .bar { width: 6px; min-height: 36px; align-self: stretch; border-radius: 3px; flex: 0 0 auto; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; background: #fff; display: flex; flex-direction: column; align-items: center; padding: calc(56px + var(--safe-top)) 28px 32px; }
.login > div { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.login img { width: 260px; align-self: center; }
.login .tag { text-align: center; color: var(--muted); font-size: 15px; margin-top: -6px; }
.login .err { background: #F6DEE2; color: #8A2435; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.login .ok { background: var(--olive-soft); color: #3F5222; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.linkbtn { background: none; border: 0; color: var(--olive); font-weight: 500; font-size: 15px; padding: 10px; align-self: center; }

.center-msg { padding: 60px 24px; text-align: center; color: var(--muted); }
.grid2 .btn { white-space: normal; text-align: center; }
