/* Japonia 2026 — spokojny, czytelny w słońcu, z cynobrowym akcentem */
:root {
  --bg: #f7f4ee;
  --card: #ffffff;
  --card-2: #f0ebe1;
  --ink: #1c1b1a;
  --muted: #6b655c;
  --line: #e3ddd1;
  --accent: #d23c2c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6e2;
  --ok: #2f7d4f;
  --ok-soft: #e1f1e6;
  --warn: #9a5b00;
  --warn-soft: #fbefd6;
  --ignacy: #2a5ea8;
  --ula: #b8336a;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 2px 10px rgba(40, 30, 20, .05);
  --radius: 16px;
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --card: #1d1b19;
    --card-2: #262320;
    --ink: #f2eee7;
    --muted: #a59e93;
    --line: #34302b;
    --accent: #e5574a;
    --accent-ink: #ffffff;
    --accent-soft: #3a1d19;
    --ok: #6cc28d;
    --ok-soft: #17301f;
    --warn: #f0b552;
    --warn-soft: #3a2c12;
    --ignacy: #6d9eea;
    --ula: #ec6fa2;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.ja { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.boot { padding: 40vh 24px 0; text-align: center; color: var(--muted); }

/* ---- układ ---- */
.app { min-height: 100vh; min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 10px) calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; min-height: 52px;
}
.top h1 { font-size: 22px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.top .sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.top .back { margin-left: -8px; }
main {
  padding: 14px calc(16px + var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + 24px) calc(16px + var(--safe-left));
  max-width: 720px; margin: 0 auto;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 4px var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h) ; padding-top: 2px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.on { color: var(--accent); }

/* ---- karty ---- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 16px; margin-bottom: 14px;
}
.card.flat { box-shadow: none; }
.card h2 { font-size: 20px; margin-bottom: 4px; }
.card h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.card.hero { border: 2px solid var(--accent); }
.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 22px 4px 8px;
}
.section-title:first-child { margin-top: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

/* ---- przyciski ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  font-weight: 650; font-size: 16px; text-decoration: none; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--accent); }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btns > .btn { flex: 1 1 auto; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { background: var(--card-2); }

/* ---- etykiety ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--card-2); color: var(--muted); white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.tobuy { border: 2px dashed var(--warn) !important; }

/* ---- teraz ---- */
.countdown { font-size: 44px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.05; margin: 6px 0 2px; }
.countdown.soon { color: var(--accent); }
.route { display: grid; grid-template-columns: 58px 1fr; gap: 2px 10px; margin-top: 12px; }
.route .t { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.route .p { font-weight: 600; }
.route .p .ja { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
.big-info { font-size: 19px; font-weight: 700; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); margin-top: 10px; }
.note-line { margin: 6px 0 0; padding-left: 14px; position: relative; font-size: 15px; }
.note-line::before { content: ""; position: absolute; left: 2px; top: .6em; width: 5px; height: 5px; border-radius: 3px; background: var(--accent); }
.howto { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--card-2); border-radius: 0 10px 10px 0; font-size: 15px; }
.map-wrap { position: relative; z-index: 0; isolation: isolate; }
.map { height: 300px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-bottom: 14px; background: var(--card-2); }
.person { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.person + .person { border-top: 1px solid var(--line); }
.avatar {
  width: 40px; height: 40px; border-radius: 20px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 17px; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.avatar.ignacy { background: var(--ignacy); }
.avatar.ula { background: var(--ula); }
.weather { display: flex; align-items: center; gap: 14px; }
.weather .temp { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.forecast { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; }
.forecast > div { flex: 0 0 auto; min-width: 78px; padding: 8px; border-radius: 12px; background: var(--card-2); font-size: 13px; text-align: center; }
.hints { margin: 0; padding: 0; list-style: none; }
.hints li { padding: 10px 0 10px 28px; position: relative; border-top: 1px solid var(--line); }
.hints li:first-child { border-top: 0; }
.hints li::before { content: "→"; position: absolute; left: 4px; color: var(--accent); font-weight: 800; }
.offline-bar { background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; }

/* znaczniki mapy */
.pin {
  width: 34px; height: 34px; border-radius: 17px; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
  font-family: -apple-system, system-ui, sans-serif;
}
.pin.ignacy { background: var(--ignacy); }
.pin.ula { background: var(--ula); }
.pin.target { background: var(--accent); border-radius: 17px 17px 17px 3px; }
.pin.hotel { background: #1c1b1a; font-size: 14px; }
.pin.stale { opacity: .55; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
  .leaflet-container { background: #1d1b19; }
  .leaflet-control-attribution { background: rgba(29, 27, 25, .8) !important; color: #a59e93; }
  .leaflet-control-attribution a { color: #c9c2b6; }
  .leaflet-bar a { background: #262320; color: #f2eee7; border-color: #34302b; }
  .pin.hotel { background: #f2eee7; color: #1c1b1a; }
}

/* ---- plan ---- */
.day-list { list-style: none; margin: 0; padding: 0; }
.day-link {
  display: flex; gap: 14px; align-items: center; padding: 12px 14px; margin-bottom: 8px;
  border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: inherit; min-height: 64px;
}
.day-link .date { width: 52px; flex: none; text-align: center; }
.day-link .date b { display: block; font-size: 22px; line-height: 1; }
.day-link .date span { font-size: 12px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.day-link .title { font-weight: 650; }
.day-link .city { font-size: 13px; color: var(--muted); }
.day-link.today { border: 2px solid var(--accent); background: var(--accent-soft); }
.day-link.past { opacity: .5; }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 58px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item {
  display: grid; grid-template-columns: 50px 1fr; gap: 16px; padding: 10px 0; cursor: pointer;
  position: relative; width: 100%; text-align: left; background: none; border: 0; color: inherit;
}
.tl-item .time { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; padding-top: 12px; font-size: 15px; }
.tl-item .time small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.tl-item .body { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; position: relative; }
.tl-item .body::before {
  content: ""; position: absolute; left: -13px; top: 17px; width: 10px; height: 10px; border-radius: 5px;
  background: var(--bg); border: 2px solid var(--muted);
}
.tl-item.fixed .body::before { background: var(--accent); border-color: var(--accent); }
.tl-item.segment .body { background: var(--card-2); }
.tl-item.now .body { border: 2px solid var(--accent); }
.tl-item.done { opacity: .55; }
.tl-item .ttl { font-weight: 650; }
.tl-item .meta { font-size: 14px; color: var(--muted); margin-top: 2px; }

/* ---- arkusz szczegółów ---- */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 8px calc(16px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(16px + var(--safe-left));
  animation: up .2s ease-out;
}
.sheet { position: relative; }
.sheet-close { position: absolute; top: 6px; right: calc(8px + var(--safe-right)); background: var(--card-2); }
.sheet h2 { padding-right: 44px; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { font-size: 22px; margin-bottom: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }

/* ---- adres dla kierowcy ---- */
.driver {
  position: fixed; inset: 0; z-index: 60; background: #fff; color: #000;
  padding: calc(var(--safe-top) + 24px) calc(20px + var(--safe-right)) calc(var(--safe-bottom) + 24px) calc(20px + var(--safe-left));
  display: flex; flex-direction: column; justify-content: center; gap: 22px; text-align: center;
}
.driver .please { font-size: 22px; color: #555; }
.driver .name { font-size: 34px; font-weight: 800; line-height: 1.3; }
.driver .addr { font-size: 30px; font-weight: 600; line-height: 1.5; word-break: break-all; }
.driver .latin { font-size: 15px; color: #666; }
.driver .close { position: absolute; top: calc(var(--safe-top) + 10px); right: calc(10px + var(--safe-right)); color: #000; }

/* ---- formularze ---- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 17px;
  -webkit-appearance: none; appearance: none;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea.input { min-height: 90px; resize: vertical; }
.amount { position: relative; }
.amount .input { font-size: 34px; font-weight: 800; padding-left: 46px; min-height: 66px; font-variant-numeric: tabular-nums; }
.amount::before { content: "¥"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 28px; font-weight: 800; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  min-height: 42px; padding: 0 14px; border-radius: 21px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 15px; cursor: pointer;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.day-picker { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.day-picker select { flex: 1; text-align: center; font-weight: 700; }

/* ---- listy ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.amount-col { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pending { opacity: .6; }
.total { font-size: 28px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--accent); margin-top: 4px; }

/* ---- notatki i zdjęcia ---- */
.note { padding: 12px 0; border-top: 1px solid var(--line); }
.note:first-child { border-top: 0; }
.note p { margin: 0 0 4px; white-space: pre-wrap; word-break: break-word; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 12px; overflow: hidden; }
.photos a { position: relative; display: block; aspect-ratio: 1; background: var(--card-2); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .vid { position: absolute; right: 6px; bottom: 4px; color: #fff; font-size: 12px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.steps { margin: 8px 0 0; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  font-weight: 600; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}

/* ekran logowania */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; text-align: center; max-width: 460px; margin: 0 auto; }
.login img { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 20px; box-shadow: var(--shadow); }
.login h1 { font-size: 26px; margin-bottom: 12px; }
.login p { color: var(--muted); }
