/* Kapesní aplikace: phone-first, native-app feel. System fonts only. */
:root {
  --bg: #f2f0eb; --surface: #ffffff; --surface2: #ebe8e1; --ink: #1d1c1a; --muted: #5d5b55; --line: #dcd8cf;
  --accent: #1f6a5a; --accent-ink: #ffffff; --accent-soft: #dcebe6; --warn: #8a4b00; --warn-soft: #f6e6cf;
  --bad: #a3261f; --bad-soft: #f5dcd9; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --dot-l: 42%; --desk: #dedbd3; --tab-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111312; --surface: #1c1f1d; --surface2: #262a27; --ink: #ecebe6; --muted: #a6a7a0; --line: #30342f;
    --accent: #7ccdb6; --accent-ink: #0b211a; --accent-soft: #1d3a32; --warn: #f0b96b; --warn-soft: #3a2c15;
    --bad: #ff9a90; --bad-soft: #3d1f1c; --shadow: 0 1px 2px rgba(0,0,0,.4); --dot-l: 66%; --desk: #0a0b0a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 17px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* phone shell */
.phone { position: relative; display: flex; flex-direction: column; height: 100dvh; width: 100%; max-width: 100%; background: var(--bg); overflow: hidden; }
@media (min-width: 700px) {
  body { background: var(--desk); display: grid; place-items: center; min-height: 100dvh; }
  .phone { width: 410px; height: min(860px, calc(100dvh - 40px)); border-radius: 44px; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
}
.screen { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-behavior: smooth; }
.navbar { position: sticky; top: 0; z-index: 5; height: 48px; padding-top: env(safe-area-inset-top); box-sizing: content-box; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.navbar span { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .2s; }
.navbar.on { border-bottom-color: var(--line); }
.navbar.on span { opacity: 1; }
.view { padding: 0 16px calc(var(--tab-h) + 96px); margin-top: -48px; }
h1.large { font-size: 34px; line-height: 1.12; letter-spacing: -.02em; margin: 56px 0 4px; font-weight: 700; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 16px; }
h3.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 4px 10px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
h3.sec b { color: var(--accent); }

/* tab bar + fab */
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabbar button { position: relative; background: none; border: 0; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar button[aria-current="page"] .ic { stroke-width: 2.3; }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-style: normal; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.fab { position: absolute; right: 18px; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); z-index: 6; width: 60px; height: 60px; border-radius: 30px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.28); transition: transform .15s; }
.fab:active { transform: scale(.94); }
.fab .ic { width: 28px; height: 28px; stroke-width: 2.2; }

/* cards and rows */
.card { background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.list { background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row b, .row strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row small { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.row .chev { color: var(--muted); width: 18px; height: 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: hsl(var(--h, 0) 55% var(--dot-l)); flex: none; }
.dot.gray { background: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface2); color: var(--muted); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.wait { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; background: var(--surface); border-radius: 18px; }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-weight: 600; }

/* buttons */
.btn { min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface2); display: grid; place-items: center; color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; min-height: 44px; }
.toplinks { display: flex; gap: 16px; justify-content: flex-end; padding-top: 58px; font-size: 14px; margin-bottom: -44px; position: relative; z-index: 1; }
.toplinks a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; font-weight: 600; }

/* dnes */
.askpill { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 18px; border-radius: 27px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); text-align: left; margin: 6px 0 4px; box-shadow: var(--shadow); }
.askpill .ic { color: var(--accent); }
.swipe { position: relative; border-radius: 18px; margin-bottom: 10px; overflow: hidden; touch-action: pan-y; }
.swipe-bg { opacity: 0; position: absolute; inset: 0; display: flex; align-items: center; padding: 0 22px; font-weight: 700; color: #fff; }
.swipe-bg.l { background: #1f6a5a; justify-content: flex-start; }
.swipe-bg.r { background: #a3261f; justify-content: flex-end; }
.swipe-in { position: relative; transition: transform .2s; }
.swipe-in.drag { transition: none; }
.term { display: flex; gap: 14px; }
.datebox { flex: none; align-self: flex-start; width: 54px; text-align: center; border-radius: 12px; background: var(--surface2); padding: 6px 0 5px; line-height: 1.1; }
.datebox b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.datebox small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.datebox.today { background: var(--accent); color: var(--accent-ink); }
.datebox.today small { color: var(--accent-ink); }
.term .body { flex: 1; min-width: 0; }
.term p { margin: 0 0 6px; font-weight: 600; }
.term .src { background: none; border: 0; padding: 0; color: var(--muted); font-size: 14px; text-align: left; text-decoration: underline; min-height: 28px; }
.term .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 0; }
.working { display: flex; gap: 12px; align-items: center; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.55); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .screen { scroll-behavior: auto; } }
.saved { color: var(--muted); text-align: center; font-size: 15px; margin: 22px 8px 0; }

/* papiry */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 4px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.search { display: block; position: relative; margin-bottom: 12px; }
.search input { width: 100%; min-height: 48px; border-radius: 24px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 18px 0 46px; }
.search .ic { position: absolute; left: 14px; top: 12px; color: var(--muted); }
.docrow small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* calendar */
.weekbar { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; touch-action: pan-y; }
.weekbar .round { flex: none; }
.days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dayb { position: relative; min-height: 62px; border-radius: 14px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.dayb small { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.dayb b { font-size: 18px; font-variant-numeric: tabular-nums; }
.dayb.today b { color: var(--accent); }
.dayb[aria-pressed="true"] { background: var(--accent); }
.dayb[aria-pressed="true"] b, .dayb[aria-pressed="true"] small { color: var(--accent-ink); }
.dayb i { position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.dayb[aria-pressed="true"] i { background: var(--accent-ink); }
.dayh { font-size: 15px; font-weight: 700; margin: 18px 4px 8px; display: flex; justify-content: space-between; }
.dayh.sel { color: var(--accent); }
.ev { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); align-items: center; }
.ev .tm { flex: none; width: 66px; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: 15px; }
.ev .grow { flex: 1; min-width: 0; }
.ev b { font-weight: 600; display: block; }
.ev small { color: var(--muted); font-size: 13px; }
.ev.ext { border-left: 4px solid var(--muted); }
.ev.ok { border-left: 4px solid var(--accent); }
.ev.wait { border-left: 4px solid var(--warn); }
.nothing { color: var(--muted); padding: 4px 6px 0; margin: 0; }

/* majetek */
.hero { background: var(--accent); color: var(--accent-ink); border-radius: 24px; padding: 20px; margin-bottom: 12px; }
.hero small { opacity: .85; font-weight: 600; }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero svg.spark { width: 100%; height: 54px; margin-top: 8px; display: block; }
.hero .two { display: flex; gap: 24px; margin-top: 10px; }
.hero .two b { display: block; font-variant-numeric: tabular-nums; font-size: 18px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface2); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.up { color: var(--accent); }
.down { color: var(--bad); }

/* sheets */
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 20; animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; z-index: 21; background: var(--bg); border-radius: 26px 26px 0 0; display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(0,0,0,.25); animation: up .25s ease-out; padding-bottom: env(safe-area-inset-bottom); }
.sheet.full { height: 92%; }
.sheet.drag { animation: none; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none; } }
.grab { padding: 10px 0 4px; display: grid; place-items: center; touch-action: none; }
.grab i { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 4px 16px 8px 20px; touch-action: none; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -.01em; }
.sheet-body { overflow-y: auto; padding: 4px 16px 24px; overscroll-behavior: contain; }
.sheet-body p { margin: 0 0 12px; }
.sheet-body h4 { margin: 22px 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin: 0 0 4px 2px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); padding: 10px 14px; }
.field textarea { min-height: 96px; resize: vertical; }
.fieldrow { display: flex; gap: 10px; }
.fieldrow .field { flex: 1; }
.answer { background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); margin-top: 14px; }
.answer .q { color: var(--muted); font-size: 15px; margin-bottom: 6px; }
.answer .ai { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.answer.thinking .a { color: var(--muted); }
.srcs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.big3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.big3 label, .big3 button { min-height: 96px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 15px; text-align: center; }
.big3 .ic { width: 30px; height: 30px; color: var(--accent); }
.big3 .rec { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.big3 .rec .ic { color: var(--bad); }
.attach { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.attach span { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; }
.thumbs button { flex: none; border: 0; padding: 0; background: var(--surface2); border-radius: 12px; overflow: hidden; width: 110px; height: 140px; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.origbtn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; }
pre.text { white-space: pre-wrap; word-break: break-word; font: 14px/1.5 var(--font); background: var(--surface); border-radius: 14px; padding: 12px 14px; max-height: 40vh; overflow: auto; margin: 8px 0 0; }
details.more summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; color: var(--accent); cursor: pointer; }
.hist { font-variant-numeric: tabular-nums; }
.viewer { position: absolute; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; }
.viewer-x { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 2; background: rgba(255,255,255,.9); color: #000; }
#viewerBody { flex: 1; overflow: auto; }
#viewerBody iframe { width: 100%; height: 100%; border: 0; background: #fff; }
#viewerBody img { display: block; width: 100%; height: auto; }
#viewerBody pre { color: #fff; white-space: pre-wrap; padding: 70px 16px 16px; font: 14px/1.5 var(--font); }
.toast { position: absolute; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 90px + env(safe-area-inset-bottom)); z-index: 40; background: #222; color: #fff; border-radius: 16px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.bad { background: #8d1f19; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: #9be0cb; font-weight: 700; min-height: 44px; padding: 0 6px; }
.login { text-align: center; padding: 120px 20px; }
