/* ============================================================
   Fakturace online — Design system
   Tokens, light/dark themes, component library
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: var(--primary-soft); color: var(--primary-text); }

/* ---------- Tokens: LIGHT ---------- */
:root, [data-theme="light"] {
  --bg: #F5F7FB;
  --bg-2: #EEF1F7;
  --surface: #FFFFFF;
  --surface-2: #FBFCFE;
  --surface-3: #F4F6FA;
  --border: #E7EBF1;
  --border-strong: #D6DCE6;
  --text: #0F1726;
  --text-2: #5A6677;
  --text-3: #8C97A6;
  --text-inv: #FFFFFF;

  --primary: #2563EB;
  --primary-hover: #1D54D4;
  --primary-press: #1A49BC;
  --primary-soft: #E9F0FE;
  --primary-soft-2: #DBE7FD;
  --primary-text: #1D4FD7;
  --on-primary: #FFFFFF;

  --green: #16A34A; --green-soft: #E5F6EC; --green-text: #15803D;
  --amber: #E08600; --amber-soft: #FDF0DC; --amber-text: #B45309;
  --red: #DC2626; --red-soft: #FCEBEB; --red-text: #C2261F;
  --gray: #64748B; --gray-soft: #EDF0F4; --gray-text: #475467;
  --violet: #7C3AED; --violet-soft: #F0E9FE; --violet-text: #6D28D9;

  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.05);
  --shadow: 0 2px 4px -2px rgba(16,24,40,.06), 0 4px 12px -2px rgba(16,24,40,.07);
  --shadow-lg: 0 12px 28px -8px rgba(16,24,40,.16), 0 4px 10px -4px rgba(16,24,40,.08);
  --shadow-pop: 0 16px 40px -12px rgba(16,24,40,.22);
  --ring: 0 0 0 4px rgba(37,99,235,.14);

  --chart-grid: #EEF1F6;
}

/* ---------- Tokens: DARK ---------- */
[data-theme="dark"] {
  --bg: #0A0E16;
  --bg-2: #070A11;
  --surface: #111826;
  --surface-2: #151D2D;
  --surface-3: #1A2334;
  --border: #232D3F;
  --border-strong: #303C52;
  --text: #E9EDF4;
  --text-2: #94A0B2;
  --text-3: #66728499;
  --text-3: #687589;
  --text-inv: #0F1726;

  --primary: #3B82F6;
  --primary-hover: #4B8DF7;
  --primary-press: #2F74E8;
  --primary-soft: #16233D;
  --primary-soft-2: #1B2C4C;
  --primary-text: #7DAAFB;
  --on-primary: #FFFFFF;

  --green: #22C55E; --green-soft: #102A1C; --green-text: #4ADE80;
  --amber: #F59E0B; --amber-soft: #2C1F0C; --amber-text: #FBBF24;
  --red: #F05252; --red-soft: #2E1414; --red-text: #FB7B7B;
  --gray: #94A0B2; --gray-soft: #1B2330; --gray-text: #AEB9C8;
  --violet: #A78BFA; --violet-soft: #1F1733; --violet-text: #C4B5FD;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
  --shadow: 0 2px 8px -2px rgba(0,0,0,.5), 0 8px 20px -6px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 36px -10px rgba(0,0,0,.6);
  --shadow-pop: 0 20px 48px -12px rgba(0,0,0,.7);
  --ring: 0 0 0 4px rgba(59,130,246,.25);

  --chart-grid: #1C2636;
}

/* ---------- Typography helpers ---------- */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: 'JetBrains Mono', monospace; }
.h1 { font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.h3 { font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* ============================================================
   App shell
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 252px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(150deg, var(--primary) 0%, #4F46E5 100%);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 10px -2px rgba(37,99,235,.4);
}
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: -.02em; white-space: nowrap; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--text-3); font-weight: 600; margin-top: -1px; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-group-label { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); padding: 16px 10px 8px; margin-top: 12px; border-top: 1px solid var(--border); }
.nav-group-label:first-of-type { margin-top: 2px; border-top: none; padding-top: 6px; }
.nav-group-toggle { display: flex; align-items: center; gap: 6px; width: 100%; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); padding: 16px 10px 8px; margin-top: 12px; background: none; border: none; border-top: 1px solid var(--border); cursor: pointer; text-align: left; }
.nav-group-toggle:hover { opacity: .82; }
.nav-group-chev { color: var(--text-3); display: flex; transition: transform .15s; }
.nav-group.open .nav-group-chev { transform: rotate(90deg); }
.nav-group-collapsible:not(.open) .nav-group-items { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8.5px 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
  width: 100%; text-align: left; position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); }
