:root {
  --bg: #f4f5f7; --karta: #fff; --text: #1d2229; --sedy: #6b7280; --linka: #d9dde3;
  --modra: #2f6fd1; --modra2: #e6efff; --chyba: #c62828; --var: #b26a00; --ok: #2e7d32;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--linka); background: #fff; border-radius: 8px; padding: 6px 12px; min-height: 36px; }
button:hover:not(:disabled) { border-color: var(--modra); }
button.hlavni { background: var(--modra); color: #fff; border-color: var(--modra); font-weight: 600; }
button.smaz { color: var(--chyba); }
button.mini { min-height: 28px; padding: 2px 8px; }
button.odkaz { border: 0; background: none; color: var(--modra); font-weight: 700; padding: 0; min-height: 0; }
input, select { border: 1px solid var(--linka); border-radius: 6px; padding: 5px 7px; background: #fff; min-height: 34px; max-width: 100%; }
.tlacitko { display: inline-flex; align-items: center; border: 1px solid var(--linka); background: #fff; border-radius: 8px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.sedy { color: var(--sedy); }
small { font-size: 12px; }

.hl { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #1f2a3a; color: #fff; }
.hl .zpet { min-height: 48px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.1; padding: 4px 12px; background: #2f3d52; color: #fff; border-color: #44536b; font-weight: 700; font-size: 17px; flex-shrink: 0; }
.hl .zpet small { font-weight: 400; font-size: 11px; opacity: .8; }
.hl .zpet:disabled { opacity: .45; cursor: default; }
.hl .titul { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; }
.hl .titul b { font-size: 18px; }
.hl .ver { font-size: 12px; color: #a9b4c4; }
.hl .pj { overflow: hidden; text-overflow: ellipsis; color: #dce6f5; }
.hl .ikona { min-height: 44px; min-width: 44px; background: #2f3d52; color: #fff; border-color: #44536b; font-weight: 700; }
.hl .pdf { background: #c23b3b; border-color: #c23b3b; }
.zalozky { position: sticky; top: 60px; z-index: 19; display: flex; gap: 4px; overflow-x: auto; padding: 6px 10px; background: #fff; border-bottom: 1px solid var(--linka); scrollbar-width: none; }
.zalozky button { border: 0; background: none; border-radius: 18px; white-space: nowrap; font-weight: 600; color: var(--sedy); }
.zalozky button.akt { background: var(--modra2); color: var(--modra); }
.odz { display: inline-block; margin-left: 4px; min-width: 18px; padding: 0 5px; border-radius: 9px; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.odz.chyba { background: var(--chyba); } .odz.varovani { background: var(--var); }

.obsah { padding: 10px; max-width: 1500px; margin: 0 auto; }
.lista { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.pole { display: inline-flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pole > span { color: var(--sedy); font-size: 12px; }
.pole.uzke input { width: 70px; }
.pole.siroke { display: flex; margin-bottom: 8px; }
.pole.siroke input, .pole.siroke select { width: 100%; }
.volno { display: inline-flex; flex-direction: column; white-space: nowrap; font-size: 14px; padding-bottom: 4px; }
.volno small span { margin-right: 8px; color: var(--sedy); }
.volno .plno { color: var(--var); } .volno .plno-chyba { color: var(--chyba); font-weight: 700; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.plocha { min-width: 0; }
.plocha, .panel > section { background: var(--karta); border: 1px solid var(--linka); border-radius: 10px; padding: 10px; }
.panel { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 112px; }
.svg-obal { overflow-x: auto; }
.svg-skrin { width: 100%; height: auto; display: block; user-select: none; }
.svg-skrin .prvek { cursor: grab; touch-action: none; }
.svg-skrin .slot { cursor: pointer; }
.svg-skrin .slot:hover { fill: #eaf2ff; }
.knihovna h3, .detail h3 { margin: 0 0 8px; font-size: 15px; }
.chipy { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chip { min-height: 30px; padding: 3px 9px; border-radius: 15px; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.chip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chip.akt { background: var(--modra2); border-color: var(--modra); }
.volby { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.karta { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px dashed var(--modra); border-radius: 8px; background: #f7faff; cursor: grab; touch-action: none; margin-bottom: 8px; }
.karta-sirka { height: 46px; border-radius: 3px; background: repeating-linear-gradient(90deg, #2f6fd1 0 12px, #fff 12px 14px); flex-shrink: 0; }
.orient { color: var(--var); }
.pridat { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pridat .hlavni { margin-left: auto; }
.cil { display: inline-flex; gap: 4px; align-items: center; background: var(--modra2); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.det-hl { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; }
.posun { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.posun button { min-width: 44px; }
.posun .smaz { margin-left: auto; }

.kontroly { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.kon { padding: 6px 9px; border-radius: 6px; font-size: 13.5px; border-left: 4px solid; margin-top: 4px; }
.kon[data-a] { cursor: pointer; }
.kon.chyba { background: #fdecec; border-color: var(--chyba); }
.kon.varovani { background: #fff4e0; border-color: var(--var); }
.kon.info { background: #eef3fa; border-color: #8aa4c8; }
.kon.ok { background: #eaf6ea; border-color: var(--ok); margin-top: 10px; }
span.ok { color: var(--ok); font-weight: 700; } span.varovani { color: var(--var); font-weight: 700; } span.chyba { color: var(--chyba); font-weight: 700; }

.filtr { width: 220px; margin-bottom: 8px; }
.tab-obal { overflow: auto; max-height: calc(100vh - 190px); border: 1px solid var(--linka); border-radius: 10px; background: #fff; }
.tab { border-collapse: collapse; width: 100%; font-size: 14px; }
.tab th, .tab td { padding: 6px 8px; border-bottom: 1px solid #eceef2; text-align: left; vertical-align: middle; white-space: nowrap; }
.tab thead th { position: sticky; top: 0; background: #f0f2f5; z-index: 1; }
.tab th.radit { cursor: pointer; user-select: none; }
.tab th.radit:hover { color: var(--modra); }
.tab .num { text-align: right; }
.tab tr.klik { cursor: pointer; }
.tab tr.klik:hover td { background: #f5f8ff; }
.tab tfoot td { background: #f7f8fa; position: sticky; bottom: 0; }
.tab td input:not(.cislo) { min-width: 180px; }
.tab td .cislo { width: 90px; text-align: right; }
.tab .prazdno { text-align: center; color: var(--sedy); padding: 20px; }
.tab.mala { width: auto; margin-top: 6px; }
.akce { display: inline-flex; gap: 4px; }
.ref { margin-top: 14px; }
h3 { font-size: 16px; margin: 16px 0 6px; }

.schema-obal { background: #fff; border: 1px solid var(--linka); border-radius: 10px; }
.svg-schema { display: block; min-width: 760px; width: 100%; height: auto; }

.stitky { display: flex; flex-direction: column; gap: 3mm; }
.stitek-radek { display: flex; align-items: center; gap: 2mm; }
.stitek-cislo { width: 9mm; font-size: 9pt; color: var(--sedy); flex-shrink: 0; }
.stitek { display: flex; border: 0.3mm solid #333; background: #fff; }
.st-bunka { height: 11mm; border-right: 0.2mm solid #555; padding: 0.6mm; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-size: 6pt; line-height: 1.1; flex-shrink: 0; }
.st-bunka:last-child { border-right: 0; }
.st-bunka b { font-size: 6.5pt; }

.zavoj { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
.dialog { position: fixed; z-index: 41; top: 70px; left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 90px); overflow: auto; background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dialog h3 { margin-top: 0; }
.zprava { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-weight: 600; }
.zprava.chyba { background: var(--chyba); } .zprava.ok { background: var(--ok); }
#duch { position: fixed; z-index: 60; pointer-events: none; background: var(--modra); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 13px; }
#tisk { display: none; }

@media (max-width: 860px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; }
  .hl .titul b { font-size: 16px; }
  .obsah { padding: 8px; }
  .filtr { width: 100%; }
}
@media (max-width: 420px) {
  .hl { gap: 6px; padding: 6px 8px; }
  .hl .zpet { padding: 4px 9px; font-size: 16px; }
  .hl .ikona { min-width: 40px; padding: 4px 6px; }
}

@page { size: A4 landscape; margin: 9mm; }
@media print {
  html, body { background: #fff; font-size: 10pt; }
  #app, #zprava, #duch { display: none !important; }
  #tisk { display: block; }
  .list { page-break-after: always; break-after: page; }
  .list:last-child { page-break-after: auto; break-after: auto; }
  .t-hl { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 0.5mm solid #000; padding-bottom: 2mm; margin-bottom: 3mm; font-size: 9pt; }
  .t-nazev { font-size: 12pt; }
  .t-mid { font-size: 13pt; font-weight: 700; align-self: center; }
  .t-prava { text-align: right; }
  .t-svg svg { display: block; width: 100%; height: auto; max-height: 158mm; min-width: 0; }
  .t-pozn { font-size: 8.5pt; color: #333; margin: 2mm 0; }
  .t-pata { font-size: 7.5pt; color: #555; margin-top: 3mm; }
  .tisk-tab { font-size: 7.5pt; line-height: 1.15; width: 100%; border-collapse: collapse; }
  .tisk-tab th, .tisk-tab td { padding: 0.25mm 2mm; border-bottom: 0.2mm solid #ccc; text-align: left; }
  .tisk-tab .num { text-align: right; }
  .tisk-tab th { background: #eee; }
  .stitky { gap: 1.2mm; margin-top: 1.5mm; }
  .st-bunka { height: 9mm; }
  .t-hl { margin-bottom: 2mm; }
  .stitek-cislo { width: 7mm; }
  .svg-skrin .slot { stroke: none; fill: transparent; }
}
