/* Pilotmedia Účto – styl „Fintech“ (varianta B), denní a noční režim.
   Barvy Pilotmedie: žlutá #FFCC00 (hlavní akce), purpurová (aktivní prvky), modrá #074284 (odkazy ve dne). */

:root {
  --bg: #F3F4F6; --surface: #FFFFFF; --surface2: #F1F3F6; --line: #E2E5EA; --line2: #CDD2D9;
  --text: #0E1116; --muted: #5B6470;
  --accent: #FFCC00; --accent-ink: #111111; --accent-hover: #F2C200;
  --pink: #C8077C; --link: #074284;
  --inv: #0E1116; --inv-ink: #FFFFFF;
  --ok: #0A7D55; --ok-bg: #E3F4EC; --warn: #8A5A00; --warn-bg: #FFF4CC; --err: #B42335; --err-bg: #FDECEE;
  --shadow: 0 1px 2px rgba(14, 17, 22, .05), 0 6px 20px rgba(14, 17, 22, .05);
  --radius: 20px; --radius-s: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="noc"] {
  --bg: #0B0D10; --surface: #15181D; --surface2: #1E222A; --line: #262B33; --line2: #353B45;
  --text: #EDEFF3; --muted: #9AA3AE;
  --accent: #FFCC00; --accent-ink: #111111; --accent-hover: #FFD633;
  --pink: #FF5CB4; --link: #8FB4FF;
  --inv: #EDEFF3; --inv-ink: #0B0D10;
  --ok: #7CE0A8; --ok-bg: #12301F; --warn: #FFD966; --warn-bg: #332A0A; --err: #FF8A9A; --err-bg: #3A1820;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0B0D10; --surface: #15181D; --surface2: #1E222A; --line: #262B33; --line2: #353B45;
    --text: #EDEFF3; --muted: #9AA3AE; --pink: #FF5CB4; --link: #8FB4FF; --inv: #EDEFF3; --inv-ink: #0B0D10;
    --ok: #7CE0A8; --ok-bg: #12301F; --warn: #FFD966; --warn-bg: #332A0A; --err: #FF8A9A; --err-bg: #3A1820;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; transition: background .2s, color .2s;
}
a { color: var(--link); }
h1 { font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 1rem; margin: 0; }
code { font-family: var(--mono); font-size: .85em; background: var(--surface2); padding: 1px 6px; border-radius: 6px; }
.num, .amount, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* ---------- rozvržení ---------- */
main { max-width: 980px; margin: 0 auto; padding: 4px 16px 120px; }
@media (min-width: 820px) { main { padding: 16px 24px 64px; } }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.brand { display: flex; align-items: center; gap: 7px; font-size: 1.45rem; font-weight: 750; letter-spacing: -0.045em;
  color: var(--text); text-decoration: none; }
