@import url("/assets/fonts/fonts.css");

/* ===========================================================================
   Fakturace panz.cz

   Barvy, fonty a radiusy jsou prevzate 1:1 z panz.cz (src/styles/global.css),
   aby oba weby vypadaly jako jedna rodina. Meritko je ale jine: panz.cz je
   marketingovy web s 88px sekcemi a 48px tlacitky, tohle je hustý nastroj,
   kde musi byt citelna tabulka o dvaceti radcich.

   Tmave tema je vychozi, stejne jako na panz.cz.
   =========================================================================== */

:root {
  color-scheme: dark;

  --page: #0a1328;
  --surface: #111e42;
  --surface-soft: #18264e;
  --ink: #eef2fb;
  --ink-2: #c7d2ec;
  --muted: #a6b4d6;
  --faint: #6f80a8;
  --line: #25406e;
  --line-strong: #36537f;

  --accent: #2f8cf5;
  --accent-strong: #7bb4ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 140, 245, 0.16);
  --accent-line: #34507f;

  --mint: #25d3a0;
  --label: #25d3a0;

  --ok: #25d3a0;
  --ok-soft: rgba(37, 211, 160, 0.14);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.14);
  --bad: #ff7a6b;
  --bad-soft: rgba(255, 122, 107, 0.14);

  --shadow: 0 16px 38px rgba(1, 5, 18, 0.45);
  --shadow-strong: 0 26px 58px rgba(1, 5, 18, 0.7);

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 15px;
  --radius-xl: 22px;

  --sans: "Source Sans 3", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --disp: "Space Grotesk", "Source Sans 3", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --rail: 236px;
}

:root[data-theme="light"] {
  color-scheme: light;

  --page: #f5f8fd;
  --surface: #ffffff;
  --surface-soft: #eef3fb;
  --ink: #0f1b33;
  --ink-2: #2c3d63;
  --muted: #50607d;
  --faint: #8492ac;
  --line: #e1e8f3;
  --line-strong: #ccd8ea;

  --accent: #2f7ff0;
  --accent-strong: #1450a8;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 127, 240, 0.1);
  --accent-line: #a9c6ee;

  --mint: #0f9f78;
  --label: #0a7d5d;

  --ok: #0c8a66;
  --ok-soft: rgba(37, 211, 160, 0.18);
  --warn: #8a5a06;
  --warn-soft: rgba(240, 180, 41, 0.2);
  --bad: #c03a2f;
  --bad-soft: rgba(255, 122, 107, 0.18);

  --shadow: 0 1px 2px rgba(10, 19, 40, 0.05), 0 10px 28px -14px rgba(10, 19, 40, 0.25);
  --shadow-strong: 0 14px 44px -12px rgba(10, 19, 40, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--disp);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p { margin: 0; }
a { color: var(--accent); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Cisla v tabulkach musi byt pod sebou zarovnana, jinak se castky spatne ctou. */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: 10px 16px; background: var(--accent); color: #fff; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- layout - */

.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 12px 28px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand .mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--accent); border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--disp); font-weight: 700; font-size: 15px;
  transform: rotate(-4deg);
}
.brand b { display: block; font-family: var(--disp); font-size: 16px; font-weight: 600; line-height: 1.2; }
.brand span { color: var(--muted); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }

.navgroup { display: flex; flex-direction: column; gap: 2px; }
.navlabel {
  padding: 0 8px 6px;
  color: var(--label); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border: 0; border-radius: 7px; background: none;
  color: var(--ink-2); font-size: 13.5px; text-align: left; text-decoration: none;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; opacity: 0.35; }
.nav-item[aria-current="page"] .dot { opacity: 1; }
.nav-item .tag {
  margin-left: auto; padding: 1px 6px;
  border-radius: 20px; background: var(--bad-soft); color: var(--bad);
  font-size: 10.5px; font-variant-numeric: tabular-nums;
}

.rail-foot { margin-top: auto; padding: 0 8px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; font-weight: 600; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }

.menu-btn { display: none; }

.content { display: flex; flex-direction: column; gap: 20px; padding: 24px 28px 64px; }