.nav-item.active svg { color: var(--primary); }
.nav-item svg { color: var(--text-3); flex-shrink: 0; }
.nav-item.active svg { color: var(--primary); }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--red); color:#fff; border-radius: 999px;
  min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center;
}
.nav-item.active .nav-badge { background: var(--red); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border-radius: 10px; transition: background .12s;
}
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  color: #fff; background: linear-gradient(150deg, #2563EB, #7C3AED);
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; border-radius: 7px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; border-radius: 11px; }
.avatar.neutral { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); font-weight: 700; }

/* ---------- Main column ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; flex-shrink: 0;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; width: 340px; max-width: 42vw;
  color: var(--text-3); transition: border .14s, background .14s;
}
.search:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: var(--ring); }
.search input { border: none; background: none; outline: none; width: 100%; color: var(--text); font-size: 13.5px; }
.search kbd {
  font-family: inherit; font-size: 11px; font-weight: 700; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; margin-left: auto;
}
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  color: var(--text-2); position: relative; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 999px; background: var(--red); border: 2px solid var(--surface); }

.content { padding: 26px 28px 60px; max-width: 1320px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 0; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.025em; }
.page-sub { color: var(--text-2); margin-top: 3px; font-size: 14px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border: 1px solid transparent; transition: background .12s, border .12s, box-shadow .12s, transform .04s;
}
.btn:active { transform: translateY(.5px); }
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-press); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger-soft { background: var(--red-soft); color: var(--red-text); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--red-soft) 70%, var(--red) 30%); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-sm);
}
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-head .grow { flex: 1; min-width: 0; }
.card-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.card-body { padding: 18px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 17px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stat-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.stat-val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-val small { font-size: 15px; font-weight: 700; color: var(--text-2); }
.stat-meta { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.trend.up { color: var(--green-text); }
.trend.down { color: var(--red-text); }

/* ============================================================
   Badges / status pills
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: -.005em; white-space: nowrap;
}
.pill .dotc { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill.green { background: var(--green-soft); color: var(--green-text); }
.pill.amber { background: var(--amber-soft); color: var(--amber-text); }
.pill.red { background: var(--red-soft); color: var(--red-text); }
.pill.gray { background: var(--gray-soft); color: var(--gray-text); }
.pill.blue { background: var(--primary-soft); color: var(--primary-text); }
.pill.violet { background: var(--violet-soft); color: var(--violet-text); }
.tag { display:inline-flex; align-items:center; gap:6px; height:22px; padding:0 8px; border-radius:6px; font-size:11.5px; font-weight:700; background:var(--surface-3); color:var(--text-2); border:1px solid var(--border); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-2);
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text-2); }
.tbl th .th-in { display: inline-flex; align-items: center; gap: 5px; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.cell-strong { font-weight: 700; }
.row-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s; }
tr:hover .row-actions { opacity: 1; }
.mini-btn { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: background .1s, color .1s; }
.mini-btn:hover { background: var(--surface-3); color: var(--text); }
.mini-btn.danger:hover { background: var(--red-soft); color: var(--red-text); }

.checkbox-cell { width: 18px; }

/* ---------- Filter bar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg a { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); display:inline-flex; align-items:center; gap:7px; text-decoration:none; white-space:nowrap; }
.seg button:hover, .seg a:hover { color: var(--text); }
.seg button.on, .seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.seg button .cnt, .seg a .cnt { font-size: 11px; font-weight: 700; background: var(--bg-2); padding: 0 6px; border-radius: 999px; color: var(--text-3); }
.seg button.on .cnt, .seg a.on .cnt { background: var(--primary-soft); color: var(--primary-text); }

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--red); }
.hint { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 12px; font-size: 13.5px; color: var(--text);
  transition: border .14s, box-shadow .14s; outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
.input:disabled { background: var(--surface-3); color: var(--text-3); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238C97A6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px;
}
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-strong); border-left: none; border-radius: 0 10px 10px 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.input.has-pre { padding-left: 0; }
.input-affix { display:flex; align-items:center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; overflow:hidden; transition: border .14s, box-shadow .14s; }
.input-affix:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.input-affix .pre { padding: 0 2px 0 12px; color: var(--text-3); font-weight:600; }
.input-affix input { border:none; outline:none; background:none; padding: 9px 12px; width:100%; font-size:13.5px; }
.input-affix .suf { padding: 0 12px; color: var(--text-3); font-weight:600; white-space:nowrap; }

/* checkbox / radio / switch */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; font-weight: 500; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.box {
  width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--border-strong);
  background: var(--surface); display: grid; place-items: center; transition: all .12s; flex-shrink: 0; color: #fff;
}
.check input:checked + .box { background: var(--primary); border-color: var(--primary); }
.check input:focus-visible + .box { box-shadow: var(--ring); }
.box svg { opacity: 0; transform: scale(.6); transition: all .12s; }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.radio .box { border-radius: 999px; }
.radio .box::after { content:''; width: 8px; height: 8px; border-radius: 999px; background:#fff; opacity:0; transform: scale(.4); transition: all .12s; }
.radio input:checked + .box { background: var(--primary); border-color: var(--primary); }
.radio input:checked + .box::after { opacity: 1; transform: scale(1); }
.switch { display: inline-block; vertical-align: middle; position: relative; width: 44px; height: 24px; border-radius: 999px; background: #b3bdd0; border: 1px solid #97a3bb; transition: background .16s, border-color .16s; flex-shrink: 0; }
.switch::after { content:''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .16s; }
.check input:checked + .switch { background: var(--primary); border-color: var(--primary); }
.check input:checked + .switch::after { transform: translateX(20px); }

/* ============================================================
   Notifications / toasts
   ============================================================ */
.alert { display: flex; gap: 12px; padding: 13px 15px; border-radius: 12px; border: 1px solid; align-items: flex-start; }
.alert .ai { flex-shrink: 0; margin-top: 1px; }
.alert .at { font-weight: 700; font-size: 13.5px; }
.alert .ad { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.alert.success { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.alert.success .ai, .alert.success .at { color: var(--green-text); }
.alert.error { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 22%, transparent); }
.alert.error .ai, .alert.error .at { color: var(--red-text); }
.alert.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 22%, transparent); }
.alert.warn .ai, .alert.warn .at { color: var(--amber-text); }
.alert.info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 22%, transparent); }
.alert.info .ai, .alert.info .at { color: var(--primary-text); }

