/*
 * Brand tokens transcribed from `constants/theme.ts`, which in turn mirrors
 * `web/assets/styles.css`. Warm-only: every hue sits between 330° and 70°, and
 * dropping a cool colour in greys the ivory down.
 *
 * Set in the app's own Inter and Lora, served off the loopback interface out
 * of the app's `node_modules` — see `FONTS` in `server.mjs`. Not a webfont from
 * a CDN, so the page still renders with the network unplugged, and each stack
 * falls back to a system face if a file is not there. The faces are named
 * "… App" rather than "Inter" so a copy installed on the machine, with other
 * metrics, cannot stand in for them: the line counts under the short
 * description are measured in exactly these.
 */
:root {
  --ivory: #fbf6ef;
  --tint: #f3e6df;
  --bordeaux: #9b4f58;
  --bordeaux-deep: #86414a;
  --gold: #bfa77a;
  --ink: #332d29;
  --ink-soft: #5f544e;
  --ink-muted: #a39588;
  --line: #eadbcb;
  --line-soft: #f1e7dc;
  --surface: #ffffff;
  --dark: #2b2522;
  --ok: #4a6b45;
  --ok-bg: #e7f0e4;
  --error-bg: #fbefee;
  --radius: 16px;
  --header: 60px;
  --shadow: 0 1px 2px rgba(51, 45, 41, 0.04), 0 8px 24px rgba(51, 45, 41, 0.06);
  --shadow-lg: 0 18px 44px rgba(51, 45, 41, 0.18), 0 2px 6px rgba(51, 45, 41, 0.06);
  --sans: "Inter App", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Lora App", Georgia, "Iowan Old Style", "Times New Roman", serif;
}

