:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #e5e5ea;
  --text: #1c1c1e;
  --muted: #8e8e93;
  --hairline: rgba(60, 60, 67, .18);
  --accent: #b81d2c;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(184, 29, 44, .10);
  --star: #c9a227;
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff3b30;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(0,0,0,.05);
  --radius: 18px;
  --nav-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol";
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  --text-2: #3a3a3c;
  --green: #1f8a3b;
  --green-soft: rgba(52, 199, 89, .14);
  --amber: #a15c00;
  --amber-soft: rgba(255, 159, 10, .16);
  --blue: #0a63c9;
  --blue-soft: rgba(10, 132, 255, .12);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.32, .72, 0, 1);
  --chrome: color-mix(in srgb, var(--bg) 72%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --muted: #8e8e93;
    --hairline: rgba(84, 84, 88, .65);
    --accent: #e03a4a;
    --accent-contrast: #fff;
    --accent-soft: rgba(224, 58, 74, .18);
    --shadow: 0 1px 2px rgba(0,0,0,.5);
    --chrome: color-mix(in srgb, #1c1c1e 72%, transparent);
    --text-2: #d1d1d6;
    --green: #4cd964;
    --green-soft: rgba(48, 209, 88, .18);
    --amber: #ffb340;
    --amber-soft: rgba(255, 159, 10, .2);
    --blue: #64a8ff;
    --blue-soft: rgba(10, 132, 255, .2);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #f5f5f7;
  --muted: #8e8e93;
  --hairline: rgba(84, 84, 88, .65);
  --accent: #e03a4a;
  --accent-contrast: #fff;
  --accent-soft: rgba(224, 58, 74, .18);
  --shadow: 0 1px 2px rgba(0,0,0,.5);
  --chrome: color-mix(in srgb, #1c1c1e 72%, transparent);
  --text-2: #d1d1d6;
  --green: #4cd964;
  --green-soft: rgba(48, 209, 88, .18);
  --amber: #ffb340;
  --amber-soft: rgba(255, 159, 10, .2);
  --blue: #64a8ff;
  --blue-soft: rgba(10, 132, 255, .2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { overflow-x: hidden; }
body.sheet-open { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
[hidden] { display: none !important; }

/* Reset so unstyled controls never fall back to UA grey-border buttons */
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 14px; outline: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--hairline)); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; min-height: 120px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; font-weight: 500; }
label > input, label > textarea, label > select { margin-top: 6px; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 14px; }

.app { min-height: 100%; display: flex; flex-direction: column; }
.app-chrome {
  position: sticky; top: 0; z-index: 10;
  background: var(--chrome);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--hairline);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-chrome, .bottomnav, .sheet-header, .sheet-footer { background: var(--surface); }
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 8px) 16px 8px;
  min-height: calc(var(--safe-t) + 52px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand img { border-radius: 7px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border: 0; border-radius: 50%; background: transparent;
  display: grid; place-items: center; color: var(--text);
}
.icon-btn:active { background: var(--surface-2); transform: scale(.97); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 22px; height: 22px; }
.sync-pill { font-size: 11px; padding: 4px 6px; color: var(--ok); }
.sync-pill[data-state="pending"] { color: var(--warn); }
.sync-pill[data-state="offline"] { color: var(--muted); }
.sync-pill[data-state="error"] { color: var(--danger); }
.banner {
  margin: 0 16px 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); font-size: 14px; color: var(--muted);
}
.view { flex: 1; padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 88px); max-width: 760px; width: 100%; margin: 0 auto; min-width: 0; }

.page-title {
  font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15;
  margin: 4px 0 12px; color: var(--text);
}

/* wyszukiwarka + filtry */
/* duży tytuł + wyszukiwarka przewijają się z treścią (przyklejony jest tylko mały pasek u góry) —
   mniejsza warstwa z backdrop-filter = brak migania przy przewijaniu na Androidzie */
