/* Stavba – vzhled podle docs/nahled.html. Tokeny ze SPEC kap. 1, odvozené odstíny jen kvůli kontrastu ≥ 4,5 : 1. */

:root {
  color-scheme: light dark;
  --paper: #f3f1ec;
  --card: #ffffff;
  --ink: #1d2126;
  --muted: #666b71;         /* #6a6f75 ze SPEC – o chlup tmavší kvůli kontrastu na papíře */
  --line: #e3dfd6;
  --line-strong: #d0c9bc;
  --accent: #d8612a;        /* výplně, pruhy, fokus */
  --accent-soft: #fbe9df;
  --accent-btn: #c25521;    /* pozadí tlačítek s bílým textem (4,55 : 1) */
  --accent-ink: #ad4c1d;    /* oranžový text na papíře i kartě */
  --chip-on-ink: #9c3f12;
  --ok: #2c8a56;
  --ok-soft: #e3f3ea;
  --ok-btn: #2a8152;
  --ok-ink: #1f6e43;
  --warn: #b9800f;
  --warn-soft: #fbf1db;
  --warn-ink: #8a5d06;
  --bad: #c2402c;
  --bad-soft: #fae5e1;
  --bad-ink: #a8331f;
  --bad-strong: #8f2a1b;
  --info: #2f6db0;
  --info-soft: #e4eef9;
  --info-ink: #2f6db0;
  --gray-soft: #eeebe5;
  --gray-ink: #5d6268;
  --track: #ece8e0;
  --seg: #e6e1d7;
  --bar-neutral: #8a7e6c;
  --input: #fbfaf7;
  --tabbar-bg: rgba(255, 255, 255, .92);
  --overlay: rgba(22, 25, 29, .45);
  --shadow: 0 1px 0 rgba(0, 0, 0, .04);
  --shadow-lift: 0 10px 30px rgba(29, 33, 38, .16);
  --focus: 0 0 0 3px var(--paper), 0 0 0 5px var(--accent);
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --col: 640px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181b;
    --card: #202327;
    --ink: #ecebe8;
    --muted: #a4a8ae;
    --line: #33373c;
    --line-strong: #464b51;
    --accent: #e5713a;
    --accent-soft: #3a2418;
    --accent-btn: #c25521;
    --accent-ink: #ef8a57;
    --chip-on-ink: #f2a57f;
    --ok: #3fa56c;
    --ok-soft: #1d3328;
    --ok-btn: #2a8152;
    --ok-ink: #6cc896;
    --warn: #d19a2a;
    --warn-soft: #3a2f15;
    --warn-ink: #e6b450;
    --bad: #d9553f;
    --bad-soft: #3d1f1a;
    --bad-ink: #f08a78;
    --bad-strong: #f6a596;
    --info: #4f8fd6;
    --info-soft: #1b2a3d;
    --info-ink: #8ab6ea;
    --gray-soft: #2c3035;
    --gray-ink: #b8bcc1;
    --track: #2e3237;
    --seg: #34393f;
    --bar-neutral: #a89a85;
    --input: #1a1d20;
    --tabbar-bg: rgba(32, 35, 39, .94);
    --overlay: rgba(0, 0, 0, .6);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3);
    --shadow-lift: 0 10px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  background: var(--paper); color: var(--ink); font: 15px/1.4 var(--font); min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; }
ul, ol { list-style: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.title:focus-visible, main:focus-visible, h2:focus-visible, [tabindex="-1"]:focus-visible { outline: none; }

/* ---------------------------------------------------------------- rozvržení */

#layout { max-width: var(--col); margin: 0 auto; padding: calc(10px + var(--safe-t)) 16px calc(var(--tabbar-h) + 28px + var(--safe-b)); }
.logged-out #layout { padding-bottom: 32px; }
#main, #detail { min-width: 0; }
.screen { display: flex; flex-direction: column; gap: 12px; }
.fade-in { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.boot { min-height: 60vh; display: grid; place-items: center; opacity: .5; }
.boot img { border-radius: 14px; }
body.has-banner #layout { padding-top: calc(48px + var(--safe-t)); }

@media (min-width: 1100px) {
  #layout.split {
    max-width: 1240px; display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 28px;
    padding-bottom: 0; align-items: start;
  }
  #layout.split #main, #layout.split #detail {
    height: calc(100dvh - var(--tabbar-h) - var(--safe-b) - 10px); overflow-y: auto; overscroll-behavior: contain;
    padding: 0 4px 28px; scrollbar-gutter: stable;
  }
  #layout.split #detail { border-left: 1px solid var(--line); padding-left: 28px; }
  body.has-banner #layout.split #main, body.has-banner #layout.split #detail { height: calc(100dvh - var(--tabbar-h) - var(--safe-b) - 48px); }
  .detail-empty { min-height: 60vh; display: grid; place-items: center; }
}

