/* Řídicí panel - bento přehled na jednu obrazovku. Tvar: obal 22px, jádro 17px, vnitřní řádky 12px, tlačítka pilulky. Jeden akcent. */
:root {
  --bg: #e5e8eb; --shell: rgba(15, 23, 32, .05); --ring: rgba(15, 23, 32, .09);
  --core: #fcfdfd; --core2: #f0f3f5; --ink: #0d141b; --ink2: #3f4a55; --mute: #566270;
  --line: rgba(15, 23, 32, .11); --accent: #0a6654; --accent-ink: #fff; --accent-soft: rgba(10, 102, 84, .11);
  --shadow: 0 22px 44px -28px rgba(20, 40, 50, .38);
  --r-shell: 22px; --r-core: 17px; --r-row: 12px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --bar: 60px; --gut: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090c0f; --shell: rgba(255, 255, 255, .045); --ring: rgba(255, 255, 255, .09);
    --core: #13181d; --core2: #1b2229; --ink: #eaeff3; --ink2: #b9c3cc; --mute: #9aa6b0;
    --line: rgba(255, 255, 255, .11); --accent: #52d3af; --accent-ink: #04211a; --accent-soft: rgba(82, 211, 175, .13);
    --shadow: 0 22px 44px -28px rgba(0, 0, 0, .8);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
kbd { font: 11px/1 var(--sans); padding: 3px 6px; border-radius: 6px; background: var(--core2); border: 1px solid var(--line); color: var(--mute); }
.muted { color: var(--mute); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* lišta */
.bar { position: sticky; top: 0; z-index: 10; height: var(--bar); display: flex; align-items: center; gap: 16px; padding: 0 var(--gut); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 14px; height: 14px; border-radius: 5px; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.bar-date { color: var(--mute); font-size: 14px; white-space: nowrap; }
.bar-links { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.cmdk { display: flex; align-items: center; gap: 28px; min-height: 40px; padding: 0 8px 0 16px; border-radius: 999px; background: var(--core); border: 1px solid var(--line); color: var(--mute); cursor: pointer; transition: border-color .4s var(--ease); }
.cmdk:hover { border-color: var(--accent); }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--core); color: var(--ink); text-decoration: none; font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform .35s var(--ease), background .35s var(--ease), border-color .35s var(--ease); }
.pill:hover { border-color: var(--accent); }
.pill:active { transform: scale(.97); }
.pill.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill.ghost { background: transparent; }
.pill.small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.pill:disabled { opacity: .55; cursor: default; }
.login { margin: 40px auto; max-width: 360px; text-align: center; display: grid; gap: 14px; }

/* mřížka */
.grid { padding: 0 var(--gut) var(--gut); display: grid; gap: 12px; grid-template-columns: 1fr; }
.tile { border-radius: var(--r-shell); background: var(--shell); box-shadow: inset 0 0 0 1px var(--ring); padding: 5px; min-width: 0; min-height: 0; cursor: pointer; transition: transform .5s var(--ease), box-shadow .5s var(--ease); animation: rise .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
.tile:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.tile:focus-visible { outline-offset: 0; }
.core { height: 100%; min-height: 0; display: flex; flex-direction: column; border-radius: var(--r-core); background: var(--core); padding: 16px 18px 14px; overflow: hidden; position: relative; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.th { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex: none; }
.th h3 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.th .n { margin-left: auto; font-size: 13px; color: var(--mute); }
.tb { flex: 1; min-height: 0; overflow: hidden; -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent); mask-image: linear-gradient(#000 calc(100% - 22px), transparent); }
.tb.nomask { -webkit-mask-image: none; mask-image: none; }
.more { font-size: 13px; color: var(--mute); padding-top: 4px; }

/* řádky událostí */
.ev { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; }
.ev .w { white-space: nowrap; line-height: 1.35; font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.ev .t { font-weight: 550; overflow-wrap: anywhere; }
.ev button.t { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--core2); color: var(--ink2); white-space: nowrap; }
.chip.wait { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lead { font-size: 13px; color: var(--mute); margin: 6px 0 2px; }
.empty { color: var(--mute); padding: 6px 0 10px; }

/* schválení */
.ap { padding: 10px 12px; border-radius: var(--r-row); background: var(--core2); margin-bottom: 8px; }
.ap .t { font-weight: 600; overflow-wrap: anywhere; }
.ap .s { font-size: 13px; color: var(--mute); margin-top: 2px; }
.ap .acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* čísla a graf */
.big { font-size: clamp(28px, 2.6vw, 38px); font-weight: 680; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sub { font-size: 13px; color: var(--mute); margin-top: 4px; }
.tb.fill { display: flex; flex-direction: column; }
.spark { display: block; width: 100%; flex: 1; min-height: 60px; margin-top: 8px; }
.spark path.l { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark path.a { fill: var(--accent-soft); stroke: none; }
.spark circle { fill: var(--accent); }

/* týden */
.wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { text-align: center; padding: 6px 0 5px; border-radius: 10px; background: var(--core2); border: 0; cursor: pointer; }
.wd b { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wd span { font-size: 11px; color: var(--mute); text-transform: lowercase; }
.wd i { display: block; height: 6px; margin-top: 3px; }
.wd i::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.wd.none i::before { display: none; }
.wd.today { background: var(--accent); color: var(--accent-ink); }
.wd.today span { color: inherit; opacity: .85; }
.wd.today i::before { background: var(--accent-ink); }
.wd.wait i::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.wd.today.wait i::before { box-shadow: inset 0 0 0 1.5px var(--accent-ink); }

/* pošta a papíry */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pr { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); }
.pr:first-child { border-top: 0; }
.pr .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); align-self: center; }
.pr .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.pr .w { font-size: 12px; color: var(--mute); white-space: nowrap; }

/* zeptat se */
.askf { display: flex; flex-direction: column; gap: 10px; flex: 1; justify-content: flex-end; }
.askf .hint { color: var(--ink2); font-size: 14px; }
.askf .fieldrow { display: flex; gap: 8px; }
input[type=text], textarea { width: 100%; min-height: 42px; padding: 9px 14px; border-radius: var(--r-row); border: 1px solid var(--line); background: var(--core2); color: var(--ink); }
input[type=text]:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=file] { width: 100%; padding: 8px; border-radius: var(--r-row); border: 1px dashed var(--line); background: var(--core2); }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg button { font-size: 13px; padding: 4px 11px; border-radius: 999px; background: var(--core2); border: 0; color: var(--ink2); cursor: pointer; }
.sugg button:hover { background: var(--accent-soft); }

/* panel na celou plochu */
.panel { position: fixed; z-index: 20; inset: var(--bar) var(--gut) var(--gut); background: var(--bg); border-radius: var(--r-shell); }
.panel[hidden] { display: none; }
.panel-shell { height: 100%; border-radius: var(--r-shell); background: var(--shell); box-shadow: inset 0 0 0 1px var(--ring), var(--shadow); padding: 5px; backdrop-filter: none; }
.panel-core { height: 100%; border-radius: var(--r-core); background: var(--core); display: flex; flex-direction: column; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: none; }
.panel-head h2 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.panel-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 28px; }
.panel.open .panel-body > * { animation: rise .7s var(--ease) both; }
.cols { display: grid; gap: 22px; grid-template-columns: 1fr; max-width: 1400px; }
.sec h3 { font-size: 13px; font-weight: 650; color: var(--mute); margin: 0 0 8px; text-transform: none; letter-spacing: 0; }
.sec + .sec { margin-top: 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.lst { list-style: none; padding: 0; margin: 0; }
.lst li { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.lst li:first-child { border-top: 0; }
.lst .t { font-weight: 560; overflow-wrap: anywhere; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.lst .chip { margin-left: 10px; vertical-align: 2px; }
.lst .s { grid-column: 1; font-size: 13px; color: var(--mute); }
.lst .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
.day-h { font-size: 13px; font-weight: 650; color: var(--mute); margin: 18px 0 2px; }
.day-h:first-child { margin-top: 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 13px; }
.filters button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.search { max-width: 420px; margin-bottom: 12px; }

/* týdenní kalendář v panelu */
.wkbig { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wkbig { min-height: calc(100dvh - 250px); }
.wcol { background: var(--core2); border-radius: var(--r-row); padding: 10px; min-height: 160px; min-width: 0; }
.wcol.today { box-shadow: inset 0 0 0 2px var(--accent); }
.wcol h4 { margin: 0 0 8px; font-size: 13px; font-weight: 650; }
.wcol h4 span { color: var(--mute); font-weight: 500; }
.wev { display: block; width: 100%; text-align: left; border: 0; background: var(--core); border-radius: 9px; padding: 6px 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
.wev small { display: block; color: var(--mute); font-size: 12px; }
.wev.wait { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* majetek */
.chart { width: 100%; height: 220px; display: block; }
.chart path.l { fill: none; stroke: var(--accent); stroke-width: 2.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart path.a { fill: var(--accent-soft); }
.chart .ax { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.axl { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.stat { background: var(--core2); border-radius: var(--r-row); padding: 12px 14px; }
.stat b { display: block; font-size: 20px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--mute); }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 5px; }
.frm { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; }
.frm .fld { margin: 0; }
select, input[type=date], input[type=number] { width: 100%; min-height: 42px; padding: 8px 12px; border-radius: var(--r-row); border: 1px solid var(--line); background: var(--core2); color: var(--ink); font: inherit; }

/* odpověď */
.chat { display: grid; gap: 14px; max-width: 820px; }
.q { font-weight: 650; }
.a { background: var(--core2); border-radius: var(--r-row); padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.a.warn { box-shadow: inset 0 0 0 1.5px var(--accent); }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai { font-size: 12px; color: var(--mute); margin-top: 6px; }

/* detail papíru */
.detail { display: grid; gap: 22px; grid-template-columns: 1fr; max-width: 1300px; }
.viewer { border-radius: var(--r-row); background: var(--core2); overflow: hidden; min-height: 360px; }
.viewer iframe { width: 100%; height: 70vh; border: 0; background: #fff; display: block; }
.viewer img { width: 100%; display: block; }
.viewer pre { margin: 0; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }
details.txt { margin-top: 14px; }
details.txt summary { cursor: pointer; font-weight: 600; min-height: 34px; }
.tx { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: var(--ink2); max-height: 280px; overflow: auto; background: var(--core2); border-radius: var(--r-row); padding: 12px; margin-top: 6px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.dl dt { color: var(--mute); } .dl dd { margin: 0; font-weight: 550; }
.err { color: var(--ink); background: var(--core2); box-shadow: inset 0 0 0 1.5px var(--ink2); border-radius: var(--r-row); padding: 8px 12px; font-size: 14px; }

/* dialogy */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: 100vw; }
dialog::backdrop { background: rgba(9, 14, 18, .55); }
.sheet { width: min(520px, calc(100vw - 24px)); margin: auto; }
.sheet-in, .pal-in { border-radius: var(--r-shell); background: var(--core); padding: 22px; display: grid; gap: 12px; box-shadow: 0 0 0 5px var(--shell), 0 0 0 6px var(--ring), var(--shadow); }
.sheet-in h2 { font-size: 20px; letter-spacing: -.02em; }
.palette { width: min(640px, calc(100vw - 24px)); margin: 14vh auto auto; }
.pal-in { padding: 14px; gap: 10px; }
#palInput { min-height: 48px; font-size: 16px; }
#palList { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; }
#palList li { display: flex; gap: 12px; align-items: baseline; padding: 10px 12px; border-radius: var(--r-row); cursor: pointer; }
#palList li[aria-selected=true] { background: var(--accent-soft); }
#palList li small { margin-left: auto; color: var(--mute); font-size: 12px; white-space: nowrap; }
.pal-foot { font-size: 12px; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(520px, calc(100vw - 32px)); padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); animation: rise .5s var(--ease) both; }
.toast.bad { border-radius: 14px; }

/* jedna obrazovka 1440x900: bez posunu, bento */
@media (min-width: 1100px) and (min-height: 700px) {
  body { height: 100dvh; overflow: hidden; }
  .grid { height: calc(100dvh - var(--bar)); grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr); }
  .t-dnes { grid-column: 1 / 5; grid-row: 1 / 3; }
  .t-schv { grid-column: 5 / 9; grid-row: 1 / 3; }
  .t-maj { grid-column: 9 / 13; grid-row: 1; }
  .t-tyden { grid-column: 9 / 13; grid-row: 2; }
  .t-posta { grid-column: 1 / 4; grid-row: 3; }
  .t-papiry { grid-column: 4 / 9; grid-row: 3; }
  .t-ask { grid-column: 9 / 13; grid-row: 3; }
  .detail { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
@media (min-width: 700px) and (max-width: 1099px), (min-width: 1100px) and (max-height: 699px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-dnes, .t-schv { min-height: 340px; }
  .tile { min-height: 230px; }
}
@media (min-width: 900px) { .cols.two { grid-template-columns: 1fr 1fr; } }
@media (max-width: 699px) {
  :root { --gut: 12px; --bar: 56px; }
  .bar { gap: 8px; }
  .bar-date, .cmdk-txt, .cmdk kbd, .hide-s { display: none; }
  .cmdk { padding: 0 14px; gap: 0; }
  .cmdk::before { content: "Hledat"; font-weight: 550; color: var(--ink); font-size: 14px; }
  .tile { min-height: 220px; }
  .t-dnes, .t-schv { min-height: 300px; }
  .panel { inset: var(--bar) 0 0; }
  .panel-shell { border-radius: var(--r-shell) var(--r-shell) 0 0; }
  .panel-head { flex-wrap: wrap; gap: 8px; padding: 12px; }
  .panel-head h2 { font-size: 18px; order: 2; width: 100%; }
  .panel-tools { order: 1; }
  .panel-body { padding: 14px 14px 40px; }
  .wkbig { grid-template-columns: 1fr; }
  .wkbig { min-height: 0; }
  .wcol { min-height: 0; }
  .stats { grid-template-columns: 1fr; }
  .frm { grid-template-columns: 1fr 1fr; }
  .viewer iframe { height: 60vh; }
  .lst li { grid-template-columns: 1fr; }
  .lst .acts { grid-column: 1; grid-row: auto; }
  .ev { grid-template-columns: 48px 1fr; }
  .ev .chip { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