@font-face { font-family: "Inter App"; src: url("/fonts/Inter_400Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter App"; src: url("/fonts/Inter_500Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter App"; src: url("/fonts/Inter_600SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lora App"; src: url("/fonts/Lora_500Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

* { box-sizing: border-box; }

/* `display` on a class beats the browser's own `[hidden]` rule. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0; font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font: 12px ui-monospace, "SF Mono", Menlo, monospace; }
kbd {
  font: 500 10.5px var(--sans);
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-muted);
  background: var(--surface);
}
.hint { font-size: 12px; line-height: 1.45; font-weight: 400; color: var(--ink-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ head -- */

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header);
  padding: 0 24px;
  background: rgba(251, 246, 239, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 18px; white-space: nowrap; }
/* The hero ramp from `ARTWORK.hero`, as a mark. */
.brand-mark { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(149deg, #e8d2c6, #cfa394 46%, #9b4f58); flex: none; }

.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--tint); }
.tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(51, 45, 41, 0.1); }
.tabs .n { margin-left: 6px; font-size: 11px; font-weight: 500; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.tabs .n:empty { display: none; }

/* What Dziś is showing right now — the one fact already on everybody's phone. */
.today {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-align: left;
}
.today:hover { border-color: var(--gold); }
.today-art { width: 30px; height: 30px; border-radius: 50%; }
.today-text { display: grid; min-width: 0; line-height: 1.2; }
.today-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.today b { max-width: 220px; overflow: hidden; font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.today-source { padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--bordeaux-deep); font-size: 11px; white-space: nowrap; }
.today-source.warn { background: var(--bordeaux); color: #fff; }

.project {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* The tool writes straight to production; that should never be a surprise. */
.project code {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  background: var(--bordeaux);
  color: #fff;
  font: 600 11.5px var(--sans);
  letter-spacing: 0.03em;
}
.project code::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28); }

/* ----------------------------------------------------------------- shell -- */

main {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(440px, 560px);
  gap: 20px;
  align-items: start;
  max-width: 1340px;
  margin: 0 auto;
  padding: 20px 24px 120px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.list { overflow: hidden; }

/*
 * The editor is a frame: a heading that stays, a body that scrolls, and the
 * save bar pinned under it. Sticky and capped at the window — sticky alone was
 * a trap once the list grew taller than the form, because the editor pinned
 * its top to the window and left its bottom, Zapisz included, below the fold
 * until the page had scrolled to the end of the list.
 */
.editor {
  position: sticky;
  top: calc(var(--header) + 20px);
  height: calc(100vh - var(--header) - 40px);
  min-height: 440px;
  overflow: hidden;
}

.ed { display: flex; flex-direction: column; height: 100%; }
.ed-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 10px; padding: 14px 20px 24px; }

/* Whole-page state while a request is in flight — every write re-reads the
   catalogue, so a stale list is never what you are looking at. */
body[data-busy="true"] main { opacity: 0.55; pointer-events: none; }

@media (max-width: 980px) {
  main { grid-template-columns: 1fr; }
  .editor { position: static; height: auto; min-height: 0; }
  .ed-body { overflow: visible; }
  .today b { max-width: 120px; }
}

/* --------------------------------------------------------------- buttons -- */

button.primary, button.ghost, button.danger, .filelabel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
}
button.small, .file .filelabel { padding: 5px 12px; font-size: 12.5px; }

button.primary { background: var(--bordeaux); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--bordeaux-deep); }
button.primary kbd { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
button.ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
button.ghost:hover:not(:disabled) { background: var(--ivory); color: var(--ink); }
button.danger { background: var(--surface); border-color: var(--bordeaux); color: var(--bordeaux-deep); }
button.danger:hover:not(:disabled) { background: var(--bordeaux); color: #fff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.filelabel { background: var(--tint); color: var(--ink); }
.filelabel:hover { background: var(--line-soft); }
.filelabel input { display: none; }

.iconbtn { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: 18px; line-height: 1; }
.iconbtn:hover { background: var(--line-soft); color: var(--ink); }

/* ----------------------------------------------------------------- lists -- */

.list-tools { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.list-title { flex: 1; display: grid; gap: 2px; }
.list-title h2 { font-size: 18px; }

.search { position: relative; flex: 1; }
.search input { width: 100%; padding: 9px 40px 9px 34px; border: 1px solid var(--line); border-radius: 12px; background: var(--ivory); }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-54%); font-size: 17px; color: var(--ink-muted); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input::-webkit-search-cancel-button { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; border-bottom: 1px solid var(--line-soft); }
.chip { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; color: var(--ink-soft); }
.chip:hover { border-color: var(--ink-muted); }
.chip .n { margin-left: 6px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, 0.6); }
.chip.warn .n { padding: 0 6px; border-radius: 999px; background: var(--bordeaux); color: #fff; }

.rows { padding-bottom: 8px; }

.group-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 18px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}
.group-title:hover { color: var(--ink-soft); }
.group-title .count { font-weight: 500; letter-spacing: 0; }
.chev { display: inline-block; width: 10px; transition: transform 0.15s; }
.group.closed .chev { transform: rotate(-90deg); }
.group-empty { margin: 2px 16px 6px; padding: 12px; border: 1.5px dashed var(--line); border-radius: 12px; text-align: center; font-size: 12.5px; color: var(--ink-muted); }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 12px 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 8px;
  padding: 8px 10px 8px 6px;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
}
.row:hover { background: var(--ivory); }
.row:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.row[aria-current="true"] { background: var(--tint); }
.row[aria-current="true"]::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--bordeaux); }

.handle { text-align: center; font-size: 13px; color: var(--ink-muted); opacity: 0; cursor: grab; }
.row:hover .handle { opacity: 0.8; }

