:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1d2430; --muted: #5d6675; --line: #e2e6ec;
  --accent: #1f6feb; --accent-ink: #ffffff; --user: #e8f0fe; --pin: #1f6feb; --dot: #9aa4b2;
  --err: #b42318; --radius: 12px; --shadow: 0 1px 3px rgba(16, 24, 40, .08);
  --brand-grad: linear-gradient(135deg, #1f6feb 0%, #7b4ddb 100%);  /* logo D gradient (2026-10-17) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419; --surface: #161c23; --text: #e6e9ee; --muted: #9aa4b2; --line: #263039;
    --accent: #5b9dff; --accent-ink: #0b1220; --user: #1c2a40; --pin: #5b9dff; --dot: #5d6675;
    --err: #ff8a80; --shadow: none; color-scheme: dark;
    --brand-grad: linear-gradient(135deg, #5b9dff 0%, #9d7bf0 100%);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
}
button { font: inherit; cursor: pointer; }
.btn { background: var(--accent); background-image: var(--brand-grad); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: .55rem 1rem; }
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn.small { padding: .35rem .75rem; font-size: .9rem; }
.btn.ghost { background: transparent; background-image: none; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); padding: .2rem .3rem; }
.muted { color: var(--muted); font-size: .9rem; }
.err { color: var(--err); font-size: .9rem; }

.top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand > div { min-width: 0; }
.brand strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { display: block; color: var(--muted); font-size: .85rem; }
.logo { flex: none; width: 34px; height: 34px; display: block; }
.beta { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; vertical-align: 2px;
  padding: .05rem .35rem; border-radius: 6px; background: var(--user); color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: .4rem; flex: none; }
.chip { font-size: .85rem; padding: .25rem .6rem; border-radius: 999px; background: var(--user); white-space: nowrap; }

.tabs { display: none; }
.layout { flex: 1; display: grid; grid-template-columns: minmax(340px, 46%) 1fr; grid-template-rows: minmax(0, 1fr); min-height: 0; min-width: 0; }
.pane { min-height: 0; min-width: 0; }
#chat { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; border-right: 1px solid var(--line); background: var(--bg); }
#map { position: relative; }
#mapEl { position: absolute; inset: 0; }

.messages { overflow-y: auto; min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: .8rem; }
.welcome h1 { font-size: 1.35rem; margin: .2rem 0 .4rem; }
.welcome p { color: var(--muted); margin: 0 0 .8rem; }
.examples { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.ex { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .85rem; color: var(--text);
  text-align: left; }
.msg { max-width: 100%; padding: .7rem .9rem; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--user); max-width: 85%; }
.msg.system { background: transparent; box-shadow: none; border: 1px dashed var(--line); color: var(--muted); }
.msg .body > :first-child { margin-top: 0; }
.msg .body > :last-child { margin-bottom: 0; }
.msg table { border-collapse: collapse; display: block; overflow-x: auto; font-size: .9rem; margin: .5rem 0; }
.msg th, .msg td { border: 1px solid var(--line); padding: .3rem .5rem; text-align: left; vertical-align: top; }
.msg a { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; align-items: center; }
.actions .fb { background: none; border: 1px solid var(--line); border-radius: 8px; padding: .15rem .45rem; color: var(--text); }
.actions .fb.on { border-color: var(--accent); }
.thinking { color: var(--muted); font-style: italic; }
.thinking::after { content: "…"; animation: dots 1.2s steps(3) infinite; }
@keyframes dots { 0% { content: "."; } 50% { content: ".."; } 100% { content: "..."; } }

.chat-bar { padding: 0 16px; min-height: 0; }
.composer { display: flex; gap: .5rem; padding: .6rem 16px calc(.6rem + env(safe-area-inset-bottom)); background: var(--surface);
  border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem;
  font: inherit; background: var(--bg); color: var(--text); max-height: 30vh; }

.map-tools { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.map-tools .btn.ghost { background: var(--surface); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; display: grid;
  gap: .3rem; font-size: .9rem; max-width: 260px; box-shadow: var(--shadow); }
.pin-num { background: var(--pin); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center;
  font-weight: 600; font-size: .85rem; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.leaflet-popup-content { font: 14px/1.4 system-ui, sans-serif; }
.leaflet-popup-content b { display: block; margin-bottom: .2rem; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; padding: .4rem 16px; font-size: .78rem;
  color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
dialog label { display: grid; gap: .2rem; margin-bottom: .6rem; font-size: .9rem; }
dialog input, dialog select, dialog textarea { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); }
dialog label.check { display: flex; gap: .5rem; align-items: flex-start; font-size: .82rem; color: var(--muted); }
.row { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .6rem; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.sso { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.offers { display: grid; gap: .5rem; margin: .6rem 0; }
.offer { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; display: flex; justify-content: space-between;
  align-items: center; gap: .6rem; }
.offer small { display: block; color: var(--muted); }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .75rem; padding: 0 .4rem; }

@media (max-width: 760px) {
  .brand .sub { display: none; }
  #codeBtn { font-size: .85rem; }
  .brand strong { font-size: .95rem; }
  .tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; background: none; border: 0; padding: .55rem; color: var(--muted); border-bottom: 2px solid transparent; }
  .tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
  .layout { grid-template-columns: 1fr; }
  .pane { display: none; }
  .pane.active { display: grid; }
  #map.active { display: block; }
  #chat { border-right: 0; }
  .foot { font-size: .72rem; }
}

.flats { margin-top: .7rem; display: grid; gap: .35rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.flat { display: flex; gap: .4rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; }
.flat > span { flex: 1 1 180px; min-width: 0; }
.flat small { display: block; color: var(--muted); }
.flat .down { color: #1a7f37; } .flat .up { color: var(--err); }
.saved { display: grid; gap: .4rem; max-height: 60vh; overflow-y: auto; }
dialog.wide { width: min(620px, calc(100vw - 32px)); }
.pin-star { color: #f5a524; font-size: 22px; line-height: 24px; text-align: center; text-shadow: 0 0 3px #000; }
.foot a { color: inherit; }

/* 2026-10-14: narrow phones — keep the counter, "Mam kod" and "Zaloguj" visible (live test: title cut) */
@media (max-width: 420px) { .top-actions { gap: .25rem; } .brand .beta { display: none; } }
.welcome .beta-note { display: inline-block; margin-bottom: .35rem; }

/* 2026-10-17: start screen (landing) — facts, steps, FAQ; removed after the first question like before */
.welcome .lead { color: var(--muted); margin: 0 0 .8rem; }
.facts { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .3rem; font-size: .95rem; }
.facts li::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: .45rem; }
.steps { margin: 1.1rem 0 .8rem; padding-left: 1.2rem; display: grid; gap: .25rem; color: var(--muted); font-size: .95rem; }
.steps b { color: var(--text); }
.faq { border-top: 1px solid var(--line); margin-top: .6rem; }
.faq details { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.faq p { margin: .4rem 0 .2rem; color: var(--muted); font-size: .92rem; }
.faq a { color: var(--accent); }

/* 2026-10-17: hero with selling points (Bartek's slogans) */
.welcome h1 { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hooks { list-style: none; padding: 0; margin: .2rem 0 .7rem; display: grid; gap: .55rem; }
.hooks li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; font-size: .95rem; }
.hooks b { display: block; color: var(--text); }
.cta { margin: 0 0 .9rem; font-size: 1rem; }
.cta b { color: var(--accent); }