.toolbar { padding: 8px 16px 4px; max-width: 760px; width: 100%; margin: 0 auto; min-width: 0; }
.search-row { display: flex; align-items: stretch; gap: 8px; margin: 4px 0 8px; }
.search { position: relative; flex: 1 1 100%; min-width: 0; width: 100%; margin: 0; }
.search input {
  padding-left: 40px; padding-right: 14px; border: 0; border-radius: 12px;
  height: 40px; min-height: 40px; width: 100%; background: var(--surface-2);
}
.search input:focus { box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.search svg { position: absolute; left: 12px; top: 9px; width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 2; pointer-events: none; }
.toolbar-actions { display: flex; align-items: stretch; gap: 8px; margin: 0 0 8px; }
.toolbar-actions .filter-btn { flex: 1 1 auto; }
.filter-toggle {
  flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px;
  border: 0; border-radius: 12px; background: var(--surface-2);
  display: grid; place-items: center; padding: 0; color: var(--muted);
}
.filter-toggle svg { width: 20px; height: 20px; }
.filter-toggle svg.star { fill: none; stroke: var(--muted); stroke-width: 1.8; }
.filter-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.filter-toggle[aria-pressed="true"] svg.star { fill: var(--star); stroke: var(--star); }
.filter-toggle[aria-pressed="true"] svg.line-icon { stroke: var(--accent); }
.filter-btn {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; height: 44px; padding: 0 16px;
  border: 0; border-radius: 12px; background: var(--surface-2);
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text);
}
.filter-btn.has-filters { background: var(--accent-soft); color: var(--accent); }

.section-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  margin: 18px 2px 8px; display: flex; justify-content: space-between;
  letter-spacing: -.01em; text-transform: none;
}

/* karty */
.list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 14px; text-align: left; width: 100%; min-width: 0;
  overflow-wrap: break-word;
  transition: opacity .28s var(--ease-out), transform .28s var(--ease-out);
}
/* brak skalowania karty przy dotyku — w v2.0 karta „pulsowała” przy każdym rozpoczęciu przewijania */
.card.removing { opacity: 0; transform: scale(.96); pointer-events: none; }
.card.unread .card-title { font-weight: 700; }
/* kafelek v2.2: tytuł, krótki opis (1–2 linie), data — bez tagów, źródeł i rozwijania */
.card.tile { display: flex; align-items: flex-start; gap: 4px; padding: 14px 6px 13px 16px; cursor: pointer; }
.tile-text { flex: 1 1 auto; min-width: 0; }
.card.tile .card-title {
  font-weight: 620; font-size: 16.5px; line-height: 1.32; letter-spacing: -.018em; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card.tile.unread .card-title { font-weight: 700; }
.tile-emoji { font-family: var(--emoji); font-size: .86em; margin-right: 6px; font-weight: 400; }
.card-summary {
  margin: 4px 0 0; color: var(--text-2); font-size: 14.5px; line-height: 1.42; letter-spacing: -.008em;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-date { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card.tile .card-actions { flex-direction: column; margin: -8px -2px -6px 0; gap: 0; }
.card.tile .card-actions .icon-btn { width: 40px; height: 40px; }
.card.tile .card-actions .icon-btn svg { width: 19px; height: 19px; }
.card.tile .unread-dot { margin: 0 7px 0 0; vertical-align: .14em; width: 7px; height: 7px; }
.detail-lead { font-size: 17px; line-height: 1.5; color: var(--text); font-weight: 500; margin: 0 0 14px; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.card-meta.top { margin: 6px 0 0; }
.badge { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-weight: 600; font-size: 12px; }
.tag { background: var(--surface-2); border-radius: 999px; padding: 3px 8px; color: var(--muted); }
.card-actions { display: flex; gap: 2px; margin: -6px -6px 0 0; flex-shrink: 0; }
.card-actions .icon-btn { width: 44px; height: 44px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; flex-shrink: 0; }
.day-group { margin-top: 4px; }
.day-group .day-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 2px 8px; }

.icon-btn svg.star { fill: none; stroke: var(--muted); stroke-width: 1.8; }
.icon-btn[aria-pressed="true"] svg.star { fill: var(--star); stroke: var(--star); }
.icon-btn svg.copy { fill: none; stroke: var(--muted); stroke-width: 1.8; }
.stars-inline { color: var(--star); letter-spacing: 1px; }
.empty { text-align: center; color: var(--muted); padding: 56px 16px; }
.empty strong { display: block; color: var(--text); font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.pending-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }

/* FAB + tab bar */
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 20;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 38%, transparent);
  display: grid; place-items: center;
  transition: transform .16s var(--ease-out);
}
.fab:active { transform: scale(.97); }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--chrome);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--hairline);
}
.bottomnav button {
  border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); min-height: 48px; min-width: 0; padding: 4px 2px 0;
}
.bottomnav button span:not(.nav-badge):not(.nav-icon-wrap) {
  font-size: 10px; font-weight: 500; letter-spacing: -.02em; white-space: nowrap; line-height: 1.2;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; flex-shrink: 0; }
