:root {
  --ink: #0e2447; --text: #3e5379; --muted: #6b7f9f; --line: #dbe6f6; --bg: #f4f8ff;
  --blue-50: #f0f6ff; --blue-100: #e3eeff; --blue-200: #c9dcff; --blue-300: #9fc0fb; --blue-500: #3f7be8; --blue-600: #2b63d3; --blue-700: #214fae;
  --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(14,36,71,.06), 0 4px 12px rgba(43,99,211,.06);
  --shadow-md: 0 2px 4px rgba(14,36,71,.05), 0 16px 40px rgba(43,99,211,.12);
  --font-head: "Sora", "Inter", system-ui, sans-serif; --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --side-w: 248px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); font-size: 15px; line-height: 24px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-head); color: var(--ink); }
h1 { font-size: 28px; line-height: 36px; letter-spacing: -.6px; }
h2 { font-size: 17px; line-height: 24px; letter-spacing: -.2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 13px; line-height: 20px; } .strong { font-weight: 600; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; flex: none; width: var(--side-w); height: 100vh; padding: 22px 16px; background: var(--ink); color: #c8d5ec; }
.back-link { display: flex; align-items: center; gap: 10px; align-self: flex-start; margin: 0 0 22px; padding: 9px 16px 9px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #e6eeff; font-size: 14px; font-weight: 600; line-height: 20px; white-space: nowrap; transition: background-color .2s, border-color .2s, color .2s; }
.back-link:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.34); color: #fff; text-decoration: none; }
.back-link .ico { width: 18px; height: 18px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-radius: 12px; background: transparent; color: #c8d5ec; font-size: 14.5px; font-weight: 500; text-align: left; transition: background-color .2s, color .2s; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--blue-600); color: #fff; }
.side-foot { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.whoami { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.avatar { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--blue-500); color: #fff; font-weight: 700; }
.who { display: flex; flex-direction: column; line-height: 18px; min-width: 0; }
.who strong { white-space: nowrap; }
.who strong { color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.who small { overflow: hidden; color: #9fb2d3; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; min-width: 0; }
.content { max-width: 1280px; margin: 0 auto; padding: 32px 36px 64px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { margin-bottom: 8px; color: var(--muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: 999px; font-size: 14.5px; font-weight: 600; line-height: 20px; white-space: nowrap; text-decoration: none; transition: background-color .2s, border-color .2s, color .2s, transform .2s, box-shadow .2s; }
.btn:hover { text-decoration: none; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 8px 20px rgba(43,99,211,.24); }
.btn-primary:hover { background: var(--blue-700); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue-300); color: var(--blue-600); }
.btn-ok { background: var(--ok); color: #fff; } .btn-ok:hover { background: #15803d; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; } .btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-text { background: transparent; color: var(--muted); } .btn-text:hover { color: var(--blue-600); }
.link { font-size: 13.5px; font-weight: 600; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); color: var(--text); transition: transform .25s, box-shadow .25s, border-color .25s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--blue-200); text-decoration: none; }
.kpi-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi strong { font-family: var(--font-head); font-size: 30px; line-height: 38px; letter-spacing: -.8px; color: var(--ink); }
.kpi small { font-size: 12.5px; color: var(--muted); }
.kpi-hot { background: linear-gradient(135deg, #3f7be8, #2b63d3); border-color: transparent; }
.kpi-hot .kpi-label, .kpi-hot small { color: rgba(255,255,255,.82); } .kpi-hot strong { color: #fff; }
.kpi-warn strong { color: var(--warn); }

/* ---------- Panels ---------- */
.panel { margin-bottom: 20px; padding: 22px 24px; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.grid-2, .grid-3, .grid-side { margin-bottom: 20px; }
.grid-2 > .panel, .grid-3 > .panel, .grid-side > .panel { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stack > .panel { margin-bottom: 0; }
.empty { padding: 22px 0; text-align: center; color: var(--muted); }

/* ---------- Grafy ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: #e6eefb; stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .cursor { stroke: var(--blue-300); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .tip { position: absolute; top: 0; transform: translate(-50%, 0); z-index: 3; min-width: 150px; padding: 10px 12px; background: var(--ink); color: #fff; border-radius: 12px; font-size: 12px; line-height: 18px; pointer-events: none; box-shadow: var(--shadow-md); }
.chart .tip[hidden] { display: none; }
.chart .tip strong { display: block; margin-bottom: 2px; }
.chart .tip span { display: block; white-space: nowrap; }
.chart .tip i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut svg { width: 140px; height: 140px; flex: none; }
.d-num { font-family: var(--font-head); font-size: 26px; font-weight: 800; fill: var(--ink); } .d-sub { font-size: 11px; fill: var(--muted); }
.d-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 120px; list-style: none; margin: 0; padding: 0; }
.d-legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.d-legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; } .d-legend b { margin-left: auto; color: var(--ink); }
.bars { display: flex; flex-direction: column; gap: 14px; list-style: none; margin: 0; padding: 0; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 6px; } .bar-top b { color: var(--ink); }
.bar-track { height: 10px; border-radius: 999px; background: var(--blue-100); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6b9cf3, #2b63d3); }

/* ---------- Zoznamy a tabuľky ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; align-items: center; gap: 14px; padding: 12px 4px; color: inherit; border-radius: 12px; }
.list a:hover { background: var(--blue-50); text-decoration: none; }
.list-date { flex: none; min-width: 78px; font-weight: 600; color: var(--blue-600); font-size: 13.5px; }
.list-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 20px; }
.list-main strong { color: var(--ink); } .list-main small { color: var(--muted); font-size: 12.5px; }
.table-panel { padding: 8px 8px 12px; }
.table-panel .panel-head { padding: 14px 16px 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { padding: 12px 16px; text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data td { padding: 13px 16px; border-bottom: 1px solid #edf2fb; vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data .num { text-align: right; white-space: nowrap; }
.data.compact td, .data.compact th { padding: 11px 12px; }
.data tr.row-link { cursor: pointer; transition: background-color .15s; }
.data tr.row-link:hover { background: var(--blue-50); }
.data tr.is-new { background: #f7faff; box-shadow: inset 3px 0 0 var(--blue-500); }
td.quick { white-space: nowrap; }
td.quick > a, td.quick > form { display: inline-flex; align-items: center; margin: 0 6px 0 0; vertical-align: middle; }
td.quick > :last-child { margin-right: 0; }
td.quick form { margin: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--blue-100); color: var(--blue-700); font-size: 11px; font-weight: 600; vertical-align: middle; }
.tag-blue { background: var(--blue-600); color: #fff; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.b-new { background: #e3eeff; color: #214fae; } .b-taken { background: #ede9fe; color: #6d28d9; }
.b-done { background: #dcfce7; color: #15803d; } .b-cancelled { background: #eef2f7; color: #64748b; }
.b-paid { background: #dcfce7; color: #15803d; } .b-unpaid { background: #fef3c7; color: #b45309; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 16px 0 6px; }
.pager a, .pager span { min-width: 36px; padding: 6px 10px; border-radius: 10px; text-align: center; font-size: 13.5px; color: var(--text); }
.pager a { border: 1px solid var(--line); background: #fff; } .pager a:hover { border-color: var(--blue-300); text-decoration: none; }
.pager a.current { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }

/* ---------- Formuláre ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters input[type=search] { flex: 1 1 280px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; line-height: 20px; font-weight: 600; color: var(--ink); } .field small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--blue-50); color: var(--ink); transition: border-color .2s, box-shadow .2s, background-color .2s;
}
textarea { resize: vertical; min-height: 90px; line-height: 22px; }
input:focus, select:focus, textarea:focus { outline: none; background: #fff; border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(63,123,232,.18); }
input.is-readonly { background: #eef2f9; color: var(--muted); }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; 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='%232b63d3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
.filters select { width: auto; min-width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid[hidden], [hidden] { display: none !important; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input, .x-check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--blue-600); flex: none; }
.check small { color: var(--muted); }
.extras-admin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.x-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .2s, background-color .2s; }
.x-item.is-on { border-color: var(--blue-500); background: var(--blue-50); }
.x-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; min-width: 0; }
.x-check span { display: flex; flex-direction: column; line-height: 19px; } .x-check strong { color: var(--ink); font-size: 13.5px; } .x-check small { color: var(--muted); font-size: 12px; font-weight: 400; }
.x-qty { width: 82px !important; min-height: 36px !important; padding: 4px 28px 4px 10px !important; background-position: right 9px center; }
.x-qty:disabled { opacity: .4; }
.notice { border-color: var(--blue-200); background: var(--blue-50); }
.notice h2 { margin-bottom: 6px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.inline-form { margin-top: 14px; }
.page-actions form { margin: 0; }
.form-actions form { margin: 0; }
.client-box { display: flex; flex-direction: column; gap: 4px; }
.client-box .strong { font-size: 17px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf2fb; font-size: 13.5px; } .timeline li:last-child { border-bottom: 0; }
.timeline span { color: var(--muted); } .timeline b { color: var(--ink); font-weight: 600; text-align: right; }
.action-bar { display: flex; flex-wrap: wrap; gap: 20px 36px; align-items: center; }
.action-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; } .action-group form { margin: 0; }
.action-title { margin-right: 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---------- Flash ---------- */
.flash { margin-bottom: 16px; padding: 12px 16px; border-radius: 14px; font-size: 14px; border: 1px solid; transition: opacity .6s; }
.flash-ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; } .flash-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.flash.fade { opacity: 0; }

/* ---------- Prihlásenie ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: linear-gradient(#edf4ff, #fff); }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px 28px; background: #fff; border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-md); }
.auth-logo img { width: 132px; height: 48px; margin: 0 auto 14px; object-fit: contain; }
.auth-card h1 { margin-bottom: 18px; font-size: 22px; line-height: 30px; text-align: center; }
.auth-card > p { margin-bottom: 18px; line-height: 24px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 20px; padding: 4px; background: var(--blue-100); border-radius: 999px; }
.tab { padding: 9px; border-radius: 999px; text-align: center; font-weight: 600; font-size: 14px; color: var(--text); } .tab:hover { text-decoration: none; }
.tab.active { background: #fff; color: var(--blue-600); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-back { margin-top: 20px; text-align: center; font-size: 13.5px; }

/* ---------- Mobil ---------- */
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { position: sticky; z-index: 20; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; }
  .back-link { margin: 0 6px 0 0; padding: 8px 14px 8px 10px; }
  .back-link { flex: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 2px; } .side-foot { display: none; }
  .nav-item { width: auto; padding: 9px 12px; white-space: nowrap; } .nav-item span { font-size: 13.5px; }
  .whoami { display: none; }
  .content { padding: 22px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; line-height: 32px; }
  .grid-3 { grid-template-columns: 1fr; } .form-grid, .extras-admin { grid-template-columns: 1fr; }
  .panel { padding: 18px 16px; } .table-panel { padding: 4px 4px 10px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 16px; } .kpi strong { font-size: 24px; line-height: 30px; }
  .nav-item svg { display: none; }
  /* tabuľky ako karty */
  table.data, .data thead, .data tbody, .data tr, .data td { display: block; }
  .data thead { display: none; }
  .data tr { margin: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
  .data tr.is-new { box-shadow: inset 3px 0 0 var(--blue-500); }
  .data td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
  .data td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
  .data td.quick { flex-wrap: wrap; gap: 6px; justify-content: flex-start; padding-top: 10px; } .data td.quick::before { display: none; }
  td.quick > a, td.quick > form { margin: 0; }
  .data .num { text-align: right; }
}
