:root {
  color-scheme: light dark;
  --bg: #edf1f2; --sea1: #dbe6ea; --sea2: #e8eff1; --grid: #b7c7cd; --card: #ffffff; --line: #c5d1d5;
  --tx: #0f1a1c; --mu: #40545a; --ac: #0f5e57; --ac-tx: #ffffff; --wait: #f59e0b; --waitln: #8a4a06; --waittx: #8a4a06; --okc: #0f6b3d;
  --isl-s: 36%; --isl-l: 80%; --isl-st: 42%; --isl-tx: #0f1f1f; --dot-l: 38%;
  --bar: #ffffff; --shadow: 0 1px 2px rgb(15 26 28 / .08), 0 8px 24px rgb(15 26 28 / .08);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", serif;
  --barh: 76px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1114; --sea1: #0f1b20; --sea2: #0b1519; --grid: #22343b; --card: #14222a; --line: #2b3f48;
    --tx: #eaf2f3; --mu: #a2b7bc; --ac: #62d3c1; --ac-tx: #04201c; --wait: #fbbf24; --waitln: #fde68a; --waittx: #fcd34d; --okc: #6ee7a8;
    --isl-s: 26%; --isl-l: 25%; --isl-st: 58%; --isl-tx: #f3f8f8; --dot-l: 66%;
    --bar: #101c22; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tx); font: 16px/1.5 var(--sans); padding-bottom: calc(var(--barh) + env(safe-area-inset-bottom)); overflow-x: hidden; }
a { color: var(--ac); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--ac); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }

/* horni pruh */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px 10px; max-width: 1560px; margin: 0 auto; }
.brand { flex: 1 1 auto; min-width: 0; }
.brand h1 { font: 700 26px/1.1 var(--serif); letter-spacing: -.01em; }
.brand h1 a { color: var(--tx); text-decoration: none; }
.brand p { color: var(--mu); font-size: 15px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.seg a { padding: 10px 18px; min-height: 44px; display: flex; align-items: center; text-decoration: none; color: var(--tx); font-weight: 600; }
.seg a.on { background: var(--ac); color: var(--ac-tx); }
.links { display: flex; gap: 14px; font-size: 14px; width: 100%; justify-content: flex-end; }
@media (min-width: 700px) { .links { width: auto; } }

/* hlavni plocha */
main { max-width: 1560px; margin: 0 auto; padding: 4px 16px 24px; }
main.map { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { main.map { grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); align-items: start; } }
.loading, .err { padding: 40px 0; color: var(--mu); }
.stage { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--sea1); height: min(62dvh, 560px); min-height: 360px; box-shadow: var(--shadow); transition: height .3s; }
.stage.zoomed { height: min(44dvh, 420px); min-height: 300px; }
@media (min-width: 900px) { .stage, .stage.zoomed { position: sticky; top: 12px; height: calc(100dvh - var(--barh) - 110px); min-height: 440px; max-height: 900px; } }
#mapSvg { width: 100%; height: 100%; display: block; touch-action: manipulation; }
.sea { fill: var(--sea2); }
.grid path { stroke: var(--grid); stroke-width: 1; opacity: .35; fill: none; }
.zone { cursor: pointer; outline: none; }
.zone:focus-visible .isle { stroke-width: 4px; stroke: var(--ac); }
.isle { fill: hsl(var(--h) var(--isl-s) var(--isl-l)); stroke: hsl(var(--h) calc(var(--isl-s) + 10%) var(--isl-st)); stroke-width: 2.5px; vector-effect: non-scaling-stroke; transition: stroke-width .2s; }
.zone:hover .isle { stroke-width: 4px; }
.cont { fill: none; stroke: hsl(var(--h) 30% var(--isl-st)); stroke-width: 1.2px; vector-effect: non-scaling-stroke; opacity: .4; }
.zname { font: 700 24px var(--serif); text-anchor: middle; fill: var(--isl-tx); paint-order: stroke; }
.zsub { font: 600 19px var(--sans); text-anchor: middle; fill: var(--isl-tx); opacity: .85; }
.zone.sel .zname { font-size: 20px; } .zone.sel .zsub { font-size: 15px; }
.gs0 { stop-color: hsl(var(--h) var(--sat) 58%); stop-opacity: .75; }
.gs1 { stop-color: hsl(var(--h) var(--sat) 58%); stop-opacity: 0; }
.glow { pointer-events: none; }
.hot .glow { animation: pulse 3.2s ease-in-out infinite; }
.ring { fill: none; stroke: hsl(var(--h) 25% var(--isl-st)); stroke-width: 1.2px; vector-effect: non-scaling-stroke; stroke-dasharray: 3 7; opacity: .55; pointer-events: none; }
.orb { animation: spin linear infinite; transform-origin: 0 0; }
.dotg { cursor: pointer; }
.hit { fill: transparent; }
.dot { stroke-width: 2; transition: stroke-width .2s; }
.dotg:hover .dot { stroke-width: 4; }
.dot.ok { fill: hsl(var(--h) 55% var(--dot-l)); stroke: var(--card); }
.dot.wait { fill: var(--wait); stroke: var(--waitln); }
.dot.doc { fill: var(--tx); fill-opacity: .7; stroke: var(--card); }
.dot.maj { fill: hsl(var(--h) 60% var(--dot-l)); stroke: var(--card); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .orb, .hot .glow { animation: none; } .stage { transition: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--mu); margin: 0 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; display: inline-block; }
.lw { background: var(--wait); border-radius: 50%; border: 2px solid var(--waitln); } .lo { background: hsl(200 55% var(--dot-l)); border-radius: 50%; }
.ld { background: var(--tx); opacity: .7; border-radius: 2px; } .lm { background: hsl(38 60% var(--dot-l)); transform: rotate(45deg) scale(.8); }