.bottomnav button.active { color: var(--accent); }
.bottomnav button.active svg { fill: var(--accent-soft); }
.bottomnav button:active { transform: scale(.97); }
.nav-icon-wrap { position: relative; display: grid; place-items: center; width: 28px; height: 24px; }
.nav-badge {
  position: absolute; top: -6px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: var(--accent-contrast);
  font-size: 10px; font-weight: 700; line-height: 18px; text-align: center;
}

/* arkusz */
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.36); z-index: 40;
  animation: fade-in .22s var(--ease-out);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  max-width: 760px; margin: 0 auto;
  padding: 0 0 calc(10px + var(--safe-b));
  overflow: hidden;
  touch-action: pan-y;
}
/* animacja wejścia tylko raz (klasa zdejmowana w JS po animationend) — dotyk jej nie restartuje */
.sheet.entering { animation: sheet-up .42s var(--ease-spring); }
.sheet.dragging { transition: none !important; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet-handle { width: 36px; height: 5px; border-radius: 99px; background: var(--surface-2); margin: 8px auto 0; flex-shrink: 0; }
.sheet-header {
  position: sticky; top: 0; z-index: 2; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 10px 20px;
  background: var(--surface);
  border-bottom: .5px solid var(--hairline);
  min-height: 48px;
}
.sheet-header h2 {
  font-size: 17px; font-weight: 700; letter-spacing: -.02em;
  margin: 0; flex: 1; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-close {
  width: 44px; height: 44px; min-width: 44px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); background: var(--surface-2);
  flex-shrink: 0;
}
.sheet-close:active { transform: scale(.97); }
.sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 16px 20px 8px; -webkit-overflow-scrolling: touch; min-width: 0;
  /* v2.2: break-word zamiast anywhere — „anywhere” zmniejszało minimalną szerokość przycisków w filtrach
     i łamało słowa w środku („Dowoln a”, „Dzi ś”). Długie adresy łamie .md (overflow-wrap:anywhere). */
  overflow-wrap: break-word;
}
.sheet-footer, .sheet-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  flex-shrink: 0; position: sticky; bottom: 0;
  background: var(--surface);
  padding: 10px 20px calc(6px + var(--safe-b));
  border-top: .5px solid var(--hairline);
}
.sheet-footer .btn, .sheet-actions .btn { min-height: 50px; }
.field-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.btn {
  border: 0; background: var(--surface-2); border-radius: 999px;
  padding: 13px 16px; font-weight: 600; font-size: 16px; min-height: 50px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .16s var(--ease-out), opacity .16s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); }
.btn.danger { color: var(--danger); background: transparent; font-weight: 500; font-size: 15px; }
.btn.danger:active { background: var(--accent-soft); }
.btn.wide { grid-column: 1 / -1; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: transparent; color: var(--accent); }
.detail-actions { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 4px; }
.detail-actions .btn.primary { width: 100%; }
.icon-row { display: flex; gap: 8px; }
.icon-row .btn {
  flex: 1; min-height: 48px; border-radius: 14px; font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--text);
}
.icon-row .btn svg { width: 18px; height: 18px; }
.btn.subtle-danger { width: 100%; border: 0; background: transparent; color: var(--danger); font-weight: 500; font-size: 15px; min-height: 44px; }


