/* PaperPilot – skener dokumentů
   Nový tmavý design (Etapa A, 21-7-2026): fialový akcent, sidebar,
   krémový papír skenů zůstává jako kontrastní prvek. */

:root {
  --bg:        #16151b;                       /* pozadí s fialovým nádechem */
  --surface:   #1e1d25;                       /* sidebar, dialogy, karty */
  --card:      #26242e;                       /* pole, vnořené karty */
  --line:      rgba(255,255,255,.08);
  --text:      #eceaf2;
  --muted:     rgba(236,234,242,.55);
  --faint:     rgba(236,234,242,.35);
  --paper:     #f6f3eb;
  --ink:       #1b1b1b;
  --accent:    #8b6cf5;                       /* fialová (na tmavé zesvětlená) */
  --accent-bg: rgba(139,108,245,.16);
  --on-accent: #17141f;                       /* text na fialovém podkladu */
  --danger:    #f0716b;
  --danger-bg: rgba(240,113,107,.12);
  --green:     #4cc38a;
  --radius:    12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

/* Appka je "app shell" bez scrollu na úrovni dokumentu – scrolluje jen
   <main> (a jednotlivá vnitřní okna, co to potřebují). Tohle je hlavní
   pojistka proti známé mobilní chybě: focus na textarea uvnitř position:fixed
   panelu + otevření klávesnice by jinak přinutilo prohlížeč scrollovat celý
   dokument, což s fixed elementy dělá neplechu (obsah "zmizí" nahoře). */
html {
  overflow: hidden;
}
body {
  position: fixed; inset: 0; width: 100%; overflow: hidden;
  display: flex; flex-direction: column;
}

/* ---------- kostra: sidebar + obsah ---------- */

.shell   { flex: 1; display: flex; min-height: 0; }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.sidebar {
  width: 236px; flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  padding-top: calc(22px + env(safe-area-inset-top));
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 6px 20px; background: none; border: none;
  color: var(--text); cursor: pointer; font: inherit; text-align: left;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #8b6cf5, #5a3adf);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }

.account-email {
  padding: 0 6px; margin: 10px 0 0;
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}

.account-inbound {
  padding: 8px 8px 0; margin: 6px 0 0;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); text-align: center;
}
.account-inbound-lbl { display: block; margin-bottom: 2px; }
.account-inbound strong {
  display: block; color: var(--text); font-weight: 600;
  font-size: 11px; word-break: break-all; line-height: 1.4;
}
.account-inbound .btn-copy-email {
  margin-top: 6px; font-size: 11px; padding: 3px 9px;
  border-radius: 6px; border: 1px solid var(--line);
  background: transparent; color: var(--accent); cursor: pointer;
}
.account-inbound .btn-copy-email:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- lišta s dobrovolným příspěvkem ("na kafe") ---------- */
.donate-bar {
  position: fixed; z-index: 60;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  max-width: min(560px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 14px;
  padding: 12px 44px 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  font-size: 13.5px; color: var(--text);
}
.donate-text { flex: 1; line-height: 1.45; }
.donate-btn {
  flex: none;
  background: #c8892b; color: #fff;
  text-decoration: none; font-weight: 700; font-size: 13px;
  padding: 8px 14px; border-radius: 9px; white-space: nowrap;
}
.donate-btn:hover { filter: brightness(1.08); }
.donate-close {
  position: absolute; top: 6px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 4px;
}
.donate-close:hover { color: var(--text); }

@media (max-width: 600px) {
  .donate-bar { flex-direction: column; align-items: stretch; gap: 10px; text-align: center; }
  .donate-btn { text-align: center; }
}

.btn-new-doc {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 11px;
  padding: 12px 14px; font-size: 14px; font-weight: 700;
  cursor: pointer; margin-bottom: 16px; font-family: inherit;
}
.btn-new-doc span { font-size: 16px; line-height: 1; }
.btn-new-doc:hover { filter: brightness(1.08); }
/* Na desktopu appka nabízí přidání dokumentu jen kontextově – plovoucím
   tlačítkem (.fab) viditelným v otevřeném šanonu, ne odsud obecně. */
@media (min-width: 901px) { .btn-new-doc { display: none; } }

.side-nav { display: flex; flex-direction: column; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px; border-radius: 9px; margin-bottom: 2px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-family: inherit;
  font-size: 13.5px; font-weight: 500; text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav-ic { width: 18px; flex: none; display: flex; }
.nav-ic svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.nav-lbl { flex: 1; }
.nav-badge {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--accent);
}

.side-h {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: var(--faint); padding: 18px 10px 8px;
}
.side-grow { flex: 1; }

.gaugebox {
  background: var(--card); border-radius: 12px;
  padding: 10px 12px; margin-top: 14px;
}

.side-backdrop {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(0,0,0,.5);
}

/* ---------- pravý panel: náhled dokumentu (desktop) ---------- */

.preview-panel {
  width: 340px; flex: none;
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 26px 22px;
  padding-top: calc(26px + env(safe-area-inset-top));
  overflow-y: auto;
}
.preview-panel h2 { margin: 0 0 16px; font-size: 15px; font-weight: 700; }

.pv-empty {
  color: var(--faint); font-size: 13px; line-height: 1.6;
  border: 1.5px dashed rgba(255,255,255,.14); border-radius: 12px;
  padding: 26px 16px; text-align: center;
}

.pv-imgwrap {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  max-height: 300px;
}
.pv-imgwrap img { width: 100%; height: auto; max-height: 300px; object-fit: contain; display: block; }

.pv-summary {
  margin-top: 12px; font-size: 12.5px; line-height: 1.55;
  color: var(--muted);
  background: var(--card); border-radius: 8px; padding: 10px 12px;
}

.pv-det-h {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--faint); margin: 18px 0 6px;
}
.pv-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 0;
}
.pv-row .l { font-size: 12.5px; color: var(--muted); flex: none; }
.pv-row .v { font-size: 12.5px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.pv-row .v.tag-p {
  background: var(--accent-bg); color: var(--accent);
  font-weight: 600; padding: 3px 9px; border-radius: 6px;
}
.pv-row .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pv-row .tags span {
  background: rgba(76,195,138,.14); color: var(--green);
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
}

.pv-actions { display: flex; gap: 8px; margin-top: 16px; }
.pv-actions button, .pv-actions a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px; min-height: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--text);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit; text-decoration: none;
}
.pv-actions .pv-del {
  border-color: rgba(240,113,107,.3); background: var(--danger-bg); color: var(--danger);
}

