/* =====================================================================
   Komuś Się Przyda – wygląd. Kolory zmienisz w sekcji :root.
   ===================================================================== */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #5b6672;
  --line: #e4ddd2;
  --primary: #0f766e;
  --primary-dark: #0b5d57;
  --primary-soft: #e3f4f1;
  --need: #7c3aed;
  --need-dark: #6427cf;
  --need-soft: #f1eafe;
  --warn-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok-soft: #e7f6ec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 41, 51, .06), 0 4px 16px rgba(31, 41, 51, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
@media (min-width: 900px) { html { font-size: 18px; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--primary-dark); }
a:hover { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h2, .h3 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 18px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: #fff; padding: 8px 12px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- nagłówek ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 1.8rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.2rem; color: var(--primary-dark); }
.brand-text small { color: var(--muted); font-size: .72rem; max-width: 300px; }
.main-nav { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.main-nav a:hover { background: var(--primary-soft); }
.main-nav a.active:not(.btn) { background: var(--primary-soft); color: var(--primary-dark); }
.main-nav a.btn { color: #fff; }
.dot-count { display: inline-block; background: #e11d48; color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 7px; margin-left: 4px; font-weight: 700; }
@media (max-width: 640px) {
  .site-header { position: static; }
  .filter-row label { flex: 1 1 100%; }
  .filter-row select { max-width: none; }
  .brand-text small { display: none; }
  .main-nav { width: 100%; justify-content: space-between; }
  .main-nav a { padding: 7px 8px; font-size: .92rem; }
}

/* ---------- przyciski ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 18px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-need { background: var(--need); border-color: var(--need); color: #fff; }
.btn-need:hover { background: var(--need-dark); border-color: var(--need-dark); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(.92); }
.btn-danger-ghost { color: var(--danger); background: transparent; }
.btn-danger-ghost:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.btn-sm { min-height: 38px; padding: 6px 13px; font-size: .9rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.spinner { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero i filtry ---------- */
.hero { background: linear-gradient(135deg, var(--primary-soft), #fdf1e4); border-radius: 22px; padding: clamp(22px, 5vw, 44px); margin-bottom: 22px; }
.hero h1 { font-size: clamp(1.6rem, 4.2vw, 2.4rem); }
.hero p { max-width: 720px; font-size: 1.05rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 20px; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab, .kind-tile { position: relative; }
.tab input, .kind-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.tab span { display: inline-block; padding: 8px 16px; border-radius: 99px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; }
.tab input:checked + span { background: var(--text); border-color: var(--text); color: #fff; }
.tab input:focus-visible + span { outline: 3px solid #f59e0b; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.filter-row .grow { flex: 1 1 260px; }
.filter-row label { flex: 0 1 auto; }
.filter-row select { max-width: 260px; }

input, select, textarea { width: 100%; font: inherit; color: var(--text); padding: 10px 12px; border: 1.5px solid #cfc6b8; border-radius: 10px; background: #fff; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; margin: 6px 0; font-weight: 400 !important; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--primary); }

/* ---------- karty ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(31,41,51,.12); color: var(--text); }
.card-img { aspect-ratio: 4 / 3; background: #f1ece4; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.placeholder { display: flex; align-items: center; justify-content: center; font-size: 3.4rem; background: linear-gradient(135deg, var(--primary-soft), #f6efe4); }
.placeholder.ph-need { background: linear-gradient(135deg, var(--need-soft), #f6efe4); }
.card-body { padding: 12px 14px 14px; }
.card-body h3 { font-size: 1.05rem; margin: 6px 0 4px; }
.card-body p { margin: 0 0 2px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }
.badge-give { background: var(--primary-soft); color: var(--primary-dark); }
.badge-need { background: var(--need-soft); color: var(--need-dark); }
.badge-status { background: #eee; color: #444; }
.st-zarezerwowane { background: var(--warn-soft); color: #8a5a00; }
.st-przekazane { background: var(--ok-soft); color: #1d6b38; }
.badge-req { text-transform: none; letter-spacing: 0; }
.rs-oczekuje { background: var(--warn-soft); color: #8a5a00; }
.rs-zaakceptowana { background: var(--primary-soft); color: var(--primary-dark); }
.rs-zakonczona { background: var(--ok-soft); color: #1d6b38; }
.rs-odrzucona, .rs-anulowana { background: #eee; color: #555; }
.empty { text-align: center; padding: 40px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); grid-column: 1 / -1; }

/* ---------- panele, alerty ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: .5em; }
.panel-ok { background: var(--primary-soft); border-color: #b8e2dc; }
.alert { padding: 12px 14px; border-radius: 10px; margin: 10px 0; }
.alert-error { background: var(--danger-soft); color: #7a1a12; }
.alert-ok { background: var(--ok-soft); color: #1d5c34; }
.hint { background: var(--warn-soft); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; max-width: min(92vw, 520px); padding: 12px 20px; border-radius: 12px; color: #fff; background: #1f2933; box-shadow: 0 8px 30px rgba(0,0,0,.25); font-weight: 500; }
.toast-error { background: var(--danger); }

/* ---------- szczegóły ogłoszenia ---------- */
.crumbs { margin-bottom: 14px; }
.crumbs a { text-decoration: none; font-weight: 600; }
.detail { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .detail { grid-template-columns: 1.1fr 1fr; align-items: start; } .detail-media { position: sticky; top: 90px; } }
.gallery img#main-photo { width: 100%; max-height: 520px; object-fit: contain; background: #f1ece4; border-radius: var(--radius); }
.gallery-ph { aspect-ratio: 4 / 3; border-radius: var(--radius); font-size: 6rem; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; }
.thumb.active { border-color: var(--primary); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; margin: 0 0 14px; }
.facts dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-weight: 500; }
.desc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: var(--surface); border: 1px solid var(--line); padding: 5px 12px; border-radius: 99px; font-size: .9rem; }
.req-list { list-style: none; padding: 0; margin: 0; }
.req { border-top: 1px solid var(--line); padding: 12px 0; }
.req:first-child { border-top: 0; }
.req-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.report { margin-top: 18px; }
.report summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.report form { margin-top: 8px; display: grid; gap: 8px; }
.safety { margin-top: 30px; background: var(--warn-soft); border-radius: var(--radius); padding: 16px 20px; }
.safety ul { margin: 0; padding-left: 20px; }

/* ---------- formularz ---------- */
.form { display: grid; gap: 14px; max-width: 760px; }
.form label { display: grid; gap: 5px; font-weight: 600; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.form legend { font-weight: 700; margin-bottom: 6px; }
.two { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } }
.kind-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kind-tile span { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 16px 10px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-size: 1.8rem; }
.kind-tile strong { font-size: 1.1rem; }
.kind-tile small { font-size: .8rem; color: var(--muted); font-weight: 400; }
.kind-tile input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.kind-tile.need input:checked + span { border-color: var(--need); background: var(--need-soft); }
.kind-tile input:focus-visible + span { outline: 3px solid #f59e0b; }
fieldset:disabled .kind-tile span { cursor: default; opacity: .8; }
.checks { display: grid; gap: 2px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.photo-grid:empty { display: none; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eee; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 1.2rem; cursor: pointer; line-height: 1; }
.file-btn { justify-self: start; cursor: pointer; }
.req-check { background: var(--surface); border: 1px solid var(--line); padding: 12px; border-radius: 10px; }

/* ---------- moje sprawy ---------- */
.big-tabs { border-bottom: 2px solid var(--line); gap: 0; margin-bottom: 16px; }
.tab-link { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab-link.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.case-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.case { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); }
.case:hover { border-color: var(--primary); color: var(--text); }
.case.unread { border-left: 5px solid #e11d48; }
.case-main { display: flex; flex-direction: column; gap: 3px; }
.case-main .badge { align-self: flex-start; }
.case-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.new-dot { background: #e11d48; color: #fff; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.resolved { opacity: .6; }

/* ---------- rozmowa ---------- */
.case-listing { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.case-listing > span:last-child { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.case-thumb { width: 72px; height: 72px; flex: none; border-radius: 10px; overflow: hidden; font-size: 2rem; }
.case-thumb img { width: 100%; height: 100%; object-fit: cover; }
.status-panel p { margin: 0; }
.status-panel.rs-zaakceptowana { background: var(--primary-soft); }
.status-panel.rs-zakonczona { background: var(--ok-soft); }
.chat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.msgs { list-style: none; margin: 0 0 12px; padding: 4px; max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg time { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 16px; white-space: normal; overflow-wrap: anywhere; }
.mine .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.theirs .bubble { background: #f1ece4; border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; align-items: center; max-width: 92%; text-align: center; }
.msg.sys span { background: var(--warn-soft); padding: 6px 12px; border-radius: 10px; font-size: .88rem; }
.send { display: flex; gap: 8px; align-items: flex-end; }
.send textarea { flex: 1; }

/* ---------- konto, logowanie ---------- */
.auth { max-width: 520px; margin: 0 auto; }
.forgot summary { cursor: pointer; color: var(--primary-dark); }
.forgot .form { margin-top: 10px; }
.cols { display: grid; gap: 18px; }
@media (min-width: 860px) { .cols { grid-template-columns: 1fr 1fr; align-items: start; } .cols .panel { margin-top: 0; } }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.danger-zone label { display: grid; gap: 5px; margin: 10px 0; }

/* ---------- treści, stopka ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.prose li { margin-bottom: .4em; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: .7em; }
.site-footer { background: #1f2933; color: #d7dde3; padding: 28px 0; font-size: .92rem; }
.site-footer a { color: #fff; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer .muted { color: #a9b4bf; }

/* ---------- kod odzyskiwania ---------- */
.recovery { border: 2px dashed #e0a800; background: #fffaf0; }
.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: .12em; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; text-align: center; user-select: all; }
.code-inline { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; }