/* ------------------------------------------------------------ primitivy - */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: inherit;
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-soft); color: var(--ink); border-color: transparent; }
.btn.bad { border-color: var(--bad); color: var(--bad); }
.btn.bad:hover { background: var(--bad-soft); }
.btn.sm { padding: 4px 9px; border-radius: var(--radius-sm); font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 14.5px; font-weight: 600; }
.panel-head .hint { color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface-soft); color: var(--muted);
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge i { display: block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* -------------------------------------------------------------- tabulky - */

.tablewrap { overflow-x: auto; }
table.t { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; }
table.t th {
  padding: 9px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
table.t td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: var(--surface-soft); }
table.t a.row-link { color: inherit; text-decoration: none; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.sub2 { color: var(--muted); font-size: 11.5px; }

.prazdno { padding: 34px 16px; color: var(--muted); text-align: center; }
.prazdno b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 14px; }

/* ------------------------------------------------------------ formulare - */

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 7px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 13px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field input[readonly] { opacity: 0.7; cursor: default; }
.field .napoveda { color: var(--faint); font-size: 11px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.rada { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.switchrow {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.switchrow:last-child { border-bottom: 0; }
.switchrow .txt { flex: 1; min-width: 0; }
.switchrow .txt b { display: block; font-size: 13.5px; font-weight: 600; }
.switchrow .txt span { color: var(--muted); font-size: 12px; }

.sw {
  position: relative; flex: none;
  width: 38px; height: 22px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 20px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted);
  transition: transform 150ms, background 150ms;
}
.sw[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.sw[aria-pressed="true"]::after { transform: translateX(16px); background: var(--accent-ink); }

.segbar {
  display: inline-flex; gap: 2px; flex-wrap: wrap;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line); border-radius: 9px;
}
.segbar a, .segbar button {
  padding: 5px 11px;
  border: 0; border-radius: 7px; background: none;
  color: var(--muted); font-size: 12.5px; text-decoration: none;
  cursor: pointer;
}
.segbar [aria-pressed="true"], .segbar [aria-current="true"] {
  background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow);
}

.search {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.search input { width: 170px; padding: 0; border: 0; background: none; font-size: 13px; }
.search input:focus { outline: none; }

/* ------------------------------------------------------------------ KPI - */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi {
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.kpi .k-label {
  color: var(--label); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.kpi .k-val {
  margin-top: 6px;
  font-family: var(--disp); font-size: 27px; font-weight: 600;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.kpi .k-val small { margin-left: 3px; color: var(--muted); font-size: 15px; font-weight: 500; }
.kpi .k-note { margin-top: 4px; color: var(--muted); font-size: 12px; }
.kpi.attn { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.kpi.attn .k-val { color: var(--bad); }

/* --------------------------------------------------------------- seznam - */

.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 11px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .li-main { flex: 1; min-width: 0; }
.li .li-main b { display: block; overflow: hidden; font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.li .li-main span { color: var(--muted); font-size: 11.5px; }
.sev { width: 3px; flex: none; align-self: stretch; border-radius: 2px; background: var(--line-strong); }
.sev.bad { background: var(--bad); }
.sev.warn { background: var(--warn); }
.sev.ok { background: var(--ok); }

/* ---------------------------------------------------------- graf a meter - */

.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--sans); font-size: 10px; }
.chart .vlab { font-size: 9.5px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); }

.meter { height: 9px; overflow: hidden; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter i.warn { background: var(--warn); }
.meter i.bad { background: var(--bad); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- hlasky - */

.zpravy { display: flex; flex-direction: column; gap: 8px; }
.zprava {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); font-size: 13px;
}
.zprava.uspech { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.zprava.chyba { border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.zprava.varovani { border-color: transparent; background: var(--warn-soft); color: var(--warn); }
.zprava.info { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink-2); }

.toastwrap {
  position: fixed; left: 50%; bottom: 26px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  transform: translateX(-50%); pointer-events: none;
}
.toast {
  max-width: min(460px, 90vw); padding: 9px 15px;
  background: var(--ink); color: var(--page);
  border-radius: var(--radius); box-shadow: var(--shadow-strong);
  font-size: 13px;
  animation: rise 250ms ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------- drawer a modal - */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 8, 20, 0.55);
  opacity: 0; pointer-events: none;
  transition: opacity 180ms;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  display: flex; flex-direction: column;
  width: min(560px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-strong);
  transform: translateX(101%);
  transition: transform 220ms cubic-bezier(0.3, 0.7, 0.3, 1);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 17px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.drawer-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ prihlaseni - */

.login-page {
  display: grid; place-items: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--page);
}
.login-box { width: min(420px, 100%); }
.login-box .brand { justify-content: center; margin-bottom: 22px; }
.login-card {
  padding: 26px;
  background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
}
.login-card h1 { margin-bottom: 4px; font-size: 21px; font-weight: 600; }
.login-card .lead { margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.login-card .field + .field { margin-top: 14px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 10px 16px; }
.login-pod { margin-top: 16px; color: var(--faint); font-size: 11.5px; text-align: center; line-height: 1.5; }

.kod-vstup {
  width: 100%; padding: 12px;
  font-family: var(--mono); font-size: 24px; letter-spacing: 0.3em; text-align: center;
}

/* ------------------------------------------------------------- responzive */

@media (max-width: 980px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 80;
    width: 270px; height: 100dvh;
    transform: translateX(-102%);
    transition: transform 240ms cubic-bezier(0.3, 0.7, 0.3, 1);
    box-shadow: var(--shadow-strong);
  }
  body.nav-open .rail { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

@media print {
  .rail, .topbar, .toastwrap, .btn { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .panel { border: 1px solid #ccc; box-shadow: none; }
}
