/* Druk3D – style. Motywy: [data-theme=dark|light] na <html>. Wszystkie kolory przez zmienne. */
:root, [data-theme="dark"] {
  --bg: #14161a; --panel: #1c1f25; --panel2: #23272f; --input: #121418; --line: #2f343e; --line2: #3d4450;
  --text: #e8eaee; --muted: #8d95a3; --accent: #ff8a3d; --accent2: #ffb27a; --on-accent: #1a1208;
  --ok: #3ecf8e; --warn: #f5b942; --bad: #ef5b5b; --info: #5aa9ff;
  --soft-accent: rgba(255,138,61,.14); --topbar: rgba(20,22,26,.9); --swatch-line: rgba(255,255,255,.22);
  --shadow: 0 8px 28px rgba(0,0,0,.4); --r: 12px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f4f6; --panel: #ffffff; --panel2: #f0f2f5; --input: #ffffff; --line: #dfe3e8; --line2: #c9cfd7;
  --text: #1b1f26; --muted: #5f6b7a; --accent: #e8691c; --accent2: #b9520f; --on-accent: #ffffff;
  --ok: #15803d; --warn: #a16207; --bad: #dc2626; --info: #1d4ed8;
  --soft-accent: rgba(232,105,28,.1); --topbar: rgba(243,244,246,.92); --swatch-line: rgba(0,0,0,.18);
  --shadow: 0 8px 28px rgba(16,24,40,.14);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; }
