/* Layout: kůlna jako nástěnka s visačkami — sticky hlavička se záložkami, mřížka visaček, detail v dialogu */
:root {
  --bg: #eceee7;
  --surface: #fbfcf8;
  --surface-2: #dfe4da;
  --ink: #1a221d;
  --muted: #59665d;
  --line: #c6cec0;
  --accent: #2c6a4d;
  --accent-ink: #ffffff;
  --hole: #eceee7;
  --c-zahrada: #4c8436;
  --c-dum: #36689c;
  --c-dilna: #b8611a;
  --c-sport: #9c3765;
  --ok: #2b7a4b;
  --ok-bg: #dcefe2;
  --warn: #8a5b0c;
  --warn-bg: #f5e7c8;
  --bad: #a63333;
  --bad-bg: #f6dcdc;
  --idle-bg: #e4e7e1;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(26, 34, 29, .06), 0 6px 18px -10px rgba(26, 34, 29, .35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131915; --surface: #1b231e; --surface-2: #26302a; --ink: #e2e9e2; --muted: #98a69c;
    --line: #34403a; --accent: #74c49a; --accent-ink: #0d1a12; --hole: #131915;
    --c-zahrada: #8cc674; --c-dum: #86b3e3; --c-dilna: #eb9c58; --c-sport: #e383b0;
    --ok: #86d3a3; --ok-bg: #1f3a2a; --warn: #f0c46d; --warn-bg: #3d3018; --bad: #f19a9a; --bad-bg: #432222; --idle-bg: #2a332d;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131915; --surface: #1b231e; --surface-2: #26302a; --ink: #e2e9e2; --muted: #98a69c;
  --line: #34403a; --accent: #74c49a; --accent-ink: #0d1a12; --hole: #131915;
  --c-zahrada: #8cc674; --c-dum: #86b3e3; --c-dilna: #eb9c58; --c-sport: #e383b0;
  --ok: #86d3a3; --ok-bg: #1f3a2a; --warn: #f0c46d; --warn-bg: #3d3018; --bad: #f19a9a; --bad-bg: #432222; --idle-bg: #2a332d;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Hlavička */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-block: 12px 0; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.brand svg { flex: none; color: var(--accent); }
.brand h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.brand p { margin: 0; color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: 4px; width: 100%; overflow-x: auto; }
.tab { appearance: none; border: 0; background: none; padding: 10px 14px 12px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.badge { font-family: var(--font-mono); font-size: .72rem; background: var(--bad); color: var(--surface); border-radius: 999px; padding: 1px 7px; }

/* Tlačítka a formuláře */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .85rem; }
label .hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 400; font-size: .95rem;
}
textarea { resize: vertical; min-height: 70px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
form.stack, .stack { display: grid; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }

main { padding-block: 24px 64px; }
.view { display: grid; gap: 22px; }

/* Jak to funguje */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 10px; align-items: baseline; color: var(--muted); font-size: .9rem; }
.steps li::before { content: counter(s); font-family: var(--font-mono); font-size: .8rem; color: var(--accent); border: 1px solid var(--accent); border-radius: 50%; width: 22px; height: 22px; display: inline-grid; place-items: center; flex: none; }
.steps b { color: var(--ink); }

