:root {
  --bg: #ffffff;
  --surface: #f5f7fa;
  --surface-2: #eef2f7;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --navy: #172033;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --orange: #d97706;
  --orange-soft: #fff7ed;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --shadow: 0 14px 40px rgba(17, 24, 39, .06);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.line-badge {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 14px; background: var(--navy); color: white; font-size: 21px; font-weight: 800;
  box-shadow: 0 8px 22px rgba(23,32,51,.15);
}
.brand { font-size: 18px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }

.icon-button {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--navy);
  display: grid; place-items: center; cursor: pointer;
}
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:active { transform: scale(.97); }

.status-strip {
  min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px;
  background: var(--surface); color: var(--muted); font-size: 12px; margin-bottom: 14px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex: 0 0 auto; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(22,163,74,.10); }
.status-dot.warn { background: var(--orange); box-shadow: 0 0 0 4px rgba(217,119,6,.10); }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 4px rgba(220,38,38,.10); }
.text-button { margin-left: auto; border: 0; padding: 3px 0; background: transparent; color: var(--blue); font-weight: 700; cursor: pointer; }

.mode-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 16px; background: var(--surface); margin-bottom: 14px;
}
.mode-button { border: 0; background: transparent; color: var(--muted); padding: 10px 8px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.mode-button.active { background: #fff; color: var(--text); box-shadow: 0 2px 10px rgba(17,24,39,.07); }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.route-card { padding: 18px; margin-bottom: 12px; }
.eyebrow { color: var(--blue); font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .10em; }
.route-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 9px; }
.route-main h1 { margin: 0; font-size: 22px; line-height: 1.18; letter-spacing: -.035em; }
.route-main p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.route-icon { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: 0 0 auto; }
.route-icon svg, .metric-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.action-card { padding: 22px 20px 20px; margin-bottom: 12px; border-top: 5px solid var(--blue); transition: border-color .2s ease, background .2s ease; }
.action-card.state-good { border-top-color: var(--green); background: linear-gradient(180deg, var(--green-soft), #fff 55%); }
.action-card.state-soon { border-top-color: var(--orange); background: linear-gradient(180deg, var(--orange-soft), #fff 55%); }
.action-card.state-now { border-top-color: var(--red); background: linear-gradient(180deg, var(--red-soft), #fff 55%); }
.action-card.state-neutral { border-top-color: var(--blue); }
.action-kicker { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.action-label { margin-top: 11px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.action-time { margin-top: 4px; font-size: clamp(44px, 13vw, 70px); line-height: 1; letter-spacing: -.055em; font-weight: 850; font-variant-numeric: tabular-nums; }
.action-note { min-height: 19px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.metric-card { padding: 16px; min-height: 156px; }
.metric-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.metric-icon svg { width: 20px; height: 20px; }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.navy { color: var(--navy); background: #f1f5f9; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin-top: 4px; font-size: 25px; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.metric-sub { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.details-card { padding: 4px 18px; margin-bottom: 22px; box-shadow: none; background: #fcfcfd; }
.details-row { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; color: var(--muted); }
.details-row strong { color: var(--text); font-size: 14px; }
.divider { height: 1px; background: var(--line); }

.next-section { margin-bottom: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section-head h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.section-head a { color: var(--blue); font-size: 12px; font-weight: 700; text-decoration: none; }
.departure-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.departure-chips::-webkit-scrollbar { display: none; }
.chip { min-width: 76px; text-align: center; padding: 11px 13px; border-radius: 14px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chip.primary { background: var(--navy); color: #fff; }
.chip.unreachable { color: #9ca3af; text-decoration: line-through; }
.chip.placeholder { color: #9ca3af; }
.schedule-note { margin: 10px 2px 0; color: #9ca3af; font-size: 11px; line-height: 1.4; }

footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; color: #9ca3af; font-size: 10px; padding-bottom: 4px; }

.settings-dialog { width: min(calc(100% - 28px), 520px); border: 0; border-radius: 26px; padding: 0; color: var(--text); box-shadow: 0 24px 80px rgba(17,24,39,.22); }
.settings-dialog::backdrop { background: rgba(15,23,42,.36); backdrop-filter: blur(3px); }
.settings-dialog form { padding: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.dialog-head h2 { margin: 5px 0 0; font-size: 22px; }
.setting-label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.range-row { display: grid; grid-template-columns: 1fr 72px; align-items: center; gap: 14px; }
.range-row input { width: 100%; accent-color: var(--blue); }
.range-row output { text-align: center; background: var(--surface); padding: 9px 10px; border-radius: 12px; font-weight: 800; }
.setting-help, .setting-block p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 9px 0 0; }
.setting-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.setting-block.subtle { opacity: .86; }
.secondary-button, .primary-button { width: 100%; border-radius: 14px; padding: 12px 14px; font-weight: 800; cursor: pointer; }
.secondary-button { margin-top: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.primary-button { margin-top: 22px; border: 0; background: var(--navy); color: #fff; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); width: max-content; max-width: calc(100% - 36px); background: var(--navy); color: #fff; border-radius: 14px; padding: 10px 14px; font-size: 12px; font-weight: 650; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 10px 30px rgba(17,24,39,.22); z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) {
  .app-shell { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 380px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 0; }
  .mode-button { font-size: 12px; }
  .route-main h1 { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* V1.2 — pomoc kontekstowa */
.top-actions { display: flex; align-items: center; gap: 8px; }
.help-main-button { color: var(--blue); background: var(--blue-soft); border-color: #dbeafe; }
.micro-head { display: flex; align-items: center; gap: 7px; margin: -2px 3px 7px; color: #9ca3af; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.card-topline, .metric-label-row, .heading-with-info, .label-with-info { display: flex; align-items: center; gap: 7px; }
.card-topline { justify-content: space-between; }
.metric-label-row { justify-content: space-between; margin-top: 0; }
.heading-with-info h2 { margin: 0; }
.label-with-info { min-width: 0; }
.mini-info-button {
  width: 25px; height: 25px; flex: 0 0 25px; display: inline-grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  font-size: 12px; line-height: 1; font-weight: 850; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.08);
}
.mini-info-button:active { transform: scale(.93); }
.status-strip .mini-info-button { margin-left: auto; background: #fff; }
.status-strip .text-button:not([hidden]) { margin-left: 2px; }

.help-dialog {
  width: min(calc(100% - 28px), 500px); max-height: min(82dvh, 720px); border: 0; border-radius: 28px;
  padding: 0; color: var(--text); box-shadow: 0 28px 90px rgba(17,24,39,.25); overflow: auto;
}
.help-dialog::backdrop { background: rgba(15,23,42,.42); backdrop-filter: blur(4px); }
.help-dialog-inner { padding: 22px; }
.help-hero { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.help-icon {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px;
  background: var(--blue-soft); color: var(--blue); font-size: 22px; font-weight: 900;
}
.help-close { width: 40px; height: 40px; border-radius: 13px; }
.help-dialog h2 { margin: 7px 0 0; font-size: 24px; line-height: 1.15; letter-spacing: -.035em; }
.help-lead { margin: 13px 0 0; color: var(--text); font-size: 15px; line-height: 1.55; font-weight: 650; }
.help-detail { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.help-detail p { margin: 0 0 10px; }
.help-detail p:last-child { margin-bottom: 0; }
.help-example { margin-top: 16px; padding: 14px 15px; border-radius: 16px; background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.55; }
.help-example strong { color: var(--blue); }
.help-dialog .primary-button { margin-top: 20px; }

@media (max-width: 380px) {
  .top-actions { gap: 5px; }
  .top-actions .icon-button { width: 40px; height: 40px; border-radius: 13px; }
  .label-with-info { gap: 4px; }
}


/* V1.3 — szybki kontakt telefoniczny */
.contact-section { margin: 0 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.contact-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.contact-head h2 { margin: 6px 0 0; font-size: 18px; line-height: 1.2; letter-spacing: -.025em; }
.contact-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 14px; background: var(--blue-soft); color: var(--blue); }
.contact-icon svg, .contact-button-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contact-intro { margin: 10px 0 15px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.contact-buttons { display: grid; gap: 10px; }
.contact-button { min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 16px; text-decoration: none; color: #fff; background: var(--navy); box-shadow: 0 8px 20px rgba(17,24,39,.10); -webkit-tap-highlight-color: transparent; }
.contact-button.secondary-contact { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.contact-button:active { transform: scale(.985); }
.contact-button-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.12); }
.secondary-contact .contact-button-icon { color: var(--blue); background: #fff; }
.contact-button-text { min-width: 0; display: grid; gap: 3px; }
.contact-button-text strong { font-size: 14px; line-height: 1.15; }
.contact-button-text small { opacity: .76; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.secondary-contact .contact-button-text small { color: var(--muted); opacity: 1; }
.contact-arrow { margin-left: auto; font-size: 25px; line-height: 1; opacity: .72; }
@media (max-width: 380px) { .contact-section { padding: 16px; } }