body { overflow-x: hidden; }
.hidden { display: none !important; }
a { color: var(--accent2); }
h1 { font-size: 1.3rem; margin: 0; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; }
h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .45rem; font-weight: 600; }
.m0 { margin: 0 !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.err { color: var(--bad); min-height: 1.2em; margin: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; flex-wrap: nowrap !important; }
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txt { color: var(--text); }
.txt-bad { color: var(--bad); } .txt-warn { color: var(--warn); }
.dim { opacity: .55; }

/* ---------- układ ---------- */
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .75rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .55rem; padding: 0 .5rem; min-width: 0; }
.brand.big { font-size: 1.55rem; justify-content: center; }
.logo { background: var(--accent); color: var(--on-accent); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 1rem; flex: none; }
#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
#nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; color: var(--text); text-decoration: none; border-radius: 9px; font-size: .94rem; }
#nav a:hover { background: var(--panel2); }
#nav a.active { background: var(--soft-accent); color: var(--accent2); font-weight: 600; }
#nav .ico { width: 20px; text-align: center; flex: none; }
#nav .badge { margin-left: auto; }
.side-foot { display: flex; flex-direction: column; gap: .35rem; }
.side-foot .btn { justify-content: flex-start; }
main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; padding: .9rem 1.5rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--topbar); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 10; }
.title-wrap { display: flex; align-items: baseline; gap: .8rem; min-width: 0; flex-wrap: wrap; }
.clock { color: var(--muted); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.clock b { color: var(--text); font-weight: 600; }
#topActions { display: flex; gap: .5rem; flex-wrap: wrap; }
#view { padding: 1.25rem 1.5rem 3rem; max-width: 1500px; }
.bottom-nav { display: none; }

/* ---------- karty / siatki ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; min-width: 0; }
.grid { display: grid; gap: 1rem; }
.grid.tight { gap: 0 1.25rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(300px, 430px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.split > * { min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; min-width: 0; }
.kpi .v { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .2rem; overflow-wrap: anywhere; }
.kpi .l { color: var(--muted); font-size: .8rem; }
.kpi.alert .v { color: var(--warn); }
.kpi.bad .v { color: var(--bad); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; min-width: 0; }
.row.between { justify-content: space-between; }
.wrap-gap { row-gap: .6rem; }
.grow { flex: 1; min-width: 60px; }
.stack > * + * { margin-top: .6rem; }
.filters { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px) auto; gap: .5rem; align-items: center; }
.group-head { display: flex; align-items: baseline; gap: .6rem; margin: 1.1rem 0 .55rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.group-head:first-child { margin-top: 0; }
.changelog h3 { color: var(--accent2); font-size: .9rem; text-transform: none; letter-spacing: 0; margin: 1.2rem 0 .4rem; }
.changelog h3:first-of-type { margin-top: 0; }
.changelog ul { margin: 0; padding-left: 1.2rem; line-height: 1.55; }
.changelog li { margin-bottom: .2rem; }
code { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 0 .3rem; font-size: .85em; }
.onboard ol { padding-left: 1.2rem; line-height: 1.7; }

/* ---------- formularze ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--muted); min-width: 0; }
input, select, textarea { background: var(--input); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .55rem .65rem; font: inherit; font-size: .95rem; width: 100%; min-width: 0; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--soft-accent); border-color: var(--accent); }
input[type=color] { padding: 2px 4px; height: 40px; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex: none; margin: 0; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
select.auto { width: auto; }
label.check { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); font-size: .92rem; cursor: pointer; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .full, .fields h3 { grid-column: 1 / -1; }
.fields h3 { margin: .5rem 0 0; }
.fields > label:not(.check) { justify-content: flex-end; }
textarea { min-height: 70px; resize: vertical; }
.seg, .chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.seg button, .chips button, .tabs button { background: var(--input); border: 1px solid var(--line); color: var(--text); padding: .45rem .75rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: .87rem; white-space: nowrap; }
.seg button.on, .chips button.on { background: var(--soft-accent); border-color: var(--accent); color: var(--accent2); font-weight: 600; }
.seg.compact { flex-wrap: nowrap; gap: 0; }
.seg.compact button { border-radius: 0; }
.seg.compact button:first-child { border-radius: 8px 0 0 8px; }
.seg.compact button:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.chips i { font-style: normal; color: var(--muted); font-size: .78rem; margin-left: .15rem; }
.chips.sub button { font-size: .8rem; padding: .3rem .6rem; }
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs.scroll::-webkit-scrollbar { display: none; }
.tabs button { border-radius: 9px; padding: .5rem .9rem; flex: none; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ---------- przyciski ---------- */
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: .55rem .9rem; cursor: pointer; font: inherit; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap; text-decoration: none; min-height: 38px; }
.btn:hover { border-color: var(--line2); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: .3rem .6rem; font-size: .82rem; min-height: 32px; }
.btn.block { display: flex; width: 100%; justify-content: flex-start; white-space: normal; text-align: left; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: .3rem .45rem; border-radius: 6px; min-width: 32px; min-height: 32px; }
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.linkish { background: none; border: none; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.linkish:hover b, .linkish:hover { color: var(--accent2); }
.card-actions { margin-top: auto; padding-top: .2rem; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .45rem; margin-top: .9rem; }
.action-grid .btn { white-space: normal; text-align: center; line-height: 1.25; overflow-wrap: anywhere; }

/* ---------- tabele ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -.3rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .9rem; }
th { color: var(--muted); font-weight: 500; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn { margin-left: .3rem; }
.tbl-spools td:first-child { min-width: 180px; }
.tbl-spools .bar { width: 90px; margin-bottom: .2rem; }
.status-sel { width: auto; min-height: 30px; padding: .2rem .4rem; font-size: .8rem; border-radius: 999px; }
.status-sel.ok { color: var(--ok); } .status-sel.warn { color: var(--warn); } .status-sel.bad { color: var(--bad); } .status-sel.info { color: var(--info); }

/* ---------- drobne elementy ---------- */
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--panel2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge.neutral { background: var(--panel2); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.badge.info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--swatch-line); flex: none; display: inline-block; vertical-align: middle; }
.swatch.sm { width: 15px; height: 15px; border-width: 1.5px; }
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; min-width: 60px; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar.low > i { background: var(--warn); }
.bar.empty > i { background: var(--bad); }
.bar-row { align-items: center; }
.bar-row > span { width: 90px; flex: none; }
.bar-row .bar { flex: 1; }
.notice { display: block; border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; line-height: 1.4; color: var(--text); text-decoration: none; }
.notice.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.notice.bad { background: color-mix(in srgb, var(--bad) 9%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.notice.tip { background: color-mix(in srgb, var(--info) 7%, transparent); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); }
a.notice:hover { filter: brightness(1.1); }
.params { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.param-group { background: var(--panel2); border-radius: 10px; padding: .7rem .85rem; min-width: 0; }
.param-group h4 { margin: 0 0 .45rem; font-size: .76rem; color: var(--accent2); text-transform: uppercase; letter-spacing: .05em; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .22rem 0; font-size: .9rem; min-width: 0; }
.kv > span:first-child { color: var(--muted); flex: none; max-width: 55%; }
.kv > span.ellipsis:first-child { flex: 1; max-width: none; color: var(--text); }
.kv b { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.total { font-size: 1.85rem; font-weight: 750; color: var(--accent2); font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.mat-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px 34px; gap: .4rem; align-items: end; margin-bottom: .4rem; }

/* ---------- magazyn ---------- */
.spools, .models, .places, .profiles, .printers { display: grid; gap: .75rem; }
.spools { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.models { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.places, .profiles, .printers { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
.spool { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem; display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.spool.empty { opacity: .55; }
.spool .head { display: flex; gap: .65rem; align-items: center; background: none; border: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; min-width: 0; }
.spool .head .t { flex: 1; min-width: 0; }
.spool .head .t > b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spool .head .t > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spool .head:hover b { color: var(--accent2); }
.spool .var { color: var(--info); font-weight: 600; }
.dlg-head h2 { flex-wrap: nowrap; align-items: flex-start; }
.dlg-head h2 .swatch { margin-top: .1rem; }
.place, .profile, .printer { display: flex; flex-direction: column; gap: .5rem; }
.slots { display: flex; flex-direction: column; gap: .3rem; margin-top: .2rem; }
.slot { display: flex; align-items: center; gap: .5rem; padding: .4rem .55rem; background: var(--panel2); border-radius: 8px; min-width: 0; }
.slot .linkish { flex: 1; overflow: hidden; }
.slot .linkish > *:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-n { width: 22px; height: 22px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; font-size: .75rem; color: var(--muted); flex: none; }
.chips-static { gap: .3rem; }
.check-list { display: flex; flex-direction: column; gap: .35rem; max-height: 45vh; overflow-y: auto; padding: .3rem; border: 1px solid var(--line); border-radius: 8px; }
.check-list .check { gap: .5rem; padding: .2rem .1rem; }
.scan-video { width: 100%; border-radius: 10px; margin-top: .8rem; background: #000; max-height: 50vh; object-fit: cover; }
.model { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.model .img { aspect-ratio: 4/3; background: var(--panel2) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 2rem; }
.model .body { padding: .75rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: 0; }
.model .files a { overflow-wrap: anywhere; }

/* ---------- zamówienia ---------- */
.orders { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card.order { display: flex; flex-direction: column; gap: .4rem; text-align: left; color: inherit; font: inherit; cursor: pointer; width: 100%; }
.card.order:hover { border-color: var(--line2); }
a.kpi.link { color: inherit; text-decoration: none; }
a.kpi.link:hover { border-color: var(--line2); }
.slicer-row { margin-bottom: .5rem; gap: .8rem; }
.oitem { background: var(--panel2); border-radius: 10px; padding: .65rem .75rem; display: flex; flex-direction: column; gap: .2rem; }
.oitem.done { opacity: .7; }
.st-seg { flex-wrap: wrap; }
.st-seg button { font-size: .8rem; padding: .35rem .6rem; }
.offer-mat { background: var(--panel2); border-radius: 10px; padding: .6rem .7rem; display: flex; flex-direction: column; gap: .45rem; }
.offer-mat .row input:not([type]), .offer-mat .row select { min-width: 0; }
.color-tag { display: inline-flex; align-items: center; gap: .3rem; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .2rem .1rem .45rem; font-size: .8rem; }
.color-tag .icon-btn { min-width: 22px; min-height: 22px; padding: 0; font-size: .75rem; }
.qr-row { display: flex; gap: .8rem; align-items: center; }
.qr-row p { margin: 0; min-width: 0; }
.qr-mini { width: 96px; height: 96px; flex: none; background: #fff; border-radius: 8px; padding: 4px; }
.qr-mini svg { width: 100%; height: 100%; display: block; }
/* drukarki na żywo */
.live-box { margin-bottom: 1rem; }
.live-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.card.live { display: flex; flex-direction: column; gap: .45rem; }
.trays { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; margin-top: .2rem; }
.tray { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .45rem; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: .35rem .5rem; min-width: 0; position: relative; }
.tray .swatch { grid-row: 1 / 3; width: 22px; height: 22px; }
.tray.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--soft-accent); }
.tray.empty { opacity: .5; }
.tray .badge { position: absolute; top: 3px; right: 4px; }
.cam { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16/9; object-fit: contain; }
.ha-map { background: var(--panel2); border-radius: 10px; padding: .6rem .7rem; display: flex; flex-direction: column; gap: .45rem; }
pre.dbg { max-height: 50vh; overflow: auto; background: var(--input); border: 1px solid var(--line); border-radius: 8px; padding: .7rem; font-size: .75rem; white-space: pre-wrap; word-break: break-all; }

/* kalendarz */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 1rem; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: .45rem .5rem; font-size: .76rem; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--line); }
.day { min-height: 108px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.day:nth-child(7n) { border-right: none; }
.day.other { background: color-mix(in srgb, var(--bg) 50%, transparent); }
.day.other .dnum { opacity: .45; }
.day.today .dnum { background: var(--accent); color: var(--on-accent); }
.day.drop { outline: 2px dashed var(--accent); outline-offset: -3px; }
.dnum { font-size: .8rem; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-title { min-width: 150px; text-align: center; text-transform: capitalize; }
.ev { font-size: .74rem; padding: .15rem .4rem; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-left: 3px solid; background: var(--panel2); }
.ev[draggable="true"] { cursor: grab; }
.ev.done { opacity: .5; text-decoration: line-through; }
.ev.late { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.ev-deadline { border-color: var(--accent); } .ev-print { border-color: var(--info); } .ev-wish { border-color: var(--muted); border-left-style: dashed; } .ev-maint { border-color: var(--warn); }
.ev-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.ev-dot.ev-deadline { background: var(--accent); } .ev-dot.ev-print { background: var(--info); } .ev-dot.ev-wish { background: transparent; border: 2px dashed var(--muted); } .ev-dot.ev-maint { background: var(--warn); }
.agenda { display: flex; flex-direction: column; gap: .6rem; }
.agenda-day.past { opacity: .7; }
.ev-row { cursor: pointer; padding: .25rem 0; }
.ev-row:hover .grow { color: var(--accent2); }
.show-s { display: none; }

/* ---------- strona publiczna (zamow.html) ---------- */
body.pub { min-height: 100vh; }
.pub-top { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.pub-wrap { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.pub-hero h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.pub-hero p { margin: 0 0 1.2rem; max-width: 760px; }
.pub-split { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
.pub-sum { position: sticky; top: 4.5rem; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; padding: 1.6rem 1rem; border: 2px dashed var(--line2); border-radius: 12px; text-align: center; cursor: pointer; color: var(--text); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--soft-accent); }
.drop-ico { font-size: 1.6rem; color: var(--accent); }
.pub-item { background: var(--panel2); border-radius: 12px; padding: .75rem .85rem; display: flex; flex-direction: column; gap: .55rem; }
.pub-item .fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.colors { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--swatch-line); cursor: pointer; padding: 0; }
.color-dot.on { outline: 3px solid var(--accent); outline-offset: 2px; }
label.inline { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
label.inline input { width: 90px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.block-btn { width: 100%; margin-top: .8rem; min-height: 46px; font-size: 1rem; }
.center { text-align: center; }
.txt-ok { color: var(--ok); }
.pub-status { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: .7rem; }
.pub-status h1 { font-size: 1.4rem; }
.timeline { list-style: none; padding: 0; margin: .4rem 0; display: flex; flex-direction: column; gap: .4rem; }
.timeline li { display: flex; align-items: center; gap: .6rem; color: var(--muted); }
.timeline li span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line2); flex: none; }
.timeline li.done { color: var(--text); } .timeline li.done span { background: var(--ok); border-color: var(--ok); }
.timeline li.now { color: var(--accent2); font-weight: 600; } .timeline li.now span { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--soft-accent); }

/* ---------- okna ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(620px, calc(100vw - 1.5rem)); max-width: none; box-shadow: var(--shadow); }
dialog.wide { width: min(820px, calc(100vw - 1.5rem)); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog form { padding: 1.1rem 1.2rem 1.2rem; max-height: min(88vh, 88dvh); overflow-y: auto; overscroll-behavior: contain; }
.dlg-head { position: sticky; top: -1.1rem; background: var(--panel); margin: -1.1rem -1.2rem .6rem; padding: 1rem 1.2rem .5rem; z-index: 2; flex-wrap: nowrap; }
.dlg-head h2 { margin: 0; flex: 1; }
dialog .foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.more-item { display: flex; align-items: center; gap: .6rem; padding: .75rem .8rem; background: var(--panel2); border-radius: 10px; color: var(--text); text-decoration: none; font-size: .92rem; min-width: 0; }
.more-item.active { background: var(--soft-accent); color: var(--accent2); }
.more-item .badge { margin-left: auto; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(200%); background: var(--panel2); color: var(--text); border: 1px solid var(--line); padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); transition: transform .25s; z-index: 1000; max-width: calc(100vw - 2rem); }
.toast:not(.show) { visibility: hidden; transition: transform .25s, visibility 0s .25s; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad { border-color: var(--bad); }

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; width: min(380px, 100%); display: flex; flex-direction: column; gap: .9rem; text-align: center; }
.login-card label { text-align: left; }

/* ---------- etykiety (druk) ---------- */
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  #printArea { display: block; font-family: Arial, sans-serif; color: #000; }
  #printArea * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lbl { box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; page-break-inside: avoid; break-inside: avoid; }
  .print-label .lbl { width: 50mm; height: 30mm; padding: 1.5mm 2mm; page-break-after: always; break-after: page; }
  .print-a4 { display: grid !important; grid-template-columns: repeat(3, 63.5mm); grid-auto-rows: 38.1mm; gap: 0 2.5mm; }
  .print-a4 .lbl { width: 63.5mm; height: 38.1mm; padding: 2.5mm 3mm; }
  .lbl-top { display: flex; gap: 1.5mm; align-items: center; font-size: 7.5pt; line-height: 1.15; }
  .lbl-top b { font-size: 8pt; }
  .lbl-sw { width: 4.5mm; height: 4.5mm; border-radius: 50%; border: .3mm solid #000; flex: none; }
  .lbl-info { font-size: 6pt; }
  .lbl-code svg { width: 100%; height: 8mm; display: block; }
  .print-a4 .lbl-code svg { height: 11mm; }
  .lbl-txt { font-size: 7pt; text-align: center; letter-spacing: .5pt; font-family: monospace; }
  .lbl.lbl-qr { flex-direction: row; justify-content: flex-start; align-items: center; gap: 1.5mm; }
  .lbl-qrbox { flex: none; height: 100%; aspect-ratio: 1; }
  .lbl-qrbox svg { width: 100%; height: 100%; display: block; }
  .lbl-side { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
  .lbl-qr .lbl-top { align-items: flex-start; }
  .lbl-qr .lbl-txt { text-align: left; font-size: 6.5pt; }
  .lbl-side, .lbl-top b, .lbl-top div { overflow-wrap: anywhere; }
  .print-label .lbl.lbl-qr { padding: 1.5mm; gap: 1mm; }
  .print-label .lbl-top { font-size: 5.5pt; gap: 1mm; }
  .print-label .lbl-top b { font-size: 6.5pt; }
  .print-label .lbl-sw { width: 2.8mm; height: 2.8mm; }
  .print-label .lbl-info { font-size: 5pt; }
  .print-label .lbl-qr .lbl-txt { font-size: 5.5pt; }
}

/* ---------- responsywność ---------- */
@media (max-width: 1200px) { .split { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); } }
@media (max-width: 1000px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .hide-m { display: none; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { padding: .7rem 1rem; }
  h1 { font-size: 1.15rem; }
  .clock-date { display: none; }
  #topActions .btn { padding: .4rem .65rem; font-size: .85rem; min-height: 34px; }
  #view { padding: .9rem .8rem calc(5.5rem + env(safe-area-inset-bottom)); }
  .card { padding: .85rem .9rem; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .grid.tight { gap: 0; }
  .fields.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row { grid-template-columns: minmax(0, 1fr) auto; }
  .filter-row > input { grid-column: 1 / -1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -.9rem; padding: 0 .9rem 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .mat-row { grid-template-columns: minmax(0, 1fr) 66px 66px 30px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kpi { padding: .7rem .8rem; }
  .kpi .v { font-size: 1.2rem; }
  .hide-s { display: none; }
  .show-s { display: block; }
  .pub-split { grid-template-columns: minmax(0, 1fr); }
  .pub-sum { position: static; }
  .pub-item .fields.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pub-item .fields.three > label:first-child { grid-column: 1 / -1; }
  .pub-hero h1 { font-size: 1.3rem; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); z-index: 20; }
  .bottom-nav a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .68rem; padding: .35rem .1rem; color: var(--muted); text-decoration: none; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav a.active { color: var(--accent2); }
  .bottom-nav .ico { font-size: 1.15rem; position: relative; line-height: 1.2; }
  .bottom-nav .dot { position: absolute; top: 0; right: -6px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
  .toast { bottom: calc(4.8rem + env(safe-area-inset-bottom)); }
  th, td { padding: .5rem .35rem; }
  dialog, dialog.wide { width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: none; }
  dialog form { max-height: 92dvh; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .dlg-head { top: -1rem; margin: -1rem -1rem .6rem; padding: .9rem 1rem .5rem; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid .btn { white-space: normal; text-align: center; }
  .total { font-size: 1.6rem; }
}
@media (max-width: 380px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .fields.three { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr); }
}