/* ---------------------------------------------------------------- banner, toasty */

.banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) 16px 8px; font-size: 14px; font-weight: 600; min-height: 40px;
}
.banner.offline { background: var(--ink); color: var(--paper); }
.banner.pending { background: var(--warn-soft); color: var(--warn-ink); border-bottom: 1px solid var(--line); }
.banner-btn { font-weight: 700; text-decoration: underline; min-height: 44px; min-width: 44px; padding: 0 8px; margin: -8px 0; color: inherit; }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.logged-out ~ #toasts { bottom: 24px; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 560px; width: max-content; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast.bad svg { color: #ff9c8a; }
.toast.ok svg { color: #7fd6a3; }
.toast.warn svg { color: #f1c56b; }

/* ---------------------------------------------------------------- spodní lišta */

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--tabbar-bg); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); padding-bottom: var(--safe-b);
}
.tabbar-inner { max-width: var(--col); margin: 0 auto; display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); }
#layout.split ~ #tabbar .tabbar-inner { max-width: 760px; }
.tab {
  min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; position: relative;
}
.tab .tab-ic { position: relative; }
.tab.on { color: var(--accent-ink); font-weight: 700; }
.tab.on .icon { stroke-width: 2.4; }
.tab:focus-visible { outline-offset: -4px; }
.dot-badge { position: absolute; top: -2px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--card); }

/* ---------------------------------------------------------------- hlavička obrazovky */

