:root {
  --amber: #faa623;
  --amber-deep: #f07c1d;
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1c1c1e;
  --ink-soft: #6b6b70;
  --line: #e6e2da;
  --green: #1d8a4a;
  --amberwarn: #b5730a;
  --red: #c0392b;
  --blue: #2a6cb0;
  --sheet-scrim: rgba(0,0,0,.45);
  --tabbar-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315; --card: #1e1e21; --ink: #f3f3f1; --ink-soft: #a3a3a8;
    --line: #313136; --green: #4cc47e; --amberwarn: #e0a13a; --red: #e06552; --blue: #6ab0f0;
    --sheet-scrim: rgba(0,0,0,.65);
  }
}
/* Battery-saver forces a dark, minimal look regardless of system theme */
body.battery {
  --bg: #0c0c0d; --card: #161618; --ink: #e8e8e6; --ink-soft: #8a8a90;
  --line: #262629; --amber: #c98a2e; --amber-deep: #b5730a;
}
body.battery * { animation: none !important; transition: none !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select { font: inherit; color: inherit; }
a { color: var(--amber-deep); }

/* ---------- header ---------- */
header#appHeader {
  background: linear-gradient(135deg, var(--amber), var(--amber-deep));
  color: #1c1206;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px;
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 5;
}
body.battery header#appHeader { background: #161618; color: var(--ink); }
.hdr-title { flex: 1; min-width: 0; }
.hdr-title h1 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-title .sub { font-size: 12px; font-weight: 600; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-btn { font-size: 22px; padding: 4px 10px; border-radius: 10px; line-height: 1; }
.hdr-btn:active { background: rgba(0,0,0,.12); }
#btnBack { font-size: 30px; font-weight: 400; }

/* ---------- layout ---------- */
main#view { max-width: 520px; margin: 0 auto; padding: 14px 14px 24px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card.tap:active { transform: scale(.99); }
h2.screen-h { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 2px 2px 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.stale-flag { font-size: 12px; color: var(--amberwarn); font-weight: 700; }
.pill { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase; }
.pill.park { background: rgba(240,124,29,.15); color: var(--amber-deep); }
.pill.rest { background: rgba(42,108,176,.15); color: var(--blue); }
.pill.travel { background: rgba(107,107,112,.18); color: var(--ink-soft); }
.pill.excursion { background: rgba(29,138,74,.15); color: var(--green); }

/* ---------- Today ---------- */
.today-hero { text-align: center; padding: 18px 14px; }
.today-hero .dayno { font-size: 13px; font-weight: 800; letter-spacing: .08em; color: var(--ink-soft); text-transform: uppercase; }
.today-hero .label { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 8px; }
.today-hero .date { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini {
  display: flex; flex-direction: column; gap: 3px; padding: 13px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.mini .k { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--ink-soft); text-transform: uppercase; }
.mini .v { font-size: 20px; font-weight: 800; }
.mini .v small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.crowd-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 5px; }
.crowd-bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--amber), var(--red)); }
.bigbtn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.bigbtn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none;
  padding: 18px 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; color: var(--ink); font-weight: 700; font-size: 14px;
}
.bigbtn:active { border-color: var(--amber); }
.bigbtn .ico { font-size: 28px; }

/* ---------- lists / rows ---------- */
.row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px;
}
.row .grow { flex: 1; min-width: 0; }
.row .r-name { font-size: 15.5px; font-weight: 600; }
.row .r-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.wait-badge { font-size: 20px; font-weight: 800; min-width: 58px; text-align: right; }
.wait-badge small { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.status-down { color: var(--red); font-weight: 800; }
.status-refurb { color: var(--amberwarn); font-weight: 800; }
.status-closed { color: var(--ink-soft); font-weight: 700; }
.itin-day.today { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(250,166,35,.25); }
.itin-day .top { display: flex; align-items: center; gap: 10px; }
.itin-day .notes { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 10px; }
.itin-date { font-size: 12px; font-weight: 700; color: var(--ink-soft); }

/* ---------- weather ---------- */
.wx-now { text-align: center; padding: 8px 0 4px; }
.wx-now .temp { font-size: 54px; font-weight: 300; letter-spacing: -.03em; }
.wx-now .cond { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.wx-hours { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; -webkit-overflow-scrolling: touch; }
.wx-hour { flex: 0 0 auto; width: 62px; text-align: center; padding: 10px 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.wx-hour.rainy { border-color: var(--blue); background: rgba(42,108,176,.08); }
.wx-hour .h { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.wx-hour .i { font-size: 22px; margin: 4px 0; }
.wx-hour .t { font-size: 14px; font-weight: 700; }
.wx-hour .p { font-size: 12px; font-weight: 700; color: var(--blue); margin-top: 2px; }
.wx-hour .p.hi { color: var(--red); }

/* ---------- forms / calculators ---------- */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; flex-wrap: wrap; }
.seg button { padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); font-size: 16px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-big { text-align: center; padding: 14px; }
.result-big .amt { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.result-big .eur { font-size: 15px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.result-big .k { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--ink-soft); text-transform: uppercase; }
.split-line { display: flex; justify-content: space-between; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.split-line:last-child { border-bottom: none; }
.go {
  display: block; width: 100%; margin-top: 6px;
  background: linear-gradient(135deg, var(--amber), var(--amber-deep));
  color: #1c1206; font-size: 16px; font-weight: 800; padding: 14px; border-radius: 14px;
}
.go:active { filter: brightness(.93); }
.go.quiet { background: var(--card); border: 1px solid var(--line); color: var(--ink-soft); }
.note-box { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-top: 10px; }

/* ---------- toggles ---------- */
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.switch .track::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::before { transform: translateX(20px); }

/* ---------- states ---------- */
.empty { text-align: center; color: var(--ink-soft); padding: 26px 16px; }
.empty .ico { font-size: 40px; margin-bottom: 8px; }
.setup-card { border: 1px dashed var(--amber); background: rgba(250,166,35,.06); }
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--line);
  border-top-color: var(--amber-deep); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- attribution ---------- */
footer#attribution {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  font-size: 10.5px; text-align: center; color: var(--ink-soft);
  padding: 4px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px); border-top: 1px solid var(--line); z-index: 4;
}
footer#attribution a { color: var(--ink-soft); }

/* ---------- tab bar ---------- */
nav#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--ink-soft); font-size: 10.5px; font-weight: 700;
}
.tab .ti { font-size: 21px; line-height: 1; filter: grayscale(.4); opacity: .7; }
.tab.active { color: var(--amber-deep); }
.tab.active .ti { filter: none; opacity: 1; }

@media (min-width: 560px) {
  footer#attribution { max-width: 520px; margin: 0 auto; }
}
