:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --primary: #0369a1;
  --primary-dark: #075985;
  --primary-soft: #e0f2fe;
  --green: #15803d;
  --green-dark: #166534;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #fff;
  --header-bg: #0f172a;
  --shadow: rgba(15, 23, 42, .12);
  --radius: 10px;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button,
input { font: inherit; }
button,
a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:active,
.activity-card__link:active { transform: translateY(1px); }
:focus-visible { outline: 3px solid #38bdf8; outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Shared Marketing2 header */
.app-header {
  position: relative;
  z-index: 700;
  background: var(--header-bg);
  color: #fff;
}
.app-header__inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 62px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}
.brand__mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.brand strong,
.brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand small { margin-top: -2px; color: #94a3b8; font-size: 11px; font-weight: 500; }
.app-header__user {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #cbd5e1;
  font-size: 13px;
}
.app-header__user form { margin: 0; }
.header-button,
.quiet-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.header-button:hover,
.quiet-button:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.08); color: #fff; }

/* Activity index */
.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 64px;
}
.page-heading { max-width: 620px; margin-bottom: 28px; }
.page-heading h1 {
  margin: 3px 0 6px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.08;
  letter-spacing: -.035em;
}
.page-heading > p:last-child { margin: 0; color: var(--ink-soft); }
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 16px;
}
.activity-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.activity-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 10px 28px var(--shadow);
}
.activity-card__link {
  min-height: 278px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  color: inherit;
  text-decoration: none;
}
.activity-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.activity-card__arrow { color: var(--ink-muted); font-size: 22px; transition: transform .18s ease, color .18s ease; }
.activity-card:hover .activity-card__arrow { color: var(--primary); transform: translateX(3px); }
.activity-card h2 {
  margin: 24px 0 22px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.status-badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.status-badge--predano { background: var(--amber-soft); color: #92400e; }
.status-badge--realizace { background: var(--primary-soft); color: var(--primary-dark); }
.status-badge--hotovo { background: var(--green-soft); color: var(--green-dark); }
.activity-card__progress { margin-top: auto; }
.activity-card__progress > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
}
.activity-card__progress strong { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.progress-track {
  height: 7px;
  margin: 8px 0 7px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-soft);
}
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.activity-card__progress small { color: var(--ink-soft); font-size: 12px; }
.activity-card__cta {
  margin-top: 20px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 650;
}
.empty-state {
  max-width: 580px;
  padding: 44px 28px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.empty-state__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 23px;
  font-weight: 800;
}
.empty-state h2 { margin: 0 0 5px; font-size: 21px; }
.empty-state p { margin: 0; color: var(--ink-soft); }

/* Login */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 12%, rgba(3, 105, 161, .22), transparent 34rem),
    var(--header-bg);
}
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}
.login-card {
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.login-brand strong,
.login-brand span { display: block; }
.login-brand strong { font-size: 15px; }
.login-brand div > span { margin-top: -2px; color: var(--ink-soft); font-size: 12px; }
.login-heading h1 { margin: 3px 0 5px; font-size: 28px; letter-spacing: -.03em; }
.login-heading > p:last-child { margin: 0 0 22px; color: var(--ink-soft); font-size: 14px; }
.login-form { display: grid; gap: 8px; }
.login-form label { margin-top: 6px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
.login-form input:focus { border-color: var(--primary); outline: 3px solid rgba(56,189,248,.25); }
.login-button {
  min-height: 46px;
  margin-top: 12px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  transition: background .18s ease;
}
.login-button:hover { background: var(--primary-dark); }
.login-help { margin: 18px 0 0; color: var(--ink-muted); font-size: 12px; text-align: center; }
.form-error { padding: 10px 12px; border-radius: 8px; background: var(--red-soft); color: #991b1b; font-size: 13px; font-weight: 600; }

/* Delivery map */
.topbar {
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: max(9px, env(safe-area-inset-top)) 18px 9px;
}
.topbar .eyebrow { color: #94a3b8; }
.topbar h1 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(16px, 3vw, 21px);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar__title { min-width: 0; }
.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.back-link:hover { color: #fff; }
.delivery-layout {
  height: calc(100vh - 68px);
  height: calc(100dvh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
}
.map-panel { min-width: 0; position: relative; }
.delivery-map { width: 100%; height: 100%; min-height: 420px; background: #dfe8e3; }
.map-toolbar {
  position: absolute;
  z-index: 500;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }
.map-toolbar button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15,23,42,.14);
  font-size: 13px;
  font-weight: 650;
}
.map-toolbar button:hover { background: var(--bg-soft); }
.map-toolbar button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: #fff; }
.gps-state {
  padding: 7px 9px;
  border: 1px solid rgba(15,23,42,.1);
  border-radius: 6px;
  background: rgba(255,255,255,.94);
  color: var(--ink-soft);
  box-shadow: 0 3px 10px rgba(15,23,42,.09);
  font-size: 11px;
}
.gps-state[data-state="active"] { color: var(--green-dark); }
.delivery-sheet {
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--border);
  background: var(--bg);
  overscroll-behavior: contain;
}
.progress-card,
.address-card,
.address-list-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.progress-card { padding: 16px; }
.progress-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.progress-heading strong { display: block; margin-top: 1px; font-size: 27px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.progress-heading span { color: var(--ink-soft); font-size: 12px; }
progress {
  width: 100%;
  height: 8px;
  margin-top: 6px;
  border: 0;
  accent-color: var(--green);
}
progress::-webkit-progress-bar { border-radius: 4px; background: var(--bg-soft); }
progress::-webkit-progress-value { border-radius: 4px; background: var(--green); }
.reward { margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; }
.reward strong { color: var(--ink); }
.sync-state { margin: 7px 0 0; color: var(--green-dark); font-size: 11px; font-weight: 600; }
.sync-state[data-state="pending"] { color: #92400e; }
.sync-state[data-state="error"],
.sync-state[data-state="conflict"] { color: #b42318; }
.address-card { position: relative; margin-top: 12px; padding: 16px; }
.address-card h2 { margin: 4px 34px 12px 0; font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
.close-detail {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 23px;
}
.close-detail:hover { background: var(--bg-soft); }
dl { margin: 0 0 12px; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
dt { color: var(--ink-soft); }
dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.technology-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.technology { padding: 4px 8px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #0008; }
.customer-warning { padding: 10px; border-left: 3px solid var(--amber); border-radius: 5px; background: var(--amber-soft); color: #78350f; font-size: 12px; font-weight: 600; }
.primary-button,
.finish-button {
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  transition: background .18s ease;
}
.primary-button:hover,
.finish-button:hover { background: var(--green-dark); }
.address-list-card { margin-top: 12px; overflow: hidden; }
.address-list-card summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}
.address-list-card summary::-webkit-details-marker { display: none; }
.address-list-card summary span { color: var(--primary); font-size: 11px; font-weight: 650; }
.address-list-card[open] summary { border-bottom: 1px solid var(--border); }
.address-list-card[open] summary span { font-size: 0; }
.address-list-card[open] summary span::after { content: "Skrýt"; font-size: 11px; }
.address-list {
  max-height: 280px;
  overflow-y: auto;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.address-list button {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--bg-soft);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-size: 12px;
}
.address-list button:hover { background: var(--bg-soft); }
.address-list button[data-completed="true"] { color: var(--ink-muted); text-decoration: line-through; }
.finish-button { margin-top: 12px; }
.delivery-dot { border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 5px #0008; }
.user-dot { width: 17px; height: 17px; display: block; border: 3px solid #fff; border-radius: 50%; background: #087ee6; box-shadow: 0 1px 7px #0008; }

@media (max-width: 760px) {
  .app-header__inner,
  .page-shell { width: min(100% - 28px, 1180px); }
  .app-header__user > span { display: none; }
  .page-shell { padding: 28px 0 40px; }
  .activity-grid { grid-template-columns: 1fr; }
  .activity-card__link { min-height: 240px; padding: 18px; }
  .login-card { padding: 24px 20px; }
  .topbar {
    min-height: 62px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: max(7px, env(safe-area-inset-top)) 10px 7px;
  }
  .topbar .quiet-button { width: 40px; overflow: hidden; color: transparent; padding: 0; }
  .topbar .quiet-button::before { content: "↪"; color: #cbd5e1; font-size: 18px; }
  .back-link { font-size: 0; }
  .back-link span { font-size: 21px; }
  .delivery-layout {
    height: calc(100vh - 62px);
    height: calc(100dvh - 62px);
    display: block;
    position: relative;
  }
  .map-panel,
  .delivery-map { height: 100%; min-height: 0; }
  .map-toolbar { top: 10px; left: 10px; right: 10px; flex-wrap: wrap; gap: 6px; }
  .map-toolbar button { min-height: 40px; padding: 0 11px; }
  .gps-state { max-width: calc(100vw - 20px); flex-basis: 100%; width: max-content; }
  .delivery-sheet {
    position: absolute;
    z-index: 600;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    max-height: min(58%, 510px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(248,250,252,.97);
    box-shadow: 0 16px 42px rgba(15,23,42,.28);
    backdrop-filter: blur(10px);
  }
  .progress-card { padding: 10px 12px; }
  .progress-heading strong { font-size: 22px; }
  .reward,
  .sync-state { display: inline-block; margin-right: 9px; }
  .address-card { padding: 13px; }
  .address-card h2 { font-size: 16px; }
  .address-list { max-height: 210px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-soft: #0b2c44;
    --green: #4ade80;
    --green-dark: #22c55e;
    --green-soft: #123824;
    --amber: #fbbf24;
    --amber-soft: #3b2f0b;
    --red: #f87171;
    --red-soft: #3f171b;
    --ink: #e6edf6;
    --ink-soft: #aab6c8;
    --ink-muted: #7b8aa0;
    --border: #28344b;
    --bg: #0b1220;
    --bg-soft: #131d31;
    --surface: #15203a;
    --shadow: rgba(0,0,0,.42);
  }
  .delivery-sheet { background: var(--bg); }
  .gps-state { background: rgba(21,32,58,.95); }
  .customer-warning { color: #fde68a; }
  .login-page { background: radial-gradient(circle at 12% 12%, rgba(14,165,233,.18), transparent 34rem), #070d18; }
  .login-form input { border-color: #3a4763; }
  .leaflet-layer,
  .leaflet-control-zoom-in,
  .leaflet-control-zoom-out { filter: brightness(.82) contrast(1.08); }
  @media (max-width: 760px) {
    .delivery-sheet { background: rgba(11,18,32,.96); }
  }
}

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