.brand-dot { width: 9px; height: 9px; border-radius: 2px; background: var(--accent); }
.topnav { display: none; gap: 4px; }
.topnav a { padding: 8px 14px; border-radius: 99px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.topnav a:hover { color: var(--text); background: var(--surface2); }
.topnav a.on { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.top-actions { display: flex; align-items: center; gap: 8px; }
@media (min-width: 820px) { .topnav { display: flex; } .top { padding-inline: 24px; } }

.icon-btn {
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-weight: 650; font-size: .85rem; cursor: pointer;
}
.icon-btn:hover { border-color: var(--line2); }
.ikona-den, .ikona-noc { display: none; }
:root[data-theme="den"] .ikona-noc, :root[data-theme="noc"] .ikona-den { display: block; }

/* spodní lišta (mobil) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-around;
  padding: 8px 8px max(10px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.tabbar a { min-width: 60px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; }
.tabbar a.on { color: var(--text); }
.tabbar a.on::after { content: ""; position: absolute; top: -9px; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--pink); }
.tabbar .fab { min-width: 0; width: 60px; height: 60px; margin-top: -30px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); box-shadow: 0 8px 24px rgba(255, 204, 0, .35); }
.tabbar .fab::after { display: none; }
@media (min-width: 820px) { .tabbar { display: none; } }

/* ---------- prvky ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.narrow { max-width: 440px; margin: 40px auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1 1 140px; }
.row.end { align-items: flex-end; }
.grow { flex: 2 1 200px !important; }
.pad-top { padding-top: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--muted); }
input, select, textarea, button, .btn {
  font: inherit; color: var(--text); background: var(--surface2); border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 10px 12px; min-height: 46px;
}
input, select, textarea { width: 100%; font-weight: 500; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  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% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.short { max-width: 96px; }
textarea { resize: vertical; }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  font-weight: 650; background: var(--surface); border-color: var(--line); }
button:hover, .btn:hover { border-color: var(--line2); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.danger { color: var(--err); background: none; border-color: transparent; align-self: flex-start; }
.big { min-height: 58px; font-size: 1.05rem; border-radius: 16px; }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0; }
.small-btn { min-height: 36px; padding: 6px 12px; font-size: .88rem; align-self: flex-start; border-radius: 10px; }
.link { background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.inline { display: inline; margin: 0; }
.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 1rem; font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--pink); }
details summary { cursor: pointer; color: var(--link); font-weight: 600; }
.with-btn { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.with-btn input { flex: 1 1 120px; min-width: 0; }

/* hlášky */
.ok, .alert, .todo { padding: 11px 14px; border-radius: 14px; margin: 0 0 12px; font-size: .95rem; }
.ok { background: var(--ok-bg); color: var(--ok); }
.alert { background: var(--err-bg); color: var(--err); }
.todo { background: var(--warn-bg); color: var(--warn); }
.ok a, .alert a, .todo a { color: inherit; font-weight: 650; }
.alert-inline { color: var(--err); margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; list-style: none; }

/* ---------- přehled: souhrn ---------- */
.souhrn { display: flex; flex-direction: column; gap: 12px; }
.souhrn-hlava { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); }
.souhrn-castka { font-family: var(--mono); font-size: 2.1rem; font-weight: 500; letter-spacing: -0.04em; line-height: 1.1; }
.souhrn-castka small { font-size: 1.05rem; color: var(--muted); letter-spacing: 0; }
.pruh { display: block; width: 100%; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface2); }
.pruh rect { fill: var(--c, var(--muted)); }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda .vpravo { margin-left: auto; font-family: var(--mono); }

/* ---------- přehled: focení ---------- */
.upload { display: flex; flex-direction: column; gap: 12px; }
.upload.busy { opacity: .85; }
.akce { display: flex; gap: 8px; }
.akce .big { flex: 1; }
.akce .ctverec { width: 58px; min-width: 58px; padding: 0; }
.log { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log .done a { color: var(--ok); }
.log .err { color: var(--err); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .78rem; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chip { display: block; color: var(--text); font-size: .95rem; font-weight: 600; position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 1px solid var(--line2);
  border-radius: 99px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.chip input:checked + span { background: var(--inv); color: var(--inv-ink); border-color: var(--inv); }
.chip input:focus-visible + span { outline: 2px solid var(--pink); outline-offset: 2px; }
.segment { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface2); }
.segment legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.segment .chip { flex: 1; }
.segment .chip span { width: 100%; justify-content: center; min-height: 36px; border: 0; border-radius: 9px; font-size: .88rem; color: var(--muted); }
.segment .chip input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.stav-vytezeni { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--mono);
  font-size: .78rem; color: var(--muted); padding: 0 4px; margin: 0 0 12px; }
.stav-vytezeni span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- filtry ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.filters > * { flex: 1 1 140px; min-width: 0; }
.filters input[type=search] { flex-basis: 100%; }
.filters select, .filters input { min-height: 42px; font-size: .92rem; background-color: var(--surface); border-color: var(--line); }

/* ---------- seznam dokladů ---------- */
.skupina { margin-bottom: 14px; }
.skupina-h { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 4px 8px; }
.skupina-h h2 { font-size: .95rem; font-weight: 700; }
.skupina-h span { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); }
.list > li + li { border-top: 1px solid var(--line); }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; color: inherit; text-decoration: none; }
a.item:hover { background: var(--surface2); }
.thumb { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; background: var(--surface2); display: flex; align-items: center;
  justify-content: center; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.thumb .tecka { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--c);
  border: 2px solid var(--surface); }
