/*! Zárezák od MVMSK · © 2026 MVM SK s. r. o. · Kopírovanie kódu a logiky aj voľné nasadenie len s výhradným súhlasom MVM SK s. r. o. */
/*
 * Zárezák – vzhľad podľa témy WOODCNC (woodcnc.sk).
 *
 * Štýluje sa výhradne cez presetové premenné WordPressu. Vo vloženom rámci ich
 * tema.js prevezme z rodičovskej stránky (inline na <html>), takže sa uplatní
 * presne paleta a písma webu vrátane tmavého režimu. Hodnoty nižšie sú len
 * náhradné – pre samostatné otvorenie aplikácie.
 * Dizajn: biele pozadie, veľa vzduchu, ostré hrany, čierne primárne tlačidlá,
 * akcent terakota striedmo (fokus, rez na nákrese, drobné zvýraznenia).
 */
:root {
  --wp--preset--color--base: #FFFFFF;
  --wp--preset--color--paper: #F7F6F4;
  --wp--preset--color--sand: #E7E3DC;
  --wp--preset--color--clay: #C7BFB2;
  --wp--preset--color--line: #E3E0DA;
  --wp--preset--color--graphite: #6B6862;
  --wp--preset--color--ink: #1B1A17;
  --wp--preset--color--accent: #B4522B;
  --wp--preset--font-family--body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --wp--preset--font-family--display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  /* Stavové farby textu (kontrast ≥ 4,5 : 1 na karte aj na vlastnom jemnom pozadí). */
  --z-ok: #2D6A3E;
  --z-warn: #855400;
  --z-error: #B3261E;
  /* Najtmavší odtieň palety – pre tiene a stmavenie pod dialógom. */
  --z-shade: var(--wp--preset--color--ink);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --wp--preset--color--base: #141311;
  --wp--preset--color--paper: #1E1D1A;
  --wp--preset--color--sand: #26241F;
  --wp--preset--color--clay: #8C877E;
  --wp--preset--color--line: #33312C;
  --wp--preset--color--graphite: #A8A39A;
  --wp--preset--color--ink: #F4F2EE;
  --wp--preset--color--accent: #D4703F;
  --z-ok: #7CC08F;
  --z-warn: #E0B25C;
  --z-error: #F08A7A;
  --z-shade: var(--wp--preset--color--base);
  /* Dielce na nákrese sú v tmavom režime o odtieň svetlejšie než pozadie, aby „vystúpili“. */
  --z-svg-part-1: color-mix(in srgb, var(--z-strong) 22%, var(--z-bg));
  --z-svg-part-2: color-mix(in srgb, var(--z-strong) 13%, var(--z-bg));
  --z-svg-part-3: color-mix(in srgb, var(--z-accent) 13%, var(--z-bg));
  --z-svg-part-4: color-mix(in srgb, var(--z-muted) 20%, var(--z-bg));
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wp--preset--color--base: #141311;
    --wp--preset--color--paper: #1E1D1A;
    --wp--preset--color--sand: #26241F;
    --wp--preset--color--clay: #8C877E;
    --wp--preset--color--line: #33312C;
    --wp--preset--color--graphite: #A8A39A;
    --wp--preset--color--ink: #F4F2EE;
    --wp--preset--color--accent: #D4703F;
    --z-ok: #7CC08F;
    --z-warn: #E0B25C;
    --z-error: #F08A7A;
    --z-shade: var(--wp--preset--color--base);
    --z-svg-part-1: color-mix(in srgb, var(--z-strong) 22%, var(--z-bg));
    --z-svg-part-2: color-mix(in srgb, var(--z-strong) 13%, var(--z-bg));
    --z-svg-part-3: color-mix(in srgb, var(--z-accent) 13%, var(--z-bg));
    --z-svg-part-4: color-mix(in srgb, var(--z-muted) 20%, var(--z-bg));
    color-scheme: dark;
  }
}
/* Sémantické aliasy – komponenty nižšie používajú iba tieto premenné.
 * Aplikácia je pracovný nástroj s hustými tabuľkami, preto má výraznejší
 * kontrast než web: pozadie o odtieň tmavšie (karty z neho vystúpia), linky
 * v clay, okraje polí a tlmený text tmavšie (miešané s graphite / ink).
 */
:root {
  --z-bg: color-mix(in srgb, var(--wp--preset--color--sand) 55%, var(--wp--preset--color--paper));
  --z-card: var(--wp--preset--color--base);
  --z-soft: var(--wp--preset--color--sand);
  --z-strong: color-mix(in srgb, var(--wp--preset--color--graphite) 50%, var(--wp--preset--color--clay));
  --z-line: color-mix(in srgb, var(--wp--preset--color--clay) 75%, var(--wp--preset--color--line));
  --z-muted: color-mix(in srgb, var(--wp--preset--color--ink) 35%, var(--wp--preset--color--graphite));
  --z-text: var(--wp--preset--color--ink);
  --z-primary: var(--wp--preset--color--ink);
  --z-on-primary: var(--wp--preset--color--base);
  --z-accent: var(--wp--preset--color--accent);
  --z-focus: var(--wp--preset--color--accent);
  --z-font: var(--wp--preset--font-family--body);
  --z-font-display: var(--wp--preset--font-family--display);
  --z-radius: 0;
  --z-subtle: color-mix(in srgb, var(--z-soft) 45%, var(--z-card));
  --z-glass: color-mix(in srgb, var(--z-card) 93%, transparent);
  --z-shadow: 0 8px 28px color-mix(in srgb, var(--z-shade) 8%, transparent);
  --z-scrim: color-mix(in srgb, var(--z-shade) 45%, transparent);
  --z-ok-bg: color-mix(in srgb, var(--z-ok) 10%, var(--z-card));
  --z-warn-bg: color-mix(in srgb, var(--z-warn) 12%, var(--z-card));
  --z-error-bg: color-mix(in srgb, var(--z-error) 9%, var(--z-card));
  /* Nákres dosky: doska (odpad) je tmavšia/výraznejšia, dielce jemné tóny, rez terakota. */
  --z-svg-board: color-mix(in srgb, var(--z-strong) 60%, var(--z-bg));
  --z-svg-part-1: color-mix(in srgb, var(--z-soft) 70%, var(--z-card));
  --z-svg-part-2: color-mix(in srgb, var(--z-bg) 60%, var(--z-card));
  --z-svg-part-3: color-mix(in srgb, var(--z-accent) 8%, var(--z-card));
  --z-svg-part-4: color-mix(in srgb, var(--z-muted) 14%, var(--z-card));
  --z-svg-part-line: var(--z-muted);
  --z-svg-part-size: color-mix(in srgb, var(--z-text) 75%, var(--z-card));
  --z-svg-done: color-mix(in srgb, var(--z-ok) 28%, var(--z-card));
  --z-svg-remnant: color-mix(in srgb, var(--z-accent) 24%, var(--z-soft));
  --z-svg-remnant-line: color-mix(in srgb, var(--z-accent) 60%, var(--z-soft));
  --z-svg-cut: var(--z-accent);
  --z-svg-group: var(--z-text);
  font-family: var(--z-font);
  color: var(--z-text); background: var(--z-bg); font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 105px; scroll-padding-bottom: 130px; }