/* dokument právě vybraný v pravém panelu */
.note-thumb.previewed { outline: 2px solid var(--accent); outline-offset: 2px; }

/* panel jen na širokém desktopu */
@media (max-width: 1180px) { .preview-panel { display: none; } }

/* hamburger jen na mobilu */
#btn-menu { display: none; }

@media (max-width: 900px) {
  #btn-menu { display: flex; }
  .side-backdrop { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 12px 0 32px rgba(0,0,0,.45);
  }
  .shell.menu-open .sidebar { transform: translateX(0); }
}

[hidden] { display: none !important; }

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

header {
  flex: none; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px;
  padding-top: calc(18px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.btn-ai-pill {
  display: flex; align-items: center; gap: 7px;
  background: var(--accent-bg); color: var(--accent);
  border: none; border-radius: 10px;
  padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit; flex: none;
}
.btn-ai-pill:hover { background: rgba(139,108,245,.26); }
@media (max-width: 520px) { .btn-ai-pill .btn-ai-lbl { display: none; } }

header h1 {
  flex: 1; margin: 0; min-width: 0;
  display: grid; gap: 1px;
}
header h1 #head-title {
  font-size: 22px; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (min-width: 901px) { header h1 #head-title { font-size: 26px; } }

.eyebrow {
  display: block;
  font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-home {
  display: block; text-align: left;
  font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  background: none; border: none; padding: 0; margin: 0; font-family: inherit;
  cursor: pointer;
}
.eyebrow-home:hover, .eyebrow-home:focus-visible { color: var(--accent); }

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

button {
  font: inherit; color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
}
button:hover { border-color: rgba(255,255,255,.16); }
button:active { transform: scale(.97); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-danger  { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-ghost   { background: transparent; border-color: transparent; }

.sidebar-logout {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.sidebar-logout:hover { color: var(--text); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* domeček v hlavičce – žlutý akcent, stejně jako domeček v prohlížeči poznámky */
#btn-back-home { stroke: var(--accent); }

/* ---------- ukazatele paliva (úložiště + kredit) ---------- */

.fuel-gauges { display: flex; gap: 18px; align-items: flex-end; justify-content: center; }
.fuel-gauge { display: grid; justify-items: center; gap: 0; }
.fuel-gauge svg { width: 44px; height: 30px; overflow: visible; }
.fuel-gauge .dial { fill: none; stroke: var(--line); stroke-width: 2.4; stroke-linecap: round; }
.fuel-gauge .redzone { fill: none; stroke: #d33; stroke-width: 2.4; stroke-linecap: round; }
.fuel-gauge .ticks line { stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; }
.fuel-gauge .ef { font: 700 7px -apple-system, Segoe UI, Roboto, sans-serif; fill: var(--muted); }
.fuel-gauge .needle {
  stroke: var(--accent); stroke-width: 2; stroke-linecap: round;
  transform-origin: 22px 24px;
  transition: transform .8s cubic-bezier(.34,1.3,.5,1);
}
.fuel-gauge .pivot { fill: var(--text); }
.fuel-gauge.low .needle { stroke: #e5a33b; }
.fuel-gauge.empty .needle { stroke: #d33; }
.fuel-label { font-size: 9px; color: var(--muted); line-height: 1; margin-top: 0; text-transform: uppercase; letter-spacing: .04em; }

/* lišta stavu tarifu pod hlavičkou */
.plan-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 18px; font-size: 13.5px;
  background: rgba(139,108,245,.14); color: #cbbdfa; border-bottom: 1px solid var(--line);
}
.plan-banner a { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }

/* ---------- plovoucí tlačítko foťáku ---------- */

.fab {
  position: fixed; z-index: 30;
  right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); border: none; color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
/* Dřív appka na desktopu foťák skrývala úplně a nahrazovala ho tlačítkem
   „Nový dokument" v sidebaru (viditelným odkudkoli). Teď je to obráceně:
   appka na desktopu FAB ukáže jen v otevřeném šanonu (řídí show() přes
   hidden atribut) – dává jasný smysl "sem, do TÉTO složky", a nezobrazí
   se, dokud šanon není otevřený. */
@media (min-width: 1181px) { .fab { right: calc(340px + 18px); } }
.fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- obsah ---------- */

main {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 24px; padding-bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 1000px; margin: 0 auto; width: 100%;
}
@media (max-width: 900px) { main { padding: 16px; } }

.empty {
  text-align: center; color: var(--muted);
  padding: 56px 24px;
}
.empty strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

/* ---------- složky: regály s barevnými hřbety (Etapa B, 21-7-2026) ---------- */

.folder-grid { display: block; }

.shelf { margin-bottom: 30px; }

.shelf-head {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  background: none; border: none; border-radius: 0;
  padding: 0 2px 12px; min-height: 0;
  color: var(--muted); cursor: pointer; text-align: left;
}
.shelf-head b { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; }
.shelf-head span { font-size: 12px; color: var(--faint); font-weight: 400; }
.shelf-head .chev {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s ease;
}
.shelf-head .chev.open { transform: rotate(90deg); }
.shelf-head:hover { color: var(--text); }
.shelf-head.theme-other { color: var(--faint); }

.shelf-row {
  display: flex; gap: 14px; align-items: flex-end;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 6px 2px 0; scrollbar-width: thin;
}

/* polička pod složkami */
.plank {
  height: 15px; border-radius: 3px; margin-top: -3px;
  background: linear-gradient(180deg, #6e4d2a, #4a3016);
  box-shadow: 0 10px 14px -6px rgba(0,0,0,.55);
}

/* hřbet složky = kniha v regálu */
.folder-spine {
  position: relative;
  width: 96px; height: 178px; flex: none;
  border-radius: 8px 8px 3px 3px;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 18px; cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(0,0,0,.7);
}
.folder-spine:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.spine-label {
  width: 68px; min-height: 74px;
  background: var(--paper); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  padding: 7px 6px; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.spine-label b {
  font-size: 12px; font-weight: 700; color: #26242b;
  text-align: center; line-height: 1.25;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.spine-cnt {
  margin-top: 12px; font-size: 19px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

.spine-unread {
  margin-top: 4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 8px; padding: 2px 7px; white-space: nowrap;
}
.spine-protected {
  margin-top: 4px;
  background: rgba(0,0,0,.3); color: rgba(255,255,255,.85);
  font-size: 9.5px; font-weight: 600;
  border-radius: 7px; padding: 2px 7px;
}

.spine-hole {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg);
  margin: auto auto 14px;
}

.spine-menu {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 26px; height: 26px; min-height: 0;
  border-radius: 50%; border: none;
  background: rgba(0,0,0,.28); color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer;
}
.spine-menu svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.spine-menu:hover { background: rgba(0,0,0,.5); }

.add-shelf {
  width: 100%; margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: none; border: 1.5px dashed rgba(255,255,255,.18);
  border-radius: 12px; padding: 15px;
  color: var(--faint); font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.add-shelf span { font-size: 15px; line-height: 1; }
.add-shelf:hover { color: var(--muted); border-color: rgba(255,255,255,.3); }

/* ---------- mřížka poznámek ---------- */

.note-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.note-thumb {
  padding: 0; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--paper); aspect-ratio: 3 / 4;
  cursor: pointer;
}
.note-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.note-thumb-menu {
  position: absolute; top: 4px; left: 4px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.45); color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer;
}
.note-thumb-menu svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.note-thumb-menu:hover { background: rgba(0,0,0,.65); }

/* ---------- skenování ---------- */

.stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: var(--radius);
  overflow: hidden; touch-action: none;
  min-height: 320px;
}
.stage canvas { max-width: 100%; height: auto; display: block; }

.scan-hint { color: var(--muted); font-size: 14px; text-align: center; margin: 12px 4px; }

.toolbar {
  display: flex; gap: 10px; margin-top: 14px;
  flex-wrap: wrap; align-items: center;
}
.toolbar .grow { flex: 1; }
/* Lišta ovládacích tlačítek umístěná NAD obsahem (mřížka složek/poznámek)
   – odsazení má dole místo nahoře. */
.toolbar-top { margin-top: 2px; margin-bottom: 14px; }

.seg {
  display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.seg button {
  flex: 1; border: none; border-radius: 0; background: transparent;
  padding: 10px 12px; font-size: 14px; white-space: nowrap;
}
.seg button.on { background: var(--accent); color: var(--ink); font-weight: 700; }

select {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; min-height: 44px; width: 100%;
}

.save-bar { display: grid; gap: 10px; margin-top: 14px; }

/* ---------- prohlížeč poznámky ---------- */

.viewer {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.92);
  display: flex; flex-direction: column;
}
.viewer .body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: auto; padding: 12px;
}
.viewer img {
  max-width: 100%; max-height: 100%; background: var(--paper);
  cursor: zoom-in;
}
.viewer img.zoomed {
  max-width: none; max-height: none; height: auto;
  cursor: zoom-out;
}
.viewer .body.zoomed { align-items: flex-start; justify-content: flex-start; }
.viewer .bar {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.viewer .bar .grow { flex: 1; }
.zoom-ctrl { display: flex; gap: 6px; }
.zoom-ctrl button {
  min-height: 0; padding: 8px 14px; font-weight: 700;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}
.zoom-ctrl #viewer-zoom-fit { font-weight: 600; font-size: 13px; }

/* ---------- dialog / login ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 8px;
}
.dialog {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
  max-height: min(640px, 97vh);
}
.dialog h2 { margin: 0; font-size: 17px; }
.dialog-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
/* dlouhý seznam (např. hodně regálů) se má scrollovat uvnitř dialogu,
   ať zůstane nadpis i poslední položka ("+ Nový regál" / pole na název)
   vždy dosažitelné, i když se dialog nevejde celý na obrazovku */
.theme-choice-list { display: grid; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; }
.theme-choice {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 14px; color: var(--text);
  background: none; cursor: pointer; text-align: left; width: 100%;
}
.theme-choice.current { border-color: var(--accent); color: var(--accent); }
.theme-choice .tick { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-choice.muted { color: var(--muted); }
.theme-choice.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.dialog-head { display: flex; align-items: center; gap: 8px; }
.dialog-head h2 { flex: 1; }
.icon-btn.home-icon { color: var(--accent); flex: none; }
.viewer .home-icon {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 10px; z-index: 5;
  background: rgba(0,0,0,.45); border-radius: 50%; color: var(--accent);
}
/* šipka "zpět do složky" – hned vedle domečku (domeček = úplný začátek appky,
   šipka = jen o patro výš, na seznam dokumentů v aktuální složce) */
.viewer .viewer-back { left: 62px; }
.dialog input {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; width: 100%;
}
.dialog .row { display: flex; gap: 10px; justify-content: flex-end; }

.usage-baseline-row { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.usage-baseline-row label { font-size: 12px; color: var(--muted); }
.usage-baseline-row .row { justify-content: stretch; }
.usage-baseline-row input { flex: 1; }
.usage-baseline-row button { flex-shrink: 0; }
.usage-reset-note { font-size: 12px; color: var(--muted); }

.usage-wallet-row { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.usage-wallet-row .row { justify-content: stretch; }
.usage-wallet-row input { flex: 1; }
.usage-wallet-row button { flex-shrink: 0; }
#usage-wallet-rows { display: grid; gap: 10px; }
.usage-row.strong .value { font-size: 17px; }
.usage-row .value.negative { color: var(--danger); }

/* ---------- načítání + toast ---------- */

.spinner {
  width: 34px; height: 34px; margin: 0 auto;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.spinner-sm { width: 22px; height: 22px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.note-thumb.pending {
  display: flex; align-items: center; justify-content: center;
  min-height: 140px; background: var(--surface);
}
.thumb-pending-label {
  display: grid; gap: 8px; justify-items: center;
  color: var(--muted); font-size: 12px;
}

.loading { text-align: center; color: var(--muted); padding: 48px 16px; display: grid; gap: 14px; }
.loading-sub { font-size: 13px; color: var(--muted); margin-top: -8px; }
.loading-bar-wrap {
  width: 100%; max-width: 280px; height: 8px; margin: 4px auto 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.loading-bar { height: 100%; width: 0%; background: var(--accent); transition: width .25s ease; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 18px;
  z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  transition: opacity .25s;
}

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

/* ---------- AI panel ---------- */

#ai-panel { padding: 0; align-items: stretch; justify-content: stretch; background: var(--bg); }
.ai-dialog {
  max-width: none; width: 100%; height: 100%;
  border-radius: 0; border: none;
  display: flex; flex-direction: column;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  padding-top: calc(16px + env(safe-area-inset-top));
}
@media (min-width: 901px) {
  #ai-panel { padding: 28px; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
  .ai-dialog {
    max-width: 820px; height: min(780px, 100%);
    border-radius: 16px; border: 1px solid var(--line);
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
    padding: 22px;
  }
}
#ai-mode-ask, #ai-mode-search { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ai-dialog textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; width: 100%; resize: vertical;
}
.ai-answer {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; font-size: 14px; line-height: 1.45;
}
.ai-transcript {
  display: flex; flex-direction: column; gap: 10px;
  flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; margin-bottom: 10px;
}
.ai-msg { max-width: 92%; }
.ai-msg.user { align-self: flex-end; }
.ai-msg.assistant { align-self: flex-start; }
.ai-msg .bubble {
  white-space: pre-wrap; border-radius: 12px; padding: 10px 12px;
  font-size: 14px; line-height: 1.45;
}
.ai-msg.user .bubble { background: var(--accent); color: var(--on-accent); }
.ai-msg.assistant .bubble { background: var(--bg); border: 1px solid var(--line); color: var(--text); }
.ai-msg.assistant.error .bubble { border-color: var(--danger); color: var(--danger); }
.ai-msg .refs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ai-msg .refs button {
  border: none; padding: 0; width: 44px; height: 44px; border-radius: 8px;
  overflow: hidden; cursor: pointer; background: var(--bg); border: 1px solid var(--line);
}
.ai-msg .refs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-loading { text-align: center; color: var(--muted); padding: 10px; }

.ai-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.ai-tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 4px;
  border-radius: 10px; cursor: pointer;
}
.ai-tab.on { background: var(--accent-bg); color: var(--accent); }

#ai-mode-search input#search-q {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; width: 100%;
}
.search-results { display: grid; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; }
.search-result {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; cursor: pointer; width: 100%;
}
.search-result img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.search-result .info { display: grid; gap: 3px; min-width: 0; }
.search-result .meta { font-size: 11px; color: var(--muted); }
.search-result .snippet { font-size: 13px; line-height: 1.4; color: var(--text); }
.search-result .snippet mark { background: var(--accent); color: var(--on-accent); border-radius: 3px; padding: 0 2px; }
.empty-inline { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }

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

.tag-bar { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 12px; }
.tag-chip {
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer;
}
.tag-chip .count { color: var(--muted); font-weight: 400; }
.tag-chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.note-thumb .tag-pill {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(0,0,0,.62); color: #fff; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 5px; max-width: calc(100% - 34px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.viewer-summary {
  color: #fff; background: rgba(0,0,0,.5); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; margin-top: 10px; max-width: 90%;
}

/* ---------- termíny a úkoly ---------- */

.tasks-list { display: grid; gap: 4px; }
.task-group-label {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 18px 0 6px; padding: 0 2px;
}
.task-group-label:first-child { margin-top: 4px; }
.task-item {
  display: flex; gap: 12px; align-items: center; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; cursor: pointer; text-align: left;
}
.task-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.task-item .txt { display: grid; gap: 2px; min-width: 0; }
.task-item .txt b { font-size: 14px; font-weight: 600; }
.task-item .txt span { font-size: 12px; color: var(--muted); }
.task-item.due-soon { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.task-item.past-due { opacity: .55; }

/* ---------- využití AI ---------- */

.usage-dialog { max-width: 420px; }
.usage-body { display: grid; gap: 14px; font-size: 14px; }
.usage-section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); margin-top: 4px; padding-bottom: 2px; border-bottom: 1px solid var(--line);
}
.usage-section-label:first-child { margin-top: 0; }
.usage-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 8px; border-bottom: 1px dashed var(--line);
}
.usage-row .label { color: var(--muted); font-size: 13px; }
.usage-row .value { font-weight: 700; }
.usage-limit-warn {
  background: rgba(232,147,58,.16); color: #f0b06a; border-radius: 10px;
  padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.usage-bars { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.usage-bars .bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.usage-bars-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.usage-test-result {
  border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.usage-test-result.ok    { background: rgba(76,195,138,.14); color: var(--green); border-color: rgba(76,195,138,.4); }
.usage-test-result.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(240,113,107,.4); }

/* ---------- PDF badge na náhledu ---------- */

.note-thumb { position: relative; }
.note-thumb .pdf-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: #d63e36; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 5px; letter-spacing: .02em;
}

/* ---------- Kategorie ---------- */

.view-subhead {
  font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; margin: 18px 0 4px;
}
.muted-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }

.inbound-email-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}
.inbound-email-hint strong {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}
.inbound-email-hint .btn-copy-email {
  margin-left: auto;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.inbound-email-hint .btn-copy-email:hover { background: var(--accent); color: var(--on-accent); }

.cat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.cat-card p { font-size: 13.5px; color: var(--muted); margin: 6px 0 12px; }
.cat-card .row, #cat-editor .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.cat-list { display: grid; gap: 6px; margin-bottom: 10px; }
.cat-list .cat-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px;
}
.cat-list .cat-row input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; padding: 4px;
}
.cat-list .cat-row .cat-count { font-size: 11.5px; color: var(--muted); flex: none; }
.cat-list .cat-row button {
  flex: none; border: none; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.cat-list .cat-row button:hover { color: var(--danger); }

#cat-new-name {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; color: var(--text); font: inherit; font-size: 14px;
}

.cat-review-list { display: grid; gap: 8px; }
.cat-review-item {
  display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px;
}
.cat-review-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; }
.cat-review-item .body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.cat-review-item .suggested { font-size: 13.5px; }
.cat-review-item .suggested b { font-weight: 700; }
.cat-review-item .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cat-review-item select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 12.5px; padding: 5px 6px;
}
.cat-review-item .actions button {
  font-size: 12.5px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); cursor: pointer;
}
.cat-review-item .actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.cat-review-item .actions button.dismiss { color: var(--muted); }

.badge-dot {
  position: absolute; top: 2px; right: 2px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--bg);
}

.note-thumb .cat-badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(58,90,114,.88); color: #fff; font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 5px; max-width: calc(100% - 8px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- výdaje (Etapa 11) ---------- */

.expenses-summary {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 14px;
}
.expenses-summary .label { font-size: 12.5px; color: var(--muted); }
.expenses-summary .value { font-size: 20px; font-weight: 700; }

.expense-item {
  display: flex; gap: 12px; align-items: center; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; cursor: pointer; text-align: left; margin-bottom: 4px;
}
.expense-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.expense-item .txt { display: grid; gap: 2px; min-width: 0; flex: 1; }
.expense-item .txt b { font-size: 14px; font-weight: 600; }
.expense-item .txt span { font-size: 12px; color: var(--muted); }
.expense-item .amount { font-size: 15px; font-weight: 700; flex: none; text-align: right; }
.expense-item.due-soon { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.expense-item.past-due .amount { color: var(--danger); }

/* ---------- hromadný výběr poznámek (Etapa 10) ---------- */

.select-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 13.5px;
}
.select-bar button:disabled { opacity: .4; cursor: default; }

.note-grid.select-mode .note-thumb { user-select: none; -webkit-user-select: none; }
.note-grid.select-mode .note-thumb-menu { display: none; } /* v režimu výběru ať nepřekáží menu jednotlivé poznámky */

.note-thumb .select-check {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.35);
  display: none;
}
.note-grid.select-mode .note-thumb .select-check { display: block; }
.note-thumb.selected .select-check {
  background: var(--accent); border-color: var(--accent);
}
.note-thumb.selected .select-check::after {
  content: "✓"; color: #fff; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; height: 100%;
}
.note-thumb.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- univerzální dialog Zařadit/Přesunout do šanonu (Etapa 1, 25-7-2026) ---------- */

.assign-dlg { display: flex; flex-direction: column; max-height: min(860px, 97vh); }

.assign-doc {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; margin: 10px 0 12px;
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
}
.assign-doc img {
  width: 38px; height: 38px; object-fit: cover; border-radius: 7px; flex: none;
  background: var(--bg);
}
.assign-doc b { color: var(--text); display: block; font-size: 13px; }

.assign-search {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 13px; color: var(--text);
  font: inherit; font-size: 13.5px; margin-bottom: 8px;
}
.assign-search::placeholder { color: var(--faint); }
.assign-search:focus { outline: none; border-color: var(--accent); }

.assign-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px; }

.assign-grp {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--faint); margin: 10px 2px 6px;
}
.assign-grp .sp { color: var(--accent); }

.assign-opt {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 11px;
  border: 1.5px solid transparent; background: none;
  min-height: 0; text-align: left; margin-bottom: 3px;
}
.assign-opt:hover { background: rgba(255,255,255,.04); border-color: transparent; }
.assign-opt .dot { width: 16px; height: 16px; border-radius: 5px; flex: none; }
.assign-opt .nm { flex: 1; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.assign-opt .cnt { font-size: 11.5px; color: var(--faint); }
.assign-opt .pct { font-size: 11.5px; font-weight: 700; color: var(--faint); }
.assign-opt .pct.hi { color: var(--green); }

.assign-why {
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
  margin: 2px 4px 8px; padding-left: 2px;
}
.assign-thinking { display: flex; align-items: center; gap: 8px; }
.assign-thinking::before {
  content: ""; width: 12px; height: 12px; flex: none;
  border: 2px solid rgba(255,255,255,.18); border-top-color: var(--accent);
  border-radius: 50%; animation: assign-spin .7s linear infinite;
}
@keyframes assign-spin { to { transform: rotate(360deg); } }

.assign-opt .radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--faint); flex: none; position: relative;
}
.assign-opt.sel { background: var(--accent-bg); border-color: var(--accent); }
.assign-opt.sel .nm { font-weight: 700; color: var(--accent); }
.assign-opt.sel .radio { border-color: var(--accent); }
.assign-opt.sel .radio::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent);
}