.rating { display: flex; gap: 4px; }
.rating button { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 4px; color: var(--surface-2); min-width: 44px; min-height: 44px; }
.rating button.on { color: var(--star); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); font-size: 16px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 22px; }
.dates { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* ustawienia — grouped lists */
.group { background: var(--surface); border: 0; border-radius: var(--radius); padding: 0 16px; margin-bottom: 16px; overflow: hidden; }
.group .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: .5px solid var(--hairline); min-height: 44px; }
.group .item:last-child { border-bottom: 0; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface-2); border-radius: 10px; padding: 2px; }
.seg button {
  border: 0; background: transparent; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; min-height: 36px; color: var(--text);
  white-space: nowrap; overflow-wrap: normal; word-break: keep-all; flex: 0 0 auto;
}
/* filtry v2.2: wybór jako zawijające się „pigułki” — każda opcja zawsze w jednej linii, bez łamania słów */
.seg.seg-choices { display: flex; flex-wrap: wrap; gap: 8px; background: none; padding: 0; border-radius: 0; }
.seg.seg-choices button {
  background: var(--surface-2); border-radius: 999px; padding: 7px 14px; min-height: 36px;
  font-size: 14px; line-height: 1.25; font-weight: 500;
}
.seg.seg-choices button.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; font-weight: 600; }
.seg button.active { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.seg button:disabled { opacity: .4; }

/* logowanie */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card img { border-radius: 18px; }
.login-card h1 { margin: 16px 0 4px; font-size: 28px; letter-spacing: -.03em; }
.login-card label { text-align: left; }
.login-card .btn { width: 100%; margin-top: 8px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-t) + 64px); z-index: 60;
  background: rgba(28,28,30,.92); color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 15px; font-weight: 500; max-width: calc(100% - 32px);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.offscreen { position: fixed; opacity: 0; pointer-events: none; }
