/* Sindat Finanční report: base, typography, app shell */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--fs-xl); line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-md); line-height: 1.3; font-weight: 620; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-body); line-height: 1.35; font-weight: 600; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-4) 0; }
::selection { background: var(--navy-100); }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-xs); }
svg :focus-visible { box-shadow: none; outline: 2px solid var(--navy-500); outline-offset: 1px; }

.num, .tnum { font-variant-numeric: tabular-nums lining-nums; }
.pnum { font-variant-numeric: proportional-nums lining-nums; }
.muted { color: var(--text-3); }
.serif { font-family: var(--font-serif); font-weight: 600; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.eyebrow {
  font-size: var(--fs-xs); line-height: 1.3; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
[hidden] { display: none !important; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--paper); color: var(--text); box-shadow: var(--shadow-pop); transition: top var(--t-fast);
}
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- shell */
.app { position: relative; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.app::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--side-w); background: var(--navy-700); }
:root[data-theme="dark"] .app::before { background: #0a2a5c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .app::before { background: #0a2a5c; } }

.side {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text); z-index: 30;
}
.side-brand { display: flex; flex-direction: column; gap: 10px; padding: 28px 24px 26px; }
.side-brand a { display: inline-block; width: max-content; border-radius: 4px; }
.side-logo { height: 22px; width: auto; }
.side-product {
  font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--side-muted); font-weight: 600;
}
.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; }
.side-nav .nav-label {
  padding: 18px 12px 6px; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--side-muted); font-weight: 600;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px;
  border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; font-size: 14px;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--side-hover); color: var(--side-text-strong); text-decoration: none; }
.nav-item .ic { width: 18px; height: 18px; flex: none; opacity: 0.86; }
.nav-item[aria-current="page"] { background: var(--side-active); color: var(--side-text-strong); font-weight: 600; }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber-500);
}
.nav-item[aria-current="page"] .ic { opacity: 1; }
.nav-item:focus-visible { box-shadow: 0 0 0 2px var(--amber-500); }

.side-foot { padding: 16px 12px 16px; border-top: 1px solid var(--side-line); display: flex; flex-direction: column; gap: 10px; }
.side-fresh { display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 12.5px; color: var(--side-muted); }
.side-fresh .dot { width: 7px; height: 7px; border-radius: 50%; background: #4ad39a; box-shadow: 0 0 0 3px rgba(74, 211, 154, 0.18); flex: none; }
.side-fresh b { color: var(--side-text-strong); font-weight: 600; }

.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--side-text-strong); text-align: left;
}
.user-btn:hover { background: var(--side-hover); }
.user-btn:focus-visible { box-shadow: 0 0 0 2px var(--amber-500); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 12px; font-weight: 650; letter-spacing: 0.02em;
}
.user-btn .u-name { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.user-btn .u-role { display: block; font-size: 12px; color: var(--side-muted); line-height: 1.25; }
.user-btn .ic { margin-left: auto; width: 16px; height: 16px; opacity: 0.7; }

.main { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
  padding: 18px 40px 16px; min-height: var(--topbar-h);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color var(--t-med), box-shadow var(--t-med);
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.tb-title { min-width: 0; flex: 1 1 260px; }
.tb-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { margin-top: 2px; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-actions { display: flex; align-items: center; gap: 8px; }
.tb-actions:empty { display: none; }

.content { width: 100%; max-width: calc(var(--content-max) + 80px); margin: 0 auto; padding: 8px 40px 56px; outline: none; }

/* mobile header (hidden on desktop) */
.mhead { display: none; }

/* layout helpers */
.stack { display: flex; flex-direction: column; gap: var(--gutter); }
.grid { display: grid; gap: var(--gutter); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; } .col-5 { grid-column: span 5; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

@media (max-width: 1180px) {
  .topbar { padding: 16px 28px 14px; }
  .content { padding: 8px 28px 48px; }
  .col-3 { grid-column: span 6; }
  .col-4 { grid-column: span 6; }
  .col-5, .col-7 { grid-column: span 12; }
}

@media (max-width: 899px) {
  :root { --gutter: 16px; }
  .app { display: block; }
  .app::before { display: none; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; bottom: 0;
    transform: translateX(-102%); transition: transform var(--t-med) var(--ease); box-shadow: none;
  }
  .app.nav-open .side { transform: none; box-shadow: 24px 0 48px -12px rgba(0, 0, 0, 0.4); }
  .mhead {
    position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 8px;
    height: 56px; padding: 0 8px 0 4px; background: var(--navy-900); color: #fff;
  }
  .mhead .logo { height: 17px; width: auto; }
  .mhead .icon-btn { color: #fff; }
  .mhead .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
  .mhead .mh-title { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); font-weight: 600; margin-left: 4px; }
  .mhead .mh-more { margin-left: auto; }
  .topbar {
    position: static; padding: 18px 16px 6px; gap: 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: transparent;
  }
  .tb-title { flex-basis: 100%; }
  .tb-title h1 { font-size: 21px; white-space: normal; }
  .tb-controls { width: 100%; gap: 8px; }
  .tb-controls:empty, .tb-controls:not(:has(> :not(.tb-theme))) { display: none; }
  /* theme toggle and exports move to the "..." menu in the navy header: at most two rows of controls */
  .tb-controls .tb-theme, .tb-actions { display: none; }
  .content { padding: 8px 16px 40px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid > [class*="col-"] { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
.ic { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- browser print (any page)
   Shell chrome is hidden and the content flows on white paper. Paper is always light, also when the screen uses the
   dark theme (the triple :root beats both dark-theme selectors in tokens.css). The Report page adds its own rules. */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  :root:root:root {
    color-scheme: light;
    --navy-100: #e7effb; --navy-50: #f3f7fd; --amber-100: #fbf1d6;
    --ink-900: #101828; --ink-700: #344054; --ink-500: #5d6679; --ink-400: #98a2b3; --ink-300: #d0d5dd; --ink-200: #e4e7ec; --ink-100: #f2f4f7;
    --canvas: #ffffff; --paper: #ffffff; --paper-2: #f8f9fb; --paper-sunk: #eef1f5; --line: #e6e9ef; --line-strong: #d3d8e0;
    --hover: transparent; --press: transparent; --link: #06459b;
    --c-actual: #1d5fc9; --c-actual-wash: rgba(29, 95, 201, 0.10); --c-forecast: #c48a0c; --c-forecast-wash: rgba(196, 138, 12, 0.12);
    --c-budget: #8b95a7; --c-budget-wash: rgba(139, 149, 167, 0.16); --c-total: #06459b; --c-grid: #edf0f4; --c-axis: #c9cfd8;
    --cat-1: #1d5fc9; --cat-2: #0b9a8d; --cat-3: #7c4dce; --cat-4: #d0587e; --cat-5: #6da7ec;
    --good: #0e7a55; --good-bg: #e6f5ee; --bad: #c2372c; --bad-bg: #fdecea; --warn: #b54708; --warn-bg: #fef0c7;
    --info: #06459b; --info-bg: #e7effb;
    --shadow-card: none; --shadow-pop: none;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  body { background: #fff !important; min-height: 0; }
  .app { display: block; min-height: 0; }
  .app::before, .side, .mhead, .skip, .tip, .toasts, .scrim, .popover, .drawer, .tb-controls, .tb-actions { display: none !important; }
  .topbar { position: static; min-height: 0; padding: 0 0 4mm; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; }
  .content { max-width: none; padding: 0; margin: 0; }
  .card { box-shadow: none; }
  .card.kpi, .card-head { break-inside: avoid; }
  .grid { gap: 4mm; }
}
