/* PracaSoc — papier, atrament, porządne nagłówki. Bez cieni, bez gradientów. */

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  --paper: #f6f4ef;
  --sheet: #fffefb;
  --ink: #1c1d21;
  --ink-2: #4b4c53;
  --ink-3: #77787e;
  --rule: #e3dfd5;
  --rule-2: #cfc9bb;
  --accent: #23439b;
  --accent-hover: #1b3580;
  --accent-ink: #ffffff;
  --accent-soft: #e9edf8;
  --danger: #a3342b;
  --danger-soft: #f8e9e6;
  --ok: #2d6a3c;
  --ok-soft: #e7f1e8;

  --serif: "Source Serif 4", "Iowan Old Style", Charter, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
  --col: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141518;
    --sheet: #1b1c20;
    --ink: #ecebe6;
    --ink-2: #bdbbb3;
    --ink-3: #8d8b84;
    --rule: #2b2c32;
    --rule-2: #3c3d44;
    --accent: #9fb3f1;
    --accent-hover: #b8c7f5;
    --accent-ink: #10131c;
    --accent-soft: #1e2640;
    --danger: #ee8c80;
    --danger-soft: #3a201d;
    --ok: #93d09f;
    --ok-soft: #1b2d1f;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* atrybut hidden ma wygrywać z display ustawionym przez klasy (.btn, .tile…) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { margin: 0; font-weight: 600; }