.ico { font-size: .66rem; font-weight: 750; color: var(--muted); letter-spacing: .04em; }
.info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.info strong { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info .small { color: var(--muted); }
.amount { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; font-size: .95rem; font-weight: 500; }
.amount em { font-style: normal; font-family: inherit; color: var(--warn); font-size: .85rem; }
.badge { font-family: -apple-system, system-ui, sans-serif; font-size: .7rem; font-weight: 650; padding: 1px 0; color: var(--muted); }
.s-novy { color: var(--warn); }
.s-zkontrolovany, .s-predany { color: var(--ok); }
.v-ceka, .v-zpracovava { color: var(--pink); }
.v-chyba { color: var(--err); }

/* štítky firem */
.c-zelena { --c: #2FB386; } .c-modra { --c: #5B8DEF; } .c-oranzova { --c: #F2994A; } .c-fialova { --c: #A78BFA; }
.c-cervena { --c: #F0647A; } .c-tyrkys { --c: #22B8CF; } .c-hneda { --c: #C08457; } .c-seda { --c: #9AA3AE; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }
.tag { display: inline-block; background: var(--c, var(--accent)); color: #0B0D10; font-weight: 700; font-size: .78rem;
  padding: 3px 10px; border-radius: 99px; white-space: nowrap; max-width: 14em; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.small-tag { font-size: .68rem; padding: 1px 7px; }
h1 .tag { font-size: .85rem; }

/* ---------- detail ---------- */
.back { margin: 4px 0 12px; }
.back a { color: var(--muted); text-decoration: none; font-weight: 600; }
.detail { display: grid; gap: 16px; }
@media (min-width: 820px) { .detail { grid-template-columns: 1fr 1fr; align-items: start; } .preview { position: sticky; top: 80px; } }
.preview figure { margin: 0 0 12px; }
.preview img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.preview iframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.preview figcaption { margin-top: 6px; }
.vytezeni { border: 1px solid var(--line); background: var(--surface2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.vytezeni p { margin: 0; }
.rozpis { border-collapse: collapse; font-size: .88rem; font-family: var(--mono); }
.rozpis th, .rozpis td { padding: 4px 12px 4px 0; text-align: right; border-bottom: 1px solid var(--line); }
.rozpis th { font-family: -apple-system, system-ui, sans-serif; font-weight: 600; color: var(--muted); font-size: .78rem; }
.rozpis th:first-child, .rozpis td:first-child { text-align: left; }
.ocr { white-space: pre-wrap; font-family: var(--mono); font-size: .78rem; max-height: 320px; overflow: auto; background: var(--surface);
  padding: 10px; border-radius: 10px; border: 1px solid var(--line); }
.polozky { margin: 6px 0 0; padding-left: 18px; }

/* ---------- firmy, tokeny, účet ---------- */
.firma, .token { align-items: flex-start; }
.firma.off, .token.off { opacity: .55; }
.firma .info .tag { align-self: flex-start; margin-bottom: 4px; }
.firma .btn { flex: 0 0 auto; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches legend { width: 100%; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid transparent; }
.swatch input:checked + span { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.ok-card { border-color: var(--ok); }
.ok-card input { font-family: var(--mono); font-size: .85rem; }
.menu-ucet { list-style: none; margin: 0; padding: 0; }
.menu-ucet li + li { border-top: 1px solid var(--line); }
.menu-ucet a, .menu-ucet button { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 14px 4px;
  color: var(--text); text-decoration: none; font-weight: 600; background: none; border: 0; border-radius: 0; min-height: 52px; }
.menu-ucet .pozn { color: var(--muted); font-weight: 500; font-size: .85rem; }

/* ---------- přihlášení ---------- */
.prihlaseni { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; }
.prihlaseni .narrow { margin: 0 auto; width: 100%; }
.prihlaseni .brand { font-size: 2.2rem; }
.google { width: 100%; background: #FFFFFF; color: #1F1F1F; border: 1px solid #C7CCD1; margin-top: 4px; }
.google:hover { border-color: #9AA3AE; }
.google svg { flex: 0 0 auto; }
.logo-pm { display: block; height: 22px; width: auto; margin: 22px auto 0; opacity: .9; }
:root[data-theme="den"] .logo-pm { filter: invert(1) brightness(.25); }
.dot-pink { --c: var(--pink); }
.upload p { margin: 0; }

.rezimy button { flex: 1; min-height: 40px; border: 0; background: none; color: var(--muted); border-radius: 9px; font-size: .9rem; }
.rezimy button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
h1.brand { justify-content: flex-start; margin-bottom: 4px; }
/* opravy: .btn jako <label> nesmí převzít sloupcové rozvržení labelu */
.btn { flex-direction: row; }
.akce .ctverec { flex: 0 0 58px; }
.segment { flex-wrap: nowrap; }
.segment .chip { flex: 1 1 0; min-width: 0; }
.segment .chip span { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.stav-vytezeni { justify-content: flex-start; }
.stav-vytezeni .dot { margin-top: 1px; }
.info .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
