:root {
  --bg: #f3f5f8; --card: #ffffff; --text: #101828; --muted: #667085; --faint: #98a2b3; --line: #e4e7ec; --line-soft: #f0f2f5;
  --brand: #16325c; --brand-2: #1d4ed8; --brand-soft: #eef3fb;
  --ok: #067647; --ok-soft: #ecfdf3; --ok-dot: #17b26a;
  --warn: #b54708; --warn-soft: #fffaeb; --warn-dot: #f79009;
  --miss: #475467; --miss-soft: #f2f4f7; --miss-dot: #98a2b3;
  --note: #f79009;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 13.5px; line-height: 1.45;
       -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }

/* Hlavička */
.topbar { height: 56px; display: flex; align-items: center; gap: 20px; padding: 0 24px; background: var(--brand); color: #fff; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.logo b { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.logo b span { opacity: .6; font-weight: 500; }
.nav { display: flex; gap: 4px; }
.nav a { color: rgba(255,255,255,.75); padding: 6px 10px; border-radius: 7px; font-weight: 500; }
.nav a.on, .nav a:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #3b82f6; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.logout { border: 1px solid rgba(255,255,255,.25); background: none; color: rgba(255,255,255,.85); height: 30px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; }
.logout:hover { background: rgba(255,255,255,.1); color: #fff; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; border: 1px solid #d0d5dd; background: var(--card); color: var(--text);
       padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { background: #1e40af; }
.btn svg { width: 16px; height: 16px; }

/* Lišta projektu */
.pagehead { padding: 20px 24px 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pagehead h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.pagehead .sub { color: var(--muted); margin-top: 2px; }
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 10px;
        box-shadow: 0 12px 24px -4px rgba(16,24,40,.12); padding: 4px; min-width: 230px; z-index: 40; display: none; }
.menu.open { display: block; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: none; padding: 8px 10px; border-radius: 7px; text-align: left; }
.menu button:hover { background: var(--miss-soft); }
.menu .ico { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex: none; }
.menu b { display: block; font-weight: 600; }
.menu small { color: var(--muted); }

/* Souhrn */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .lbl { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .num { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok-dot); } .dot.warn { background: var(--warn-dot); } .dot.miss { background: var(--miss-dot); } .dot.all { background: var(--brand-2); }

/* Rozložení */
.layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr); gap: 16px; padding: 16px 24px; height: calc(100vh - 196px); min-height: 520px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 48px; }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-head .hint { color: var(--muted); font-size: 12px; }
.panel-scroll { overflow: auto; flex: 1; }

/* Tabulka */
table.cmp { border-collapse: separate; border-spacing: 0; width: 100%; }
table.cmp th, table.cmp td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
table.cmp thead th { position: sticky; top: 0; z-index: 2; background: #f9fafb; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: var(--muted); }
table.cmp thead th .colname { display: block; font-size: 13px; color: var(--text); margin-top: 1px; }
tr.grp td { background: #fbfcfd; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 7px 14px; border-bottom: 1px solid var(--line); }
td.param { font-weight: 500; }
td.param small { color: var(--faint); font-weight: 400; margin-left: 2px; }
td.val { position: relative; cursor: pointer; white-space: nowrap; padding-right: 74px; }
td.val:hover { background: #f5f8ff; }
td.val.active { background: var(--brand-soft); box-shadow: inset 2px 0 0 var(--brand-2); }
td.val.missing { color: var(--faint); font-style: italic; cursor: default; }
td.val .tools { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
td.val:hover .tools, td.val .tools:focus-within { opacity: 1; }
.tool { border: 0; background: transparent; color: var(--muted); border-radius: 6px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; }
.tool:hover { background: #e4e7ec; color: var(--text); }
.tool svg { width: 14px; height: 14px; }
td.status { white-space: nowrap; }
td.status small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; white-space: normal; }

/* Popover a bublina */
.popover { position: fixed; z-index: 50; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 24px -4px rgba(16,24,40,.14); padding: 4px; min-width: 220px; }
.popover button.item { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; background: none; padding: 8px 10px; border-radius: 7px; text-align: left; }
.popover button.item:hover { background: var(--miss-soft); }
.popover textarea { width: 300px; min-height: 84px; border: 1px solid #d0d5dd; border-radius: 8px; padding: 8px 10px; font: inherit; resize: vertical; outline: none; }
.popover textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px #dbe6fe; }
.popover .row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.popover h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.tip { position: fixed; z-index: 60; max-width: 300px; background: #101828; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; }

/* Prohlížeč PDF */
.viewer .panel-head .title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.viewer .panel-head .title b { font-weight: 600; }
.viewer .panel-head .title span { color: var(--muted); }
.ctl { display: flex; align-items: center; border: 1px solid #d0d5dd; border-radius: 8px; background: var(--card); height: 30px; box-shadow: var(--shadow); }
.ctl button { border: 0; background: none; height: 100%; padding: 0 8px; display: grid; place-items: center; }
.ctl button:hover { background: var(--miss-soft); }
.ctl button + button, .ctl span + button { border-left: 1px solid var(--line); }
.ctl span { min-width: 56px; text-align: center; font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); line-height: 28px; }
.ctl svg { width: 14px; height: 14px; }
.viewer-body { background: #e8ebf0; }
#pageWrap { position: relative; margin: 18px auto; width: max-content; }
#pageWrap canvas { display: block; box-shadow: 0 4px 14px rgba(16,24,40,.16); background: #fff; }
.hl { position: absolute; background: rgba(253, 176, 34, .28); border: 2px solid #f79009; border-radius: 3px; pointer-events: none;
      animation: hlBlink .45s ease-in-out 6 alternate, hlGlow 2s ease-in-out 2.7s infinite; }
/* nejdřív výrazně zabliká, pak jemně pulzuje, aby místo nezmizelo z očí */
@keyframes hlBlink { from { background: rgba(253,176,34,.15); box-shadow: 0 0 0 0 rgba(247,144,9,0); }
                     to { background: rgba(253,176,34,.75); box-shadow: 0 0 0 6px rgba(247,144,9,.35); } }
@keyframes hlGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(247,144,9,.45); } 50% { box-shadow: 0 0 0 7px rgba(247,144,9,0); } }
@media (prefers-reduced-motion: reduce) { .hl { animation: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(247,144,9,.6); } 100% { box-shadow: 0 0 0 14px rgba(247,144,9,0); } }
.empty { color: var(--muted); text-align: center; padding: 90px 30px; }
.empty .ico { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }

/* Patička */
.footer { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 24px 16px; color: var(--muted); font-size: 12px; }
.footer a { color: var(--muted); }

/* Textové stránky */
.doc { max-width: 760px; margin: 28px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 40px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.6; }
.doc h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.3px; }
.doc .meta { color: var(--muted); margin-bottom: 18px; }
.doc h2 { font-size: 16px; margin: 26px 0 6px; }
.doc .draft { background: var(--warn-soft); color: var(--warn); border: 1px solid #fedf89; border-radius: 8px; padding: 10px 14px; margin-bottom: 20px; font-size: 13px; }
.doc .free { background: var(--ok-soft); color: var(--ok); border: 1px solid #abefc6; border-radius: 8px; padding: 12px 16px; margin: 6px 0 4px; }
.doc .ph { background: #fef0c7; padding: 0 4px; border-radius: 4px; }
.doc .dtab { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; table-layout: fixed; }
.doc .dtab th, .doc .dtab td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.doc .dtab th { background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 600; }
.doc .dtab th:nth-child(1) { width: 34%; } .doc .dtab th:nth-child(3) { width: 24%; }
@media (max-width: 640px) { .doc { padding: 22px 18px; } }

/* Tisk / PDF */
.print-only { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; font-size: 10.5px; }
  .topbar, .viewer, .footer, .tools, .popover, .tip, .no-print { display: none !important; }
  .print-only { display: block; }
  .pagehead { padding: 0 0 8px; }
  .layout { display: block; height: auto; padding: 0; }
  .panel { border: 0; box-shadow: none; overflow: visible; }
  .panel-head { display: none; }
  .panel-scroll { overflow: visible; }
  table.cmp thead th { position: static; }
  td.val { padding-right: 14px; }
  tr { break-inside: avoid; }
}
@media (max-width: 1050px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .viewer { min-height: 80vh; }
  .nav { display: none; }
}

/* v4: komentáře, barvy stavů, výpočetní kontrola, reklamní místo */
.panel-head .lg { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-left: 10px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.warn { background: #fff1d6; border: 1px solid #f9c66b; }
.sw.bad { background: #fee4e2; border: 1px solid #f39b92; }
.fxs { font-style: italic; font-weight: 700; font-size: 11px; color: var(--brand-2); }
table.cmp th.cmt-h { min-width: 240px; }
td.val.zad { color: var(--text); }
td.val.st-warn { background: #fff7e6; }
td.val.st-bad { background: #fef1f0; }
td.val.st-warn:hover { background: #fff1d6; }
td.val.st-bad:hover { background: #fee4e2; }
td.cmt { padding: 4px 8px; }
td.cmt.st-warn { background: #fffbf2; }
td.cmt.st-bad { background: #fff7f6; }
td.cmt textarea { width: 100%; min-width: 220px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 5px 6px; font: inherit; font-size: 12.5px;
                  line-height: 1.4; resize: none; overflow: hidden; color: var(--text); outline: none; display: block; }
td.cmt textarea:hover { border-color: var(--line); background: #fff; }
td.cmt textarea:focus { border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px #dbe6fe; }
td.cmt textarea::placeholder { color: #c0c6d0; }
td.cmt.st-warn textarea { color: #93370d; }
td.cmt.st-bad textarea { color: #b42318; }
.calc { margin-left: 7px; border: 1px solid; border-radius: 5px; font-size: 10.5px; font-style: italic; font-weight: 700; padding: 0 5px; height: 18px; line-height: 16px; vertical-align: 1px; background: #fff; }
.calc.ok { color: var(--ok); border-color: #abefc6; }
.calc.bad { color: var(--warn); border-color: #f9c66b; background: #fff7e6; }
.calc.derived { color: var(--brand-2); border-color: #c7d7fe; }
.popover .item.muted { color: var(--muted); cursor: default; }
.calc-pop { padding: 16px 18px; width: 420px; max-width: calc(100vw - 24px); }
.calc-pop .cp-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.calc-pop .cp-head .fxs { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); font-size: 15px; flex: none; }
.calc-pop .cp-head div { flex: 1; } .calc-pop .cp-head small { color: var(--muted); font-size: 11.5px; }
.calc-pop .cp-head h4 { margin: 1px 0 0; font-size: 14px; }
.calc-pop .cp-x { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.calc-pop .cp-x:hover { background: var(--miss-soft); }
.calc-pop .cp-label { font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); margin: 12px 0 6px; }
.calc-pop .eq { font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 17px; background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; white-space: nowrap; }
.calc-pop .eq.sub { font-size: 15px; }
.calc-pop .eq b { font-family: Inter, system-ui, sans-serif; font-size: 15px; margin-left: 2px; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; line-height: 1.15; }
.frac > span { padding: 1px 4px; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; }
.frac .frac { font-size: .9em; }
.calc-pop .cp-vars { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.calc-pop .cp-vars td { padding: 4px 6px; border-bottom: 1px solid var(--line-soft); }
.calc-pop .cp-vars tr:last-child td { border-bottom: 0; }
.calc-pop .cp-vars .sym { font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 14px; width: 44px; }
.calc-pop .cp-vars .val { text-align: right; font-weight: 600; white-space: nowrap; }
.calc-pop .cp-vars tr.const td { color: var(--muted); }
.calc-pop .cp-cmp { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; margin-top: 12px; }
.calc-pop .cp-cmp div { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.calc-pop .cp-cmp small { display: block; color: var(--muted); font-size: 11px; }
.calc-pop .cp-cmp b { font-size: 15px; }
.calc-pop .cp-cmp .ok { background: var(--ok-soft); border-color: #abefc6; } .calc-pop .cp-cmp .ok b { color: var(--ok); }
.calc-pop .cp-cmp .bad { background: #fff7e6; border-color: #fedf89; } .calc-pop .cp-cmp .bad b { color: var(--warn); }
.calc-pop .verdict b { margin-right: 4px; }
.verdict { margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: #fff7e6; color: var(--warn); }
.verdict.info { background: var(--brand-soft); color: var(--brand); }
@media print { td.cmt textarea { border: 0; } .panel-head .lg { display: none; } }

/* v5: menu uživatele */
#userMenu .user-chip { border: 0; background: rgba(255,255,255,.08); color: #fff; height: 36px; padding: 0 10px 0 4px; border-radius: 999px; }
#userMenu .user-chip:hover { background: rgba(255,255,255,.16); }
.menu.um { min-width: 250px; padding: 6px; color: var(--text); }
.menu.um .um-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu.um .um-head b { display: block; }
.menu.um .um-head small { color: var(--muted); }
.avatar.lg { width: 36px; height: 36px; font-size: 15px; color: #fff; }
.menu.um a, .menu.um > button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); font-weight: 500; border: 0; background: none; text-align: left; }
.menu.um a:hover, .menu.um > button:hover { background: var(--miss-soft); text-decoration: none; }
.menu.um svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu.um hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .def { font-size: 10.5px; font-weight: 600; color: var(--brand-2); background: var(--brand-soft); padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.footer .spacer { flex: 1; }

table.cmp { min-width: 980px; }
td.param { min-width: 200px; }

/* v7: zakotvené sloupce, bloky náhrad, přepínač */
table.cmp { min-width: 0; width: max-content; }
table.cmp.single { width: 100%; }
table.cmp th, table.cmp td { background-clip: padding-box; }
td.param, th.param-h { position: sticky; left: 0; z-index: 1; width: 240px; min-width: 240px; max-width: 240px; background: #f4f7fb; border-right: 1px solid var(--line); }
td.val.zad, th.zad-h { position: sticky; left: 240px; z-index: 1; width: 128px; min-width: 128px; background: #fff; font-weight: 700; border-right: 2px solid #c9d3e3; box-shadow: 4px 0 6px -4px rgba(16,24,40,.12); }
table.cmp thead th.param-h, table.cmp thead th.zad-h { z-index: 4; background: #eef2f8; }
table.cmp thead tr:first-child th { top: 0; }
table.cmp thead tr:nth-child(2) th { top: 47px; }
th.n-h { border-top: 3px solid var(--nc); background: color-mix(in srgb, var(--nc) 7%, #fff) !important; border-left: 2px solid #c9d3e3; text-align: left; }
th.n-h .colname { color: color-mix(in srgb, var(--nc) 70%, #101828); }
th.n-sub { font-size: 10.5px !important; padding-top: 5px !important; padding-bottom: 5px !important; background: color-mix(in srgb, var(--nc, #667085) 4%, #fff) !important; }
th.n-sub:not(.cmt-h) { border-left: 2px solid #c9d3e3; }
td.val { width: 118px; min-width: 118px; max-width: 160px; white-space: normal; padding-right: 58px; }
td.val.n-first { border-left: 2px solid #c9d3e3; }
td.val:not(.zad):not(.st-warn):not(.st-bad) { background: #fff; }
td.cmt { width: 250px; min-width: 250px; background: #fff; }
td.cmt.st-warn { background: #fffbf2; } td.cmt.st-bad { background: #fff7f6; }
table.cmp.single td.cmt { width: auto; }
tr.grp td { background: #e9eef6 !important; color: #344054; }
tr.grp td span { position: sticky; left: 14px; }
td.val.active { background: var(--brand-soft) !important; }
.switch-bar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.switch-bar:empty { display: none; }
.switch-bar > span { color: var(--muted); font-size: 12px; margin-right: 2px; }
.switch-bar button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; }
.switch-bar button:hover { border-color: #b8c2d3; }
.switch-bar button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.switch-bar button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* v8: kompaktní řádky, širší hodnoty, skrytí náhledu PDF */
table.cmp th, table.cmp td { padding: 5px 10px; }
table.cmp thead th { padding-top: 7px; padding-bottom: 7px; }
td.param { font-size: 13px; line-height: 1.3; }
td.val { width: 165px; min-width: 165px; max-width: 220px; padding-right: 52px; line-height: 1.3; }
td.val.zad { width: 150px; min-width: 150px; }
th.zad-h { width: 150px; min-width: 150px; }
td.cmt { padding: 2px 6px; width: 240px; min-width: 240px; }
td.cmt textarea { padding: 3px 5px; font-size: 12.5px; line-height: 1.35; min-height: 0; }
tr.grp td { padding: 4px 10px !important; font-size: 10.5px; }
.tool { width: 20px; height: 20px; }
.calc { height: 16px; line-height: 14px; font-size: 10px; }

.pdf-toggle { display: inline-flex; align-items: center; gap: 7px; margin-left: 14px; border: 1px solid var(--line); background: #fff; border-radius: 8px; height: 28px; padding: 0 10px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.pdf-toggle:hover { border-color: #b8c2d3; color: var(--text); }
.pdf-toggle .sw2 { width: 26px; height: 15px; border-radius: 999px; background: #d0d5dd; position: relative; transition: .15s; }
.pdf-toggle .sw2::after { content: ""; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: .15s; }
.pdf-toggle.on { color: var(--text); }
.pdf-toggle.on .sw2 { background: var(--brand-2); }
.pdf-toggle.on .sw2::after { transform: translateX(11px); }
.layout.nopdf { grid-template-columns: minmax(0, 1fr); }
.layout.nopdf .viewer { display: none; }
table.cmp td.cmt { padding: 2px 6px; }
table.cmp td.param, table.cmp td.val { padding-top: 4px; padding-bottom: 4px; }
.panel-head { flex-wrap: wrap; row-gap: 4px; }
.panel-head .lg, .panel-head .hint { white-space: nowrap; }
@media (max-width: 1500px) { .panel-head .hint { display: none; } }

/* v9: označení AI */
.ai-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 11px; font-weight: 600; color: #6941c6; background: #f4f3ff; border: 1px solid #d9d6fe; border-radius: 999px; padding: 1px 8px 1px 6px; }
.ai-tag svg { width: 11px; height: 11px; }
table.cmp td.cmt.ai { position: relative; }
table.cmp td.cmt.ai::after { content: "AI"; position: absolute; top: 3px; right: 5px; font-size: 9px; font-weight: 700; color: #6941c6; background: #f4f3ff; border: 1px solid #d9d6fe; border-radius: 4px; padding: 0 4px; line-height: 13px; pointer-events: none; }
table.cmp td.cmt.ai textarea { padding-right: 26px; }
@media print { table.cmp td.cmt.ai::after { display: none; } }

/* v10: server – čekání na ověření přihlášení, upozornění */
html[data-auth]:not(.auth-ok) body { visibility: hidden; }
.must-change { background: #fffaeb; color: #93370d; border-bottom: 1px solid #fedf89; padding: 8px 24px; font-size: 13px; }
.must-change a { color: #b54708; font-weight: 600; }
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 16px; }
.notice.warn { background: #fffaeb; border: 1px solid #fedf89; color: #93370d; }
.notice.err { background: #fef3f2; border: 1px solid #fecdca; color: #b42318; }
.notice.ok { background: var(--ok-soft); border: 1px solid #abefc6; color: var(--ok); }
.notice b { font-weight: 600; }

/* v11: štítek ukázka / zpracovala AI */
.run-tag { display: inline-block; margin-left: 10px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); }
.run-tag.demo { background: #fff7e6; color: var(--warn); }

/* v12: zobrazení zdroje z Wordu / Excelu */
.textpage { background: #fff; box-shadow: 0 4px 14px rgba(16,24,40,.16); padding: 28px 32px; width: min(760px, calc(100vw - 80px)); white-space: pre-wrap; line-height: 1.65; color: var(--text); font-family: Inter, system-ui, sans-serif; }
mark.hl-t { background: rgba(253,176,34,.35); outline: 2px solid #f79009; border-radius: 3px; padding: 0 2px; animation: hlBlink .45s ease-in-out 6 alternate, hlGlow 2s ease-in-out 2.7s infinite; }
@media (prefers-reduced-motion: reduce) { mark.hl-t { animation: none; } }

/* v13: záložky zařízení, sbalování skupin a komentářů */
.unit-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.unit-tabs > span { color: var(--muted); font-size: 12px; margin-right: 2px; }
.unit-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; }
.unit-tabs a small { background: var(--miss-soft); color: var(--muted); border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 600; }
.unit-tabs a:hover { border-color: #b8c2d3; }
.unit-tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.unit-tabs a.on small { background: rgba(255,255,255,.2); color: #fff; }
tr.grp { cursor: pointer; user-select: none; }
tr.grp:hover td { background: #dfe6f1 !important; }
tr.grp .chev { display: inline-block; font-style: normal; margin-right: 6px; transition: transform .15s; }
tr.grp.folded .chev { transform: rotate(-90deg); }
tr.grp em { font-style: normal; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }
th.n-h { position: relative; padding-right: 30px !important; }
.cfold { position: absolute; top: 6px; right: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 22px; height: 22px; line-height: 1; font-size: 13px; color: var(--muted); cursor: pointer; padding: 0; }
.cfold:hover { color: var(--text); border-color: #b8c2d3; }
.switch-bar .spacer { flex: 1; }
@media print { tr.grp .chev { display: none; } }
.run-tag.ok { background: var(--ok-soft); color: var(--ok); }

/* v14: barva zvolená uživatelem (menu ⋯ nebo pravé tlačítko na buňce) */
td.val.st-good, td.val.zad.st-good { background: #ecfdf3; } td.val.st-good:hover { background: #dcfae6; }
td.cmt.st-good { background: #f3fdf7; } td.cmt.st-good textarea { color: #067647; }
td.val.zad.st-warn { background: #fff7e6; } td.val.zad.st-bad { background: #fef1f0; }
td.val.manual { box-shadow: inset 3px 0 0 var(--mk, transparent); }
td.val.manual.st-good { --mk: #12b76a; } td.val.manual.st-warn { --mk: #f79009; } td.val.manual.st-bad { --mk: #d92d20; } td.val.manual.st-none { --mk: #98a2b3; }
.popover .marks { padding: 6px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.popover .marks small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; padding: 0 4px 2px; }
.popover .mark { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 8px; font-size: 12.5px; text-align: left; cursor: pointer; }
.popover .mark:hover { border-color: #b8c2d3; }
.popover .mark.on { border-color: var(--brand-2); box-shadow: 0 0 0 2px #dbe6fe; }
.popover .mark i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.popover .m-none i { background: #fff; border: 1px solid #d0d5dd; } .popover .m-good i { background: #12b76a; }
.popover .m-warn i { background: #f79009; } .popover .m-bad i { background: #d92d20; }
.popover .mark.reset { grid-column: 1 / -1; color: var(--muted); justify-content: center; }

/* v15: vlastní názvy zařízení a náhrad */
.rename { border: 0; background: none; color: var(--faint); width: 22px; height: 22px; padding: 3px; margin-left: 6px; border-radius: 6px; cursor: pointer; vertical-align: middle; opacity: .55; }
.rename svg { width: 100%; height: 100%; display: block; }
.rename:hover { opacity: 1; color: var(--brand-2); background: var(--brand-soft); }
th.n-h .rename { width: 18px; height: 18px; padding: 2px; margin-left: 4px; }
.rename-pop { padding: 12px 14px; width: 300px; }
.rename-pop input { width: 100%; height: 36px; border: 1px solid #d0d5dd; border-radius: 8px; padding: 0 10px; font: inherit; outline: none; }
.rename-pop input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px #dbe6fe; }
.popover .marks { grid-template-columns: repeat(3, 1fr); }

/* v16: zadání, hodnota i komentář náhrady stejně široké */
table.cmp td.val, table.cmp th.zad-h, table.cmp th.n-sub, table.cmp td.cmt, table.cmp.single td.cmt { width: 200px; min-width: 200px; max-width: 200px; }
table.cmp td.cmt textarea { min-width: 0; }