.art { position: relative; display: block; flex: none; overflow: hidden; background-size: cover; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row-art { width: 46px; height: 46px; border-radius: 11px; }

.row-main { display: grid; gap: 1px; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-name { overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
/* A track still being worked on should read as unfinished at a glance,
   without having to find the badge. */
.row:has(.badge.draft) .row-name { color: var(--ink-soft); }
.row-meta { overflow: hidden; font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; text-overflow: ellipsis; }
.row-side { display: flex; align-items: center; gap: 8px; }
.soft { font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; }

.gaps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
/* Only the gaps that stop a track playing reach the row, so they are all loud. */
.gap { padding: 1px 8px; border-radius: 999px; background: var(--bordeaux); color: #fff; font-size: 11px; white-space: nowrap; }

.badge { flex: none; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.badge.draft { background: var(--line); color: var(--ink-soft); }
.badge.free { background: var(--ok-bg); color: var(--ok); }
.badge.today { background: var(--gold); color: #3f3120; }
/* Pinned but not what Dziś is showing, because the plan named someone else for
   today. Deliberately quieter than `.today`: it is a standing preference, not
   what is on screen. */
.badge.held { background: var(--line-soft); color: var(--ink-soft); }

.star { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; font-size: 16px; color: var(--ink-muted); }
.star:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.star[aria-pressed="true"] { color: var(--gold); }
.star:disabled { opacity: 0.35; }

.dragging { opacity: 0.4; }
/* The row (or group heading) a dragged item would land above. */
.dropinto { box-shadow: inset 0 3px 0 -1px var(--bordeaux); }

.empty { padding: 36px 18px; text-align: center; color: var(--ink-muted); }

/* ---------------------------------------------------------------- editor -- */

.ed-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.ed-head > button { margin-left: auto; }
.ed-art { width: 56px; height: 56px; border-radius: 14px; }
.ed-title { display: grid; gap: 1px; min-width: 0; }
.ed-title h2 { overflow: hidden; font-size: 20px; white-space: nowrap; text-overflow: ellipsis; }
.ed-title code { font-size: 11px; color: var(--ink-muted); }
.ed-crumb { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--ink-muted); }

.empty-editor { display: grid; place-content: center; gap: 4px; height: 100%; padding: 40px; text-align: center; color: var(--ink-soft); }

.section { margin: 10px 2px -2px; font: 600 11px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.card { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); }

.field { display: grid; gap: 6px; min-width: 0; }
.caption { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.count { font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.count.over, .hint.over { color: var(--bordeaux-deep); }
.hint:empty { display: none; }

.field input[type="text"], .field textarea, .field select, .confirm input, .pick-search {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
  color: var(--ink);
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.status { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--ivory); }
.segment { flex: 1; padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.segment:hover:not(:disabled) { color: var(--ink); }
.segment[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(51, 45, 41, 0.12); }
/* Live is the consequential state, so it says so rather than looking like the
   other one with a different label. */
.segment[aria-pressed="true"][data-draft="false"] { background: var(--bordeaux); color: #fff; }
.segment:disabled { opacity: 0.6; cursor: not-allowed; }

.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch-row b { display: block; font-size: 13.5px; font-weight: 600; }
.switch { position: relative; flex: none; width: 36px; height: 22px; margin-top: 1px; }
.switch input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: 0.15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: 0.15s; }
.switch input:checked + i { background: var(--gold); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + i { opacity: 0.45; }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Tags as chips; the first two are drawn as the pills they become on Dziś. */
.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
  cursor: text;
}
.tags:focus-within { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; font-weight: 500; }
.tag.lead { border-color: transparent; background: var(--tint); color: var(--bordeaux-deep); }
.tag button { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; line-height: 1; color: var(--ink-muted); }
.tag button:hover { background: var(--line-soft); color: var(--ink); }
.tags input { flex: 1; min-width: 90px; padding: 4px; border: 0; background: transparent; outline: none; }

/* ---- what is missing ---- */

.todo-card { padding: 8px; }
.todo-card:has(.done) { padding: 12px 14px; border-color: #dcead6; background: #f6faf4; }
.todo { display: grid; gap: 3px; }
.todo-head { padding: 4px 2px 3px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted); }
.todo-head.hard { color: var(--bordeaux-deep); }
.todo-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
.todo-item:hover { background: var(--ivory); }
.todo-item b { display: block; font-size: 13px; font-weight: 600; }
.todo-item .hint { display: block; }
.todo-item .dot { width: 8px; height: 8px; border-radius: 50%; background: #e2d3c6; }
.todo-item.hard { background: var(--error-bg); }
.todo-item.hard b { color: var(--bordeaux-deep); }
.todo-item.hard .dot { background: var(--bordeaux); }
.todo-item .arrow { color: var(--ink-muted); opacity: 0; transition: opacity 0.15s; }
.todo-item:hover .arrow { opacity: 1; }
.todo.done { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ok); }
.todo-ok { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ok-bg); font-size: 12px; }

/* Where the checklist sent you: one blink, then nothing. */
.flash { animation: flash 1.3s ease-out; }
@keyframes flash {
  0%, 35% { box-shadow: 0 0 0 3px rgba(191, 167, 122, 0.6); }
  100% { box-shadow: 0 0 0 3px rgba(191, 167, 122, 0); }
}

/* ---- files ---- */

.file {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--ivory);
}
.file-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--tint); font-size: 17px; color: var(--bordeaux-deep); }
.file-art { width: 44px; height: 44px; border-radius: 10px; }
.file-main { display: grid; gap: 2px; min-width: 0; }
.file-main b { font-size: 13.5px; }
.file-main .hint { overflow-wrap: anywhere; }
.file-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* Notes run the full width under the row, not squeezed into its middle column. */
.file > :nth-child(n + 4) { grid-column: 1 / -1; }
.file-note { margin-top: 2px; }
/* Full width so the scrubber is long enough to land on a moment in the clip. */
.preview-player { width: 100%; height: 34px; margin-top: 4px; }

/* `contain`, never `cover`: the point is the whole frame as uploaded. The tint
   behind it is what a transparent PNG shows through, the way the app shows the
   card under it. A fixed 3:2 box, the shape covers are asked for, so the form
   does not change height when the image arrives — a redraw keeps the editor's
   scroll, and a box that is empty for a frame would clamp it. */
.cover-current { display: block; justify-self: start; width: 300px; max-width: 100%; aspect-ratio: 3 / 2; margin-top: 4px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--tint); }
.cover-current img { display: block; width: 100%; height: 100%; object-fit: contain; }

.drop {
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 100%;
  padding: 22px 16px;
  border: 1.5px dashed #dcc6b4;
  border-radius: 14px;
  background: var(--ivory);
  text-align: center;
  white-space: normal;
  font-weight: 400;
}
.drop:hover, .drop.over { border-color: var(--bordeaux); background: var(--tint); }
.drop b { font-weight: 600; }
.drop-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; color: var(--bordeaux); }

details.more summary { padding: 2px; font-size: 12px; font-weight: 500; color: var(--ink-soft); list-style: none; cursor: pointer; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "ⓘ  "; color: var(--ink-muted); }
details.more p { margin: 6px 2px 0; font-size: 12px; line-height: 1.5; color: var(--ink-muted); }

.warn-line { margin: 0; padding: 7px 10px; border-radius: 8px; background: var(--error-bg); font-size: 12px; line-height: 1.45; color: var(--bordeaux-deep); }
.warn-line.inset { margin: 6px 16px 0; }
.warn-line code { padding: 0 4px; border-radius: 4px; background: rgba(51, 45, 41, 0.07); }

/* ---- delete ---- */

/* Folded shut: the most destructive control on the page should not also be
   the most permanently visible one. */
.danger-zone { margin-top: 14px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.danger-zone summary { padding: 11px 0; font-size: 13px; font-weight: 600; color: var(--bordeaux-deep); list-style: none; cursor: pointer; }
.danger-zone summary::-webkit-details-marker { display: none; }
.danger-zone summary::after { content: "▾"; float: right; color: var(--ink-muted); }
.danger-zone[open] { border-color: #e6c4c4; background: var(--error-bg); }
.danger-zone p { margin: 0 0 10px; }
.confirm { display: flex; gap: 8px; padding-bottom: 14px; }
.confirm input { flex: 1; min-width: 0; background: var(--surface); }

/* ---- collections ---- */

.tints { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tint { width: 32px; height: 32px; padding: 0; border: 2px solid transparent; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
.tint[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff; }
.tints .hint { margin-left: 4px; }

.members { display: grid; gap: 6px; }
.members div { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.member-art { width: 28px; height: 28px; border-radius: 7px; }

/* ---- save bar ---- */

.savebar { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px 12px 20px; border-top: 1px solid var(--line-soft); background: var(--surface); border-radius: 0 0 18px 18px; }
.savestate { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-muted); }
.savestate i { width: 8px; height: 8px; border-radius: 50%; background: #9dbe95; }
.savebar[data-state="dirty"] { background: #fff8f0; }
.savebar[data-state="dirty"] .savestate { font-weight: 600; color: var(--ink); }
.savebar[data-state="dirty"] .savestate i { background: var(--gold); box-shadow: 0 0 0 4px rgba(191, 167, 122, 0.25); }

/* ------------------------------------------------------------------ dock -- */

/*
 * A sibling of `main` rather than part of it, because the busy rule above dims
 * `main` and no child can be brighter than its parent — the one thing that has
 * to stay readable while the page is locked is the thing saying why. Fixed for
 * the same reason: a bar you have to scroll to find does not answer "what is
 * happening". Bottom left rather than centred: the centre of the window is
 * where the editor's save bar sits, and a notice parked on top of "Niezapisane
 * zmiany" hides the one line that says whether there is anything left to do.
 */
.dock {
  position: fixed;
  left: 24px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100vw - 48px));
  pointer-events: none;
}
.dock > div { display: grid; gap: 8px; }
.dock > div:empty { display: none; }

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px 11px 12px;
  border-radius: 14px;
  background: var(--dark);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}
.toast-icon { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: #6e9466; font-size: 11px; font-weight: 700; }
.toast.error .toast-icon { background: var(--bordeaux); }
.toast.info .toast-icon, .toast.guard .toast-icon { background: var(--gold); color: var(--dark); }
.toast-text { flex: 1; min-width: 0; }
.toast-close { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; font-size: 16px; line-height: 1; color: rgba(255, 255, 255, 0.7); }
.toast-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.guard-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.guard-actions button { padding: 5px 11px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-size: 12.5px; font-weight: 600; color: #fff; }
.guard-actions button:hover { background: rgba(255, 255, 255, 0.22); }
.guard-actions button.primary { background: #fff; color: var(--dark); }
.guard-actions button.primary:hover:not(:disabled) { background: var(--tint); }

/* ---------------------------------------------------------------- upload -- */

.upload {
  display: grid;
  gap: 9px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
}

.upload-head { display: flex; align-items: baseline; gap: 10px; }
.upload-percent { margin-left: auto; color: var(--ink-soft); font-size: 13px; }
.upload-percent, .upload .hint { font-variant-numeric: tabular-nums; }

.upload-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--tint); }

.upload-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--bordeaux));
  /* Progress lands in jumps of a few hundred kB. Without this the bar ticks
     rather than moves, and a ticking bar reads as a stall between ticks. */
  transition: width 180ms linear;
}

/* Past the last byte there is nothing left to measure — the server is probing
   the file and writing Firestore — and a bar frozen full reads as a hang. */
.upload[data-finishing="true"] .upload-fill { animation: upload-pulse 1.1s ease-in-out infinite; }

@keyframes upload-pulse { 50% { opacity: 0.4; } }

@media (prefers-reduced-motion: reduce) {
  .upload-fill, .chev, .switch i, .switch i::after { transition: none; }
  .upload[data-finishing="true"] .upload-fill, .toast, .flash { animation: none; }
}

/* ----------------------------------------------------------------- plan --- */

.plan-today { display: flex; align-items: center; gap: 12px; margin: 14px 16px 4px; padding: 10px 12px; border-radius: 14px; background: var(--tint); }
.plan-today-art { width: 40px; height: 40px; border-radius: 10px; }
.plan-today-text { display: grid; min-width: 0; }
.plan-today b { font-size: 14px; }
.pill { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: var(--surface); font-size: 11.5px; color: var(--bordeaux-deep); text-align: right; }

.monthbar { display: flex; align-items: center; gap: 6px; padding: 12px 16px 4px; }
.monthbar h3 { min-width: 170px; font-size: 19px; text-align: center; }
.progress { display: flex; align-items: center; gap: 9px; margin-left: auto; font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-bar { width: 90px; height: 5px; overflow: hidden; border-radius: 999px; background: var(--line-soft); }
.progress-bar i { display: block; height: 100%; border-radius: 999px; background: var(--gold); }

.filltools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 16px 0; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 12px; font-size: 12.5px; color: var(--ink-soft); }
.filltools select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--ivory); font-size: 12.5px; }
.filltools .check { display: flex; align-items: center; gap: 5px; }
.filltools .check input { accent-color: var(--bordeaux); }
.filltools .spacer { flex: 1; }

/* Seven columns, always: a month is read across weeks, and a grid that reflows
   to five columns on a narrow panel stops being a calendar. */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 12px 16px 8px; }
