/* Quba LaserLab: wygląd aplikacji. Kolory wyłącznie ze zmiennych (src/brand/tokens.css), motyw jasny/ciemny przełącza src/brand/theme.js. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 400 13px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
body { display: flex; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
a { color: var(--primary); }
#side { width: 300px; flex: none; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 10px 12px 30px; }
#view { flex: 1; position: relative; min-width: 0; background: var(--scene-bg); }
#view canvas { display: block; }
h1 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; }
h1 small { font-weight: 400; color: var(--muted); font-size: 12px; }
h2 { font: 500 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 0 6px; }
section { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.tools label, label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--primary); }
input[type=number], input[type=text], select, textarea { width: 100%; padding: 4px 7px; border: 1px solid var(--field-border); border-radius: var(--r-sm); font: inherit; color: var(--text); background: var(--surface-2); transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
input[type=number] { font-family: var(--mono); font-size: 12px; }
input::placeholder { color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
option { background: var(--surface); color: var(--text); }
button { padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
button.danger { color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
@media (hover:hover) and (pointer:fine) {
  button:not(:disabled):hover { border-color: var(--primary); color: var(--primary); }
  button.primary:not(:disabled):hover { background: var(--primary); color: var(--on-primary); filter: brightness(1.08); }
  button.danger:not(:disabled):hover { border-color: var(--danger); color: var(--danger); }
}
.hint { color: var(--muted); font-size: 11px; margin: 6px 0 0; }
.hint a { color: var(--primary); }
.legend span[style] { background: var(--paper); border-radius: 2px; padding: 0 2px; }
#warnings { margin: 0; padding-left: 16px; color: var(--danger); }
.joints { list-style: none; padding: 0; margin: 4px 0 0; }
.joints li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.joints li span { flex: 1; }
.joints select { width: 90px; }
#status { position: absolute; left: 10px; bottom: 8px; color: var(--muted); font: 500 11px var(--mono); pointer-events: none; background: var(--label-bg); padding: 2px 6px; border-radius: var(--r-sm); }
#status:empty { display: none; }
/* Gizmo kierunku widoku w Edytorze 3D (src/view-gizmo.js): tarcza celownika lasera – świecący pierścień z podziałką,
   zwężające się promienie osi i romby z literą; klik = widok z tej strony, przeciąganie = obrót kamery */
.vgz { position: absolute; top: 10px; right: 10px; z-index: 6; width: 104px; height: 104px; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.vgz svg { display: block; overflow: visible; }
.vgz.dragging { cursor: grabbing; }
.vgz-face { fill: var(--label-bg); opacity: .78; transition: opacity var(--dur) var(--ease-out); }
.vgz:hover .vgz-face, .vgz.dragging .vgz-face, .vgz:focus-within .vgz-face { opacity: 1; }
.vgz-ring { fill: none; stroke: var(--primary); stroke-width: 1.5; opacity: .75; transition: opacity var(--dur) var(--ease-out); }
.vgz:hover .vgz-ring, .vgz.dragging .vgz-ring, .vgz:focus-within .vgz-ring { opacity: 1; }
.vgz-ticks line { stroke: var(--primary); stroke-width: .35; opacity: .45; }
.vgz-ticks line.major { stroke-width: 1.1; opacity: 1; stroke-linecap: round; }
.vgz-dots { fill: none; stroke: var(--primary); stroke-width: .9; stroke-linecap: round; stroke-dasharray: 0 2.6; opacity: .45; }
.vgz-core { fill: var(--primary); }
.vgz-axis.vgz-x { fill: var(--axis-x); }
.vgz-axis.vgz-y { fill: var(--axis-y); }
.vgz-axis.vgz-z { fill: var(--axis-z); }
.vgz-axis.neg { fill: var(--primary); }
.vgz-ball { cursor: pointer; outline: none; }
.vgz-ball.vgz-x { --ax: var(--axis-x); } .vgz-ball.vgz-y { --ax: var(--axis-y); } .vgz-ball.vgz-z { --ax: var(--axis-z); }
.vgz-dia { fill: var(--ax); stroke: var(--ax); stroke-width: .6; transition: fill-opacity var(--dur-fast) var(--ease-out); }
.vgz-ball.neg .vgz-dia { fill: var(--ax); fill-opacity: .08; stroke-width: 1; stroke-opacity: .75; }
.vgz-hot { fill: none; stroke: var(--primary); stroke-width: 1.1; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.vgz-ball.hot .vgz-hot, .vgz-ball:focus-visible .vgz-hot { opacity: 1; }
.vgz-ball.neg.hot .vgz-dia { fill-opacity: .3; stroke-opacity: 1; }
.vgz-ball text { font: 700 8.5px var(--mono); fill: var(--axis-ink); pointer-events: none; }
.vgz-ball.neg text { font-size: 6px; fill: var(--text); }
.vgz-tip { position: absolute; top: calc(100% + 6px); left: 50%; transform: translate(-50%, -2px); white-space: nowrap; pointer-events: none; font: 500 11px var(--mono); color: var(--text); background: var(--label-bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px 8px; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.vgz.tip-on .vgz-tip { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 700px) { .vgz { width: 84px; height: 84px; top: 8px; right: 8px; } }
@media (prefers-reduced-motion: reduce) { .vgz-face, .vgz-ring, .vgz-dia, .vgz-hot, .vgz-tip { transition: none; } }
#sheets { position: absolute; z-index: 20; right: 10px; top: 10px; bottom: 10px; width: min(460px, 60%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); display: flex; flex-direction: column; }
#sheets[hidden] { display: none; }
.sheets-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border); }
#sheets-body { overflow: auto; padding: 10px; }
#sheets-body figure { margin: 0 0 12px; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
#sheets-body figcaption { font: 500 11px var(--mono); color: var(--muted); margin-bottom: 4px; }
/* podgląd arkusza = podgląd pliku do cięcia: zostaje jasnym „papierem” w obu motywach */
#sheets-body svg { width: 100%; height: auto; background: var(--paper); border: 1px solid var(--paper-line); border-radius: 2px; }
#sheets-body svg path { vector-effect: non-scaling-stroke; stroke-width: 1px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tools button { text-align: left; display: flex; justify-content: space-between; align-items: center; }
.tools button.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.tools button.active kbd { background: transparent; color: inherit; border-color: currentColor; }
kbd { font: 500 10px/1 var(--mono); border: 1px solid var(--border); border-radius: 3px; padding: 2px 4px; background: var(--surface-2); color: var(--muted); }
.dim-label, .measure-label { font: 500 11px/1 var(--mono); padding: 2px 4px; border-radius: 3px; background: var(--label-bg); white-space: nowrap; }
.dim-label { color: var(--dim-text); border: 1px solid var(--dim-text); }
.dim-edit { pointer-events: auto; cursor: text; }
.dim-edit:hover { background: var(--hover-bg); }
.cell-label { font: 500 11px/1 var(--mono); padding: 2px 5px; border-radius: 3px; background: var(--label-bg); color: var(--dim-text); border: 1px dashed var(--dim-text); white-space: nowrap; pointer-events: none; }
.cell-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 4px 0; }
.cell-ctl { display: inline-flex; gap: 3px; align-items: center; }
.cell-ctl input { width: 52px; text-align: center; }
.cell-ctl button { min-width: 26px; padding: 2px 6px; }
.cell-sizes { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 2px 0 4px; font-size: 11px; color: var(--muted); }
.cell-sizes input { width: 54px; }
.dim-input { pointer-events: auto; width: 52px; font: 600 11px/1 var(--mono); padding: 1px 2px; margin: -2px -4px; border: 1px solid var(--primary); border-radius: 3px; color: var(--text); background: var(--surface); }
.sel-toolbar { pointer-events: none; }
.sel-toolbar-inner { position: relative; left: 95px; top: -55px; display: flex; gap: 4px; pointer-events: auto; }
.sel-toolbar button { width: 30px; height: 30px; padding: 0; font-size: 15px; line-height: 1; border-radius: var(--r-sm); background: var(--label-bg); border: 1px solid var(--border); box-shadow: var(--shadow); }
.sel-toolbar button:hover { background: var(--sel-bg); border-color: var(--primary); }
.sel-toolbar button.on { background: var(--angle-bg); border-color: var(--warn); }
.view-list { list-style: none; padding: 0; margin: 4px 0; }
.view-list li { display: flex; align-items: center; gap: 4px; padding: 1px 0; }
.view-list li a { flex: 1; color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-list li a:hover { text-decoration: underline; }
.view-list button { padding: 1px 6px; }
.lock-label { font-size: 18px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); pointer-events: none; color: var(--primary); }
.lock-label .lk-i { width: 20px; height: 20px; }
.clash-label { font: 600 11px/1 var(--mono); padding: 2px 5px; border-radius: 3px; background: var(--label-bg); color: var(--danger); border: 1px solid var(--danger); white-space: nowrap; pointer-events: none; }
/* kłódki: zamknięta = zablokowane (podświetlona), otwarta = odblokowane (wygaszona) */
.lk-i.lk-on { color: var(--primary); opacity: 1; }
.lk-i.lk-off { opacity: .45; }
#e2-lock .lk-i { width: 15px; height: 15px; vertical-align: -2px; }
.measure-label { color: var(--measure-text); border: 1px solid var(--measure-text); }
.measure-label.pick { pointer-events: auto; cursor: pointer; }
.measure-label.sel { color: var(--primary); border: 2px solid var(--primary); background: var(--sel-bg); margin: -1px; }
.view-list li a { min-width: 0; }
.view-list li a.on { font-weight: 600; color: var(--primary); }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '▾'; font-size: 14px; line-height: 1; width: 12px; color: var(--text); margin-top: 8px; transition: transform .15s; }
details.fold:not([open]) > summary::before { transform: rotate(-90deg); }
details.fold > summary h2 { flex: 1; }
@media (hover:hover) and (pointer:fine) { details.fold > summary:hover h2 { color: var(--text); } }
#measure-list-box { margin: 4px 0; }
#measure-list-box summary { cursor: pointer; font-size: 12px; color: var(--muted); }
#measure-list-box .view-list { max-height: 160px; overflow-y: auto; }
.cutouts { list-style: none; padding: 0; margin: 4px 0 0; }
.cutouts li { display: flex; justify-content: space-between; align-items: center; padding: 1px 0; }
.cutouts button { padding: 0 6px; }
#rect-menu { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 4px; width: 220px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); }
#rect-menu button { display: flex; justify-content: space-between; align-items: center; text-align: left; }
#rect-menu button.primary kbd { background: transparent; color: inherit; border-color: currentColor; }

