:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --primary: #1f5fbf;
  --primary-text: #ffffff;
  --accent: #e8a317;
  --danger: #c0392b;
  --ok: #1e8e4e;
  --nav-bg: #1b2433;
  --nav-text: #c9d1dd;
  --nav-active: #2b3a52;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d; --surface: #1b212b; --text: #e6e9ef; --muted: #9aa3b2; --border: #2c3442;
    --primary: #4d8ef0; --nav-bg: #0d1117; --nav-active: #1f2a3b; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; line-height: 1.3; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.mt { margin-top: 1.5rem; }
.prewrap { white-space: pre-wrap; }
.cap::first-letter { text-transform: uppercase; }
.pos { color: var(--ok); }
.neg, .danger { color: var(--danger) !important; }

/* ---------- layout ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--nav-bg); color: #fff; z-index: 30; }
.brand { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.logo { color: var(--accent); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .btn-link { color: var(--nav-text); }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.sidenav { position: fixed; top: 52px; bottom: 0; left: 0; width: 220px; background: var(--nav-bg); padding: 10px 8px; overflow-y: auto; z-index: 20; }
.sidenav a { display: flex; align-items: center; gap: 10px; color: var(--nav-text); padding: 9px 12px; border-radius: 6px; margin-bottom: 2px; }
.sidenav a:hover { background: var(--nav-active); text-decoration: none; color: #fff; }
.sidenav a.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidenav .ico { width: 18px; text-align: center; opacity: .8; }
.sidenav a.small { margin-top: 16px; }
.nav-backdrop { display: none; }
.main { margin: 52px 0 0 220px; padding: 24px; max-width: 1400px; }
.main-center { padding: 48px 16px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidenav { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(0,0,0,.4); z-index: 15; }
  .main { margin-left: 0; padding: 16px; }
  .hide-sm { display: none; }
}

/* ---------- components ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 0 auto; }
.auth { text-align: left; }
.auth-logo { font-size: 2.2rem; color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 16px; }
@media (max-width: 500px) { .grid-2 { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: .88em; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }
form.inline { display: inline; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border: 1px solid; }
.flash-ok { background: #e8f6ee; border-color: #b5e0c6; color: #145c33; }
.flash-error { background: #fdecea; border-color: #f3c0ba; color: #8a2419; }
@media (prefers-color-scheme: dark) {
  .flash-ok { background: #13301f; border-color: #1e5a37; color: #a6e3bf; }
  .flash-error { background: #3a1714; border-color: #6d2a22; color: #f5b5ac; }
}

.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: #e9ecf1; color: #3b4454; vertical-align: middle; white-space: nowrap; font-weight: 500; }
.st-poptavka, .dst-koncept { background: #eef0f4; color: #4b5563; }
.st-nabidka, .dst-vystaveno { background: #e3edfb; color: #1f4f99; }
.st-objednano { background: #fff3d6; color: #7a5300; }
.st-realizace { background: #ffe7c7; color: #8a4a00; }
.st-dokonceno, .dst-prijato { background: #dff3e6; color: #17693a; }
.st-fakturovano, .dst-zaplaceno { background: #e6e1f7; color: #4a338f; }
.st-zruseno, .dst-storno, .dst-odmitnuto { background: #f6e0de; color: #8a2419; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tfoot th, tfoot td { border-bottom: 0; font-weight: 600; color: var(--text); text-transform: none; font-size: .95rem; letter-spacing: 0; }
.num { text-align: right; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(31, 95, 191, .04); }
tr.billed td { color: var(--muted); }
tr.inactive td { opacity: .55; }
tr.late td:first-child, li.late { box-shadow: inset 3px 0 0 var(--danger); padding-left: 10px; }

/* forms */
.form label, .row-form label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
textarea { width: 100%; resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 0 0 12px; }
fieldset[disabled] { border: 0; padding: 0; }
legend { font-size: .88rem; color: var(--muted); padding: 0 4px; }
.row { display: flex; flex-wrap: wrap; gap: 0 14px; }
.row > label { flex: 0 1 auto; }
.grow { flex: 1 1 220px !important; }
.row-form { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.row-form > .btn { margin-bottom: 12px; }
.row-form.tight { gap: 8px; align-items: center; }
.row-form.tight > .btn { margin-bottom: 0; }
.w-xs { width: 64px; } .w-sm { width: 100px; } .w-md { width: 140px; } .w-full { width: 100%; min-width: 220px; }
.hint { font-size: .8rem; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.narrow-form { max-width: 640px; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { flex-direction: row !important; align-items: center; gap: 6px !important; border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; margin: 0 !important; color: var(--text) !important; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input[type=search] { flex: 1 1 260px; max-width: 420px; }
.filters label { display: flex; align-items: center; gap: 8px; }
.manual-mat { flex-basis: 100%; }
.manual-mat.hidden { display: none; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.status-buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.eco td, .eco th { padding: 6px 8px; }
.progress { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.progress > div { height: 100%; background: var(--ok); }
.progress > div.over { background: var(--danger); }
.progress-label { margin-top: 12px; }

.timeline { list-style: none; padding: 0; margin: 16px 0 0; }
.timeline li { border-left: 3px solid var(--accent); padding: 4px 0 12px 12px; margin-bottom: 8px; }

/* week */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { border: 1px solid var(--border); border-radius: 6px; padding: 8px; min-height: 120px; background: var(--bg); }
.day.weekend { opacity: .8; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.entry { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 6px 8px; margin-bottom: 6px; font-size: .9rem; }
.week-total { text-align: right; margin: 12px 0 0; }
.week-nav { gap: 10px; }
@media (max-width: 900px) { .week { grid-template-columns: 1fr; } .day { min-height: 0; } }

/* calendar */
.calendar { padding: 0; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px; font-size: .8rem; color: var(--muted); font-weight: 600; text-align: center; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--bg); color: var(--muted); }
.cal-day.today .cal-num { background: var(--accent); color: #000; border-radius: 99px; display: inline-block; min-width: 22px; text-align: center; }
.cal-num { font-size: .8rem; margin-bottom: 2px; }
.cal-job { display: block; font-size: .75rem; padding: 1px 6px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .cal-day { min-height: 70px; } .cal-job { font-size: .65rem; padding: 0 3px; } }

/* documents */
.items input { width: 100%; }
.items td { padding: 4px; }
.add-items { margin-top: 10px; }
.totals { text-align: right; margin-top: 16px; }
.totals .grand { font-size: 1.2rem; margin-top: 4px; }

select { max-width: 100%; }
.row-form > label.grow > select, .row > label.grow > select { width: 100%; }
@media (max-width: 600px) {
  .row-form > label, .row > label { flex: 1 1 100% !important; }
  .row-form input:not([type=checkbox]), .row-form select, .row input:not([type=checkbox]), .row select { width: 100%; }
  .row-form > label.check { flex: 0 1 auto !important; }
  .dl { grid-template-columns: 1fr; gap: 0 12px; }
  .dl dd { margin-bottom: 8px; }
}

/* ---------- v2: sklad, podpisy, oprávnění ---------- */
.stat-link { color: inherit; }
.stat-link:hover { text-decoration: none; border-color: var(--primary); }
.warn { color: #b26b00; }
.btn-lg { padding: 12px 20px; font-size: 1.05rem; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.mt-sm { margin-top: 10px; }
.mono { font-family: ui-monospace, monospace; word-break: break-all; }
.center { text-align: center; }
table.compact th, table.compact td { padding: 5px 8px; }
details > summary { cursor: pointer; color: var(--primary); }
.copy-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.copy-row input { flex: 1; }
.sign-cta { border-left: 4px solid var(--accent); }

.entry.approved { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.ok-mark { color: var(--ok); font-weight: 700; }
.week-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }

.perm-table td:first-child { max-width: 420px; }
.perm-table input[type=checkbox] { width: 20px; height: 20px; }

/* skladový seznam – optimalizováno na mobil */
.stock-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; position: sticky; top: 52px; background: var(--surface); padding: 8px 0; z-index: 5; }
.stock-tools input[type=search] { flex: 1 1 240px; font-size: 1rem; padding: 10px 12px; }
.scan-video { width: 100%; max-height: 50vh; border-radius: 8px; background: #000; margin-bottom: 10px; }
.stock-list { border: 1px solid var(--border); border-radius: 6px; max-height: 60vh; overflow-y: auto; margin-bottom: 12px; }
.stock-cat { background: var(--bg); padding: 4px 10px; font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; z-index: 1; }
.stock-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--border); }
.stock-item[hidden] { display: none; }
.stock-item.filled { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.stock-item.flash-row { background: color-mix(in srgb, var(--accent) 35%, transparent); transition: background .3s; }
.si-name { flex: 1; min-width: 0; }
.si-qty { display: flex; align-items: center; gap: 4px; }
.si-qty input { width: 74px; text-align: right; font-size: 1rem; padding: 8px; }
.si-qty .unit { width: 34px; font-size: .85rem; color: var(--muted); }
.si-price input { width: 90px; text-align: right; }
.btn-step { width: 38px; height: 38px; padding: 0; font-size: 1.2rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0; border-top: 1px solid var(--border); }
@media (max-width: 600px) {
  .stock-list { max-height: none; }
  .stock-item { flex-wrap: wrap; }
  .si-name { flex-basis: 100%; }
  .si-qty { margin-left: auto; }
  .stock-tools { top: 52px; }
}

/* náhled listu */
.sheet-preview { border: 1px solid var(--border); border-radius: 6px; padding: 16px; background: var(--surface); }
.sp-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 3px solid var(--accent); padding-bottom: 8px; margin-bottom: 12px; }
.sp-title { text-align: right; }
.sp-number { font-weight: 700; font-size: 1.1rem; }
.sheet-preview h4 { margin: 14px 0 6px; font-size: .95rem; }
.sp-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.sp-sign-img { height: 80px; border-bottom: 1px solid var(--muted); display: flex; align-items: flex-end; justify-content: center; margin: 4px 0; }
.sp-sign-img img { max-height: 76px; max-width: 100%; }
@media (prefers-color-scheme: dark) { .sp-sign-img img { background: #fff; border-radius: 4px; } }

/* podpisová stránka */
.sign-page { max-width: 820px; margin: 0 auto; }
.sign-doc summary { padding: 4px 0; }
.sign-doc .sheet-preview { margin-top: 12px; }
.sig-wrap { position: relative; margin: 6px 0 10px; }
#signature-pad { width: 100%; height: 240px; border: 2px dashed var(--border); border-radius: 8px; background: #fff; touch-action: none; display: block; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9aa3b2; pointer-events: none; font-size: 1.1rem; }
.sig-wrap::after { content: ''; position: absolute; left: 6%; right: 6%; bottom: 60px; border-bottom: 1px solid #c9ced6; pointer-events: none; }
@media (min-width: 900px) { #signature-pad { height: 300px; } }
@media (orientation: landscape) and (max-height: 500px) { #signature-pad { height: 55vh; } }
.sig-hint[hidden] { display: none; }
.stock-cat[hidden] { display: none; }

/* aktualizace aplikace */
.upd-blockers { border-left: 4px solid var(--danger); }
.upd-pre { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-size: .82rem; max-height: 320px; overflow: auto; }
.upd-code { display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font-size: .85rem; user-select: all; }
.upd-steps { list-style: none; padding: 0; margin: 0; }
.upd-steps li { display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: start; }
.upd-steps li:last-child { border-bottom: 0; }
.upd-steps .ico { font-size: 1.1rem; line-height: 1.4; }
.upd-steps .st-RUNNING .ico { animation: spin 1.2s linear infinite; display: inline-block; }
.upd-steps .st-FAILED { color: var(--danger); }
.upd-steps .st-SKIPPED, .upd-steps .st-PENDING { color: var(--muted); }
.upd-steps pre { grid-column: 2 / 4; margin: 4px 0 0; }
.upd-toast { position: fixed; right: 16px; bottom: 16px; max-width: 420px; z-index: 50; }
.changes li { display: flex; gap: 10px; }
.changes .mono { color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.upd-toast { white-space: pre-line; }

/* plánování */
.seg { display: inline-flex; gap: 2px; margin-left: 8px; }
.plan-form summary { padding: 2px 0; }
.plan-card { padding: 0; overflow: hidden; }
.plan-card .table-wrap { max-height: 75vh; overflow: auto; }
.plan-grid { border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.plan-grid th, .plan-grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 4px; vertical-align: top; }
.plan-grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; text-transform: none; letter-spacing: 0; }
.plan-grid .pg-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 150px; text-align: left; font-weight: normal; color: var(--text); font-size: .88rem; }
.plan-grid thead .pg-name { z-index: 3; }
.pg-day { text-align: center; white-space: nowrap; }
.pg-day span { display: block; font-size: .72rem; }
.pg-day strong { color: var(--text); }
.pg-day em { display: block; font-style: normal; color: var(--danger); font-weight: normal; white-space: normal; max-width: 110px; margin: 0 auto; }
.pg-day.off { background: var(--bg); }
.pg-day.today { box-shadow: inset 0 -3px 0 var(--accent); }
.plan-grid.pg-week .pg-cell { min-width: 120px; height: 64px; }
.plan-grid.pg-month .pg-cell { min-width: 30px; text-align: center; padding: 6px 2px; }
.pg-cell { position: relative; }
.pg-cell.off { background: var(--bg); }
.pg-cell.free { background: transparent; }
.pg-cell.part { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pg-cell.full { background: color-mix(in srgb, var(--ok) 26%, transparent); }
.pg-cell.over { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.pg-cell.extra { background: color-mix(in srgb, #b26b00 20%, var(--bg)); }
.pg-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.pg-job { display: flex; justify-content: space-between; gap: 6px; font-size: .75rem; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; }
.pg-job span { font-weight: 600; }
.pg-foot { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.pg-h { font-weight: 600; }
.pg-add { position: absolute; right: 3px; bottom: 1px; font-size: .9rem; color: var(--muted); opacity: 0; text-decoration: none; }
.pg-cell:hover .pg-add, .pg-cell.free .pg-add { opacity: .6; }
.pg-add:hover { opacity: 1 !important; color: var(--primary); text-decoration: none; }
.plan-grid.pg-month .pg-add { position: static; display: block; line-height: 1; }
.plan-grid.pg-month .pg-cell:not(.free) .pg-add { display: none; }
.pg-sum { min-width: 150px; white-space: normal; }
.load { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 4px 0 2px; }
.load > div { height: 100%; background: var(--ok); }
.load > div.full { background: #b26b00; }
.load > div.over { background: var(--danger); }
.plan-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 14px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); vertical-align: -2px; margin-right: 4px; }
.lg.part { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.lg.full { background: color-mix(in srgb, var(--ok) 26%, transparent); }
.lg.over { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.lg.off { background: var(--bg); }
.my-plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.mp-day { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.mp-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.grid-2 > * { min-width: 0; }
body { overflow-x: hidden; }
@media (max-width: 600px) { .stats { grid-template-columns: 1fr 1fr; } .stat-value { font-size: 1.15rem; } }

/* vyúčtování */
.billing-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.billing-grid > * { min-width: 0; }
@media (max-width: 900px) { .billing-grid { grid-template-columns: 1fr; } }
.billing-options fieldset { margin-bottom: 14px; }
.billing-options label.check { margin-bottom: 6px; }
tr.bl-rezie td { font-style: italic; }
tr.grand-row th { font-size: 1.05rem; }
table.bulk td { padding: 3px 4px; }
table.bulk input, table.bulk select { padding: 6px 8px; }
table.bulk input[type=date] { width: 150px; }
.billing-options select, .billing-options input:not([type=radio]):not([type=checkbox]) { width: 100%; max-width: 100%; }
fieldset { min-width: 0; }

/* Fotky a soubory */
.upload-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.upload-btn { position: relative; overflow: hidden; cursor: pointer; }
.upload-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.upload-btn:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery-sm { grid-template-columns: repeat(auto-fill, minmax(90px, 110px)); gap: 6px; margin-top: 6px; }
.tile { margin: 0; min-width: 0; }
.tile img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--border); }
.tile figcaption { margin-top: 4px; overflow-wrap: anywhere; }
.note-edit { margin-top: 4px; }
.note-edit summary { cursor: pointer; color: var(--muted, #667); }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.92); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100vw; max-height: calc(100vh - 48px); object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, 0.15); color: #fff; border: 0; font-size: 32px; line-height: 1; width: 48px; height: 48px; border-radius: 24px; cursor: pointer; }
.lightbox .lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-close { right: 8px; top: 8px; }
.lightbox .lb-bar { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px; color: #ddd; font-size: 14px; text-align: center; overflow-wrap: anywhere; }
.lightbox .lb-bar a { color: #fff; }

/* Zákazník: výběr a ARES */
.customer-picker { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.customer-picker > label { display: flex; flex-direction: column; gap: 4px; }
.picker-filter { margin-bottom: 4px; }
.new-customer { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; }
.new-customer legend { font-weight: 600; padding: 0 4px; }
.ares { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.ares-msg.danger { color: var(--danger, #c0392b); }
.ares-results { list-style: none; padding: 0; margin: 0; width: 100%; border: 1px solid var(--border); border-radius: 8px; max-height: 320px; overflow: auto; }
.ares-results li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.ares-results li:last-child { border-bottom: 0; }
.customer-picker:has(.new-customer:not([hidden])) { flex-basis: 100%; }