h1 {
  font: 600 1.75rem/1.15 var(--serif);
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p { margin: 0 0 0.75rem; }

small { font-size: 0.8125rem; color: var(--ink-3); font-weight: 400; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.i {
  width: 1.25rem; height: 1.25rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.i-lg { width: 2.25rem; height: 2.25rem; stroke-width: 1.25; color: var(--ink-3); }

/* ── górny pasek ─────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar-in {
  max-width: var(--col); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.625rem 1rem;
}

.brand {
  font: 600 1.1875rem/1 var(--serif);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand::before {
  /* znak: kartka z zagiętym rogiem, w kolorze atramentu */
  content: ""; display: inline-block; vertical-align: -0.12em;
  width: 0.7em; height: 0.9em; margin-right: 0.4em;
  background: var(--accent);
  clip-path: polygon(0 0, 66% 0, 100% 26%, 100% 100%, 0 100%);
}
.brand:hover { color: var(--ink); }
.brand-lg { font-size: 1.625rem; margin-bottom: 1.5rem; display: block; }

.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  color: var(--ink-2); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500;
  padding: 0.5rem 0.625rem; border-radius: var(--radius);
}
.nav a:hover { color: var(--ink); background: var(--rule); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav .me {
  width: 2.25rem; height: 2.25rem; padding: 0; margin-left: 0.25rem;
  display: grid; place-items: center;
  border: 1px solid var(--rule-2); border-radius: 50%;
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em;
}
.nav .me[aria-current="page"] { border-color: var(--ink); }

/* ── strona ──────────────────────────────────────────────── */

.page {
  max-width: var(--col); margin: 0 auto;
  padding: 1.25rem 1rem calc(3rem + env(safe-area-inset-bottom, 0px));
}

.head { margin: 0.5rem 0 1.25rem; }
.head h1 + .lede, .head h1 + .meta { margin-top: 0.5rem; }
.lede { color: var(--ink-2); white-space: pre-line; max-width: 36rem; }
.meta { color: var(--ink-3); font-size: 0.875rem; margin: 0; }
.muted { color: var(--ink-3); }
.danger { color: var(--danger); }

.crumb {
  display: inline-flex; align-items: center; gap: 0.125rem;
  margin-left: -0.3rem;
  color: var(--ink-3); text-decoration: none; font-size: 0.875rem;
}
.crumb:hover { color: var(--ink); }
.crumb .i { width: 1.125rem; height: 1.125rem; }

.kicker {
  margin: 0 0 0.375rem;
  color: var(--ink-3); font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}

.section { margin-top: 2.25rem; }
.label {
  margin-bottom: 0.75rem;
  color: var(--ink-3); font: 600 0.75rem/1.2 var(--sans);
  letter-spacing: 0.07em; text-transform: uppercase;
}

.notice {
  margin: 0 0 1.25rem; padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9375rem;
}
.notice-ok { border-color: var(--ok); background: var(--ok-soft); }
.notice-error { border-color: var(--danger); background: var(--danger-soft); }

/* ── zakładki ────────────────────────────────────────────── */

.tabs {
  display: flex; gap: 1.5rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 0.625rem 0; margin-bottom: -1px;
  color: var(--ink-3); text-decoration: none; font-weight: 500; font-size: 0.9375rem;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

/* ── listy ───────────────────────────────────────────────── */

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.tabs + .rows { border-top: 0; margin-top: -0.75rem; }
.rows > li { border-bottom: 1px solid var(--rule); }

.row {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.875rem 0.25rem;
  color: inherit; text-decoration: none;
}
a.row:hover { background: var(--sheet); color: inherit; }
a.row:hover .chev { color: var(--ink); transform: translateX(2px); }

.row-main { flex: 1; min-width: 0; display: grid; gap: 0.125rem; }
.row-title { font: 600 1.0625rem/1.3 var(--serif); overflow-wrap: anywhere; }
.row-title.code { font: 500 1rem/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.04em; }
.row-meta { color: var(--ink-3); font-size: 0.8125rem; overflow-wrap: anywhere; }

.chev { color: var(--ink-3); transition: transform 0.15s, color 0.15s; }

.tile, .avatar {
  flex: none; display: grid; place-items: center;
  color: var(--ink-2); background: var(--sheet);
  border: 1px solid var(--rule-2);
}
.tile {
  width: 2.5rem; height: 2.5rem; border-radius: var(--radius);
  font: 600 0.9375rem/1 var(--serif);
}
.avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}

.role {
  flex: none; color: var(--ink-3);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.role-owner { color: var(--accent); }
.role-moderator { color: var(--ink); }

.tag {
  display: inline-block; vertical-align: 0.1em; margin-left: 0.25rem;
  padding: 0.0625rem 0.375rem; border: 1px solid var(--rule-2); border-radius: 4px;
  font: 600 0.6875rem/1.4 var(--sans); letter-spacing: 0.03em; color: var(--ink-2);
}
.tag-danger { color: var(--danger); border-color: currentColor; }

.empty {
  padding: 2.5rem 1rem; text-align: center;
  border: 1px dashed var(--rule-2); border-radius: 8px;
}
.empty p { margin: 0.25rem 0 0; }
.empty .i-lg { margin-bottom: 0.5rem; }

/* wiersz osoby z rozwijanymi opcjami po prawej */
.person { position: relative; }
.person.has-actions > .row { padding-right: 3rem; }
.manage > summary {
  position: absolute; top: 0.625rem; right: 0;
  width: 2.5rem; height: 2.5rem; display: grid; place-items: center;
  border-radius: var(--radius); color: var(--ink-3);
  list-style: none; cursor: pointer;
}
.manage > summary::-webkit-details-marker { display: none; }
.manage > summary:hover, .manage[open] > summary { color: var(--ink); background: var(--rule); }
.manage-body {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0 0.25rem 1rem 3.375rem;
}
.manage-body form { margin: 0; }

/* ── formularze ──────────────────────────────────────────── */

.stack { display: grid; gap: 1rem; }
.narrow { max-width: 26rem; }

.field { display: grid; gap: 0.375rem; }
.field > span { font-weight: 600; font-size: 0.9375rem; }
.grow { flex: 1; min-width: 12rem; }

input, select, textarea {
  width: 100%; min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-2); border-radius: var(--radius);
}
textarea { resize: vertical; line-height: 1.45; }
select { padding-right: 2rem; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.form-row .field { flex: 1 1 9rem; }
.form-row > .notice { flex-basis: 100%; margin: 0; }
.inline { display: flex; gap: 0.5rem; align-items: center; }
.inline select { width: auto; }

.search { margin-bottom: 1rem; }

/* ── przyciski ───────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 1rem;
  font: 500 0.9375rem/1 var(--sans); color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-2); border-radius: var(--radius);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); padding: 0 0.625rem; }
.btn-quiet:hover { background: var(--rule); border-color: transparent; }
.btn-quiet.danger { color: var(--danger); }
.btn-quiet.danger:hover { background: var(--danger-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--sheet); }
.btn-danger:hover { filter: brightness(0.92); color: var(--sheet); border-color: var(--danger); }
.btn-wide { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.actions form { margin: 0; }

.foot-action { margin-top: 2rem; }
.foot-action.split { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.foot-action .fold { margin-top: 0; flex: 1 1 18rem; }
.foot-action form { margin: 0; }

/* rozwijane sekcje: „Nowa grupa”, „Usuń grupę” */
.fold { margin-top: 1.5rem; }
.section > .fold { margin-top: 0; }
.fold > summary { list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary { display: none; }
.fold-body { padding: 1.25rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; }
.danger-zone { margin-top: 3rem; }
.danger-zone .fold-body { border-color: color-mix(in srgb, var(--danger) 40%, var(--rule)); }

/* ── udostępnianie: zaproszenia i linki resetu ───────────── */

.share-card {
  display: grid; justify-items: center; gap: 1rem;
  padding: 1.5rem 1rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
  text-align: center;
}
.qr { width: min(15rem, 70vw); line-height: 0; }
.qr svg { width: 100%; height: auto; border-radius: 4px; }
.share-url {
  margin: 0; font: 500 1rem/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.share-card .actions { justify-content: center; }

/* tryb „pełny ekran” do pokazania kodu na rzutniku */
.share-card:fullscreen { align-content: center; border: 0; border-radius: 0; background: #fff; color: #16171a; }
.share-card:fullscreen .qr { width: min(70vh, 80vw); }
.share-card:fullscreen .share-url { font-size: clamp(1.25rem, 3.5vw, 2.5rem); }
.share-card:fullscreen .actions, .share-card:fullscreen .meta { display: none; }

/* ── strony logowania i zaproszeń ────────────────────────── */

.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; justify-items: center; align-content: center; gap: 1rem;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
.auth > .notice { width: 100%; max-width: 25rem; }
.sheet {
  width: 100%; max-width: 25rem;
  padding: 1.75rem 1.5rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px;
}
.sheet h1 { margin-bottom: 0.5rem; }
.sheet .lede { margin-bottom: 0.5rem; }
.sheet .meta { margin-bottom: 1.25rem; }
.sheet > p:not([class]) { color: var(--ink-2); }
.aside { margin: 1.25rem 0 0; font-size: 0.875rem; color: var(--ink-3); }

/* ── materiały ───────────────────────────────────────────── */

.path {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem;
  margin: -0.5rem 0 1rem; font-size: 0.875rem; color: var(--ink-3);
}
.path a { color: var(--ink-2); text-decoration: none; }
.path a:hover { color: var(--ink); text-decoration: underline; }
.path [aria-current] { color: var(--ink); font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1.25rem; }
.upload { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.upload .pick { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.upload label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload.js .no-js-only { display: none; }
.upload.busy { opacity: 0.55; pointer-events: none; }
/* „Nowa wersja” stoi obok „Pobierz” — jedno główne działanie na ekranie */
.upload-secondary .btn-primary { background: var(--sheet); border-color: var(--rule-2); color: var(--ink); }
.upload-secondary .btn-primary:hover { background: var(--sheet); border-color: var(--ink-3); color: var(--ink); }

@media (hover: hover) and (pointer: fine) { .touch-only { display: none; } }
@media (hover: none), (pointer: coarse) { .pointer-only { display: none; } }

.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop[open] { flex-basis: 100%; }
.pop-body {
  display: grid; gap: 0.75rem; margin-top: 0.5rem; padding: 1rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
}
.pop-body form { margin: 0; }
.pop-body .inline input { flex: 1; min-width: 0; }

.sending { margin: -0.5rem 0 1.25rem; }
.sending-text { margin: 0 0 0.375rem; font-size: 0.875rem; color: var(--ink-2); overflow-wrap: anywhere; }
.sending progress {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 0.25rem;
  border: 0; border-radius: 2px; background: var(--rule); overflow: hidden;
}
.sending progress::-webkit-progress-bar { background: var(--rule); }
.sending progress::-webkit-progress-value { background: var(--accent); transition: width 0.2s; }
.sending progress::-moz-progress-bar { background: var(--accent); }

.tile-folder { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tile-type { font: 700 0.625rem/1 var(--sans); letter-spacing: 0.04em; color: var(--ink-2); }
.tile-thumb { overflow: hidden; padding: 0; }
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.tile-lg { width: 4.5rem; height: 5.5rem; margin: 0 auto 0.75rem; font-size: 0.875rem; }

.quiet-link { color: var(--ink-3); font-size: 0.875rem; }
.empty-line { color: var(--ink-3); padding: 1rem 0; margin: 0; }

.row-tight { padding-block: 0.625rem; }
.row-title-sm { font: 600 0.9375rem/1.3 var(--sans); }
.row-wrap { flex-wrap: wrap; }
.row-actions { display: flex; gap: 0.25rem; margin-left: auto; }
.row-actions form, .row form { margin: 0; }
.tag-accent { color: var(--accent); border-color: currentColor; }

.viewer { margin: 0 0 1rem; }
.view-image, .view-page {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--rule); border-radius: 6px; background: #fff;
}
.view-image { margin: 0 auto; }
/* zanim strona PDF się wczyta, rezerwujemy miejsce w proporcji A4 */
.view-page { width: 100%; aspect-ratio: auto 1 / 1.414; margin-bottom: 0.75rem; }
.view-media { display: block; width: 100%; border-radius: 6px; background: #000; }
audio.view-media { background: transparent; }
.view-text {
  margin: 0; padding: 1rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 0.875rem/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
}

/* upuszczanie plików na stronę */
body.dropping::after {
  content: "Upuść, żeby dodać";
  position: fixed; inset: 0.75rem; z-index: 50;
  display: grid; place-items: center;
  font: 600 1.25rem/1 var(--serif); color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  border: 2px dashed var(--accent); border-radius: 12px;
  pointer-events: none;
}

/* ── notatki: treść ───────────────────────────────────────── */

.prose { font-size: 1.0625rem; line-height: 1.65; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 0.75em; }
.prose p { margin: 0; }
.prose p:empty { min-height: 1.65em; }
.prose h2 { font: 600 1.375rem/1.25 var(--serif); margin-top: 1.4em; }
.prose h3 { font: 600 1.125rem/1.3 var(--serif); margin-top: 1.2em; }
.prose > h2:first-child, .prose > h3:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0.5em 0 0; padding-left: 1.5em; }
.prose li + li { margin-top: 0.25em; }
.prose li > ul, .prose li > ol { margin-top: 0.25em; }
.prose blockquote {
  margin: 0.75em 0 0; padding: 0.125em 0 0.125em 1rem;
  border-left: 3px solid var(--rule-2); color: var(--ink-2);
}
.prose code {
  font: 0.875em/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--rule); padding: 0.1em 0.35em; border-radius: 4px;
}
.prose pre {
  margin: 0.75em 0 0; padding: 0.875rem 1rem; overflow-x: auto;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px;
}
.prose pre code { background: none; padding: 0; font-size: 0.875rem; line-height: 1.55; }
.prose hr { border: 0; border-top: 1px solid var(--rule-2); margin: 1.5em 0; }
.prose mark { background: color-mix(in srgb, #f2d24b 45%, transparent); color: inherit; padding: 0 0.1em; border-radius: 2px; }
.prose a { overflow-wrap: anywhere; }

/* listy zadań: w treści (render serwera) i w edytorze (Tiptap) */
.prose ul.tasks, .prose ul[data-type="taskList"] { list-style: none; padding-left: 0.25em; }
.prose li.task, .prose ul[data-type="taskList"] > li { display: flex; gap: 0.6em; align-items: flex-start; }
.prose li.task > div, .prose ul[data-type="taskList"] > li > div { flex: 1; min-width: 0; }
.prose .check {
  flex: none; width: 1.05em; height: 1.05em; margin-top: 0.3em;
  border: 1.5px solid var(--ink-3); border-radius: 3px;
}
.prose li.task.done > .check { background: var(--accent); border-color: var(--accent); }
.prose li.task.done > .check::after {
  content: ""; display: block; width: 0.32em; height: 0.6em; margin: 0.05em auto 0;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.prose li.task.done > div, .prose ul[data-type="taskList"] > li[data-checked="true"] > div { color: var(--ink-3); text-decoration: line-through; }
.prose ul[data-type="taskList"] > li > label { flex: none; margin-top: 0.2em; }
.prose ul[data-type="taskList"] input[type="checkbox"] { width: 1.05em; height: 1.05em; min-height: 0; accent-color: var(--accent); }

.note-body { margin: 0.25rem 0 1.5rem; }
.sharing { margin-top: 1rem; }
.choice { display: flex; gap: 0.625rem; align-items: baseline; font-size: 0.9375rem; cursor: pointer; }
.choice input { width: auto; min-height: 0; accent-color: var(--accent); }
.tile-note { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ── notatki: edytor ──────────────────────────────────────── */

.editor-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: -0.5rem 0 0.75rem; }
.editor-done { padding-left: 0.25rem; }
.save-state { font-size: 0.8125rem; color: var(--ink-3); text-align: right; }
.save-state[data-kind="ok"] { color: var(--ok); }
.save-state[data-kind="warn"] { color: var(--ink); }
.save-state[data-kind="error"] { color: var(--danger); }

.note-title {
  display: block; width: 100%; min-height: 0; padding: 0.25rem 0; margin-bottom: 0.5rem;
  resize: none; overflow: hidden;
  font: 600 1.75rem/1.2 var(--serif); letter-spacing: -0.012em;
  background: transparent; border: 0; border-radius: 0;
}
.note-title:focus { box-shadow: none; outline: none; }

.editor-bar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 3.5rem); z-index: 5;
  display: flex; gap: 0.125rem; align-items: center; overflow-x: auto; scrollbar-width: none;
  margin: 0 -1rem 1rem; padding: 0.375rem 1rem;
  background: var(--paper); border-block: 1px solid var(--rule);
}
.editor-bar::-webkit-scrollbar { display: none; }
.editor-bar button {
  flex: none; width: 2.5rem; height: 2.5rem; display: grid; place-items: center;
  color: var(--ink-2); background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.editor-bar button:hover { background: var(--rule); color: var(--ink); }
.editor-bar button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.editor-bar button:disabled { opacity: 0.35; cursor: default; background: none; }
.bar-sep { flex: none; width: 1px; height: 1.5rem; margin: 0 0.25rem; background: var(--rule-2); }
.glyph { font-size: 1.0625rem; line-height: 1; }
.glyph-b { font-weight: 800; }
.glyph-i { font: italic 500 1.125rem/1 var(--serif); }
.glyph-h { font: 700 1.125rem/1 var(--serif); }
.glyph-h3 { font: 700 0.875rem/1 var(--serif); }

.editor-body { min-height: 50vh; padding-bottom: 30vh; }
.ProseMirror { outline: none; position: relative; word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; font-variant-ligatures: none; }
.ProseMirror pre { white-space: pre-wrap; }
.ProseMirror li { position: relative; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection { caret-color: transparent; }
.ProseMirror-selectednode { outline: 2px solid var(--accent); }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; }
.ProseMirror-gapcursor::after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--ink); }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); float: left; height: 0; pointer-events: none; color: var(--ink-3);
}

/* ── wybór osób (chipy) ──────────────────────────────────── */

.picker { display: grid; gap: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; list-style: none; margin: 0; padding: 0; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.25rem 0.25rem 0.25rem 0.625rem; font-size: 0.875rem;
  background: var(--accent-soft); border-radius: 999px;
}
.chip small { color: var(--ink-3); }
.chip-x {
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center; padding: 0;
  font-size: 1rem; line-height: 1; color: var(--ink-2); background: none; border: 0; border-radius: 50%; cursor: pointer;
}
.chip-x:hover { background: var(--rule-2); color: var(--ink); }
.picker-box { position: relative; }
.picker-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 0.25rem); z-index: 20;
  list-style: none; margin: 0; padding: 0.25rem; max-height: 16rem; overflow-y: auto;
  background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius);
}
.picker-option { padding: 0.5rem 0.625rem; border-radius: 4px; cursor: pointer; }
.picker-option small { color: var(--ink-3); }
.picker-option.active, .picker-option:hover { background: var(--accent-soft); }

/* ── komentarze ───────────────────────────────────────────── */

.comment-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.comment { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-top: 1px solid var(--rule); }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { margin: 0 0 0.125rem; font-size: 0.875rem; }
.comment-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.comment form { margin: 0; }
.comment-x { width: 2rem; padding: 0; color: var(--ink-3); }
.comment-form { display: flex; gap: 0.5rem; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 2.75rem; }

/* ── historia zmian ───────────────────────────────────────── */

.history { list-style: none; margin: 0; padding: 0; }
.version { padding: 1rem 0; border-top: 1px solid var(--rule); }
.version-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.version-head p { margin: 0; }
.version-head form { margin: 0; }
.version-empty { margin: 0; font-size: 0.875rem; }
.diff {
  font: 0.875rem/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--sheet);
}
.diff-line { padding: 0.0625rem 0.75rem 0.0625rem 1.75rem; position: relative; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-line::before { position: absolute; left: 0.625rem; color: var(--ink-3); }
.diff-ctx { color: var(--ink-3); }
.diff-add { background: var(--ok-soft); color: var(--ink); }
.diff-add::before { content: "+"; color: var(--ok); }
.diff-del { background: var(--danger-soft); color: var(--ink-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.diff-del::before { content: "−"; color: var(--danger); text-decoration: none; }
.diff-gap { padding: 0.125rem 0.75rem; color: var(--ink-3); background: var(--paper); text-align: center; font-family: var(--sans); font-size: 0.8125rem; }

/* ── wyszukiwanie ─────────────────────────────────────────── */

.search-form { display: flex; gap: 0.5rem; margin: 0 0 1.25rem; }
.search-form input { flex: 1; min-width: 0; }
.search-compact { margin: -0.5rem 0 1rem; }
.search-compact input { min-height: 2.5rem; font-size: 0.9375rem; }
.row-top { align-items: flex-start; }
.hit { font-size: 0.875rem; color: var(--ink-2); line-height: 1.45; }
.hit mark { background: color-mix(in srgb, #f2d24b 50%, transparent); color: var(--ink); padding: 0 0.1em; border-radius: 2px; }

/* ── instalacja na telefonie ─────────────────────────────── */

.install { margin-top: 1rem; }
.sheet .install { padding-top: 1rem; border-top: 1px solid var(--rule); }
.install-btn { padding-left: 0; }
.install-btn:hover { background: transparent; color: var(--accent); }
.install-tip { margin: 0; font-size: 0.875rem; color: var(--ink-2); }
.i-inline { width: 1.05em; height: 1.05em; vertical-align: -0.15em; color: var(--accent); }

/* ── konto i admin ───────────────────────────────────────── */

progress.usage {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 0.375rem; margin-bottom: 0.5rem;
  border: 0; border-radius: 3px; background: var(--rule); overflow: hidden;
}
progress.usage::-webkit-progress-bar { background: var(--rule); }
progress.usage::-webkit-progress-value { background: var(--accent); }
progress.usage::-moz-progress-bar { background: var(--accent); }

.stats {
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem;
  margin: 0 0 1rem;
}
.stats p { margin: 0; color: var(--ink-3); }
.stats strong { font: 600 1.5rem/1.2 var(--serif); color: var(--ink); margin-right: 0.125rem; }

.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.log li {
  display: grid; gap: 0.125rem;
  padding: 0.625rem 0; border-bottom: 1px solid var(--rule); font-size: 0.9375rem;
}

@media (max-width: 30rem) {
  h1 { font-size: 1.5rem; }
  .note-title { font-size: 1.5rem; }
  .editor-bar button { width: 2.25rem; }
  .bar-sep { margin: 0 0.125rem; }
  .manage-body { padding-left: 0.25rem; }
}

@media (min-width: 48rem) {
  h1 { font-size: 2rem; }
  .note-title { font-size: 2rem; }
  .page { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