/* zakładki u góry */
body { flex-direction: column; }
#tabs { flex: none; display: flex; align-items: center; gap: 2px; padding: 0 12px; height: 44px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text); overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs .brand { display: flex; align-items: center; gap: 8px; margin-right: 14px; padding: 0; font-size: 15px; letter-spacing: -.01em; color: var(--text); text-decoration: none; flex: none; }
#tabs .brand img { width: 26px; height: 26px; }
#tabs .brand b { font-weight: 700; }
#tabs .brand span { color: var(--muted); font-weight: 500; }
#tabs a[data-tab] { display: flex; align-items: center; gap: 6px; flex: none; height: 44px; padding: 0 11px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease); }
#tabs .ti { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover:hover) and (pointer:fine) { #tabs a[data-tab]:hover { color: var(--text); background: var(--hover-bg); } }
#tabs a[data-tab].active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
#tabs .tab-project { margin-left: auto; padding-left: 12px; color: var(--muted); font: 500 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* nazwa projektu Edytora 3D (main.js) – tylko na stronie Edytora 3D; inne strony mają własne pole nazwy */
#tabs:not(:has(a[data-tab="cad"].active)) .tab-project { display: none; }
#tabs .mode { margin-left: 12px; }
#tabs .tl { white-space: nowrap; }
@media (max-width: 1380px) { #tabs .tab-project { display: none; } #tabs .mode { margin-left: auto; } #tabs a[data-tab] { padding: 0 8px; } #tabs .brand { margin-right: 8px; } }
/* węższe okno: same ikony (nazwa w tooltipie przeglądarki: title), aktywna zakładka z nazwą */
@media (max-width: 1200px) {
  #tabs a[data-tab]:not(.active) .tl { display: none; }
  #tabs a[data-tab] { position: relative; padding: 0 10px; }
  #tabs .ti { width: 18px; height: 18px; }
}
@media (max-width: 560px) { #tabs .brand span { display: none; } }
.page { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 40px; background: var(--bg); }
.page[hidden] { display: none; }
.page.cad:not([hidden]) { display: flex; padding: 0; overflow: hidden; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
/* pusty stan listy (Projekty): co zrobić + przycisk akcji */
.pj-empty { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border: 1px dashed var(--field-border); border-radius: var(--r-md); color: var(--muted); font-size: 13px; }
.pj-empty p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
@media (hover:hover) and (pointer:fine) { .card:hover { border-color: var(--primary); box-shadow: var(--shadow-lift); transform: var(--lift); } .card.active:hover { box-shadow: 0 0 0 1px var(--primary), var(--shadow-lift); } }
.card.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.card .thumb { aspect-ratio: 4 / 3; background: var(--surface-2) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 32px; border-bottom: 1px solid var(--border); }
.card .body { padding: 8px 10px 10px; }
.card .body b { display: block; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.card .body small { display: block; margin-top: 2px; color: var(--muted); font: 400 12px/1.4 var(--font); } /* opis karty: zwykły krój; mono tylko dla liczb (.num) */
.card .body small .num { font-family: var(--mono); font-size: 11px; }
.card .acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; } /* wrap: Delete never falls off the card */
.card .acts button { padding: 2px 8px; font-size: 12px; }
.card.new .thumb { font-size: 48px; color: var(--primary); background: var(--sel-bg); }
.kerf-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.kerf-form { width: 330px; flex: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px 14px; }
/* panel ustawień przewija się osobno, podgląd obok zostaje na miejscu (wysokość --form-h: sticky-form.js); w wąskim oknie panel jest nad podglądem */
@media (min-width: 760px) { .page .kerf-layout > .kerf-form { position: sticky; top: 0; max-height: var(--form-h, calc(100dvh - 150px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; box-sizing: border-box; } }
.kerf-preview { flex: 1; min-width: 300px; }
.kerf-preview svg { width: 100%; max-width: 760px; height: auto; background: var(--paper); border: 1px solid var(--paper-line); border-radius: 2px; }
.kerf-preview svg path { vector-effect: non-scaling-stroke; stroke-width: 1px; }
.kerf-table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12px; }
.kerf-table td { padding: 2px 4px; border-bottom: 1px solid var(--border); }
.kerf-table button { padding: 1px 8px; font-size: 12px; }
.kerf-table tr.cur td { background: var(--sel-bg); font-weight: 600; }
.dialog { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.dialog[hidden] { display: none; }
.dialog-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); display: flex; gap: 16px; padding: 16px; max-width: 820px; width: 100%; flex-wrap: wrap; box-shadow: var(--shadow); }
.dialog-box img { width: 400px; max-width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-sm); background: var(--surface-2); }
.dialog-form { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 6px; }
.dialog-form h1 { font-size: 18px; margin: 0; }
h2.cat { font: 600 13px var(--font); text-transform: none; letter-spacing: 0; margin: 22px 0 0; color: var(--text); }
h2.cat small { color: var(--muted); font: 400 11px var(--mono); }
.card .boxes-name { display: block; font: 500 11px var(--mono); color: var(--accent); }
.card.off { cursor: default; opacity: .6; }
@media (hover:hover) and (pointer:fine) { .card.off:hover { border-color: var(--border); } }
.card.off .thumb { font-size: 22px; aspect-ratio: 4 / 1.4; }
.card .acts a { font-size: 12px; color: var(--primary); }
/* Presety: tryb ukrywania kart */
#ps-filter { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ps-hide-bar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ps-hide-bar button { padding: 3px 10px; font-size: 12px; }
.ps-hidden-count { color: var(--muted); font: 400 11px var(--mono); }
.card { position: relative; }
.card.hide-edit { cursor: pointer; }
.card.off.hide-edit { cursor: pointer; }
.card.is-hidden { opacity: .4; border-style: dashed; }
.card.hide-edit .hide-badge { position: absolute; top: 8px; right: 8px; z-index: 1; padding: 2px 8px; border-radius: 999px; font: 600 11px var(--mono); background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.card.hide-edit .hide-badge.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
@media (hover:hover) and (pointer:fine) { .card.off.hide-edit:hover { border-color: var(--primary); } }
.prism-verts { border-collapse: collapse; width: 100%; margin: 4px 0; }
.prism-verts th { font: 500 10px var(--mono); color: var(--muted); }
.prism-verts td { padding: 1px 2px; font-size: 12px; }
.prism-verts input[type=number] { width: 100%; box-sizing: border-box; }
.prism-verts button { padding: 0 6px; font-size: 12px; }
.angle-wrap { pointer-events: none; }
.angle-val { pointer-events: auto; cursor: text; padding: 0 1px; border-radius: 2px; }
.angle-val:hover { background: var(--hover-bg); }
.angle-input { pointer-events: auto; width: 46px; font: 600 11px/1 var(--mono); padding: 1px 2px; border: 1px solid var(--primary); border-radius: 3px; color: var(--text); background: var(--surface); }
.angle-label { position: relative; left: 0; top: 0; display: flex; align-items: center; gap: 2px; font: 600 11px/1 var(--mono); padding: 1px 3px; border-radius: 3px; background: var(--angle-bg); color: var(--angle-text); border: 1px solid var(--warn); white-space: nowrap; }
.angle-label button { pointer-events: auto; width: 18px; height: 18px; padding: 0; font-size: 11px; line-height: 1; border-radius: 4px; background: var(--label-bg); border: 1px solid var(--border); cursor: pointer; }
.angle-label button:hover { background: var(--sel-bg); border-color: var(--primary); }
.angle-label.angle-locked { border-color: var(--warn); }
.angle-90, .angle-90 span { font-weight: 800; }
.prism-verts .pv-angle { white-space: nowrap; }
.prism-verts .pv-angle input { width: 52px; }
.prism-verts .pv-angle button { vertical-align: middle; }
.prism-verts tr.pv-hover td { background: var(--angle-bg); }
.prism-verts tr.pv-active td { background: var(--sel-bg); }
/* Wzory otworów: znacznik źródła i panelik w 3D obok zaznaczonego otworu */
.pat-mark { width: 9px; height: 9px; border: 1.5px solid var(--accent); border-radius: 50%; background: var(--sel-bg); pointer-events: none; box-sizing: border-box; }
.pat-ui { width: 0; height: 0; pointer-events: none; }
.pat-ui-inner { position: absolute; left: 16px; bottom: 16px; width: max-content; display: flex; flex-direction: column; gap: 4px; padding: 5px 6px; border-radius: var(--r-sm); background: var(--label-bg); border: 1px solid var(--accent); box-shadow: var(--shadow); pointer-events: auto; font: 11px/1.2 var(--font); color: var(--text); }
.pat-arrows { display: flex; gap: 3px; }
.pat-count { align-self: center; margin-left: 3px; color: var(--muted); white-space: nowrap; }
.pat-ui button { width: 26px; height: 26px; padding: 0; font-size: 14px; line-height: 1; border-radius: 5px; background: var(--surface); border: 1px solid var(--border); }
.pat-ui button:hover { background: var(--sel-bg); border-color: var(--accent); }
.pat-ui button.on { background: var(--sel-bg); border-color: var(--accent); color: var(--accent); }
.pat-row { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pat-lab { width: 62px; color: var(--muted); }
.pat-ui input { width: 52px; padding: 2px 3px; font-size: 11px; }
.pickable { cursor: pointer; }
.pickable:hover, .pickable.on { color: var(--accent); text-decoration: underline; }
.pat-side { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.pat-side b { width: 100%; font: 500 10.5px var(--mono); color: var(--muted); }
.pat-side label { display: flex; align-items: center; gap: 3px; }
.pat-side input { width: 56px; }

/* Slicer */
.sl-main { flex: 1; min-width: 320px; }
/* generator dopasowany do okna (Topery): strona się nie przewija, formularz po lewej przewija się osobno,
   podgląd 2D/3D stoi zawsze u góry, pasek arkusza i arkusze przewijają się we własnym okienku pod podglądem */
@media (min-width: 760px) and (min-height: 560px) {
  .page.gen-fit:not([hidden]) { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 14px; }
  .page.gen-fit > .kerf-layout { flex: 1 1 auto; min-height: 0; flex-wrap: nowrap; align-items: stretch; }
  .page.gen-fit .kerf-layout > .kerf-form { position: static; max-height: none; min-height: 0; }
  .page.gen-fit .sl-main { display: flex; flex-direction: column; min-height: 0; }
  .page.gen-fit .sl-main > .pv-sticky { position: static; flex: none; }
  .page.gen-fit .sl-main > .sl-below { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border-top: 1px solid var(--border); padding-top: 8px; }
  .page.gen-fit .sl-main > .hint:empty { display: none; }
  /* --gen-extra: wysokość dodatkowych wierszy nad podglądem (np. podpowiedzi i Przód/Tył w Ramkach), żeby okienko arkusza nie znikało */
  .page.gen-fit .pv-sticky .pv-layout { --pv-h: clamp(200px, calc(100dvh - 540px - var(--gen-extra, 0px)), 400px); }
  .page.gen-fit .pv-sticky .pv-layout[data-one] { --pv-h: clamp(200px, calc(100dvh - 520px - var(--gen-extra, 0px)), 460px); }
  .page.gen-fit .pv-sticky .pv-layout[data-lay=column], .page.gen-fit .pv-sticky .pv-layout[data-lay=column-reverse] { --pv-h: clamp(130px, calc((100dvh - 560px - var(--gen-extra, 0px)) / 2), 320px); }
  #page-ramki { --gen-extra: 72px; }
  #page-puzzle, #page-kolory, #page-warstwy { --gen-extra: 24px; } /* suwak Rozsuń */
  #page-drogi { --gen-extra: 40px; } /* dwa wiersze nagłówka (plansza + przyciski) */
  /* strona z trybami (Kolory: Po numerach / Włóczka) – układ siedzi w .gen-mode */
  .page.gen-fit > .gen-mode:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .page.gen-fit > .gen-mode > .kerf-layout { flex: 1 1 auto; min-height: 0; flex-wrap: nowrap; align-items: stretch; }
}
#sl-view { position: relative; height: 480px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); }
.sl-steps select { width: auto; }
.sl-steps { align-items: center; gap: 14px; margin: 6px 0 10px; }
.sl-range { display: flex; align-items: center; gap: 8px; }
.sl-range input { width: 220px; }
.sl-sheets { display: flex; flex-wrap: wrap; gap: 12px; }
.sl-sheets figure { margin: 0; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.sl-sheets figcaption { font: 500 11px var(--mono); color: var(--muted); margin-bottom: 2px; }
.sl-sheets svg { width: 360px; height: auto; background: var(--paper); border: 1px solid var(--paper-line); border-radius: 2px; }
.sl-sheets svg path { vector-effect: non-scaling-stroke; stroke-width: 1px; }
#page-slicer.drop { outline: 3px dashed var(--primary); outline-offset: -8px; }
.sl-labels { position: absolute; top: 0; left: 0; pointer-events: none; }
.sl-dim { background: var(--label-bg); color: var(--dim-text); border: 1px solid var(--dim-text); border-radius: 4px; padding: 1px 5px; font: 500 12px var(--mono); white-space: nowrap; }

/* nesting: pasek nad podglądem arkuszy (edytor i slicer) */
.nest-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.nest-bar select { font-size: 12px; }
.nest-bar .nest-status { flex-basis: 100%; margin: 0; font-family: var(--mono); }

/* Grawer */
.gr-form { width: 360px; }
#gr-view { position: relative; height: calc(100vh - 150px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); }
#gr-view canvas { display: block; }
/* Grawer Wrap: pole wzoru i okno wyboru (engrave-picker.js) */
:root { --gr-ply: #e6cd9f; --gr-ink: #22140a; }
.gr-sw { background-color: var(--gr-ply); background-repeat: repeat; background-position: 0 0; border: 1px solid var(--border); border-radius: var(--r-sm); }
.gr-cur { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 4px; }
.gr-cur-sw { height: 96px; }
.gr-cur-info { display: flex; flex-direction: column; min-width: 0; }
.gr-cur-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-cur-info small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-cur-btns { display: flex; gap: 4px; }
.gr-cur-btns .primary { flex: 1; }
.gr-cur-btns button:not(.primary) { flex: none; width: 34px; padding-left: 0; padding-right: 0; }
.gr-cur.mini { grid-template-columns: 52px 1fr; align-items: center; }
.gr-cur.mini .gr-cur-sw { height: 44px; grid-row: 1 / span 2; }
.gr-cur.mini .gr-cur-btns { grid-column: 1 / -1; }
.gr-stroke .gr-two output { flex: none; min-width: 96px; font-size: 11px; color: var(--muted); }
.gr-credit { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.3; margin: 2px 0 4px; }
.gr-pick-ov { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, 0.45); }
.gr-pick-ov[hidden] { display: none; }
.gr-pick { display: flex; flex-direction: column; width: min(980px, 100%); height: min(680px, 100%); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.gr-pick-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.gr-pk-q { flex: 1; min-width: 0; }
.gr-pk-count { color: var(--muted); font-size: 12px; flex: none; }
.gr-pk-x { flex: none; width: 30px; padding: 0; font-size: 18px; line-height: 1; }
.gr-pick-body { display: flex; flex: 1; min-height: 0; }
.gr-pk-cats { flex: none; width: 190px; padding: 8px; overflow-y: auto; border-right: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.gr-pk-cats hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.gr-pk-cats button { display: flex; justify-content: space-between; align-items: center; gap: 6px; text-align: left; padding: 6px 8px; font-size: 13px; background: transparent; border-color: transparent; }
.gr-pk-cats button i { font-style: normal; font-size: 11px; color: var(--muted); }
.gr-pk-cats button.on { background: var(--sel-bg); border-color: var(--primary); color: var(--text); }
.gr-pk-grid { flex: 1; min-width: 0; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; align-content: start; }
.gr-tile { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 4px; text-align: left; background: var(--surface-2); content-visibility: auto; contain-intrinsic-size: 124px 150px; }
.gr-tile .gr-sw { display: block; width: 100%; height: 100px; }
.gr-tile .gr-tn { font-size: 12px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-tile.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--sel-bg); }
.gr-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.gr-star { position: absolute; top: 6px; right: 8px; font-size: 16px; line-height: 1; color: var(--ink-soft, #fff); text-shadow: 0 0 3px rgba(0, 0, 0, 0.8); opacity: 0; cursor: pointer; }
.gr-tile:hover .gr-star, .gr-tile:focus-visible .gr-star, .gr-star.on { opacity: 1; }
.gr-star.on { color: var(--warn); }   /* było #f4b400: 1,9:1 na jasnym tle */
.gr-del { position: absolute; top: 6px; left: 8px; font-size: 16px; line-height: 1; color: var(--danger); text-shadow: 0 0 3px #fff; opacity: 0; cursor: pointer; }
.gr-tile:hover .gr-del { opacity: 1; }
.gr-own { align-items: center; justify-content: center; min-height: 128px; border-style: dashed; }
.gr-plus { font-size: 30px; line-height: 1; color: var(--primary); }
.gr-empty { grid-column: 1 / -1; color: var(--muted); margin: 6px 0; }
.gr-pick-foot { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
.gr-pick-foot .gr-credit { margin: 0; text-align: right; }
@media (max-width: 720px) { .gr-pk-cats { width: 130px; } .gr-pick-ov { padding: 8px; } .gr-pick-foot { flex-direction: column; } }
.gr-upload { margin-top: 8px; }
.gr-upload summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.gr-up-prev { display: block; max-width: 100%; max-height: 120px; margin: 6px 0; border: 1px solid var(--border); image-rendering: pixelated; }
.gr-group { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 8px 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 5px; background: var(--surface-2); }
.gr-ghead { display: flex; align-items: center; justify-content: space-between; }
.gr-gname { cursor: pointer; font-weight: 600; }
.gr-gname:hover { color: var(--primary); text-decoration: underline; }
.gr-two { display: flex; gap: 6px; align-items: center; }
.gr-two input[type=range] { flex: 1; min-width: 0; }
.gr-two input[type=number] { width: 70px; flex: none; }
.gr-warn { margin: 6px 0 0; padding-left: 16px; color: var(--danger); font-size: 11px; }

/* Topery */
#tp-2d { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; color: var(--text); padding: 6px; margin-bottom: 8px; }
#tp-2d svg { width: 100%; height: 220px; display: block; }
#tp-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.tp-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.tp-types button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font-size: 11px; line-height: 1.15; }
.tp-types button svg { width: 84px; height: 44px; }
.tp-types button.on { border-color: var(--primary); background: var(--sel-bg); }
.tp-line { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 4px; }
.tp-line input[type=text] { width: 100%; box-sizing: border-box; font-size: 15px; }
.tp-line .grid2 { gap: 4px 6px; }
.tp-line > .row { flex-wrap: nowrap; align-items: center; }
.tp-line > .row > input[type=text] { flex: 1 1 auto; min-width: 0; }
.tp-line > .row > button[data-del] { flex: none; min-width: 28px; min-height: 28px; padding: 0 6px; }

/* Puzzle */
#pz-2d { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; color: var(--text); padding: 6px; margin-bottom: 8px; }
#pz-2d svg { width: 100%; height: 300px; display: block; }
#pz-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.pz-explode { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 4px; flex-direction: row; color: var(--text); }
.pz-explode input { flex: 1; }

/* Mapa */
#mp-pick-wrap { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); margin-bottom: 4px; touch-action: none; }
#mp-pick { width: 100%; height: 100%; display: block; cursor: grab; }
#mp-pick.drag { cursor: grabbing; }
/* mapa wyboru kadru: po pobraniu danych zwija się do paska „Kadr: … · Zmień kadr”, żeby podgląd 2D/3D był cały w oknie */
#mp-pick-wrap { transition: height var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out), margin var(--dur) var(--ease-out); }
#mp-pick-wrap.folded { height: 0; opacity: 0; margin-bottom: 0; border-width: 0; }
#mp-pick-toggle { display: flex; align-items: center; gap: 6px; max-width: 100%; margin-bottom: 4px; font-size: 13px; text-align: left; }
#mp-pick-toggle .num { font: 500 12px var(--mono); color: var(--muted); }
#mp-pick-toggle .mp-kadr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#mp-pick-toggle .mp-kadr-act { color: var(--primary); white-space: nowrap; }
.page.gen-fit .sl-main > #mp-pick-toggle, .page.gen-fit .sl-main > #mp-pick-wrap { flex: none; }
#page-mapa { --gen-extra: 40px; }
#page-mapa:has(#mp-pick-wrap:not(.folded)) { --gen-extra: 400px; }
@media (prefers-reduced-motion: reduce) { #mp-pick-wrap { transition: none; } }
.osm-credit { position: absolute; right: 0; bottom: 0; background: var(--label-bg); font: 10px var(--mono); padding: 1px 5px; color: var(--muted); }
.osm-credit a { color: var(--primary); }
#mp-2d { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; color: var(--text); padding: 6px; margin-bottom: 8px; }
#mp-2d .zm-content > svg { width: 100%; height: 320px; display: block; }
.zm-host { position: relative; overflow: hidden; }
.zm-host .zm-content { touch-action: none; }
.zm-host.zm-zoomed .zm-content { cursor: grab; }
.zm-host.zm-drag .zm-content { cursor: grabbing; }
.zm-btns { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.zm-btns button { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.zm-btns button:hover { background: var(--surface-2); border-color: var(--primary); }
#mp-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.mp-results { display: flex; flex-direction: column; gap: 3px; margin: 4px 0; }
.mp-results button { text-align: left; font-size: 12px; padding: 3px 6px; }
.mp-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.mp-styles button { font-size: 12px; padding: 6px 4px; line-height: 1.2; }
.mp-styles button.on { border-color: var(--primary); background: var(--sel-bg); }
.mp-road { display: grid; grid-template-columns: 1fr 70px; gap: 4px; align-items: center; font-size: 12px; }
.mp-status { font-size: 12px; margin: 4px 0; }
.mp-status progress { width: 100%; height: 6px; accent-color: var(--primary); }

/* Drogi */
.dr-form { width: 350px; }
#dr-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; cursor: default; }
#dr-bg { cursor: grab; }
#dr-svg .it .body { fill: var(--paper); stroke: var(--muted); stroke-width: 1px; vector-effect: non-scaling-stroke; fill-rule: evenodd; cursor: pointer; }
#dr-svg .it .eng { fill: var(--muted); fill-rule: evenodd; pointer-events: none; }
#dr-svg .it.sel .body { stroke: var(--sel); stroke-width: 3px; fill: color-mix(in srgb, var(--sel) 22%, var(--paper)); }
#dr-svg .it.bad .body { fill: color-mix(in srgb, var(--danger) 45%, var(--paper)); stroke: var(--danger); }
#dr-svg .it.nocut .body { opacity: .5; }
#dr-svg .it.ghost { pointer-events: none; opacity: .75; }
#dr-svg .pp { pointer-events: none; }
#dr-svg .pp circle { stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; }
#dr-svg .pp circle.ok { fill: #2e9e55; }
#dr-svg .pp circle.free { fill: #f08a1c; }
body.dr-dragging { cursor: grabbing; user-select: none; }
.dr-marks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-bottom: 6px; }
.dr-pal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dr-pal-it { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font-size: 10px; line-height: 1.1; touch-action: none; user-select: none; background: var(--surface-2); color: var(--text); }
.dr-pal-it svg { width: 100%; height: 56px; pointer-events: none; }
.dr-pal-it span { text-align: center; pointer-events: none; }
.dr-portdia { display: block; margin: 4px 0; }
.dr-portdia circle { cursor: pointer; stroke: #fff; stroke-width: 1px; }
.dr-portdia circle.ok { fill: #2e9e55; }
.dr-portdia circle.off { fill: #c9ccd3; }
.dr-cuttab input { width: 60px; padding: 1px 4px; }
.dr-cuttab small { color: var(--muted); }
.mp-top { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 6px 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.mp-top .mp-status { min-height: 16px; }

/* Edytor 2D */
.badge { display: inline-block; padding: 0 5px; margin-right: 2px; border: 1px solid var(--border); border-radius: 4px; font: 600 10px/16px var(--mono); color: var(--primary); background: var(--sel-bg); }
.page.ed2:not([hidden]) { display: flex; padding: 0; overflow: hidden; }
.e2 { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.e2-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.e2-grp { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.e2-grp button, .e2-top > button { padding: 4px 9px; }
.e2-top input[type=number] { width: 66px; }
.e2-top select { width: auto; padding: 3px 5px; }
.e2-name { width: 190px !important; font-weight: 600; }
.e2-lbl { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.e2-opts { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; align-items: center; gap: 4px 14px; padding: 4px 10px; height: 40px; flex: none; white-space: nowrap; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; }
.e2-opts .hint { margin: 0; }
.e2-inl { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 12px; }
.e2-inl input[type=text], .e2-inl input[type=number] { width: 70px; }
.e2-main { flex: 1; display: flex; min-height: 0; }
.e2-tools { width: 46px; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--surface); border-right: 1px solid var(--border); }
.e2-tool { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; }
.e2-tool.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ei { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* wspólne ikony interfejsu (src/brand/icons.js, te same co w Laser Desk): 16 px, kolor z tekstu */
.ui-ic { flex: none; display: inline-block; vertical-align: middle; }
.e2-ic .ui-ic, #pv-play .ui-ic, [data-pv="close"] .ui-ic, #btn-undo .ui-ic, #btn-redo .ui-ic { display: block; margin: auto; }
.e2-cwrap { flex: 1; position: relative; min-width: 0; background: var(--scene-bg); overflow: hidden; }
#e2-canvas { position: absolute; inset: 0; display: block; outline: none; touch-action: none; }
.e2-flash { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: 80%; padding: 5px 12px; background: var(--label-bg); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); font: 500 12px var(--mono); box-shadow: var(--shadow); pointer-events: none; }
.e2-flash.bad { border-color: var(--warn); color: var(--warn); }
.e2-side { width: 296px; flex: none; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border); }
.e2-panel { border-bottom: 1px solid var(--border); padding: 0 10px 8px; }
.e2-panel > summary { cursor: pointer; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 9px 0 7px; }
.e2-panel[hidden] { display: none; }
.e2-props { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.e2-props input[type=text] { font-family: var(--mono); font-size: 12px; }
.e2-props2 { display: flex; align-items: flex-end; gap: 10px; margin-top: 8px; }
.e2-toggle { padding: 3px 7px; }
.e2-toggle.on { border-color: var(--primary); background: var(--sel-bg); }
.e2-anchor { display: grid; grid-template-columns: repeat(3, 14px); gap: 3px; padding: 4px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.e2-anchor button { width: 14px; height: 14px; padding: 0; border-radius: 3px; }
.e2-anchor button.on { background: var(--primary); border-color: var(--primary); }
.e2-rot { flex: 1; }
.e2-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.e2-btns3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.e2-btns button, .e2-btns3 button { padding: 4px 6px; font-size: 12px; }
/* doker „Wyrównaj i rozłóż”: ikona ze wspólnego zestawu nad nazwą; wąski doker – sama ikona (pętla 7) */
#e2-align { container-type: inline-size; }
#e2-align button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; line-height: 1.2; }
#e2-align button .ei { width: 20px; height: 20px; flex: none; }
@container (max-width: 230px) { #e2-align button { min-height: 36px; } #e2-align .e2-al-t { display: none; } }
.e2-ref { flex-direction: row; align-items: center; gap: 6px; margin-top: 6px; }
.e2-ref select { width: auto; }
.e2-panel textarea { width: 100%; resize: vertical; margin-bottom: 6px; font-size: 14px; }
.e2-layers { max-height: 300px; overflow-y: auto; margin: 0 -4px; }
.e2-layer { display: grid; grid-template-columns: 20px 18px 1fr 26px 26px 20px; gap: 4px; align-items: center; padding: 1px 4px; border-radius: 4px; cursor: pointer; font: 500 11px var(--mono); }
.e2-layer.on { background: var(--sel-bg); }
.e2-layer select { width: 100%; padding: 1px 3px; font-size: 11px; font-family: var(--font); }
.e2-layer small { color: var(--muted); text-align: right; }
.e2-sw { width: 18px; height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 4px; }
.e2-sw.used { box-shadow: 0 0 0 2px var(--primary); }
.e2-ic { padding: 0 4px; height: 22px; font-size: 12px; line-height: 1; border-color: transparent; background: transparent; opacity: .45; }
.e2-ic.on { opacity: 1; color: var(--primary); }
.e2-objs { max-height: 220px; overflow-y: auto; }
.e2-obj { display: grid; grid-template-columns: 12px 1fr 26px 26px; gap: 4px; align-items: center; padding: 1px 4px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.e2-obj.on { background: var(--sel-bg); }
.e2-obj.dim span { opacity: .5; text-decoration: line-through; }
.e2-obj i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--border); }
.e2-obj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; padding: 4px 10px; background: var(--surface); border-top: 1px solid var(--border); }
.e2-pal { display: flex; flex-wrap: wrap; gap: 2px; }
.e2-psw { position: relative; width: 24px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.e2-psw.on { outline: 2px solid var(--primary); outline-offset: 1px; z-index: 1; }
.e2-psw i { position: absolute; inset: 0; display: grid; place-items: center; font: 600 9px var(--mono); font-style: normal; color: #fff; mix-blend-mode: difference; pointer-events: none; }
.e2-psw u { position: absolute; right: 1px; bottom: 1px; width: 4px; height: 4px; border-radius: 50%; background: var(--surface); border: 1px solid var(--text); }
.e2-status { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--muted); }
.e2-status .mono { font-family: var(--mono); color: var(--text); }
.e2-help h2 { margin-top: 12px; }
.e2-help table { border-collapse: collapse; width: 100%; }
.e2-help td { padding: 2px 8px 2px 0; font-size: 12px; vertical-align: top; }
.e2-help td:first-child { white-space: nowrap; width: 38%; }
@media (max-width: 1100px) { .e2-side { width: 260px; } .e2-name { width: 140px !important; } }
#e2-help-dlg .dialog-box { max-height: 90vh; overflow-y: auto; max-width: 900px; }
.e2-help { columns: 2; column-gap: 28px; }
.e2-help h2 { break-after: avoid; }
.e2-help table { break-inside: avoid; }
@media (max-width: 760px) { .e2-help { columns: 1; } }

/* Edytor 2D – etap 2: kształty, węzły, booleany */
.e2-shape { display: flex; flex-direction: column; gap: 8px; }
.e2-shgrp { display: flex; flex-direction: column; gap: 3px; }
.e2-shbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.e2-shbtns button { display: flex; align-items: center; gap: 6px; padding: 4px 6px; font-size: 12px; text-align: left; line-height: 1.15; }
.e2-shbtns button .ei { flex: none; width: 16px; height: 16px; }
.e2-shbtns button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.e2-shbtns button:disabled { opacity: .42; cursor: default; }
.e2-nb { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; font-size: 12px; }
.e2-nb .ei { width: 16px; height: 16px; }
.e2-sep { width: 1px; align-self: stretch; margin: 2px 2px; background: var(--border); }
.e2-opmsg { font-size: 12px; color: var(--muted); }
.e2-opmsg.bad { color: var(--warn); }
.e2-opts .e2-inl select { width: auto; padding: 2px 5px; }
.e2-bool { flex-direction: column; gap: 10px; max-width: 760px; }
.e2-bool-head { display: flex; align-items: baseline; gap: 12px; }
.e2-bool-head h1 { margin: 0; font-size: 18px; }
.e2-bool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.e2-bcard { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border: 2px solid var(--border); border-radius: var(--r-sm); background: var(--surface); text-align: left; }
.e2-bcard canvas { width: 100%; height: auto; aspect-ratio: 180 / 100; border-radius: 4px; display: block; }
.e2-bcard.on { border-color: var(--primary); background: var(--sel-bg); }
.e2-bname { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.e2-bname .ei { width: 16px; height: 16px; }
.e2-bcard small { color: var(--muted); font-size: 11px; }
.e2-bool-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; }
.e2-bcard:disabled { opacity: .5; }
#e2-bool .hint { margin: 4px 0; }
#e2-bool .row { position: sticky; bottom: -8px; padding: 6px 0 2px; background: var(--surface); }
#e2-bool .hint.bad { color: var(--warn); }
.e2-bool .hint.bad { color: var(--warn); }

.e2-opts > * { flex: none; }
.e2-opts .hint, .e2-opts .e2-opmsg { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1500px) { .e2-nb span { display: none; } .e2-nb { padding: 3px 6px; } }

/* Edytor 2D, etap 3: ustawienia warstwy (kerf), podgląd cięcia */
.e2-lset { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 2px 2px; font-size: 12px; border-top: 1px solid var(--border); margin-top: 6px; }
.e2-lset .e2-inl input { width: 60px; }
.e2-pv { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow); font-size: 12px; }
.e2-pv[hidden] { display: none; }
.e2-pv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.e2-pv-row input[type=range] { flex: 1 1 160px; min-width: 120px; }
.e2-pv-row b { font-weight: 600; }
.e2-pv-row .e2-inl input { width: 46px; }
.e2-pv select, .e2-pv button { width: auto; }
.e2-pv-row button { padding: 3px 9px; }

/* Edytor 2D, etap 3a (partia A): okno Przekształć, prowadnice, narożniki prostokąta, jednostki */
.xf { display: flex; flex-direction: column; gap: 7px; }
.xf-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.xf-tabs button { padding: 3px 4px; font-size: 12px; }
.xf-tabs button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.xf-body { display: flex; flex-direction: column; gap: 7px; }
.xf-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 8px; }
.xf-row > label { flex: 1; min-width: 68px; }
.xf-row > button { padding: 4px 8px; font-size: 12px; }
.xf input[type=text], .xf select { font-family: var(--mono); font-size: 12px; width: 100%; }
.xf-pivot { display: flex; flex-direction: column; gap: 5px; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.xf-pivot select { font-family: var(--font); }
.xf-anchor { align-self: flex-start; }
.xf-anchor button { width: 14px; height: 14px; padding: 0; border-radius: 3px; }
.xf-anchor button.on { background: var(--primary); border-color: var(--primary); }
.gd-add { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.gd-list { display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow-y: auto; }
.gd-row { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.gd-row b { color: var(--accent); width: 14px; text-align: center; }
.gd-row input[type=text] { width: 60px; padding: 2px 4px; }
.gd-row button { margin-left: auto; padding: 0 7px; height: 22px; line-height: 1; }
.e2-rectprops { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.rr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rr-cell { display: grid; grid-template-columns: 14px 1fr; gap: 3px; align-items: center; }
.rr-cell b { color: var(--muted); font-weight: 400; text-align: center; grid-row: span 2; }
.rr-cell input, .rr-cell select, .rr-all input, .rr-all select { width: 100%; font-size: 12px; padding: 3px 4px; }
.rr-all { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: end; }
.e2-props small.uu { color: var(--muted); font: 500 10.5px var(--mono); }
.e2-top input.e2-sz { width: 64px; font-family: var(--mono); }
.e2-top select#e2-sheetp { max-width: 170px; }

/* Edytor 2D – układ w stylu CorelDRAW (etap 4): pasek menu, pasek właściwości, przybornik z flyoutami, dokery po prawej, paleta bez numerów.
   Kolory wyłącznie przez zmienne. */
.e2 [hidden], .e2-find[hidden], .e2-pops [hidden] { display: none !important; }
.e2-menubar { display: flex; align-items: center; gap: 2px; height: 34px; flex: none; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.e2-menus { display: flex; }
.e2-mb { padding: 4px 11px; border-color: transparent; background: transparent; font-size: 13px; }
.e2-mb u { text-underline-offset: 2px; }
.e2-mb.open { background: var(--sel-bg); color: var(--primary); border-color: transparent; }
@media (hover:hover) and (pointer:fine) { .e2-mb:not(:disabled):hover { background: var(--hover-bg); border-color: transparent; } .e2-mb.open:hover { background: var(--sel-bg); } }
.e2-mbsp { flex: 1; }
.e2-menubar .e2-name { width: 210px !important; height: 26px; padding: 2px 8px; }
.e2-mbtn { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border-color: transparent; background: transparent; font-weight: 600; }
.e2-mbtn .ei { width: 16px; height: 16px; }
.e2-pbar { display: flex; align-items: center; gap: 10px; height: 40px; flex: none; padding: 0 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; white-space: nowrap; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; }
.e2-pseg { display: flex; align-items: center; gap: 4px 10px; flex: none; }
.e2-pseg label { flex-direction: row; align-items: center; gap: 4px; font-size: 12px; color: var(--text); }
.e2-pseg input[type=text] { width: 64px; padding: 3px 5px; font-family: var(--mono); font-size: 12px; }
.e2-pseg select { width: auto; padding: 2px 4px; }
.e2-pseg #e2-t-font { max-width: 150px; }
.e2-pseg input.e2-sz { width: 62px; }
.e2-pseg input#e2-rot { width: 52px; }
.e2-pseg .hint { margin: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
.e2-pseg > button, .e2-pseg button.e2-nb { padding: 3px 8px; font-size: 12px; }
.e2-pbar .e2-opts { height: auto; padding: 0; border: 0; background: none; overflow: visible; }
.e2-pbar .e2-opts .hint { max-width: 40vw; }
.e2-anc { position: relative; display: block; width: 14px; height: 14px; border: 1px solid var(--muted); border-radius: 2px; }
.e2-anc::after { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 1px; background: var(--primary); left: calc(var(--ax, .5) * 7px + 0.5px); top: calc(var(--ay, .5) * 7px + 0.5px); }
.e2-colbox { display: flex; align-items: center; gap: 5px; }
.e2-bsw { width: 16px; height: 16px; flex: none; border-radius: 4px; border: 1px solid var(--border); display: inline-block; }
.e2-stk { display: inline-flex; align-items: center; gap: 4px; }
.e2-skic { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 5px; min-width: 52px; justify-content: space-between; color: var(--text); }
.e2-skpv { display: inline-flex; width: 26px; height: 16px; }
.e2-skpv .ei { width: 26px; height: 16px; stroke: currentColor; fill: none; }
.e2-skcar { font-size: 10.5px; color: var(--muted); }
.e2-pseg input.e2-sz#pb-sk, .e2-pseg input.e2-sz#pb-sk0 { width: 80px; }
.e2-pop { position: fixed; z-index: 45; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.e2-pop-wide { width: 290px; }
.e2-pop .e2-rectprops { margin: 0; padding: 0; border: 0; }
/* przybornik */
.e2-tools { overflow-y: auto; scrollbar-width: none; }
.e2-tool { position: relative; flex: none; }
.e2-tool[aria-disabled="true"] { opacity: .45; }
.e2-tool .tri { position: absolute; right: 2px; bottom: 2px; width: 0; height: 0; border-style: solid; border-width: 0 0 5px 5px; border-color: transparent transparent currentColor transparent; opacity: .75; }
.e2-tsep { display: block; height: 1px; margin: 2px 4px; background: var(--border); flex: none; }
.e2-fly { position: fixed; z-index: 50; display: flex; gap: 3px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow); }
/* menu rozwijane */
.e2-menu { position: fixed; z-index: 50; min-width: 230px; max-height: calc(100vh - 12px); overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); font-size: 13px; }
.e2-mi { display: grid; grid-template-columns: 16px 20px 1fr auto 12px; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--r-sm); cursor: default; white-space: nowrap; color: var(--text); }
.e2-mi.hot { background: var(--sel-bg); color: var(--primary); }
.e2-mi.off { opacity: .42; }
.e2-mic .ei { width: 16px; height: 16px; display: block; }
.e2-mk { color: var(--muted); font: 11px var(--mono); padding-left: 18px; }
.e2-msub { color: var(--muted); font-size: 10px; text-align: right; }
.e2-mchk { color: var(--primary); font-weight: 700; text-align: center; }
.e2-mnum { font: 600 11px var(--mono); color: var(--primary); text-align: center; }
.e2-ml u { text-underline-offset: 2px; }
.e2-msep { height: 1px; margin: 4px 2px; background: var(--border); }
.e2-find { position: fixed; inset: 0; z-index: 55; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: var(--overlay); }
.e2-find-box { width: min(580px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.e2-find-box input[type=text] { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 14px; font-size: 15px; background: var(--surface); }
.e2-find-list { max-height: 50vh; overflow-y: auto; padding: 4px; }
.e2-fi { display: grid; grid-template-columns: 20px 1fr auto auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; }
.e2-fi.hot { background: var(--sel-bg); }
.e2-fi.off { opacity: .45; }
.e2-fp { color: var(--muted); font-size: 11px; }
/* dokery po prawej */
.e2-side { width: 330px; display: flex; flex-direction: row; overflow: hidden; background: var(--surface); }
.e2-dockarea { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.e2-dockcard { flex: 1 1 0; display: flex; flex-direction: column; min-height: 0; }
.e2-dockbody [data-dock][hidden] { display: none; }
.e2-side.collapsed { width: 28px; }
.e2-side.collapsed .e2-dockarea { display: none; }
.e2-dockhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; min-height: 28px; padding: 3px 10px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.e2-dockbody { flex: 1 1 0; padding: 8px 10px; overflow-y: auto; min-height: 0; }
.e2-cnt { font: 500 11px var(--mono); color: var(--muted); }
.e2-objs { padding: 0; }
.e2-dockbody [data-dock="objects"] { margin: -8px -10px; padding: 2px 4px; }
.e2-dtabs { width: 28px; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 6px 3px; overflow-y: auto; background: var(--surface-2); border-left: 1px solid var(--border); }
.e2-dtab { writing-mode: vertical-rl; padding: 8px 3px; min-width: 24px; font-size: 11px; white-space: nowrap; text-align: center; }
.e2-dtab.pin { font-weight: 600; }
.e2-dtabs .e2-dtab.on { background: var(--surface); border-color: var(--field-border); color: var(--text); font-weight: 600; } /* neutralnie: akcent zostaje na aktywnym narzędziu */
.e2-obj { grid-template-columns: 14px 14px 16px 1fr 24px 24px; padding-left: calc(2px + var(--lv, 0) * 14px); gap: 3px; }
.e2-obj.lk .e2-on { font-style: italic; }
.e2-obj .e2-on { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2-obj.dim .e2-on { opacity: .5; text-decoration: line-through; }
.e2-obj .e2-ic { padding: 0 3px; }
.e2-ox { padding: 0; border: 0; background: none; width: 14px; height: 18px; font-size: 10px; color: var(--muted); }
.e2-ox.none { visibility: hidden; }
.e2-osw { width: 14px; height: 14px; padding: 0; border-radius: 3px; border: 1px solid var(--border); }
.e2-oty { color: var(--muted); display: grid; place-items: center; }
.e2-oty .oi { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.e2-obj.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.e2-obj.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.e2-obj.drop-into { outline: 2px solid var(--primary); outline-offset: -2px; }
.e2-rename { width: 100%; padding: 0 4px; font-size: 12px; }
.e2-crow { display: grid; grid-template-columns: 20px 1fr 54px 24px 18px 20px; gap: 4px; align-items: center; padding: 2px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.e2-crow.on { background: var(--sel-bg); }
.e2-crow select { padding: 1px 3px; font-size: 11px; font-family: var(--font); min-width: 0; width: 100%; }
.e2-crow .e2-kerf { min-width: 0; width: 100%; }
.e2-crow small { color: var(--muted); text-align: right; }
.e2-kerf { width: 100%; padding: 1px 4px; font: 11px var(--mono); }
.e2-cpick { position: fixed; z-index: 60; display: grid; grid-template-columns: repeat(10, 22px); gap: 3px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.e2-cpick button { width: 22px; height: 22px; padding: 0; border-radius: 4px; border: 1px solid var(--border); }
/* paleta bez numerów i pasek stanu */
.e2-pal { gap: 3px; padding: 1px 0; }
.e2-psw { width: 24px; height: 24px; border-radius: 3px; } /* WCAG 2.5.8: 24×24 target */
.e2-status { align-items: center; }
.e2-chip { padding: 0 9px; font-size: 11px; line-height: 22px; border-radius: 10px; color: var(--muted); background: transparent; }
.e2-chip.on { color: var(--text); border-color: var(--field-border); background: var(--surface-2); } /* stan opisuje tekst (wł./wył.), bez akcentu */
.e2-stcol { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.e2-stcol i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); }

/* menu kontekstowe: paleta koloru, Inteligentne wypełnienie na dole przybornika */
.e2-mgrid { display: grid; grid-template-columns: repeat(6, 18px); gap: 3px; padding: 6px 8px; }
.e2-msw { width: 18px; height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 3px; }
.e2-msw:hover { outline: 2px solid var(--primary); outline-offset: 1px; }
.e2-tsep.fill { margin-top: auto; }

/* karty otwartych dokumentów Edytora 2D */
.e2-doctabs { display: flex; align-items: flex-end; gap: 2px; height: 28px; flex: none; padding: 3px 8px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; white-space: nowrap; background: var(--surface); border-bottom: 1px solid var(--border); }
.e2-doctabs::-webkit-scrollbar { display: none; }
.e2-dt { display: flex; align-items: center; gap: 4px; flex: none; min-width: 90px; max-width: 200px; height: 25px; padding: 0 4px 0 10px; box-sizing: border-box; cursor: pointer; font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; border-radius: 5px 5px 0 0; user-select: none; }
.e2-dt:hover { color: var(--text); }
.e2-dt.on { color: var(--text); font-weight: 600; background: var(--bg); box-shadow: inset 0 2px 0 var(--primary); height: 26px; margin-bottom: -1px; }
.e2-dtn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.e2-dtx, .e2-dtplus { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
.e2-dtx:hover, .e2-dtplus:hover { background: var(--sel-bg); color: var(--text); }
.e2-dtplus { flex: none; align-self: center; margin: 0 4px 1px; width: 24px; height: 24px; font-size: 16px; }

/* Testy: przełącznik trybów i Test materiału */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-left: auto; }
.seg button { background: none; border: 0; border-radius: 0; color: var(--text); padding: 6px 14px; font-size: 13px; }
.seg button.on { background: var(--primary); color: var(--on-primary); }
/* wybór jednej z dwóch opcji w formularzu (np. Linie cięcia / Osobne elementy): stan „wybrane”, nie przycisk główny */
button.pick.on { border-color: var(--primary); background: var(--sel-bg); color: var(--text); }
.mt-form { width: 360px; }
.mt-form details { border-top: 1px solid var(--border); padding: 6px 0; }
.mt-form details:first-of-type { border-top: 0; }
.mt-form summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 2px 0; }
.mt-form details > .grid2, .mt-form details > .mt-checks { margin-top: 6px; }
.mt-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.mt-form label.ck { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.mt-checks { display: grid; gap: 4px; }
.mt-form .row { margin-top: 8px; }
.mt-form .mt-name { flex: 1 1 100%; min-width: 0; }
.mt-warn { color: var(--warn); font-size: 12px; margin: 6px 0 0; }
.mt-note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.mt-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.mt-bar .seg { margin-left: 0; }
.mt-info { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.mt-stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; display: flex; justify-content: center; }
.mt-stage svg { width: 100%; max-width: 640px; height: auto; max-height: 78vh; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .25)); }
.mt-form [data-ax][hidden] { display: none !important; }

/* ocena wyciętej karty (Test materiału) */
#mt-grade-toggle.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.mt-stage.grading { cursor: crosshair; outline: 2px solid var(--primary); outline-offset: -2px; }
.mt-grade { margin-top: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); max-width: 680px; }
.mt-grade label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.mt-picks { display: grid; gap: 6px; margin: 8px 0 10px; }
.mt-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; background: var(--surface-2); border-radius: var(--r-sm, 6px); font-size: 13px; }
.mt-pick b { min-width: 52px; }
.mt-pick .muted { color: var(--muted); }
.mt-pick button { padding: 0 7px; line-height: 20px; }
.mt-dup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--warn); border-radius: var(--r-sm, 6px); font-size: 13px; }
.mt-dup span { flex: 1 1 200px; }
.mt-dup[hidden] { display: none; }

/* kalkulator kosztu i czasu w sekcji Eksport */
.cost-sec { margin: 8px 0 0; padding-top: 6px; border-top: 1px dashed var(--border); text-align: left; }
.cost-sec > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 2px 0; }
.cost-sec .cost-body { margin-top: 6px; }
.cost-sec label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.cost-sec input, .cost-sec select { min-width: 0; width: 100%; box-sizing: border-box; }
.cost-sec .cost-pair { display: flex; gap: 4px; }
.cost-sec .cost-pw[hidden] { display: none; }
.cost-out { margin-top: 10px; display: grid; gap: 3px; font-size: 13px; }
.cost-out > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; padding: 2px 0; }
.cost-out > div > span { color: var(--muted); }
.cost-out > div > b { font-family: var(--mono); font-weight: 600; text-align: right; }
.cost-out .total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
.cost-out .piece { background: var(--surface-2); border-radius: var(--r-sm, 6px); padding: 6px 8px; margin-top: 4px; }
.cost-out .piece > span { color: var(--text); font-weight: 600; }
.cost-out .piece > b { color: var(--primary); font-size: 15px; }
.cost-sec .cost-note { margin: 6px 0 0; }

/* nagłówek strony z przełącznikiem trybów na środku (Testy, Grawer) */
.page-head.has-modes { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.page-head.has-modes .seg { margin: 0; justify-self: center; }
.page-head.has-modes .head-r { justify-self: end; margin: 0; }
@media (max-width: 700px) {
  .page-head.has-modes { grid-template-columns: 1fr; gap: 8px; }
  .page-head.has-modes .seg, .page-head.has-modes .head-r { justify-self: start; }
}
#gr-mode-wrap[hidden], #gr-mode-photo[hidden] { display: none; }

/* Grawer (zdjęcia) */
.ph-form [hidden] { display: none !important; }
.ph-form label.ph-sl { display: grid; grid-template-columns: 1fr 72px; gap: 2px 8px; align-items: center; margin-top: 4px; }
.ph-form label.ph-sl input[type="range"] { grid-column: 1 / 3; width: 100%; accent-color: var(--primary); margin: 0; }
.ph-form select { width: 100%; }
.ph-form .mp-top .row { gap: 6px; }
.ph-stage { position: relative; height: calc(100vh - 210px); min-height: 360px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; touch-action: none; }
.ph-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.ph-cmp { position: absolute; top: 0; bottom: 0; width: 0; z-index: 2; cursor: ew-resize; touch-action: none; }
.ph-cmp::before { content: ''; position: absolute; top: 0; bottom: 0; left: -14px; width: 28px; }
.ph-cmp::after { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--primary); box-shadow: 0 0 0 1px var(--surface); }
.ph-cmp-h { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--primary); background: var(--surface); color: var(--primary); font-size: 16px; line-height: 1; padding: 0; cursor: ew-resize; z-index: 1; }
.ph-cmp-h:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph-cmp[hidden] { display: none; }
.ph-stage.drop { outline: 2px dashed var(--primary); outline-offset: -6px; }
.ph-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; pointer-events: none; }
.ph-empty > * { pointer-events: auto; }
.ph-empty[hidden] { display: none; }

/* Edytor 2D: sekcja „Grawer zdjęcia” w dokerze Obraz */
.e2-engr label.ck { display: flex; align-items: center; gap: 6px; }
.e2-engr label.ck input { margin: 0; }
.e2-engr label { display: block; }
.e2-engr label.ph-sl { display: grid; }
.e2-engr summary { cursor: pointer; margin-top: 6px; }

/* okienko „Z telefonu” w Grawer Pro */
#ph-phone-dlg .ph-phone-status[data-kind="ok"] { color: var(--ok); }
#ph-phone-dlg .ph-phone-status[data-kind="err"] { color: var(--danger); }
#ph-phone-dlg canvas { width: 240px; height: auto; }
#ph-phone-dlg .ph-phone-wifi { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--accent); font-size: 15px; font-weight: 600; text-align: center; }
.ph-phone-btn { display: inline-flex; align-items: center; gap: 6px; }
.ph-phone-btn .ph-qr-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }

/* Grawer Wrap: pasek szybkiego wyboru wzoru */
.gr-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 4px 0 2px; }
.gr-strip-t, .gr-strip-more { aspect-ratio: 1; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); min-width: 0; overflow: hidden; cursor: pointer; }
.gr-strip-t:hover, .gr-strip-t:focus-visible, .gr-strip-more:hover { border-color: var(--primary); }
.gr-strip-t .gr-sw { display: block; width: 100%; height: 100%; border: 0; border-radius: 0; background-color: var(--paper, #fff); }
.gr-strip-more { font-weight: 600; color: var(--primary); font-size: 13px; }
.gr-strip-cap { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.gr-expset { margin-top: 8px; }

/* ---------- Tło ze zdjęcia (okno pomiaru z kartką A4) ---------- */
#ms-dlg .ms-box { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 8px; max-width: min(1040px, 96vw); max-height: 96vh; overflow-y: auto; }
#ms-dlg .ms-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#ms-dlg h1 { font-size: 18px; margin: 0; }
#ms-dlg .ms-step { color: var(--muted); font-size: 12px; }
#ms-dlg .ms-tips { font-size: 13px; color: var(--muted); }
#ms-dlg .ms-tips ul { margin: 4px 0 0; padding-left: 20px; }
#ms-dlg .ms-stage { position: relative; height: min(62vh, 640px); min-height: 260px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#ms-dlg .ms-stage canvas#ms-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ms-dlg #ms-loupe { position: absolute; top: 8px; width: 140px; height: 140px; border: 2px solid var(--accent); border-radius: var(--r-sm); background: var(--surface); pointer-events: none; box-shadow: var(--shadow); }
#ms-dlg #ms-loupe[hidden] { display: none; }
#ms-dlg .ms-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--overlay); font-weight: 600; }
#ms-dlg .ms-busy[hidden] { display: none; }
#ms-dlg .ms-status { margin: 0; font-size: 13px; min-height: 18px; color: var(--muted); }
#ms-dlg .ms-status[data-k="ok"] { color: var(--ok); }
#ms-dlg .ms-status[data-k="warn"] { color: var(--warn); }
#ms-dlg .ms-status[data-k="err"] { color: var(--danger); }
#ms-dlg .ms-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#ms-dlg .ms-bar[hidden] { display: none; }
#ms-dlg .ms-sp { flex: 1; }
#ms-dlg .ms-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
#ms-dlg button.on { background: var(--sel-bg); border-color: var(--sel); color: var(--sel); }
#ms-dlg button, #ms-dlg select { min-height: 36px; }

/* wybór źródła tła i panel Tło w Edytorze 2D */
#bg-src-dlg .dialog-box, #pt-dlg .dialog-box { display: block; max-width: 460px; }
#bg-src-dlg h1, #pt-dlg h1 { font-size: 18px; margin: 0 0 8px; }
#bg-src-dlg ul { margin: 6px 0 10px; padding-left: 20px; color: var(--muted); font-size: 13px; }
#bg-src-dlg .bg-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
#bg-src-dlg .bg-choice button { min-height: 52px; font-weight: 600; }
.e2-bgpanel { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.e2-bgpanel .bg-thumb { width: 100%; max-height: 140px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.e2-bgpanel label { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; }
.e2-bgpanel input[type=range] { flex: 1; accent-color: var(--primary); }
.e2-bgpanel .bg-xy { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.e2-bgpanel .bg-xy input { width: 100%; }
.e2-bgpanel .bg-btns { display: flex; flex-direction: column; gap: 6px; }
.e2-pbtn-accent { border-color: var(--accent) !important; }

/* Grawer Pro: cel wysyłki do Edytora 2D */
.ph-target { display: grid; gap: 4px; font-size: 12px; margin-top: 8px; }
.ph-target select { width: 100%; }
#pt-dlg .pt-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
#pt-dlg .pt-row { display: flex; flex-direction: row; text-align: left; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; background: var(--surface-2); }
#pt-dlg .pt-row:has(input:checked) { border-color: var(--primary); background: var(--sel-bg); }
#pt-dlg .pt-row img, #pt-dlg .pt-ph { width: 64px; height: 48px; object-fit: contain; flex: none; border-radius: var(--r-sm); background: var(--surface); }

/* Grawer Wrap: otwieranie projektu / pliku */
.gr-open { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.gr-projpick { position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 4px; width: 340px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.gr-projpick button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 4px; background: transparent; border: 0; border-radius: 6px; color: var(--text); }
.gr-projpick button:hover, .gr-projpick button.on { background: var(--surface-2); }
.gr-projpick .t { width: 48px; height: 36px; flex: none; border-radius: 4px; background: var(--surface-2) center / cover no-repeat; }
.gr-projpick small { display: block; color: var(--muted); }
#gr-view.drop { outline: 2px dashed var(--primary); outline-offset: -4px; }

/* wspólny pasek „Eksport” (Edytor 2D, Edytor 3D, Grawer Wrap, Grawer Pro): zwykła ostatnia sekcja panelu bocznego */
.export-bar { margin: 16px 0 4px; padding: 10px 0 0; border-top: 1px solid var(--border); text-align: left; }
.export-bar .export-title { display: block; margin-bottom: 6px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.export-bar .exp-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.export-bar .exp-btns > button { margin: 0 !important; }
.export-bar .tolaser { order: -2; background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.export-bar .tolaser:not(:disabled):hover { background: var(--primary); color: var(--on-primary); filter: brightness(1.08); }
.export-bar .to2d, .export-bar .tograw { order: -1; }
.export-bar .hint { margin: 4px 0 0; }
.export-bar .hint:empty { display: none; }
.export-bar label.ph-target { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.export-bar label.ph-target select { flex: 1; min-width: 0; }
.export-bar .save-proj, .export-bar .save-copy { order: 5; }
.export-bar .save-copy { background: transparent; border-color: transparent; color: var(--muted); text-decoration: underline; padding-left: 4px; padding-right: 4px; }
.export-bar .save-status:empty { display: none; }
.ph-proj { position: relative; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.ph-proj .row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ph-proj .row:first-child { margin-top: 0; }
.ph-proj #ph-pname { flex: 1; min-width: 0; }
.ph-proj .hint:empty { display: none; }
.ph-proj .hint { margin: 6px 0 0; }
.ph-proj .gr-projpick { top: 100%; left: 0; right: 0; width: auto; }
.ph-proj .gr-projpick { overflow-x: hidden; }
.ph-proj .gr-projpick button > span:last-child { min-width: 0; flex: 1; }
.ph-proj .gr-projpick b, .ph-proj .gr-projpick small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { margin: 2px 0 0; font: 400 11.5px var(--mono); color: var(--muted); }
.save-state:empty { display: none; }
.gr-open .save-state { margin: 0; }
.gr-open .gr-name { width: 180px; }
.e2-mbtn.e2-mtxt { width: auto; flex: none; min-width: max-content; overflow: visible; padding: 0 9px; font: 500 12px var(--font); border-color: var(--border); }
.e2-savestate { font: 400 11px var(--mono); color: var(--muted); white-space: nowrap; }
.e2-savestate:empty { display: none; }
.e2-dockbody [data-dock="export"] .export-bar { margin: 0; padding: 0; border-top: 0; }
.e2-dockbody [data-dock="export"] .export-title { display: none; }
.e2-mlist { position: fixed; z-index: 50; width: 320px; max-height: 260px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); font-size: 12px; }
.e2-mrow { display: flex; align-items: center; gap: 4px; padding: 1px 2px; border-radius: var(--r-sm); }
.e2-mrow:hover { background: var(--hover-bg); }
.e2-mrow.on { background: var(--sel-bg); color: var(--primary); }
.e2-mtxt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-family: var(--mono); }

/* kopia zapasowa: pasek przypomnienia na liście projektów */
.backup-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-md, 6px); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.backup-bar[hidden] { display: none; }
.backup-bar span { flex: 1; }
.backup-bar button { padding: 2px 8px; }

/* ---------- stan lasera (Quba Laser Desk) i biblioteka materiałów ---------- */
.laser-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); font: 500 11px var(--mono); white-space: nowrap; }
.laser-chip > i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.laser-chip > span { overflow: hidden; text-overflow: ellipsis; }
.laser-chip[data-kind="idle"] { color: var(--text); } .laser-chip[data-kind="idle"] > i { background: var(--ok); }
.laser-chip[data-kind="busy"] { color: var(--text); } .laser-chip[data-kind="busy"] > i { background: var(--sel); animation: laser-pulse var(--dur-breathe) ease-in-out infinite; }
.laser-chip[data-kind="hold"] { color: var(--text); } .laser-chip[data-kind="hold"] > i { background: var(--warn); }
.laser-chip[data-kind="alarm"] { color: var(--danger); border-color: var(--danger); font-weight: 700; } .laser-chip[data-kind="alarm"] > i { background: var(--danger); }
@keyframes laser-pulse { 50% { opacity: .45; } } /* spokojny oddech zamiast mrugania (pętla wyglądu 9B) */
@media (prefers-reduced-motion: reduce) { .laser-chip[data-kind="busy"] > i { animation: none; } }
#tabs > .laser-chip { margin-left: auto; flex: 0 1 auto; min-width: 0; max-width: 220px; } /* gives way first; full text in its tooltip */
@media (max-width: 1480px) { #tabs a[data-tab] { padding: 0 8px; } #tabs > .laser-chip > span { display: none; } #tabs > .laser-chip { padding: 2px 6px; } #tabs .tab-project { max-width: 180px; } } /* sam punkt statusu; pełny tekst w podpowiedzi */
#tabs > .laser-chip + .tab-project { margin-left: 0; }
@media (max-width: 1200px) { #tabs > .laser-chip > span { display: none; } #tabs > .laser-chip { padding: 2px 6px; } }
.export-bar > .laser-chip { margin: 0 0 6px; }
.use-laser { margin-top: 6px; } .use-laser[hidden] { display: none !important; }
.mat-lib { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.mat-lib .mat-side { width: 340px; } .mat-lib .mat-edit { width: 420px; max-width: 100%; }
.mat-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mat-item { display: grid; gap: 2px; text-align: left; padding: 7px 10px; }
.mat-item.on { border-color: var(--primary); }
.mat-item small { color: var(--muted); font-weight: 400; }
.mat-item .badge { justify-self: start; font: 600 10px var(--mono); color: var(--ok); }
.mat-op { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-bottom: 8px; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.mat-op .chk { grid-column: 1 / 3; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--text); font-weight: 600; }

/* Edytor 2D: okno Dane zmienne (CSV) */
#e2-csv-dlg .dialog-box { display: block; max-width: 760px; max-height: 92vh; overflow-y: auto; }
#e2-csv-dlg h1 { font-size: 18px; margin: 0 0 6px; }
#e2-csv-dlg code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
#e2-csv-dlg .csv-row, #e2-csv-dlg .csv-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 8px 0; }
#e2-csv-dlg label { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
#e2-csv-dlg .csv-chk { display: inline-flex; }
#e2-csv-dlg textarea { width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 12px; resize: vertical; background: var(--surface-2); color: var(--text); border: 1px solid var(--field-border); border-radius: var(--r-sm); padding: 6px 8px; }
#e2-csv-dlg .csv-table { max-height: 168px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); margin: 6px 0; }
#e2-csv-dlg .csv-table:empty { display: none; }
#e2-csv-dlg .csv-table table { border-collapse: collapse; width: 100%; font-size: 12px; }
#e2-csv-dlg .csv-table th, #e2-csv-dlg .csv-table td { padding: 3px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
#e2-csv-dlg .csv-table thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
#e2-csv-dlg .csv-table td:first-child, #e2-csv-dlg .csv-table th:first-child { color: var(--muted); font-family: var(--mono); width: 1%; }
#e2-csv-dlg .csv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin-top: 8px; }
#e2-csv-dlg fieldset { border: 1px solid var(--border); border-radius: var(--r-sm); margin: 0; padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 6px; }
#e2-csv-dlg legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
#e2-csv-dlg fieldset input[type=number] { width: 58px; }
#e2-csv-dlg .csv-warn { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
#e2-csv-dlg .csv-warn li { color: var(--warn); padding: 1px 0; }
#e2-csv-dlg .csv-warn li.bad { color: var(--danger); }
#e2-csv-dlg .csv-warn li.ok { color: var(--ok); font-weight: 600; }
#e2-csv-dlg .csv-btns { margin-top: 12px; }

/* ---------- Ze zdjęcia (v3) ---------- */
.oz-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.oz-steps button { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.oz-steps button b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--text); font: 600 12px var(--mono); }
.oz-steps button.on { border-color: var(--primary); color: var(--text); background: var(--sel-bg); }
.oz-steps button.on b { background: var(--primary); color: var(--on-primary); }
.oz-steps button.done b { background: var(--ok); color: var(--on-primary); }
.oz-steps button:disabled { opacity: .45; cursor: default; }
.oz-drop { border: 2px dashed var(--border); border-radius: var(--r-md); background: var(--surface); padding: 28px 24px 22px; text-align: center; max-width: 720px; margin: 8px auto 0; transition: border-color .15s, background .15s; cursor: pointer; }
.oz-drop.over { border-color: var(--primary); background: var(--sel-bg); }
.oz-drop h2 { font: 600 22px/1.25 var(--font); letter-spacing: 0; text-transform: none; color: var(--text); margin: 12px auto 6px; max-width: 24ch; }
.oz-drop p { color: var(--muted); max-width: 52ch; margin: 6px auto; }
.oz-hero { width: min(300px, 70%); height: auto; }
.oz-src { justify-content: center; margin: 14px 0 6px; flex-wrap: wrap; }
.oz-tips { padding-left: 18px; margin: 4px 0 8px; display: grid; gap: 5px; }
.oz-toolbar { margin: 8px 0; flex-wrap: wrap; align-items: center; }
.oz-toolbar button.on { border-color: var(--primary); background: var(--sel-bg); }
.oz-sp { flex: 1; }
.oz-photo { position: relative; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; min-height: 260px; }
.oz-photo .zm-content > svg { display: block; width: 100%; height: min(70vh, 760px); }
.oz-photo.oz-tool-edit .zm-content > svg { cursor: crosshair; }
.oz-busy { margin: 6px 0; font-weight: 600; color: var(--primary); }
.oz-plate { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; color: var(--text); margin-bottom: 8px; position: relative; }
.oz-plate .zm-content > svg { display: block; width: 100%; height: 300px; }
#oz-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.oz-list { display: grid; gap: 6px; margin-bottom: 8px; }
.oz-row { border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 8px; background: var(--surface-2); }
.oz-row.sel { border-color: var(--primary); background: var(--sel-bg); }
.oz-row.off { opacity: .55; }
.oz-row-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oz-row-h input[type=text] { flex: 1; min-width: 90px; }
.oz-row-h small { color: var(--muted); font: 500 11px var(--mono); }
.oz-row-b { display: grid; gap: 4px; margin-top: 6px; }
.oz-row-2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.oz-row-2 input[type=number] { width: 64px; }
.oz-row-b > button { justify-self: start; padding: 3px 12px; }
.oz-dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font: 700 11px var(--mono); flex: none; }
.oz-pobj { cursor: grab; }
.oz-pobj.bad path { stroke-dasharray: 3 1.5; }
.oz-notch-h { cursor: grab; }
.oz-pname { user-select: none; }
.oz-pname:hover { fill: var(--accent); }
.oz-rename { position: absolute; z-index: 5; width: 150px; padding: 3px 6px; border: 1px solid var(--primary); border-radius: var(--r-sm, 4px); background: var(--surface); color: var(--text); font: 600 13px var(--sans, system-ui, sans-serif); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
#oz-msg3:empty { display: none; }
.oz-sl { display: grid; gap: 2px; margin: 6px 0; }
.oz-sl span { display: flex; justify-content: space-between; gap: 8px; }
.oz-sl b { font: 600 12px var(--mono); }
.oz-modes button.on { border-color: var(--primary); background: var(--sel-bg); }
#page-zdjecie[data-step="1"] .export-bar, #page-zdjecie[data-step="2"] .export-bar { display: none; }
@media (max-width: 700px) {
  .oz-form { width: 100%; }
  .oz-drop { padding: 18px 12px; }
  .oz-steps { width: 100%; }
  .oz-steps button { padding-right: 10px; font-size: 13px; }
  .oz-photo .zm-content > svg { height: 52vh; }
}

/* Suwak „Porównaj” (ui-compare.js) */
.cmp { position: relative; overflow: hidden; touch-action: none; user-select: none; cursor: ew-resize; }
.cmp-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cmp-layer.cmp-fit { object-fit: contain; }
.cmp-bar { position: absolute; top: 0; bottom: 0; width: 0; z-index: 3; }
.cmp-bar::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--primary); box-shadow: 0 0 0 1px var(--surface); }
.cmp-h { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--primary); background: var(--surface); color: var(--primary); font-size: 16px; line-height: 1; padding: 0; cursor: ew-resize; }
.cmp-h:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cmp-zoom { cursor: grab; }
.cmp-zoom.cmp-panning { cursor: grabbing; }
.cmp-pane { position: absolute; inset: 0; overflow: hidden; }
.cmp-tools { position: absolute; top: 6px; right: 6px; z-index: 4; display: flex; gap: 4px; align-items: center; cursor: default; }
.cmp-tools button { padding: 3px 8px; font-size: 12px; min-height: 0; }
.cmp-zinfo { font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm, 4px); padding: 2px 6px; font-variant-numeric: tabular-nums; }

/* Obraz warstwowy (Grawer ▸ Obraz warstwowy) */
#lw-2d { margin-bottom: 8px; }
#lw-2d .lw-stage { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; padding: 6px; display: flex; justify-content: center; }
#lw-2d .cmp { width: 100%; max-height: 440px; background: var(--paper); }
#lw-2d .lw-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 2px 4px 0; }
#lw-2d .lw-empty { border: 2px dashed var(--border); border-radius: var(--r-md); padding: 28px 16px; text-align: center; background: var(--surface-2); }
#lw-2d .lw-empty.drop, #lw-2d .lw-stage.drop { border-color: var(--primary); }
#lw-2d .lw-empty .row { justify-content: center; margin-top: 10px; }
#lw-2d svg.lw-outline { overflow: hidden; }
#lw-2d svg.lw-outline path { fill: none; stroke: var(--text); stroke-opacity: 0.7; stroke-width: 1px; vector-effect: non-scaling-stroke; }
#lw-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.lw-th { display: grid; grid-template-columns: 56px 1fr 34px; gap: 6px; align-items: center; font-size: 12px; margin: 3px 0; }
.lw-th input[type=range] { width: 100%; }
.lw-th output { text-align: right; font-variant-numeric: tabular-nums; }
.lw-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid var(--border); }
.lw-tab { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.lw-tab th, .lw-tab td { text-align: left; padding: 2px 6px; border-bottom: 1px solid var(--border); }

/* ---------- Kolory ▸ Po numerach ---------- */
#kl-2d { margin-bottom: 8px; }
#kl-2d .kl-stage { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; padding: 6px; display: flex; justify-content: center; }
#kl-2d .cmp { width: 100%; max-height: 460px; background: var(--paper); }
#kl-2d .kl-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 2px 4px 0; }
#kl-2d .kl-empty { border: 2px dashed var(--border); border-radius: var(--r-md); padding: 28px 16px; text-align: center; background: var(--surface-2); }
#kl-2d .kl-empty.drop, #kl-2d .kl-stage.drop { border-color: var(--primary); }
#kl-2d .kl-empty .row { justify-content: center; margin-top: 10px; }
#kl-2d .kl-map svg { width: 100%; height: 100%; display: block; }
#kl-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.kl-range { display: grid; grid-template-columns: 1fr minmax(90px, 1.2fr) 30px; gap: 6px; align-items: center; font-size: 12px; margin: 4px 0; }
.kl-range input[type=range] { width: 100%; }
.kl-range output { text-align: right; font-variant-numeric: tabular-nums; }
.kl-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid var(--border); }
.kl-tab { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0 8px; }
.kl-tab th, .kl-tab td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--border); }
.kl-tab tr[data-n] { cursor: pointer; }
.kl-tab tr[data-n]:hover td { background: var(--surface-2); }
.kl-tab tr[data-n].on td { background: var(--sel-bg); }
.kl-pal { display: grid; gap: 4px; margin: 4px 0 6px; }
.kl-pal .row { gap: 4px; flex-wrap: nowrap; }
.kl-pal input[type=color] { width: 34px; height: 28px; padding: 0; flex: none; }
.kl-pal input[type=text] { flex: 1; min-width: 0; }
.kl-soon { border: 2px dashed var(--border); border-radius: var(--r-md); padding: 40px 16px; text-align: center; background: var(--surface-2); margin: 16px 0; }
#kl-mode-paint[hidden], #kl-mode-yarn[hidden] { display: none; }

/* ---------- Kolory ▸ Włóczka i mozaika ---------- */
#st-2d { margin-bottom: 8px; }
#st-2d .kl-stage { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; padding: 6px; display: flex; justify-content: center; }
#st-2d .cmp { width: 100%; max-height: 460px; background: var(--paper); }
#st-2d .kl-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 2px 4px 0; }
#st-2d .kl-empty { border: 2px dashed var(--border); border-radius: var(--r-md); padding: 28px 16px; text-align: center; background: var(--surface-2); }
#st-2d .kl-empty.drop, #st-2d .kl-stage.drop { border-color: var(--primary); }
#st-2d .kl-empty .row { justify-content: center; margin-top: 10px; }
#st-2d .kl-map svg { width: 100%; height: 100%; display: block; }
#st-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
#st-explode-row[hidden] { display: none; }

/* Generatory (kafelki) */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 4px 0 24px; }
.gen-tile { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); text-decoration: none; overflow: hidden; transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.gen-tile:hover, .gen-tile:focus-visible { border-color: var(--primary); transform: var(--lift); box-shadow: var(--shadow-lift); }
.gen-tile:focus-visible { outline: var(--ring-w) solid var(--primary); outline-offset: 2px; }
.gen-tile:active { transform: translateY(0) scale(.99); box-shadow: none; transition-duration: var(--dur-fast); }
.gen-pic { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: #0d1220; border-bottom: 1px solid var(--border); } /* zdjęcia z podglądu 3D mają ciemne tło sceny */
.gen-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s var(--ease-out); }
.gen-tile:hover .gen-pic img { transform: scale(1.04); }
.gen-txt { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.gen-txt b { font-size: 16px; }
.gen-txt span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.gen-back { font-size: 13px; font-weight: 400; color: var(--muted); text-decoration: none; white-space: nowrap; margin-right: 12px; vertical-align: middle; }
.gen-back:hover { color: var(--primary); }

/* Wybór czcionki (font-picker.js): przycisk zamiast <select data-font> i rozwijana lista z wyszukiwarką */
.fp-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 120px; max-width: 220px; width: auto; padding: 3px 6px; font-size: 13px; text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--field-border); border-radius: var(--r-sm); cursor: pointer; }
.fp-btn:hover { border-color: var(--primary); }
.fp-btn:disabled { opacity: 0.5; cursor: default; }
.fp-bn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.fp-caret { flex: none; color: var(--muted); font-size: 11px; }
.grid2 .fp-btn, .tp-line .fp-btn, label > .fp-btn { max-width: 100%; }
.grid2 label .fp-btn { width: 100%; }
.fp-pop { position: fixed; z-index: 450; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.fp-pop[hidden] { display: none; }
.fp-q { margin: 8px 8px 4px; width: auto; }
.fp-cats { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 8px 6px; border-bottom: 1px solid var(--border); }
.fp-cats button { padding: 2px 8px; font-size: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.fp-cats button i { font-style: normal; color: var(--muted); font-size: 11px; }
.fp-cats button.on { background: var(--sel-bg); border-color: var(--primary); }
.fp-list { flex: 1; min-height: 120px; overflow-y: auto; padding: 4px; }
.fp-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; }
.fp-item:hover { background: var(--surface-2); }
.fp-item.act { background: var(--sel-bg); }
.fp-item.cur { border-color: var(--primary); }
.fp-item .fp-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; line-height: 1.35; }
.fp-item .fp-plain { font-size: 13px; color: var(--muted); font-family: var(--font); }
.fp-tag { flex: none; font-size: 10.5px; color: var(--muted); font-family: var(--font); }
.fp-star { flex: none; font-size: 15px; line-height: 1; color: var(--muted); opacity: 0.35; cursor: pointer; }
.fp-item:hover .fp-star, .fp-star.on { opacity: 1; }
.fp-star.on { color: var(--warn); }
.fp-empty { color: var(--muted); margin: 8px; font-size: 12px; }
.fp-foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--border); }
.fp-sample { flex: 1; min-width: 0; width: auto; font-size: 12px; }
.fp-count { flex: none; color: var(--muted); font-size: 11px; }

/* Prezent z imieniem (#imie) – układ jak Topery */
#ng-2d { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; color: var(--text); padding: 6px; margin-bottom: 8px; }
#ng-2d svg { width: 100%; height: 240px; display: block; }
#ng-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.ng-slots { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tb-spos { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tb-spos .ng-slots { margin-bottom: 0; }
.tb-spos-ex { margin: 0; font-style: italic; }
.ng-slots button { font-size: 12px; padding: 4px 8px; }
.ng-slots button.on, .ng-icons button.on { border-color: var(--primary); background: var(--sel-bg); }
.ng-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
.ng-icons-grp { grid-column: 1 / -1; font-size: 11px; color: var(--muted); margin-top: 4px; }
.ng-icons button { padding: 4px; min-height: 36px; display: grid; place-items: center; font-size: 11px; color: var(--text); }
.ng-icons button svg, .ng-icons button img { width: 34px; height: 34px; display: block; object-fit: contain; }

/* Witraż (#witraz) – dopisać na końcu src/style.css */
#wz-2d { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--scene-bg); padding: 6px; margin-bottom: 8px; min-height: 280px; display: flex; align-items: center; justify-content: center; }
#wz-2d canvas { display: block; max-width: 100%; cursor: crosshair; }
#wz-2d .wz-empty:empty { display: none; }
#wz-views { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
#wz-views .hint { margin: 0 4px 0 0; }
#wz-views button.on, .wz-sw button.on { border-color: var(--primary); background: var(--sel-bg); }
.wz-sw { display: flex; flex-wrap: wrap; gap: 6px; }
.wz-sw button { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; font: 500 11px var(--mono); color: var(--muted); }
.wz-sw input[type=color] { width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; }
.wz-photo { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.wz-photo img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); }
.wz-photo .row { display: flex; flex-wrap: wrap; gap: 6px; }
#wz-form input[type=color] { width: 100%; height: 26px; padding: 1px; border: 1px solid var(--field-border); border-radius: var(--r-sm); background: var(--surface-2); }

/* Mapa głębi (#glebia, src/depth-page.js) – dopisać na końcu src/style.css */
#dg-2d { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; padding: 8px; margin-bottom: 8px; display: grid; place-items: center; height: 300px; }
#dg-2d canvas { max-width: 100%; max-height: 282px; width: auto; height: auto; display: block; box-shadow: 0 2px 10px rgb(0 0 0 / .25); image-rendering: auto; }
#dg-view { position: relative; height: 360px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
#dg-views { margin: 4px 0 6px; }
#dg-views button.on { border-color: var(--primary); background: var(--sel-bg); color: var(--primary); }
.tp-types.dg-two { grid-template-columns: 1fr 1fr; }
.dg-shapes { grid-template-columns: repeat(4, 1fr); }
.dg-shapes button img { width: 84px; height: 44px; max-width: 100%; object-fit: contain; }
.dg-range { margin-top: 6px; }
.dg-range > span { display: flex; justify-content: space-between; gap: 8px; }
.dg-range output { font-family: var(--mono); color: var(--text); }
.dg-range input { width: 100%; margin: 2px 0 0; }
#page-glebia.dg-drop .kerf-layout { outline: 2px dashed var(--primary); outline-offset: 6px; border-radius: var(--r-md); }
/* Topery – typ „Z nagłówkiem”: siatka miniatur nagłówków (topper-heads.js) */
.tp-head-grp { margin: 6px 0 3px; }
.tp-heads { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 4px; }
.tp-heads button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px 3px; font-size: 10px; line-height: 1.1; text-align: center; }
.tp-heads button svg { width: 34px; height: 34px; color: var(--text); }
.tp-heads button.on { border-color: var(--primary); background: var(--sel-bg); }
.tp-heads button.on svg { color: var(--primary); }

/* Tabliczka adresowa (src/plate-page.js) – jak „Prezent z imieniem” */
#tb-2d { border: 1px solid var(--border); border-radius: var(--r-md); background-color: var(--surface-2); background-image: var(--grid-img); background-size: 16px 16px; color: var(--text); padding: 6px; margin-bottom: 8px; }
#tb-2d svg { width: 100%; height: 300px; display: block; }
#tb-view { position: relative; height: 340px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
#tb-symbols button svg { color: var(--text); }
.tb-pat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.tb-pat-cur { display: flex; align-items: center; gap: 8px; padding: 4px; text-align: left; }
.tb-pat-cur .gr-sw { width: 56px; height: 40px; flex: none; }
.tb-pat-quick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.tb-pat-quick button { padding: 2px; min-height: 34px; font-size: 11px; }
.tb-pat-quick .gr-sw { display: block; width: 100%; height: 28px; }

/* Znak cienia (#cien) */
#cs-2d { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); padding: 6px; margin-bottom: 8px; }
#cs-view { position: relative; height: 380px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
.cs-views { display: grid; grid-template-columns: 1fr 2fr; grid-template-rows: 1.5fr 1fr; gap: 8px; height: 100%; min-height: 380px; }
.cs-views figure:nth-child(3) { grid-column: 1 / -1; }
.cs-views figure { margin: 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cs-views figcaption { font-size: 11px; color: var(--muted); margin: 0 0 4px 22px; }
.pv-pane .cs-views figcaption { margin-left: 22px; }
.cs-views svg { flex: 1 1 0; width: 100% !important; height: 100% !important; min-height: 0; display: block; }
@media (max-width: 700px) { .cs-views { grid-template-columns: 1fr; grid-template-rows: none; } .cs-views figure { height: 260px; } }
/* Tabliczka: kafelki presetów z miniaturą, symbole z biblioteki, materiały i kolory warstw */
#tb-examples { flex: 1 1 100%; min-width: 0; }
.tb-cards { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.tb-cards-h { flex: none; writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tb-card { flex: none; width: 136px; display: flex; flex-direction: column; gap: 4px; padding: 5px; text-align: left; background: var(--surface-2); }
.tb-card-img { display: block; height: 86px; border-radius: var(--r-sm); background-color: var(--surface); background-image: var(--grid-img); background-size: 12px 12px; }
.tb-card-img svg { width: 100%; height: 100%; display: block; }
.tb-card-img { overflow: hidden; }
.tb-card-photo { width: 100%; height: 100%; display: block; object-fit: contain; }
.page-head > .preset-cards { flex: 1 0 100%; min-width: 0; }
.tb-card-noimg { display: grid; place-items: center; }
.tb-card-noimg::after { content: '◇'; font-size: 26px; color: var(--muted); }
.tb-card-n { font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-card.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--sel-bg); }
.tb-sym-cur { width: 40px; height: 40px; flex: none; display: grid; place-items: center; color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.tb-sym-cur svg { width: 32px; height: 32px; }
.tb-sym-quick button { display: grid; place-items: center; color: var(--text); }
.tb-sym-quick button svg { width: 24px; height: 24px; }
.tb-sym-quick button.on { border-color: var(--primary); background: var(--sel-bg); }
.gr-pk-grid.tb-sym-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.gr-tile.tb-sym-tile { align-items: center; contain-intrinsic-size: 96px 112px; }
.tb-sym-ic { display: grid; place-items: center; width: 100%; height: 72px; color: var(--text); }
.tb-sym-ic svg { width: 56px; height: 56px; }
.tb-sym-tile .gr-tn { text-align: center; width: 100%; }
.tb-sym-tile.on .tb-sym-ic { color: var(--primary); }
.tb-sym-src { position: absolute; left: 5px; top: 4px; font-size: 9px; color: var(--muted); }
.tb-sym-st { display: flex; gap: 2px; flex: none; }
.tb-sym-st button { padding: 4px 8px; font-size: 12px; }
.tb-sym-st button.on { border-color: var(--primary); background: var(--sel-bg); }
.tb-combos { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.tb-combos button { display: flex; height: 30px; padding: 3px; gap: 2px; }
.tb-combos button span { flex: 1; border-radius: 2px; }
.tb-combos button.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tb-layer { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; margin-bottom: 8px; background: var(--surface-2); }
.tb-layer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tb-layer-head .hint { margin: 0 0 0 auto; font-size: 11px; text-align: right; }
.tb-layer-sw { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.tb-mats { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 7px; }
.tb-mats button { padding: 3px 7px; font-size: 12px; }
.tb-mats button.on { border-color: var(--primary); background: var(--sel-bg); color: var(--primary); }
.tb-colors { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px; }
.tb-colors button, .tb-own-col { width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.tb-colors button.on, .tb-own-col.on { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--primary); }
.tb-own-col { position: relative; display: grid; place-items: center; background: var(--surface); color: var(--muted); cursor: pointer; }
.tb-own-col::after { content: '+'; font-size: 15px; line-height: 1; pointer-events: none; }
.tb-own-col.on::after { content: ''; }
.tb-own-col input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.tb-burn { display: flex; align-items: center; gap: 6px; margin: 7px 0 0; }
.tb-burn span { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); }

/* Linia cięcia z obrazka (#wyciecie, src/cutline-page.js) */
#cl-2d { position: relative; border: 1px solid var(--border); border-radius: var(--r-md); background-color: #fff; background-image: linear-gradient(45deg, #f1f1f1 25%, transparent 25%, transparent 75%, #f1f1f1 75%), linear-gradient(45deg, #f1f1f1 25%, transparent 25%, transparent 75%, #f1f1f1 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; color: #555; padding: 6px; margin-bottom: 8px; --muted: #777; }
#cl-2d .zm-content > svg { width: 100%; height: 420px; display: block; }
#cl-view { position: relative; height: 380px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--scene-bg); margin-bottom: 8px; }
#cl-views { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
#cl-views .hint { margin: 0 4px 0 0; }
#cl-views .check { margin-left: 8px; }
#cl-views button.on { border-color: var(--primary); background: var(--sel-bg); }
.cl-photo img { display: block; max-width: 100%; max-height: 140px; margin: 0 auto 6px; border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff; }
.cl-photo .hint { margin: 4px 0 0; }
.tp-types.cl-two { grid-template-columns: 1fr 1fr; }
.tp-leaves { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); }
h2.tp-fold { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; padding: 4px 0; margin-bottom: 2px; border-top: 1px solid var(--border, #ddd); }
h2.tp-fold:first-of-type { border-top: 0; }
h2.tp-fold::before { content: ''; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; transition: transform .15s; }
h2.tp-fold.folded::before { transform: rotate(-90deg); }
h2.tp-fold:hover, h2.tp-fold:focus-visible { color: var(--text); outline: none; }
h2.tp-fold.folded { margin-bottom: 0; }

/* Puzzle: ustawienia graweru obrazu (wspólny formularz z zakładki Grawer, photo-engrave-form.js) */
.pz-engr details { border-top: 1px solid var(--border); padding: 6px 0; }
.pz-engr summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 2px 0; }
.pz-engr details > .grid2 { margin-top: 6px; }
.pz-engr [hidden] { display: none !important; }
.pz-engr label.ph-sl { display: grid; grid-template-columns: 1fr 72px; gap: 2px 8px; align-items: center; margin-top: 4px; }
.pz-engr label.ph-sl input[type="range"] { grid-column: 1 / 3; width: 100%; accent-color: var(--primary); margin: 0; }
.pz-engr label.ck { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.pz-engr label.ck input { margin: 0; }
.pz-engr select { width: 100%; }

/* strona narzędzia wczytuje się (dynamiczny import w pages.js) – kliknięcia czekają na podpięcie obsługi */
.page-loading { pointer-events: none; cursor: progress; }

/* ===== Mikrointerakcje: jedna warstwa stanów (hover / active / focus-visible / disabled / przeciąganie pól) =====
   Tylko tokeny z src/brand/tokens.css (--dur, --dur-fast, --ease-out, --ring-w, --press, --lift, --shadow-lift).
   Przejścia wyłącznie: background-color, border-color, color, box-shadow, transform. :where() = zerowa specyficzność,
   więc reguły konkretnych elementów (wcześniej w pliku i w JS) zawsze wygrywają. */
:where([role="button"], [role="tab"], [role="option"], [role="menuitem"], [role="switch"], summary, select, label.check, li[tabindex], a.btn) {
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@media (hover:hover) and (pointer:fine) {
  :where([role="tab"], [role="option"], [role="menuitem"], li[tabindex]):not([aria-disabled="true"]):hover { background-color: var(--hover-bg); }
  :where(select, input[type=number], input[type=text], textarea):not(:disabled):not(:focus):hover { border-color: var(--muted); }
  input[type=checkbox]:not(:disabled), input[type=radio]:not(:disabled), input[type=range]:not(:disabled) { cursor: pointer; }
}
/* wciśnięcie: krótsze przejście, lekkie zmniejszenie (uchwyty porównania mają własne przesunięcie, więc tylko skala na nim) */
button:not(:disabled):not(.cmp-h):not(.ph-cmp-h):active, :where([role="button"], [role="tab"], a.btn):not([aria-disabled="true"]):active { transform: var(--press); transition-duration: var(--dur-fast); }
.cmp-h:active, .ph-cmp-h:active { transform: translate(-50%, -50%) scale(.94); }
#tabs a[data-tab]:active { background-color: var(--sel-bg); }
.card:active { transform: none; box-shadow: none; transition-duration: var(--dur-fast); }
/* fokus z klawiatury: wyraźna obwódka akcentu (WCAG 2.4.7 / 1.4.11); obramowanie pól zostaje, obwódka jest na zewnątrz */
:where(button, [role="button"], [role="tab"], [role="option"], [role="menuitem"], [role="switch"], summary, a, label.check, li[tabindex], .card):focus-visible { outline: var(--ring-w) solid var(--primary); outline-offset: 2px; }
#tabs a[data-tab]:focus-visible { outline-offset: -3px; border-radius: var(--r-sm); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible, input[type=range]:focus-visible { outline: var(--ring-w) solid var(--primary); outline-offset: 2px; }
/* wyłączone: przyciemnione, bez podniesienia i bez wciśnięcia */
:where(button, input, select, textarea, [aria-disabled="true"]):disabled, [aria-disabled="true"] { cursor: not-allowed; }
:where(input, select, textarea):disabled { opacity: .55; }
[aria-disabled="true"]:hover, button:disabled:hover { transform: none; box-shadow: none; }
/* pola liczbowe przeciągane myszą (ui-scrub.js: .scrub-hot na polu i etykiecie, body.ui-scrubbing w trakcie) – tylko wygląd, logika bez zmian */
input.scrub-hot { cursor: ew-resize; }
label.scrub-hot { cursor: ew-resize; }
body.ui-scrubbing input.scrub-hot:active, body.ui-scrubbing input.scrub-hot:hover, body.ui-scrubbing input.scrub-hot:focus {
  border-color: var(--primary); background-color: var(--sel-bg); box-shadow: 0 0 0 1px var(--primary); color: var(--primary);
}
/* mniej ruchu: bez transformacji i przejść (stany kolorem zostają) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  button:active, .card:hover, .card:active, .gen-tile:hover, .gen-tile:focus-visible, .gen-tile:active, .gen-tile:hover .gen-pic img, :where([role="button"], [role="tab"], a.btn):active, .mode:active { transform: none !important; }
  .cmp-h:active, .ph-cmp-h:active { transform: translate(-50%, -50%) !important; }
}

/* ===== Ładowanie (pętla wyglądu 7, DESIGN.md §11, src/busy.js) =====
   Jeden wskaźnik: cienki pasek u góry obszaru, który się liczy (pętla --dur-loop), i napis co się dzieje.
   Pojawia się dopiero po --busy-delay (300 ms): szybkie operacje nic nie migają. */
.busy { position: absolute; inset: 0; z-index: 30; pointer-events: none; opacity: 0; transition: none; }
/* widoczny dopiero po --busy-delay; opacity i transform liczy kompozytor, więc pasek jedzie także wtedy,
   gdy liczenie podglądu blokuje główny wątek */
.busy.on { opacity: 1; transition: opacity var(--dur) var(--ease-out) var(--busy-delay); }
.busy-bar { display: block; position: relative; height: var(--busy-h); overflow: hidden;
  background: color-mix(in srgb, var(--primary) 18%, transparent); }
.busy-bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: busy-run var(--dur-loop) var(--ease-out) infinite; }
/* napis na dole obszaru (u góry są narzędzia podglądu: Całość, 1:1, zoom) */
.busy-t { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: var(--r-sm); background: var(--label-bg); color: var(--label-text);
  border: 1px solid var(--border); font: 500 12px/1.3 var(--font); white-space: nowrap; box-shadow: var(--shadow); }
.busy-t:empty { display: none; }
@keyframes busy-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .busy.on { transition: opacity 1ms linear var(--busy-delay); }
  .busy-bar::after { animation: none; width: 100%; opacity: .55; background: var(--primary); }
}
/* karta wczytywana pierwszy raz (pages.js showLazy → .page-loading): ten sam pasek u góry karty, też po 300 ms */
.page-loading::before { content: ''; display: block; position: sticky; top: 0; height: var(--busy-h);
  margin-bottom: calc(-1 * var(--busy-h)); z-index: 30;
  background: linear-gradient(90deg, transparent, var(--primary), transparent) 0 0 / 40% 100% no-repeat,
    color-mix(in srgb, var(--primary) 18%, transparent);
  opacity: 0; animation: busy-in var(--dur) var(--ease-out) var(--busy-delay) forwards, busy-slide var(--dur-loop) var(--ease-out) infinite; }
@keyframes busy-in { to { opacity: 1; } }
@keyframes busy-slide { from { background-position: -70% 0, 0 0; } to { background-position: 170% 0, 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .page-loading::before { animation: busy-in 1ms linear var(--busy-delay) forwards; background: var(--primary); opacity: 0; }
}

/* ===== Pętle (pętla wyglądu 9B, DESIGN.md §12) =====
   Pusty stan „oddycha”: obwódka w kolorze akcentu delikatnie pojawia się i znika (--dur-breathe), żeby oko trafiło na jedyną akcję.
   Tylko opacity pseudo-elementu (kompozytor) – płótna i podglądy nie przerysowują się. Mniej ruchu → obwódki brak (stan statyczny). */
.pj-empty, #lw-2d .lw-empty, #kl-2d .kl-empty { position: relative; }
.pj-empty::after, #lw-2d .lw-empty::after, #kl-2d .kl-empty::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 55%, transparent); opacity: 0;
  animation: quba-breathe var(--dur-breathe) ease-in-out infinite; }
#lw-2d .lw-empty::after, #kl-2d .kl-empty::after { inset: -2px; }
@keyframes quba-breathe { 50% { opacity: 1; } }
/* napis wskaźnika pracy oddycha razem z paskiem (DESIGN.md §11) */
.busy.on .busy-t { animation: quba-breathe-text var(--dur-breathe) ease-in-out infinite; }
@keyframes quba-breathe-text { 50% { opacity: .72; } }
@media (prefers-reduced-motion: reduce) {
  .pj-empty::after, #lw-2d .lw-empty::after, #kl-2d .kl-empty::after, .busy.on .busy-t { animation: none; }
}

/* ===== Pusty stan i błąd (pętla wyglądu 9C, DESIGN.md §12): krótki tytuł + jedno zdanie, co zrobić + jeden przycisk ===== */
.es-t { display: block; margin: 0 0 2px; color: var(--text); font-size: 13px; font-weight: 600; }
.gr-empty .es-t, .bk-empty .es-t { margin-bottom: 4px; }
.gr-empty button, .bk-empty button { margin-left: 8px; }
