@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-wdth-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --surface: #F5F6F8; --panel: #FFFFFF; --tint: #E6EAF0; --ink: #0A0C14; --ink-soft: #4A4F5E;
  --accent: #C7351B; --accent-strong: #A32A13; --highlight: #F0BF2E; --line: #DEDFE1;
  --ok: #1F7A45; --ok-bg: #E3F3E8; --warn-bg: #FBEAE6;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0D0F16; --panel: #161925; --tint: #222738; --ink: #ECEEF3; --ink-soft: #A3A8B8;
    --accent: #F06A4F; --accent-strong: #FF8A72; --line: #2A2F40; --ok: #6FD39A; --ok-bg: #16301F; --warn-bg: #3A1D17;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 15px/1.5 Archivo, "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.3rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.015em; margin: 0 0 0.7em; display: flex; align-items: center; gap: 0.5em; }
p { margin: 0 0 0.8em; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
main.login { display: grid; place-items: center; min-height: 100vh; padding-top: 0; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; background: var(--ink); color: var(--surface); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.03em; text-decoration: none; color: inherit; }
.brand b { color: var(--accent); }
.brand span { font-weight: 500; opacity: 0.7; letter-spacing: 0; font-size: 0.85em; margin-left: 4px; }
.brand.big { font-size: 1.6rem; margin-bottom: 18px; }
.bar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.bar nav a, .bar nav .link { color: inherit; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; }
.bar nav a.on { background: color-mix(in srgb, var(--surface) 16%, transparent); }
.bar nav form { margin: 0; }
@media (prefers-color-scheme: dark) { .bar { background: #05060A; color: var(--ink); border-bottom: 1px solid var(--line); } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.narrow { width: min(420px, 100%); }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.count { background: var(--tint); border-radius: 99px; padding: 0 8px; font-size: 0.8rem; font-weight: 700; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.head h2 { margin: 0 0 0.7em; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--ink); color: var(--surface); border: 0; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { background: var(--accent-strong); color: #fff; }
.button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.button.ghost:hover { color: var(--accent-strong); box-shadow: inset 0 0 0 1.5px var(--accent-strong); background: transparent; }
.button.wide { width: 100%; padding: 12px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link.danger { color: var(--accent-strong); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 0.9rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: grid; gap: 6px; }
legend { font-weight: 700; font-size: 0.9rem; padding: 0 4px; }
.stack { display: grid; gap: 12px; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inline input:not([type=date]):not([type=time]) { flex: 1 1 180px; }
.inline input[type=date], .inline input[type=time] { width: auto; }
.inline-form { display: inline; margin-left: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.item { display: grid; grid-template-columns: 1fr 110px 150px; gap: 10px; }
details summary { cursor: pointer; color: var(--ink-soft); margin-top: 10px; }
pre { white-space: pre-wrap; font: inherit; font-size: 0.92rem; margin: 8px 0 0; padding: 10px 12px; background: var(--surface); border-radius: 8px; }

.warn { background: var(--warn-bg); color: var(--accent-strong); padding: 8px 12px; border-radius: 8px; }
.ok { background: var(--ok-bg); color: var(--ok); padding: 8px 12px; border-radius: 8px; }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--tint); white-space: nowrap; }
.tag.red, .inv-stornovana { background: var(--warn-bg); color: var(--accent-strong); }
.inv-zaplacena { background: var(--ok-bg); color: var(--ok); }
.inv-vystavena { background: color-mix(in srgb, var(--highlight) 35%, var(--panel)); color: var(--ink); }

.funnel { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.funnel a { text-decoration: none; padding: 6px 11px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 0.9rem; white-space: nowrap; }
.funnel a b { margin-left: 3px; }
.funnel a.empty { color: var(--ink-soft); opacity: 0.7; }
.funnel a.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.funnel a.strong { font-weight: 700; }
.search input { max-width: 420px; margin-bottom: 14px; }

.list { display: grid; gap: 8px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.row:hover { border-color: var(--ink-soft); color: inherit; }
.row .main { display: grid; min-width: 0; }
.row .main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stage { font-size: 0.8rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--tint); white-space: nowrap; }
.stage.s4, .stage.s5, .stage.s6 { background: color-mix(in srgb, var(--highlight) 45%, var(--panel)); }
.stage.s7, .stage.s8 { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); color: var(--accent-strong); }
.stage.s9 { background: var(--ok-bg); color: var(--ok); }
.stage.s10 { opacity: 0.6; }

.today { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.tasks, .plain, .timeline { list-style: none; margin: 0; padding: 0; }
.tasks li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.tasks li:last-child { border-bottom: 0; }
.tasks li > div { flex: 1; min-width: 0; }
.tasks li form { margin: 0; }
.tasks li.late > div > a, .tasks li.late > div { color: var(--accent-strong); }
.tasks li.done { opacity: 0.6; }
.tick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink-soft); background: transparent; color: transparent; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; flex: none; display: inline-grid; place-items: center; }
.tick:hover { color: var(--ok); border-color: var(--ok); }
.tick.on { color: #fff; background: var(--ok); border-color: var(--ok); }
.plain li { padding: 5px 0; }

.firm { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.firm .muted { margin: 0; }
.firm h1 { margin-bottom: 0.3em; }
.links { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 0; font-size: 0.92rem; }
.links span { color: var(--ink-soft); }
.stagepick { display: flex; gap: 8px; align-items: flex-end; }
.stagepick select { min-width: 220px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; align-items: start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 10px; font-size: 0.92rem; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; }
.timeline li { display: grid; grid-template-columns: 92px 120px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.timeline .kind, .event .kind { font-weight: 700; }
.timeline details summary { margin: 0; color: var(--ink); }
.timeline li.ev-email-prijaty .kind, .timeline li.ev-odpoved .kind { color: var(--accent-strong); }
.timeline li.ev-poznamka .text { white-space: pre-wrap; }
.drafts .event summary { margin: 6px 0; color: var(--ink); }
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); border-bottom: 1px solid var(--ink); padding: 6px 8px 6px 0; }
.table td { border-bottom: 1px solid var(--line); padding: 9px 8px 9px 0; vertical-align: top; }
.num { text-align: right; white-space: nowrap; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .two, .item { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .row { flex-direction: column; align-items: flex-start; }
  .row .side { justify-content: flex-start; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 2px 0; }
  .num { text-align: left; }
  .stagepick select { min-width: 0; }
}