.assign-new {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 11px; margin-top: 6px;
  border: 1.5px dashed rgba(255,255,255,.18); background: none;
  color: var(--faint); font-size: 13.5px; min-height: 0; text-align: left;
}
.assign-new:hover { color: var(--muted); border-color: rgba(255,255,255,.3); }

.assign-learn {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.45;
  cursor: pointer;
}
.assign-learn input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin-top: 1px; }

.assign-foot { margin-top: 12px; }
#assign-ok:disabled { opacity: .45; cursor: default; }

/* ---------- panel Zálohy ---------- */

.backup-option {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.backup-option:last-of-type { border-bottom: none; }
.backup-option strong { font-size: 14.5px; }
.backup-option p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.backup-option button, .backup-option a.btn-primary {
  flex: none; font-size: 13px; padding: 8px 14px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.backup-option a.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.backup-option button:disabled { opacity: .5; cursor: default; }

.backup-result {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: var(--bg); border: 1px solid var(--line);
}
.backup-result.ok    { border-color: rgba(76,195,138,.4); color: var(--green); }
.backup-result.error { border-color: rgba(240,113,107,.4); color: var(--danger); }

/* ---------- vícestránkové dokumenty (bod 2) ---------- */

.page-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.page-strip .page-thumb {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 8px;
  overflow: hidden; border: 2px solid var(--line);
}
.page-strip .page-thumb.current { border-color: var(--accent); }
.page-strip .page-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-strip .page-thumb .num {
  position: absolute; bottom: 2px; left: 3px; font-size: 9px; font-weight: 700;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.page-strip .page-thumb .rm {
  position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 16px; text-align: center;
  border: none; padding: 0; cursor: pointer;
}

.note-thumb.multi-page { box-shadow: -3px 3px 0 -1px var(--surface), -3px 3px 0 0 var(--line), -6px 6px 0 -1px var(--surface), -6px 6px 0 0 var(--line); }
.note-thumb .page-count-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(58,90,114,.88); color: #fff; font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 5px;
}

.viewer .page-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%; color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4);
  width: 54px; height: 54px; display: flex; align-items: center; justify-content: center;
}
.viewer .page-nav svg { width: 30px; height: 30px; stroke-width: 2.5; }
.viewer .page-nav:active:not(:disabled) { background: rgba(0,0,0,.8); }
.viewer .page-nav.prev { left: 12px; }
.viewer .page-nav.next { right: 12px; }
.viewer .page-indicator {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; z-index: 5;
  background: rgba(0,0,0,.45); color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}

