/* =========================================================
   Living – jednoduchý, teplý a responzivní vzhled
   ========================================================= */

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --border: #e7e1d8;
  --border-strong: #d8d0c4;
  --ink: #241f1a;
  --ink-2: #4e463d;
  --muted: #8b8275;
  --brand: #2e6f5e;
  --brand-hover: #275e50;
  --brand-soft: #e4efea;
  --brand-ink: #1f5344;
  --warn: #bf5330;
  --warn-soft: #fbeae3;
  --ok: #2d7d52;
  --ok-soft: #e5f2ea;
  --radius: 15px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(36, 31, 26, .05), 0 5px 16px rgba(36, 31, 26, .05);
  --shadow-lg: 0 2px 6px rgba(36, 31, 26, .07), 0 16px 40px rgba(36, 31, 26, .09);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #1f2124;
    --surface-2: #25272b;
    --border: #32353a;
    --border-strong: #43474d;
    --ink: #ece8e2;
    --ink-2: #c3bdb4;
    --muted: #918a80;
    --brand: #56ab8f;
    --brand-hover: #67bb9e;
    --brand-soft: #22332d;
    --brand-ink: #8fd3ba;
    --warn: #e08a67;
    --warn-soft: #3a2620;
    --ok: #5fb686;
    --ok-soft: #1f3128;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1rem; }
p { margin: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .1em .4em;
  font-size: .88em;
  word-break: break-all;
}

.icon { flex: none; vertical-align: -.15em; }
.text-muted { color: var(--muted); }
.text-warn { color: var(--warn); font-weight: 600; }
.text-brand { color: var(--brand); font-weight: 600; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.req { color: var(--warn); }
.is-hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Horní lišta ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .topbar { background: var(--surface); }
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; color: var(--ink); font-size: 1.02rem; text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--brand-soft); font-size: 18px; flex: none;
}
.brand-mark--big { width: 56px; height: 56px; border-radius: 17px; font-size: 28px; margin: 0 auto 12px; }

.topnav { display: none; gap: 2px; margin-left: auto; }
.topnav-link {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: .93rem; font-weight: 500; text-decoration: none;
}
.topnav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.topnav-link.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topnav + .topbar-right { margin-left: 8px; }
.me {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  color: var(--ink); font-size: .92rem; font-weight: 600; text-decoration: none;
}
.me:hover { background: var(--surface-2); text-decoration: none; }
.me-name { display: none; }

/* ---------- Obsah ---------- */
.wrap {
  max-width: 1120px; margin: 0 auto;
  padding: 18px 16px calc(84px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px;
}
body.guest .wrap { padding-bottom: 40px; min-height: 100vh; justify-content: center; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}

.cols { display: grid; gap: 18px; }
/* Bez min-width:0 by dlouhý obsah (adresa, příkaz) roztlačil sloupec do šířky. */
.cols > *, .wrap > * { min-width: 0; }

/* ---------- Karty ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card--warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.card--form { max-width: 640px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--brand); }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---------- Tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: .94rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--small { padding: 7px 12px; font-size: .87rem; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .95rem; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn--danger:hover { background: var(--warn-soft); color: var(--warn); }

.link-more {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .9rem; font-weight: 600;
}
.link-more:hover { text-decoration: none; }

/* ---------- Odznáčky ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .77rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.chip--warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip--ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip--brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }

/* ---------- Hlášky ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px 11px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); font-size: .94rem;
}
.flash--success { background: var(--ok-soft); border-color: transparent; color: var(--ok); font-weight: 600; }
.flash--error { background: var(--warn-soft); border-color: transparent; color: var(--warn); font-weight: 600; }
.flash--info { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.flash-close {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  opacity: .6; padding: 2px; line-height: 0;
}
.flash-close:hover { opacity: 1; }

.notice {
  padding: 12px 15px; border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--brand-ink);
  font-size: .92rem; line-height: 1.55;
}
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice .icon { vertical-align: -.2em; margin-right: 4px; }

.empty { padding: 22px 8px; text-align: center; color: var(--ink-2); }
.empty p { margin: 0 0 4px; }

.code {
  margin: 12px 0 6px; padding: 13px 15px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .84rem; line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  /* dlouhé cesty a adresy se zalomí, ať se vejdou i na mobil */
  white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0;
}

