:root {
  --page: #f7f8f7; --surface: #ffffff; --surface-2: #f0f2f0;
  --ink: #14171a; --ink-2: #4d5451; --muted: #8a908d;
  --ring: rgba(20,23,26,.10); --accent: #2a78d6; --accent-ink: #ffffff;
  --danger: #d03b3b; --ok: #0ca30c; --warn: #f0a202;
  --st-utkast: #8a908d; --st-klar: #2a78d6; --st-generert: #7a4fd6; --st-levert: #0ca30c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0e1110; --surface: #191d1b; --surface-2: #222724;
    --ink: #eef1ef; --ink-2: #b9c0bc; --muted: #7f8683;
    --ring: rgba(255,255,255,.10); --accent: #3987e5;
  }
}
* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 0 14px calc(24px + env(safe-area-inset-bottom)); }
.screen[hidden] { display: none; }

.setup-card { text-align: center; padding: 12vh 10px 0; display: flex; flex-direction: column; gap: 12px; }
.setup-card .logo { font-size: 52px; }
.setup-card h1 { margin: 0; font-size: 28px; }
.setup-card p { color: var(--ink-2); font-size: 15px; margin: 0 0 12px; }
.setup-card .or { color: var(--muted); font-size: 13px; }
.setup-card input { text-align: center; }

header { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; }
header h1 { font-size: 22px; margin: 0; }

input, select, textarea {
  width: 100%; font-size: 16px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink); outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 10px 0 4px; }
button {
  font-size: 15px; font-weight: 600; padding: 11px 16px; border-radius: 10px;
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink); cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.ghost { background: transparent; color: var(--ink-2); }
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: default; }

.tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.tab { flex: 1; background: var(--surface-2); border-color: transparent; color: var(--ink-2); }
.tab.active { background: var(--accent); color: var(--accent-ink); }

/* kalender */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 6px; }
.cal-nav button { flex: 0 0 44px; }
.cal-label { font-size: 16px; font-weight: 700; text-transform: capitalize; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--ring); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; font-weight: 600; color: var(--ink); position: relative; padding: 2px;
}
.cal-day.out { color: var(--muted); opacity: .45; }
.cal-day.today { border-color: var(--accent); border-width: 2px; }
.cal-day.selecting { background: var(--accent); color: var(--accent-ink); }
.cal-day.in-range { background: rgba(42,120,214,.18); }
.cal-day .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.dot.mine { background: var(--st-klar); }
.dot.claimed { background: var(--ok); }
.dot.unclaimed { background: var(--warn); }
.dot.notreimb { background: var(--muted); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 11.5px; color: var(--muted); margin: 12px 2px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-hint { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; text-align: center; }

/* turliste */
.trip-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.trip-row {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--ring); border-radius: 12px; padding: 12px 14px; text-align: left; width: 100%;
}
.trip-row .body { flex: 1; min-width: 0; }
.trip-row .dates { font-size: 15px; font-weight: 650; }
.trip-row .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.chip { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: #fff; white-space: nowrap; }
.chip.st-utkast { background: var(--st-utkast); }
.chip.st-klar { background: var(--st-klar); }
.chip.st-generert { background: var(--st-generert); }
.chip.st-levert { background: var(--st-levert); }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 32px 20px; }

/* tur-ark */
.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.sheet-card {
  position: absolute; left: 0; right: 0; bottom: 0; top: 4vh; overflow-y: auto;
  background: var(--surface); border-radius: 18px 18px 0 0; padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.18);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; position: sticky; top: 0; background: var(--surface); padding-bottom: 6px; }
.sheet-head h2 { font-size: 17px; margin: 0; }
.sheet-body { padding-bottom: 30px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 label { margin-bottom: 0; }

.status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.status-row .chip { padding: 6px 12px; font-size: 12.5px; }

.meals-wrap { margin-top: 14px; }
.meals-head { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.meals { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--ring); border-radius: 10px; padding: 8px; }
.meal-day { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.meal-day .d { flex: 0 0 84px; color: var(--ink-2); font-weight: 600; }
.meal-day label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 12px; font-weight: 500; color: var(--ink); }
.meal-day input[type=checkbox] { width: auto; padding: 0; }

.receipts-block { margin-top: 18px; border-top: 1px solid var(--ring); padding-top: 12px; }
.receipts-head { display: flex; align-items: center; justify-content: space-between; }
.receipts-head h3 { font-size: 14.5px; margin: 0; }
.camera-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--ring); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; margin: 0; }
.receipt-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.receipt-empty { font-size: 13px; color: var(--muted); margin-top: 8px; }
.save-hint { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 8px; }

.receipt-card { display: flex; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 10px; }
.receipt-card img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; background: var(--ring); flex: 0 0 auto; }
.receipt-card .rbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.receipt-card .rline { font-size: 12.5px; color: var(--ink-2); }
.receipt-card .rline b { color: var(--ink); }
.receipt-card .waiting { font-size: 12.5px; color: var(--muted); font-style: italic; }
.receipt-card .rconf { font-size: 12.5px; font-weight: 700; color: var(--ok); }
.receipt-card .rlow { font-size: 11.5px; color: var(--warn); font-weight: 600; }
.receipt-row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.receipt-row-actions input[type=number] { width: 90px; padding: 7px 9px; font-size: 13px; }
.receipt-row-actions select { width: auto; padding: 7px 9px; font-size: 12.5px; }
.receipt-row-actions button { padding: 7px 10px; font-size: 12.5px; }
.receipt-card .rdel { align-self: flex-start; background: none; border: none; color: var(--muted); font-size: 15px; padding: 2px 4px; }

#toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--page); font-size: 13.5px; font-weight: 550;
  padding: 9px 16px; border-radius: 999px; z-index: 40; max-width: 90vw; text-align: center;
}