.cal-head { padding-bottom: 2px; text-align: center; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }

.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 78px;
  overflow: hidden;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
}
.cell:hover { border-color: var(--ink-muted); }
.cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cell.blank { border: 0; background: transparent; pointer-events: none; }
.cell[aria-current="true"] { border-color: var(--bordeaux); background: var(--tint); box-shadow: 0 0 0 1px var(--bordeaux); }
.cell-day { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
/* Today is the one cell whose answer is already on somebody's phone. */
.cell.today .cell-day { align-self: flex-start; padding: 0 7px; border-radius: 999px; background: var(--bordeaux); color: #fff; }
/* Days that have already happened stay legible but stop competing with the
   part of the month still worth planning. */
.cell.past { opacity: 0.55; }
.cell-art { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 5px; }
.cell-title { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: 11.5px; line-height: 1.3; color: var(--ink); }
/* Hatched rather than blank, so an unplanned day reads as a decision still to
   make — it will show the pin or the rotation, not nothing. */
.cell.free { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--ivory) 6px 12px); }
.cell.free .cell-title { color: var(--ink-muted); }
/* A day pointing at a track the app will not show — withdrawn or deleted since
   it was planned. It falls back to the pin silently, so the cell has to say so. */
.cell.warn { border-color: var(--bordeaux); }
.cell.warn .cell-title { font-weight: 600; color: var(--bordeaux-deep); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 18px 16px; font-size: 11.5px; color: var(--ink-muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border: 1px solid var(--line); border-radius: 4px; }
.legend .key-today { border-color: var(--bordeaux); background: var(--bordeaux); }
.legend .key-free { background: repeating-linear-gradient(135deg, var(--surface) 0 3px, var(--ivory) 3px 6px); }
.legend .key-warn { border-color: var(--bordeaux); }

.pick-search { margin: 8px 0 4px; padding: 7px 10px; font-size: 13px; }
.picklist { max-height: 260px; overflow: auto; margin: 0 -6px; padding: 0 2px; }
.pick { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.pick:hover { background: var(--ivory); }
.pick.on { background: var(--tint); box-shadow: inset 0 0 0 1.5px var(--bordeaux); }
.pick.broken b { color: var(--bordeaux-deep); }
.pick-art { width: 36px; height: 36px; border-radius: 9px; }
.pick-none { display: grid; place-items: center; width: 36px; height: 36px; border: 1.5px dashed #e2d3c6; border-radius: 9px; color: var(--ink-muted); }
.pick-text { display: grid; min-width: 0; }
.pick-text b, .pick-text .hint { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pick-text b { font-size: 13px; font-weight: 600; }
.pick-group { display: flex; align-items: center; gap: 7px; padding: 10px 8px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted); }
.fallback { margin: 4px 2px 0; }

.home-preview { display: grid; justify-items: center; gap: 10px; padding: 8px 0 12px; }
.home-preview .label-row { width: 100%; flex-wrap: wrap; }

/* --------------------------------------------------------------- preview -- */

/* The device. 320px is a narrow phone, which is the width worth checking: a
   title that fits here fits everywhere. The frame is drawn in the *app's*
   ivory, not the page's, because the two are the same colour and the preview
   would otherwise dissolve into the panel. */
.phone {
  width: 320px;
  max-width: 100%;
  padding: 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--ivory);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--sans);
  color: var(--ink);
  /* Nothing in here is a control. Selecting the preview's text would let it be
     copied back into a form, which is not what it is for. */
  user-select: none;
}

.p-top { padding: 6px 22px 0; display: grid; gap: 3px; }

.p-date {
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.p-greeting {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 30px;
}

/* ---- the hero card ---- */

.p-card {
  position: relative;
  margin: 8px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: var(--surface);
  overflow: hidden;
  /* Warm-tinted, like the card's own shadow: a grey one over ivory reads as
     dirt on the paper. */
  box-shadow: 0 10px 20px rgba(80, 60, 45, 0.12);
}

/* Sized to match `PREVIEW` in app.js, which is what the gradient angles are
   computed from. Change one and change the other. */
.p-art { position: relative; overflow: hidden; }
.p-art-hero { height: 168px; }
.p-art-tile { height: 80px; border-radius: 14px; }

.p-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.p-sheen { position: absolute; inset: 0; }

.p-eyebrow {
  position: absolute;
  top: 14px;
  left: 16px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 9.5px;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.p-disc {
  position: absolute;
  top: 58px;
  left: 50%;
  margin-left: -26px;
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  font-size: 15px;
  color: var(--bordeaux);
}

.p-heart {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 31px;
  height: 31px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  font-size: 15px;
  color: var(--ink-muted);
}

.p-body { padding: 18px; }

.p-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  margin: 0;
}

/* Two lines, then an ellipsis — the same `numberOfLines` the card sets. This is
   half of what the preview is for: copy that is one word too long is invisible
   in a form field and obvious here. `CARD_DESCRIPTION` in app.js measures the
   same box. */
.p-desc {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.p-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }

.p-pill {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--tint);
  color: var(--bordeaux-deep);
  font-size: 10px;
  font-weight: 600;
}

/* ---- Najnowsze ---- */

.p-section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 20px;
  margin: 24px 0 11px;
}

