:root {
  --bg: #2a211c;
  --bg-2: #352c27;
  --card: #3d322c;
  --text: #f4efe8;
  --muted: #c4b8a8;
  --accent: #c4784a;
  --soon: #d4a05a;
  --line: #4a3f38;
  --rail: 4.75rem;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}
button { background: var(--accent); color: var(--bg); border: 0; cursor: pointer; font-weight: 600; }
button.text-btn, .text-btn {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding: 0.35rem 0.5rem;
}
.text-btn.is-on { color: var(--text); background: var(--card); }
h1, h2 { font-weight: 600; letter-spacing: 0.01em; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 0.95rem; margin: 0 0 0.5rem; color: var(--muted); font-weight: 600; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  z-index: 20;
}
.rail-end { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.icon-btn {
  width: 3.15rem;
  height: 3.15rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
}
.icon-btn svg { width: 2rem; height: 2rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.is-active { color: var(--bg); background: var(--accent); }
.who {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
}
.main { margin-left: var(--rail); padding: 1.7rem 1.5rem 5rem; min-height: 100vh; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.icon-scan {
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.icon-scan svg {
  width: 1.55rem;
  height: 1.55rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-row {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.icon-row svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.left-slider { margin: 0.55rem 0 0.8rem; }
.left-slider .left-label { margin-bottom: 0.35rem; }
.left-slider input[type="range"] {
  width: 100%;
  min-height: 2.75rem;
  accent-color: var(--accent);
  padding: 0;
  background: transparent;
  border: 0;
}
.app-ver {
  position: fixed;
  top: 0.4rem;
  right: 0.7rem;
  z-index: 30;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  pointer-events: none;
}
.muted { color: var(--muted); }
.flash { background: var(--card); padding: 0.7rem 1rem; border-radius: 8px; }

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.widget {
  background: var(--card);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.15rem;
  min-height: 8rem;
}
.widget.size-s { grid-column: span 1; }
.widget.size-m { grid-column: span 2; }
.widget.size-l { grid-column: span 4; }
.widget-bar { display: flex; justify-content: space-between; min-height: 1.2rem; }
.board.is-edit .widget { outline: 1px dashed var(--accent); }
.clock-time { font-size: clamp(3rem, 8vw, 6rem); font-variant-numeric: tabular-nums; line-height: 0.95; font-family: Georgia, "Times New Roman", serif; }
.clock-date { margin: 0.35rem 0 0; color: var(--muted); font-size: 1.15rem; }
.big-num { font-size: 3rem; margin: 0; font-variant-numeric: tabular-nums; }
.weather-now { font-size: 2.4rem; margin: 0; }
.weather-hit, .widget-hit { color: inherit; text-decoration: none; display: block; }
.board.is-edit .weather-hit,
.board.is-edit .widget-hit { pointer-events: none; }
.wx-top { display: flex; align-items: center; gap: 0.7rem; }
.wx-svg { width: 2.4rem; height: 2.4rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.wx-day-label { margin: 0.15rem 0 0; font-size: 1.15rem; }
.wx-periods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin: 0.7rem 0 0.4rem;
}
.wx-period, .wx-hour, .wx-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 0.45rem 0.2rem;
}
.wx-period span, .wx-hour span, .wx-day span { color: var(--muted); font-size: 0.75rem; }
.wx-period em, .wx-day em { font-style: normal; font-size: 0.78rem; }
.wx-period .wx-svg, .wx-hour .wx-svg, .wx-day .wx-svg { width: 1.55rem; height: 1.55rem; }
.wx-hours, .wx-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr)); gap: 0.4rem; margin-top: 0.7rem; }
.wx-warns { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }
.wx-cues { margin-left: auto; display: flex; align-items: center; gap: 0.45rem; }
.wx-umb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 2.5rem;
  color: var(--muted);
}
.wx-umb.is-yes { color: #7eb6d9; }
.wx-umb em { font-style: normal; font-size: 0.7rem; }
.wx-umb-svg { width: 1.55rem; height: 1.55rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wx-chart-wrap { margin: 0.85rem 0 0.2rem; }
.wx-chart { width: 100%; height: auto; display: block; }
.wx-chart-grid { stroke: var(--line); stroke-width: 1; }
.wx-chart-x, .wx-chart-y { fill: var(--muted); font-size: 11px; }
.wx-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.wx-line-temp { stroke: var(--accent); }
.wx-line-sun { stroke: var(--soon); }
.wx-line-rain { stroke: #7eb6d9; }
.wx-line-cloud { stroke: var(--muted); }
.wx-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.wx-chart-legend span { display: flex; align-items: center; gap: 0.35rem; }
.wx-chart-legend i {
  width: 1.1rem;
  height: 0.2rem;
  border-radius: 2px;
  display: inline-block;
}
.wx-swatch-temp { background: var(--accent); }
.wx-swatch-sun { background: var(--soon); }
.wx-swatch-rain { background: #7eb6d9; }
.wx-swatch-cloud { background: var(--muted); }
.wx-flag {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.wx-flag-svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.wx-alert {
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.6rem 0;
  font-size: 0.85rem;
}
.wx-when { margin: 0.1rem 0 0.55rem; font-weight: 650; }
.wx-lvl-1 { background: #7a6a28; color: #f8efc4; }
.wx-lvl-2 { background: #8a4a1c; color: #fde4c8; }
.wx-lvl-3 { background: #7a2a28; color: #f8d4d0; }
.wx-alert h2 { color: inherit; margin-bottom: 0.35rem; }
.wx-alert h3 { font-size: 0.85rem; margin: 0.7rem 0 0.25rem; }
.wx-alert ul { margin: 0; padding-left: 1.1rem; }
.wx-now-block { margin-bottom: 1rem; }
.weather-page .wx-top .wx-svg { width: 3.2rem; height: 3.2rem; }
.weather-page .weather-now { font-size: 3rem; }

.list { list-style: none; padding: 0; margin: 0 0 5rem; }
.list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  border: 0;
}
.list li[hidden] { display: none; }
.grow { flex: 1; }
.is-done .grow { opacity: 0.45; text-decoration: line-through; }
.check-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--accent);
  padding: 0;
}
.add-bar {
  position: fixed;
  left: var(--rail);
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.add-text-wrap { position: relative; flex: 1; min-width: 0; }
.add-bar input[name="text"] { width: 100%; }
.add-bar input[name="qty"] { width: 4rem; }
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.35rem);
  z-index: 16;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 14rem;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.suggest li { margin: 0; }
.suggest button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
.suggest button.is-on, .suggest button:hover { background: var(--bg-2); }
.suggest .hint { color: var(--muted); font-weight: 400; font-size: 0.82em; }
.card { background: var(--card); border-radius: 14px; padding: 1rem; margin-bottom: 1rem; }
.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.crumb a { text-decoration: none; }
.crumb a::after, .crumb span + span::before { content: none; }
.crumb a + a::before, .crumb a + span::before {
  content: "›";
  margin-right: 0.5rem;
  color: var(--muted);
}
.loc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.65rem;
  margin: 0 0 1rem;
}
.loc-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  border-radius: 12px;
  padding: 0.9rem 0.95rem;
  min-height: 4.4rem;
}
.loc-card strong { font-size: 1.05rem; }
.loc-card.is-urgent strong { color: var(--accent); }
.loc-items { margin: 0 0 1rem; }
.item-link { color: inherit; text-decoration: none; }
.item-link:hover { color: var(--accent); }
.vorrat-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  margin: 0 0 0.7rem;
}
.vorrat-search { margin: 0; flex: 1 1 10rem; max-width: 22rem; }
.vorrat-sort {
  margin-left: auto;
  min-width: 13.5rem;
}
.vorrat-sort select { min-height: 2.75rem; width: 100%; }
.mhd.is-expired { color: var(--accent); font-weight: 650; }
.mhd.is-soon { color: var(--soon); font-weight: 650; }
.item-photos { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.item-photos figure { margin: 0; width: 7.5rem; }
.item-photos img { width: 100%; height: 7.5rem; object-fit: cover; border-radius: 8px; background: var(--bg-2); }
.page-setup { margin: 1.6rem 0 0; }
.page-setup summary {
  color: var(--muted);
  cursor: pointer;
  width: fit-content;
  font-size: 0.9rem;
  list-style: none;
}
.page-setup summary::-webkit-details-marker { display: none; }
.page-setup summary::before { content: "⚙ "; }
.page-setup[open] summary { margin-bottom: 0.7rem; }
.loc-levels { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.loc-levels select { min-width: 8.5rem; flex: 1; }
.stack { display: flex; flex-direction: column; gap: 0.7rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.8rem; list-style: none; padding: 0; }
.cards img { width: 100%; height: 8rem; object-fit: cover; border-radius: 8px; }
label { display: flex; flex-direction: column; gap: 0.3rem; }
.check { flex-direction: row; align-items: center; gap: 0.5rem; }
.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: min(22rem, 100%); }
.auth-card h1 { margin-bottom: 0.5rem; }

#cam { width: 100%; border-radius: 10px; background: #000; }
.switch-bar.switch-3 { grid-template-columns: 1fr 1fr 1fr; }
.todo-sort { margin: 0 0 0.8rem; max-width: 22rem; margin-left: 0; }
.shop-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.shop-filters-label { margin-right: 0.15rem; }
.shop-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
  text-decoration: none;
}
.shop-chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.switch-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem;
  margin: 0 0 1.15rem;
  padding: 0.22rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.switch-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.7rem 0.5rem;
  border-radius: 9px;
  font-weight: 650;
}
.switch-item svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.switch-item.is-active {
  color: var(--text);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}
.food-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.scan-btn { min-width: 6rem; }
.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1rem 5.5rem;
}
.scan-overlay[hidden] { display: none; }
#scan-video, #scan-reader { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-mode, .scan-hint { position: relative; color: #f4efe8; margin: 0 0 0.35rem; }
.scan-mode { font-weight: 650; font-size: 1.1rem; }
.scan-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
}
.scan-overlay .text-btn { color: #f4efe8; }
.sheet { border: 0; border-radius: 14px; padding: 1rem; width: min(24rem, 94vw); max-height: 90vh; overflow: auto; background: var(--card); color: var(--text); }
#result-body:empty { display: none; }
.sheet::backdrop { background: rgba(0,0,0,0.45); }
.sheet menu { display: flex; gap: 0.5rem; padding: 0; margin: 0.6rem 0 0; }
.sheet-actions { display: flex; gap: 0.5rem; }
.sheet-actions > button { flex: 1; min-height: 44px; }
.sheet-actions > [hidden] { display: none; }
.transfer-row { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.7rem; margin: 0 0 0.6rem; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.cal-nav h2 { margin: 0; color: var(--text); font-size: 1.1rem; text-align: center; }
.cal-nav .text-btn {
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.cal-day {
  background: var(--card);
  border-radius: 10px;
  min-height: 6.4rem;
  padding: 0.35rem 0.4rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.cal-day.is-out { opacity: 0.45; }
.cal-day.is-today { outline: 2px solid var(--accent); }
.cal-day-num {
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  min-height: 1.8rem;
  display: inline-flex;
  align-items: center;
}
.cal-evs { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cal-ev {
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
  background: var(--bg-2);
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
  line-height: 1.25;
  color: inherit;
  text-decoration: none;
}
.cal-ev span { flex: 1; min-width: 0; overflow: hidden; }
#cal-add-sheet label, #cal-edit-sheet label, #todo-add-sheet label { margin: 0; }

.cal-scroll {
  --cal-hour-h: 2.6rem;
  --cal-gutter: 3.25rem;
  --cal-day-min: 9rem;
  overflow: auto;
  max-height: calc(100dvh - 13.5rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 1rem;
}
.cal-scroll-day { --cal-day-min: 0; }
.cal-week-inner { min-width: calc(var(--cal-gutter) + 7 * var(--cal-day-min)); }
.cal-scroll-day .cal-week-inner { min-width: 0; }
.cal-allday {
  display: grid;
  grid-template-columns: var(--cal-gutter) minmax(0, 1fr);
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.cal-allday-days,
.cal-hour-days {
  display: grid;
  grid-template-columns: repeat(var(--cal-cols, 7), minmax(var(--cal-day-min), 1fr));
}
.cal-gutter {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--card);
}
.cal-gutter-head { min-height: 2.6rem; }
.cal-allday-col {
  border-left: 1px solid var(--line);
  padding: 0.3rem 0.3rem 0.45rem;
  min-width: 0;
}
.cal-day-head {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  min-height: 2rem;
  margin-bottom: 0.25rem;
}
.cal-day-head span { color: var(--muted); font-weight: 500; }
.cal-day-head.is-static { color: var(--muted); font-weight: 500; }
.cal-chip {
  display: block;
  background: var(--bg-2);
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
  padding: 0.2rem 0.35rem;
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  overflow: hidden;
}
.cal-hours {
  display: grid;
  grid-template-columns: var(--cal-gutter) minmax(0, 1fr);
}
.cal-hour-label {
  height: var(--cal-hour-h);
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.15rem 0.35rem 0 0;
  text-align: right;
}
.cal-hour-col {
  position: relative;
  height: calc(24 * var(--cal-hour-h));
  border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent calc(var(--cal-hour-h) - 1px),
    var(--line) calc(var(--cal-hour-h) - 1px),
    var(--line) var(--cal-hour-h)
  );
}
.cal-allday-col.is-today,
.cal-hour-col.is-today,
.cal-day.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-timed {
  position: absolute;
  left: 3px;
  right: 3px;
  overflow: hidden;
  background: var(--bg-2);
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
  padding: 0.15rem 0.3rem;
  font-size: 0.78rem;
  line-height: 1.2;
  z-index: 1;
}
.cal-timed em { font-style: normal; color: var(--muted); }

@media (max-width: 800px) {
  .rail {
    inset: auto 0 0 0;
    width: 100%;
    height: 4.5rem;
    flex-direction: row;
    justify-content: space-around;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 0.3rem 0.4rem;
  }
  .rail-end { margin-top: 0; flex-direction: row; }
  .who { display: none; }
  .main { margin-left: 0; padding-bottom: 6.5rem; }
  .board { grid-template-columns: 1fr; }
  .widget.size-s, .widget.size-m, .widget.size-l { grid-column: span 1; }
  .add-bar { left: 0; bottom: 4.5rem; }
  .clock-time { font-size: 3.2rem; }
  .cal-day { min-height: 4.6rem; padding: 0.25rem; }
  .cal-ev { font-size: 0.7rem; }
  .cal-scroll { max-height: calc(100dvh - 16.5rem); }
  .page-head-actions { flex-wrap: wrap; justify-content: flex-end; }
}
