/* Duże litery, duże przyciski, wysoki kontrast. Stan zawsze ikoną + tekstem, nie kolorem. */
:root {
  --bg: #f6f4ef; --card: #fff; --ink: #1d1d1b; --muted: #5d5a54; --line: #cfcac0;
  --primary: #24425c; --primary-ink: #fff; --attention-bg: #fff3c4; --danger: #8a1c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 32px; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: .4em 0; }
h2 { font-size: 1.3rem; margin: 1.4em 0 .5em; border-bottom: 2px solid var(--line); padding-bottom: 4px; }
h3 { font-size: 1.1rem; margin: 1em 0 .3em; }
.muted { color: var(--muted); }
code { background: #e9e5dc; padding: 1px 4px; border-radius: 4px; }

.top { position: sticky; top: 0; z-index: 10; background: var(--primary); }
.top nav { display: flex; max-width: 760px; margin: 0 auto; }
.top a { flex: 1; text-align: center; color: var(--primary-ink); text-decoration: none; padding: 14px 6px; font-weight: 600; font-size: 1.05rem; }
.top a.on { background: rgba(255,255,255,.18); text-decoration: underline; text-underline-offset: 5px; }
footer { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; }

.flash { background: var(--card); border: 2px solid var(--primary); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.error { background: #fde8e8; border: 3px solid var(--danger); border-radius: 10px; padding: 12px 14px; font-weight: 600; }
.warning { background: var(--attention-bg); border: 3px dashed var(--ink); border-radius: 10px; padding: 8px 14px; font-weight: 600; }
.back { display: inline-block; padding: 8px 0; font-size: 1.05rem; }
.where-big { font-size: 1.15rem; margin: 0 0 .6em; }
.summary { color: var(--muted); }

/* Status: ikona + pogrubiony tekst + szczegół */
.status { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 6px 10px; border-radius: 10px; background: var(--card); border: 2px solid var(--line); }
.status.attention { background: var(--attention-bg); border: 3px solid var(--ink); }
.status small { flex-basis: 100%; color: var(--muted); font-size: .95rem; }
.ic { font-size: 1.3em; }

/* Mapa klatek */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 104px; padding: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.tile .code { font-size: 1.35rem; font-weight: 800; }
.tile .line { display: flex; align-items: center; gap: 4px; }
.tile .st { font-size: .85rem; font-weight: 600; line-height: 1.15; }
.tile .more { font-size: .8rem; color: var(--muted); }
.tile.empty { background: transparent; border-style: dashed; color: var(--muted); }
.tile.attention { background: var(--attention-bg); border: 3px solid var(--ink); }
.tile .flag { position: absolute; top: 6px; right: 6px; font-size: 1.2rem; }

.todo, .cards, .history, .plain { list-style: none; padding: 0; margin: 0; }
.todo li a, .card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin-bottom: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.todo .where, .card .who { font-weight: 700; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 10px 16px; border-radius: 12px; border: 2px solid var(--primary); background: var(--card); color: var(--primary); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.big { width: 100%; min-height: 60px; font-size: 1.2rem; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .95rem; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.link { background: none; border: none; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; padding: 4px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.actions .btn { width: 100%; }
.actions.secondary { margin-top: 28px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.tabs a { padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--card); font-weight: 600; }
.tabs a.on { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }

/* Formularze */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; }
.form input, .form select, .form textarea { font: inherit; padding: 12px; border: 2px solid #8d877b; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
.form input[type=checkbox] { width: 28px; height: 28px; }
.form .req { color: var(--danger); }
.date-row { display: flex; gap: 6px; align-items: center; }
.date-row input { flex: 1; min-width: 0; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
.form.inline > * { flex: 1 1 140px; width: auto; }
.inline-form { display: inline; }
.login { max-width: 420px; margin: 8vh auto 0; }

/* Historia */
.history li { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.h-head { display: flex; align-items: center; gap: 8px; }
.h-head time { margin-left: auto; font-weight: 700; white-space: nowrap; }
.h-body { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.note { margin: 6px 0 0; white-space: pre-wrap; background: #f1eee7; border-radius: 8px; padding: 6px 8px; }
.h-meta summary { color: var(--muted); font-size: .9rem; cursor: pointer; padding: 6px 0 0; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px; }
dl.facts dt { font-weight: 700; color: var(--muted); }
dl.facts dd { margin: 0; }

@media (max-width: 380px) {
  body { font-size: 17px; }
  .actions { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }
.install { margin: 4px 0 10px; }
.install-hint { background: var(--card); border: 2px solid var(--primary); border-radius: 10px; padding: 10px 14px; }

/* Podgląd importu */
.imp { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 4px 12px 10px; margin-bottom: 12px; }
.imp-empty { background: transparent; border-style: dashed; }
.imp h3 { margin: .5em 0 .3em; }
.orig { white-space: pre-wrap; font: inherit; font-size: .95rem; background: #f1eee7; border-left: 4px solid #8d877b; padding: 6px 10px; margin: 0 0 8px; }
.imp-items { padding-left: 4px; list-style: none; margin: 0; }
.imp-items li { padding: 3px 0; }
.imp-items li.guess { font-weight: 700; text-decoration: underline dotted; }
.imp-after { margin: 8px 0 4px; font-weight: 700; }
.imp-status { margin-bottom: 4px; }
.questions li { margin-bottom: 8px; }
