/* Skrzynka Pani Keto - mobile-first */
:root {
  --bg: #f5f4ef;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #6b726e;
  --line: #e3e1d9;
  --brand: #1f3d2b;
  --brand-2: #2f6b47;
  --ok: #1d7a3e;
  --ok-bg: #e5f4ea;
  --err: #b3261e;
  --err-bg: #fbe9e7;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--brand-2); }
h1 { font-size: 1.4rem; margin: 8px 0 14px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; background: #f0efe9; padding: 1px 5px; border-radius: 6px; word-break: break-all; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--brand); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.top .brand { font-weight: 700; letter-spacing: .2px; }
.top .who { opacity: .85; font-size: .9rem; }

.nav {
  display: flex; gap: 6px; overflow-x: auto; white-space: nowrap;
  background: #fff; border-bottom: 1px solid var(--line); padding: 8px 10px;
  -webkit-overflow-scrolling: touch;
}
.nav a, .nav .link {
  display: inline-block; padding: 8px 12px; border-radius: 999px;
  text-decoration: none; color: var(--ink); font-size: .95rem;
  background: none; border: 0; font-family: inherit; cursor: pointer;
}
.nav a.on { background: var(--brand); color: #fff; }
.nav .link { color: var(--muted); }
form.inline { display: inline; margin: 0; }

.wrap { max-width: 760px; margin: 0 auto; padding: 12px 14px 30px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 14px;
}
.card.narrow { max-width: 420px; margin: 24px auto; }

label { display: block; font-weight: 600; margin: 0 0 12px; font-size: .95rem; }
input {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: 17px; /* 16+ = iPhone nie powiększa ekranu */
  padding: 12px 12px; border: 1px solid #cfccc2; border-radius: 10px; background: #fff;
}
input:focus { outline: 2px solid var(--brand-2); border-color: transparent; }

.btn {
  display: inline-block; font: inherit; font-weight: 600;
  background: var(--brand); color: #fff; border: 0; border-radius: 12px;
  padding: 12px 18px; min-height: 46px; cursor: pointer;
}
.btn.big { width: 100%; font-size: 1.05rem; min-height: 52px; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn:active { transform: translateY(1px); }

.flash { padding: 12px 14px; border-radius: 12px; margin: 0 0 12px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.good { color: var(--ok); font-weight: 600; }
.bad { color: var(--err); font-weight: 600; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.empty { text-align: center; padding: 40px 16px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.big-num { font-size: 3rem; font-weight: 700; color: var(--brand); line-height: 1; }

dl.kv { display: grid; grid-template-columns: 1fr; gap: 2px 12px; margin: 0 0 8px; }
dl.kv dt { color: var(--muted); font-size: .85rem; margin-top: 8px; }
dl.kv dd { margin: 0; }
@media (min-width: 600px) {
  dl.kv { grid-template-columns: 220px 1fr; }
  dl.kv dt { margin-top: 0; }
}

.table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.sig-valid { color: var(--ok); }
.sig-invalid { color: var(--err); font-weight: 600; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }

pre.json { background: #f7f6f2; border-radius: 10px; padding: 12px; overflow-x: auto; font-size: .8rem; max-height: 70vh; }

.foot { text-align: center; color: var(--muted); font-size: .75rem; padding: 10px 0 24px; }

/* --- Lista pozycji (E2) --- */
h1 .count { font-size: .95rem; background: var(--brand); color: #fff; border-radius: 999px; padding: 2px 10px; vertical-align: middle; }
h2.section { margin: 18px 0 10px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.center { text-align: center; }
.item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.item.old { border-left: 4px solid #d98c1f; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; font-weight: 700; font-size: .75rem; padding: 2px 7px; border-radius: 6px; color: #fff; background: #555; }
.b-facebook { background: #1877f2; }
.b-instagram { background: #c13584; }
.b-youtube { background: #e00; }
.b-tiktok { background: #111; }
.kind { font-weight: 600; color: var(--ink); }
.brand-tag { background: #eef3ee; color: var(--brand); border-radius: 6px; padding: 1px 7px; }
.when { margin-left: auto; }
.when.late { color: #b4610b; font-weight: 600; }
.author { font-weight: 700; margin: 8px 0 4px; }
.text { font-size: 1.05rem; margin: 4px 0 8px; white-space: normal; word-wrap: break-word; }
.post { display: flex; gap: 8px; align-items: center; background: #f7f6f2; border-radius: 10px; padding: 6px 8px; margin: 6px 0; font-size: .85rem; color: var(--muted); }
.post img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.flag { display: inline-block; font-size: .8rem; background: #fff3e0; color: #9a5800; border-radius: 6px; padding: 2px 8px; margin-bottom: 6px; }
.rule { font-size: .8rem; color: var(--muted); margin: 4px 0 8px; }
.thread { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.msg { max-width: 88%; padding: 8px 10px; border-radius: 14px; font-size: .95rem; word-wrap: break-word; }
.msg small { display: block; font-size: .7rem; opacity: .75; margin-bottom: 2px; }
.msg time { display: block; font-size: .7rem; opacity: .6; margin-top: 2px; }
.msg.in { background: #f0efe9; align-self: flex-start; }
.msg.in.new { background: #fff6d6; border: 1px solid #f0d77a; }
.msg.out { background: #e3f1e7; align-self: flex-end; }
.att { font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: flex-start; }
.actions form.inline { margin: 0; }
.btn.small { padding: 8px 12px; min-height: 38px; font-size: .9rem; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details.done { width: 100%; }
details.done[open] > summary { margin-bottom: 8px; }
.reasons { display: flex; flex-direction: column; gap: 6px; }
.reasons .btn { width: 100%; text-align: left; background: #f4f3ee; color: var(--ink); border: 1px solid var(--line); }
textarea { display: block; width: 100%; font: inherit; font-size: 16px; padding: 10px; border: 1px solid #cfccc2; border-radius: 10px; margin: 8px 0; }
.tpl-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tpl-body { background: #f7f6f2; border-radius: 10px; padding: 10px; margin: 6px 0; }
.words { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.word { background: #f0efe9; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: .85rem; }
.word.extra { background: #fff3c4; }
.word .x { border: 0; background: none; color: var(--err); font-size: 1rem; cursor: pointer; padding: 0 6px; }
@media (min-width: 700px) {
  details.done { width: auto; }
}

/* Przyciski w karcie: 2 kolumny na telefonie */
a.btn { text-decoration: none; text-align: center; }
.item .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.item .actions > * { width: 100%; min-width: 0; }
.item .actions .btn { width: 100%; padding-left: 8px; padding-right: 8px; }
.item .actions > a.btn { grid-column: 1 / -1; }
.item .actions details.done { grid-column: 1 / -1; order: 5; }
.item .actions details.done > summary { display: block; text-align: center; }
@media (min-width: 700px) {
  .item .actions { grid-template-columns: repeat(3, 1fr); }
  .item .actions > a.btn { grid-column: auto; }
}

/* E3: odpowiedzi i statusy wysyłki */
.out-status { font-size: .85rem; background: #f0efe9; border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.out-status.bad { background: var(--err-bg); }
.out-status.good { background: var(--ok-bg); }
details.reply { margin-top: 10px; }
details.reply > summary { display: block; text-align: center; }
.reply-form { margin-top: 10px; }
select { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 16px; padding: 10px; border: 1px solid #cfccc2; border-radius: 10px; background: #fff; }
a.when { color: inherit; text-decoration: none; }
a.card.result { display: block; color: var(--ink); text-decoration: none; }
a.card.result:active { background: #f7f6f2; }

.help ul { padding-left: 20px; margin: 0; }
.help li { margin: 0 0 8px; }
.help p { margin: 0 0 10px; }

label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
label.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; }

.row { flex-wrap: wrap; }
.row > div:first-child { flex: 1 1 180px; min-width: 0; word-break: break-word; }
.row form { margin: 0; }

/* Zmiany, instrukcja per przypadek */
a.card.notice { display: block; text-decoration: none; color: #8a1c14; background: #fff4f2; border-color: #f3c7c0; font-weight: 600; }
.change.unread { border-left: 4px solid #d33; }
.cases { display: flex; flex-direction: column; gap: 10px; }
.case { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.case .sit { font-weight: 700; margin-bottom: 4px; }
.case .do { color: #2b3330; }

[hidden] { display: none !important; }

/* Obsługa: kolory marek i zakładki Mariusza (Pani Keto | Ketomocni, nigdy razem) */
body.b-pk { --brand: #4a2d73; --brand-2: #6b44a3; }
body.b-km { --brand: #142a66; --brand-2: #2a4fb0; }
.btabs { display: flex; gap: 0; background: #fff; border-bottom: 1px solid var(--line); }
.btabs .bt { flex: 1; text-align: center; padding: 12px 8px; font-weight: 600; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; }
.btabs .bt-pk.on { color: #4a2d73; border-bottom-color: #4a2d73; background: #f4effa; }
.btabs .bt-km.on { color: #142a66; border-bottom-color: #142a66; background: #eef2fb; }
.order { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 12px; margin: 10px 0; }
.order .meta { color: var(--muted); font-size: .9rem; }
.order textarea { width: 100%; min-height: 150px; font: inherit; margin-top: 8px; }
.warn { background: #fff6e0; border: 1px solid #f0d58a; border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: .92rem; }
