:root {
  --bg: #f7f3eb;
  --surface: #fffdf8;
  --surface-2: #f0eadd;
  --ink: #1e2a3a;
  --muted: #5b6675;
  --line: #ddd5c6;
  --accent: #8a2e3b;
  --accent-ink: #fff8ee;
  --accent-soft: #f3e3e3;
  --warm: #b8632f;
  --warm-soft: #f6e3d8;
  --danger: #a12b2b;
  --shadow: 0 6px 24px rgba(52, 40, 20, .10);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14181f;
  --surface: #1b212b;
  --surface-2: #232b37;
  --ink: #ece7db;
  --muted: #a3acb8;
  --line: #2e3745;
  --accent: #d98590;
  --accent-ink: #1a1013;
  --accent-soft: #33232a;
  --warm: #e5906a;
  --warm-soft: #33261f;
  --danger: #ef7b6d;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-underline-offset: 2px; word-break: break-word; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
  background: var(--surface-2); color: var(--ink); transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-small { padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.danger { color: var(--danger); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  font-size: 18px; color: var(--ink);
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- Bramka instalacji ---------- */
.gate {
  min-height: 100dvh; display: flex; justify-content: center; align-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom));
}
.gate-inner { width: 100%; max-width: 440px; text-align: center; }
.gate-logo img { border-radius: 22px; box-shadow: var(--shadow); }
.gate h1 { font-size: 34px; margin: 18px 0 8px; }
.gate-lead { color: var(--muted); margin: 0 0 22px; }
.gate-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 22px 0 14px; }
.gate-tab {
  padding: 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 14.5px;
}
.gate-tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; text-align: left; }
.steps li {
  counter-increment: s; display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; margin-bottom: 9px; font-size: 15px;
}
.steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--warm-soft); color: var(--warm); font-weight: 700; font-size: 13px;
  display: grid; place-items: center; margin-top: 1px;
}
.gate-inapp {
  text-align: left; background: var(--warm-soft); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin: 0 0 18px; font-size: 14.5px;
}
.gate-inapp p { margin: 0 0 12px; }
.gate-inapp i { margin-right: 8px; color: var(--warm); }
.gate-note { color: var(--muted); font-size: 13.5px; margin-top: 18px; }
.gate-note i { margin-right: 8px; }

/* ---------- Układ aplikacji ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; position: relative; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; justify-content: center; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 21px; flex: none;
  position: relative;
}
.brand-mark::after { content: ""; position: absolute; right: 5px; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--warm); }
.brand-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.usage { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); text-align: left; }
.usage-bar { width: 44px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; flex: none; }
.usage-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .4s; }
.usage.warn .usage-bar span { background: var(--warm); }
.usage.crit .usage-bar span { background: var(--danger); }
.top-actions { display: flex; }

/* ---------- Czat ---------- */
.chat { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; scroll-behavior: smooth; }
.welcome { text-align: center; padding: 28px 6px 10px; }
.welcome-mark {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 22px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-size: 28px; transform: rotate(-4deg);
}
.welcome h2 { font-size: 27px; margin-bottom: 10px; }
.welcome p { color: var(--muted); margin: 0 auto; max-width: 420px; }
.chips { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.chip {
  text-align: left; padding: 13px 15px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); font-size: 15px; display: flex; gap: 12px; align-items: center;
}
.chip i { color: var(--warm); width: 18px; text-align: center; flex: none; }
.chip:active { background: var(--surface-2); }

.messages { display: flex; flex-direction: column; gap: 20px; padding-bottom: 10px; }
.msg-user { align-self: flex-end; max-width: 86%; }
.msg-user .bubble {
  background: var(--accent); color: var(--accent-ink); padding: 11px 15px; border-radius: 20px 20px 6px 20px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-lena { display: flex; gap: 11px; align-items: flex-start; max-width: 100%; }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 17px; margin-top: 2px;
}
.lena-body { min-width: 0; flex: 1; }
.lena-name { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }

.prose { overflow-wrap: anywhere; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; }
.prose h3 {
  font-size: 17px; margin: 18px 0 7px; padding-left: 11px; border-left: 3px solid var(--warm);
}
.prose ul, .prose ol { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: n; }
.prose li { position: relative; padding-left: 26px; margin-bottom: 7px; }
.prose ul li::before { content: ""; position: absolute; left: 7px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: var(--warm); }
.prose ol li { counter-increment: n; }
.prose ol li::before {
  content: counter(n); position: absolute; left: 0; top: .18em; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.prose strong { font-weight: 700; }
.tbl-wrap { overflow-x: auto; margin: 0 0 12px; }
.prose table { border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.prose th { background: var(--surface-2); }
.callout {
  margin: 16px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--warm-soft);
  border: 1px solid color-mix(in srgb, var(--warm) 30%, transparent); font-size: 14.5px;
}
.callout p { margin: 0; }
.callout-title { font-weight: 700; color: var(--warm); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; font-family: var(--serif); }
.msg-tools { display: flex; gap: 4px; margin-top: 6px; }
.tool { color: var(--muted); font-size: 13px; padding: 6px 9px; border-radius: 9px; display: inline-flex; gap: 6px; align-items: center; }
.tool:active { background: var(--surface-2); }

.msg-error .lena-body {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--danger);
  border-radius: 14px; padding: 12px 14px;
}
.err-title { font-family: var(--serif); font-weight: 700; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; color: var(--danger); }
.err-text { font-size: 15px; }
.err-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* trzy kropki */
.dots { display: inline-flex; gap: 6px; padding: 12px 0 6px; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); opacity: .3; animation: dot 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .18s; }
.dots span:nth-child(3) { animation-delay: .36s; }
@keyframes dot { 0%, 70%, 100% { transform: translateY(0); opacity: .3; } 35% { transform: translateY(-6px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots span { animation-duration: 2.4s; } .chat { scroll-behavior: auto; } }

/* ---------- Pole pisania ---------- */
.composer-wrap { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); }
.banner {
  display: flex; align-items: center; gap: 10px; background: var(--warm-soft); color: var(--ink);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px;
}
.banner i { color: var(--warm); }
.banner span { flex: 1; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 24px; padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow); transition: border-color .15s;
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; line-height: 1.4; padding: 9px 0; max-height: 140px; min-width: 0;
}
.composer textarea::placeholder { color: var(--muted); }
.send {
  flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 17px; transition: opacity .15s, transform .12s;
}
.send:active { transform: scale(.94); }
.send:disabled { opacity: .35; }
.send.stop { background: var(--warm); }
.hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 7px; font-size: 12px; color: var(--muted); text-align: center; }
.help-btn { color: var(--accent); font-size: 19px; width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.help-btn:active { background: var(--surface-2); }

/* ---------- Historia ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 12, 8, .45); z-index: 20; animation: fade .2s; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); background: var(--bg); z-index: 21;
  transform: translateX(-102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { font-size: 22px; }
.history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.h-item { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.h-item.active { border-color: var(--accent); }
.h-main { flex: 1; min-width: 0; text-align: left; padding: 11px 12px; }
.h-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-date { font-size: 12px; color: var(--muted); }
.h-del { width: 42px; height: 42px; color: var(--muted); }
.h-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14.5px; }
.h-empty i { display: block; font-size: 26px; margin-bottom: 10px; color: var(--line); }

/* ---------- Okna (arkusze) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 110; background: rgba(15, 12, 8, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet-back.center { align-items: center; padding: 20px; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: rise .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-back.center .sheet { border-radius: 26px; max-height: 88dvh; padding-bottom: 20px; }
.sheet h2 { font-size: 23px; margin-bottom: 6px; }
.sheet .sub { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sheet-icon { width: 52px; height: 52px; border-radius: 18px; background: var(--warm-soft); color: var(--warm); display: grid; place-items: center; font-size: 23px; margin-bottom: 14px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.sheet-actions.row { flex-direction: row; }
.sheet-actions.row .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.help-block { display: flex; gap: 13px; margin-bottom: 14px; }
.help-block .n { flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 14px; }
.help-block h3 { font-size: 16px; margin-bottom: 2px; }
.help-block p { margin: 0; font-size: 14.5px; color: var(--muted); }

/* ---------- Ustawienia ---------- */
.field { margin-bottom: 18px; }
.field label, .field .lbl { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .desc { font-size: 13px; color: var(--muted); margin-top: 6px; }
.input-row { display: flex; gap: 8px; }
.input, .select {
  width: 100%; padding: 12px 14px; border-radius: 13px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; min-width: 0; outline: 0;
}
.input:focus, .select:focus { border-color: var(--accent); }
.input-row .icon-btn { border: 1.5px solid var(--line); background: var(--surface); flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.seg button { padding: 10px; border-radius: 11px; font-weight: 600; font-size: 14.5px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.seg button.on { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.status { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.status.ok { background: var(--accent-soft); color: var(--accent); }
.status.bad { background: var(--warm-soft); color: var(--danger); }
.status.wait { background: var(--surface-2); color: var(--muted); }
.status i { margin-top: 3px; }
.meter { height: 9px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.meter-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 120; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: 14.5px; box-shadow: var(--shadow); animation: rise .25s; max-width: 420px; display: flex; gap: 10px; align-items: center; }

@media (min-width: 760px) {
  body { background: var(--surface-2); }
  .app { background: var(--bg); box-shadow: var(--shadow); }
}

/* ---------- Blokada PIN ---------- */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; justify-content: center; align-items: center; overflow-y: auto;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); }
.lock-inner { width: 100%; max-width: 340px; text-align: center; }
.lock-mark { width: 60px; height: 60px; border-radius: 20px; font-size: 34px; margin: 0 auto 16px; }
.lock-mark::after { width: 7px; height: 7px; right: 9px; bottom: 10px; }
.lock h2 { font-size: 24px; margin-bottom: 6px; }
.lock-sub { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0 10px; }
.pin-dots span { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--accent); transition: background .12s, transform .12s; }
.pin-dots span.on { background: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.pin-msg { min-height: 40px; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.pin-msg.bad { color: var(--danger); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px auto 16px; max-width: 280px; }
.keypad button { height: 62px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 24px; font-family: var(--serif); font-weight: 600; }
.keypad button:active { background: var(--surface-2); transform: scale(.96); }
.keypad button.ok { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 20px; }
.off .keypad { opacity: .4; pointer-events: none; }
.pin-sheet { text-align: center; }
.pin-sheet .sheet-icon { margin-left: auto; margin-right: auto; }

/* ---------- Baza wiedzy, znaczek „nowe”, baner aktualizacji ---------- */
.icon-btn { position: relative; }
.badge-dot {
  position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--warm); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
}
.kb-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.kb-item summary { list-style: none; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.kb-item summary::-webkit-details-marker { display: none; }
.kb-title { font-weight: 600; font-size: 15px; line-height: 1.35; }
.kb-date { font-size: 12px; color: var(--muted); }
.kb-detail { padding: 2px 14px 14px; border-top: 1px solid var(--line); font-size: 14.5px; }
.kb-detail h4 { margin: 14px 0 4px; font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.kb-detail p { margin: 0 0 6px; }
.kb-detail ul, .kb-detail ol { margin: 0 0 6px; padding-left: 20px; }
.kb-detail li { margin-bottom: 4px; }
.kb-src { font-size: 12.5px; color: var(--muted); }
.kb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.kb-actions .btn { text-decoration: none; }
.update-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 130;
  max-width: 460px; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 16px;
  padding: 12px 12px 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); animation: rise .25s;
}
.update-banner span { flex: 1; font-size: 14px; font-weight: 600; line-height: 1.4; }
.update-banner button { flex: none; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 700; }

/* ---------- Widoki i dolna belka ---------- */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.know-top { justify-content: space-between; }
.know-top .icon-btn { color: var(--accent); font-size: 21px; }
.know-brand { justify-content: flex-start; padding-left: 4px; }
.know-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 24px; }
.know-head h1 { font-size: 26px; margin-bottom: 4px; }
.know-head p { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.kb-list { display: flex; flex-direction: column; gap: 10px; }
.kb-prev { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }
.kb-new { display: inline-block; align-self: flex-start; margin-bottom: 4px; padding: 1px 8px; border-radius: 9px; background: var(--warm); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.kb-note { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: relative; z-index: 6;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; font-size: 11px; font-weight: 600; color: var(--muted); min-width: 0; }
.tab .ico { position: relative; font-size: 20px; line-height: 1.2; }
.tab .ico .badge-dot { top: -6px; right: -12px; }
.tab.on { color: var(--accent); }
.tab-lena { margin-top: -26px; color: var(--ink); }
.tab-lena .fab {
  width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 24px; border: 4px solid var(--bg); box-shadow: var(--shadow);
}
.tab-lena.on { color: var(--accent); }
.app.typing .tabbar { display: none; }
.kb-item[open] .kb-prev { display: none; }

/* Blok „Źródło i weryfikacja” w bazie wiedzy */
.kb-verify { margin: 14px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.08)); border-left: 3px solid var(--ok, #2f6b45); font-size: 13px; }
.kb-verify.is-warn { border-left-color: var(--warn, #8a5a00); }
.kb-verify > b { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.kb-verify > b i { color: var(--ok, #2f6b45); }
.kb-verify.is-warn > b i { color: var(--warn, #8a5a00); }
.kb-verify dl { margin: 6px 0 0; display: grid; gap: 6px; }
.kb-verify dt { color: var(--muted); font-weight: 600; font-size: 12px; }
.kb-verify dd { margin: 0; overflow-wrap: anywhere; }
.kb-flag { margin: 6px 0 0; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--warn, #8a5a00); }
.kb-flag-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

/* Kalkulator terminów w aplikacji */
.dl-card { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 14px; padding: 13px 14px; text-align: left; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.dl-card-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.dl-card-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-card-txt strong { font-size: 15.5px; }
.dl-card-txt span { font-size: 13px; color: var(--muted); }
.dl-card > .fa-chevron-right { color: var(--muted); font-size: 13px; }
.dl-radio { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin: 0 0 8px; font-size: 15px; }
.dl-radio input { margin-top: 4px; }
.dl-result { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); border-left: 4px solid var(--accent); }
.dl-result ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.dl-lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dl-date { font-size: 20px; font-weight: 800; margin: 3px 0; }
.dl-left { font-weight: 700; color: var(--accent); }
.dl-left.is-soon, .dl-item.is-soon span { color: var(--warn, #8a5a00); }
.dl-left.is-late, .dl-item.is-late span { color: var(--danger, #a12b2b); }
.dl-saved-h { margin: 20px 0 8px; font-size: 15px; }
.dl-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); }
.dl-item div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-item b { font-size: 14px; }
.dl-item span { font-size: 12.5px; color: var(--muted); }
.dl-warn { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }

/* Okno „Więcej działów” (dolna belka, gdy działów jest więcej niż trzy) */
.more-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.more-item { display: flex; align-items: center; justify-content: flex-start; gap: 12px; text-align: left; }
.more-item > i { width: 22px; text-align: center; color: var(--accent); }
.more-item > span:first-of-type { flex: 1; }
.badge-inline { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--warm); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