.p-section h5 { font-family: var(--serif); font-size: 15.5px; font-weight: 500; margin: 0; }
.p-seeall { font-size: 12px; font-weight: 600; color: var(--bordeaux); }

/* Scrolls sideways like the row it copies, so eight tiles are eight tiles
   rather than a wrapped grid that exists on no screen. */
.p-row {
  display: flex;
  gap: 11px;
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.p-tile { width: 118px; flex: 0 0 118px; }

.p-tile-badge {
  display: block;
  margin-top: 7px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 9px;
  font-weight: 600;
  color: var(--bordeaux);
}

.p-tile-title {
  display: -webkit-box;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  color: #453c34;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.p-tile-badge + .p-tile-title { margin-top: 2px; }

.p-tile-meta { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-muted); }

/* --------------------------------------------------------------- sign-in -- */

/* Who is signed in, online only. `make admin` has no login and never draws it. */
.account { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.account span { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/*
 * Covers the page rather than replacing it: a session that runs out mid-edit
 * keeps the form underneath, unsaved text and all. Above the dock, whose
 * "Sesja wygasła" toast says the same thing this does.
 */
.signin {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(251, 246, 239, 0.88);
  backdrop-filter: blur(8px);
}
.signin-card {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.signin-card .brand h2 { font-size: 20px; }
.signin-lead { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.signin-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
  color: var(--ink);
}
#signin-code { font: 600 22px var(--sans); letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.signin-error { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--error-bg); color: var(--bordeaux-deep); font-size: 13px; }
.signin-card button { width: 100%; }

@media (max-width: 720px) {
  .account span { display: none; }
}
