/* Puls Kościerzyny – wygląd aplikacji */
:root {
  --ink: #0F1B2A; --ink2: #26343F; --muted: #5B6B7A; --line: #E3E9EF; --line2: #D5DEE7;
  --bg: #FFFFFF; --soft: #F6F8FA; --soft2: #F1F4F7; --tint: #EEF4F9; --tintLine: #D9E6F1;
  --accent: #0A5C8F; --red: #C62828; --redDark: #A31F15; --green: #1E6B3A; --amberBg: #FFF6E5; --amberLine: #F1D49A; --amberInk: #5C3D00;
  --gold: #D99A00; --goldBg: #FFF8E6; --goldLine: #E8C35A; --violet: #5B3FA0; --dark: #1E2B38;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif; }
body { overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 560px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; background: var(--bg); position: relative; }
.top { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1.5px solid var(--line); background: var(--bg); padding-top: calc(10px + env(safe-area-inset-top)); }
.top.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.back { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px 0 6px; border-radius: 12px; font-size: 15px; font-weight: 700; color: var(--accent); background: none; border: 0; }
.top.dark .back { color: #fff; }
.top .ttl { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.top.dark .ttl { color: #fff; font-size: 15px; font-weight: 800; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 16px; }
.bar { flex: none; display: flex; justify-content: center; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--line); background: var(--bg); }
.nav { flex: none; display: flex; align-items: center; justify-content: space-around; height: 72px; padding: 0 12px env(safe-area-inset-bottom); border-top: 1.5px solid var(--line); background: var(--bg); }
.nav a { width: 84px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.nav a.on { color: var(--accent); }
.pill { height: 50px; padding: 0 24px; border-radius: 25px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; border: 0; }
.nav .pill { width: auto; flex-direction: row; color: #fff; font-size: 14.5px; }

.pad { padding: 0 16px; }
.h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.h2 { margin: 0; font-size: 18px; font-weight: 800; }
.sub { font-size: 13.5px; font-weight: 500; color: var(--muted); line-height: 1.4; }
.lbl { font-size: 14px; font-weight: 800; }
.cap { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 14px; }
.search input { width: 100%; height: 48px; padding: 0 14px 0 44px; border: 1.5px solid var(--line2); border-radius: 14px; background: #fff; outline: none; }
.inp, .sel, .ta { width: 100%; height: 48px; padding: 0 14px; border: 1.5px solid var(--line2); border-radius: 12px; background: #fff; outline: none; }
.ta { height: 110px; padding: 12px 14px; resize: none; line-height: 1.45; }
.inp:focus, .sel:focus, .ta:focus, .search input:focus { border-color: var(--accent); }

.chips-wrap { position: relative; margin-top: 12px; }
.chips { display: flex; gap: 8px; padding: 0 56px 4px 16px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-hint { position: absolute; top: 0; right: 0; bottom: 4px; width: 60px; padding-right: 10px; display: flex; align-items: center; justify-content: flex-end; background: linear-gradient(to right, rgba(255,255,255,0), #fff 55%); pointer-events: none; }
.chips-hint span { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.chip { flex: none; height: 40px; padding: 0 15px; border-radius: 20px; border: 1.5px solid var(--line2); background: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.dark.on { background: var(--ink); border-color: var(--ink); }
.chip.red.on { background: var(--red); border-color: var(--red); }
.wrapchips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: grid; gap: 6px; padding: 4px; border-radius: 14px; background: var(--soft2); }
.seg button { height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; }
.seg button.on { background: #fff; color: var(--ink); }

.card { padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; }
.list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.post { display: flex; gap: 12px; padding: 12px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; }
.post .thumb { flex: none; width: 88px; height: 88px; border-radius: 12px; background: var(--tint); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.post .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post .tt { font-size: 15px; font-weight: 700; line-height: 1.3; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.meta { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.empty { padding: 22px 18px; border-radius: 16px; border: 1.5px dashed #C9D5E0; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.45; }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.note.amber { background: var(--amberBg); color: var(--amberInk); border: 1.5px solid var(--amberLine); }
.note.blue { background: var(--tint); color: #0A4A73; }
.note.green { background: #E6F4EA; color: var(--green); }
.note.red { background: #FDECEA; color: var(--redDark); }
.edited { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; font-style: italic; color: var(--muted); }

.btn { height: 48px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line2); background: #fff; font-weight: 700; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 800; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 800; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; font-weight: 800; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; font-weight: 800; }
.btn.redo { color: var(--red); border-color: #E8B4B0; font-weight: 800; }
.btn.sm { height: 40px; font-size: 13.5px; padding: 0 12px; }
.btn.full { width: 100%; }
.btns { display: flex; gap: 8px; }
.btns > * { flex: 1; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 16px 0; }
.tile { min-height: 112px; padding: 14px; border-radius: 18px; border: 1.5px solid var(--tintLine); background: var(--tint); display: flex; flex-direction: column; gap: 10px; }
.tile .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.tile b { font-size: 16px; font-weight: 800; }
.tile small { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.alert { margin: 12px 16px 0; padding: 16px; border-radius: 18px; background: var(--red); color: #fff; display: flex; flex-direction: column; gap: 8px; }
.alert .k { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.22); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.alert a { align-self: flex-start; padding: 9px 14px; border-radius: 10px; background: #fff; color: var(--redDark); font-size: 13.5px; font-weight: 800; }
.warn { margin: 12px 16px 0; padding: 14px; border-radius: 16px; background: var(--amberBg); border: 1.5px solid var(--amberLine); color: var(--amberInk); }

.star { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.star svg { position: absolute; left: 0; top: 0; }
.star span { position: relative; margin-top: 2px; font-weight: 800; line-height: 1; }
.role { padding: 2px 9px; border-radius: 999px; color: #fff; font-size: 11.5px; font-weight: 800; }
.role.admin { background: var(--ink); } .role.editor { background: var(--violet); }
.ava { flex: none; border-radius: 50%; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; border: 1.5px dashed #AFC0CF; background: var(--soft); }
.ava.ph { border: 0; background: #C7D3DE; }
.ava img { width: 100%; height: 100%; object-fit: cover; }

.sw { flex: none; position: relative; width: 50px; height: 30px; padding: 0; border: 0; border-radius: 15px; background: #B9C5D0; }
.sw::after { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
.sw.on { background: var(--green); }
.sw.on.blue { background: var(--accent); }
.sw.on::after { left: 24px; }
.setrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1.5px solid #EEF1F4; }

.sheet-bg { position: fixed; inset: 0; background: rgba(15,27,42,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { width: 100%; max-width: 560px; background: #fff; border-radius: 22px 22px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 88vh; overflow-y: auto; }
.radio { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line2); font-size: 14.5px; font-weight: 600; }
.radio.on { border-color: var(--accent); background: var(--tint); }
.check { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; line-height: 1.45; color: var(--ink2); }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: calc(100% - 32px); width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.4; z-index: 60; box-shadow: 0 8px 24px rgba(15,27,42,.25); }
.toast.err { background: var(--redDark); }
.spin { padding: 30px; text-align: center; color: var(--muted); font-weight: 600; }
.photo-big { margin: 14px 16px 0; border-radius: 16px; overflow: hidden; background: var(--tint); }
.photo-big img { width: 100%; max-height: 360px; object-fit: cover; }
.bubble { display: flex; flex-direction: column; gap: 4px; max-width: 86%; padding: 10px 14px; border-radius: 16px; background: var(--soft2); }
.bubble.me { align-self: flex-end; background: #E3F0FA; }
.datebox { flex: none; width: 58px; height: 64px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; background: var(--tint); color: #0A4A73; }
.datebox.today { background: var(--red); color: #fff; }
.datebox b { font-size: 22px; } .datebox small { font-size: 12px; font-weight: 800; }
.premium { background: var(--goldBg); border-color: var(--goldLine); }
.ptag { padding: 2px 9px; border-radius: 999px; background: var(--gold); color: #1F1500; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; }
.statgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); }
.stat b { display: block; font-size: 22px; font-weight: 800; margin: 2px 0; }
.stat span { font-size: 12px; font-weight: 700; color: #3B4B59; }
.stat small { font-size: 12px; color: var(--muted); font-weight: 600; }
.ladder { display: flex; gap: 12px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); }
.ladder.on { border-color: var(--accent); background: var(--tint); }
@media (min-width: 600px) { body { background: var(--soft2); } #app { border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line); } }

/* v1.3: karty, opinie */
.nav.four a { width: 66px; }
.nav.four .pill { width: auto; padding: 0 16px; }
.stars { display: inline-flex; gap: 1px; }
.cardsgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 16px 0; }
.lcard { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; aspect-ratio: 1.586; padding: 14px; border-radius: 16px; color: #fff; overflow: hidden; box-shadow: 0 6px 16px rgba(15,27,42,.18); }
.lcard b { font-size: 16px; line-height: 1.2; }
.lcard span { font-size: 13px; font-weight: 700; opacity: .9; letter-spacing: .04em; }
.lcard svg { position: absolute; right: 10px; bottom: 8px; width: 34px; height: 34px; opacity: .35; }
.lcard.big { aspect-ratio: auto; min-height: 92px; }
.lcard.big b { font-size: 20px; }
.bcbox { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 10px 10px; text-align: center; }
.bcbox .bc { width: 100%; height: 110px; display: block; }
.bcbox.big .bc { height: 150px; }
.bcnum { margin-top: 8px; font-size: 18px; font-weight: 800; letter-spacing: .12em; word-break: break-all; color: #000; }
.qrbox { display: flex; justify-content: center; padding: 8px; background: #fff; }
.qrbox img, .qrbox canvas { max-width: 100%; height: auto; }
.showcard { display: flex; flex-direction: column; gap: 14px; padding: 16px; }

/* panel admina na komputerze: pełna szerokość ekranu */
@media (min-width: 900px) {
  body.wide #app { max-width: 1440px; border: 0; }
  body.wide .top { padding-left: 32px; padding-right: 32px; }
  body.wide #main > .pad, body.wide #main > .col.pad, body.wide #tab { padding-left: 32px; padding-right: 32px; }
  body.wide #main > .card { margin-left: 32px !important; margin-right: 32px !important; }
  body.wide .chips { flex-wrap: wrap; overflow: visible; padding-left: 32px; padding-right: 32px; }
  body.wide .chips-hint { display: none; }
  body.wide #tab.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); align-items: start; gap: 14px; }
  body.wide #tab.cardgrid > .note { grid-column: 1 / -1; }
  body.wide #tab .card { margin-left: 0 !important; margin-right: 0 !important; }
}
@media (min-width: 900px) { body.wide #tab:not(.cardgrid) { max-width: 1100px; } }