/* panel */
.panel { min-width: 0; }
.panel h2, .weekbar h2 { font: 700 30px/1.15 var(--serif); margin-bottom: 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sw { width: 18px; height: 18px; border-radius: 50%; background: hsl(var(--h) 45% 55%); display: inline-block; }
.tip { color: var(--mu); font-size: 14.5px; margin-bottom: 8px; }
.dek { color: var(--mu); margin-bottom: 14px; max-width: 62ch; }
.dek b { color: var(--tx); }
.sec { font: 700 13px var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--mu); margin: 22px 0 8px; }
.crumb { margin-bottom: 8px; } .crumb a { font-weight: 600; text-decoration: none; display: inline-block; padding: 8px 0; min-height: 44px; }
.card { background: var(--card); border: 1px solid var(--line); border-left: 5px solid hsl(var(--h, 215) 50% 50%); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.card.wait { border-left-color: var(--wait); }
.card h3 { font: 600 18px/1.3 var(--sans); margin: 2px 0 4px; }
.when { font-size: 14px; font-weight: 600; color: var(--waittx); } .when.ok { color: var(--okc); }
.src, .card blockquote { color: var(--mu); font-size: 15px; margin-top: 4px; }
blockquote { margin: 8px 0 0; padding-left: 12px; border-left: 3px solid var(--line); font-style: italic; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.b { font: 600 16px var(--sans); min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--tx); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, border-color .2s; }
.b:hover { border-color: var(--ac); }
.b.main { background: var(--ac); color: var(--ac-tx); border-color: var(--ac); }
.b:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; color: var(--tx); min-height: 52px; transition: border-color .2s; }
.row:hover { border-color: hsl(var(--h, 215) 50% 50%); }
.tg { flex: none; padding-top: 1px; }
.chip { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.chip.w { background: var(--wait); color: #2b1700; } .chip.ok { background: color-mix(in srgb, var(--okc) 22%, var(--card)); color: var(--okc); } .chip.d { background: color-mix(in srgb, var(--mu) 20%, var(--card)); color: var(--tx); }
.rt { min-width: 0; } .rt b { display: block; font-weight: 600; overflow-wrap: anywhere; } .rt small { display: block; color: var(--mu); font-size: 14px; overflow-wrap: anywhere; }
.empty { color: var(--mu); padding: 6px 0; }
.saved { color: var(--mu); font-size: 14.5px; margin-top: 12px; }
.networth { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: var(--tx); box-shadow: var(--shadow); }
.networth span { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); }
.networth b { display: block; font: 700 34px/1.2 var(--serif); } .networth small { color: var(--mu); font-size: 14.5px; }
.spark { width: 100%; height: 90px; display: block; margin-top: 12px; } .spark polyline { fill: none; stroke: var(--ac); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.ledger { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.ledger li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); } .ledger li:first-child { border-top: 0; }
.ledger small { display: block; color: var(--mu); font-size: 14px; } .ledger em { font-style: normal; font-weight: 700; white-space: nowrap; }
.orig img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: block; margin-bottom: 10px; }
.fulltext { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font: 15px/1.6 var(--sans); max-height: 420px; overflow: auto; overflow-wrap: anywhere; }
mark { background: color-mix(in srgb, var(--wait) 45%, transparent); color: inherit; border-radius: 3px; }