.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-pop); min-width: 280px;
  animation: toastIn .26s cubic-bezier(.2,.9,.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast .ti { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }

/* ============================================================
   Modal / dialog
   ============================================================ */
.overlay { position: fixed; inset: 0; background: rgba(8,12,20,.5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 24px; animation: fade .16s; }
.overlay[hidden] { display: none; }
[data-theme="dark"] .overlay { background: rgba(0,0,0,.62); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-pop); width: 100%; max-width: 440px; animation: pop .2s cubic-bezier(.2,.9,.3,1); overflow: hidden; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
.modal.wide { max-width: 620px; }
.modal-head { padding: 20px 22px 0; }
.modal-body { padding: 14px 22px 8px; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 22px 20px; }
.modal-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }

/* ============================================================
   Misc
   ============================================================ */
.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.vdiv { width: 1px; background: var(--border); align-self: stretch; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.gap6{gap:6px}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap16{gap:16px}.gap20{gap:20px}.gap24{gap:24px}
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.center { align-items: center; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt20{margin-top:20px}.mt24{margin-top:24px}
.mb4{margin-bottom:4px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}.mb20{margin-bottom:20px}.mb24{margin-bottom:24px}
.tr{text-align:right}.tc{text-align:center}
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ei { width: 56px; height: 56px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-3); }

.dropdown { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; min-width: 190px; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; width: 100%; text-align: left; color: var(--text); transition: background .1s; }
.dd-item:hover { background: var(--surface-3); }
.dd-item.danger { color: var(--red-text); }
.dd-item.danger:hover { background: var(--red-soft); }
.dd-item svg { color: var(--text-3); }
.dd-item.danger svg { color: var(--red-text); }
.dd-sep { height: 1px; background: var(--border); margin: 5px 0; }

.kbd { font-family:'JetBrains Mono',monospace; font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

/* progress */
.bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

/* avatar group */
.av-group { display: inline-flex; }
.av-group .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.av-group .avatar:first-child { margin-left: 0; }

/* skeleton scrollbar nicety */
.nav::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { height: 8px; width: 8px; }
.nav::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ============================================================
   Mobile
   ============================================================ */
.menu-btn, .mobile-only { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .24s cubic-bezier(.3,.9,.3,1); box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(8,12,20,.45); z-index: 39; backdrop-filter: blur(2px); }
  .menu-btn { display: grid; }
  .search { width: auto; flex: 1; max-width: none; }
  .search kbd { display: none; }
  .hide-mobile { display: none !important; }
  .content { padding: 18px 16px 80px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-title { font-size: 21px; }
  .mobile-fab { display: flex !important; }
}
@media (max-width: 560px) {
  /* Dlaždice pod sebou (čísla se na úzkém mobilu nelámou) */
  .stat-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat { padding: 15px 16px; }
  .stat-val { font-size: 23px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .content { padding: 16px 14px 84px; }
  .card-head { padding: 14px 14px; }
  .page-head { margin-bottom: 16px; }
  /* Akce v hlavičce stránky na celou šířku pod nadpisem */
  .page-head > .row { width: 100%; }
  .page-head > .row .btn { flex: 1; justify-content: center; }
}

/* Floating action button (mobile quick invoice) */
.mobile-fab {
  display: none; position: fixed; bottom: 20px; right: 18px; z-index: 45;
  height: 52px; padding: 0 20px; border-radius: 999px; background: var(--primary); color: #fff;
  align-items: center; gap: 9px; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 26px -6px rgba(37,99,235,.6);
}

/* card list (mobile table replacement) */
.cardlist { display: flex; flex-direction: column; gap: 10px; }
.inv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: var(--shadow-xs); }