.page-nav:disabled { opacity: .3; }

/* ---------- foťák: menu Jedna strana / Víc stran ---------- */

.fab-menu {
  position: fixed; z-index: 41;
  right: 18px; bottom: calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
/* na širokém desktopu je i samo tlačítko (.fab) posunuté doleva, ať
   nepřekrývá pravý panel náhledu – menu se posune stejně, aby zůstalo
   u tlačítka */
@media (min-width: 1181px) { .fab-menu { right: calc(340px + 18px); } }
.fab-menu button {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap;
  padding: 12px 18px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.fab-menu button svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }

.icon-btn.wallet-icon svg { stroke: none; }
.icon-btn.wallet-icon-big { text-decoration: none; }
.icon-btn.wallet-icon-big svg { width: 30px; height: 30px; stroke: none; }

/* ---------- Spotřeba AI (26-7-2026) ---------- */

.usage-h {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--faint); margin: 28px 2px 12px;
}
.usage-h .seg-sw { margin-left: auto; }

.seg-sw { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg-sw button {
  min-height: 0; padding: 5px 11px; border: none; background: none;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  border-radius: 7px; letter-spacing: 0;
}
.seg-sw button.on { background: var(--accent); color: var(--on-accent); }

/* karty období */
.usage-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .usage-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .usage-cards { grid-template-columns: 1fr; } }

