* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: 'Segoe UI', Tahoma, sans-serif; background: #f1f3f5; color: #1a1a1a; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #1f2937; color: #fff; border-bottom: 1px solid #111827;
  position: sticky; top: 0; z-index: 100;
}
.topbar h1 { font-size: 15px; margin: 0; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.3px; }
.topbar h1 .brand-logo { height: 28px; width: auto; background: #fff; padding: 3px 6px; border-radius: 4px; }
.topbar h1 a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.topbar h1 a:hover { text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar nav a { color: #cbd5e1; padding: 6px 10px; border-radius: 5px; font-size: 13px; }
.topbar nav a.active { background: #374151; color: #fff; }
.topbar nav a:hover { background: #374151; color: #fff; text-decoration: none; }
.topbar .user-menu { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.topbar button, .topbar label.btn {
  background: #374151; color: #fff; border: 0; padding: 7px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit;
  white-space: nowrap;
}
.topbar button:hover, .topbar label.btn:hover { background: #4b5563; }
.topbar button.primary { background: #2563eb; }
.topbar button.primary:hover { background: #1d4ed8; }
.topbar button.success { background: #059669; }
.topbar button.success:hover { background: #047857; }
.topbar button.danger { background: #dc2626; }
.topbar button.danger:hover { background: #b91c1c; }
.topbar input[type="file"] { display: none; }

/* === LIGHTBOX PRO OBRÁZKY V NÁHLEDU === */
.image-lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.92);
  z-index: 2000;
  cursor: zoom-out;
  align-items: center; justify-content: center;
  padding: 20px;
}
.image-lightbox.show { display: flex; }
.image-lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
}
.image-lightbox .lb-close {
  position: absolute; top: 14px; right: 18px;
  background: rgba(255,255,255,0.1); color: #fff;
  border: 0; width: 40px; height: 40px; border-radius: 20px;
  font-size: 22px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.image-lightbox .lb-close:hover { background: rgba(255,255,255,0.25); }
.image-lightbox .lb-hint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.6); font-size: 12px;
  background: rgba(0,0,0,0.4); padding: 4px 10px; border-radius: 12px;
}
/* Náhled obrázku/PDF v panelu - cursor zoom */
#pdfContainer img,
#pdfContainer canvas { cursor: zoom-in; transition: opacity 0.15s; }
#pdfContainer img:hover,
#pdfContainer canvas:hover { opacity: 0.94; }
/* Při sbaleném panelu žádný zoom kurzor - klik panel rozbalí */
.pdf-pane.collapsed #pdfContainer img,
.pdf-pane.collapsed #pdfContainer canvas { cursor: pointer; }

/* === DROPDOWN MENU V TOPBARU (Export, Více) === */
.topbar-menu { position: relative; display: inline-flex; }
.topbar-menu-btn {
  display: inline-flex; align-items: center; gap: 5px;
  /* dědí styl z .topbar button */
}
.topbar-menu-btn .caret { font-size: 9px; opacity: 0.85; margin-left: 2px; }
.topbar-menu-items {
  display: none;
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 240px;
  background: #1f2937; border: 1px solid #374151;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  padding: 4px; z-index: 200;
  flex-direction: column;
}
.topbar-menu.open .topbar-menu-items { display: flex; }
.topbar-menu-items button,
.topbar-menu-items label.topbar-menu-file {
  background: transparent; color: #fff;
  text-align: left; padding: 8px 12px; border-radius: 4px;
  border: 0; font-size: 13px; font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  width: 100%; white-space: nowrap; box-sizing: border-box;
  margin: 0;
}
.topbar-menu-items button:hover,
.topbar-menu-items label.topbar-menu-file:hover { background: #374151; }
.topbar-menu-items button.danger { color: #fca5a5; background: transparent; }
.topbar-menu-items button.danger:hover { background: #7f1d1d; color: #fff; }
.topbar-menu-sep { height: 1px; background: #374151; margin: 4px 4px; }

.container { max-width: 1300px; margin: 24px auto; padding: 0 20px; }

.card {
  background: #fff; border-radius: 8px; padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #e5e7eb;
}
.card h2 { margin-top: 0; font-size: 15px; padding-bottom: 8px; border-bottom: 2px solid #2563eb;
  color: #1e3a8a; text-transform: uppercase; letter-spacing: 0.5px; }

.btn {
  display: inline-block; background: #f3f4f6; border: 1px solid #d1d5db; padding: 7px 14px;
  border-radius: 5px; cursor: pointer; font-size: 13px; font-family: inherit; color: #374151;
}
.btn:hover { background: #e5e7eb; }
.btn.primary { background: #2563eb; color: #fff; border-color: #1d4ed8; }
.btn.primary:hover { background: #1d4ed8; }
.btn.success { background: #059669; color: #fff; border-color: #047857; }
.btn.success:hover { background: #047857; }
.btn.danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn.danger:hover { background: #fee2e2; }
.btn.ghost { background: transparent; border-color: transparent; color: #6b7280; }
.btn.ghost:hover { background: #f3f4f6; color: #374151; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px;
  font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}
input[readonly] { background: #f3f4f6; color: #6b7280; }

table { border-collapse: collapse; width: 100%; }

.list-table { font-size: 13px; }
.list-table th {
  background: #f9fafb; text-align: left; padding: 10px 12px; border-bottom: 2px solid #e5e7eb;
  font-weight: 600; color: #374151; font-size: 11px; text-transform: uppercase;
}
.list-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.list-table tr:hover td { background: #f8fafc; cursor: pointer; }
.list-table .cislo { font-weight: 600; color: #1e3a8a; }
.list-table .pdf-yes { color: #059669; font-weight: 600; }
.list-table .pdf-no { color: #9ca3af; }
.list-table .actions { display: flex; gap: 6px; }
.list-table .actions button { padding: 5px 10px; font-size: 12px; }

.toolbar {
  display: flex; gap: 8px; align-items: center; padding: 12px 0; flex-wrap: wrap;
}
.toolbar input[type=text] { flex: 1; max-width: 360px; }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: #6b7280; gap: 8px;
}

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px;
  font-weight: 600; background: #e5e7eb; color: #374151;
}
.badge.admin { background: #fde68a; color: #92400e; }
.badge.team { background: #d1fae5; color: #065f46; }
.badge.private { background: #f3f4f6; color: #6b7280; }
.badge.inactive { background: #fee2e2; color: #991b1b; }
.badge.bdr { background: #ddd6fe; color: #5b21b6; }

/* Stavové badge */
.stav-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.stav-badge.stav-rozpracovana { background: #fef3c7; color: #92400e; }
.stav-badge.stav-k_vyrobe     { background: #fee2e2; color: #991b1b; }
.stav-badge.stav-vyrobeno     { background: #dbeafe; color: #1e3a8a; }
.stav-badge.stav-vyskladneno  { background: #c7d2fe; color: #312e81; }
.stav-badge::before {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}

/* Stavová "row" v seznamu - barevný proužek vlevo */
.list-table tr.row-rozpracovana { box-shadow: inset 4px 0 0 #f59e0b; }
.list-table tr.row-k_vyrobe     { box-shadow: inset 4px 0 0 #dc2626; }
.list-table tr.row-vyrobeno     { box-shadow: inset 4px 0 0 #2563eb; }
.list-table tr.row-vyskladneno  { box-shadow: inset 4px 0 0 #4f46e5; }

/* Legenda barev */
.legend-list { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 6px; background: #f9fafb; }
.legend-color { width: 28px; height: 28px; border-radius: 6px; flex: 0 0 auto; }
.legend-meta b { display: block; font-size: 13px; color: #111827; }
.legend-meta span { font-size: 12px; color: #6b7280; }

/* Produkt typ badge (Baxxon 1 / 2) v topbaru */
.produkt-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 700;
  margin-left: 8px;
}
.produkt-badge.b1 { background: #6b7280; color: #fff; }
.produkt-badge.b2 { background: #7c3aed; color: #fff; }

/* Timeline historie */
.history-timeline { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 20px; }
.history-timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: #e5e7eb;
}
.history-item { position: relative; padding: 10px 0 10px 16px; }
.history-item::before {
  content: ''; position: absolute; left: -17px; top: 14px;
  width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; border: 2px solid #fff;
}
.history-item.action-stav_change::before { background: #2563eb; }
.history-item.action-create::before      { background: #10b981; }
.history-item.action-update::before      { background: #f59e0b; }
.history-item.action-delete::before      { background: #dc2626; }
.history-item .h-time   { font-size: 11px; color: #6b7280; }
.history-item .h-action { font-size: 13px; font-weight: 600; color: #111827; }
.history-item .h-detail { font-size: 12px; color: #4b5563; margin-top: 2px; }
.history-item .h-user   { font-size: 12px; color: #6b7280; }

/* Filter buttons */
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid #d1d5db; padding: 5px 12px; border-radius: 16px;
  cursor: pointer; font-size: 12px; font-weight: 500; color: #374151;
  font-family: inherit;
}
.filter-btn:hover { background: #f3f4f6; }
.filter-btn.active { background: #1f2937; color: #fff; border-color: #1f2937; }
.filter-btn .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* Adresa v seznamu - víceřádkové */
.list-table td.adresa { white-space: pre-line; max-width: 220px; font-size: 12px; color: #4b5563; line-height: 1.4; }
.list-table td.poznamka-cell { text-align: center; font-size: 16px; cursor: help; }
.list-table tr:has(td.poznamka-cell:not(:empty)) { background: #fffbeb; }

/* Lookup list (číselníky v adminu) */
.lookup-list { border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; max-height: 320px; overflow-y: auto; }
.lookup-item { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid #f3f4f6; }
.lookup-item:last-child { border-bottom: 0; }
.lookup-item .lookup-value { flex: 1; font-size: 13px; color: #1f2937; }
.lookup-item button { padding: 3px 8px; font-size: 12px; }
.list-table tr:has(td.poznamka-cell:not(:empty)):hover td { background: #fef3c7; }

/* ============================================================ */
/* NOVÝ CONFIG: dashboard, karty, toggle, counter, btn-group     */
/* ============================================================ */

/* Sticky dashboard nahoře v konfiguračním modalu */
.cfg-dashboard {
  position: sticky; top: -1px; z-index: 5;
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px;
  padding: 14px; margin: -14px -14px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e5e7eb;
  border-radius: 6px 6px 0 0;
}
@media (max-width: 600px) {
  .cfg-dashboard { grid-template-columns: 1fr; }
}

/* Levá: produkt badge */
.cfg-product {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 8px;
  background: #fff; border: 2px solid #e5e7eb;
  transition: all 0.2s;
}
.cfg-product.product-baxxon1 { background: #f0fdf4; border-color: #86efac; }
.cfg-product.product-baxxon2 { background: #faf5ff; border-color: #d8b4fe; }
.cfg-product.product-empty   { background: #f9fafb; border-color: #e5e7eb; }
.cfg-product.product-error   { background: #fef2f2; border-color: #fca5a5; }
.cfg-product-icon { font-size: 32px; line-height: 1; }
.cfg-product-text { flex: 1; min-width: 0; }
.cfg-product-label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.4px; }
.cfg-product-name  { font-size: 18px; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.cfg-product.product-baxxon1 .cfg-product-name { color: #15803d; }
.cfg-product.product-baxxon2 .cfg-product-name { color: #7c3aed; }
.cfg-product.product-error   .cfg-product-name { color: #dc2626; }
.cfg-product-desc { font-size: 11px; color: #6b7280; margin-top: 3px; }

/* Pravá: capacity bars */
.cfg-bars { display: flex; flex-direction: column; gap: 7px; padding: 4px 0; }
.cfg-bar { display: grid; grid-template-columns: 90px 1fr 70px; gap: 8px; align-items: center; font-size: 12px; }
.cfg-bar-label { color: #4b5563; font-weight: 500; }
.cfg-bar-track { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
.cfg-bar-fill {
  height: 100%; background: #10b981; border-radius: 5px;
  transition: width 0.25s, background 0.25s;
}
.cfg-bar-fill.warn { background: #f59e0b; }
.cfg-bar-fill.err  { background: #dc2626; }
.cfg-bar-value { text-align: right; font-weight: 600; font-family: 'Courier New', monospace; color: #1f2937; }
.cfg-bar-value.warn { color: #92400e; }
.cfg-bar-value.err  { color: #dc2626; }

/* Karty pro sekce */
.cfg-card {
  background: #fff; border: 1px solid #e5e7eb; border-left: 5px solid #6b7280;
  border-radius: 8px; margin-bottom: 12px; overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cfg-card.cfg-card-heating  { border-left-color: #f59e0b; }
.cfg-card.cfg-card-tc       { border-left-color: #ef4444; }
.cfg-card.cfg-card-aku      { border-left-color: #06b6d4; }
.cfg-card.cfg-card-tuv      { border-left-color: #3b82f6; }
.cfg-card.cfg-card-ventily  { border-left-color: #8b5cf6; }
.cfg-card.cfg-card-bivalent { border-left-color: #f97316; }
.cfg-card.cfg-card-inputs   { border-left-color: #10b981; }
.cfg-card.cfg-card-pozn     { border-left-color: #f59e0b; background: #fffbeb; }

.cfg-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
}
.cfg-card-icon { font-size: 20px; line-height: 1; }
.cfg-card-title { font-size: 13px; font-weight: 700; color: #1f2937; flex: 1; }
.cfg-card-hint  { font-size: 11px; color: #9ca3af; }
.cfg-card-body  { padding: 12px 14px; }
.cfg-card-row   { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cfg-card-row + .cfg-card-row { margin-top: 10px; }
.cfg-card-row > label.lbl { font-size: 13px; color: #374151; font-weight: 500; min-width: 110px; }

/* Toggle switch (vypadá jako iOS) */
.cfg-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; user-select: none; }
.cfg-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cfg-toggle-slider {
  position: relative; display: inline-block;
  width: 42px; height: 22px;
  background: #cbd5e1; border-radius: 11px; flex: 0 0 42px;
  transition: background 0.2s;
}
.cfg-toggle-slider::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; top: 2px; left: 2px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: left 0.2s;
}
.cfg-toggle input:checked + .cfg-toggle-slider { background: #2563eb; }
.cfg-toggle input:checked + .cfg-toggle-slider::after { left: 22px; }
.cfg-toggle:hover .cfg-toggle-slider { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }

/* +/− counter */
.cfg-counter {
  display: inline-flex; align-items: stretch;
  border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden;
  background: #fff;
}
.cfg-counter-btn {
  background: #f3f4f6; border: 0; width: 32px; cursor: pointer;
  font-size: 18px; font-weight: 700; color: #374151;
  font-family: inherit; line-height: 1;
}
.cfg-counter-btn:hover { background: #e5e7eb; }
.cfg-counter-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cfg-counter input {
  width: 44px; text-align: center; border: 0;
  border-left: 1px solid #d1d5db; border-right: 1px solid #d1d5db;
  font-weight: 700; font-size: 14px; font-family: inherit;
  padding: 0; outline: 0;
}
.cfg-counter input::-webkit-outer-spin-button,
.cfg-counter input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cfg-counter input { -moz-appearance: textfield; }

/* Button group (vizuální radio) */
.cfg-btn-group {
  display: inline-flex; border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden;
}
.cfg-btn-toggle {
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  background: #fff; color: #374151;
  border-right: 1px solid #d1d5db;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit; line-height: 1.3;
}
.cfg-btn-toggle:last-child { border-right: 0; }
.cfg-btn-toggle input { display: none; }
.cfg-btn-toggle:hover { background: #f3f4f6; }
.cfg-btn-toggle:has(input:checked) { background: #2563eb; color: #fff; }
.cfg-btn-toggle small { opacity: 0.7; font-size: 10px; }
.cfg-btn-toggle:has(input:checked) small { opacity: 0.9; }

/* Conditional reveal block (zobrazí se po zapnutí toggle/counter) */
.cfg-reveal {
  display: none;
  margin-top: 12px; padding: 10px 12px;
  background: #f9fafb; border-left: 3px solid #dbeafe; border-radius: 5px;
}
.cfg-reveal.show { display: block; }
.cfg-reveal > div + div { margin-top: 8px; }

/* Poznámka textarea pretty */
.cfg-pozn-area textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #fbbf24; background: #fff;
  border-radius: 5px; font-family: inherit; font-size: 13px; resize: vertical;
  min-height: 60px; box-sizing: border-box;
}
.cfg-pozn-area textarea:focus { outline: none; border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }

/* Hide old summary div - dashboard replaces it */
.cfg-body .cfg-summary { display: none !important; }

/* Mobile: counters and groups full-width */
@media (max-width: 600px) {
  .cfg-card-row { flex-direction: column; align-items: flex-start; }
  .cfg-card-row > label.lbl { min-width: 0; }
  .cfg-btn-group { flex-wrap: wrap; }
  .cfg-btn-toggle { flex: 1; justify-content: center; }
}

.error { color: #dc2626; font-size: 13px; padding: 8px 12px; background: #fee2e2; border-radius: 5px; margin: 8px 0; }
.success-msg { color: #065f46; font-size: 13px; padding: 8px 12px; background: #d1fae5; border-radius: 5px; margin: 8px 0; }

.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  z-index: 1000; align-items: center; justify-content: center; padding: 24px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff; border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.modal-head h2 { margin: 0; font-size: 16px; flex: 1; color: #111827; }
.modal-close {
  background: transparent; border: 0; font-size: 26px; cursor: pointer; color: #6b7280;
  width: 32px; height: 32px; border-radius: 6px; line-height: 1;
}
.modal-close:hover { background: #e5e7eb; color: #111827; }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-foot { padding: 12px 20px; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; justify-content: flex-end; background: #f9fafb; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: #4b5563; font-weight: 600; margin-bottom: 4px; text-transform: uppercase; }
label.field > input, label.field > select, label.field > textarea { width: 100%; }

/* === COMPACT TOPBAR (1500–1750px) — laptopy a iPad Pro 12.9" landscape mimo hamburger === */
@media (max-width: 1750px) and (min-width: 1501px) {
  .topbar { gap: 6px; padding: 8px 12px; }
  .topbar h1 { font-size: 13px; }
  .topbar h1 .brand-logo { height: 24px; }
  .topbar button, .topbar label.btn {
    padding: 6px 10px; font-size: 12px;
  }
  .topbar nav a { padding: 5px 8px; font-size: 12px; }
  .topbar .save-status { font-size: 11px; }
  .topbar .user-menu { font-size: 12px; }
}

/* === MOBILE / TABLET (do 1500px — iPad Pro landscape + menší) === */
.mobile-menu-btn { display: none; }

@media (max-width: 1500px) {
  /* Zabránit horizontálnímu posunu celé stránky */
  html, body { overflow-x: hidden; max-width: 100vw; }

  /* Topbar zhuštěný */
  .topbar {
    flex-wrap: wrap; gap: 6px; padding: 8px 10px;
    width: 100%; max-width: 100vw; box-sizing: border-box;
  }
  .topbar h1 { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; }
  .topbar h1 .brand-logo { height: 22px; }
  .topbar h1 a { gap: 6px; }

  /* Hamburger viditelný jen na mobilu */
  .mobile-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: #374151; color: #fff; border: 0;
    width: 40px; height: 34px; border-radius: 5px;
    font-size: 20px; cursor: pointer; flex: 0 0 40px;
    font-family: inherit;
  }
  .mobile-menu-btn:hover { background: #4b5563; }

  /* Defaultně schovat všechno kromě loga a hamburgeru */
  .topbar nav,
  .topbar .spacer,
  .topbar .save-status,
  .topbar button:not(.mobile-menu-btn):not(#btnRealizovat):not(#btnVyrobeno),
  .topbar label.btn,
  .topbar .user-menu,
  .topbar .topbar-menu,
  .topbar .user-divider,
  .topbar input[type="file"] {
    display: none;
  }

  /* Otevřené menu - dropdowny se rozvinou inline */
  body.mobile-menu-open .topbar .topbar-menu {
    display: flex; flex-direction: column; width: 100%; gap: 4px;
  }
  body.mobile-menu-open .topbar .topbar-menu-btn { display: none; }
  body.mobile-menu-open .topbar .topbar-menu-items {
    display: flex; flex-direction: column;
    position: static; background: transparent; border: 0;
    box-shadow: none; padding: 0; width: 100%; gap: 4px;
    min-width: 0;
  }
  body.mobile-menu-open .topbar .topbar-menu-items button,
  body.mobile-menu-open .topbar .topbar-menu-items label.topbar-menu-file {
    padding: 12px 14px; font-size: 14px; background: #374151;
    border-radius: 5px;
  }
  body.mobile-menu-open .topbar .topbar-menu-items button:hover,
  body.mobile-menu-open .topbar .topbar-menu-items label.topbar-menu-file:hover {
    background: #4b5563;
  }
  body.mobile-menu-open .topbar .topbar-menu-sep {
    background: #4b5563; margin: 4px 0;
  }

  /* Status badges - sbalená lišta pod topbarem */
  .topbar #stavBadgeHolder,
  .topbar #produktBadgeHolder {
    display: inline-flex; order: 99; margin: 0;
  }

  /* Otevřené menu - vše vertikálně pod sebou */
  body.mobile-menu-open .topbar {
    flex-direction: column; align-items: stretch;
  }
  body.mobile-menu-open .topbar nav,
  body.mobile-menu-open .topbar .save-status,
  body.mobile-menu-open .topbar button:not(.mobile-menu-btn):not(#btnRealizovat):not(#btnVyrobeno),
  body.mobile-menu-open .topbar label.btn,
  body.mobile-menu-open .topbar .user-menu {
    display: flex; width: 100%; justify-content: flex-start;
    padding: 12px 14px; font-size: 14px; margin: 0;
    border-radius: 5px;
  }
  body.mobile-menu-open .topbar nav {
    flex-direction: column; gap: 4px; padding: 0;
  }
  body.mobile-menu-open .topbar nav a {
    padding: 10px 14px; background: #374151; border-radius: 5px;
    display: block;
  }
  body.mobile-menu-open .topbar nav a.active { background: #2563eb; }
  body.mobile-menu-open .topbar .user-menu {
    flex-direction: column; gap: 8px; align-items: stretch;
    border-top: 1px solid #374151; margin-top: 8px; padding-top: 12px;
  }
  body.mobile-menu-open .topbar .user-menu span { padding: 0 14px; color: #cbd5e1; }
  body.mobile-menu-open .mobile-menu-btn {
    position: absolute; top: 8px; right: 10px;
    background: #dc2626;
  }

  /* Tlačítka stavu - fixní spodní lišta */
  #btnRealizovat,
  #btnVyrobeno {
    position: fixed !important;
    bottom: 12px; left: 12px; right: 12px;
    width: auto;
    padding: 14px 20px !important;
    font-size: 14px !important; font-weight: 700;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    z-index: 150;
    margin: 0;
    justify-content: center;
  }

  /* Layout: form a PDF pod sebou */
  .layout { flex-direction: column; height: auto; }
  .form-pane { padding: 10px; padding-bottom: 90px; min-width: 0; }
  .pdf-pane { flex: 0 0 60vh; border-left: 0; border-top: 2px solid #111827; }
  .splitter { display: none; }
  .pdf-pane.collapsed { display: none !important; }

  /* Sekce ve formuláři - tabulky se scrollem */
  .section { overflow: hidden; }
  .section > :not(h2) { padding-left: 10px; padding-right: 10px; }
  .section table.data-table { font-size: 11px; }
  .section table.data-table td.label { width: 50px; padding: 4px; }
  .section .data-table-wrap, .section > table {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .section table.data-table input,
  .section table.data-table select { font-size: 12px; min-width: 0; }

  /* Identifikace - stack info-grid sloupců */
  .header-row, .info-grid, .info-grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Seznam zakázek - umožnit horizontální scroll v tabulce */
  .container { padding: 0 8px; margin: 12px 0; }
  .card { padding: 12px; overflow-x: auto; }
  .list-table { font-size: 12px; min-width: 760px; }
  .filter-btn { padding: 4px 10px; font-size: 11px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input[type=text] { max-width: 100%; min-width: 200px; flex: 1; }

  /* Fullscreen modaly */
  .modal-backdrop.show { padding: 0; align-items: stretch; }
  .modal {
    max-width: 100% !important;
    max-height: 100vh !important;
    height: 100vh; width: 100%;
    border-radius: 0;
    display: flex; flex-direction: column;
  }
  .modal-body { flex: 1; overflow-y: auto; }

  /* Konfigurace modal - sloupce pod sebou */
  .cfg-body .cfg-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .cfg-body label { margin-right: 0; }
  .cfg-body fieldset { padding: 8px 10px; }

  /* Wizard tlačítka - více prostoru */
  .modal-foot { flex-wrap: wrap; gap: 8px; }
  .modal-foot .btn { flex: 1; min-width: 110px; }
}