.screen-head { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.back {
  display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; min-height: 44px; margin-left: -6px; padding-right: 10px;
  color: var(--accent-ink); font-weight: 600; font-size: 15.5px;
}
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.hello-text { min-width: 0; }
.kicker { color: var(--muted); font-size: 13.5px; min-height: 18px; }
.title { font-size: 26px; line-height: 1.15; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.head-actions { display: flex; gap: 8px; flex: none; }

/* ---------------------------------------------------------------- karty */

.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; min-height: 22px; }
.card-head .btn.small { margin: -8px -6px -8px 0; }
.card-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.card-count { font-size: 13px; font-weight: 700; color: var(--accent-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-accent { color: var(--accent-ink); }
.t-ok { color: var(--ok-ink); }
.t-warn { color: var(--warn-ink); }
.t-bad { color: var(--bad-ink); }
.t-info { color: var(--info-ink); }
.t-muted { color: var(--muted); }
.card-link {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 8px -14px -14px; padding: 0 14px;
  border-top: 1px solid var(--line); font-weight: 600; font-size: 14.5px; color: var(--accent-ink); border-radius: 0 0 var(--radius) var(--radius);
}
.card-link:hover { background: var(--accent-soft); }

.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two > * { min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.strong { font-weight: 700; }
.center { text-align: center; }
.mt { margin-top: 10px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.num, .amount { font-variant-numeric: tabular-nums; }
.big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.section-title { font-size: 18px; margin-top: 6px; }
.form-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }

/* ---------------------------------------------------------------- štítky */

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.35; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill.info { background: var(--info-soft); color: var(--info-ink); }
.pill.gray { background: var(--gray-soft); color: var(--gray-ink); }
.pill.tiny { font-size: 11px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }

/* ---------------------------------------------------------------- tlačítka */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 16px; border-radius: 16px;
  font-weight: 700; font-size: 16px; line-height: 1.2; text-decoration: none; text-align: center; transition: transform .06s, background-color .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.985); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 44px; padding: 8px 12px; font-size: 14px; border-radius: 12px; gap: 6px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn[aria-busy="true"] { opacity: .75; cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.primary { background: var(--accent-btn); color: #fff; }
.btn.primary:hover { background: #b24c1c; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn.secondary:hover { border-color: var(--line-strong); }
.btn.ok { background: var(--ok-btn); color: #fff; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger-outline { background: var(--card); color: var(--bad-ink); border: 1.5px solid #ead1cb; }
.btn.ghost { background: transparent; color: var(--accent-ink); }
.btn.ghost:hover, .btn.ghost-danger:hover { background: var(--gray-soft); }
.btn.ghost-danger { background: transparent; color: var(--bad-ink); }
.btn.link { background: none; padding: 0 2px; min-height: 44px; color: var(--accent-ink); font-size: 14px; font-weight: 700; justify-content: flex-start; }
.btn.link.done { color: var(--ok-ink); }
.btn.dashed { background: var(--input); color: var(--accent-ink); border: 2px dashed var(--line-strong); min-height: 64px; }
.btn.big-sec { min-height: 54px; font-size: 16.5px; }
.btn-lg { min-height: 56px; font-size: 17px; }
.btn.main { flex-direction: row; gap: 12px; min-height: 66px; border-radius: 16px; padding: 12px 18px; }
.btn.main .btn-text { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.btn.main .btn-label { font-size: 17.5px; }
.btn small { font-weight: 500; font-size: 13px; opacity: .95; }
.btn.has-sub .btn-text { display: flex; flex-direction: column; align-items: center; }
.btn.main.sent { background: var(--ok-btn); }
.btn.main.queued { background: var(--warn-soft); color: var(--warn-ink); border: 1.5px solid #ecd9a8; }
.icon-btn { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: 12px; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--gray-soft); color: var(--ink); }
.icon-btn.small { min-width: 44px; min-height: 44px; }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.file-btn { cursor: pointer; position: relative; }
.file-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.stack-sm > .row-actions > .btn.ghost:first-child { margin-left: -12px; }
.amount-card .notice { margin-top: 12px; }
.row-actions.col { flex-direction: column; align-items: stretch; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }

/* ---------------------------------------------------------------- prázdné stavy, kostra */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 8px; }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 4px; }
.empty-title { font-weight: 700; font-size: 16px; }
.empty-text { color: var(--muted); font-size: 14px; max-width: 34ch; }
.empty .btn { margin-top: 8px; }
.empty-icon.bad { background: var(--bad-soft); color: var(--bad-ink); }

.skeleton { display: flex; flex-direction: column; gap: 12px; }
.sk-line, .sk-card { background: linear-gradient(90deg, var(--track) 0, var(--seg) 40%, var(--track) 80%); background-size: 600px 100%; animation: shimmer 1.2s infinite linear; border-radius: 8px; }
.sk-line { height: 14px; }
.sk-line.big { height: 28px; }
.sk-line.w40 { width: 40%; }
.sk-line.w70 { width: 70%; }
.sk-card { border-radius: var(--radius); }
@keyframes shimmer { from { background-position: -300px 0; } to { background-position: 300px 0; } }

/* ---------------------------------------------------------------- řádky, klíč–hodnota */

.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.kvs > .kv:first-child, .kv:first-child { border-top: 0; padding-top: 2px; }
.kv-k { color: var(--ink); }
.kv-v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv-v.muted { color: var(--muted); font-weight: 500; }
.kv.strong { font-weight: 700; }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 0; border-top: 1px solid var(--line);
  color: var(--ink); text-align: left; text-decoration: none;
}
.rows > .row:first-child, .card > .row:first-of-type { border-top: 0; }
button.row:hover, a.row:hover { background: linear-gradient(90deg, transparent, var(--gray-soft) 12%, var(--gray-soft) 88%, transparent); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main b { font-weight: 600; overflow-wrap: anywhere; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.row-side .amount, .row > .amount { font-weight: 700; }
.row-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--gray-soft); display: grid; place-items: center; color: var(--muted); flex: none; }
.line1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.amount.strong { font-weight: 700; }

/* ---------------------------------------------------------------- pruhy */

.bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin: 8px 0 6px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.bar.ok > div { background: var(--ok); }
.bar.bad > div { background: var(--bad); }
.bar.neutral > div { background: var(--bar-neutral); }

.phases { display: flex; gap: 4px; margin: 6px 0 2px; }
.phases div { flex: 1; height: 6px; border-radius: 3px; background: var(--seg); }
.phases .d { background: var(--ok); }
.phases .c { background: var(--accent); }

.cats { display: flex; flex-direction: column; gap: 8px; }
.cat { display: grid; grid-template-columns: minmax(84px, 118px) 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.cat-name { overflow-wrap: anywhere; }
.cat-bar { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.cat-bar div { height: 100%; background: var(--bar-neutral); border-radius: 5px; }
.cat-bar.over div { background: var(--bad); }
.cat-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-val small { font-weight: 500; color: var(--muted); }

.sharebar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; font-size: 12px; font-weight: 700; color: #fff; }
.sharebar div { display: grid; place-items: center; min-width: 0; padding: 0 4px; }
.sharebar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------------------------------------------------------------- kroky fází */

.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 12px; }
.step::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.step:last-child { padding-bottom: 0; }
.step:last-child::before { display: none; }
.step .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--card); flex: none; z-index: 1; margin-top: 1px; }
.step.d .dot { background: var(--ok); border-color: var(--ok); position: relative; }
.step.d .dot::after { content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.step.d::before { background: var(--ok); opacity: .35; }
.step.n .dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-body { display: flex; flex-direction: column; gap: 1px; min-height: 24px; flex: 1; min-width: 0; }
button.step-body { min-height: 44px; margin-top: -10px; padding-top: 10px; border-radius: 8px; }
.step b { font-size: 15px; font-weight: 600; }
.step.n b { font-weight: 800; }
.step:not(.d):not(.n) b { color: var(--muted); font-weight: 600; }
.step .when { font-size: 13px; color: var(--muted); }
.step .when.note { font-style: italic; }

/* ---------------------------------------------------------------- úkoly */

.task { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); min-height: 52px; }
.card > .task:first-of-type, .card-head + .task, .stack > .task:first-child, div > .task:first-child { border-top: 0; }
.box-wrap { position: relative; width: 44px; height: 44px; flex: none; margin: -2px -10px 0 -11px; display: grid; place-items: center; }
.box-wrap .box { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.box-ui { width: 24px; height: 24px; border: 2px solid #b9b3a8; border-radius: 7px; background: var(--card); position: relative; transition: background .15s, border-color .15s; }
.box:checked + .box-ui { background: var(--ok); border-color: var(--ok); }
.box:checked + .box-ui::after { content: ""; position: absolute; left: 6.5px; top: 2.5px; width: 5px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.box:focus-visible + .box-ui { box-shadow: var(--focus); }
.box:disabled { cursor: default; }
.task .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 9px 0 6px; cursor: pointer; }
.task .t b { font-weight: 600; overflow-wrap: anywhere; }
.task.done .t b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.task .icon-btn { margin: 2px -10px 0 0; }
.task .pill.tiny { align-self: flex-start; margin: 4px 0 0; }
.done-groups { padding: 0; }
.done-groups summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 14px; font-weight: 700; cursor: pointer; color: var(--muted); font-size: 14px; }
.done-groups summary::-webkit-details-marker { display: none; }
.done-groups[open] summary svg { transform: rotate(180deg); }
.group-flat { padding: 4px 14px 12px; border-top: 1px solid var(--line); }
.group-flat .card-head { margin: 10px 0 4px; }

/* ---------------------------------------------------------------- byty v seznamu */

.flats { display: flex; flex-direction: column; }
.flat { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; margin: 0 -14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.flats > .flat:first-child { border-top: 0; padding-top: 2px; }
.flat .line1 b { font-size: 16px; font-weight: 700; }
.flat:hover { background: var(--gray-soft); }
.flat[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.proj { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.proj strong { font-size: 17px; }
.proj-card { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.proj-card:hover { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line); }
.qrow { padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.qrow:first-of-type { border-top: 0; }
.wait-row { min-height: 52px; }
.money-row .row-main { gap: 4px; }

/* ---------------------------------------------------------------- výstrahy a schvalování */

.alert { border-radius: var(--radius); padding: 13px 14px; display: flex; gap: 12px; align-items: flex-start; }
.alert.bad { background: var(--bad-soft); }
.alert.warn { background: var(--warn-soft); }
.alert-dot { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; display: grid; place-items: center; flex: none; margin-top: 2px; }
.alert.bad .alert-dot { background: var(--bad); }
.alert.warn .alert-dot { background: var(--warn); }
.alert-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.alert.bad .alert-body b { color: var(--bad-strong); }
.alert.warn .alert-body b { color: var(--warn-ink); }
.alert-acts { margin: -4px 0 -12px; }

.appr-list { display: flex; flex-direction: column; }
.appr { border-top: 1px solid var(--line); padding: 12px 0 4px; transition: opacity .2s, transform .2s; }
.appr:first-child { border-top: 0; padding-top: 0; }
.appr.leaving { opacity: 0; transform: translateX(24px); }
.appr-top { display: flex; gap: 12px; align-items: flex-start; }
.appr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.appr-title { font-weight: 700; font-size: 15.5px; min-height: 24px; padding: 11px 0; margin: -11px 0; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.appr .amount { font-weight: 700; font-size: 15.5px; white-space: nowrap; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 6px; }

/* ---------------------------------------------------------------- fotky */

.th { position: relative; display: block; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #b9b1a2, #8c8578); flex: none; }
.th img { width: 100%; height: 100%; object-fit: cover; }
.th img.broken { visibility: hidden; }
.th.sm { width: 44px; height: 44px; }
.th.md { width: 56px; height: 56px; }
.th.lg { width: 96px; height: 96px; }
.th-empty { background: var(--gray-soft); color: var(--muted); display: grid; place-items: center; }
.th.add { background: var(--card); border: 2px dashed var(--line-strong); display: grid; place-items: center; color: var(--accent-ink); cursor: pointer; }
.th.add:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.th.busy { display: grid; place-items: center; background: var(--gray-soft); }
.th-open { display: block; width: 100%; height: 100%; }
.th.md:has(.th-del) { overflow: visible; }
.th.md:has(.th-del) img, .th-open { border-radius: 10px; }
.th-del { position: absolute; top: -12px; right: -12px; width: 44px; height: 44px; display: grid; place-items: center; color: #fff; z-index: 2; }
.th-del svg { width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: rgba(29, 33, 38, .78); box-shadow: 0 0 0 2px var(--card); }
.th-more { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); color: #fff; font-weight: 800; font-size: 18px; display: grid; place-items: center; }
button.th { cursor: zoom-in; }
.thumb-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.thumb-grid .th { width: 100%; height: auto; aspect-ratio: 1; }
.rooms { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.photo-hint + .btn.ghost { margin: 4px 0 -8px -12px; }
.room { display: flex; align-items: center; gap: 10px; }
.room .nm { width: 86px; font-weight: 600; font-size: 14px; flex: none; overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; min-width: 0; padding-top: 4px; }

.viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; background: #0d0f11; color: #fff; overflow: hidden; }
.viewer::backdrop { background: #0d0f11; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; padding: calc(6px + var(--safe-t)) 8px 6px 16px; min-height: 56px; }
.viewer-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.viewer-close { min-width: 48px; min-height: 48px; display: grid; place-items: center; color: #fff; border-radius: 50%; }
.viewer-close:hover { background: rgba(255, 255, 255, .12); }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; touch-action: pan-y pinch-zoom; user-select: none; padding: 0 8px; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .15s; -webkit-user-drag: none; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); min-width: 52px; min-height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; }
.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }
.viewer-cap { text-align: center; padding: 10px 16px calc(14px + var(--safe-b)); font-size: 14.5px; color: #e8e8e8; min-height: 48px; }
.viewer :focus-visible { outline-color: #ffb48f; }

/* ---------------------------------------------------------------- formuláře */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fieldset { border: 0; padding: 0; }
.fieldset legend { padding: 0; margin-bottom: 6px; }
.field-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.field-hint { font-size: 13px; color: var(--muted); }
.field-error, .form-error { color: var(--bad-ink); font-size: 14px; font-weight: 600; }
.form-error { background: var(--bad-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
.input {
  width: 100%; min-height: 48px; padding: 11px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--input);
  font-size: 16px; color: var(--ink); appearance: none; -webkit-appearance: none;
}
.input::placeholder { color: var(--muted); opacity: .85; }
.input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[disabled] { opacity: .6; }
.textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 34px;
}
input[type="date"].input, input[type="time"].input { min-height: 48px; }
.row-form { display: flex; gap: 8px; align-items: flex-end; }
.row-form .field { flex: 1; }
.check-row { display: flex; gap: 12px; align-items: center; min-height: 48px; font-weight: 600; cursor: pointer; }
.switch { width: 24px; height: 24px; accent-color: var(--accent-btn); flex: none; }
.amount-wrap { display: flex; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.amount-wrap:focus-within { border-color: var(--accent); }
.amount-input { border: 0; background: transparent; padding: 4px 0; font-size: 40px; font-weight: 800; letter-spacing: -.02em; min-height: 60px; font-variant-numeric: tabular-nums; }
.amount-input:focus-visible { box-shadow: none; }
.amount-cur { font-size: 22px; font-weight: 700; color: var(--muted); }
.receipt-box { display: flex; flex-direction: column; gap: 8px; }
.receipt-preview { display: flex; align-items: center; gap: 14px; }
.receipt-preview .btn { padding-left: 0; justify-content: flex-start; }
.receipt-preview .stack-sm { gap: 0; align-items: flex-start; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14.5px; }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.bad { background: var(--bad-soft); color: var(--bad-ink); }
.notice svg { flex: none; margin-top: 1px; }
.notice ul.plain li + li { margin-top: 4px; }
.note-box { padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.note-box.bad { background: var(--bad-soft); color: var(--bad-ink); }
.note-box.warn { background: var(--warn-soft); color: var(--warn-ink); }
.note-box.internal { background: var(--gray-soft); margin-top: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.note-box.internal .pill { margin: 0; }
.budget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.member-row { display: grid; grid-template-columns: 1.2fr 1.2fr 64px 44px; gap: 6px; align-items: center; }
.member-row .input { min-height: 44px; padding: 8px 10px; font-size: 15px; }
.member-row .select { padding-right: 26px; background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; }

/* čipy */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14.5px; font-weight: 600;
  color: var(--ink); transition: background .12s, border-color .12s;
}
.chip:hover { border-color: var(--line-strong); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--chip-on-ink); }
.chips.small .chip { min-height: 44px; padding: 6px 12px; font-size: 13.5px; }
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.filters .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 2px; scrollbar-width: none; }
.filters .chips::-webkit-scrollbar { display: none; }
.filters .chip { flex: none; }

/* ---------------------------------------------------------------- dialogy */

.sheet {
  margin: auto auto 0; width: 100%; max-width: var(--col); max-height: 92dvh; border: 0; padding: 0; background: var(--card); color: var(--ink);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lift); overflow: hidden;
}
.sheet[open] { animation: up .22s cubic-bezier(.2, .9, .3, 1); display: flex; }
.sheet::backdrop { background: var(--overlay); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-inner { display: flex; flex-direction: column; width: 100%; max-height: 92dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 19px; overflow-wrap: anywhere; }
.sheet-body { padding: 16px 18px calc(18px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sheet-actions-col { margin-top: 4px; }
@media (min-width: 700px) {
  .sheet { margin: auto; border-radius: 22px; max-width: 560px; }
  .sheet.small { max-width: 420px; }
}
.option-list { display: flex; flex-direction: column; gap: 6px; }
.option { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 14px; border: 1.5px solid var(--line); font-weight: 600; }
.option:hover { border-color: var(--line-strong); }
.option.on { border-color: var(--accent); background: var(--accent-soft); }
.option > span:nth-child(2) { flex: 1; }
.option-num { width: 28px; height: 28px; border-radius: 50%; background: var(--gray-soft); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }
.exp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.receipt-big { display: block; width: 100%; max-height: 300px; border-radius: 14px; overflow: hidden; background: var(--gray-soft); }
.receipt-big img { width: 100%; max-height: 300px; object-fit: contain; }
.kvs { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- karta bytu */

.tabs-nav {
  display: flex; gap: 6px; overflow-x: auto; margin: 2px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; position: sticky; top: 0; z-index: 5;
  background: var(--paper);
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-link {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 14.5px;
  color: var(--muted); border: 1.5px solid transparent;
}
.tab-link:hover { color: var(--ink); background: var(--gray-soft); }
.tab-link.on { color: var(--ink); background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.tab-content { min-height: 40vh; }

.report { display: flex; flex-direction: column; gap: 10px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.report-day { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.report-text p + p { margin-top: 4px; }
.report.compact .report-day { font-size: 15px; }
.timeline { display: flex; flex-direction: column; gap: 12px; }

.formula { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.fx-line { display: grid; grid-template-columns: 18px 1fr auto; align-items: baseline; gap: 6px; padding: 6px 0; font-size: 14.5px; }
.fx-line + .fx-line { border-top: 1px dashed var(--line); }
.fx-line.strong { font-weight: 800; border-top: 1.5px solid var(--ink) !important; }
.fx-op { color: var(--muted); font-weight: 700; text-align: center; }
.fx-label small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.fx-val { text-align: right; font-weight: 600; white-space: nowrap; }
.fx-line.strong .fx-val { font-weight: 800; }
.formula hr { border: 0; height: 10px; }
.investor { padding: 12px 0; border-top: 1px solid var(--line); }
.card-head + .investor { border-top: 0; padding-top: 0; }
.investor.mine { background: var(--accent-soft); margin: 0 -14px; padding: 12px 14px; border-radius: 12px; border-top: 0; }
.investor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }

.log { display: flex; flex-direction: column; }
.log-day + .log-day { margin-top: 10px; }
.log-head { font-size: 14px; font-weight: 700; letter-spacing: 0; padding: 8px 0 4px; color: var(--muted); }
.log-item { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.log-item:first-child { border-top: 0; padding-top: 0; }
.log-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; flex: none; }
.log-item.t-ok .log-dot { background: var(--ok); }
.log-item.t-bad .log-dot { background: var(--bad); }
.log-item.t-info .log-dot { background: var(--info); }
.log-item.t-ok, .log-item.t-bad, .log-item.t-info { color: inherit; }

/* investor */
.block-title { font-size: 21px; margin-top: 8px; }
.block-title a { color: var(--ink); display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.project-block + .project-block { margin-top: 18px; }
.done-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 26px 18px; }
.done-card h2 { font-size: 22px; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-bottom: 4px; }
.done-card.ok .done-icon { background: var(--ok-btn); }
.done-card.warn .done-icon { background: var(--warn); }

/* doklady, dokumenty */
.doc-ic { width: 34px; height: 40px; border-radius: 6px; background: var(--gray-soft); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); flex: none; }
.row.doc .row-side { flex-direction: column; align-items: flex-end; }

/* profil */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--chip-on-ink); display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.avatar-btn { position: relative; display: grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: 50%; }
.avatar-btn .dot-badge { top: 0; right: 0; }
.profile { display: flex; gap: 12px; align-items: center; }
.profile .pill { margin-top: 6px; }
.ios-help { background: var(--info-soft); color: var(--ink); border-radius: 14px; padding: 12px 14px; }
.ios-help ol { list-style: decimal; padding-left: 20px; margin-top: 6px; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
.kbd { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); vertical-align: -6px; color: var(--info-ink); }
.with-icon { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.notif .notif-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: flex-start; margin-top: 7px; background: transparent; }
.notif.unread .notif-dot { background: var(--accent); }
.notif.unread b { font-weight: 800; }
.user-row { align-items: flex-start; }
.user-row.disabled { opacity: .65; }

/* přihlášení */
.login { min-height: 80vh; min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; gap: 20px; max-width: 440px; margin: 0 auto; padding: 24px 0; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.login-logo img { border-radius: 16px; box-shadow: var(--shadow-lift); margin-bottom: 8px; }
.login-title { font-size: 32px; }
.login-card { padding: 18px; }
.login-card.center { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px; }
.login-sent { font-size: 22px; }
.sent-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }

/* ---------------------------------------------------------------- širší displeje */

@media (min-width: 700px) {
  .title { font-size: 30px; }
  .tabs-nav { margin: 2px 0 0; padding: 2px 0 4px; gap: 2px; position: static; }
  .tab-link { padding: 0 11px; font-size: 14px; }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  #layout.split .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (prefers-color-scheme: dark) {
  .box-ui { border-color: #6d727a; }
  .btn.danger-outline { border-color: #5a2d26; }
  .btn.main.queued { border-color: #5a4a22; }
  .th { background: linear-gradient(135deg, #4a463f, #37342f); }
  .btn.primary:hover { background: #d0602a; }
}

.card > .thumb-grid:not(:first-child), .card > p + .rows { margin-top: 10px; }
.viewer-acts { display: flex; gap: 4px; }
.viewer-del { color: #ffb4a6; }
.notice.info { background: var(--info-soft); color: var(--info-ink); }