/* Filtr */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { appearance: none; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .88rem; display: inline-flex; gap: 6px; align-items: center; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters .search { flex: 1 1 200px; min-width: 0; }
.filters .spacer { flex: 1 1 0; }

/* Visačky */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; } }
.tag { --cat: var(--muted); position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; display: grid; grid-template-rows: auto 1fr; overflow: hidden; text-align: left; padding: 0; transition: transform .15s ease; }
.tag:hover { transform: translateY(-2px) rotate(-.4deg); }
.tag::before { content: ""; position: absolute; top: 10px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--hole); border: 2px solid var(--line); z-index: 1; }
.cat-zahrada { --cat: var(--c-zahrada); } .cat-dum { --cat: var(--c-dum); } .cat-dilna { --cat: var(--c-dilna); } .cat-sport { --cat: var(--c-sport); }
.chip.cat-zahrada .dot, .chip.cat-dum .dot, .chip.cat-dilna .dot, .chip.cat-sport .dot { background: var(--cat); }
.tag-photo { aspect-ratio: 4 / 3; max-width: 100%; background: color-mix(in srgb, var(--cat) 14%, var(--surface)); display: grid; place-items: center; color: var(--cat); border-bottom: 3px solid var(--cat); }
.tag-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag-photo > span { display: grid; place-items: center; width: 100%; height: 100%; }
.tag-photo svg { width: 46%; height: auto; opacity: .85; }
.tag-body { padding: 12px 14px 14px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.tag-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--muted); }
.inv { font-family: var(--font-mono); letter-spacing: .04em; }
.cat-label { color: var(--cat); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.tag h3 { font-size: 1.12rem; font-weight: 600; overflow-wrap: anywhere; }
.owner { font-size: .85rem; color: var(--muted); }

.pill { justify-self: start; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--idle-bg); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.free, .pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.reserved, .pill.requested, .pill.out { background: var(--warn-bg); color: var(--warn); }
.pill.late, .pill.declined { background: var(--bad-bg); color: var(--bad); }

/* Prázdné stavy a hlášky */
.empty { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 20px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty h3 { color: var(--ink); font-size: 1.15rem; }
.empty p { margin: 0; max-width: 46ch; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; font-size: .9rem; }

/* Sekce a seznamy */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.panel h2 { font-size: 1.15rem; display: flex; align-items: baseline; gap: 10px; }
.panel h2 small { font-family: var(--font-body); font-weight: 500; color: var(--muted); font-size: .85rem; }
.list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list .what { flex: 1 1 220px; min-width: 0; display: grid; gap: 2px; }
.list .what b { overflow-wrap: anywhere; }
.list .sub { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.list .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.dates { font-family: var(--font-mono); font-size: .82rem; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.linkish { appearance: none; background: none; border: 0; padding: 0; color: inherit; font-weight: 700; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* Sháním */
.wanted { display: grid; gap: 12px; }
.want { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; }
.want.done { opacity: .6; }
.want h3 { font-size: 1.08rem; font-weight: 600; overflow-wrap: anywhere; }
.want .sub { color: var(--muted); font-size: .85rem; }
.want p { margin: 0; overflow-wrap: anywhere; }
.want .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.offers { font-size: .88rem; color: var(--ok); font-weight: 600; }

/* Dialogy */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(10, 16, 12, .5); }
.dlg { display: grid; gap: 18px; padding: 20px; }
.dlg-head { display: flex; gap: 12px; align-items: start; }
.dlg-head > div { flex: 1; min-width: 0; display: grid; gap: 6px; }
.dlg-head h2 { font-size: 1.5rem; font-weight: 800; overflow-wrap: anywhere; }
.x { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1.2rem; line-height: 1; flex: none; }
.di-photo { border-radius: var(--radius); overflow: hidden; max-height: 300px; display: grid; }
.di-photo img { width: 100%; max-height: 300px; object-fit: cover; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; min-width: 0; white-space: pre-line; }
.section-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.req { background: var(--surface-2); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.req .warn { color: var(--bad); font-size: .88rem; font-weight: 600; }
.owner-tools { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.preview-photo { max-height: 140px; border-radius: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; z-index: 20; max-width: calc(100vw - 32px); }

@media (prefers-reduced-motion: reduce) { .tag { transition: none; } .tag:hover { transform: none; } }

/* ---------- Samostatná aplikace: přihlášení, účet ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding-block: 32px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px 24px; display: grid; gap: 18px; box-shadow: var(--shadow); }
.auth-card .brand { margin: 0; }
.auth-card p.lead { margin: 0; color: var(--muted); }
input[type="email"], input[type="password"] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 400; font-size: .95rem; }
.err { color: var(--bad); font-weight: 600; font-size: .9rem; }
.user-box { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); }
.user-box b { color: var(--ink); }
.invite-link { font-family: var(--font-mono); font-size: .8rem; background: var(--surface-2); border-radius: 6px; padding: 8px 10px; overflow-wrap: anywhere; user-select: all; }
.admin-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }

/* Základ, který v artefaktu dodávala hostitelská stránka */
html { color-scheme: light; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