body { margin: 0; font-size: 14px; line-height: 1.5; background: var(--z-bg); color: var(--z-text); }
button, input, select { font: inherit; color: inherit; }
button, .button, summary { -webkit-tap-highlight-color: transparent; }
button, .button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 15px; border: 1px solid var(--z-strong); border-radius: var(--z-radius); background: var(--z-card); color: var(--z-text); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.3; transition: background-color .18s, border-color .18s, color .18s; }
button:hover, .button:hover { background: var(--z-subtle); border-color: var(--z-text); }
button:active { background: var(--z-soft); }
button:disabled { opacity: .6; cursor: not-allowed; }
button:disabled:hover { background: var(--z-card); border-color: var(--z-strong); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible, .button:focus-within { outline: 2px solid var(--z-focus); outline-offset: 2px; }
.primary { color: var(--z-on-primary); background: var(--z-primary); border-color: var(--z-primary); min-height: 48px; padding: 13px 22px; font-weight: 500; letter-spacing: .02em; }
.primary:hover, .primary:focus-visible { color: var(--z-on-primary); background: var(--z-accent); border-color: var(--z-accent); }
.primary:disabled:hover { color: var(--z-on-primary); background: var(--z-primary); border-color: var(--z-primary); }
input, select { font-size: 16px; display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: 7px; padding: 10px 11px; border: 1px solid var(--z-strong); border-radius: var(--z-radius); background: var(--z-card); color: var(--z-text); line-height: 1.35; }
input:focus, select:focus { border-color: var(--z-focus); }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox] { display: inline-block; width: 22px; height: 22px; min-height: 22px; flex: 0 0 22px; margin: 0; accent-color: var(--z-text); cursor: pointer; }
input[type=range] { accent-color: var(--z-text); cursor: pointer; padding: 0; border: 0; background: transparent; }
input[type=search] { appearance: none; }
input:disabled, select:disabled { color: var(--z-muted); background: var(--z-bg); }
input:user-invalid { border-color: var(--z-error); background: var(--z-error-bg); }
label { display: block; font-size: 12px; font-weight: 500; }
label small { display: block; margin-top: 6px; }
select { text-overflow: ellipsis; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--z-font-display); color: var(--z-text); }
h1 { font-size: clamp(25px, 2.6vw, 34px); line-height: 1.15; letter-spacing: -.02em; font-weight: 500; }
h2 { font-size: 17px; letter-spacing: -.01em; font-weight: 600; }
h3 { font-size: 15px; line-height: 1.4; font-weight: 600; }
p { color: var(--z-muted); line-height: 1.65; }
small, .hint { font-size: 12px; color: var(--z-muted); line-height: 1.6; }
.hint { margin-top: 14px; }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; color: var(--z-muted); margin-bottom: 9px; }
.muted { color: var(--z-muted); }
.invalid { color: var(--z-error); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 100; left: 16px; top: -100px; padding: 12px; color: var(--z-on-primary); background: var(--z-primary); border-radius: var(--z-radius); }
.skip-link:focus { top: 12px; }
.inline-toggle, .check-label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 12px; }
.check-label { margin: 12px 0; }
.pill { display: inline-flex; padding: 4px 9px; background: var(--z-soft); border-radius: var(--z-radius); font-size: 11px; color: var(--z-text); white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Persistent frame */
.app-header { position: sticky; top: 0; z-index: 30; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 32px; background: var(--z-card); border-bottom: 1px solid var(--z-line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--z-text); text-decoration: none; font-family: var(--z-font-display); font-size: 25px; font-weight: 600; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; background: var(--z-primary); color: var(--z-on-primary); border-radius: var(--z-radius); display: grid; place-items: center; font-size: 25px; }
.brand-caption { margin-left: 12px; padding-left: 20px; border-left: 1px solid var(--z-line); font-family: var(--z-font); font-size: 9px; letter-spacing: .14em; color: var(--z-muted); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 9px; }
/* Samostatne otvorená aplikácia (celá obrazovka) – cesta späť na web.
 * Vo vloženom rámci je web okolo, preto odkaz skrývame (tema.js pridá .is-embedded). */
.header-start { display: flex; align-items: center; gap: 18px; min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 0; border-right: 1px solid var(--z-line); color: var(--z-text); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.back-link:hover { color: var(--z-accent); }
.back-link span[aria-hidden] { font-size: 18px; line-height: 1; }
.is-embedded .back-link { display: none; }
.import-label-short { display: none; }
.import-button { background: var(--z-subtle); border-color: var(--z-strong); color: var(--z-text); }
.action-menu { position: relative; }
.action-menu > summary { display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 44px; min-height: 44px; padding: 9px 14px; border: 1px solid var(--z-strong); background: var(--z-card); color: var(--z-text); border-radius: var(--z-radius); cursor: pointer; font-weight: 500; list-style: none; }
.action-menu > summary:hover { border-color: var(--z-text); }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu[open] > summary { background: var(--z-soft); }
.menu-content { position: absolute; z-index: 40; right: 0; top: calc(100% + 8px); width: 250px; display: grid; gap: 6px; padding: 8px; background: var(--z-card); border: 1px solid var(--z-line); border-radius: var(--z-radius); box-shadow: var(--z-shadow); }
.menu-content button, .menu-content .button { justify-content: flex-start; text-align: left; border-color: transparent; width: 100%; }
main { max-width: 1600px; margin: 0 auto; padding: 28px 24px 130px; }
.job-heading { display: flex; justify-content: space-between; align-items: center; gap: 28px; margin: 0 0 30px; }
.job-heading > div:first-child { min-width: 0; flex: 1; }
.job-field { max-width: 650px; }
.job-field input { border: 1px solid transparent; background: transparent; font-family: var(--z-font-display); font-size: clamp(22px, 2.2vw, 30px); letter-spacing: -.02em; font-weight: 500; padding: 2px 5px; margin: -3px 0 0 -5px; }
.job-field input:hover { background: var(--z-card); border-color: var(--z-line); }
.save-state { display: flex; align-items: center; gap: 7px; font-size: 11px; margin-top: 6px; }
.save-state:before, .status-dot { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--z-ok); border-radius: 50%; }
.save-state.unsaved:before { background: var(--z-warn); }
.job-overview { display: flex; align-items: center; flex: 0 0 auto; }
.job-overview > div { display: grid; gap: 1px; min-width: 100px; padding: 0 23px; border-left: 1px solid var(--z-line); }
.job-overview strong { font-family: var(--z-font-display); font-size: 27px; line-height: 1.2; font-weight: 500; letter-spacing: -.02em; }
.job-overview span { font-size: 11px; color: var(--z-muted); }
.app-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 24px; align-items: start; }
.workflow-nav { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 7px; }
.workflow-nav button { width: 100%; display: flex; align-items: center; gap: 11px; padding: 15px 12px; border-color: transparent; background: transparent; text-align: left; color: var(--z-text); }
.workflow-nav button:hover { background: var(--z-soft); border-color: transparent; color: var(--z-text); }
.workflow-nav button[aria-selected=true] { color: var(--z-on-primary); background: var(--z-primary); border-color: var(--z-primary); }
.nav-number { font-size: 10px; letter-spacing: .08em; font-weight: 500; }
.nav-copy { flex: 1; font-size: 13px; font-weight: 600; }
.nav-copy small { display: block; font-size: 10px; margin-top: 4px; font-weight: 400; color: inherit; opacity: .8; }
.nav-count { background: var(--z-soft); color: var(--z-text); border: 1px solid var(--z-strong); border-radius: var(--z-radius); min-width: 21px; padding: 2px 4px; text-align: center; font-size: 10px; font-weight: 600; }
.workflow-nav [aria-selected=true] .nav-count { color: var(--z-on-primary); background: color-mix(in srgb, var(--z-on-primary) 16%, transparent); }
.nav-note { margin: 25px 12px; padding-top: 18px; border-top: 1px solid var(--z-line); color: var(--z-muted); font-size: 11px; }
.nav-note .status-dot { margin-right: 7px; }
.nav-note small { display: block; margin-top: 5px; font-size: 10px; }
.workspace-content, .workspace { min-width: 0; }
.workspace-content:focus { outline: none; }
.workspace-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin: 1px 0 22px; }
.workspace-heading p:not(.eyebrow) { margin-top: 10px; font-size: 13px; max-width: 560px; }
.next-step { flex-shrink: 0; color: var(--z-text); border-color: transparent; border-bottom-color: var(--z-line); background: transparent; font-size: 12px; padding-inline: 0; }
.next-step:hover { color: var(--z-accent); background: transparent; border-color: transparent; border-bottom-color: var(--z-accent); }
.panel, .sheet { margin: 0 0 20px; padding: 23px; background: var(--z-card); border: 1px solid var(--z-line); border-radius: var(--z-radius); }
.section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.section-title h2 > span { display: none; }
.section-title .actions { margin-left: auto; }
.settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.advanced-settings { display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: 24px; padding-top: 12px; }
.settings-disclosure { margin-top: 20px; border-top: 1px solid var(--z-line); }
summary { padding: 16px 0; cursor: pointer; font-size: 13px; font-weight: 600; }
.context-help { margin-top: 16px; border-top: 1px solid var(--z-line); }
.catalog-disclosure, .report-disclosure { background: var(--z-card); border: 1px solid var(--z-line); border-radius: var(--z-radius); margin-bottom: 20px; }
.catalog-disclosure > summary, .report-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 22px; }
.catalog-disclosure > summary:after, .report-disclosure > summary:after { content: '+'; font-size: 20px; font-weight: 400; }
.catalog-disclosure[open] > summary:after, .report-disclosure[open] > summary:after { content: '−'; }
.catalog-disclosure > summary small { display: block; font-weight: 400; margin-top: 4px; }
.catalog-disclosure .panel, .report-disclosure .panel { border: 0; margin: 0; padding-top: 8px; }
.empty-hint, .workflow-tip { margin: 18px 0; padding: 22px; border: 1px dashed var(--z-strong); border-radius: var(--z-radius); color: var(--z-muted); background: var(--z-subtle); font-size: 13px; }
.workflow-tip b { color: var(--z-text); }
.workflow-tip p { margin-top: 5px; }
/* Editing tables stay compact on wide screens and become cards on tablets. */
.table-wrap { width: 100%; min-width: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; font-variant-numeric: tabular-nums; }
th { padding: 12px 8px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--z-muted); font-weight: 500; border-bottom: 1px solid var(--z-line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--z-line); }
td input { margin-top: 0; min-width: 74px; }
.entry-table tr { scroll-margin-block: 110px 180px; }
.entry-table tr.row-selected { background: var(--z-subtle); border-color: var(--z-text); }
.entry-table td { padding: 10px 5px; }
.entry-table td[data-column=name] input, .entry-table td[data-column=material] input { min-width: 128px; }
.entry-table input { font-size: 13px; padding: 9px; }
.entry-table input[type=checkbox] { min-width: 22px; }
.entry-table td.row-actions { min-width: 82px; white-space: nowrap; }
.row-actions button { width: 36px; min-height: 40px; padding: 6px; border-color: transparent; font-size: 19px; background: transparent; }
.row-actions button:hover { background: var(--z-soft); border-color: transparent; }
.row-actions .remove-row, .remove-row { color: var(--z-error); }
.row-action-label, .card-toggle-label { display: none; }
.row-flag .inline-toggle, .row-selection .inline-toggle { justify-content: center; }
.row-selection { width: 34px; }
.selection-tools { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 0 0 8px; }
#selection-count { font-size: 12px; color: var(--z-text); }
.edge-cell { min-width: 157px; }
.edges-button { min-height: 38px; padding: 8px 10px; font-size: 11px; }
.cut-caption { display: block; font-size: 10px; margin-top: 6px; white-space: nowrap; }
.edge-mini { display: flex; gap: 3px; margin-top: 6px; }
.edge-mini i { width: 19px; height: 4px; border-radius: var(--z-radius); background: var(--z-strong); }
#edge-bands input[data-band=id] { min-width: 94px; font-size: 11px; color: var(--z-muted); background: var(--z-bg); }
#edge-bands input[data-band=color] { width: 52px; min-width: 52px; padding: 4px; }
.edge-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 20px; margin-top: 22px; }
/* Main action is reachable from every step. */
.command-bar { position: fixed; bottom: 20px; left: max(244px, calc((100vw - 1600px) / 2 + 244px)); right: max(24px, calc((100vw - 1600px) / 2 + 24px)); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; background: var(--z-glass); backdrop-filter: blur(14px); border: 1px solid var(--z-line); box-shadow: var(--z-shadow); border-radius: var(--z-radius); }
.command-copy { display: grid; gap: 3px; min-width: 0; }
.command-copy strong { font-size: 13px; font-weight: 600; }
.command-copy span { font-size: 11px; color: var(--z-muted); }
.command-bar .primary { flex-shrink: 0; min-width: 195px; }
.command-bar.computing .primary { cursor: wait; }
.command-bar.computing .command-copy strong:before { content: ''; display: inline-block; width: 10px; height: 10px; border: 2px solid var(--z-strong); border-top-color: var(--z-text); border-radius: 50%; margin-right: 7px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#message:empty { display: none; }
#message:not(:empty) { position: sticky; top: 90px; z-index: 10; margin-bottom: 18px; padding: 12px 16px; background: var(--z-card); border: 1px solid var(--z-line); border-left: 3px solid var(--z-text); color: var(--z-text); border-radius: var(--z-radius); font-size: 12px; box-shadow: var(--z-shadow); }
.error, .warning, #message.error { padding: 16px; border-radius: var(--z-radius); font-size: 13px; }
.warning { background: var(--z-warn-bg); border: 1px solid color-mix(in srgb, var(--z-warn) 30%, var(--z-card)); border-left: 3px solid var(--z-warn); color: var(--z-warn); }
.error, #message.error { background: var(--z-error-bg); border: 1px solid color-mix(in srgb, var(--z-error) 30%, var(--z-card)); border-left: 3px solid var(--z-error); color: var(--z-error); }
.error p, .warning p { color: inherit; margin-top: 7px; }
.warning ul { margin: 8px 0 0; padding-left: 20px; }
#stale-notice, #unplaced:not(:empty) { margin-bottom: 20px; }
.keyboard-done { display: none; }
.undo-toast { position: fixed; bottom: 110px; right: 26px; z-index: 50; max-width: min(520px, calc(100vw - 28px)); display: flex; gap: 14px; align-items: center; padding: 12px 14px; color: var(--z-on-primary); background: var(--z-primary); border-radius: var(--z-radius); box-shadow: var(--z-shadow); font-size: 13px; }
.undo-toast span { min-width: 0; overflow-wrap: anywhere; }
.undo-toast button { background: transparent; color: var(--z-on-primary); border-color: color-mix(in srgb, var(--z-on-primary) 40%, transparent); flex-shrink: 0; }
.undo-toast button:hover, .undo-toast button:active { background: color-mix(in srgb, var(--z-on-primary) 14%, transparent); border-color: var(--z-on-primary); color: var(--z-on-primary); }
/* Results */
.result-heading h1 { margin-bottom: 7px; }
#result-job { color: var(--z-muted); font-size: 12px; }
.plan-empty { max-width: 620px; margin: 25px auto; padding: 25px 10px; text-align: center; }
.plan-empty > p:not(.eyebrow) { margin: 16px auto 20px; max-width: 400px; }
.empty-illustration { position: relative; width: 180px; height: 116px; margin: 0 auto 30px; padding: 8px; border: 1px solid var(--z-strong); background: var(--z-svg-board); border-radius: var(--z-radius); transform: rotate(-4deg); }
.empty-illustration i { position: absolute; border: 1px solid var(--z-svg-part-line); border-radius: var(--z-radius); background: var(--z-svg-part-1); }
.empty-illustration i:nth-child(1) { left: 9px; top: 9px; width: 70px; height: 98px; }
.empty-illustration i:nth-child(2) { left: 84px; top: 9px; width: 86px; height: 44px; background: var(--z-svg-part-3); }
.empty-illustration i:nth-child(3) { left: 84px; top: 58px; width: 60px; height: 49px; background: var(--z-svg-part-4); }
#readiness-list { display: grid; gap: 7px; max-width: 360px; margin: 22px auto; text-align: left; }
.readiness-item { justify-content: flex-start; gap: 12px; background: var(--z-card); border-color: var(--z-line); }
.readiness-item > span:nth-child(2) { flex: 1; }
.readiness-check { display: grid; place-items: center; width: 25px; height: 25px; border-radius: var(--z-radius); background: var(--z-warn-bg); color: var(--z-warn); }
.readiness-check.ready { background: var(--z-ok-bg); color: var(--z-ok); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.metric { padding: 17px 18px; border: 1px solid var(--z-line); background: var(--z-card); border-radius: var(--z-radius); }
.metric strong { display: block; font-family: var(--z-font-display); font-size: 28px; letter-spacing: -.02em; margin-top: 9px; font-weight: 500; white-space: nowrap; }
.metric span { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--z-muted); }
/* Výzva na objednávku porezu – výrazný, ale čistý pás. */
.porez-cta { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin: 0 0 22px; padding: 24px 26px; background: var(--z-soft); border-left: 3px solid var(--z-accent); border-radius: var(--z-radius); }
.porez-cta .eyebrow { color: var(--z-text); margin-bottom: 7px; }
.porez-cta h2 { font-size: 21px; line-height: 1.25; }
.porez-cta p:not(.eyebrow) { margin-top: 8px; max-width: 640px; font-size: 13px; color: color-mix(in srgb, var(--z-text) 82%, var(--z-soft)); }
.porez-cta .primary { flex-shrink: 0; }
.production-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin: 22px 0; }
.production-bar > label { flex: 0 1 260px; }
#production-progress { display: grid; gap: 6px; flex: 1 1 250px; font-size: 13px; }
#production-progress span { font-size: 11px; color: var(--z-muted); }
#production-progress small { font-size: 10px; }
progress { width: 100%; max-width: 400px; height: 7px; accent-color: var(--z-text); }
.search-status { flex-basis: 100%; font-size: 12px; color: var(--z-text); }
.search-status:empty { display: none; }
.sheet-navigation { display: flex; align-items: flex-end; gap: 16px; margin: 24px 0 16px; }
.sheet-selector { flex: 1; min-width: 0; }
.sheet-nav-buttons { display: flex; align-items: center; gap: 8px; }
.sheet-nav-buttons button { min-width: 44px; padding: 9px; }
#sheet-counter { font-size: 11px; min-width: 35px; white-space: nowrap; text-align: center; }
.show-all { font-size: 11px; white-space: nowrap; }
.sheet { padding: 22px; }
.sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sheet-heading h2 { font-size: 20px; }
.sheet-heading .eyebrow { margin-bottom: 5px; }
.sheet-info { font-size: 12px; margin-top: 7px; }
.yield-badge { background: var(--z-subtle); border: 1px solid var(--z-line); color: var(--z-text); border-radius: var(--z-radius); padding: 8px 12px; white-space: nowrap; font-family: var(--z-font-display); font-size: 18px; font-weight: 500; }
.yield-badge small { display: block; color: var(--z-muted); font-family: var(--z-font); font-size: 9px; text-align: right; font-weight: 400; }
.drawing-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: flex-end; margin: 20px 0 12px; }
.drawing-toolbar label { max-width: 440px; }
.zoom-controls { display: flex; align-items: center; gap: 3px; }
.zoom-controls button { min-width: 44px; padding: 8px; font-size: 16px; }
.zoom-controls [data-zoom=reset] { font-size: 11px; min-width: 52px; }
.sheet-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 225px; gap: 22px; }
.sheet-workspace > div { min-width: 0; }
.drawing { background: var(--z-bg); padding: 10px; border: 1px solid var(--z-line); border-radius: var(--z-radius); max-height: min(62dvh, 680px); overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.drawing > svg { display: block; width: 100%; height: auto; max-width: none; max-height: none; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: 10px; color: var(--z-muted); }
.legend span:before { content: ''; display: inline-block; vertical-align: -1px; width: 10px; height: 10px; border: 1px solid var(--z-svg-part-line); border-radius: var(--z-radius); margin-right: 5px; background: var(--z-svg-part-1); }
.legend .offcut:before { background: var(--z-svg-remnant); border-color: var(--z-svg-remnant-line); }
.legend .saw:before { background: var(--z-svg-cut); border-color: var(--z-svg-cut); }
/* Nákres dosky – prezentačné atribúty SVG nepoznajú var(), farby preto nesú triedy. */
.svg-board { fill: var(--z-svg-board); stroke: var(--z-text); vector-effect: non-scaling-stroke; }
.svg-dim { fill: var(--z-muted); }
.svg-remnant { fill: var(--z-svg-remnant); stroke: var(--z-svg-remnant-line); vector-effect: non-scaling-stroke; }
.svg-remnant-label { fill: var(--z-text); }
.svg-part { stroke: var(--z-svg-part-line); vector-effect: non-scaling-stroke; }
.svg-part-1 { fill: var(--z-svg-part-1); }
.svg-part-2 { fill: var(--z-svg-part-2); }
.svg-part-3 { fill: var(--z-svg-part-3); }
.svg-part-4 { fill: var(--z-svg-part-4); }
.svg-part-label { fill: var(--z-text); }
.svg-part-size { fill: var(--z-svg-part-size); }
.svg-cut { fill: var(--z-svg-cut); }
.svg-group { fill: none; stroke: var(--z-svg-group); }
.svg-cut-block { fill: color-mix(in srgb, var(--z-accent) 12%, transparent); stroke: var(--z-accent); }
.svg-cut-active { fill: var(--z-text); stroke: var(--z-text); }
.svg-schema-part { fill: var(--z-svg-part-1); stroke: var(--z-strong); }
.svg-schema-arrow, .svg-schema-label { fill: var(--z-muted); }
.svg-edge-none { stroke: var(--z-strong); }
.part-shape { cursor: pointer; }
.part-shape.selected .part-rect, .part-shape:focus .part-rect { stroke: var(--z-text); stroke-width: 3; }
.part-shape:focus { outline: none; }
.part-shape.produced .part-rect { fill: var(--z-svg-done); }
.part-shape.search-dim { opacity: .18; }
.edge-line { pointer-events: none; }
.part-inspector { border-left: 1px solid var(--z-line); padding-left: 20px; min-width: 0; }
.inspector-empty { padding-top: 40px; color: var(--z-muted); }
.inspector-empty > span { display: block; font-size: 35px; margin-bottom: 10px; }
.inspector-empty p { font-size: 12px; margin-top: 9px; }
.part-inspector h3 { overflow-wrap: anywhere; }
.part-inspector svg { display: block; width: 100%; max-height: 170px; }
.dimension-card { display: grid; gap: 6px; margin-top: 15px; padding: 15px; background: var(--z-subtle); border-radius: var(--z-radius); }
.dimension-card span { color: var(--z-muted); font-size: 10px; }
.dimension-card strong { font-family: var(--z-font-display); font-size: 20px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.dimension-card b { font-size: 14px; }
.edge-detail { margin: 0 0 16px; font-size: 11px; }
.edge-detail > div { display: grid; grid-template-columns: 46px 1fr; gap: 7px; padding: 9px 0; border-bottom: 1px solid var(--z-line); }
.edge-detail dt { color: var(--z-muted); }
.edge-detail dd { margin: 0; }
.edge-detail small { display: block; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: var(--z-radius); margin-right: 6px; }
.part-done { width: 100%; }
.completed { background: var(--z-ok-bg) !important; color: var(--z-ok) !important; border-color: color-mix(in srgb, var(--z-ok) 35%, var(--z-card)) !important; }
.cut-player { display: grid; gap: 14px; margin-top: 20px; padding: 18px; border: 1px solid var(--z-line); border-radius: var(--z-radius); background: var(--z-bg); }
.cut-player-heading { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--z-muted); }
.cut-player-heading .eyebrow { margin-bottom: 0; color: var(--z-muted); }
.cut-step-text { font-size: 14px; line-height: 1.8; min-height: 48px; }
.cut-step-text strong { font-family: var(--z-font-display); font-size: 20px; color: var(--z-accent); }
.slider-label { font-size: 11px; color: var(--z-muted); }
.cut-slider { margin: 0; }
.cut-buttons { display: grid; grid-template-columns: minmax(64px, 1fr) minmax(150px, 2fr) minmax(64px, 1fr); gap: 8px; }
.cut-buttons button { white-space: normal; min-height: 46px; font-size: 12px; }
.cut-buttons [data-cut-done] { background: var(--z-soft); border-color: var(--z-strong); color: var(--z-text); }
.cut-buttons [data-cut-done]:hover { border-color: var(--z-text); }
tr[data-cut-row] { cursor: pointer; }
tr.current-cut td { background: color-mix(in srgb, var(--z-accent) 12%, var(--z-card)); }
tr.cut-complete td:first-child:before { content: '✓ '; color: var(--z-ok); }
.sheet-area-summary { display: flex; flex-wrap: wrap; gap: 12px 22px; font-size: 10px; color: var(--z-muted); padding: 17px 0; }
.sheet-area-summary b { color: var(--z-text); margin-left: 3px; font-weight: 500; }
.sheet > details { border-top: 1px solid var(--z-line); }
.sheet details summary { display: flex; align-items: center; justify-content: space-between; }
.sheet .table-wrap table, .edging-report table { min-width: 610px; }
.result-reports { margin-top: 25px; }
.best-variant { background: var(--z-ok-bg); }
#variant-comparison .panel { margin-top: 18px; }
.edging-total { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.edging-total strong { font-family: var(--z-font-display); font-size: 28px; font-weight: 500; color: var(--z-text); }
.edging-total span { font-size: 11px; color: var(--z-muted); max-width: 150px; }
.edging-total b { font-family: var(--z-font-display); font-size: 23px; font-weight: 500; margin-left: auto; }
body.stale #results { opacity: .5; pointer-events: none; }
/* Dialogs */
body:has(dialog[open]) { overflow: hidden; }
dialog { color: var(--z-text); background: var(--z-card); border: 1px solid var(--z-line); border-radius: var(--z-radius); padding: 24px; width: min(1040px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain; box-shadow: 0 24px 80px color-mix(in srgb, var(--z-shade) 18%, transparent); scroll-padding-block: 90px; }
dialog::backdrop { background: var(--z-scrim, rgb(0 0 0 / .45)); backdrop-filter: blur(3px); }
dialog h3 { margin: 22px 0 12px; }
.dialog-heading { position: sticky; top: -24px; z-index: 4; margin: -24px -24px 20px; padding: 16px 24px; background: var(--z-card); border-bottom: 1px solid var(--z-line); }
.dialog-heading h2 { max-width: calc(100% - 60px); overflow-wrap: anywhere; }
.dialog-heading button { width: 44px; min-height: 44px; padding: 8px; font-size: 24px; }
.import-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 16px; }
#table-mapping { display: block; }
.mapping-extra { margin-top: 20px; border-top: 1px solid var(--z-line); }
.import-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; }
.dialog-footer { position: sticky; z-index: 3; bottom: -24px; margin: 22px -24px -24px; padding: 16px 24px; border-top: 1px solid var(--z-line); background: color-mix(in srgb, var(--z-card) 96%, transparent); backdrop-filter: blur(10px); }
.dialog-footer .hint { margin: 0; max-width: 65%; font-size: 11px; }
.dialog-footer .primary { flex-shrink: 0; }
#table-filename { overflow-wrap: anywhere; margin-bottom: 20px; }
#table-preview { max-height: 250px; border: 1px solid var(--z-line); border-radius: var(--z-radius); }
#table-preview td { white-space: pre-wrap; min-width: 100px; max-width: 230px; overflow-wrap: anywhere; }
#table-error, #edge-error { white-space: pre-line; margin-top: 18px; max-height: 220px; overflow: auto; }
#edge-dialog { max-width: 940px; }
.edge-editor-layout { display: grid; grid-template-columns: 1.1fr 1fr; align-items: start; gap: 28px; }
.edge-editor-layout svg { width: 100%; max-height: 250px; }
.edge-editor-layout > div { min-width: 0; }
.edge-side-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(90px, 1fr); gap: 12px; padding-top: 15px; }
.edge-presets { margin-top: 16px; padding: 15px 0; border-block: 1px solid var(--z-line); }
.edge-presets .actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-top: 12px; }
#part-detail-dialog { max-width: 480px; }
#part-detail-dialog .part-inspector { display: block; border: 0; padding: 0; }
#part-detail-dialog .dimension-card { margin-top: 16px; }
footer { text-align: center; color: var(--z-muted); font-size: 11px; padding: 20px 20px 130px; }
footer p { margin: 0; font-size: inherit; color: inherit; }
footer .footer-legal { margin-top: 6px; font-size: 10px; opacity: .85; }
/* „od MVMSK“ pri názve – menšie, v tlmenej farbe, zarovnané na účiar názvu. */
.brand-by { align-self: flex-end; margin: 0 0 4px -4px; font-family: var(--z-font); font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--z-muted); white-space: nowrap; }
footer a { color: inherit; }
footer a:hover { color: var(--z-accent); }
.part-label { padding: 12px; border: 1px solid var(--z-strong); border-radius: var(--z-radius); display: grid; grid-template-columns: 1fr 115px; gap: 12px; break-inside: avoid; font-size: 11px; min-height: 190px; }
.part-label > div { display: flex; flex-direction: column; gap: 5px; }
.part-label b { font-size: 15px; }
.part-label strong { font-size: 16px; }
.part-label svg { width: 100%; align-self: center; }
.part-label dl { margin: 0; font-size: 9px; }
.part-label dl > div { display: flex; gap: 10px; }
.part-label dt { min-width: 40px; }
.part-label dd { margin: 0; }
@media (max-width: 1200px) {
  .brand-caption { display: none; }
  .workspace-heading { align-items: flex-start; flex-wrap: wrap; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-workspace { grid-template-columns: minmax(0, 1fr) 195px; gap: 16px; }
  .metric { padding: 14px 12px; }
  .metric strong { font-size: 24px; }
}
@media (max-width: 1100px) {
  main { padding-inline: 20px; }
  .app-layout { grid-template-columns: 164px minmax(0, 1fr); gap: 18px; }
  .workflow-nav button { padding: 14px 9px; gap: 9px; }
  .nav-copy { font-size: 12px; }
  .nav-copy small { font-size: 9px; }
  .nav-count { display: none; }
  .command-bar { left: 202px; right: 20px; }
  .job-overview > div { padding: 0 15px; min-width: 85px; }
  .advanced-settings { grid-template-columns: 1fr; gap: 10px; }
  .entry-wrap { overflow: visible; }
  .entry-table, .entry-table tbody { display: block; width: 100%; }
  .entry-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .entry-table tbody { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
  .entry-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 12px; padding: 17px; min-width: 0; background: var(--z-bg); border: 1px solid var(--z-line); border-radius: var(--z-radius); align-content: start; }
  .entry-table td { display: flex; flex-direction: column; padding: 0; border: 0; min-width: 0; }
  .entry-table td:not(.row-actions):not(.row-selection):not(.row-flag):not(.edge-cell):before { content: attr(data-label); margin-bottom: 6px; font-size: 11px; color: var(--z-muted); font-weight: 500; }
  .entry-table td[data-column=name], .entry-table td[data-column=material], .entry-table .edge-cell, .entry-table .row-selection, .entry-table td[data-column=id] { grid-column: 1 / -1; }
  .entry-table td[data-column=name] input, .entry-table td[data-column=material] input, .entry-table input, #edge-bands input[data-band=id] { min-width: 0; width: 100%; font-size: 16px; min-height: 46px; padding: 10px; background: var(--z-card); }
  .entry-table td[data-column=name] input { font-weight: 600; }
  .entry-table input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; flex: 0 0 22px; padding: 0; }
  .entry-table .row-flag { grid-column: 1 / -1; }
  .entry-table .inline-toggle { width: 100%; justify-content: flex-start; }
  .card-toggle-label { display: inline; font-size: 12px; }
  .entry-table td.row-selection { width: 100%; padding-bottom: 4px; }
  .entry-table td.edge-cell { min-width: 0; padding: 11px; background: var(--z-subtle); border-radius: var(--z-radius); }
  .edge-cell .edges-button { min-height: 44px; width: 100%; justify-content: space-between; font-size: 12px; background: var(--z-card); }
  .cut-caption { font-size: 11px; margin-top: 8px; }
  .entry-table td.row-actions { min-width: 0; display: flex; flex-direction: row; justify-content: space-between; gap: 6px; grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--z-line); }
  .row-actions button { display: inline-flex; width: auto; min-height: 44px; padding: 8px; gap: 7px; }
  .row-action-label { display: inline; font-size: 11px; }
  #edge-bands input[data-band=color] { width: 100%; height: 46px; }
}
@media (max-width: 760px) {
  html { scroll-padding-top: 82px; scroll-padding-bottom: 180px; }
  body { font-size: 14px; }
  .header-start { gap: 10px; }
  .back-link { padding-right: 10px; }
  .back-label { display: none; }
  .brand-by { margin: 0 0 3px 3px; font-size: 10px; }
  .app-header { min-height: 64px; padding: 10px 14px; gap: 10px; }
  .brand { font-size: 20px; gap: 7px; }
  .brand-mark { width: 28px; height: 28px; font-size: 21px; }
  .header-actions { gap: 5px; }
  .header-actions .button, .header-actions button, .header-actions summary { padding: 10px; min-width: 44px; font-size: 12px; }
  .save-label { display: none; }
  .save-button { font-size: 19px !important; }
  main { padding: 22px 14px 185px; }
  .job-heading { flex-direction: column; align-items: stretch; gap: 20px; margin-bottom: 24px; }
  .job-field { max-width: none; }
  .job-field input { font-size: 25px; width: calc(100% + 5px); }
  .job-overview { padding: 14px 0; background: var(--z-card); border: 1px solid var(--z-line); border-radius: var(--z-radius); }
  .job-overview > div { width: 33.333%; min-width: 0; padding: 0 17px; }
  .job-overview > div:first-child { border-left: 0; }
  .job-overview strong { font-size: clamp(18px, 5.5vw, 24px); }
  .job-overview span { font-size: 10px; }
  .app-layout { display: block; }
  .workflow-nav { position: fixed; z-index: 25; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px 9px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--z-card) 96%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--z-line); }
  .workflow-nav button { flex-direction: column; justify-content: center; gap: 3px; border-radius: var(--z-radius); text-align: center; padding: 7px 3px; min-height: 54px; }
  .workflow-nav button[aria-selected=true] { background: var(--z-soft); color: var(--z-text); border-color: transparent; box-shadow: inset 0 2px 0 var(--z-text); }
  .nav-number { font-size: 10px; opacity: .7; }
  .nav-copy { font-size: 12px; }
  .nav-copy small, .nav-count, .nav-note { display: none; }
  .workspace-heading { gap: 8px; margin-bottom: 18px; }
  h1 { font-size: 26px; }
  .workspace-heading p:not(.eyebrow) { font-size: 12px; margin-top: 9px; }
  .next-step { padding: 8px 0; min-height: 44px; }
  .panel { padding: 17px; }
  .section-title { gap: 10px; }
  .section-title h2 { font-size: 16px; }
  .section-title .actions { gap: 6px; margin-left: 0; }
  .section-title button { font-size: 12px; padding: 10px 12px; }
  .settings { gap: 17px 12px; }
  .settings input, .settings select, .import-options input, .import-options select, .edge-settings input { font-size: 16px; }
  .hint { font-size: 11px; }
  .entry-table tbody { gap: 14px; }
  .entry-table tr { padding: 15px; }
  .selection-tools { align-items: center; gap: 8px; }
  .catalog-disclosure > summary, .report-disclosure > summary { padding: 16px; }
  .catalog-disclosure .panel { padding-inline: 14px; }
  .edge-settings { grid-template-columns: 1fr; gap: 14px; }
  .command-bar { left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 11px 12px; gap: 10px; }
  .command-copy { gap: 3px; }
  .command-copy strong { font-size: 11px; }
  .command-copy span { font-size: 10px; line-height: 1.35; }
  .command-bar .primary { min-width: 0; max-width: 53%; padding: 13px 14px; font-size: 12px; white-space: normal; }
  body.keyboard-open:not(:has(dialog[open])) .keyboard-done { display: flex; position: fixed; right: 12px; z-index: 35; box-shadow: var(--z-shadow); background: var(--z-card); color: var(--z-text); font-size: 12px; }
  body.keyboard-open .command-bar, body.keyboard-open .workflow-nav { visibility: hidden; pointer-events: none; }
  #message:not(:empty) { top: 76px; font-size: 12px; padding: 11px 13px; }
  .undo-toast { bottom: calc(160px + env(safe-area-inset-bottom)); right: 10px; left: 10px; max-width: none; gap: 10px; font-size: 12px; padding: 10px 12px; }
  .undo-toast button { min-width: 44px; padding: 8px; }
  .result-heading { align-items: flex-start; }
  .result-menu > summary { font-size: 11px; padding: 9px 10px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
  .metric { padding: 14px; }
  .metric strong { font-size: 25px; }
  .metric span { font-size: 10px; }
  .porez-cta { flex-direction: column; align-items: stretch; gap: 18px; padding: 20px 18px; }
  .porez-cta h2 { font-size: 18px; }
  .porez-cta .primary { width: 100%; white-space: normal; }
  .production-bar { gap: 14px; }
  .production-bar > label { flex-basis: 100%; }
  #part-search { font-size: 16px; }
  #production-progress small { max-width: 340px; }
  .sheet-navigation { flex-wrap: wrap; gap: 11px; align-items: flex-end; }
  .sheet-selector { flex-basis: calc(100% - 126px); }
  #sheet-select { font-size: 16px; }
  .show-all { font-size: 12px; min-height: 44px; }
  .sheet { padding: 15px; }
  .sheet-heading h2 { font-size: 18px; }
  .sheet-info { font-size: 11px; }
  .yield-badge { padding: 8px 10px; font-size: 17px; }
  .sheet-workspace { display: block; }
  .sheet-workspace > .part-inspector { display: none; }
  .drawing-toolbar { gap: 10px; margin-top: 17px; }
  .drawing-toolbar select { font-size: 16px; }
  .drawing { padding: 7px; max-height: 55dvh; }
  .legend { gap: 10px; font-size: 10px; }
  .cut-player { padding: 14px; margin-top: 17px; gap: 12px; }
  .cut-buttons { grid-template-columns: 60px minmax(0, 1fr) 60px; gap: 6px; }
  .cut-buttons button { padding: 10px 7px; font-size: 11px; }
  .cut-step-text { font-size: 13px; }
  .sheet-area-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .edging-total { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; }
  .edging-total b { margin-left: 0; }
  dialog { inset: 0; margin: 0; width: 100%; max-width: 100%; height: var(--visual-height, 100dvh); max-height: var(--visual-height, 100dvh); border: 0; padding: 16px; }
  .dialog-heading { top: -16px; margin: -16px -16px 20px; padding: 13px 16px; padding-top: max(13px, env(safe-area-inset-top)); }
  .dialog-heading h2 { font-size: 17px; }
  .dialog-footer { bottom: -16px; margin: 20px -16px -16px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); gap: 12px; }
  .dialog-footer .hint { font-size: 10px; max-width: 49%; }
  .dialog-footer .primary { max-width: 51%; padding: 13px 15px; font-size: 12px; white-space: normal; }
  .import-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; }
  #table-error, #edge-error { font-size: 12px; }
  #edge-dialog, #part-detail-dialog { max-width: 100%; }
  .edge-editor-layout { display: flex; flex-direction: column; gap: 15px; }
  .edge-editor-layout > div { width: 100%; }
  .edge-editor-layout > div:last-child { order: -1; display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 10px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--z-line); }
  .edge-editor-layout > div:last-child > .hint { grid-column: 1 / -1; margin: 0; font-size: 10px; }
  .edge-editor-layout .dimension-card { padding: 12px; margin: 0; }
  .edge-editor-layout .dimension-card strong { font-size: 18px; }
  .edge-editor-layout .dimension-card b { font-size: 13px; }
  .edge-side-row input, .edge-side-row select, #edge-dimension-mode, #edge-preset-band { font-size: 16px; }
  .edge-side-row { grid-template-columns: minmax(0, 1.6fr) minmax(90px, 1fr); gap: 10px; padding-top: 16px; }
  .edge-presets .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #part-detail-dialog .part-inspector { padding-bottom: 20px; }
  #part-detail-dialog .part-inspector svg { max-height: 210px; }
  #part-detail-dialog .part-done { position: sticky; bottom: 0; background: var(--z-card); min-height: 50px; }
  footer { padding-bottom: 180px; font-size: 10px; }
}
@media (pointer: coarse) {
  .row-actions button { min-height: 44px; min-width: 44px; }
  .edges-button { min-height: 44px; }
}
@media (max-width: 420px) {
  .import-label-full { display: none; }
  .import-label-short { display: inline; }
  .cut-buttons { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .cut-buttons [data-step] span { display: none; }
  .sheet-navigation { gap: 10px; }
  .header-actions { gap: 4px; }
  .app-header { padding-inline: 10px; }
  .brand { font-size: 19px; gap: 5px; }
  .import-button { gap: 4px; padding-inline: 9px !important; }
  main { padding-inline: 10px; }
  .panel { padding: 14px; }
  .entry-table tr { padding: 13px; }
  .workspace-heading h1 { font-size: 24px; }
  .command-bar { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}
@media print {
  /* Tlač je vždy čiernobiela bez ohľadu na tému a tmavý režim. */
  :root, :root[data-theme] {
    --z-bg: #fff; --z-card: #fff; --z-text: #000; --z-primary: #000; --z-on-primary: #fff;
    --z-muted: color-mix(in srgb, #000 75%, #fff); --z-line: color-mix(in srgb, #000 30%, #fff);
    --z-strong: color-mix(in srgb, #000 45%, #fff); --z-soft: color-mix(in srgb, #000 8%, #fff);
    --z-accent: #000; --z-focus: #000; --z-ok: #000; --z-warn: #000; --z-error: #000; --z-shade: #000;
    color-scheme: light;
  }
  :root { background: #fff; color: #000; }
  body { font-size: 10px; background: #fff; color: #000; }
  .app-header, .workflow-nav, .job-heading, .command-bar, .undo-toast, .workspace-heading, .production-bar, .sheet-navigation, .drawing-toolbar, .part-inspector, .cut-player, .result-menu, .porez-cta, #variant-comparison, #message, dialog, footer, button, .skip-link { display: none !important; }
  main { max-width: none; padding: 0; margin: 0; }
  .app-layout { display: block; }
  .workspace { display: none !important; }
  .workspace[data-workspace=plan] { display: block !important; }
  #result-empty { display: none !important; }
  .result-heading { margin-bottom: 15px; }
  .result-heading h1 { font-size: 24px; }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-block: 10px; }
  .metric { padding: 10px; }
  .metric strong { font-size: 22px; }
  .sheet, .sheet[hidden] { display: block !important; break-before: page; border: 0; padding: 0; border-radius: 0; margin: 0; }
  .sheet-workspace { display: block; }
  .drawing { max-height: none; overflow: visible; background: #fff; padding: 0; border: 0; margin-top: 14px; }
  .drawing > svg { width: 100% !important; max-height: 155mm; }
  .part-shape.search-dim { opacity: 1; }
  .part-shape.produced .part-rect { fill: var(--z-soft); }
  .part-shape.selected .part-rect { stroke-width: 1; }
  .cut-highlight { display: none; }
  .sheet > details:last-child { display: none; }
  .sheet details summary { padding: 10px 0; }
  .sheet .table-wrap { overflow: visible; }
  .sheet .table-wrap table { min-width: 0; font-size: 9px; }
  .sheet .table-wrap td { padding: 5px; }
  .report-disclosure { border: 0; }
  .edging-report { break-before: page; padding: 0; border: 0; }
  .edging-report table { min-width: 0; font-size: 9px; }
  .edging-report .table-wrap { overflow: visible; }
  body.stale #results { display: none !important; }
  body.stale main:before { content: 'Nárezový plán je neaktuálny. Pred tlačou spustite nový výpočet.'; display: block; padding: 20px; border: 2px solid #000; color: #000; font-size: 18px; }
  body.labels-mode main { display: none !important; }
  body.labels-mode #labels { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.labels-mode .part-label { min-height: 56mm; height: auto; font-size: 9px; padding: 9px; grid-template-columns: 1fr 90px; border-color: #000; }
  body.labels-mode .part-label strong { font-size: 14px; }
  body.labels-mode .part-label b { font-size: 12px; }
  body.labels-mode .part-label small { font-size: 8px; }
}
/* Decor direction and physically matched groups. */
.entry-table select { min-width: 146px; font-size: 12px; margin-top: 0; }
.grain-match-button { width: 100%; max-width: 230px; justify-content: flex-start; margin-top: 8px; min-height: 38px; font-size: 11px; overflow-wrap: anywhere; white-space: normal; }
.grain-match-button.has-group { background: var(--z-soft); border-color: var(--z-text); color: var(--z-text); }
.grain-options { margin-top: 20px; }
.grain-preview { padding: 18px; background: var(--z-subtle); border: 1px solid var(--z-line); border-radius: var(--z-radius); margin-top: 20px; }
.grain-preview ol { margin: 12px 0 0; padding-left: 22px; max-height: 230px; overflow: auto; }
.grain-preview li { padding: 8px 0; border-bottom: 1px solid var(--z-line); }
.grain-preview li span { display: block; font-size: 11px; color: var(--z-muted); }
#grain-error { white-space: pre-line; margin-top: 16px; }
.grain-report-body { padding: 0 22px 22px; }
.grain-report-item { padding: 14px 0; border-bottom: 1px solid var(--z-line); }
.grain-report-item > span { display: block; font-size: 12px; color: var(--z-muted); margin-top: 6px; }
.grain-report-item ol { font-size: 12px; }
.grain-note { padding: 10px 12px; background: var(--z-subtle); border-radius: var(--z-radius); color: var(--z-text); font-size: 11px; margin-top: 12px; }
.decor-note { font-size: 11px; color: var(--z-muted); margin-top: 10px; }
.legend .matching:before { background: transparent; border: 1.5px dashed var(--z-svg-group); }
@media (max-width: 1100px) {
  .entry-table select { width: 100%; min-width: 0; font-size: 16px; min-height: 46px; }
  .entry-table td[data-column=grainDirection] { grid-column: 1 / -1; }
  .grain-match-button { min-height: 44px; max-width: none; }
}
@media (max-width: 760px) {
  .grain-options input, .grain-options select { font-size: 16px; }
  .grain-report-body { padding: 0 16px 16px; }
  .grain-options > label:first-child { grid-column: 1 / -1; }
}
@media print {
  .grain-match-button { display: none !important; }
}