/* tyden */
main.week { display: block; }
.weekbar { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.weekbar h2 small { display: block; width: 100%; font: 400 16px var(--sans); color: var(--mu); }
.weekbar .actions { margin: 0; }
.days { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 120px; }
.day.today { border: 2px solid var(--ac); }
.day h3 { font: 700 14px var(--sans); text-transform: capitalize; color: var(--mu); display: flex; justify-content: space-between; } .day h3 b { color: var(--tx); font: 700 22px var(--serif); }
.ev { margin-top: 8px; padding-left: 8px; border-left: 4px solid hsl(var(--h, 215) 50% 50%); font-size: 15px; overflow-wrap: anywhere; }
.ev.ceka { border-left-color: var(--wait); }
.ev time { display: block; font-weight: 700; font-size: 13px; color: var(--mu); } .ev small { display: block; color: var(--waittx); font-weight: 600; }
.ev a { color: var(--tx); }
.noev { color: var(--mu); font-size: 14.5px; margin-top: 8px; }

/* pevna lista dole */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgb(0 0 0 / .1); max-width: 1000px; margin: 0 auto; border-radius: 18px 18px 0 0; }
.bar input { flex: 1 1 auto; min-width: 0; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--tx); font: 16px var(--sans); padding: 0 14px; }
.bar input::placeholder { color: var(--mu); }
.bar .b { min-height: 52px; }
.bar .ask { white-space: nowrap; background: var(--ac); color: var(--ac-tx); border-color: var(--ac); }
@media (max-width: 560px) { .bar .new span { display: none; } .bar .new { padding: 0 14px; } .bar .ask { padding: 0 14px; } }
.sheet { position: fixed; z-index: 29; left: 0; right: 0; bottom: calc(var(--barh) + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; max-height: 55dvh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 52px 16px 18px; box-shadow: var(--shadow); }
.sheet[hidden], .toast[hidden] { display: none; }
.sheet .x { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; font-size: 28px; color: var(--mu); cursor: pointer; }
.sheet .q { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--mu); margin-top: 8px; } .sheet .q:first-of-type { margin-top: 0; }
.sheet .a { font: 17px/1.55 var(--serif); margin: 4px 0; white-space: pre-wrap; }
.sheet .warn { color: var(--waittx); font-weight: 600; } .sheet .ai { color: var(--mu); font-size: 14px; margin-top: 10px; }
.srcs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.toast { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--barh) + 14px + env(safe-area-inset-bottom)); background: var(--tx); color: var(--bg); padding: 12px 18px; border-radius: 12px; max-width: min(92vw, 520px); font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { background: #b42318; color: #fff; }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--tx); width: min(560px, calc(100vw - 24px)); padding: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
dialog h2 { font: 700 26px var(--serif); margin-bottom: 4px; }
.f { display: block; font-weight: 700; margin: 14px 0 6px; }
dialog textarea, dialog input[type=file] { width: 100%; font: 16px var(--sans); color: var(--tx); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.files { color: var(--mu); font-size: 14.5px; margin-top: 6px; }
.b.rec.on { background: #b42318; color: #fff; border-color: #b42318; }