/* ---------- Formuláře ---------- */
.stack { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: .87rem; font-weight: 600; color: var(--ink-2); }
.grid-2 { display: grid; gap: 15px; grid-template-columns: 1fr; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="date"], input[type="time"], input[type="file"], input:not([type]),
select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .96rem;
}
textarea { resize: vertical; min-height: 74px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible,
.checkbox:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type="file"] { padding: 8px; background: var(--surface-2); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 49%, var(--muted) 50%),
                    linear-gradient(-45deg, transparent 49%, var(--muted) 50%);
  background-size: 6px 6px, 6px 6px;
  background-position: right 15px center, right 21px center;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.hint { font-size: .82rem; color: var(--muted); line-height: 1.45; }

.check { display: flex; align-items: center; gap: 9px; font-size: .92rem; cursor: pointer; }
.check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; margin: 0; }
.check--box {
  align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.check--box span { display: flex; flex-direction: column; gap: 2px; }
.check--box small { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.switches { display: flex; flex-wrap: wrap; gap: 8px 22px; }

.fieldset {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px;
}
.fieldset legend {
  padding: 0 6px; font-size: .87rem; font-weight: 700; color: var(--ink-2);
}
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.people-picker { display: grid; gap: 8px; grid-template-columns: 1fr; }
.person-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; font-size: .93rem;
}
.person-option span { display: flex; align-items: center; gap: 8px; }
.person-option input { accent-color: var(--brand); width: 17px; height: 17px; margin: 0; flex: none; }
.person-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.repeat-block {
  display: flex; flex-direction: column; gap: 15px;
  padding: 15px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2);
}

/* ---------- Přihlášení / registrace ---------- */
.auth { display: flex; justify-content: center; padding: 12px 0 30px; }
.auth-card { width: 100%; max-width: 430px; box-shadow: var(--shadow-lg); padding: 26px; }
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head h1 { font-size: 1.4rem; margin-bottom: 5px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: .92rem; color: var(--muted); }

/* ---------- Avatary ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; object-fit: cover;
  background: var(--surface-2); color: #fff;
  font-weight: 700; letter-spacing: .01em; text-transform: uppercase;
  vertical-align: middle;
}
.avatar--initials[data-hue="0"] { background: #3d7d63; }
.avatar--initials[data-hue="1"] { background: #b96a44; }
.avatar--initials[data-hue="2"] { background: #4a6f9c; }
.avatar--initials[data-hue="3"] { background: #8a5f9e; }
.avatar--initials[data-hue="4"] { background: #a4753a; }
.avatar--initials[data-hue="5"] { background: #4f7f8c; }
.avatar--empty { background: var(--border); color: var(--muted); }
.avatar-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar-row .field { flex: 1 1 220px; }

/* ---------- Info boxík ---------- */
.info-card { border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); }
.info-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.info-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.info-item--highlight {
  background: var(--brand-soft); border-color: transparent;
  grid-column: 1 / -1;
}
.info-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.info-item--highlight .info-label { color: var(--brand-ink); opacity: .8; }
.info-value {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 1.16rem; font-weight: 700; color: var(--ink);
  word-break: break-word;
}
.info-item--highlight .info-value { font-size: 1.4rem; color: var(--brand-ink); }
.info-note { font-size: .87rem; color: var(--muted); line-height: 1.5; }
.info-item--highlight .info-note { color: var(--brand-ink); opacity: .85; }
.copy-btn {
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 8px; cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--muted); }
.copy-btn.is-copied { color: var(--ok); border-color: var(--ok); }