.line-icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 8px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; margin: 0; overflow: visible; }
.chip {
  flex: 0 0 auto; border: 0; background: var(--surface-2); border-radius: 999px; max-width: 100%;
  overflow-wrap: normal; word-break: keep-all;
  padding: 8px 14px; font-size: 14px; font-weight: 500; white-space: nowrap;
  min-height: 36px; display: inline-flex; align-items: center; gap: 6px; color: var(--text);
}
.chip.active, .chip.selected { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip svg.check { width: 14px; height: 14px; stroke: currentColor; fill: none; flex-shrink: 0; }
.chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn, .filter-btn, .sheet-footer .btn, .switch { overflow-wrap: normal; }
.sheet-footer .btn { white-space: nowrap; min-width: 0; padding-left: 12px; padding-right: 12px; }
.switch { word-break: keep-all; }
.chip:active { transform: scale(.97); }
.btn.full { width: 100%; }
.btn.grow { flex: 1; }
.linkbtn { text-align: center; text-decoration: none; color: inherit; }
.footnote { font-size: 13px; text-align: center; padding: 8px 8px 24px; }
.card-meta.flush { margin: 0 0 8px; }
.prewrap { white-space: pre-wrap; }
.breakword { word-break: break-word; }

.token-once {
  display: block; word-break: break-all; background: var(--bg); border-radius: 12px;
  padding: 12px 14px; font-size: 13px; margin: 8px 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.token-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.token-meta { font-size: 13px; color: var(--muted); }

.active-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.active-chips .chip { min-height: 32px; padding: 6px 10px; background: var(--accent); color: var(--accent-contrast); }
.active-chips .chip .x { margin-left: 2px; font-weight: 700; }
.clear-all { border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; min-height: 36px; padding: 6px 8px; }
#filter-sheet-body { padding-bottom: 4px; }
.facet-group { margin: 6px 0 16px; }
.facet-group h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.facet-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.facet-chips .chip { min-height: 36px; }
.date-row { display: flex; gap: 8px; margin-top: 8px; }
.date-row label { flex: 1; margin: 0; }
.date-row input[type="date"] { min-height: 44px; }
.load-more {
  width: 100%; margin: 8px 0 4px; border: 0; background: transparent;
  color: var(--accent); font-weight: 600; font-size: 16px;
  min-height: 48px; border-radius: 12px;
}
.card-meta .tag { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .card:active, .btn:active, .chip:active, .filter-toggle:active, .icon-btn:active, .bottomnav button:active, .fab:active {
    transform: none;
  }
}


/* ---------- v2.1: treść (Markdown), źródła, statusy, potwierdzenie ---------- */
.detail-title { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; margin: 2px 0 14px; overflow-wrap: anywhere; }
.detail-title + .detail-date { margin-top: -10px; }
.detail-date { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.section-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 22px 0 8px; letter-spacing: -.01em; }

.md { font-size: 16.5px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; word-break: normal; min-width: 0; max-width: 100%; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; }
.md strong { font-weight: 650; color: var(--text); }
.md em { font-style: italic; }
.md-h { color: var(--text); letter-spacing: -.02em; overflow-wrap: anywhere; }
.md-h1, .md-h2 { font-size: 1.22em; line-height: 1.28; font-weight: 700; margin: 1.5em 0 .55em; }
.md-h3 { font-size: 1.08em; line-height: 1.32; font-weight: 650; margin: 1.3em 0 .45em; }
.md-h4 { font-size: .8em; line-height: 1.3; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.2em 0 .4em; }
.md-list { margin: 0 0 1em; padding-left: 1.35em; }
.md-list li { margin: 0 0 .6em; padding-left: .15em; }
.md-list li::marker { color: var(--muted); font-weight: 600; }
ol.md-list li::marker { color: var(--accent); }
.md-list .md-list { margin: .45em 0 0; }
.md-quote { margin: 0 0 1em; padding: .2em 0 .2em 14px; border-left: 3px solid var(--accent-soft); color: var(--text-2); }
.md-hr { border: 0; height: .5px; background: var(--hairline); margin: 1.4em 0; }
.md-code { font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border-radius: 6px; padding: .08em .36em; overflow-wrap: anywhere; }
.md-pre { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 0 0 1em; white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.md-link { color: var(--accent); font-weight: 500; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); overflow-wrap: anywhere; }
.md-ext { display: inline-block; width: .62em; height: .62em; margin-left: 3px; vertical-align: .12em; opacity: .7; }
.source-domain .md-ext { margin-left: 4px; vertical-align: 0; }
.md-link:active { opacity: .6; }

.status-badge {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: .08em;
  font-size: 11.5px; line-height: 1; font-weight: 700; letter-spacing: .01em;
  padding: 4px 8px 4px 6px; border-radius: 999px; white-space: nowrap; margin: 0 2px;
}
.status-badge .status-icon { font-family: var(--emoji); font-size: 12px; font-weight: 400; }
.status-badge.confirmed { background: var(--green-soft); color: var(--green); }
.status-badge.unconfirmed { background: var(--amber-soft); color: var(--amber); }
.status-badge.partial { background: var(--amber-soft); color: var(--amber); }
.status-badge.info { background: var(--blue-soft); color: var(--blue); }

.sources { margin: 24px 0 8px; padding-top: 14px; border-top: .5px solid var(--hairline); }
.sources-title { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: src; }
.source-list li { counter-increment: src; min-width: 0; }
.source-pill {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px;
  background: var(--bg); border-radius: 12px; color: var(--text); font-size: 13.5px; line-height: 1.3; min-width: 0;
}
.source-pill::before {
  content: counter(src); flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--surface-2);
  color: var(--muted); font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.source-label { font-weight: 600; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-domain { flex: 0 1 auto; color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
a.source-pill:active { opacity: .6; }
.source-pill.static .source-label { white-space: normal; }

.badge, .tag { font-family: var(--font); }
.dialog-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.32); animation: fade-in .18s var(--ease-out); }
.dialog {
  position: fixed; z-index: 71; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(300px, calc(100% - 48px)); background: var(--surface); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; text-align: center;
  animation: dialog-in .22s var(--ease-out);
}
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, -50%) scale(1.06); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.dialog-text { padding: 20px 18px 16px; }
.dialog-text h2 { font-size: 17px; font-weight: 650; margin: 0 0 6px; letter-spacing: -.02em; }
.dialog-text p { font-size: 13.5px; line-height: 1.4; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: .5px solid var(--hairline); }
.dialog-btn { min-height: 48px; font-size: 16px; color: var(--blue); }
.dialog-btn + .dialog-btn { border-left: .5px solid var(--hairline); }
.dialog-btn.destructive { color: var(--danger); font-weight: 600; }
.dialog-btn.primary { font-weight: 600; }
.dialog-btn:active { background: var(--surface-2); }
.card-meta { min-width: 0; }
.card-title { overflow-wrap: break-word; }

/* ---------- v2.3: „Poznaj więcej” (prośby o szczegóły) ---------- */
.dd { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: baseline; white-space: nowrap; max-width: 100%; }
.dd-row { margin: -2px 0 8px; }
.dd-btn, .dd-link, .dd-wait, .dd-rejected {
  display: inline-flex; align-items: center; gap: 4px;
  font: 500 12.5px/1.2 var(--font); letter-spacing: -.01em;
  padding: 3px 9px 3px 7px; border-radius: 999px; min-height: 24px;
  border: 0; background: var(--surface-2); color: var(--text-2);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, opacity .15s;
}
.dd-btn svg { width: 14px; height: 14px; stroke-width: 1.8; opacity: .8; }
.dd-btn:hover { color: var(--text); }
.dd-btn:disabled { opacity: .55; cursor: default; }
.dd-wait { background: var(--amber-soft); color: var(--amber); cursor: default; }
.dd-link { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.dd-rejected { background: transparent; color: var(--muted); cursor: default; padding-left: 2px; white-space: normal; }
.dd-cancel { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.dd-cancel svg { width: 13px; height: 13px; }
.dd-spinner { width: 9px; height: 9px; border-radius: 50%; border: 1.6px solid currentColor; border-right-color: transparent; animation: dd-spin 1s linear infinite; }
@keyframes dd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dd-spinner { animation: none; } }
.dd-parent { display: inline-flex; gap: 4px; max-width: 100%; margin: 0 0 10px; font-size: 13.5px; color: var(--blue); text-decoration: none; }
.dd-parent span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-notice {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0 12px; padding: 12px 14px;
  border: 0; border-radius: 14px; background: var(--blue-soft); color: var(--text); text-align: left;
  font: 500 14.5px/1.3 var(--font); cursor: pointer;
}
.dd-notice-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-notice-go { color: var(--blue); font-weight: 600; }

/* ---------- v2.3: Ulubione — Motywacja jako osobna grupa ---------- */
.fav-group { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.group-note { margin: -4px 4px 10px; font-size: 13px; }
.facet-hint { margin: -2px 0 8px; font-size: 13px; }

/* v2.3: przełączniki (checkbox) — wyraźny stan włączony/wyłączony (wcześniej appearance:none ukrywało zaznaczenie) */
.switch { width: 100%; margin: 0; }
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 48px;
  width: 48px; height: 28px; padding: 0; margin: 0; border: 0; border-radius: 14px;
  background: color-mix(in srgb, var(--muted) 38%, transparent); cursor: pointer; transition: background .18s ease;
}
input[type="checkbox"]::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease;
}
input[type="checkbox"]:checked { background: var(--accent); }
input[type="checkbox"]:checked::before { transform: translateX(20px); }
input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="checkbox"]:disabled { opacity: .5; }