.ucard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; }
.ucard.hi { border-color: rgba(139,108,245,.4); background: linear-gradient(180deg, rgba(139,108,245,.10), transparent); }
.ucard .t { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.ucard .usd { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 7px; }
.ucard .kc { font-size: 12px; color: var(--faint); min-height: 16px; }
.ucard .tok { font-size: 11.5px; color: var(--muted); margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.ucard .tok b { color: var(--text); font-weight: 600; }
.ucard .note { font-size: 11px; color: var(--faint); margin-top: 6px; }
.ucard .note .up { color: var(--danger); font-weight: 700; }
.ucard .note .down { color: var(--green); font-weight: 700; }

/* graf */
.chartbox { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.chart.dense { gap: 3px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.bar .stack { width: 100%; border-radius: 4px 4px 0 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.bar .seg { width: 100%; }
.bar .d { font-size: 9.5px; color: var(--faint); white-space: nowrap; }
.chart.dense .bar .d { font-size: 8.5px; }
.bar.now .d { color: var(--accent); font-weight: 700; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* rozpad podle typu */
.kinds { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 18px; }
.kindrow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.kindrow:last-child { border-bottom: none; }
.kindrow .ic { width: 10px; height: 34px; border-radius: 5px; flex: none; }
.kindrow .nm { flex: 1; min-width: 0; }
.kindrow .nm b { display: block; font-size: 13.5px; }
.kindrow .nm span { font-size: 11.5px; color: var(--faint); }
.kindrow .barwrap { width: 170px; flex: none; }
.kindrow .track { display: block; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.kindrow .track i { display: block; height: 100%; border-radius: 3px; }
.kindrow .pc { display: block; font-size: 10.5px; color: var(--faint); margin-top: 4px; text-align: right; }
.kindrow .val { width: 100px; text-align: right; flex: none; }
.kindrow .val b { display: block; font-size: 14px; font-weight: 700; }
.kindrow .val span { font-size: 11px; color: var(--faint); }
@media (max-width: 700px) { .kindrow .barwrap { display: none; } }

/* peněženka */
.wallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .wallet-grid { grid-template-columns: 1fr; } }
.wbox { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.wbox .t { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.wbox .v { font-size: 21px; font-weight: 700; margin-top: 6px; }
.wbox .n { font-size: 11.5px; color: var(--faint); margin-top: 4px; }

/* tabulka posledních volání */
.usage-tbl { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.usage-tbl table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.usage-tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: .05em; color: var(--faint);
  font-weight: 700; padding: 11px 14px; background: var(--card);
}
.usage-tbl td { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); }
.usage-tbl td.r, .usage-tbl th.r { text-align: right; }
.usage-tbl td b { color: var(--text); }
.usage-tbl .pill { display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.usage-tbl .muted-note { padding: 16px; margin: 0; }

.usage-foot { font-size: 11.5px; color: var(--faint); line-height: 1.6; margin: 14px 2px 0; }