.editor { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.editor > summary {
  display: flex; align-items: center; gap: 7px;
  font-size: .9rem; font-weight: 600; color: var(--brand);
  cursor: pointer; list-style: none; padding: 4px 0;
}
.editor > summary::-webkit-details-marker { display: none; }
.editor > summary:hover { text-decoration: underline; }
.editor-body { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }
.info-edit-row {
  display: grid; gap: 10px;
  grid-template-columns: 1fr; align-items: end;
  padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.info-edit-row--new { border-style: dashed; border-color: var(--brand); }
.row-title {
  display: flex; align-items: center; gap: 6px;
  font-size: .88rem; font-weight: 700; color: var(--brand);
}
.info-edit-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* ---------- Úkoly ---------- */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.task {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 2px; border-top: 1px solid var(--border);
}
.tasks .task:first-child { border-top: 0; padding-top: 2px; }
.task-check { display: flex; flex: none; padding-top: 1px; }
.checkbox {
  display: grid; place-items: center; flex: none;
  width: 23px; height: 23px; padding: 0;
  border: 1.8px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: #fff; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.checkbox:hover { border-color: var(--brand); }
.task--done .checkbox { background: var(--brand); border-color: var(--brand); }
.task--overdue .checkbox { border-color: var(--warn); }
.task-body { flex: 1; min-width: 0; }
.task-title {
  font-weight: 600; font-size: .98rem; line-height: 1.35; word-break: break-word;
}
.task--done .task-title { color: var(--muted); text-decoration: line-through; }
.task-repeat { display: inline-flex; color: var(--muted); margin-left: 5px; vertical-align: -.15em; }
.task-meta {
  display: flex; align-items: center; gap: 5px 13px; flex-wrap: wrap;
  margin-top: 3px; font-size: .84rem; color: var(--muted);
}
.task-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.task-note {
  margin-top: 5px; font-size: .88rem; color: var(--ink-2); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.task-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.tasks--compact .task-actions { display: none; }

/* ---------- Kalendář ---------- */
.month-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.month-title { flex: none; min-width: 150px; text-align: center; font-size: 1.12rem; }
.today-btn { margin-left: 4px; }
.month-bar .filter { margin-left: auto; }
.month-bar select { min-width: 140px; padding: 7px 34px 7px 11px; font-size: .89rem; }

.calendar { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head {
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cal-head > div {
  padding: 7px 4px; text-align: center;
  font-size: .76rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.cal-week + .cal-week { border-top: 1px solid var(--border); }
.cal-day {
  min-height: 52px; padding: 4px; display: flex; flex-direction: column; gap: 3px;
  border-left: 1px solid var(--border); background: var(--surface);
}
.cal-day:first-child { border-left: 0; }
.cal-day.is-weekend { background: var(--surface-2); }
.cal-day.is-outside { background: var(--bg); }
.cal-day.is-outside .cal-daynum { color: var(--muted); opacity: .55; }
.cal-day.is-today { background: var(--brand-soft); }
.cal-daynum {
  align-self: flex-start; min-width: 22px; padding: 1px 5px;
  border-radius: 7px; font-size: .8rem; font-weight: 600;
  color: var(--ink-2); text-align: center; text-decoration: none;
}
.cal-daynum:hover { background: var(--surface); color: var(--brand); text-decoration: none; box-shadow: var(--shadow); }
.cal-day.is-today .cal-daynum { background: var(--brand); color: #fff; }

.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 2px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.dot[data-hue="1"] { background: #b96a44; }
.dot[data-hue="2"] { background: #4a6f9c; }
.dot[data-hue="3"] { background: #8a5f9e; }
.dot[data-hue="4"] { background: #a4753a; }
.dot[data-hue="5"] { background: #4f7f8c; }
.dot--done { background: var(--border-strong); }
.dot--overdue { background: var(--warn); }

.cal-items { display: none; flex-direction: column; gap: 2px; }
.cal-item {
  display: block; padding: 2px 5px; border-radius: 5px;
  background: var(--brand-soft); color: var(--brand-ink);
  font-size: .74rem; line-height: 1.35; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
}
.cal-item:hover { text-decoration: none; filter: brightness(.96); }
.cal-item b { font-weight: 700; }
.cal-item.is-done { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.cal-item.is-overdue { background: var(--warn-soft); color: var(--warn); }
.cal-more { font-size: .7rem; color: var(--muted); padding-left: 5px; }

.calendar-hint { margin-top: 10px; text-align: center; }

/* ---------- Opakující se úkoly ---------- */
.series-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.series {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px 2px; border-top: 1px solid var(--border);
}
.series-list .series:first-child { border-top: 0; padding-top: 2px; }
.series--stopped { opacity: .6; }
.series-main { flex: 1 1 260px; min-width: 0; }
.series-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.series-meta {
  display: flex; gap: 5px 13px; flex-wrap: wrap;
  margin-top: 3px; font-size: .84rem; color: var(--muted);
}
.series-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.series-people { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.person-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .84rem; font-weight: 500;
}
.series-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Vývěska ---------- */
.composer > summary {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--brand); cursor: pointer;
  list-style: none; padding: 2px 0;
}
.composer > summary::-webkit-details-marker { display: none; }
.composer[open] > summary { margin-bottom: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

.posts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.posts--compact { gap: 16px; }
.post-head { display: flex; align-items: flex-start; gap: 11px; }
.post-head-text { flex: 1; min-width: 0; }
.post-head h2, .post-head h3 { font-size: 1.03rem; word-break: break-word; }
.pin-mark { color: var(--brand); margin-right: 3px; }
.post-actions { display: flex; gap: 2px; flex: none; }
.post-body {
  margin-top: 11px; font-size: .96rem; line-height: 1.6; color: var(--ink-2);
  word-break: break-word;
}
.posts--compact .post { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.posts--compact .post:last-child { padding-bottom: 0; border-bottom: 0; }
.posts--compact .post-body {
  margin-top: 7px; font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Dokumenty ---------- */
.docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.doc {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-top: 1px solid var(--border);
}
.docs .doc:first-child { border-top: 0; padding-top: 2px; }
.doc-ext {
  display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .66rem; font-weight: 800; text-transform: uppercase;
  color: var(--muted); letter-spacing: .02em; overflow: hidden;
}
.doc-ext[data-ext="pdf"] { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.doc-ext[data-ext="doc"], .doc-ext[data-ext="docx"] { background: #e6edf7; color: #3b5f96; border-color: transparent; }
.doc-ext[data-ext="xls"], .doc-ext[data-ext="xlsx"], .doc-ext[data-ext="csv"] { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.doc-ext[data-ext="jpg"], .doc-ext[data-ext="jpeg"], .doc-ext[data-ext="png"],
.doc-ext[data-ext="webp"], .doc-ext[data-ext="heic"] { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.doc-body { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; color: var(--ink); word-break: break-word; }
.doc-title:hover { color: var(--brand); }
.doc-desc { font-size: .89rem; color: var(--ink-2); margin-top: 2px; }
.doc-meta { margin-top: 2px; }
.doc-actions { display: flex; gap: 2px; flex: none; }

/* ---------- Lidé ---------- */
.people-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.person-card { display: flex; flex-direction: column; gap: 13px; }
.person-top { display: flex; align-items: center; gap: 14px; }
.person-top h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.person-contact { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.person-contact li {
  display: flex; align-items: center; gap: 9px; font-size: .92rem;
  color: var(--ink-2); word-break: break-all;
}
.person-contact .icon { color: var(--muted); }
.person-stats {
  display: flex; gap: 18px; padding-top: 12px;
  border-top: 1px solid var(--border); font-size: .86rem; color: var(--muted);
}
.person-stats strong { color: var(--ink); font-size: 1rem; }
.person-admin { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Rychlé odkazy ---------- */
.quick-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.quick {
  display: flex; align-items: center; gap: 13px;
  padding: 15px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none;
}
.quick:hover { text-decoration: none; border-color: var(--brand); }
.quick .icon { color: var(--brand); }
.quick span { display: flex; flex-direction: column; }
.quick small { color: var(--muted); font-size: .84rem; }

/* ---------- Tabulky a přehledy ---------- */
/* Na mobilu popisek nad hodnotou, na širších displejích dva sloupce –
   jinak by dlouhé hodnoty (např. adresa) roztlačily stránku do šířky. */
.kv { display: grid; grid-template-columns: 1fr; gap: 10px 16px; margin: 0; font-size: .93rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.kv dt + dd { margin-top: -8px; }
@media (min-width: 560px) {
  .kv { grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 8px 16px; }
  .kv dt + dd { margin-top: 0; }
}
.table-scroll { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.table th, .table td {
  padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }

/* ---------- Spodní navigace (mobil) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .tabbar { background: var(--surface); }
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 2px; border-radius: 10px;
  color: var(--muted); font-size: .68rem; font-weight: 600; text-decoration: none;
}
.tab:hover, .tab:focus { text-decoration: none; }
.tab.is-active { color: var(--brand); }

/* =========================================================
   Responzivní zlomy
   ========================================================= */
@media (min-width: 560px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .people-picker { grid-template-columns: 1fr 1fr; }
  .info-edit-row { grid-template-columns: 1fr 1fr auto; }
  .info-edit-row .check, .info-edit-row .text-muted { grid-column: 1 / -1; }
}

@media (min-width: 760px) {
  h1 { font-size: 1.75rem; }
  .wrap { padding: 24px 22px 40px; gap: 20px; }
  .card { padding: 21px; }
  .cal-day { min-height: 96px; }
  /* na přehledu stačí nižší řádky – prázdné týdny pak nezabírají místo */
  .calendar--compact .cal-day { min-height: 66px; }
  .cal-items { display: flex; }
  .cal-dots { display: none; }
  .people-grid { grid-template-columns: 1fr 1fr; }
  .tabbar { display: none; }
  .tasks--compact .task-actions { display: flex; }
}

@media (min-width: 900px) {
  .topnav { display: flex; }
  .me-name { display: inline; }
  .cols { grid-template-columns: 1fr 1fr; align-items: start; }
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .info-item--highlight { grid-column: span 2; }
}

@media (min-width: 1100px) {
  .people-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
