:root{
  color-scheme: light;
  --bg:#eef3f8;
  --bg-2:#e6edf5;
  --surface:#ffffff;
  --surface-2:#f8fbfe;
  --surface-3:#f2f6fb;
  --text:#122033;
  --muted:#5f738a;
  --muted-2:#7d8fa3;
  --line:#d7e1ec;
  --line-strong:#c5d3e2;
  --accent:#2563eb;
  --accent-2:#1d4ed8;
  --accent-soft:rgba(37,99,235,.10);
  --ok:#16a34a;
  --warn:#d97706;
  --danger:#dc2626;
  --shadow:0 16px 50px rgba(15,23,42,.08);
  --shadow-soft:0 8px 24px rgba(15,23,42,.06);
  --radius:22px;
  --radius-sm:16px;
  --radius-xs:12px;
  --topbar-h:84px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  min-height:100vh;
  color:var(--text);
  font:14px/1.45 Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.08), transparent 28%),
    radial-gradient(circle at top right, rgba(14,165,233,.07), transparent 26%),
    linear-gradient(180deg, #f6f9fc 0%, #edf3f8 100%);
}

::-webkit-scrollbar{width:12px;height:12px}
::-webkit-scrollbar-track{background:rgba(18,32,51,.04)}
::-webkit-scrollbar-thumb{background:rgba(95,115,138,.32);border:2px solid transparent;border-radius:999px;background-clip:padding-box}
::-webkit-scrollbar-thumb:hover{background:rgba(37,99,235,.38);border:2px solid transparent;background-clip:padding-box}

.hidden{display:none!important}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  min-height:var(--topbar-h);
  padding:18px 24px;
  position:sticky;
  top:0;
  z-index:50;
  background:rgba(255,255,255,.86);
  backdrop-filter:blur(18px) saturate(135%);
  border-bottom:1px solid rgba(197,211,226,.85);
  box-shadow:0 1px 0 rgba(255,255,255,.9);
}
.brand{display:flex;gap:16px;align-items:center;min-width:0}
.logo{
  width:48px;
  height:48px;
  border-radius:16px;
  display:grid;
  place-items:center;
  background:linear-gradient(180deg, #eff6ff, #dbeafe);
  border:1px solid #bfdbfe;
  color:var(--accent);
  font-size:21px;
  font-weight:900;
  box-shadow:0 10px 24px rgba(37,99,235,.10);
}
.title{font-weight:900;font-size:20px;letter-spacing:.2px}
.subtitle{color:var(--muted);font-size:12px;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:52vw}
.top-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}

.tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:14px 24px 14px;
  position:sticky;
  top:var(--topbar-h);
  z-index:40;
  background:rgba(246,249,252,.88);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(197,211,226,.9);
}
.tab{
  border:1px solid var(--line);
  background:rgba(255,255,255,.82);
  color:var(--muted);
  padding:10px 15px;
  min-height:42px;
  border-radius:999px;
  cursor:pointer;
  transition:.18s ease;
  font-weight:700;
  letter-spacing:.1px;
  box-shadow:0 2px 6px rgba(15,23,42,.03);
}
.tab:hover{
  transform:translateY(-1px);
  border-color:#bfdbfe;
  color:var(--text);
  background:#fff;
}
.tab.active{
  border-color:#93c5fd;
  background:linear-gradient(180deg,#eff6ff,#dbeafe);
  color:var(--accent-2);
  box-shadow:0 10px 22px rgba(37,99,235,.12);
}

.wrap{padding:22px 24px 34px;max-width:min(1920px,98vw);margin:0 auto}
.view{display:grid;gap:16px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}

@media (min-width: 1280px){
  .grid2{grid-template-columns:minmax(430px,600px) minmax(0,1fr)}
}
@media (max-width: 980px){
  .grid2{grid-template-columns:1fr}
}
@media (min-width: 1650px){
  body{font-size:15px}
  .wrap{padding:24px 28px 38px;max-width:98vw}
}

.card{
  position:relative;
  background:linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,251,254,.98));
  border:1px solid rgba(215,225,236,.95);
  border-radius:24px;
  padding:18px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:4px;
  background:linear-gradient(90deg, #2563eb, #38bdf8 55%, transparent 85%);
  opacity:.9;
  pointer-events:none;
}
.card-h{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:34px;
  margin-bottom:14px;
  font-weight:900;
  font-size:18px;
  letter-spacing:.1px;
}
.card-h + .toolbar{margin-top:-2px}
#prodEditorCard,.circles-learning-card{position:sticky;top:154px}

.row{
  display:grid;
  grid-template-columns:200px minmax(0,1fr);
  align-items:center;
  gap:14px;
  margin:11px 0;
}
label{color:var(--muted);font-weight:700;letter-spacing:.1px}

input,select,textarea{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  outline:none;
  font-size:15px;
  min-height:46px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.95);
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .12s ease;
}
input:hover,select:hover,textarea:hover{border-color:#bfd1e3;background:#fcfdff}
input:focus,select:focus,textarea:focus{
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
  background:#fff;
}
input::placeholder,textarea::placeholder{color:var(--muted-2)}
textarea{resize:vertical;min-height:96px}
select{appearance:none;background-image:linear-gradient(45deg,transparent 50%, var(--muted) 50%), linear-gradient(135deg,var(--muted) 50%, transparent 50%);background-position:calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);background-size:6px 6px, 6px 6px;background-repeat:no-repeat;padding-right:34px}

.inline{display:flex;gap:8px;align-items:center;min-width:0;flex-wrap:wrap}
.inline > *{min-width:0}
.hint{color:var(--muted-2);font-size:12px;line-height:1.4}
.small{color:var(--muted);font-size:12px;margin-top:8px;white-space:pre-wrap}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
hr,.hr{border:none;border-top:1px solid var(--line);margin:16px 0}

.btn{
  border:1px solid var(--line-strong);
  background:linear-gradient(180deg,#ffffff,#f5f8fc);
  color:var(--text);
  padding:10px 13px;
  min-height:42px;
  border-radius:13px;
  cursor:pointer;
  font-weight:800;
  letter-spacing:.1px;
  transition:.18s ease;
  box-shadow:0 4px 10px rgba(15,23,42,.04);
}
.btn:hover{transform:translateY(-1px);border-color:#93c5fd;box-shadow:0 12px 24px rgba(37,99,235,.10)}
.btn:active{transform:translateY(0)}
.btn-secondary{background:linear-gradient(180deg,#f8fbfe,#eef4fa)}
.btn-danger{background:linear-gradient(180deg,#fef2f2,#fee2e2);border-color:#fecaca;color:#991b1b}
.btn-small{padding:7px 9px;font-size:12px;min-height:auto}
.actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:14px}

.toolbar{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.toolbar input{max-width:380px}
.toolbar .inline{justify-content:flex-end}

.kpi{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
.kpi > div{
  padding:14px 15px;
  border-radius:18px;
  background:linear-gradient(180deg,#ffffff,#f5f9fd);
  border:1px solid var(--line);
  box-shadow:0 6px 20px rgba(15,23,42,.04);
}
.kpi.slim > div{padding:11px 13px}
.kpi-label{color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.7px;font-weight:800}
.kpi-value{font-weight:900;font-size:24px;line-height:1.15;font-variant-numeric:tabular-nums;color:#0f172a}

.note{
  margin-top:12px;
  padding:12px 14px;
  border-radius:16px;
  border:1px dashed #bfdbfe;
  background:linear-gradient(180deg,#eff6ff,#f8fbff);
  color:#1e3a5f;
}
.note-list{margin:8px 0 0 18px;color:var(--muted);padding-left:14px}
.note-list li{margin:4px 0}
.bullets{margin:0;padding-left:18px}
.bullets li{margin:8px 0}

.table-wrap{
  overflow:auto;
  border-radius:18px;
  border:1px solid var(--line);
  background:#fff;
  max-height:340px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7), 0 8px 24px rgba(15,23,42,.03);
}
#prodTableWrap{max-height:58vh}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:720px;
  background:transparent;
}
.table th,.table td{
  padding:12px 12px;
  border-bottom:1px solid #e8eef5;
  text-align:left;
  vertical-align:middle;
}
.table thead th{
  position:sticky;
  top:0;
  z-index:2;
  color:#42556d;
  font-size:11px;
  font-weight:900;
  letter-spacing:.7px;
  text-transform:uppercase;
  background:linear-gradient(180deg,#f8fbfe,#eef4f9);
  backdrop-filter:blur(8px);
}
.table tbody tr{transition:background .14s ease, transform .14s ease}
.table tbody tr:nth-child(even) td{background:rgba(248,251,254,.72)}
.table tbody tr:hover td{background:#eff6ff}
.table tbody tr:last-child td{border-bottom:none}
.table td{font-variant-numeric:tabular-nums}

.table thead th.sortable{cursor:pointer;user-select:none;white-space:nowrap}
.table thead th.sortable::after{content:" ↕";opacity:.45;font-size:.9em}
.table thead th.sortable.sort-asc::after{content:" ↑";opacity:.9}
.table thead th.sortable.sort-desc::after{content:" ↓";opacity:.9}

.row-selected,
#salesTable tbody tr.is-selected{
  outline:2px solid rgba(37,99,235,.22);
  outline-offset:-2px;
}

.pill{
  display:inline-flex;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
  font-size:12px;
  gap:6px;
  align-items:center;
  font-weight:700;
}
.tag{
  display:inline-flex;
  margin-left:8px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid #dbe4ef;
  background:#f8fbfe;
  font-size:11px;
  letter-spacing:.45px;
  align-items:center;
}
.row-kind-product{background:transparent}
.row-kind-semi{background:rgba(245,158,11,.06)}
.row-kind-semi:hover{background:rgba(245,158,11,.12)}
.row-kind-product:hover{background:rgba(37,99,235,.04)}
.tag-semi{opacity:.9}

.bom-add{display:grid;grid-template-columns:1fr 90px auto;gap:10px;align-items:center;margin:10px 0 12px}
.bom-add select{min-width:0;width:100%}
.bom-add-ops{grid-template-columns:minmax(220px,1fr) 90px 150px auto}
.bom-add-cutplan{grid-template-columns:1fr auto;align-items:start}
.bom-add-cutplanline{grid-template-columns:1fr 120px auto}
#productFormatkiTable td,#productFormatkiTable th,#bomTable td,#bomTable th,#productOpsTable td,#productOpsTable th{white-space:nowrap}
.bomQtyEdit{width:84px}
.chk,.checkline{display:flex;gap:8px;align-items:center;color:var(--text)}
.chk input,.checkline input,.inline-checkbox input{transform:scale(1.05);accent-color:var(--accent)}
.file-input{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}

.errbar{
  position:sticky;
  top:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:12px 14px;
  margin:0 12px 12px;
  border-radius:16px;
  background:#fef2f2;
  border:1px solid #fecaca;
  box-shadow:var(--shadow-soft);
}
.errbar-title{font-weight:900;font-size:13px;opacity:.97;margin-bottom:2px;color:#991b1b}
.errbar-msg{font-size:12px;opacity:.95;white-space:pre-wrap;max-width:900px;color:#7f1d1d}
.errbar-right{display:flex;gap:10px;align-items:center}

#salesTable td,#salesTable th{white-space:nowrap}
#salesTable tbody tr{cursor:pointer}
.sales-details{margin-top:14px;padding-top:12px;border-top:1px solid var(--line)}
.sales-details-body{display:grid;grid-template-columns:1fr 1fr;gap:10px 18px;font-size:14px}
.sales-kv{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:1px dashed #dce5ef}
.sales-kv .k{opacity:.85}
.sales-kv .v{font-variant-numeric:tabular-nums}

#rateTable{table-layout:fixed;min-width:0;width:100%}
#rateTable th:nth-child(1),#rateTable td:nth-child(1){width:78px;white-space:nowrap}
#rateTable th:nth-child(2),#rateTable td:nth-child(2){width:auto}
#rateTable th:nth-child(3),#rateTable td:nth-child(3){width:100px;white-space:nowrap}
#rateTable th:nth-child(4),#rateTable td:nth-child(4){width:88px;white-space:nowrap}
#rateTable td,#rateTable th{padding:8px 10px;vertical-align:middle}
#rateTable input{height:38px;padding:6px 10px}
#rateTable .pill{display:inline-block;min-width:54px;text-align:center}
#rateTable .btn{padding:6px 8px;font-size:12px}
#rateTable .rate-name{font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#rateTable .rate-actions{display:flex;gap:6px;justify-content:flex-end}
#view-ops .table-wrap{overflow-x:hidden;max-height:340px}
#view-ops .grid2{align-items:start}

#productsTable th:nth-child(1),#productsTable td:nth-child(1){width:32%;max-width:32%}
.compact-table .table td,.compact-table .table th{padding:8px 10px}
.cp-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin-top:12px}
.cp-stats .stat{background:linear-gradient(180deg,#ffffff,#f7fafe);border:1px solid var(--line);border-radius:16px;padding:11px 12px;box-shadow:0 6px 16px rgba(15,23,42,.04)}
.cp-stats .stat .k{font-size:12px;color:var(--muted);margin-bottom:6px}
.cp-stats .stat .v{font-size:16px;font-weight:900;color:var(--text)}

.circles-grid{grid-template-columns:minmax(380px,440px) 1fr}
.circles-controls .row{grid-template-columns:180px 1fr}
.circles-table-wrap{max-height:75vh}
.circles-table{min-width:920px;table-layout:fixed}
.circles-table th,.circles-table td{text-align:center;white-space:nowrap}
.circles-table thead th{position:sticky;top:0;z-index:3;background:linear-gradient(180deg,#f8fbfe,#eef4f9)}
.circles-table .sticky-col{position:sticky;left:0;z-index:2;background:#f8fbfe;text-align:left}
.circles-table thead .sticky-col{z-index:4}
.circles-cell{cursor:pointer;position:relative;font-variant-numeric:tabular-nums;padding-top:10px;padding-bottom:40px;min-height:80px;vertical-align:top}
.circles-cell:hover{background:rgba(37,99,235,.10)!important}
.circles-cell .main{display:block;font-weight:900;font-size:14px;line-height:1.15;padding-right:2px}
.circles-cell .sub{display:block;font-size:10px;color:var(--muted);margin-top:3px;line-height:1.15}
.circles-cell.missing .main{color:#dc2626}
.circles-cell .cell-indicators{position:absolute;left:50%;bottom:-4px;transform:translateX(-50%);display:flex;gap:4px;align-items:center;justify-content:center;width:calc(100% - 10px)}
.circles-cell .indicator-badge{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;border-radius:999px;font-size:9px;font-weight:800;letter-spacing:.02em;border:1px solid rgba(148,163,184,.28);background:rgba(15,23,42,.72);color:#cbd5e1;box-shadow:0 1px 2px rgba(15,23,42,.22)}
.circles-cell .indicator-badge.manual{background:rgba(22,163,74,.14);color:#22c55e;border-color:rgba(34,197,94,.35)}
.circles-cell .indicator-badge.learned{background:rgba(37,99,235,.14);color:#60a5fa;border-color:rgba(96,165,250,.35)}
.circles-cell .indicator-badge.model{background:rgba(148,163,184,.12);color:#cbd5e1;border-color:rgba(148,163,184,.25)}
.circles-cell .indicator-badge.ok{background:rgba(22,163,74,.14);color:#22c55e;border-color:rgba(34,197,94,.35)}
.circles-cell .indicator-badge.partial{background:rgba(245,158,11,.14);color:#f59e0b;border-color:rgba(245,158,11,.35)}
.circles-cell .indicator-badge.none{background:rgba(148,163,184,.10);color:#94a3b8;border-color:rgba(148,163,184,.22)}
.circles-cell.manual{background:rgba(22,163,74,.04)}
.circles-cell.learned{background:rgba(37,99,235,.03)}
.circles-tooltip{position:fixed;z-index:9998;pointer-events:none;max-width:340px;padding:10px 12px;border-radius:12px;border:1px solid #bfdbfe;background:rgba(255,255,255,.98);color:var(--text);box-shadow:0 18px 40px rgba(15,23,42,.16);font-size:12px;line-height:1.45}
.circles-tooltip.hidden{display:none}

.modal.hidden{display:none}
.modal{position:fixed;inset:0;z-index:10000}
.modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.34)}
.modal-card{position:relative;z-index:1;width:min(980px,calc(100vw - 24px));max-height:calc(100vh - 24px);margin:12px auto;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:22px;box-shadow:0 28px 70px rgba(15,23,42,.18)}
.modal-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line);position:sticky;top:0;background:rgba(255,255,255,.98)}
.modal-body{padding:16px;display:grid;gap:14px}
.calc-section{border:1px solid #e5edf6;border-radius:16px;padding:12px;background:#f8fbfe}
.calc-section h4{margin:0 0 8px 0;font-size:14px}
.calc-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px 18px}
.calc-row{display:flex;justify-content:space-between;gap:12px;padding:5px 0;border-bottom:1px dashed #e4ebf3}
.calc-row .k{color:var(--muted)}
.calc-formula{padding:10px 12px;border-radius:12px;background:#f8fbfe;border:1px solid #e5edf6;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;white-space:pre-wrap;line-height:1.55}
.calc-impact{display:inline-flex;padding:5px 8px;border-radius:999px;border:1px solid #bfdbfe;background:#eff6ff;color:#1d4ed8}

.inline-checkbox{justify-content:flex-start;gap:10px}
.compact-grid{gap:10px 14px}
.compact-grid .row{grid-template-columns:140px 1fr;margin-bottom:0}
.circles-bench-wrap{max-height:320px}
.circles-quick-controls{margin-bottom:14px}
.circles-quick-controls .compact-grid{grid-template-columns:1fr 1fr;gap:12px 18px}
.circles-quick-controls .row{grid-template-columns:180px 1fr}
.circles-collapsible{margin-top:14px}
.circles-summary{cursor:pointer;list-style:none;font-weight:900;padding:2px 0}
.circles-summary::-webkit-details-marker{display:none}
.circles-summary::after{content:"▾";float:right;opacity:.7;transition:transform .15s ease}
.circles-collapsible:not([open]) .circles-summary::after{transform:rotate(-90deg)}
.circles-collapsible-body{margin-top:12px}
.circles-range-grid{grid-template-columns:1fr 1fr}
.circles-add-row{grid-template-columns:140px 1fr;align-items:start}
.circles-add-row .inline{align-items:center;width:100%}
.circles-add-row .inline input{flex:1}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.chip{border:1px solid #bfdbfe;background:#eff6ff;color:var(--text);padding:8px 10px;border-radius:999px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:.14s ease;font-weight:700}
.chip:hover{background:#dbeafe;transform:translateY(-1px)}
.chip span{opacity:.7;font-weight:900}

.opslist{display:grid;gap:8px}
.oprow{display:grid;grid-template-columns:1fr 110px;gap:8px;align-items:center;padding:8px;border:1px solid var(--line);border-radius:14px;background:#f8fbfe}

@media (max-width: 1100px){
  .circles-grid{grid-template-columns:1fr}
  .circles-learning-card,#prodEditorCard{position:static}
}
@media (max-width: 900px){
  .sales-details-body,.calc-grid,.circles-quick-controls .compact-grid,.circles-range-grid{grid-template-columns:1fr}
  .bom-add-ops{grid-template-columns:1fr}
}
@media (max-width: 720px){
  .topbar{padding:12px 14px;align-items:flex-start;min-height:auto;flex-direction:column}
  .tabs{top:0;padding:12px 14px}
  .subtitle{max-width:100%;white-space:normal}
  .wrap{padding:14px}
  .row,.compact-grid .row,.circles-controls .row,.circles-quick-controls .row,.circles-add-row{grid-template-columns:1fr}
  .kpi{grid-template-columns:1fr}
  .toolbar{align-items:stretch}
  .toolbar input{max-width:none}
  .actions{justify-content:stretch}
  .actions .btn,.toolbar .btn{flex:1}
  .table-wrap{max-height:none}
  .modal-head{flex-direction:column;align-items:flex-start}
}

/* ===== APP SHELL / BASE LAYOUT ===== */
:root{
  --sidebar-w: 248px;
  --header-h: 74px;
  --content-max: none;
}
html,body{height:100%}
body{
  display:block;
  background:
    radial-gradient(circle at 0% 0%, rgba(59,130,246,.07), transparent 24%),
    linear-gradient(180deg,#f5f7fb 0%,#eef2f7 100%);
}

.topbar{
  position:fixed;
  top:0;
  left:var(--sidebar-w);
  right:0;
  z-index:90;
  min-height:var(--header-h);
  height:var(--header-h);
  padding:14px 24px;
  background:rgba(255,255,255,.88);
  border-bottom:1px solid #dde5ef;
  box-shadow:0 1px 0 rgba(15,23,42,.04), 0 10px 30px rgba(15,23,42,.04);
}
.brand .logo{
  width:42px;height:42px;border-radius:14px;font-size:18px;
  background:linear-gradient(180deg,#111827,#1f2937);
  border-color:#111827;color:#fff;box-shadow:none;
}
.title{font-size:18px;letter-spacing:.1px}
.subtitle{font-size:11px;max-width:40vw;color:#75859a}
.top-actions .btn{min-height:38px;padding:9px 12px;border-radius:10px;font-size:13px}
.top-actions .btn:not(.btn-danger){background:#fff}

.tabs{
  position:fixed;
  top:0;
  left:0;
  bottom:0;
  width:var(--sidebar-w);
  z-index:100;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:6px;
  padding:12px 12px 18px;
  background:linear-gradient(180deg,#f8fafc 0%,#f1f5f9 100%);
  border-right:1px solid #dde5ef;
  box-shadow:inset -1px 0 0 rgba(255,255,255,.8);
  overflow:auto;
}
.tabs::before{display:none}
.tab{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  padding:11px 14px;
  min-height:44px;
  border:none;
  border-radius:12px;
  background:transparent;
  box-shadow:none;
  color:#475569;
  font-weight:700;
}
.tab::before{
  width:18px;
  text-align:center;
  opacity:.8;
  font-size:14px;
}
.tab[data-view="calc"]::before{content:'⌘'}
.tab[data-view="products"]::before{content:'▣'}
.tab[data-view="formatki"]::before{content:'◫'}
.tab[data-view="naWymiar"]::before{content:'◧'}
.tab[data-view="sales"]::before{content:'¤'}
.tab[data-view="materials"]::before{content:'◩'}
.tab[data-view="circles"]::before{content:'◌'}
.tab[data-view="rozkroje"]::before{content:'✂'}
.tab[data-view="rates"]::before{content:'％'}
.tab[data-view="ops"]::before{content:'⚙'}
.tab[data-view="measure"]::before{content:'∑'}
.tab[data-view="help"]::before{content:'?'}
.tab:hover{transform:none;background:#eaf0f7;border:none;color:#0f172a}
.tab.active{
  background:#111827;
  color:#fff;
  border:none;
  box-shadow:0 8px 24px rgba(15,23,42,.16);
}

.wrap{
  max-width:none;
  margin:0;
  padding:calc(var(--header-h) + 22px) 22px 24px calc(var(--sidebar-w) + 22px);
}
.view{gap:18px}
.card{
  border-radius:18px;
  border:1px solid #e2e8f0;
  box-shadow:0 1px 2px rgba(15,23,42,.05),0 14px 34px rgba(15,23,42,.05);
  background:#fff;
  padding:18px 18px 16px;
}
.card::before{height:0}
.card-h{
  margin-bottom:16px;
  font-size:16px;
  min-height:auto;
  padding-bottom:12px;
  border-bottom:1px solid #eef2f7;
}
#prodEditorCard,.circles-learning-card,#cutplanEditorCard{top:94px}

.row{grid-template-columns:170px minmax(0,1fr);gap:12px;margin:10px 0}
input,select,textarea{border-radius:10px;min-height:42px;font-size:14px;border-color:#dbe3ee;box-shadow:none}
.btn{border-radius:10px;min-height:40px;padding:9px 12px;box-shadow:none}
.btn-secondary{background:#f8fafc}
.btn-danger{background:#fff1f2}
.toolbar{gap:12px;margin-bottom:16px}
.toolbar .inline{gap:8px}
.kpi > div{border-radius:14px;background:#f8fafc;box-shadow:none}
.kpi-value{font-size:22px}
.note{border-radius:12px;background:#f8fafc;border:1px solid #dbeafe}
.table-wrap{border-radius:14px;border-color:#e2e8f0;box-shadow:none;background:#fff}
.table th,.table td{padding:11px 12px}
.table thead th{background:#f8fafc;color:#64748b;font-size:10.5px}
.table tbody tr:nth-child(even) td{background:#fbfdff}
.table tbody tr:hover td{background:#f1f5f9}

/* Widoki jako prawdziwy panel */
#view-calc .grid2,
#view-sales .grid2,
#view-materials,
#view-rozkroje,
#view-products,
#view-formatki,
#view-measure,
#view-rates,
#view-ops{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(360px,.85fr);
  gap:18px;
  align-items:start;
}
#view-calc .grid2 > :first-child,
#view-sales .grid2 > :first-child,
#view-materials > :first-child,
#view-rozkroje > :first-child,
#view-products > :first-child,
#view-formatki > :first-child,
#view-measure > :first-child,
#view-rates > :first-child,
#view-ops > :first-child{min-width:0}

#view-products > .card:first-child .toolbar,
#view-formatki > .card:first-child .toolbar,
#view-rozkroje > .card:first-child .toolbar{
  position:sticky;
  top:94px;
  z-index:3;
  background:#fff;
  padding-bottom:10px;
  margin-bottom:10px;
  border-bottom:1px solid #eef2f7;
}
#prodTableWrap,
#view-formatki .table-wrap:first-of-type,
#view-rozkroje .table-wrap:first-of-type{max-height:calc(100vh - 220px)}
#prodEditorCard,
#view-formatki > .card:last-child,
#cutplanEditorCard{position:sticky}

#view-materials > .card:last-child,
#view-rates > .grid2:last-child,
#view-ops > .grid2:last-child,
#view-measure > .grid2:last-child,
#view-sales .grid2 > .card:last-child{position:sticky;top:94px}

/* Kółka jako główny dashboard */
#view-circles{
  display:grid;
  grid-template-columns:minmax(0,1.5fr) 390px;
  gap:18px;
  align-items:start;
}
#view-circles > .circles-quick-controls{grid-column:1 / -1}
#view-circles > .card:nth-of-type(2){grid-column:1}
#view-circles > details{grid-column:2}
#view-circles > details:nth-of-type(1){margin-top:0}
#view-circles > details{position:sticky;top:94px}
#view-circles > details + details{top:362px}
#view-circles > details + details + details{top:630px}
#view-circles > details + details + details + details{top:898px}
.circles-quick-controls .compact-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px 16px}
.circles-quick-controls .row{grid-template-columns:140px 1fr}
.circles-table-wrap{max-height:calc(100vh - 220px)}
.circles-collapsible .card-h,
.circles-summary{padding-bottom:0;border-bottom:none;font-size:15px}
.circles-collapsible-body{display:grid;gap:12px}

/* Instrukcja jako czysty panel tekstowy */
#view-help{max-width:1100px}
#view-help .card{padding:22px}
#view-help .module-hero-card{display:none}
.help-manual{display:grid;gap:16px}
.help-intro-card{border-color:rgba(34,197,94,.28)}
.help-lead{max-width:860px;color:var(--muted);line-height:1.65;font-size:15px;margin-top:8px}
.help-rules-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:18px}
.help-rule{display:grid;gap:8px;padding:14px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.04)}
.help-rule b{color:var(--text)}
.help-rule span{color:var(--muted);line-height:1.55}
.help-card h3{margin:0 0 10px;font-size:15px;color:var(--text)}
.help-two-col{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.help-role-kicker{display:inline-flex;align-items:center;width:max-content;max-width:100%;padding:6px 10px;border-radius:999px;background:rgba(59,130,246,.12);border:1px solid rgba(59,130,246,.26);color:#93c5fd;font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.04em;margin-bottom:10px}
.help-note{margin-top:14px;padding:12px 14px;border-left:3px solid rgba(34,197,94,.72);background:rgba(34,197,94,.08);border-radius:10px;color:var(--text);line-height:1.55}
#view-help .bullets{line-height:1.65}
#view-help .bullets li{margin:6px 0}
@media (max-width:900px){
  .help-rules-grid,
  .help-two-col{grid-template-columns:1fr}
}

/* Lepsze grupowanie przycisków */
.top-actions,
.actions,
.toolbar .inline{gap:8px}
.toolbar > input,
.toolbar > .select{min-width:220px}

/* Responsywność */
@media (max-width: 1360px){
  #view-circles,
  #view-products,
  #view-formatki,
  #view-materials,
  #view-rozkroje,
  #view-measure,
  #view-rates,
  #view-ops,
  #view-calc .grid2,
  #view-sales .grid2{grid-template-columns:1fr}
  #view-circles > .card:nth-of-type(2),
  #view-circles > details{grid-column:auto}
  #view-circles > details,
  #view-materials > .card:last-child,
  #view-rates > .grid2:last-child,
  #view-ops > .grid2:last-child,
  #view-measure > .grid2:last-child,
  #view-sales .grid2 > .card:last-child,
  #prodEditorCard,
  #view-formatki > .card:last-child,
  #cutplanEditorCard{position:static}
  .circles-quick-controls .compact-grid{grid-template-columns:1fr 1fr}
}
@media (max-width: 900px){
  :root{--sidebar-w: 100%; --header-h: auto}
  .tabs{
    position:sticky;
    top:0;
    width:auto;
    bottom:auto;
    flex-direction:row;
    flex-wrap:wrap;
    padding:12px;
    gap:8px;
    border-right:none;
    border-bottom:1px solid #dde5ef;
    box-shadow:none;
  }
  .tabs::before{display:none}
  .tab{width:auto}
  .topbar{position:sticky;left:0;height:auto;min-height:auto;padding:12px 14px}
  .wrap{padding:16px}
  .subtitle{max-width:100%;white-space:normal}
}


/* ===== PREMIUM WORKFLOW LAYOUT V2 ===== */
/* Ogólny rytm roboczy */
#view-products,
#view-formatki,
#view-materials,
#view-rozkroje,
#view-circles{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}

/* Produkty / Formatki / Materiały / Rozkroje: lista na górze, edytor pod spodem */
#view-products > .card:first-child,
#view-formatki > .card:first-child,
#view-materials > .card:first-child,
#view-rozkroje > .card:first-child{
  order:1;
}
#view-products > .card:last-child,
#view-formatki > .card:last-child,
#view-materials > .card:last-child,
#view-rozkroje > .card:last-child{
  order:2;
  position:static;
}
#view-products > .card:first-child .toolbar,
#view-formatki > .card:first-child .toolbar,
#view-rozkroje > .card:first-child .toolbar{
  position:static;
  border-bottom:none;
  padding-bottom:0;
  margin-bottom:14px;
}
#prodTableWrap,
#view-formatki .table-wrap:first-of-type,
#view-materials .table-wrap:first-of-type,
#view-rozkroje .table-wrap:first-of-type{
  max-height:56vh;
}
#view-products .table,
#view-formatki .table,
#view-materials .table,
#view-rozkroje .table{
  min-width:1100px;
}
#prodEditorCard .grid2,
#view-formatki > .card:last-child .grid2,
#view-materials > .card:last-child .grid2,
#cutplanEditorCard .grid2{
  grid-template-columns:1fr 1fr;
  align-items:start;
}

/* Sprzedaż: lista pełna szerokość, parametry pod spodem */
#view-sales .grid2{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}
#view-sales .grid2 > .card:first-child{order:2; position:static;}
#view-sales .grid2 > .card:last-child{order:1; position:static;}
#salesTableWrap{max-height:58vh !important;}
#salesTable{min-width:1180px !important;}
#view-sales .sales-details{margin-top:14px;}

/* Materiały: szeroka lista + edytor niżej */
#view-materials > .card:last-child .actions{margin-top:18px;}

/* Kółka: szybkie ustawienia u góry, macierz pełna szerokość, zwijane listy na dole */
#view-circles > .circles-quick-controls{order:1;}
#view-circles > .card:nth-of-type(2){order:2;}
#view-circles > details:nth-of-type(1){order:4;}
#view-circles > details:nth-of-type(2){order:3;}
#view-circles > details:nth-of-type(3){order:5;}
#view-circles > details:nth-of-type(4){order:6;}
#view-circles > .circles-quick-controls .compact-grid{grid-template-columns:1fr 1fr;}
#view-circles > .circles-quick-controls .row{grid-template-columns:160px 1fr;}
#view-circles .circles-table-wrap{max-height:52vh;}
#view-circles > details{position:static; margin-top:0;}
#view-circles > details[open]{box-shadow:0 1px 2px rgba(15,23,42,.05),0 16px 36px rgba(15,23,42,.06);}
.circles-summary{font-size:15px; font-weight:800; padding:4px 0;}
.circles-summary::after{font-size:12px; margin-left:12px;}

/* Rozkroje: mniejsze checkboxy */
.checkline{gap:10px;}
.checkline input[type="checkbox"],
.inline-checkbox input[type="checkbox"],
#view-rozkroje input[type="checkbox"]{
  width:14px;
  height:14px;
  min-height:14px;
  padding:0;
  border-radius:4px;
}

/* Stawki: dwa okna obok siebie na pełnej szerokości */
#view-rates{display:block;}
#view-rates > .grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

/* Operacje: 4 równe okna 2x2 */
#view-ops{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  align-items:start;
}
#view-ops > .grid2{display:contents;}
#view-ops .card{height:100%; min-height:320px;}
#view-ops .table-wrap{max-height:340px; overflow:auto;}

/* Pomiary DXF: czytelniejsza nomenklatura i dwa bloki jeden pod drugim na mniejszych ekranach */
#view-measure{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}
#view-measure > .grid2{display:grid; grid-template-columns:1fr 1fr; gap:18px;}
#view-measure > .grid2 > .card:last-child{position:static;}

/* Responsywność dla nowego układu */
@media (max-width: 1200px){
  #prodEditorCard .grid2,
  #view-formatki > .card:last-child .grid2,
  #view-materials > .card:last-child .grid2,
  #cutplanEditorCard .grid2,
  #view-rates > .grid2,
  #view-ops,
  #view-measure > .grid2{
    grid-template-columns:1fr;
  }
  #view-ops > .grid2{display:block;}
  #view-ops > .grid2 + .grid2{margin-top:18px;}
}
@media (max-width: 900px){
  #view-products .table,
  #view-formatki .table,
  #view-materials .table,
  #view-rozkroje .table,
  #salesTable{min-width:900px !important;}
  #view-circles > .circles-quick-controls .compact-grid{grid-template-columns:1fr;}
}


/* ===== LAYOUT QA FIXES v5 ===== */
/* global safety */
.view > *, .grid2 > *, .toolbar > *, .inline > * { min-width: 0; }
#view-products .card, #view-formatki .card, #view-materials .card, #view-rozkroje .card, #view-sales .card, #view-ops .card, #view-rates .card { overflow: hidden; }

/* 1) KÓŁKA: szybkie ustawienia, potem macierz full width, na dole zwinięte listy */
#view-circles{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:18px;
}
#view-circles > .circles-quick-controls{order:1; grid-column:auto !important;}
#view-circles > .card:nth-of-type(2){order:2; grid-column:auto !important;}
#view-circles > details:nth-of-type(1){order:3;}
#view-circles > details:nth-of-type(2){order:4;}
#view-circles > details:nth-of-type(3){order:5;}
#view-circles > details:nth-of-type(4){order:6;}
#view-circles > details{
  position:static !important;
  grid-column:auto !important;
  margin-top:0;
}
#view-circles .circles-table-wrap{max-height:62vh;}
#view-circles .circles-quick-controls .compact-grid{grid-template-columns:1fr 1fr;}
#view-circles .circles-collapsible:not([open]) .circles-collapsible-body{display:none;}
#view-circles .circles-collapsible{box-shadow:0 1px 2px rgba(15,23,42,.04),0 8px 22px rgba(15,23,42,.04);}

/* 2) PRODUKTY i FORMATKI: lista pełna szerokość, edytor na dół i bez nakładania */
#view-products,
#view-formatki,
#view-materials,
#view-rozkroje{display:grid !important; grid-template-columns:1fr !important; gap:18px;}
#view-products > .card:last-child,
#view-formatki > .card:last-child,
#view-materials > .card:last-child,
#view-rozkroje > .card:last-child,
#cutplanEditorCard,
#prodEditorCard{position:static !important;}
#prodTableWrap,
#view-formatki .table-wrap:first-of-type,
#view-materials .table-wrap:first-of-type,
#view-rozkroje .table-wrap:first-of-type{max-height:58vh !important;}
#prodEditorCard .grid2,
#view-formatki > .card:last-child .grid2,
#view-materials > .card:last-child .grid2,
#cutplanEditorCard .grid2{
  grid-template-columns:1fr !important;
  gap:18px;
}
#prodEditorCard .row,
#view-formatki > .card:last-child .row,
#view-materials > .card:last-child .row,
#cutplanEditorCard .row{grid-template-columns:190px minmax(0,1fr);}
#prodEditorCard .table-wrap,
#cutplanEditorCard .table-wrap{max-height:none;}
#prodEditorCard textarea,
#cutplanEditorCard textarea{max-width:100%;}

/* produkty toolbar ma oddychać */
#view-products > .card:first-child .toolbar,
#view-formatki > .card:first-child .toolbar,
#view-rozkroje > .card:first-child .toolbar{
  display:grid;
  grid-template-columns:minmax(260px,420px) minmax(220px,320px) 1fr;
  align-items:start;
}
#view-products > .card:first-child .toolbar .inline,
#view-formatki > .card:first-child .toolbar .inline,
#view-rozkroje > .card:first-child .toolbar .inline{justify-content:flex-start; flex-wrap:wrap;}

/* 3) SPRZEDAŻ: lista cały ekran, parametry pod spodem */
#view-sales .grid2{display:grid !important; grid-template-columns:1fr !important; gap:18px;}
#view-sales .grid2 > .card:last-child{order:1; position:static !important;}
#view-sales .grid2 > .card:first-child{order:2; position:static !important;}
#salesTableWrap{max-height:60vh !important;}

/* 4) MATERIAŁY */
#matTable{min-width:980px;}

/* 5) ROZKROJE: lista pełna, edytor pod spodem, małe checkboxy */
#cutplanTable{min-width:1180px;}
#cutplanEditorCard .bom-add-cutplan,
#cutplanEditorCard .bom-add-cutplanline{
  grid-template-columns:1fr !important;
  align-items:stretch;
}
#cutplanEditorCard .checkline,
#view-rozkroje .checkline{font-weight:700;}
#view-rozkroje input[type="checkbox"],
#view-rozkroje .inline-checkbox input[type="checkbox"],
#view-rozkroje .checkline input[type="checkbox"]{
  width:13px;
  height:13px;
  min-height:13px;
  margin:0;
}

/* 6) STAWKI */
#view-rates{display:block;}
#view-rates > .grid2{display:grid !important; grid-template-columns:1fr 1fr !important; gap:18px;}
#view-rates > .grid2 > .card{position:static !important;}

/* 7) OPERACJE: 4 równe okna 2x2 */
#view-ops{
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:18px;
  align-items:stretch;
}
#view-ops > .grid2{display:contents !important;}
#view-ops .card{min-height:340px; height:100%; position:static !important;}
#view-ops .row{grid-template-columns:170px minmax(0,1fr);}
#view-ops .table-wrap{max-height:340px; overflow:auto;}

/* 8) POMIARY DXF */
#view-measure{display:block;}
#view-measure > .grid2{display:grid; grid-template-columns:1fr 1fr; gap:18px;}
#view-measure > .grid2 > .card{position:static !important;}

/* safer tables */
#view-products .table,
#view-formatki .table,
#view-materials .table,
#view-rozkroje .table,
#salesTable{min-width:1100px;}

/* responsive */
@media (max-width: 1180px){
  #view-products > .card:first-child .toolbar,
  #view-formatki > .card:first-child .toolbar,
  #view-rozkroje > .card:first-child .toolbar,
  #view-rates > .grid2,
  #view-ops,
  #view-measure > .grid2,
  #view-circles .circles-quick-controls .compact-grid{
    grid-template-columns:1fr !important;
  }
}
@media (max-width: 900px){
  #prodEditorCard .row,
  #view-formatki > .card:last-child .row,
  #view-materials > .card:last-child .row,
  #cutplanEditorCard .row,
  #view-ops .row{grid-template-columns:1fr;}
  #view-products .table,
  #view-formatki .table,
  #view-materials .table,
  #view-rozkroje .table,
  #salesTable,
  #matTable,
  #cutplanTable{min-width:900px;}
}


/* QA: sidebar/tab click safety */
.tabs{isolation:isolate;pointer-events:auto}
.tab{position:relative;z-index:2;pointer-events:auto;cursor:pointer;-webkit-appearance:none;appearance:none}
.wrap,.view,.card{position:relative;z-index:1}
.topbar{z-index:90}
.tabs{z-index:120}

/* hard fix: hidden views must always stay hidden */
.view.hidden,
section.view.hidden,
main .view.hidden,
#view-calc.hidden,
#view-products.hidden,
#view-formatki.hidden,
#view-sales.hidden,
#view-materials.hidden,
#view-circles.hidden,
#view-rozkroje.hidden,
#view-rates.hidden,
#view-ops.hidden,
#view-measure.hidden,
#view-help.hidden{display:none !important;}


/* === v8: produkty — porządek toolbaru i czytelniejsza tabela === */
#view-products > .card:first-child .toolbar{
  display:grid;
  grid-template-columns:minmax(320px,1.4fr) minmax(180px,.7fr);
  gap:12px 14px;
  align-items:center;
}
#view-products > .card:first-child .toolbar > input{
  max-width:none;
  width:100%;
}
#view-products > .card:first-child .toolbar > select{
  width:100%;
  min-width:0;
}
#view-products > .card:first-child .toolbar > .inline{
  grid-column:1 / -1;
  display:grid;
  grid-template-columns:repeat(5, minmax(0,1fr));
  gap:10px;
  justify-content:stretch;
}
#view-products > .card:first-child .toolbar > .inline .btn{
  width:100%;
  min-width:0;
  white-space:nowrap;
  padding-inline:10px;
}
#prodTableWrap{
  max-height:560px;
  border-radius:16px;
}
#prodTable{
  min-width:0;
  width:100%;
  table-layout:fixed;
  font-size:14px;
}
#prodTable thead th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f8fbff;
  font-size:11px;
  letter-spacing:.4px;
  text-transform:uppercase;
  color:#64748b;
  white-space:nowrap;
  padding:11px 10px;
}
#prodTable td{
  padding:12px 10px;
  vertical-align:middle;
  font-variant-numeric:tabular-nums;
}
#prodTable tbody tr:nth-child(even) td{background:#fbfdff}
#prodTable tbody tr:hover td{background:#eef5ff}
#prodTable th:nth-child(1), #prodTable td:nth-child(1){width:19%}
#prodTable th:nth-child(2), #prodTable td:nth-child(2){width:10%}
#prodTable th:nth-child(3), #prodTable td:nth-child(3){width:8%}
#prodTable th:nth-child(4), #prodTable td:nth-child(4){width:7%}
#prodTable th:nth-child(5), #prodTable td:nth-child(5){width:6%}
#prodTable th:nth-child(6), #prodTable td:nth-child(6){width:8%}
#prodTable th:nth-child(7), #prodTable td:nth-child(7){width:6%}
#prodTable th:nth-child(8), #prodTable td:nth-child(8){width:8%}
#prodTable th:nth-child(9), #prodTable td:nth-child(9){width:6%}
#prodTable th:nth-child(10), #prodTable td:nth-child(10){width:7%}
#prodTable th:nth-child(11), #prodTable td:nth-child(11){width:9%}
#prodTable th:nth-child(n+3):nth-child(-n+11),
#prodTable td:nth-child(n+3):nth-child(-n+11){text-align:center}
#prodTable td:nth-child(1){line-height:1.25}
#prodTable .pill{max-width:100%; white-space:normal; word-break:break-word; line-height:1.15}
#prodTable td small, #prodTable td .small{font-size:12px}

@media (max-width: 1320px){
  #view-products > .card:first-child .toolbar > .inline{
    grid-template-columns:repeat(3, minmax(0,1fr));
  }
}
@media (max-width: 980px){
  #view-products > .card:first-child .toolbar{
    grid-template-columns:1fr;
  }
  #view-products > .card:first-child .toolbar > .inline{
    grid-template-columns:1fr 1fr;
  }
}

/* === v9: produkty — naprawa sekcji BOM / formatki i porządek edytora === */
#prodEditorCard .grid2 > div{min-width:0;}
#prodEditorCard .row{align-items:start;}
#prodEditorCard .row > label{padding-top:10px;}
#prodEditorCard .row > .inline{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  width:100%;
  align-items:center;
}
#prodEditorCard .row > .inline .btn{white-space:nowrap;}
#prodEditorCard .hint{min-width:0; line-height:1.4;}
#prodEditorCard .bom-add{
  display:grid;
  grid-template-columns:minmax(0,1fr) 92px auto;
  gap:12px;
  align-items:center;
  width:100%;
  margin:12px 0 14px;
}
#prodEditorCard .bom-add select,
#prodEditorCard .bom-add input{width:100%; min-width:0;}
#prodEditorCard .bom-add .btn{white-space:nowrap;}
#prodEditorCard .kpi.slim{
  grid-template-columns:1fr;
  margin:12px 0 18px;
}
#prodEditorCard .kpi.slim > div{width:100%;}
#prodEditorCard .table-wrap{
  width:100%;
  overflow:auto;
}
#prodEditorCard #productOpsTable,
#prodEditorCard #productFormatkiTable,
#prodEditorCard #bomTable{
  min-width:640px;
}
#prodEditorCard .hr{margin:18px 0;}

@media (max-width: 980px){
  #prodEditorCard .row{grid-template-columns:1fr !important; gap:8px;}
  #prodEditorCard .row > label{padding-top:0;}
  #prodEditorCard .bom-add,
  #prodEditorCard .bom-add-ops{
    grid-template-columns:1fr;
  }
  #prodEditorCard .row > .inline{grid-template-columns:1fr;}
}

/* ===== PREMIUM POLISH v10 ===== */
/* mocniejsze prowadzenie oka */
.card{
  border:1px solid #dde6f0;
  box-shadow:0 1px 2px rgba(15,23,42,.05),0 14px 30px rgba(15,23,42,.045);
}
.card-h{
  position:relative;
  padding-left:14px;
  font-size:17px;
  color:#132238;
}
.card-h::before{
  content:"";
  position:absolute;
  left:0;
  top:2px;
  bottom:14px;
  width:4px;
  border-radius:999px;
  background:linear-gradient(180deg,#2563eb,#60a5fa);
}
.section-note{
  margin:-4px 0 14px;
  padding:10px 12px;
  border-radius:12px;
  background:linear-gradient(180deg,#f8fbff,#f2f7fd);
  border:1px solid #dbe8f6;
  color:#5d728a;
  font-size:12px;
  line-height:1.45;
}
.section-title{
  display:flex;
  align-items:center;
  gap:10px;
  margin:16px 0 6px;
  font-size:13px;
  font-weight:900;
  letter-spacing:.55px;
  text-transform:uppercase;
  color:#334155;
}
.section-title::before{
  content:"";
  width:10px;
  height:10px;
  border-radius:999px;
  background:#dbeafe;
  border:1px solid #93c5fd;
  box-shadow:0 0 0 4px rgba(37,99,235,.08);
}
.section-subnote{
  margin:0 0 10px 20px;
  color:#6b7f95;
  font-size:12px;
  line-height:1.45;
}
.section-divider{
  margin:18px 0 14px;
}
.table-wrap{
  background:linear-gradient(180deg,#ffffff 0%,#fbfdff 100%);
}
.table thead th{
  letter-spacing:.45px;
  color:#607287;
}
.table td{
  color:#132238;
}
.table td:first-child{
  font-weight:700;
}
#prodTable{
  min-width:970px !important;
  table-layout:fixed;
}
#prodTable th,#prodTable td{
  padding:10px 10px;
}
#prodTable thead th{
  font-size:10px;
}
#prodTable th:nth-child(1),#prodTable td:nth-child(1){width:220px;}
#prodTable th:nth-child(2),#prodTable td:nth-child(2){width:110px;}
#prodTable th:nth-child(3),#prodTable td:nth-child(3),
#prodTable th:nth-child(4),#prodTable td:nth-child(4),
#prodTable th:nth-child(5),#prodTable td:nth-child(5),
#prodTable th:nth-child(6),#prodTable td:nth-child(6),
#prodTable th:nth-child(7),#prodTable td:nth-child(7),
#prodTable th:nth-child(8),#prodTable td:nth-child(8),
#prodTable th:nth-child(9),#prodTable td:nth-child(9),
#prodTable th:nth-child(10),#prodTable td:nth-child(10),
#prodTable th:nth-child(11),#prodTable td:nth-child(11){width:88px; white-space:nowrap;}
#prodTable th:nth-child(12),#prodTable td:nth-child(12){width:70px;}
#prodTable td:nth-child(1) .pill{
  max-width:100%;
  white-space:normal;
  line-height:1.2;
}
#prodTable td:nth-child(1),
#prodTable td:nth-child(2){overflow:hidden;text-overflow:ellipsis;}
#prodTableWrap{max-height:54vh !important;}

.products-toolbar{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:10px;
  align-items:stretch;
}
.products-toolbar .toolbar-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.products-filters-row input{flex:1 1 420px;max-width:none;}
.products-filters-row select{flex:0 0 280px;max-width:280px;}
.products-actions-row{
  padding-top:2px;
}
.products-actions-row .btn{
  min-width:0;
}
#view-products > .card:first-child .toolbar.products-toolbar{
  position:static;
  border-bottom:none;
  padding-bottom:0;
  margin-bottom:14px;
}
#view-products .note,
#view-formatki .note,
#view-materials .note,
#view-sales .note,
#view-rates .note,
#view-ops .note,
#view-rozkroje .note{
  border-style:solid;
}
#prodEditorCard{
  scroll-margin-top:96px;
}
#prodEditorCard .grid2{
  gap:20px;
}
#prodEditorCard > .actions{
  padding-top:14px;
  border-top:1px solid #edf2f7;
}
#productOpsTable,
#productFormatkiTable,
#bomTable{
  min-width:860px;
}
#view-formatki .toolbar,
#view-materials .toolbar,
#view-rozkroje .toolbar{
  align-items:flex-start;
}
#view-materials .card:first-child .toolbar{
  justify-content:flex-start;
}
#view-sales .grid2 > .card:last-child .table-wrap{
  max-height:56vh;
}
#view-rates > .grid2 > .card,
#view-ops .card,
#view-materials > .card,
#view-formatki > .card,
#view-rozkroje > .card,
#view-products > .card{
  scroll-margin-top:96px;
}
@media (max-width: 1180px){
  #prodTable{min-width:1050px !important;}
  .products-filters-row select{flex:1 1 220px;max-width:none;}
}
@media (max-width: 780px){
  .products-toolbar .toolbar-row{flex-direction:column;align-items:stretch;}
  #prodTable{min-width:980px !important;}
  .card-h{font-size:16px;}
}


/* === v11: produkty jak kółka / lepsza czytelność === */
body.modal-open{overflow:hidden;}

#view-products{display:grid !important; grid-template-columns:1fr !important; gap:18px;}
#view-products > .card:first-child{order:1;}
#view-products > #productEditorModal{order:2;}
#productEditorModal{position:fixed; inset:var(--header-h) 0 0 var(--sidebar-w); z-index:12000; display:flex; align-items:flex-start; justify-content:center; padding:18px;}
#productEditorModal.hidden{display:none !important;}
#productEditorModal .modal-backdrop{position:absolute; inset:0; background:rgba(15,23,42,.42); backdrop-filter:blur(3px);}
#productEditorModal .modal-card-product{
  position:relative; z-index:1; width:min(1280px, calc(100% - 8px)); max-height:calc(100dvh - var(--header-h) - 36px); margin:0 auto; overflow:auto;
  background:linear-gradient(180deg,#fff,#f8fbff); border:1px solid var(--line-strong); border-radius:24px; box-shadow:0 30px 80px rgba(15,23,42,.24);
}
#productEditorModal .modal-head{padding:18px 22px; border-bottom:1px solid var(--line); background:rgba(255,255,255,.96); backdrop-filter:blur(12px); position:sticky; top:0; z-index:2;}
#productEditorModal .modal-title{font-size:24px; font-weight:900; letter-spacing:-.02em;}
#productEditorModal .modal-subtitle{font-size:13px; color:var(--muted); margin-top:4px;}
#productEditorModal .modal-body{padding:0; display:block;}
#prodEditorCard{border:none !important; box-shadow:none !important; background:transparent !important; padding:22px !important; margin:0 !important;}
#prodEditorCard .card-h{display:none;}
#prodEditorCard .section-note{margin-top:0; margin-bottom:12px; background:linear-gradient(180deg,#f6faff,#eff5ff); border-color:#d5e3ff; color:#4d6480;}
#prodEditorCard .grid2{grid-template-columns:minmax(320px,.92fr) minmax(480px,1.08fr) !important; gap:24px !important; align-items:start;}
#prodEditorCard .grid2 > div{background:#fff; border:1px solid var(--line); border-radius:20px; padding:18px; box-shadow:0 10px 26px rgba(15,23,42,.05);}
#prodEditorCard .section-title{font-size:13px; letter-spacing:.08em; text-transform:uppercase; color:#506784; font-weight:800; margin-bottom:8px;}
#prodEditorCard .section-subnote{margin-bottom:10px; color:var(--muted);}
#prodEditorCard .actions{position:sticky; bottom:0; background:rgba(255,255,255,.96); padding:16px 0 0;}

#view-products > .card:first-child{padding-bottom:18px;}
#view-products > .card:first-child .card-h,
#view-formatki > .card:first-child .card-h{margin-bottom:8px;}
#view-products > .card:first-child .section-note,
#view-formatki > .card:first-child .section-note{margin-bottom:16px;}
.products-toolbar{gap:12px !important;}
.products-filters-row{display:grid !important; grid-template-columns:minmax(320px,1.4fr) minmax(220px,.6fr);}
.products-actions-row{display:flex !important; flex-wrap:wrap; gap:10px; align-items:center;}
.products-actions-row .btn{height:44px; padding:0 16px; border-radius:14px;}
#prodTableWrap{max-height:62vh !important; border-radius:18px; border:1px solid var(--line); box-shadow:inset 0 1px 0 rgba(255,255,255,.7);}
#prodTable{min-width:auto !important; width:100%; table-layout:fixed;}
#prodTable thead th{font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:#5b7087; padding:12px 10px; background:#f7faff;}
#prodTable tbody td{padding:14px 10px; font-size:13px; vertical-align:middle;}
#prodTable th:nth-child(1),#prodTable td:nth-child(1){width:23%;}
#prodTable th:nth-child(2),#prodTable td:nth-child(2){width:10%;}
#prodTable th:nth-child(3),#prodTable td:nth-child(3),
#prodTable th:nth-child(4),#prodTable td:nth-child(4),
#prodTable th:nth-child(5),#prodTable td:nth-child(5),
#prodTable th:nth-child(6),#prodTable td:nth-child(6),
#prodTable th:nth-child(7),#prodTable td:nth-child(7),
#prodTable th:nth-child(8),#prodTable td:nth-child(8),
#prodTable th:nth-child(9),#prodTable td:nth-child(9),
#prodTable th:nth-child(10),#prodTable td:nth-child(10),
#prodTable th:nth-child(11),#prodTable td:nth-child(11){width:7.1%; text-align:center;}
#prodTable th:nth-child(12),#prodTable td:nth-child(12){width:6%; text-align:right;}
#prodTable td:nth-child(n+3):nth-child(-n+11){white-space:nowrap;}
#prodTable td .hint{margin-top:5px; font-size:12px; color:#7a8da2;}
#prodTable .pill{display:inline-flex; max-width:100%;}
#view-products .note{margin-top:14px; background:linear-gradient(180deg,#f9fbfe,#f2f7fd);}

#view-formatki > .card:first-child .toolbar{display:grid !important; grid-template-columns:minmax(320px,1fr) auto; gap:12px; align-items:center;}
#view-formatki > .card:first-child .toolbar > .inline{display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:flex-start;}
#view-formatki > .card:first-child .toolbar > .inline .btn{height:44px; padding:0 16px; border-radius:14px;}

@media (max-width: 1140px){
  #productEditorModal{inset:0 !important; padding:10px;}
  #productEditorModal .modal-card-product{width:min(100vw - 20px, 1100px); margin:0 auto; max-height:calc(100dvh - 20px);}  
  #prodEditorCard .grid2{grid-template-columns:1fr !important;}
  #prodTable{min-width:980px !important; table-layout:auto;}
}
@media (max-width: 820px){
  .products-filters-row{grid-template-columns:1fr !important;}
  #view-formatki > .card:first-child .toolbar{grid-template-columns:1fr !important;}
  #productEditorModal .modal-title{font-size:20px;}
}


/* FINAL QA PASS */
#view-formatki > .card:first-child .toolbar{display:grid !important;grid-template-columns:minmax(320px,1fr) auto !important;gap:12px;align-items:center;}
#view-formatki > .card:first-child .toolbar > .inline{display:flex !important;flex-wrap:nowrap;gap:10px;align-items:center;justify-content:flex-start;}
#view-formatki > .card:first-child .toolbar > .inline .btn{white-space:nowrap;}

#view-products > .card:first-child{order:1;}
#view-products > .card:first-child .card-h{display:flex;align-items:center;justify-content:space-between;}
#view-products > .card:first-child .section-note{margin-bottom:14px;}
#prodTableWrap{max-height:58vh !important;}
#prodTable thead th{white-space:nowrap;}
#prodTable tbody td{line-height:1.35;}

/* Keep product editor visible only in content area, not under sidebar/topbar */
body.modal-open .tabs, body.modal-open .topbar{pointer-events:none;}

@media (max-width: 980px){
  #view-formatki > .card:first-child .toolbar{grid-template-columns:1fr !important;}
  #view-formatki > .card:first-child .toolbar > .inline{flex-wrap:wrap !important;}
}

.tab[data-view="spools"]::before{content:'◎'}
#view-spools{display:grid;gap:16px}
#view-materials #tubeTable .mono,#view-spools .mono{font-size:12px}
#view-spools .kpi .kpi-value{font-size:22px}
@media (min-width: 1280px){
  #view-materials > .card:nth-child(1),
  #view-materials > .card:nth-child(2){grid-column:1 / -1}
}

.row-clickable{cursor:pointer;}
.row-clickable:hover td{background:rgba(15,23,42,.04);}
#materialsEditorModal,
#spoolEditorModal{
  position:fixed;
  inset:var(--header-h) 0 0 var(--sidebar-w);
  z-index:12000;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:18px;
}
#materialsEditorModal.hidden,
#spoolEditorModal.hidden{display:none !important;}
#materialsEditorModal .modal-backdrop,
#spoolEditorModal .modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.42);
  backdrop-filter:blur(3px);
}
#materialsEditorModal .modal-card-product,
#spoolEditorModal .modal-card-product{
  position:relative;
  z-index:1;
  width:min(1280px, calc(100% - 8px));
  max-height:calc(100dvh - var(--header-h) - 36px);
  margin:0 auto;
  overflow:auto;
}
#materialsEditorModal .modal-head,
#spoolEditorModal .modal-head{padding:18px 22px; border-bottom:1px solid var(--line); background:rgba(255,255,255,.96); backdrop-filter:blur(12px); position:sticky; top:0; z-index:2;}
#materialsEditorModal .modal-title,
#spoolEditorModal .modal-title{font-size:24px; font-weight:900; letter-spacing:-.02em;}
#materialsEditorModal .modal-subtitle,
#spoolEditorModal .modal-subtitle{font-size:13px; color:var(--muted); margin-top:4px;}
#materialsEditorModal .modal-body,
#spoolEditorModal .modal-body{padding:0; display:block;}
@media (max-width: 1140px){
  #materialsEditorModal,
  #spoolEditorModal{inset:0 !important; padding:10px;}
  #materialsEditorModal .modal-card-product,
  #spoolEditorModal .modal-card-product{width:min(100vw - 20px, 1100px); margin:0 auto; max-height:calc(100dvh - 20px);} 
}



.tabs-order-tools{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  padding:8px 10px 6px;
  margin:0 2px 4px;
  margin-top:auto;
  order:999;
}
.tabs-order-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.tab-order-icon-btn{
  width:32px;
  height:32px;
  padding:0;
  border-radius:10px;
  border:1px solid #d6dee8;
  background:#fff;
  color:#475569;
  font-size:16px;
  font-weight:800;
  line-height:1;
  cursor:pointer;
  box-shadow:0 1px 2px rgba(15,23,42,.05);
}
.tab-order-icon-btn:hover{
  background:#f8fbff;
  color:#0f172a;
  border-color:#bfd1e4;
}
.tabs.is-order-editing + .tabs-order-tools .tab-order-icon-btn,
.tab-order-icon-btn.is-active{
  background:#0f172a;
  color:#fff;
  border-color:#0f172a;
}
.tabs-order-hint{
  font-size:11px;
  line-height:1.4;
  color:#64748b;
  background:#eef4fb;
  border:1px solid #d8e4f2;
  border-radius:10px;
  padding:8px 10px;
}
.tab .tab-label{
  flex:1;
  min-width:0;
  text-align:left;
}
.tab-order-controls{
  display:flex;
  align-items:center;
  gap:6px;
  margin-left:auto;
}
.tab-order-arrow{
  width:28px;
  height:28px;
  border-radius:9px;
  border:1px solid #d6dee8;
  background:#fff;
  color:#0f172a;
  font-weight:800;
  cursor:pointer;
}
.tab-order-arrow:disabled{
  opacity:.35;
  cursor:not-allowed;
}
.tabs.is-order-editing .tab{
  cursor:grab;
  background:#f8fbff;
  border:1px dashed #c8d6e5;
}
.tabs.is-order-editing .tab.active{
  background:#dbeafe;
  color:#0f172a;
  box-shadow:none;
  border:1px dashed #93c5fd;
}
.tabs.is-order-editing .tab.is-dragging{
  opacity:.55;
}
.tabs.is-order-editing .tab.drop-before{
  box-shadow:inset 0 3px 0 #2563eb;
}
.tabs.is-order-editing .tab.drop-after{
  box-shadow:inset 0 -3px 0 #2563eb;
}
body.tabs-order-editing .topbar,
body.tabs-order-editing .wrap{
  user-select:none;
}


/* modal editors: never let nested two-column grids force content outside card */
#materialsEditorModal .modal-body > .grid2,
#spoolEditorModal .modal-body > .grid2{
  grid-template-columns:minmax(0,1fr) !important;
  gap:18px;
}
#materialsEditorModal .modal-body > .grid2 > .card,
#spoolEditorModal .modal-body > .grid2 > .card{
  min-width:0;
  overflow:visible;
}
#materialsEditorModal .modal-body .card .grid2,
#spoolEditorModal .modal-body .card .grid2{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
  gap:18px;
}
#materialsEditorModal .row,
#spoolEditorModal .row{
  grid-template-columns:170px minmax(0,1fr) !important;
}
#materialsEditorModal input,
#materialsEditorModal select,
#materialsEditorModal textarea,
#spoolEditorModal input,
#spoolEditorModal select,
#spoolEditorModal textarea{
  width:100%;
  min-width:0;
}
@media (max-width: 1380px){
  #materialsEditorModal .modal-body .card .grid2,
  #spoolEditorModal .modal-body .card .grid2{
    grid-template-columns:minmax(0,1fr) !important;
  }
}
@media (max-width: 900px){
  #materialsEditorModal .row,
  #spoolEditorModal .row{
    grid-template-columns:1fr !important;
  }
}


.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;}
.materials-edit-grid{align-items:start;}
.stack-list{display:grid;gap:8px;margin-bottom:8px;}
.spool-line{display:grid;grid-template-columns:minmax(0,1fr) 100px auto auto;gap:8px;align-items:center;width:100%;}
.spool-line select,.spool-line input{width:100%;}
.spool-line-stack{grid-template-columns:1fr;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:18px;background:#fff;}
.spool-line-main{min-width:0;}
.spool-line-label{font-size:12px;color:var(--muted);margin-bottom:6px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;}
.spool-line-fields{display:grid;grid-template-columns:minmax(120px,160px) auto;gap:10px;align-items:end;}
.spool-line-fields-wide{grid-template-columns:minmax(100px,140px) minmax(180px,1fr) auto;}
.spool-mini{display:flex;flex-direction:column;gap:6px;min-width:0;}
.spool-mini span{font-size:12px;color:var(--muted);font-weight:700;}
.spool-mini-grow{min-width:0;}
@media (max-width: 1180px){.grid3{grid-template-columns:1fr;}}
@media (max-width: 900px){.spool-line-fields,.spool-line-fields-wide{grid-template-columns:1fr;}.spool-line-fields .btn,.spool-line-fields-wide .btn{justify-self:start;}}

/* Start page / dashboard */
.dashboard-hero{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.dashboard-hero-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.dashboard-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:16px;
}
.dashboard-tile{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
  text-align:left;
  min-height:170px;
  padding:18px;
  border-radius:22px;
  border:1px solid rgba(197,211,226,.95);
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(242,247,252,.98));
  box-shadow:var(--shadow-soft);
  cursor:pointer;
  transition:.18s ease;
}
.dashboard-tile:hover{
  transform:translateY(-2px);
  border-color:#93c5fd;
  box-shadow:0 18px 30px rgba(37,99,235,.10);
}
.dashboard-tile strong{
  font-size:18px;
  line-height:1.2;
}
.dashboard-tile span:last-child{
  color:var(--muted);
  line-height:1.5;
}
.dashboard-tile-top{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:4px 10px;
  border-radius:999px;
  background:var(--accent-soft);
  color:var(--accent-2);
  font-size:12px;
  font-weight:800;
  letter-spacing:.4px;
  text-transform:uppercase;
}
.tile-primary{
  background:linear-gradient(180deg,#eff6ff,#dbeafe);
  border-color:#bfdbfe;
}
.tile-primary .dashboard-tile-top{
  background:rgba(255,255,255,.75);
}
.btn-toolbar{
  min-height:44px;
  padding:10px 16px;
  border-radius:14px;
}
.top-actions{
  gap:10px;
  padding:6px;
  border:1px solid rgba(197,211,226,.8);
  border-radius:18px;
  background:rgba(255,255,255,.78);
  box-shadow:0 10px 24px rgba(15,23,42,.05);
}
@media (max-width: 900px){
  .dashboard-hero{flex-direction:column;}
  .dashboard-hero-actions{justify-content:flex-start;}
}


/* Materials view cleanup */
#view-materials .table-wrap{overflow-y:auto; overflow-x:hidden;}
#view-materials .table{width:100%;}
#view-materials .card{overflow:hidden;}

/* Materiały: Płyty zawsze jako pierwsza, pełna sekcja u góry */
#view-materials > .card:first-child{
  grid-column:1 / -1;
  order:-10;
}
#view-materials > .card:nth-child(2){order:1}
#view-materials > .card:nth-child(3){order:2}


/* spool cost cards */
.cost-card{background:#f8fbff;border:1px solid #d8e4f3;border-radius:16px;padding:14px 16px}
.cost-card-title{font-weight:800;font-size:13px;letter-spacing:.08em;text-transform:uppercase;color:#5f7896;margin-bottom:10px}
.cost-list{display:grid;gap:8px}
.cost-row{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding:8px 0;border-bottom:1px dashed #dbe5f0}
.cost-row:last-child{border-bottom:0}
.cost-row span{color:#5d728d}
.cost-row strong{text-align:right;color:#16243a}
.cost-row-total{padding-top:10px;margin-top:4px;border-top:1px solid #cfdceb;border-bottom:0}
.cost-sublist{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.cost-chip{background:#fff;border:1px solid #d8e4f3;border-radius:999px;padding:7px 10px;color:#324866;font-size:13px}
.cost-meta{margin-top:10px;color:#4e6784;font-size:13px;line-height:1.45}
.cost-empty{margin-top:10px;color:#7b8fa8;font-size:13px}

/* ===== Header refresh: minimalist premium brand ===== */
.brand-minimal{
  gap:14px;
}
.logo-minimal{
  position:relative;
  width:54px;
  height:54px;
  border-radius:18px;
  background:linear-gradient(180deg,#0f172a 0%,#172033 100%);
  border:1px solid rgba(15,23,42,.94);
  box-shadow:
    0 16px 34px rgba(15,23,42,.18),
    inset 0 1px 0 rgba(255,255,255,.05);
  overflow:hidden;
}
.logo-minimal::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:14px;
  background:radial-gradient(circle at 30% 30%, rgba(96,165,250,.22), transparent 62%);
}
.logo-core,
.logo-ring{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  border-radius:10px;
  border:2px solid rgba(255,255,255,.92);
}
.logo-core{
  width:16px;
  height:16px;
  z-index:2;
}
.logo-ring{
  width:26px;
  height:26px;
  opacity:.72;
  transform:translate(calc(-50% + 5px),calc(-50% + 5px));
}
.brand-copy{
  display:flex;
  align-items:center;
  min-width:0;
}
.title-minimal{
  margin:0;
  font-size:30px;
  font-weight:950;
  letter-spacing:-0.04em;
  color:#0f172a;
  line-height:1;
  text-transform:uppercase;
}
.title-minimal::after{
  content:"";
  display:block;
  width:72px;
  height:3px;
  margin-top:9px;
  border-radius:999px;
  background:linear-gradient(90deg,#0f172a 0%, #2563eb 58%, rgba(37,99,235,0) 100%);
  opacity:.88;
}
.topbar{
  background:rgba(255,255,255,.92);
}
@media (max-width: 900px){
  .logo-minimal{
    width:48px;
    height:48px;
  }
  .title-minimal{
    font-size:24px;
  }
  .title-minimal::after{
    width:56px;
    margin-top:7px;
  }
}


/* materiały: edytory zawsze w pełni widoczne, bez chowania za sidebarem */
#materialEditorModal .modal-card,
#extraMaterialEditorModal .modal-card,
#tubeEditorModal .modal-card{
  width:min(1120px, calc(100vw - 72px));
  margin:24px auto;
}
#materialEditorModal .modal-body,
#extraMaterialEditorModal .modal-body,
#tubeEditorModal .modal-body{
  padding:18px;
}
#materialEditorModal .modal-body .grid2,
#extraMaterialEditorModal .modal-body .grid2,
#tubeEditorModal .modal-body .grid2{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
  gap:18px;
}
#materialEditorModal .row,
#extraMaterialEditorModal .row,
#tubeEditorModal .row{
  grid-template-columns:170px minmax(0,1fr) !important;
}
#materialEditorModal input,
#materialEditorModal select,
#materialEditorModal textarea,
#extraMaterialEditorModal input,
#extraMaterialEditorModal select,
#extraMaterialEditorModal textarea,
#tubeEditorModal input,
#tubeEditorModal select,
#tubeEditorModal textarea{
  width:100%;
  min-width:0;
}
#materialEditorModal .card,
#extraMaterialEditorModal .card,
#tubeEditorModal .card{
  overflow:visible;
}
@media (max-width: 1180px){
  #materialEditorModal .modal-card,
  #extraMaterialEditorModal .modal-card,
  #tubeEditorModal .modal-card{
    width:min(980px, calc(100vw - 32px));
  }
}
@media (max-width: 900px){
  #materialEditorModal .modal-body .grid2,
  #extraMaterialEditorModal .modal-body .grid2,
  #tubeEditorModal .modal-body .grid2,
  #materialEditorModal .row,
  #extraMaterialEditorModal .row,
  #tubeEditorModal .row{
    grid-template-columns:1fr !important;
  }
}

/* === v12: spójne edytory modalne jak kółka/szpule === */
#materialEditorModal,
#extraMaterialEditorModal,
#tubeEditorModal,
#spoolEditorModal,
#productEditorModal,
#circleCalcModal{
  position:fixed;
  inset:var(--header-h) 0 0 var(--sidebar-w);
  z-index:12000;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:18px;
}
#materialEditorModal.hidden,
#extraMaterialEditorModal.hidden,
#tubeEditorModal.hidden,
#spoolEditorModal.hidden,
#productEditorModal.hidden,
#circleCalcModal.hidden{display:none !important;}

#materialEditorModal .modal-backdrop,
#extraMaterialEditorModal .modal-backdrop,
#tubeEditorModal .modal-backdrop,
#spoolEditorModal .modal-backdrop,
#productEditorModal .modal-backdrop,
#circleCalcModal .modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.44);
  backdrop-filter:blur(5px) saturate(120%);
}

#materialEditorModal .modal-card,
#extraMaterialEditorModal .modal-card,
#tubeEditorModal .modal-card,
#spoolEditorModal .modal-card,
#productEditorModal .modal-card,
#circleCalcModal .modal-card{
  position:relative;
  z-index:1;
  width:min(1280px, calc(100% - 8px));
  max-height:calc(100dvh - var(--header-h) - 36px);
  margin:0 auto;
  overflow:auto;
  border:1px solid rgba(197,211,226,.92);
  border-radius:28px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.08), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,249,255,.98));
  box-shadow:0 34px 90px rgba(15,23,42,.24);
}

#materialEditorModal .modal-head,
#extraMaterialEditorModal .modal-head,
#tubeEditorModal .modal-head,
#spoolEditorModal .modal-head,
#productEditorModal .modal-head,
#circleCalcModal .modal-head{
  padding:18px 22px;
  border-bottom:1px solid rgba(215,225,236,.95);
  background:rgba(255,255,255,.90);
  backdrop-filter:blur(14px) saturate(125%);
  position:sticky;
  top:0;
  z-index:2;
}
#materialEditorModal .modal-head::after,
#extraMaterialEditorModal .modal-head::after,
#tubeEditorModal .modal-head::after,
#spoolEditorModal .modal-head::after,
#productEditorModal .modal-head::after,
#circleCalcModal .modal-head::after{
  content:"";
  position:absolute;
  left:22px;
  right:22px;
  bottom:-1px;
  height:3px;
  border-radius:999px;
  background:linear-gradient(90deg, #2563eb, rgba(96,165,250,.85) 28%, transparent 62%);
  opacity:.9;
}

#materialEditorModal .modal-title,
#extraMaterialEditorModal .modal-title,
#tubeEditorModal .modal-title,
#spoolEditorModal .modal-title,
#productEditorModal .modal-title,
#circleCalcModal .modal-title{
  font-size:24px;
  font-weight:900;
  letter-spacing:-.02em;
}
#materialEditorModal .modal-subtitle,
#extraMaterialEditorModal .modal-subtitle,
#tubeEditorModal .modal-subtitle,
#spoolEditorModal .modal-subtitle,
#productEditorModal .modal-subtitle,
#circleCalcModal .modal-subtitle{
  font-size:13px;
  color:var(--muted);
  margin-top:4px;
}

#materialEditorModal .modal-body,
#extraMaterialEditorModal .modal-body,
#tubeEditorModal .modal-body,
#spoolEditorModal .modal-body,
#productEditorModal .modal-body,
#circleCalcModal .modal-body{
  padding:22px;
  display:grid;
  gap:18px;
}

#materialEditorModal .modal-body > .card,
#extraMaterialEditorModal .modal-body > .card,
#tubeEditorModal .modal-body > .card,
#spoolEditorModal .modal-body > .card,
#circleCalcModal .modal-body > .card{
  border-radius:24px;
  border:1px solid rgba(215,225,236,.96);
  background:linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow:0 18px 44px rgba(15,23,42,.08);
  padding:22px;
}
#materialEditorModal .modal-body > .card::before,
#extraMaterialEditorModal .modal-body > .card::before,
#tubeEditorModal .modal-body > .card::before,
#spoolEditorModal .modal-body > .card::before,
#circleCalcModal .modal-body > .card::before{
  height:5px;
  background:linear-gradient(90deg, #2563eb, #60a5fa 32%, transparent 72%);
}

#materialEditorModal .grid2,
#extraMaterialEditorModal .grid2,
#tubeEditorModal .grid2,
#spoolEditorModal .grid2,
#circleCalcModal .grid2{
  grid-template-columns:minmax(320px,1fr) minmax(320px,1fr);
  gap:22px;
  align-items:start;
}
#materialEditorModal .grid2 > div,
#extraMaterialEditorModal .grid2 > div,
#tubeEditorModal .grid2 > div,
#spoolEditorModal .grid2 > div,
#circleCalcModal .grid2 > div{
  background:linear-gradient(180deg,#ffffff,#f7fbff);
  border:1px solid rgba(215,225,236,.92);
  border-radius:20px;
  padding:18px;
  box-shadow:0 10px 26px rgba(15,23,42,.05);
}

#materialEditorModal .row,
#extraMaterialEditorModal .row,
#tubeEditorModal .row,
#spoolEditorModal .row,
#circleCalcModal .row{
  grid-template-columns:170px minmax(0,1fr);
  gap:14px;
  margin:0 0 12px;
}
#materialEditorModal .row:last-child,
#extraMaterialEditorModal .row:last-child,
#tubeEditorModal .row:last-child,
#spoolEditorModal .row:last-child,
#circleCalcModal .row:last-child{margin-bottom:0;}

#materialEditorModal .section-note,
#extraMaterialEditorModal .section-note,
#tubeEditorModal .section-note,
#spoolEditorModal .section-note,
#circleCalcModal .section-note,
#materialEditorModal .note,
#extraMaterialEditorModal .note,
#tubeEditorModal .note,
#spoolEditorModal .note,
#circleCalcModal .note{
  background:linear-gradient(180deg,#f7fbff,#edf5ff);
  border:1px solid #d7e7ff;
  color:#516882;
  border-radius:16px;
  padding:14px 16px;
}

#materialEditorModal .actions,
#extraMaterialEditorModal .actions,
#tubeEditorModal .actions,
#spoolEditorModal .actions,
#circleCalcModal .actions{
  position:sticky;
  bottom:-22px;
  margin:18px -22px -22px;
  padding:16px 22px 18px;
  background:linear-gradient(180deg, rgba(255,255,255,.86), rgba(245,249,255,.97));
  backdrop-filter:blur(12px);
  border-top:1px solid rgba(215,225,236,.92);
}

#circleCalcModal .modal-card{width:min(980px, calc(100% - 8px));}
#circleCalcModal .modal-body > .card{padding:20px;}
#circleCalcModal .table-wrap{border-radius:18px; border:1px solid rgba(215,225,236,.92); overflow:auto;}

@media (max-width: 1140px){
  #materialEditorModal,
  #extraMaterialEditorModal,
  #tubeEditorModal,
  #spoolEditorModal,
  #productEditorModal,
  #circleCalcModal{inset:0 !important; padding:10px;}

  #materialEditorModal .modal-card,
  #extraMaterialEditorModal .modal-card,
  #tubeEditorModal .modal-card,
  #spoolEditorModal .modal-card,
  #productEditorModal .modal-card,
  #circleCalcModal .modal-card{
    width:min(100vw - 20px, 1180px);
    max-height:calc(100dvh - 20px);
  }
}

@media (max-width: 900px){
  #materialEditorModal .grid2,
  #extraMaterialEditorModal .grid2,
  #tubeEditorModal .grid2,
  #spoolEditorModal .grid2,
  #circleCalcModal .grid2{grid-template-columns:1fr;}

  #materialEditorModal .row,
  #extraMaterialEditorModal .row,
  #tubeEditorModal .row,
  #spoolEditorModal .row,
  #circleCalcModal .row{grid-template-columns:1fr;}

  #materialEditorModal .modal-title,
  #extraMaterialEditorModal .modal-title,
  #tubeEditorModal .modal-title,
  #spoolEditorModal .modal-title,
  #productEditorModal .modal-title,
  #circleCalcModal .modal-title{font-size:20px;}
}

#materialEditorModal .modal-body > .card > .card-h,
#extraMaterialEditorModal .modal-body > .card > .card-h,
#tubeEditorModal .modal-body > .card > .card-h,
#spoolEditorModal .modal-body > .card > .card-h,
#productEditorModal .modal-body > .card > .card-h,
#circleCalcModal .modal-body > .card > .card-h{
  display:none;
}

#spoolEditorModal .modal-body > .card > .section-note{
  margin-top:0;
}


.na-layout-grid{display:grid;grid-template-columns:1.05fr 1.2fr;gap:16px;margin-top:16px}

.na-hero-grid{display:grid;grid-template-columns:minmax(360px,1.1fr) minmax(320px,.9fr);gap:18px;align-items:stretch;margin-top:16px}
.na-hero-left{display:flex;flex-direction:column;gap:12px}
.na-search-wrap input{width:100%}
.na-hero-actions{display:flex;flex-wrap:wrap;gap:10px}
.na-hero-right{display:flex}
.na-settings-card{width:100%;border:1px solid rgba(15,23,42,.08);border-radius:18px;padding:14px 16px;background:linear-gradient(180deg,#fbfdff,#f8fafc);box-shadow:0 10px 24px rgba(15,23,42,.04)}
.na-settings-title{font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#64748b;margin-bottom:10px}
.na-settings-grid{display:grid;grid-template-columns:140px 1fr;gap:10px 12px;align-items:end}
.na-field.compact{display:flex;flex-direction:column;gap:6px;min-width:0}
.na-field.compact label{font-size:12px;color:#64748b;font-weight:700}
.na-field.compact input,.na-field.compact select{width:100%;min-width:0}
.na-field.compact.span-2{grid-column:1 / -1}
.na-toolbar-row{justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.na-settings-inline{flex-wrap:wrap;gap:10px 12px}
.na-settings-inline label{font-size:12px;color:var(--muted,#667085)}
.na-ops-wrap{max-height:220px}
.na-summary-grid{grid-template-columns:repeat(6,minmax(120px,1fr));margin-top:14px}
.na-boards-wrap{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px}
.na-board-card{border:1px solid rgba(15,23,42,.08);border-radius:16px;padding:14px;background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.04)}
.na-board-meta{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:10px;font-size:13px}
.na-board-stage{position:relative;border:1px solid rgba(15,23,42,.12);border-radius:14px;background:linear-gradient(180deg,#f8fafc,#eef2f7);overflow:hidden;width:100%;max-width:100%;min-height:220px;box-sizing:border-box}
.na-piece{position:absolute;border:1px solid rgba(15,23,42,.18);border-radius:8px;background:rgba(59,130,246,.12);overflow:hidden;padding:2px;font-size:11px;line-height:1.2;box-sizing:border-box;display:flex;align-items:flex-start;justify-content:center;max-width:100%;max-height:100%}
.na-piece-label{display:block;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.na-piece-dim{display:block;opacity:.78}
.na-empty{padding:18px;border:1px dashed rgba(15,23,42,.18);border-radius:14px;color:#64748b;background:#f8fafc}
.subcard{margin-top:0}
.card-h.small{font-size:14px}
@media (max-width: 1100px){.na-layout-grid{grid-template-columns:1fr}.na-hero-grid{grid-template-columns:1fr}.na-settings-grid{grid-template-columns:1fr}.na-summary-grid{grid-template-columns:repeat(2,minmax(120px,1fr))}}

/* Na wymiar */
.na-library-table,
.na-current-table{min-width:1180px;}
.na-library-table td,
.na-current-table td{vertical-align:middle;}
.na-current-table input[type="number"]{min-width:82px;}
.na-current-table select{min-width:132px;}
.na-current-table .inline{align-items:center;}
.na-editor-grid{gap:18px;}
.na-summary-grid{grid-template-columns:repeat(6,minmax(140px,1fr));margin-top:14px}
.na-boards-wrap{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px}
.na-board-card{border:1px solid rgba(15,23,42,.08);border-radius:16px;padding:14px;background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.04)}
.na-board-meta{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:10px;font-size:13px}
.na-board-stage{position:relative;border:1px solid rgba(15,23,42,.12);border-radius:14px;background:linear-gradient(180deg,#f8fafc,#eef2f7);overflow:hidden;width:100%;max-width:100%;min-height:220px;box-sizing:border-box}
.na-piece{position:absolute;border:1px solid rgba(15,23,42,.18);border-radius:8px;background:rgba(59,130,246,.12);overflow:hidden;padding:2px;font-size:11px;line-height:1.2;box-sizing:border-box;display:flex;align-items:flex-start;justify-content:center;max-width:100%;max-height:100%}
.na-piece-label{display:block;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.na-piece-dim{display:block;opacity:.78}
.na-empty{padding:18px;border:1px dashed rgba(15,23,42,.18);border-radius:14px;color:#64748b;background:#f8fafc}
#naEditorModal{position:fixed;inset:var(--header-h) 0 0 var(--sidebar-w);z-index:12000;display:flex;align-items:flex-start;justify-content:center;padding:18px}
#naEditorModal.hidden{display:none !important}
#naEditorModal .modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.42);backdrop-filter:blur(3px)}
#naEditorModal .modal-card-product{position:relative;z-index:1;width:min(1280px,calc(100% - 8px));max-height:calc(100dvh - var(--header-h) - 36px);margin:0 auto;overflow:auto}
#naEditorModal .modal-head{padding:18px 22px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.96);backdrop-filter:blur(12px);position:sticky;top:0;z-index:2}
#naEditorModal .modal-title{font-size:24px;font-weight:900;letter-spacing:-.02em}
#naEditorModal .modal-subtitle{font-size:13px;color:var(--muted);margin-top:4px}
#naEditorModal .modal-body{padding:0;display:block}
@media (max-width:1100px){.na-summary-grid{grid-template-columns:repeat(2,minmax(120px,1fr))}}
@media (max-width:1140px){#naEditorModal{left:0;padding:12px}#naEditorModal .modal-card-product{width:min(100%,calc(100% - 4px));max-height:calc(100dvh - var(--header-h) - 24px)}}


.btn-toolbar{display:inline-flex;align-items:center;gap:8px;}
.btn-glyph{font-size:14px;line-height:1;display:inline-flex;align-items:center;justify-content:center;}
#view-naWymiar .table-wrap{overflow:auto;}
#view-naWymiar .inline{flex-wrap:wrap;}
#view-naWymiar .btn-small{white-space:nowrap;}

#view-naWymiar .na-lp-cell{width:44px;text-align:center;font-weight:800;color:var(--accent);}
#view-naWymiar .na-dim-inline,#view-naWymiar .na-cut-inline{gap:6px;flex-wrap:nowrap;}
#view-naWymiar .na-rot-check{gap:3px;font-size:11px;font-weight:700;white-space:nowrap;}
#view-naWymiar .na-rot-check .na-rot-box,
#view-naWymiar .na-rot-check input[type="checkbox"]{width:13px;height:13px;transform:scale(.72);transform-origin:center;accent-color:var(--accent);margin:0;}
#view-naWymiar .na-current-table input[type="text"],#view-naWymiar .na-current-table input:not([type]),#view-naWymiar .na-current-table select{max-width:100%;}
#view-naWymiar .na-piece-label{text-align:center;font-size:12px;font-weight:800;display:block;width:100%;}
#view-naWymiar .na-piece-dim{text-align:center;font-size:11px;line-height:1.1;}


#view-naWymiar .na-library-table th,#view-naWymiar .na-library-table td,#view-naWymiar .na-current-table th,#view-naWymiar .na-current-table td{vertical-align:middle;padding:8px 10px;}
#view-naWymiar .na-library-table,#view-naWymiar .na-current-table{table-layout:fixed;width:100%;}
#view-naWymiar .na-library-table th:nth-child(1){width:23%;}
#view-naWymiar .na-library-table th:nth-child(2){width:16%;}
#view-naWymiar .na-library-table th:nth-child(3){width:12%;}
#view-naWymiar .na-library-table th:nth-child(4){width:12%;}
#view-naWymiar .na-library-table th:nth-child(5){width:12%;}
#view-naWymiar .na-library-table th:nth-child(6){width:25%;}
#view-naWymiar .na-current-table th:nth-child(1){width:4%;}
#view-naWymiar .na-current-table th:nth-child(2){width:21%;}
#view-naWymiar .na-current-table th:nth-child(3){width:16%;}
#view-naWymiar .na-current-table th:nth-child(4){width:8%;}
#view-naWymiar .na-current-table th:nth-child(5){width:16%;}
#view-naWymiar .na-current-table th:nth-child(6){width:11%;}
#view-naWymiar .na-current-table th:nth-child(7){width:15%;}
#view-naWymiar .na-current-table th:nth-child(8){width:9%;}
#view-naWymiar .na-current-table input[type="text"],#view-naWymiar .na-current-table input[type="number"],#view-naWymiar .na-current-table select,#view-naWymiar .na-library-table input[type="text"],#view-naWymiar .na-library-table input[type="number"],#view-naWymiar .na-library-table select{width:100%;min-width:0;}
#view-naWymiar .na-cell-stack{display:grid;gap:4px;}
#view-naWymiar .na-dim-grid{display:grid;grid-template-columns:1fr auto 1fr;gap:4px;align-items:center;}
#view-naWymiar .na-dim-grid span{font-weight:800;color:var(--muted);text-align:center;}
#view-naWymiar .na-money-main{font-weight:800;white-space:nowrap;}
#view-naWymiar .na-money-sub{font-size:10px;line-height:1.15;color:var(--muted);margin-top:2px;word-break:break-word;}
#view-naWymiar .na-actions-col{display:flex;gap:6px;flex-wrap:nowrap;align-items:center;justify-content:flex-start;}
#view-naWymiar .na-library-actions{display:flex;gap:6px;flex-wrap:nowrap;align-items:center;justify-content:flex-start;}
#view-naWymiar .na-rot-check-compact{font-size:10px;gap:3px;align-items:center;white-space:nowrap;}
#view-naWymiar .na-rot-check-compact span{display:inline-block;line-height:1;}
#view-naWymiar .na-rot-check .na-rot-box,#view-naWymiar .na-rot-check input[type="checkbox"]{width:11px;height:11px;transform:scale(.6);} 
#view-naWymiar .na-main-input{font-weight:700;}
#view-naWymiar .na-summary-grid{margin-top:12px;}
#view-naWymiar .na-current-table .btn-small,#view-naWymiar .na-library-table .btn-small{padding:7px 10px;font-size:12px;white-space:nowrap;}
#view-naWymiar .na-pos-col{display:grid;gap:4px;}
#view-naWymiar .na-pos-col .na-rot-check{margin-top:1px;}
#view-naWymiar .na-library-table td,#view-naWymiar .na-current-table td{line-height:1.2;}
#view-naWymiar .na-library-table .inline,#view-naWymiar .na-current-table .inline{flex-wrap:nowrap;}
#view-naWymiar .table-wrap{overflow-x:auto;}
@media (max-width: 1280px){
  #view-naWymiar .na-library-table th:nth-child(1){width:25%;}
  #view-naWymiar .na-library-table th:nth-child(6){width:23%;}
  #view-naWymiar .na-current-table th:nth-child(2){width:23%;}
  #view-naWymiar .na-current-table th:nth-child(3){width:17%;}
  #view-naWymiar .na-current-table th:nth-child(5){width:18%;}
}


#cutplanEditorModal{position:fixed; inset:var(--header-h) 0 0 var(--sidebar-w); z-index:12000; display:flex; align-items:flex-start; justify-content:center; padding:18px;}
#cutplanEditorModal.hidden{display:none !important;}
#cutplanEditorModal .modal-backdrop{position:absolute; inset:0; background:rgba(15,23,42,.42); backdrop-filter:blur(3px);}
#cutplanEditorModal .modal-card{position:relative; z-index:1; width:min(1280px, calc(100vw - var(--sidebar-w) - 48px)); max-height:calc(100dvh - var(--header-h) - 36px); overflow:auto; border-radius:24px; box-shadow:0 32px 80px rgba(15,23,42,.20);}
#cutplanEditorModal #cutplanEditorCard{position:static !important; top:auto !important; margin:0; max-height:none; border-radius:24px; border:1px solid var(--line); overflow:hidden;}
#cutplanEditorModal .modal-body{padding:20px 22px 22px;}
#cutplanEditorModal .grid2{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:18px;}
#cutplanEditorModal .row{grid-template-columns:190px minmax(0,1fr);}
#cutplanEditorModal .table-wrap{max-height:none;}
#cutplanEditorModal textarea,#cutplanEditorModal input,#cutplanEditorModal select{max-width:100%;}
@media (max-width: 1100px){#cutplanEditorModal{inset:0 !important; padding:10px;} #cutplanEditorModal .modal-card{width:min(100vw - 20px, 1180px); max-height:calc(100dvh - 20px);} #cutplanEditorModal .grid2{grid-template-columns:1fr;} #cutplanEditorModal .row{grid-template-columns:1fr;}}


.app-gate{
  position:fixed;
  inset:0;
  z-index:5000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(8,12,18,.74);
  backdrop-filter:blur(6px);
}
.app-gate.hidden{ display:none !important; }
.app-gate-card{
  width:min(560px, calc(100vw - 32px));
  background:var(--panel, #fff);
  border:1px solid rgba(0,0,0,.08);
  border-radius:24px;
  box-shadow:0 24px 80px rgba(0,0,0,.28);
  padding:28px;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.app-gate-mark{
  font-size:12px;
  letter-spacing:.22em;
  text-transform:uppercase;
  opacity:.65;
}
.app-gate-title{
  font-size:30px;
  line-height:1.1;
  font-weight:800;
}
.app-gate-text,
.app-gate-note,
.app-gate-meta{
  color:var(--muted, #5f6b7a);
}
.app-gate-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:4px;
}
body.app-locked{
  overflow:hidden;
}


.start-search-card{margin-bottom:18px;}
.start-search-box{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:10px;}
.start-search-input{flex:1 1 520px;min-width:260px;font-size:18px;padding:14px 16px;border-radius:14px;}
.start-search-meta{margin-top:10px;font-size:13px;opacity:.82;}
.start-search-results{margin-top:14px;display:grid;gap:12px;}
.start-search-empty{padding:18px;border:1px dashed rgba(255,255,255,.14);border-radius:16px;opacity:.8;}
.start-search-group{border:1px solid rgba(255,255,255,.08);border-radius:18px;padding:12px 12px 10px;background:rgba(255,255,255,.02);}
.start-search-group-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:10px;}
.start-search-group-title{font-weight:700;}
.start-search-group-count{font-size:12px;opacity:.75;}
.start-search-list{display:grid;gap:8px;}
.start-search-item{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:12px 14px;border-radius:14px;border:1px solid rgba(255,255,255,.07);background:rgba(255,255,255,.03);cursor:pointer;transition:.15s ease;text-align:left;}
.start-search-item:hover{transform:translateY(-1px);border-color:rgba(255,255,255,.18);background:rgba(255,255,255,.05);}
.start-search-main{display:grid;gap:4px;min-width:0;flex:1 1 auto;justify-items:start;text-align:left;}
.start-search-title{font-weight:700;word-break:break-word;text-align:left;}
.start-search-sub{font-size:13px;opacity:.82;word-break:break-word;text-align:left;}
.start-search-price{display:grid;gap:2px;justify-items:end;text-align:right;white-space:nowrap;align-self:center;padding-left:10px;}
.start-search-price-label{font-size:11px;letter-spacing:.04em;text-transform:uppercase;opacity:.66;}
.start-search-price-value{font-weight:800;font-size:14px;}
@media (max-width: 820px){
  .start-search-item{flex-direction:column;align-items:stretch;}
  .start-search-price{justify-items:start;text-align:left;padding-left:0;}
}


/* === v20260319 UI unify / smoother tabs / stronger search === */
.wrap{
  min-height:calc(100vh - var(--header-h));
}
.view{
  align-content:start;
  animation:viewFadeSlide .18s ease;
}
@keyframes viewFadeSlide{
  from{opacity:.18; transform:translateY(8px)}
  to{opacity:1; transform:translateY(0)}
}

/* nazwa zakladki tylko w sidebarze */
.view > .card:first-child > .card-h,
.dashboard-hero .card-h{display:none !important;}
.view > .card:first-child{padding-top:20px;}
.view > .card:first-child .section-note:first-of-type,
.dashboard-hero .section-note:first-of-type{
  margin-top:0;
  font-size:15px;
  line-height:1.6;
  color:#334155;
  background:linear-gradient(180deg,#f8fbff 0%,#f5f8fc 100%);
  border:1px solid #dbe7f5;
  border-radius:16px;
  padding:14px 16px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9);
}

/* wyszukiwarki w zakladkach */
.start-search-input,
.toolbar input,
.na-search-wrap input,
#view-sales .toolbar input,
#view-spools .toolbar input,
#view-calc .start-search-input{
  min-height:46px;
  border-radius:14px;
  border:1px solid #cfdbea;
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
  box-shadow:0 1px 2px rgba(15,23,42,.04), inset 0 1px 0 rgba(255,255,255,.8);
  padding:0 15px;
  transition:border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.start-search-input::placeholder,
.toolbar input::placeholder,
.na-search-wrap input::placeholder,
#view-sales .toolbar input::placeholder,
#view-spools .toolbar input::placeholder{color:#7b8ba1;}
.start-search-input:focus,
.toolbar input:focus,
.na-search-wrap input:focus,
#view-sales .toolbar input:focus,
#view-spools .toolbar input:focus{
  border-color:#94b7ff;
  box-shadow:0 0 0 4px rgba(59,130,246,.11), 0 6px 20px rgba(37,99,235,.08);
  transform:translateY(-1px);
  outline:none;
}

/* przyciski najpierw, wyszukiwarka pod nimi */
#view-products > .card:first-child .products-actions-row{order:1;}
#view-products > .card:first-child .products-filters-row{order:2;}
#view-formatki > .card:first-child .toolbar,
#view-rozkroje > .card:first-child .toolbar,
#view-materials .card:first-child .toolbar,
#view-materials .card:nth-child(2) .toolbar,
#view-materials .card:nth-child(3) .toolbar,
#view-spools > .card:first-child .toolbar,
#view-sales .card:first-child .toolbar{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:12px;
  align-items:start;
}
#view-formatki > .card:first-child .toolbar > .inline,
#view-rozkroje > .card:first-child .toolbar > .inline,
#view-materials .card:first-child .toolbar > .inline,
#view-materials .card:nth-child(2) .toolbar > .inline,
#view-materials .card:nth-child(3) .toolbar > .inline,
#view-spools > .card:first-child .toolbar > .inline,
#view-sales .card:first-child .toolbar > .inline{
  order:1;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
#view-formatki > .card:first-child .toolbar > input,
#view-rozkroje > .card:first-child .toolbar > input,
#view-materials .card:first-child .toolbar > input,
#view-materials .card:nth-child(2) .toolbar > input,
#view-materials .card:nth-child(3) .toolbar > input,
#view-spools > .card:first-child .toolbar > input,
#view-sales .card:first-child .toolbar > input{
  order:2;
  width:100%;
  max-width:none;
}

/* logiczna, spokojna kolejnosc przyciskow */
.toolbar .inline,
.products-actions-row{
  justify-content:flex-start;
}
.toolbar .btn,
.products-actions-row .btn{
  min-height:42px;
  border-radius:13px;
  padding:0 15px;
}

/* mniej skakania na glownej powierzchni */
#view-products,
#view-formatki,
#view-materials,
#view-rozkroje,
#view-spools,
#view-sales,
#view-naWymiar,
#view-circles,
#view-calc{
  min-height:calc(100vh - var(--header-h) - 34px);
}

/* start search results bardziej klikalne */
.start-search-item{
  border-radius:16px;
  border:1px solid #dbe7f4;
  background:linear-gradient(180deg,#fff 0%,#f8fbff 100%);
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.start-search-item:hover{
  transform:translateY(-1px);
  border-color:#b8cef7;
  box-shadow:0 10px 24px rgba(37,99,235,.08);
}

/* === v20260319 modal polish / floating editors === */
.view{
  transition:opacity .18s ease, transform .18s ease, filter .18s ease;
}
.card,
.table-wrap,
.toolbar,
.kpi,
.note,
.hint,
.section-note,
input,
select,
textarea,
.btn{
  transition:background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}
.card:hover,
.table-wrap:hover{
  box-shadow:0 18px 48px rgba(15,23,42,.07);
}

#formatkaEditorModal .modal-backdrop,
#naEditorModal .modal-backdrop,
#cutplanEditorModal .modal-backdrop,
#materialEditorModal .modal-backdrop,
#extraMaterialEditorModal .modal-backdrop,
#tubeEditorModal .modal-backdrop,
#spoolEditorModal .modal-backdrop,
#productEditorModal .modal-backdrop,
#circleCalcModal .modal-backdrop{
  background:rgba(15,23,42,.34);
  backdrop-filter:blur(8px) saturate(125%);
}

#formatkaEditorModal .modal-card,
#naEditorModal .modal-card,
#cutplanEditorModal .modal-card,
#materialEditorModal .modal-card,
#extraMaterialEditorModal .modal-card,
#tubeEditorModal .modal-card,
#spoolEditorModal .modal-card,
#productEditorModal .modal-card,
#circleCalcModal .modal-card{
  width:min(1220px, calc(100% - 24px));
  max-height:calc(100dvh - var(--header-h) - 34px);
  margin:18px auto;
  border-radius:30px;
  border:1px solid rgba(205,218,233,.95);
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.10), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,.99), rgba(246,250,255,.98));
  box-shadow:0 36px 90px rgba(15,23,42,.18), 0 4px 24px rgba(37,99,235,.06);
}

#formatkaEditorModal .modal-head,
#naEditorModal .modal-head,
#cutplanEditorModal .modal-head,
#materialEditorModal .modal-head,
#extraMaterialEditorModal .modal-head,
#tubeEditorModal .modal-head,
#spoolEditorModal .modal-head,
#productEditorModal .modal-head,
#circleCalcModal .modal-head{
  justify-content:space-between;
  align-items:center;
  gap:18px;
  padding:18px 22px;
}

#formatkaEditorModal .modal-subtitle,
#naEditorModal .modal-subtitle,
#cutplanEditorModal .modal-subtitle,
#materialEditorModal .modal-subtitle,
#extraMaterialEditorModal .modal-subtitle,
#tubeEditorModal .modal-subtitle,
#spoolEditorModal .modal-subtitle,
#productEditorModal .modal-subtitle,
#circleCalcModal .modal-subtitle,
.modal .section-note,
.modal .hint[id$='PreviewNote']{
  display:none !important;
}

.modal .card > .card-h:first-child,
.modal #prodEditorCard > .card-h:first-child,
.modal #cutplanEditorCard > .card-h:first-child{
  display:none;
}

.modal .modal-head-actions,
.modal .modal-head .inline{
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.modal .modal-head .btn,
.modal .modal-head-actions .btn{
  min-height:44px;
  border-radius:14px;
  padding:0 16px;
  box-shadow:0 8px 20px rgba(15,23,42,.06);
}

.modal .modal-head .btn:hover,
.modal .modal-head-actions .btn:hover{
  transform:translateY(-1px);
}

.modal .btn .btn-glyph{display:inline-flex; align-items:center; justify-content:center; margin-right:8px; font-size:14px;}

.modal .actions{
  justify-content:space-between;
  padding-top:8px;
}
.modal .actions .btn:last-child{margin-left:auto;}

@media (max-width: 900px){
  #formatkaEditorModal .modal-card,
  #naEditorModal .modal-card,
  #cutplanEditorModal .modal-card,
  #materialEditorModal .modal-card,
  #extraMaterialEditorModal .modal-card,
  #tubeEditorModal .modal-card,
  #spoolEditorModal .modal-card,
  #productEditorModal .modal-card,
  #circleCalcModal .modal-card{
    width:min(100% - 14px, 1000px);
    max-height:calc(100dvh - 14px);
    margin:7px auto;
    border-radius:24px;
  }
  .modal .modal-head{align-items:flex-start;}
}

/* === 20260319 Na wymiar polish === */
#view-naWymiar > .card:first-child{
  padding-top:18px;
}
#view-naWymiar .na-hero-shell{
  display:grid;
  gap:14px;
  margin-top:16px;
}
#view-naWymiar .na-hero-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
#view-naWymiar .na-settings-inline-card{
  border-radius:22px;
  padding:14px 16px 16px;
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
  border:1px solid #d8e3f0;
  box-shadow:0 14px 36px rgba(15,23,42,.05), inset 0 1px 0 rgba(255,255,255,.9);
}
#view-naWymiar .na-settings-inline{
  display:grid;
  grid-template-columns:minmax(320px,1.7fr) minmax(220px,1fr) minmax(140px,.5fr);
  gap:12px;
  align-items:end;
}
#view-naWymiar .na-field.compact{
  min-width:0;
}
#view-naWymiar .na-field.compact label{
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:#66758a;
}
#view-naWymiar .na-field.compact input,
#view-naWymiar .na-field.compact select,
#view-naWymiar .na-search-wrap input{
  min-height:50px;
  border-radius:16px;
  border:1px solid #cedced;
  background:linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);
  box-shadow:0 1px 2px rgba(15,23,42,.05), inset 0 1px 0 rgba(255,255,255,.9);
  padding:0 16px;
}
#view-naWymiar .na-search-wrap-bottom{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid rgba(148,163,184,.16);
}
#view-naWymiar .na-search-wrap-bottom input{
  font-size:16px;
  font-weight:600;
}
#view-naWymiar .na-search-wrap-bottom::before{
  content:"Filtr biblioteki";
  display:block;
  margin-bottom:8px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#64748b;
}
#view-naWymiar .table-wrap + .na-search-wrap-bottom{
  position:relative;
}
#view-naWymiar .note{
  margin-top:10px;
}
@media (max-width: 1100px){
  #view-naWymiar .na-settings-inline{grid-template-columns:1fr;}
}

/* ===== FORMATIX refinements: floating, minimalist, top hubs ===== */
:root{
  --fx-bg-1:#f4f7fb;
  --fx-bg-2:#eef3f9;
  --fx-card:#ffffffcc;
  --fx-line:#d7e2ef;
  --fx-line-strong:#c9d7e8;
  --fx-shadow:0 18px 42px rgba(15,23,42,.08), 0 6px 16px rgba(15,23,42,.04);
  --fx-shadow-soft:0 10px 28px rgba(15,23,42,.05), inset 0 1px 0 rgba(255,255,255,.9);
}
body{
  background:
    radial-gradient(circle at top left, rgba(114,152,255,.10), transparent 26%),
    radial-gradient(circle at top right, rgba(103,193,255,.08), transparent 22%),
    linear-gradient(180deg,var(--fx-bg-1) 0%, var(--fx-bg-2) 100%);
}
.wrap{
  gap:20px;
}
.card,
.table-wrap,
.modal-card,
.kpi,
.dashboard-tile,
.start-search-card,
.na-settings-card,
.start-search-results,
.toolbar,
.toolbar-stack,
.bom-box,
.inline-editor,
.sp-editor,
.settings-box,
.settings-card{
  border-radius:24px;
}
.card{
  background:linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(248,251,255,.92) 100%);
  border:1px solid var(--fx-line);
  box-shadow:var(--fx-shadow-soft);
  backdrop-filter:blur(10px);
}
.card:hover,
.table-wrap:hover,
.kpi:hover,
.dashboard-tile:hover{
  box-shadow:0 20px 48px rgba(15,23,42,.10), 0 8px 20px rgba(15,23,42,.05);
}
.table-wrap{
  border:1px solid var(--fx-line);
  background:linear-gradient(180deg,#fff 0%,#fbfdff 100%);
  box-shadow:var(--fx-shadow-soft);
}
.table thead th{
  position:sticky;
  top:0;
  z-index:1;
  background:linear-gradient(180deg,#f8fbff 0%,#eef4fb 100%);
  border-bottom:1px solid var(--fx-line);
}
.table tbody tr{
  transition:transform .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.table tbody tr:hover{
  background:#f8fbff;
}
.toolbar,
.toolbar-stack{
  padding:0;
  background:transparent;
  border:none;
  box-shadow:none;
  gap:14px;
}
.toolbar input,
.toolbar select,
.start-search-input,
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea{
  border-radius:18px;
  border:1px solid var(--fx-line-strong);
  background:linear-gradient(180deg,#fff 0%,#f8fbff 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.95), 0 5px 14px rgba(15,23,42,.04);
  transition:border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.toolbar input:focus,
.toolbar select:focus,
.start-search-input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus{
  border-color:#88a8ff;
  box-shadow:0 0 0 4px rgba(88,124,255,.12), 0 8px 18px rgba(15,23,42,.06);
  outline:none;
}
.btn{
  border-radius:16px;
  box-shadow:0 6px 16px rgba(15,23,42,.05), inset 0 1px 0 rgba(255,255,255,.85);
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.btn:hover{
  transform:translateY(-1px);
  box-shadow:0 12px 22px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.9);
}
.btn:active{
  transform:translateY(0);
}
.btn[id^="btnSave"]::before,
#btnNaSaveTemplate::before,
#btnNaAddToCurrentFromModal::before,
#btnSalesSave::before,
#btnSaveGlobals::before,
#btnCirclesSave::before,
#btnSpBenchSave::before,
#btnCirBenchSave::before,
#btnCirCncBenchSave::before{
  content:"✓";
  margin-right:8px;
  font-weight:900;
}
.modal{
  backdrop-filter:blur(3px);
}
.modal-card{
  background:linear-gradient(180deg,rgba(255,255,255,.98) 0%,rgba(245,249,255,.96) 100%);
  border:1px solid var(--fx-line);
  box-shadow:0 28px 66px rgba(15,23,42,.14), 0 10px 24px rgba(15,23,42,.08);
}
.modal-head{
  border-bottom:1px solid rgba(201,215,232,.72);
  padding-bottom:14px;
  margin-bottom:16px;
}
.modal-subtitle,
#view-products > .card > .section-note,
#view-formatki > .card > .section-note,
#view-materials .section-note,
#view-sales .section-note,
#view-circles .section-note,
#view-spools .section-note,
#view-rozkroje .section-note,
#view-rates .section-note,
#view-ops .section-note,
#view-measure .section-note,
#view-help .section-note{
  display:none !important;
}
.note{
  color:#6a7a90;
}
.topbar{
  background:linear-gradient(180deg,rgba(255,255,255,.92) 0%,rgba(247,250,255,.88) 100%);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(205,216,231,.8);
}
.top-actions{
  position:relative;
  gap:10px;
}
.legacy-top-action{display:none !important;}
.btn-icon-hub{
  min-width:56px;
  padding:12px 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:linear-gradient(180deg,#ffffff 0%,#f3f8ff 100%);
}
.hub-icon{
  font-size:18px;
  line-height:1;
}
.hub-label{
  font-weight:800;
}
.hub-wrap{position:relative;}
.hub-panel{
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  width:260px;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
  background:linear-gradient(180deg,rgba(255,255,255,.98) 0%,rgba(244,248,255,.98) 100%);
  border:1px solid var(--fx-line);
  border-radius:20px;
  box-shadow:0 24px 56px rgba(15,23,42,.14), 0 10px 22px rgba(15,23,42,.06);
  z-index:60;
}
.hub-panel-title{
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#708199;
  padding:4px 8px 6px;
}
.hub-item{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  text-align:left;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid transparent;
  background:transparent;
  color:#102038;
  font-weight:700;
}
.hub-item:hover{background:#f5f9ff;border-color:#d6e2f0;}
.hub-item.is-disabled,
.hub-item:disabled{opacity:.45; pointer-events:none;}
.hub-item-icon{
  width:28px;
  height:28px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#edf4ff;
  color:#24467d;
  font-size:13px;
  font-weight:900;
  flex:0 0 auto;
}
.top-compact-action .btn-glyph{margin-right:6px;}
#btnRememberKey,
#btnReset{padding-left:14px;padding-right:14px;}

/* Hide in-tab import/export duplicates: operate from top hubs */
#btnExportProductsXls,
#btnExportProductsPriceCsv,
#btnExportProductionCsv,
#btnExportFormatkiCsv,
#btnImportMaterials,
#btnImportTubes,
#btnSpoolsExportCsvSimple,
#btnSpoolsExportCsvFull,
#btnCirclesExportCsvSimple,
#btnCirclesExportCsvFull{
  display:none !important;
}

/* Calmer section rhythm */
.view > .card:first-child{margin-top:6px;}
.card-h{
  font-size:18px;
  letter-spacing:-.02em;
}
#view-calc .section-note{
  max-width:900px;
  color:#55667c;
}
.start-search-card,
.dashboard-hero{
  border-radius:28px;
}
.dashboard-grid{
  gap:16px;
}
.dashboard-tile{
  border:1px solid var(--fx-line);
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
  box-shadow:var(--fx-shadow-soft);
}
.tabs{
  background:linear-gradient(180deg,rgba(248,250,255,.92),rgba(242,246,252,.9));
  border-right:1px solid rgba(205,216,231,.9);
}
.tab{
  border-radius:18px;
  margin:6px 12px;
  transition:transform .14s ease, box-shadow .14s ease, background-color .14s ease;
}
.tab:hover{transform:translateX(1px);}
.tab.active{
  box-shadow:0 14px 28px rgba(10,22,44,.18), inset 0 1px 0 rgba(255,255,255,.16);
}

/* Cleaner editors */
.modal-head-actions{gap:10px;}
.modal-body > .card,
.modal-body .card{
  border-radius:20px;
}

/* Small screens */
@media (max-width: 1180px){
  .hub-label{display:none;}
  .hub-panel{right:auto; left:0; width:min(300px, calc(100vw - 48px));}
}

/* Remove duplicated section names when sidebar already provides context */
#view-products > .card:first-child > .card-h,
#view-formatki > .card:first-child > .card-h,
#view-naWymiar > .card:first-child > .card-h,
#view-sales > .card:first-child > .card-h,
#view-rozkroje > .card:first-child > .card-h,
#view-circles > .card:first-child > .card-h,
#view-spools > .card:first-child > .card-h,
#view-rates > .card:first-child > .card-h,
#view-ops > .card:first-child > .card-h,
#view-measure > .card:first-child > .card-h,
#view-help > .card:first-child > .card-h{
  display:none;
}

/* === 2026-03-20: chirurgiczne poprawki UI / produkty + start + sidebar === */

/* Sidebar: ciaśniej i czyściej */
.tabs{
  gap:4px;
  padding:10px 10px 14px;
}
.tab{
  min-height:40px;
  padding:9px 12px;
  border-radius:11px;
  font-size:13px;
}
.tab::before{
  width:16px;
  font-size:13px;
}
.tabs-order-tools{
  padding:6px 8px 4px;
}

/* Start: usuń górny blok, skup uwagę na wyszukiwarce */
.dashboard-hero{
  display:none !important;
}
#view-calc .start-search-card{
  margin-top:0;
  padding:24px;
  border-radius:22px;
}
#view-calc .start-search-card .card-h{
  display:block !important;
  font-size:20px;
  margin-bottom:12px;
}
#view-calc .start-search-card .card-h::before{
  bottom:10px;
}
#view-calc .start-search-card .section-note{
  font-size:14px;
  line-height:1.55;
  margin-bottom:14px;
}
.start-search-box{
  gap:12px;
  align-items:stretch;
}
.start-search-input{
  min-height:58px;
  font-size:20px;
  padding:0 18px;
  border-radius:18px;
  border:1px solid #bfd1e8;
  box-shadow:0 8px 24px rgba(37,99,235,.08), inset 0 1px 0 rgba(255,255,255,.9);
}
.start-search-input:focus{
  box-shadow:0 0 0 5px rgba(59,130,246,.12), 0 14px 34px rgba(37,99,235,.12);
}
#btnStartSearchClear{
  min-width:132px;
  min-height:58px;
  border-radius:16px;
}
.start-search-meta{
  font-size:14px;
  color:#52657d;
}
.start-search-results{
  margin-top:16px;
}
.start-search-empty{
  padding:22px;
  border:1px dashed #cfe0f3;
  background:linear-gradient(180deg,#fbfdff,#f5f9fe);
  color:#5c7088;
}

/* Produkty: ukryj kopiowanie/duplikowanie w głównych toolbarach */
#btnCopyProduct,
#btnDuplicateFormatka,
#btnDuplicateSpool{
  display:none !important;
}

/* Modal produktu: header z akcjami po prawej */
#productEditorModal .modal-head{
  align-items:center;
}
#productEditorModal .modal-head-actions-product{
  gap:10px;
  flex-wrap:nowrap;
}
#productEditorModal .btn-icon-close{
  width:44px;
  min-width:44px;
  height:44px;
  padding:0;
  border-radius:14px;
  font-size:24px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-shadow:none;
}
#productEditorModal .btn-icon-close:hover{
  transform:none;
  box-shadow:0 10px 22px rgba(220,38,38,.16);
}
#prodEditorCard > .actions{
  justify-content:space-between;
}
#prodEditorCard > .actions .btn:last-child{
  display:none !important;
}

/* Toolbar produktów: tylko najważniejsze rzeczy */
.products-actions-row{
  gap:10px;
}
.products-actions-row .btn{
  border-radius:14px;
}
.products-filters-row{
  gap:12px;
}
.products-filters-row input{
  min-height:52px;
  font-size:17px;
  border-radius:16px;
}
.products-filters-row select{
  min-height:52px;
  border-radius:16px;
}

@media (max-width: 900px){
  #productEditorModal .modal-head-actions-product{
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
  }
  .start-search-input,
  #btnStartSearchClear{
    min-height:52px;
    font-size:17px;
  }
}


/* === 2026-03-20: ujednolicenie edytorów + materiały + ciaśniejszy sidebar === */
:root{--sidebar-w:236px;}
.tabs{gap:2px !important;padding:8px 8px 12px !important;}
.tab{min-height:36px !important;padding:7px 10px !important;font-size:12.5px !important;line-height:1.15;}
.tab::before{width:15px !important;font-size:12px !important;margin-right:8px !important;}
.tab .tab-label{line-height:1.1;}
.tabs-order-tools{padding:4px 6px 2px !important;}

.section-head-inline{display:grid;grid-template-columns:auto minmax(320px,520px);gap:14px;align-items:center;margin-bottom:10px;}
.section-head-inline .card-h{margin-bottom:0 !important;}
.na-search-wrap-inline{margin:0;}
.na-search-wrap-inline input,.materials-search-input{width:100%;min-height:46px;padding:0 16px;border-radius:15px;font-size:15px;border:1px solid #c9d8ea;background:linear-gradient(180deg,#fff,#f8fbff);box-shadow:0 8px 24px rgba(37,99,235,.06);}
.na-search-wrap-inline input:focus,.materials-search-input:focus{box-shadow:0 0 0 4px rgba(59,130,246,.10),0 10px 26px rgba(37,99,235,.10);}
#view-naWymiar .table-wrap + .na-search-wrap-bottom{display:none !important;}

.materials-toolbar{display:grid !important;grid-template-columns:minmax(320px,1fr) auto;gap:12px;align-items:center;}
#view-materials .toolbar .materials-search-input{margin:0;}

#btnDuplicateFormatka,#btnDuplicateSpool,#btnNaDuplicateTemplate,#btnCopyCutplan{display:none !important;}

/* wszystkie edytory: spójny header akcji */
#formatkaEditorModal,#naEditorModal,#materialEditorModal,#extraMaterialEditorModal,#tubeEditorModal,#spoolEditorModal,#cutplanEditorModal{position:fixed;inset:var(--header-h) 0 0 var(--sidebar-w);z-index:12000;display:flex;align-items:flex-start;justify-content:center;padding:18px;}
#formatkaEditorModal.hidden,#naEditorModal.hidden,#materialEditorModal.hidden,#extraMaterialEditorModal.hidden,#tubeEditorModal.hidden,#spoolEditorModal.hidden,#cutplanEditorModal.hidden{display:none !important;}
#formatkaEditorModal .modal-backdrop,#naEditorModal .modal-backdrop,#materialEditorModal .modal-backdrop,#extraMaterialEditorModal .modal-backdrop,#tubeEditorModal .modal-backdrop,#spoolEditorModal .modal-backdrop,#cutplanEditorModal .modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.42);backdrop-filter:blur(3px);}
#formatkaEditorModal .modal-card,#naEditorModal .modal-card,#materialEditorModal .modal-card,#extraMaterialEditorModal .modal-card,#tubeEditorModal .modal-card,#spoolEditorModal .modal-card,#cutplanEditorModal .modal-card{position:relative;z-index:1;width:min(1180px,calc(100vw - var(--sidebar-w) - 48px));max-height:calc(100dvh - var(--header-h) - 36px);overflow:auto;border-radius:24px;box-shadow:0 32px 80px rgba(15,23,42,.20);margin:0 auto;background:#fff;}
#formatkaEditorModal .modal-head,#naEditorModal .modal-head,#materialEditorModal .modal-head,#extraMaterialEditorModal .modal-head,#tubeEditorModal .modal-head,#spoolEditorModal .modal-head,#cutplanEditorModal .modal-head{padding:18px 22px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.96);backdrop-filter:blur(12px);position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:14px;}
#formatkaEditorModal .modal-title,#naEditorModal .modal-title,#materialEditorModal .modal-title,#extraMaterialEditorModal .modal-title,#tubeEditorModal .modal-title,#spoolEditorModal .modal-title,#cutplanEditorModal .modal-title{font-size:24px;font-weight:900;letter-spacing:-.02em;}
#formatkaEditorModal .modal-subtitle,#naEditorModal .modal-subtitle,#materialEditorModal .modal-subtitle,#extraMaterialEditorModal .modal-subtitle,#tubeEditorModal .modal-subtitle,#spoolEditorModal .modal-subtitle,#cutplanEditorModal .modal-subtitle{font-size:13px;color:var(--muted);margin-top:4px;}
#formatkaEditorModal .modal-body,#naEditorModal .modal-body,#materialEditorModal .modal-body,#extraMaterialEditorModal .modal-body,#tubeEditorModal .modal-body,#spoolEditorModal .modal-body,#cutplanEditorModal .modal-body{padding:0;display:block;}
#formatkaEditorModal .modal-body>.card,#naEditorModal .modal-body>.card,#materialEditorModal .modal-body>.card,#extraMaterialEditorModal .modal-body>.card,#tubeEditorModal .modal-body>.card,#spoolEditorModal .modal-body>.card,#cutplanEditorModal .modal-body>.card{border:none !important;box-shadow:none !important;background:transparent !important;padding:22px !important;margin:0 !important;}
#formatkaEditorModal .modal-body>.card>.card-h,#naEditorModal .modal-body>.card>.card-h,#materialEditorModal .modal-body>.card>.card-h,#extraMaterialEditorModal .modal-body>.card>.card-h,#tubeEditorModal .modal-body>.card>.card-h,#spoolEditorModal .modal-body>.card>.card-h,#cutplanEditorModal .modal-body>.card>.card-h{display:none;}
#formatkaEditorModal .actions,#naEditorModal .actions,#materialEditorModal .actions,#extraMaterialEditorModal .actions,#tubeEditorModal .actions,#spoolEditorModal .actions,#cutplanEditorModal .actions{justify-content:space-between;}
#formatkaEditorModal .actions .btn:last-child,#naEditorModal .actions .btn:last-child,#materialEditorModal .actions .btn:last-child,#extraMaterialEditorModal .actions .btn:last-child,#tubeEditorModal .actions .btn:last-child,#spoolEditorModal .actions .btn:last-child,#cutplanEditorModal .actions .btn:last-child{display:none !important;}
.modal-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;}
.btn-icon-close{width:44px;min-width:44px;height:44px;padding:0;border-radius:14px;font-size:24px;line-height:1;display:inline-flex;align-items:center;justify-content:center;box-shadow:none;}
.btn-icon-close:hover{transform:none;box-shadow:0 10px 22px rgba(220,38,38,.16);}
.modal-copy-btn{min-width:0;}

@media (max-width: 980px){
  .section-head-inline,.materials-toolbar{grid-template-columns:1fr !important;}
  #formatkaEditorModal,#naEditorModal,#materialEditorModal,#extraMaterialEditorModal,#tubeEditorModal,#spoolEditorModal,#cutplanEditorModal{inset:0 !important;padding:10px;}
  #formatkaEditorModal .modal-card,#naEditorModal .modal-card,#materialEditorModal .modal-card,#extraMaterialEditorModal .modal-card,#tubeEditorModal .modal-card,#spoolEditorModal .modal-card,#cutplanEditorModal .modal-card{width:min(100vw - 20px, 1100px);max-height:calc(100dvh - 20px);}
  .modal-head-actions{width:100%;justify-content:flex-start;flex-wrap:wrap;}
}


/* === 2026-03-20: trwałość globals + czystszy start + ciaśniejszy sidebar === */
:root{--sidebar-w:228px;}
.tabs{gap:1px !important;padding:6px 6px 10px !important;}
.tab{min-height:34px !important;padding:6px 9px !important;font-size:12px !important;border-radius:10px !important;}
.tab::before{width:14px !important;font-size:11px !important;margin-right:7px !important;}
.tabs-order-tools{padding:3px 5px 2px !important;}

#view-calc .dashboard-grid{display:none !important;}
#view-calc .start-search-card{max-width:1040px;margin:10px auto 0 !important;padding:30px 32px !important;border-radius:28px !important;}
#view-calc .start-search-card .section-note{font-size:13px !important;line-height:1.45 !important;margin-bottom:12px !important;color:#5a6e84 !important;}
#view-calc .start-search-card .card-h{font-size:18px !important;margin-bottom:10px !important;}
.start-search-box{display:grid !important;grid-template-columns:auto minmax(0,1fr) !important;gap:14px !important;align-items:center !important;}
#btnStartSearchClear{order:0;min-width:120px !important;min-height:60px !important;border-radius:999px !important;padding:0 20px !important;}
.start-search-input{order:1;min-height:64px !important;font-size:22px !important;padding:0 24px !important;border-radius:999px !important;border:1px solid #d7e3f1 !important;box-shadow:0 10px 30px rgba(15,23,42,.06) !important;}
.start-search-input::placeholder{font-size:15px;color:#8aa0b8;}
.start-search-meta{font-size:12px !important;margin-top:12px !important;color:#70839a !important;}
.start-search-results{margin-top:18px !important;}
.start-search-empty{padding:18px 20px !important;border-radius:18px !important;font-size:13px !important;}
@media (max-width: 820px){.start-search-box{grid-template-columns:1fr !important;} #btnStartSearchClear,.start-search-input{width:100%;}}

/* Start search premium */
#view-calc .start-search-card{
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%) !important;
  border:1px solid #dbe7f3 !important;
  box-shadow:0 24px 60px rgba(15,23,42,.08) !important;
}
.start-search-results{
  gap:14px !important;
}
.start-search-group{
  border:1px solid #dde7f2 !important;
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%) !important;
  border-radius:22px !important;
  padding:14px !important;
  box-shadow:0 12px 34px rgba(15,23,42,.05) !important;
}
.start-search-group-head{
  margin-bottom:12px !important;
  padding:0 2px !important;
}
.start-search-group-title{
  font-size:13px !important;
  letter-spacing:.08em !important;
  text-transform:uppercase !important;
  color:#56708a !important;
}
.start-search-group-count{
  font-size:12px !important;
  color:#7c92a8 !important;
}
.start-search-list{
  gap:10px !important;
}
.start-search-item{
  align-items:center !important;
  padding:14px 16px !important;
  border-radius:18px !important;
  border:1px solid #e2ebf4 !important;
  background:#ffffff !important;
  box-shadow:0 8px 24px rgba(15,23,42,.04) !important;
}
.start-search-item:hover{
  transform:translateY(-2px) !important;
  border-color:#c6d8ea !important;
  box-shadow:0 16px 30px rgba(15,23,42,.08) !important;
}
.start-search-main{
  gap:5px !important;
  align-items:flex-start !important;
  justify-items:start !important;
  text-align:left !important;
}
.start-search-title{
  width:100% !important;
  font-size:15px !important;
  line-height:1.2 !important;
  color:#102030 !important;
  text-align:left !important;
}
.start-search-sub{
  width:100% !important;
  font-size:12px !important;
  line-height:1.35 !important;
  color:#6f8398 !important;
  text-align:left !important;
}
.start-search-price{
  min-width:140px !important;
  gap:3px !important;
}
.start-search-price-label{
  font-size:10px !important;
  font-weight:700 !important;
  letter-spacing:.1em !important;
  color:#7a8ea3 !important;
}
.start-search-price-value{
  font-size:18px !important;
  line-height:1 !important;
  color:#102030 !important;
}
@media (max-width: 820px){
  .start-search-item{align-items:flex-start !important;}
  .start-search-price{min-width:0 !important;}
}


/* THEME TOGGLE */
.theme-toggle{min-width:118px;justify-content:center;}
.theme-toggle .btn-glyph{font-size:15px;}

/* DARK MODE */
body.theme-dark{
  color:var(--text);
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.16), transparent 28%),
    radial-gradient(circle at top right, rgba(14,165,233,.12), transparent 24%),
    linear-gradient(180deg, #09111d 0%, #0d1726 100%);
}
body.theme-dark{
  --bg:#0b1320;
  --bg-2:#101a2a;
  --surface:#111c2d;
  --surface-2:#162235;
  --surface-3:#1a2940;
  --text:#e8f1fb;
  --muted:#9cb0c6;
  --muted-2:#7f95ad;
  --line:#25354b;
  --line-strong:#334966;
  --accent:#60a5fa;
  --accent-2:#93c5fd;
  --accent-soft:rgba(96,165,250,.18);
  --ok:#22c55e;
  --warn:#f59e0b;
  --danger:#f87171;
  --shadow:0 20px 60px rgba(0,0,0,.34);
  --shadow-soft:0 10px 28px rgba(0,0,0,.24);
}
body.theme-dark .topbar{
  background:rgba(10,16,28,.88);
  border-bottom:1px solid rgba(51,73,102,.92);
  box-shadow:0 1px 0 rgba(255,255,255,.03);
}
body.theme-dark .tabs{
  background:rgba(11,19,32,.88);
  border-bottom:1px solid rgba(51,73,102,.88);
}
body.theme-dark .tab{
  background:rgba(20,32,49,.9);
  color:#a8b8cb;
  border-color:#2a3c54;
  box-shadow:none;
}
body.theme-dark .tab:hover{
  background:#18263a;
  color:#edf5ff;
  border-color:#47607f;
}
body.theme-dark .tab.active{
  background:linear-gradient(180deg,#173152,#122843);
  color:#cfe5ff;
  border-color:#5d8fd1;
  box-shadow:0 10px 24px rgba(0,0,0,.22);
}
body.theme-dark .logo{
  background:linear-gradient(180deg,#10233c,#153155);
  border-color:#32547f;
  color:#cde2ff;
  box-shadow:0 10px 24px rgba(0,0,0,.22);
}
body.theme-dark .card,
body.theme-dark .dashboard-tile,
body.theme-dark .hub-panel,
body.theme-dark .app-gate-card,
body.theme-dark .modal-card,
body.theme-dark .modal-panel,
body.theme-dark .sheet-card,
body.theme-dark .dialog-card{
  background:linear-gradient(180deg, rgba(18,28,44,.96), rgba(14,22,35,.98));
  border-color:rgba(45,63,88,.96);
  box-shadow:var(--shadow);
}
body.theme-dark .card::before{opacity:.75;}
body.theme-dark .btn{
  background:linear-gradient(180deg,#172435,#111b2b);
  color:#eaf2fb;
  border-color:#31445f;
  box-shadow:none;
}
body.theme-dark .btn:hover{border-color:#6fa9ff;box-shadow:0 10px 24px rgba(0,0,0,.24);}
body.theme-dark .btn-secondary{background:linear-gradient(180deg,#142132,#0f1826);}
body.theme-dark .btn-danger{background:linear-gradient(180deg,#3a171a,#2b1215);border-color:#7f2f35;color:#ffd9dc;}
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea{
  background:#0e1827;
  border-color:#2d3d55;
  color:#edf4ff;
  box-shadow:none;
}
body.theme-dark input:hover,
body.theme-dark select:hover,
body.theme-dark textarea:hover{background:#122033;border-color:#3d5474;}
body.theme-dark input:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus{
  background:#122033;
  border-color:#6ea6ff;
  box-shadow:0 0 0 4px rgba(96,165,250,.18);
}
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder{color:#7f95ad;}
body.theme-dark select{background-image:linear-gradient(45deg,transparent 50%, #9cb0c6 50%), linear-gradient(135deg,#9cb0c6 50%, transparent 50%);}
body.theme-dark .table-wrap{background:#0f1826;border-color:#2a3b52;box-shadow:none;}
body.theme-dark .table thead th{
  color:#c5d7ec;
  background:linear-gradient(180deg,#18273b,#142133);
}
body.theme-dark .table th,
body.theme-dark .table td{border-bottom:1px solid #223247;}
body.theme-dark .table tbody tr:nth-child(even) td{background:rgba(255,255,255,.012);}
body.theme-dark .table tbody tr:hover td{background:#15263a;}
body.theme-dark .kpi > div,
body.theme-dark .note,
body.theme-dark .soft-box,
body.theme-dark .metric,
body.theme-dark .summary-box,
body.theme-dark .start-search-group,
body.theme-dark .start-search-empty{
  background:linear-gradient(180deg,#132133,#0f1b2b) !important;
  border-color:#2c3e56 !important;
  color:inherit;
  box-shadow:none;
}
body.theme-dark .note{color:#d8e8fb;border-style:solid;}
body.theme-dark .pill{
  background:#10243d;
  border-color:#33557f;
  color:#cde2ff;
}
body.theme-dark .start-search-item{
  background:linear-gradient(180deg,#142234,#101a29) !important;
  border-color:#2f435e !important;
}
body.theme-dark .start-search-item:hover{
  background:linear-gradient(180deg,#182a41,#132033) !important;
  border-color:#6ea6ff !important;
}
body.theme-dark .start-search-sub,
body.theme-dark .start-search-meta,
body.theme-dark .section-note,
body.theme-dark .small,
body.theme-dark .hint,
body.theme-dark .subtitle,
body.theme-dark label,
body.theme-dark .kpi-label,
body.theme-dark .start-search-price-label{color:#9cb0c6 !important;}
body.theme-dark .kpi-value,
body.theme-dark .start-search-title,
body.theme-dark .start-search-price-value,
body.theme-dark .card-h,
body.theme-dark .title{color:#edf4ff !important;}
body.theme-dark .dashboard-tile{border-color:#2d4059;color:#dbe8f7;box-shadow:none;}
body.theme-dark .dashboard-tile:hover{border-color:#6ea6ff;background:#15263a;}
body.theme-dark .hub-item:hover{background:#16273c;}
body.theme-dark ::-webkit-scrollbar-track{background:rgba(255,255,255,.04)}
body.theme-dark ::-webkit-scrollbar-thumb{background:rgba(156,176,198,.28);border:2px solid transparent;background-clip:padding-box}
body.theme-dark ::-webkit-scrollbar-thumb:hover{background:rgba(96,165,250,.5);border:2px solid transparent;background-clip:padding-box}

/* === 2026-03-20: dark mode polish / pelny tryb ciemny === */
body.theme-dark{
  color-scheme:dark;
}
body.theme-dark .wrap,
body.theme-dark .view{
  color:var(--text);
}
body.theme-dark .section-note,
body.theme-dark .section-subnote,
body.theme-dark .note,
body.theme-dark .small,
body.theme-dark .hint,
body.theme-dark .subtitle,
body.theme-dark label,
body.theme-dark .table,
body.theme-dark .table td,
body.theme-dark .table th,
body.theme-dark .row,
body.theme-dark .inline,
body.theme-dark .toolbar,
body.theme-dark .toolbar-stack{
  color:var(--text);
}

/* top / header */
body.theme-dark .topbar,
body.theme-dark .tabs{
  backdrop-filter:blur(18px) saturate(140%);
}
body.theme-dark .top-actions .btn,
body.theme-dark .topbar .btn,
body.theme-dark .btn-toolbar,
body.theme-dark .theme-toggle{
  background:linear-gradient(180deg,#172638 0%,#111c2c 100%) !important;
  border-color:#355070 !important;
  color:#e8f1fb !important;
  box-shadow:0 10px 26px rgba(0,0,0,.22) !important;
}
body.theme-dark .top-actions .btn:hover,
body.theme-dark .topbar .btn:hover,
body.theme-dark .btn-toolbar:hover,
body.theme-dark .theme-toggle:hover{
  background:linear-gradient(180deg,#1c3048 0%,#152338 100%) !important;
  border-color:#70a9ff !important;
}
body.theme-dark #btnNewSession,
body.theme-dark .btn-danger,
body.theme-dark .btn.btn-danger{
  background:linear-gradient(180deg,#5a1f27 0%,#44171e 100%) !important;
  border-color:#91404a !important;
  color:#fff2f4 !important;
}

/* cards / toolbars */
body.theme-dark .card,
body.theme-dark .table-wrap,
body.theme-dark .modal-card,
body.theme-dark .start-search-card,
body.theme-dark .dashboard-tile,
body.theme-dark .settings-card,
body.theme-dark .settings-box,
body.theme-dark .sp-editor,
body.theme-dark .inline-editor,
body.theme-dark .bom-box{
  background:linear-gradient(180deg, rgba(17,28,45,.97) 0%, rgba(12,20,32,.98) 100%) !important;
  border-color:#2c4059 !important;
}
body.theme-dark .toolbar,
body.theme-dark .toolbar-stack,
body.theme-dark .products-toolbar,
body.theme-dark .products-toolbar .toolbar-row,
body.theme-dark .materials-toolbar,
body.theme-dark .section-head-inline,
body.theme-dark .na-search-wrap,
body.theme-dark .na-search-wrap-inline{
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
}

/* inputs */
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .toolbar input,
body.theme-dark .toolbar select,
body.theme-dark .start-search-input,
body.theme-dark .materials-search-input,
body.theme-dark .na-search-wrap-inline input,
body.theme-dark input[type="text"],
body.theme-dark input[type="number"],
body.theme-dark input[type="search"]{
  background:linear-gradient(180deg,#132133 0%,#0f1a2a 100%) !important;
  border-color:#334a67 !important;
  color:#edf4ff !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03), 0 8px 18px rgba(0,0,0,.18) !important;
}
body.theme-dark input:hover,
body.theme-dark select:hover,
body.theme-dark textarea:hover,
body.theme-dark .toolbar input:hover,
body.theme-dark .toolbar select:hover,
body.theme-dark .start-search-input:hover,
body.theme-dark .materials-search-input:hover,
body.theme-dark .na-search-wrap-inline input:hover{
  background:linear-gradient(180deg,#16263b 0%,#112033 100%) !important;
  border-color:#466282 !important;
}
body.theme-dark input:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus,
body.theme-dark .toolbar input:focus,
body.theme-dark .toolbar select:focus,
body.theme-dark .start-search-input:focus,
body.theme-dark .materials-search-input:focus,
body.theme-dark .na-search-wrap-inline input:focus{
  background:linear-gradient(180deg,#182b42 0%,#122238 100%) !important;
  border-color:#71abff !important;
  box-shadow:0 0 0 4px rgba(96,165,250,.18), 0 10px 24px rgba(0,0,0,.18) !important;
}
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder{color:#89a0b8 !important;}

/* tables */
body.theme-dark .table-wrap{
  background:linear-gradient(180deg,#0f1a29 0%,#0c1522 100%) !important;
  box-shadow:0 16px 36px rgba(0,0,0,.22) !important;
}
body.theme-dark .table,
body.theme-dark table{
  background:transparent !important;
}
body.theme-dark .table thead th,
body.theme-dark #prodTable thead th,
body.theme-dark #salesTable thead th,
body.theme-dark #matTable thead th,
body.theme-dark #extraMatTable thead th,
body.theme-dark #tubeTable thead th{
  background:linear-gradient(180deg,#1a2a3f 0%,#152235 100%) !important;
  color:#d7e7f8 !important;
  border-bottom:1px solid #2d435f !important;
}
body.theme-dark .table td,
body.theme-dark .table th,
body.theme-dark #prodTable td,
body.theme-dark #prodTable th{
  color:#e6f0fb !important;
  border-bottom:1px solid #223247 !important;
}
body.theme-dark .table tbody tr,
body.theme-dark #prodTable tbody tr,
body.theme-dark #salesTable tbody tr,
body.theme-dark #matTable tbody tr,
body.theme-dark #extraMatTable tbody tr,
body.theme-dark #tubeTable tbody tr{
  background:transparent !important;
}
body.theme-dark .table tbody tr td,
body.theme-dark #prodTable tbody tr td,
body.theme-dark #salesTable tbody tr td,
body.theme-dark #matTable tbody tr td,
body.theme-dark #extraMatTable tbody tr td,
body.theme-dark #tubeTable tbody tr td{
  background:rgba(255,255,255,.01) !important;
}
body.theme-dark .table tbody tr:nth-child(even) td,
body.theme-dark #prodTable tbody tr:nth-child(even) td,
body.theme-dark #salesTable tbody tr:nth-child(even) td,
body.theme-dark #matTable tbody tr:nth-child(even) td,
body.theme-dark #extraMatTable tbody tr:nth-child(even) td,
body.theme-dark #tubeTable tbody tr:nth-child(even) td{
  background:rgba(255,255,255,.03) !important;
}
body.theme-dark .table tbody tr:hover td,
body.theme-dark #prodTable tbody tr:hover td,
body.theme-dark #salesTable tbody tr:hover td,
body.theme-dark #matTable tbody tr:hover td,
body.theme-dark #extraMatTable tbody tr:hover td,
body.theme-dark #tubeTable tbody tr:hover td,
body.theme-dark .row-clickable:hover td{
  background:#17283d !important;
}

/* pills / notes / misc */
body.theme-dark .pill{
  background:linear-gradient(180deg,#163252 0%,#122742 100%) !important;
  border-color:#406892 !important;
  color:#d8e8fb !important;
}
body.theme-dark .note,
body.theme-dark .soft-box,
body.theme-dark .metric,
body.theme-dark .summary-box,
body.theme-dark .kpi > div{
  background:linear-gradient(180deg,#132133 0%,#0f1b2b 100%) !important;
  border-color:#2c4059 !important;
  color:#dce8f6 !important;
}
body.theme-dark .modal-backdrop{
  background:rgba(4,8,14,.62) !important;
}
body.theme-dark #formatkaEditorModal .modal-card,
body.theme-dark #naEditorModal .modal-card,
body.theme-dark #materialEditorModal .modal-card,
body.theme-dark #extraMaterialEditorModal .modal-card,
body.theme-dark #tubeEditorModal .modal-card,
body.theme-dark #spoolEditorModal .modal-card,
body.theme-dark #cutplanEditorModal .modal-card,
body.theme-dark #productEditorModal .modal-card{
  background:linear-gradient(180deg,#101a2b 0%,#0c1522 100%) !important;
  border:1px solid #2d435f !important;
  box-shadow:0 34px 80px rgba(0,0,0,.40) !important;
}

/* === 2026-03-20: dark mode polish v2 / domkniecie bialych wysp === */
body.theme-dark .modal-head,
body.theme-dark #formatkaEditorModal .modal-head,
body.theme-dark #naEditorModal .modal-head,
body.theme-dark #materialEditorModal .modal-head,
body.theme-dark #extraMaterialEditorModal .modal-head,
body.theme-dark #tubeEditorModal .modal-head,
body.theme-dark #spoolEditorModal .modal-head,
body.theme-dark #cutplanEditorModal .modal-head,
body.theme-dark #productEditorModal .modal-head,
body.theme-dark #circleCalcModal .modal-head,
body.theme-dark #materialsEditorModal .modal-head{
  background:linear-gradient(180deg, rgba(19,33,51,.98) 0%, rgba(15,26,41,.98) 100%) !important;
  border-bottom:1px solid #2d435f !important;
}

body.theme-dark .modal-title,
body.theme-dark .modal-subtitle,
body.theme-dark .modal-head .modal-title,
body.theme-dark .modal-head .modal-subtitle,
body.theme-dark #formatkaEditorModal .modal-title,
body.theme-dark #naEditorModal .modal-title,
body.theme-dark #materialEditorModal .modal-title,
body.theme-dark #extraMaterialEditorModal .modal-title,
body.theme-dark #tubeEditorModal .modal-title,
body.theme-dark #spoolEditorModal .modal-title,
body.theme-dark #cutplanEditorModal .modal-title,
body.theme-dark #productEditorModal .modal-title,
body.theme-dark #circleCalcModal .modal-title{
  color:#edf4ff !important;
}
body.theme-dark .modal-subtitle{color:#9cb0c6 !important;}

body.theme-dark .card-h,
body.theme-dark .section-title,
body.theme-dark .na-settings-title,
body.theme-dark .start-search-group-title,
body.theme-dark .start-search-group-count,
body.theme-dark .kpi-label,
body.theme-dark .cp-stats .stat .k,
body.theme-dark .table thead th,
body.theme-dark .table th,
body.theme-dark .table td,
body.theme-dark .note b,
body.theme-dark .checkline,
body.theme-dark .row-check,
body.theme-dark .inline-checkbox,
body.theme-dark .na-field label{
  color:#dbe8f7 !important;
}

body.theme-dark .section-note,
body.theme-dark .note,
body.theme-dark .hint,
body.theme-dark .small,
body.theme-dark .start-search-meta,
body.theme-dark .start-search-sub,
body.theme-dark .muted,
body.theme-dark .cp-stats .stat .v,
body.theme-dark .table .muted,
body.theme-dark .stack-list,
body.theme-dark .na-settings-inline label,
body.theme-dark .na-settings-title,
body.theme-dark .card .subtitle{
  color:#9cb0c6 !important;
}
body.theme-dark .cp-stats .stat .v,
body.theme-dark .kpi-value{color:#edf4ff !important;}

body.theme-dark .section-note,
body.theme-dark .note,
body.theme-dark .start-search-empty,
body.theme-dark .start-search-group,
body.theme-dark .cp-stats .stat,
body.theme-dark .na-settings-card,
body.theme-dark .na-summary-tile,
body.theme-dark .na-result-card,
body.theme-dark .na-template-card,
body.theme-dark .na-editor-card,
body.theme-dark .na-hero-shell,
body.theme-dark .na-search-wrap,
body.theme-dark .na-search-wrap-inline,
body.theme-dark .section-head,
body.theme-dark .section-head-inline,
body.theme-dark .stack-item,
body.theme-dark .stack-row,
body.theme-dark .chip,
body.theme-dark .summary-chip,
body.theme-dark .soft-surface{
  background:linear-gradient(180deg,#132133 0%,#0f1b2b 100%) !important;
  border-color:#2c4059 !important;
  box-shadow:none !important;
}

body.theme-dark .na-settings-card,
body.theme-dark .na-settings-inline-card,
body.theme-dark #view-naWymiar .na-settings-inline-card,
body.theme-dark #view-naWymiar .na-hero-shell,
body.theme-dark #view-naWymiar .section-note,
body.theme-dark #view-naWymiar .note,
body.theme-dark #view-calc .start-search-card,
body.theme-dark #view-calc .start-search-card .section-note,
body.theme-dark #view-calc .start-search-empty,
body.theme-dark #view-calc .start-search-group,
body.theme-dark #view-spools .note,
body.theme-dark #view-spools .section-note,
body.theme-dark #view-circles .section-note,
body.theme-dark #view-circles .note,
body.theme-dark #spoolEditorModal .section-note,
body.theme-dark #cutplanEditorModal .section-note,
body.theme-dark #naEditorModal .section-note{
  background:linear-gradient(180deg,#132133 0%,#0f1b2b 100%) !important;
  color:#cfe0f3 !important;
  border:1px solid #2c4059 !important;
}

body.theme-dark #view-calc .start-search-card,
body.theme-dark #view-naWymiar .card,
body.theme-dark #view-spools .card,
body.theme-dark #view-circles .card,
body.theme-dark #view-products .card,
body.theme-dark #view-rozkroje .card,
body.theme-dark #view-materials .card,
body.theme-dark #view-formatki .card{
  background:linear-gradient(180deg, rgba(17,28,45,.97) 0%, rgba(12,20,32,.98) 100%) !important;
}

body.theme-dark #view-calc .start-search-card .card-h,
body.theme-dark #view-calc .start-search-card .card-h::before,
body.theme-dark #view-naWymiar .card-h,
body.theme-dark #view-spools .card-h,
body.theme-dark #view-circles .card-h,
body.theme-dark #view-rozkroje .card-h,
body.theme-dark #view-materials .card-h,
body.theme-dark #view-formatki .card-h{
  color:#edf4ff !important;
}

body.theme-dark .circles-table thead th,
body.theme-dark .circles-table .sticky-col,
body.theme-dark #circlesTable thead th,
body.theme-dark #circlesTable .sticky-col,
body.theme-dark .compact-table thead th,
body.theme-dark .compact-table .sticky-col{
  background:linear-gradient(180deg,#1a2a3f 0%,#152235 100%) !important;
  color:#d7e7f8 !important;
}
body.theme-dark .circles-table tbody td,
body.theme-dark #circlesTable tbody td,
body.theme-dark .compact-table tbody td{
  background:rgba(255,255,255,.01) !important;
  color:#e6f0fb !important;
}
body.theme-dark .circles-table tbody tr:nth-child(even) td,
body.theme-dark #circlesTable tbody tr:nth-child(even) td,
body.theme-dark .compact-table tbody tr:nth-child(even) td{
  background:rgba(255,255,255,.03) !important;
}
body.theme-dark .circles-table tbody tr:hover td,
body.theme-dark #circlesTable tbody tr:hover td,
body.theme-dark .compact-table tbody tr:hover td{
  background:#17283d !important;
}

body.theme-dark .start-search-card .btn,
body.theme-dark .start-search-box .btn,
body.theme-dark .na-hero-actions .btn,
body.theme-dark .actions .btn,
body.theme-dark .table .btn,
body.theme-dark .inline .btn,
body.theme-dark .btn-small{
  background:linear-gradient(180deg,#172638 0%,#111c2c 100%) !important;
  border-color:#355070 !important;
  color:#edf4ff !important;
}
body.theme-dark .start-search-card .btn:hover,
body.theme-dark .start-search-box .btn:hover,
body.theme-dark .na-hero-actions .btn:hover,
body.theme-dark .actions .btn:hover,
body.theme-dark .table .btn:hover,
body.theme-dark .inline .btn:hover,
body.theme-dark .btn-small:hover{
  background:linear-gradient(180deg,#1c3048 0%,#152338 100%) !important;
  border-color:#70a9ff !important;
}

body.theme-dark input[type="checkbox"]{
  accent-color:#60a5fa;
}

body.theme-dark .table-wrap,
body.theme-dark .compact-table,
body.theme-dark .stack-list,
body.theme-dark .note,
body.theme-dark .section-note{
  backdrop-filter:none !important;
}


/* === 2026-03-20: dark mode domkniecie v3 / final polish === */
body.theme-dark .circles-tooltip{
  background:rgba(16,26,41,.97) !important;
  color:#e7f0fb !important;
  border-color:#355070 !important;
  box-shadow:0 18px 44px rgba(0,0,0,.42) !important;
}

body.theme-dark .tab-order-icon-btn{
  background:linear-gradient(180deg,#172638 0%,#111c2c 100%) !important;
  border-color:#355070 !important;
  color:#e8f1fb !important;
  box-shadow:0 10px 26px rgba(0,0,0,.22) !important;
}
body.theme-dark .tab-order-icon-btn:hover{
  background:linear-gradient(180deg,#1c3048 0%,#152338 100%) !important;
  border-color:#70a9ff !important;
  color:#fff !important;
}
body.theme-dark .tab-order-icon-btn.is-active,
body.theme-dark .tabs.is-order-editing + .tabs-order-tools .tab-order-icon-btn{
  background:linear-gradient(180deg,#2a4570 0%,#1d3151 100%) !important;
  border-color:#79b1ff !important;
}

body.theme-dark #prodEditorCard .grid2 > div,
body.theme-dark #materialEditorModal .grid2 > div,
body.theme-dark #extraMaterialEditorModal .grid2 > div,
body.theme-dark #tubeEditorModal .grid2 > div,
body.theme-dark #spoolEditorModal .grid2 > div,
body.theme-dark #circleCalcModal .grid2 > div,
body.theme-dark #cutplanEditorModal .grid2 > div,
body.theme-dark #naEditorModal .grid2 > div,
body.theme-dark .spool-line-stack,
body.theme-dark .na-board-card,
body.theme-dark .na-board-stage,
body.theme-dark .na-empty,
body.theme-dark .cost-chip{
  background:linear-gradient(180deg,#132133 0%,#0f1b2b 100%) !important;
  border-color:#2c4059 !important;
  color:#e6f0fb !important;
  box-shadow:none !important;
}

body.theme-dark #prodEditorCard .actions,
body.theme-dark #productEditorModal .actions,
body.theme-dark #materialEditorModal .actions,
body.theme-dark #extraMaterialEditorModal .actions,
body.theme-dark #tubeEditorModal .actions,
body.theme-dark #spoolEditorModal .actions,
body.theme-dark #cutplanEditorModal .actions,
body.theme-dark #naEditorModal .actions{
  background:linear-gradient(180deg,rgba(16,26,43,.94) 0%,rgba(12,21,34,.98) 100%) !important;
}

body.theme-dark #circleCalcModal .modal-body,
body.theme-dark #circleCalcModal .modal-body .card,
body.theme-dark #circleCalcModal .modal-body .section-note,
body.theme-dark #circleCalcModal .modal-body pre,
body.theme-dark #circleCalcModal .modal-body code{
  background:transparent !important;
  color:#e7f0fb !important;
  border-color:#2c4059 !important;
}
body.theme-dark #circleCalcModal .modal-body .card{
  background:linear-gradient(180deg,#132133 0%,#0f1b2b 100%) !important;
}
body.theme-dark #circleCalcModal .modal-body pre{
  background:linear-gradient(180deg,#0f1a29 0%,#0b1421 100%) !important;
  border:1px solid #24364c !important;
  border-radius:16px !important;
}

body.theme-dark .na-board-meta,
body.theme-dark .na-board-meta *{color:#cfe0f3 !important;}
body.theme-dark .na-board-stage .small,
body.theme-dark .na-board-stage .hint,
body.theme-dark .na-empty{color:#9cb0c6 !important;}

body.theme-dark #prodEditorCard .section-title,
body.theme-dark #spoolEditorModal .spool-line-label,
body.theme-dark #spoolEditorModal .spool-mini span,
body.theme-dark #productEditorModal .section-title,
body.theme-dark #productEditorModal .section-subnote,
body.theme-dark #spoolEditorModal .section-title,
body.theme-dark #spoolEditorModal .section-subnote,
body.theme-dark #materialEditorModal .section-title,
body.theme-dark #tubeEditorModal .section-title,
body.theme-dark #circleCalcModal .section-title,
body.theme-dark #cutplanEditorModal .section-title{
  color:#dbe8f7 !important;
}

body.theme-dark #spoolEditorModal .spool-line-stack,
body.theme-dark #spoolEditorModal .spool-line-main,
body.theme-dark #spoolEditorModal .spool-mini,
body.theme-dark #spoolEditorModal .spool-line-fields,
body.theme-dark #spoolEditorModal .spool-line-fields-wide{
  min-width:0 !important;
}
body.theme-dark #spoolEditorModal .spool-line-stack{overflow:hidden !important;}
#spoolEditorModal .spool-line-fields-wide{
  grid-template-columns:minmax(84px,110px) minmax(0,1fr) auto !important;
}
#spoolEditorModal .spool-line-fields .btn,
#spoolEditorModal .spool-line-fields-wide .btn{
  min-width:56px;
  align-self:end;
}

body.theme-dark #view-circles .circles-table .sticky-col,
body.theme-dark #view-circles .circles-table tbody th,
body.theme-dark #circlesTable .sticky-col,
body.theme-dark #circlesTable tbody th{
  background:linear-gradient(180deg,#1a2a3f 0%,#152235 100%) !important;
  color:#e7f0fb !important;
}

body.theme-dark #view-circles .circles-summary,
body.theme-dark #view-circles .circles-summary + div,
body.theme-dark #view-circles details,
body.theme-dark #view-circles details > div,
body.theme-dark #view-rozkroje .na-boards-wrap,
body.theme-dark #view-naWymiar .na-boards-wrap{
  background:transparent !important;
}


/* === 2026-03-20: domkniecie dark mode + sidebar + pelne trafienia search === */
.tabs{
  overflow-x:hidden !important;
}
.tabs-order-tools{
  width:100% !important;
  max-width:100% !important;
  margin:6px 0 0 !important;
  padding:6px 0 0 !important;
  justify-content:flex-end !important;
  overflow:hidden !important;
}
.tab-order-icon-btn{
  flex:0 0 auto;
}
@media (max-width: 900px){
  .tabs-order-tools{
    position:sticky;
    right:0;
  }
}

body.theme-dark #spoolEditorModal .cost-card,
body.theme-dark #spoolEditorModal .cost-list,
body.theme-dark #spoolEditorModal .cost-meta,
body.theme-dark #spoolEditorModal .cost-card-title{
  background:linear-gradient(180deg,#132133 0%,#0f1b2b 100%) !important;
  color:#e8f1fb !important;
  border-color:#2c4059 !important;
}
body.theme-dark #spoolEditorModal .cost-card{
  border:1px solid #2c4059 !important;
  box-shadow:none !important;
}
body.theme-dark #spoolEditorModal .cost-card-title{
  color:#cfe2f8 !important;
}
body.theme-dark #spoolEditorModal .cost-row{
  border-bottom:1px dashed #2d435d !important;
}
body.theme-dark #spoolEditorModal .cost-row span,
body.theme-dark #spoolEditorModal .cost-meta{
  color:#9cb0c6 !important;
}
body.theme-dark #spoolEditorModal .cost-row strong{
  color:#eef5ff !important;
}
body.theme-dark #spoolEditorModal .cost-row-total{
  border-top:1px solid #365171 !important;
}
body.theme-dark #spoolEditorModal .btn-icon-close,
body.theme-dark #productEditorModal .btn-icon-close,
body.theme-dark #formatkaEditorModal .btn-icon-close,
body.theme-dark #naEditorModal .btn-icon-close,
body.theme-dark #materialEditorModal .btn-icon-close,
body.theme-dark #extraMaterialEditorModal .btn-icon-close,
body.theme-dark #tubeEditorModal .btn-icon-close,
body.theme-dark #cutplanEditorModal .btn-icon-close,
body.theme-dark #circleCalcModal .btn-icon-close{
  background:linear-gradient(180deg,#6b1f26 0%,#4d151b 100%) !important;
  border-color:#9b3943 !important;
  color:#fff0f1 !important;
}
body.theme-dark #spoolEditorModal .btn-icon-close:hover,
body.theme-dark #productEditorModal .btn-icon-close:hover,
body.theme-dark #formatkaEditorModal .btn-icon-close:hover,
body.theme-dark #naEditorModal .btn-icon-close:hover,
body.theme-dark #materialEditorModal .btn-icon-close:hover,
body.theme-dark #extraMaterialEditorModal .btn-icon-close:hover,
body.theme-dark #tubeEditorModal .btn-icon-close:hover,
body.theme-dark #cutplanEditorModal .btn-icon-close:hover,
body.theme-dark #circleCalcModal .btn-icon-close:hover{
  background:linear-gradient(180deg,#7b2630 0%,#5b1a22 100%) !important;
  border-color:#bf4c58 !important;
}


/* 2026-03-20 final dark-mode touchups */
.start-search-clear-glyph{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:30px;
  font-weight:900;
  line-height:1;
}

#btnStartSearchClear.start-search-clear-glyph{
  min-width:72px !important;
  width:72px;
  padding:0 !important;
}

body.theme-dark #btnStartSearchClear.start-search-clear-glyph{
  background:linear-gradient(180deg,#5a1f27 0%,#44171e 100%) !important;
  border-color:#91404a !important;
  color:#fff2f4 !important;
  box-shadow:0 10px 24px rgba(0,0,0,.22) !important;
}
body.theme-dark #btnStartSearchClear.start-search-clear-glyph:hover{
  background:linear-gradient(180deg,#6a2630 0%,#4c1b22 100%) !important;
  border-color:#c46a74 !important;
}

body.theme-dark #circleCalcModal .modal-head{
  background:linear-gradient(180deg, rgba(16,27,42,.98) 0%, rgba(11,19,30,.98) 100%) !important;
  border-bottom:1px solid #2c4059 !important;
}
body.theme-dark #circleCalcModal .modal-head::after{
  background:linear-gradient(90deg,#3b82f6 0%, rgba(59,130,246,.18) 62%, transparent 100%) !important;
}
body.theme-dark #circleCalcModal .modal-head .btn,
body.theme-dark #circleCalcModal .modal-head-actions .btn{
  background:linear-gradient(180deg,#162538 0%,#101b2a 100%) !important;
  border-color:#355070 !important;
  color:#edf4ff !important;
  box-shadow:0 8px 20px rgba(0,0,0,.22) !important;
}
body.theme-dark #circleCalcModal .modal-head .btn:hover,
body.theme-dark #circleCalcModal .modal-head-actions .btn:hover{
  background:linear-gradient(180deg,#1c3048 0%,#142338 100%) !important;
  border-color:#70a9ff !important;
}
body.theme-dark #btnCloseCircleCalc,
body.theme-dark #circleCalcModal .modal-head #btnCloseCircleCalc{
  background:linear-gradient(180deg,#5a1f27 0%,#44171e 100%) !important;
  border-color:#91404a !important;
  color:#fff2f4 !important;
}
body.theme-dark #btnCloseCircleCalc:hover,
body.theme-dark #circleCalcModal .modal-head #btnCloseCircleCalc:hover{
  background:linear-gradient(180deg,#6a2630 0%,#4c1b22 100%) !important;
  border-color:#c46a74 !important;
}

body.theme-dark #circleCalcModal .modal-body,
body.theme-dark #circleCalcModal .modal-body > .card{
  background:transparent !important;
}
body.theme-dark #circleCalcModal .calc-section,
body.theme-dark #circleCalcModal .section-note,
body.theme-dark #circleCalcModal .note,
body.theme-dark #circleCalcModal .soft-box,
body.theme-dark #circleCalcModal .summary-box{
  background:linear-gradient(180deg,#132133 0%,#0f1a2a 100%) !important;
  border:1px solid #2f435e !important;
  color:#e6f0fb !important;
  box-shadow:none !important;
}
body.theme-dark #circleCalcModal .calc-section h4,
body.theme-dark #circleCalcModal .calc-row,
body.theme-dark #circleCalcModal .calc-row b,
body.theme-dark #circleCalcModal .calc-row .k,
body.theme-dark #circleCalcModal .calc-section .k,
body.theme-dark #circleCalcModal .calc-section b,
body.theme-dark #circleCalcModal .calc-section span,
body.theme-dark #circleCalcModal .calc-section div{
  color:#e6f0fb !important;
}
body.theme-dark #circleCalcModal .calc-row{
  border-bottom:1px dashed #29405c !important;
}
body.theme-dark #circleCalcModal .calc-row .k,
body.theme-dark #circleCalcModal .modal-subtitle{
  color:#9cb0c6 !important;
}
body.theme-dark #circleCalcModal .calc-formula{
  background:linear-gradient(180deg,#101b2b 0%,#0d1725 100%) !important;
  border:1px solid #2f435e !important;
  color:#e6f0fb !important;
}
body.theme-dark #circleCalcModal .calc-impact{
  background:rgba(37,99,235,.18) !important;
  border-color:#3b82f6 !important;
  color:#dbeafe !important;
}

/* === 2026-03-20 final micro-fixes: sidebar / header / search clear === */
.tabs{
  box-shadow:none !important;
}
body.theme-dark .tabs{
  border-right:1px solid #223247 !important;
  box-shadow:none !important;
}
body.theme-dark .tabs::after,
body.theme-dark .tabs::before{
  display:none !important;
}
body.theme-dark .tabs-order-tools{
  border-top:1px solid rgba(34,50,71,.7);
}

.top-actions{
  background:rgba(255,255,255,.58);
  border-color:rgba(205,216,231,.72);
  box-shadow:0 8px 20px rgba(15,23,42,.04);
}
body.theme-dark .top-actions{
  background:rgba(15,26,41,.34) !important;
  border-color:rgba(53,80,112,.48) !important;
  box-shadow:none !important;
  backdrop-filter:blur(10px) saturate(120%);
}

body.theme-dark #btnStartSearchClear.start-search-clear-glyph{
  background:linear-gradient(180deg,#172638 0%,#111c2c 100%) !important;
  border-color:#355070 !important;
  color:#f87171 !important;
  box-shadow:none !important;
}
body.theme-dark #btnStartSearchClear.start-search-clear-glyph:hover{
  background:linear-gradient(180deg,#1c3048 0%,#152338 100%) !important;
  border-color:#70a9ff !important;
  color:#fca5a5 !important;
}


/* === 2026-03-20: start hero rebuild === */
#view-calc{
  display:block !important;
}
#view-calc .start-stage{
  width:min(1120px, calc(100vw - var(--sidebar-w) - 56px));
  margin:14px auto 0;
}
#view-calc .start-hero{
  padding:34px 34px 28px !important;
  border-radius:34px !important;
  background:
    radial-gradient(circle at top left, rgba(96,165,250,.16), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,251,255,.98)) !important;
  border:1px solid #d9e6f3 !important;
  box-shadow:0 30px 80px rgba(15,23,42,.10) !important;
  overflow:visible;
}
#view-calc .start-hero::before{
  height:1px !important;
  background:linear-gradient(90deg, rgba(96,165,250,.55), rgba(56,189,248,.22), transparent 70%) !important;
}
#view-calc .start-kicker{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(191,219,254,.95);
  color:#597794;
  font-size:11px;
  font-weight:800;
  letter-spacing:.16em;
  text-transform:uppercase;
  box-shadow:0 8px 24px rgba(15,23,42,.05);
}
#view-calc .start-title{
  margin-top:18px;
  font-size:clamp(28px, 4.2vw, 46px);
  line-height:1.02;
  font-weight:900;
  letter-spacing:-.04em;
  color:#0f1d2e;
  max-width:700px;
}
#view-calc .start-lead{
  margin-top:12px;
  font-size:15px;
  line-height:1.55;
  color:#5d738b;
  max-width:620px;
}
#view-calc .start-search-shell{
  display:grid;
  grid-template-columns:minmax(0,1fr) 48px;
  gap:12px;
  align-items:center;
  margin-top:24px;
  padding:12px 14px;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(19,31,48,.96), rgba(14,24,38,.98));
  border:1px solid rgba(42,67,96,.92);
  box-shadow:0 18px 40px rgba(15,23,42,.18);
  backdrop-filter:blur(18px) saturate(140%);
}
#view-calc .start-search-icon{display:none !important;}
#view-calc .start-search-input{
  order:1;
  min-height:64px !important;
  padding:0 24px !important;
  border:none !important;
  border-radius:999px !important;
  background:rgba(255,255,255,0) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), inset 0 -1px 0 rgba(0,0,0,.04) !important;
  font-size:24px !important;
  font-weight:700;
  letter-spacing:-.03em;
  color:#f3f7ff !important;
}
#view-calc .start-search-input::placeholder{
  color:#8ea0b8 !important;
  font-size:17px !important;
  font-weight:500;
  letter-spacing:-.01em;
}
#view-calc .start-search-input:focus{
  box-shadow:none !important;
}
#view-calc .start-search-input:hover{
  background:rgba(255,255,255,0) !important;
}
#view-calc .start-search-clear-btn{
  order:2;
  width:40px !important;
  min-width:40px !important;
  height:40px !important;
  min-height:40px !important;
  padding:0 !important;
  border-radius:999px !important;
  display:grid !important;
  place-items:center !important;
  justify-self:end;
  align-self:center;
  font-size:18px !important;
  font-weight:700 !important;
  line-height:1 !important;
  color:#ff4d4f !important;
  background:rgba(255,255,255,.21) !important;
  border:1px solid rgba(255,255,255,.14) !important;
  box-shadow:0 10px 20px rgba(0,0,0,.18) !important;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
#view-calc .start-search-clear-btn:hover{
  transform:translateY(-1px) scale(1.03) !important;
  background:rgba(255,255,255,.24) !important;
  box-shadow:0 14px 24px rgba(0,0,0,.22) !important;
}
#view-calc .start-search-clear-btn:active{
  transform:scale(.98) !important;
}

#view-calc .start-search-meta{
  margin-top:14px !important;
  padding-left:6px;
  font-size:12px !important;
  color:#7890a8 !important;
  letter-spacing:.02em;
}
#view-calc .start-results-stage{
  margin-top:18px !important;
  min-height:160px;
  padding:18px !important;
  border-radius:28px !important;
  border:1px solid #dce8f4 !important;
  background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,251,255,.98)) !important;
  box-shadow:0 22px 60px rgba(15,23,42,.08) !important;
}
#view-calc .start-search-empty.start-results-stage{
  display:grid;
  place-items:center;
  padding:36px 24px !important;
  color:#6b8199;
  font-size:15px !important;
  text-align:center;
  border-style:solid !important;
}
#view-calc .start-search-results{
  gap:16px !important;
}
#view-calc .start-search-group{
  padding:10px !important;
  border-radius:24px !important;
  background:linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,250,255,.98)) !important;
  border:1px solid #dde9f5 !important;
  box-shadow:0 14px 36px rgba(15,23,42,.05) !important;
}
#view-calc .start-search-group-head{
  margin-bottom:10px !important;
  padding:4px 8px 6px !important;
}
#view-calc .start-search-group-title{
  color:#6a8199 !important;
  font-size:11px !important;
  letter-spacing:.16em !important;
  font-weight:800 !important;
}
#view-calc .start-search-group-count{
  min-width:74px;
  text-align:center;
  padding:5px 10px;
  border-radius:999px;
  background:#eef4fb;
  color:#6f86a0 !important;
  font-size:11px !important;
  font-weight:800;
}
#view-calc .start-search-list{
  gap:10px !important;
}
#view-calc .start-search-item{
  position:relative;
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto;
  gap:16px !important;
  align-items:center !important;
  padding:16px 18px !important;
  border-radius:20px !important;
  border:1px solid #e2ecf5 !important;
  background:linear-gradient(180deg, #ffffff, #fbfdff) !important;
  box-shadow:0 10px 26px rgba(15,23,42,.04) !important;
  overflow:hidden;
}
#view-calc .start-search-item::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:4px;
  border-radius:20px;
  background:linear-gradient(180deg, rgba(96,165,250,.95), rgba(56,189,248,.58));
  opacity:.85;
}
#view-calc .start-search-item:hover{
  transform:translateY(-2px) scale(1.002) !important;
  border-color:#c7d9ea !important;
  box-shadow:0 18px 36px rgba(15,23,42,.08) !important;
}
#view-calc .start-search-main{
  padding-left:6px;
  gap:6px !important;
}
#view-calc .start-search-title{
  font-size:16px !important;
  line-height:1.2 !important;
  font-weight:800 !important;
  color:#102030 !important;
}
#view-calc .start-search-sub{
  font-size:13px !important;
  line-height:1.38 !important;
  color:#6d839a !important;
}
#view-calc .start-search-price{
  min-width:152px !important;
  justify-items:end !important;
  align-self:center;
  padding:10px 12px;
  border-radius:16px;
  background:linear-gradient(180deg, #f5f9fd, #edf4fb);
  border:1px solid #dce8f4;
}
#view-calc .start-search-price-label{
  font-size:10px !important;
  letter-spacing:.14em !important;
  color:#7b91a8 !important;
}
#view-calc .start-search-price-value{
  font-size:18px !important;
  font-weight:900 !important;
  color:#0f2033 !important;
}

body.theme-dark #view-calc .start-hero{
  background:
    radial-gradient(circle at top left, rgba(96,165,250,.18), transparent 30%),
    linear-gradient(180deg, rgba(18,28,44,.96), rgba(12,20,31,.98)) !important;
  border-color:#2b4059 !important;
  box-shadow:0 34px 90px rgba(0,0,0,.32) !important;
}
body.theme-dark #view-calc .start-kicker{
  background:rgba(15,26,40,.88);
  border-color:#35557b;
  color:#a8c3e2;
}
body.theme-dark #view-calc .start-title{color:#eef5ff;}
body.theme-dark #view-calc .start-lead{color:#93a9c0;}
body.theme-dark #view-calc .start-search-shell{
  background:linear-gradient(180deg, rgba(17,30,48,.97), rgba(12,22,36,.99));
  border-color:#315179;
  box-shadow:0 22px 52px rgba(0,0,0,.34);
}
body.theme-dark #view-calc .start-search-icon{
  background:linear-gradient(180deg, #17283c, #102033);
  border-color:#345476;
  color:#b7d2ef;
  box-shadow:none;
}
body.theme-dark #view-calc .start-search-input{
  background:rgba(255,255,255,.28) !important;
  color:#eef5ff !important;
}
body.theme-dark #view-calc .start-search-input::placeholder{
  color:#7d92ab !important;
}
body.theme-dark #view-calc .start-search-meta{
  color:#8da5bd !important;
}
body.theme-dark #view-calc .start-results-stage,
body.theme-dark #view-calc .start-search-group{
  background:linear-gradient(180deg, rgba(17,28,42,.97), rgba(12,20,31,.98)) !important;
  border-color:#283d56 !important;
  box-shadow:0 20px 50px rgba(0,0,0,.24) !important;
}
body.theme-dark #view-calc .start-search-empty.start-results-stage{
  color:#8ea5bc;
}
body.theme-dark #view-calc .start-search-group-count{
  background:#15263a;
  color:#9fbbd8 !important;
}
body.theme-dark #view-calc .start-search-item{
  background:linear-gradient(180deg, #142234, #101a29) !important;
  border-color:#2d425d !important;
  box-shadow:none !important;
}
body.theme-dark #view-calc .start-search-item:hover{
  border-color:#6ea6ff !important;
  box-shadow:0 18px 40px rgba(0,0,0,.26) !important;
}
body.theme-dark #view-calc .start-search-title{
  color:#eef5ff !important;
}
body.theme-dark #view-calc .start-search-sub,
body.theme-dark #view-calc .start-search-price-label,
body.theme-dark #view-calc .start-search-group-title{
  color:#8fa7c0 !important;
}
body.theme-dark #view-calc .start-search-price{
  background:linear-gradient(180deg, #15273a, #122031);
  border-color:#2c445f;
}
body.theme-dark #view-calc .start-search-price-value{
  color:#eff6ff !important;
}

@media (max-width: 980px){
  #view-calc .start-stage{width:min(100%, calc(100vw - 24px));}
  #view-calc .start-hero{padding:24px 20px 20px !important;border-radius:26px !important;}
  #view-calc .start-title{font-size:32px;max-width:none;}
  #view-calc .start-search-shell{grid-template-columns:56px minmax(0,1fr);}
  #view-calc .start-search-clear-btn{grid-column:1 / -1;width:100%;}
}
@media (max-width: 720px){
  #view-calc .start-search-input{font-size:19px !important;}
  #view-calc .start-search-item{grid-template-columns:1fr !important;}
  #view-calc .start-search-price{min-width:0 !important;justify-items:start !important;}
}

/* === 20260320 Start visual cleanup === */
#view-calc .start-hero{
  padding:34px 36px 30px;
  overflow:hidden;
}
#view-calc .start-kicker,
#view-calc .start-title,
#view-calc .start-search-icon,
#view-calc .start-lead.is-hidden{
  display:none !important;
}
#view-calc .start-panorama{
  position:relative;
  height:108px;
  margin:0 0 18px;
  border-radius:22px;
  overflow:hidden;
  background:linear-gradient(180deg, rgba(255,255,255,.015), rgba(255,255,255,0));
}
#view-calc .start-panorama-line{
  position:absolute;
  left:0;
  right:0;
  border-radius:999px;
  background:linear-gradient(90deg, rgba(255,255,255,0), rgba(120,168,255,.22), rgba(255,255,255,0));
  box-shadow:0 0 26px rgba(52,119,255,.12);
}
#view-calc .start-panorama-line-1{
  top:20px;
  height:1px;
  opacity:.8;
}
#view-calc .start-panorama-line-2{
  top:52px;
  left:4%;
  right:10%;
  height:2px;
  opacity:.92;
}
#view-calc .start-panorama-line-3{
  bottom:24px;
  left:16%;
  right:0;
  height:1px;
  opacity:.7;
}
#view-calc .start-panorama-glow{
  position:absolute;
  inset:18px 12% 18px 8%;
  border-radius:999px;
  background:radial-gradient(circle at center, rgba(65,127,255,.16), rgba(65,127,255,0) 68%);
  filter:blur(12px);
}
#view-calc .start-search-shell{
  display:flex;
  align-items:center;
  gap:14px;
  min-height:118px;
  padding:14px 16px 14px 18px;
  border-radius:999px;
  border:2px solid rgba(113,154,226,.42);
  background:transparent !important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.025), 0 12px 32px rgba(0,0,0,.14);
}
#view-calc .start-search-input,
#view-calc .start-search-input:focus{
  flex:1 1 auto;
  min-height:84px;
  border-radius:999px;
  border:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  transform:none !important;
  padding:0 22px;
  font-size:21px;
  font-weight:600;
  color:#ecf3ff;
}
#view-calc .start-search-input::placeholder{
  color:rgba(220,230,250,.58);
  opacity:1;
}
#view-calc .start-search-clear-btn{
  flex:0 0 78px;
  width:78px;
  height:78px;
  min-height:78px;
  padding:0;
  border-radius:50%;
  background:transparent !important;
  border:1px solid rgba(255,92,92,.52) !important;
  box-shadow:0 0 0 1px rgba(255,255,255,.03) inset, 0 8px 22px rgba(0,0,0,.16);
  color:#ff6666 !important;
  font-size:30px;
  line-height:1;
  display:grid;
  place-items:center;
}
#view-calc .start-search-clear-btn:hover{
  background:rgba(255,96,96,.06) !important;
  border-color:rgba(255,110,110,.72) !important;
  color:#ff7e7e !important;
  transform:translateY(-1px);
}
#view-calc .start-search-meta{
  margin-top:16px;
  font-size:14px;
  color:rgba(214,225,245,.72);
}
#view-calc .start-results-stage{
  margin-top:22px;
}
@media (max-width: 900px){
  #view-calc .start-hero{padding:24px 18px 22px;}
  #view-calc .start-panorama{height:78px; margin-bottom:14px;}
  #view-calc .start-search-shell{min-height:92px; padding:10px 10px 10px 12px; gap:10px;}
  #view-calc .start-search-input,
  #view-calc .start-search-input:focus{min-height:68px; font-size:18px; padding:0 16px;}
  #view-calc .start-search-clear-btn{width:60px; height:60px; min-height:60px; flex-basis:60px; font-size:24px;}
}


/* === Start visual polish 2026-03-20 === */
#view-calc .start-panorama{
  min-height:72px;
  height:72px;
  margin-bottom:8px;
  opacity:.82;
}
#view-calc .start-panorama-line-1,
#view-calc .start-panorama-line-2,
#view-calc .start-panorama-line-3{
  transform:scaleY(.5);
  transform-origin:center;
}
#view-calc .start-search-shell{
  grid-template-columns:minmax(0,1fr) 58px;
  gap:18px;
  padding:11px 18px;
  border-width:2px !important;
  background:transparent !important;
}
#view-calc .start-search-input{
  min-height:68px !important;
  padding:0 28px !important;
  background:transparent !important;
  box-shadow:none !important;
  font-size:31px !important;
}
#view-calc .start-search-input:hover,
#view-calc .start-search-input:focus{
  background:transparent !important;
  box-shadow:none !important;
}
#view-calc .start-search-input::placeholder{
  color:rgba(201,214,232,.72) !important;
  font-size:19px !important;
}
#view-calc .start-search-meta{
  padding-left:18px;
}
#view-calc .start-search-clear-btn{
  width:58px !important;
  min-width:58px !important;
  height:58px !important;
  min-height:58px !important;
  justify-self:center;
  align-self:center;
  margin-right:6px;
  background:transparent !important;
  border:1px solid rgba(255,90,94,.52) !important;
  box-shadow:none !important;
}
#view-calc .start-search-clear-btn:hover{
  background:rgba(255,90,94,.06) !important;
  border-color:rgba(255,90,94,.68) !important;
  box-shadow:none !important;
}
#view-calc .start-search-empty.start-results-stage,
#view-calc .start-search-empty-waiting.start-results-stage{
  min-height:76px;
  padding:18px 24px !important;
}
#view-calc .start-waiting{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
#view-calc .start-waiting span{
  width:10px;
  height:10px;
  border-radius:50%;
  background:rgba(140,164,192,.72);
  box-shadow:0 0 0 1px rgba(122,150,180,.22);
  animation:startWaitingPulse 1.2s infinite ease-in-out;
}
#view-calc .start-waiting span:nth-child(2){animation-delay:.18s;}
#view-calc .start-waiting span:nth-child(3){animation-delay:.36s;}
@keyframes startWaitingPulse{
  0%, 80%, 100%{transform:scale(.72);opacity:.36;}
  40%{transform:scale(1);opacity:.92;}
}

body.theme-dark #view-calc .start-panorama{
  min-height:72px;
  height:72px;
  opacity:.64;
}
body.theme-dark #view-calc .start-search-shell{
  grid-template-columns:minmax(0,1fr) 58px;
  gap:18px;
  padding:11px 18px;
  border-width:2px !important;
  background:transparent !important;
}
body.theme-dark #view-calc .start-search-input{
  min-height:68px !important;
  padding:0 28px !important;
  background:transparent !important;
  box-shadow:none !important;
  font-size:31px !important;
}
body.theme-dark #view-calc .start-search-input:hover,
body.theme-dark #view-calc .start-search-input:focus{
  background:transparent !important;
  box-shadow:none !important;
}
body.theme-dark #view-calc .start-search-input::placeholder{
  color:rgba(190,205,225,.66) !important;
  font-size:19px !important;
}
body.theme-dark #view-calc .start-search-meta{
  padding-left:18px;
}
body.theme-dark #view-calc .start-search-clear-btn{
  width:58px !important;
  min-width:58px !important;
  height:58px !important;
  min-height:58px !important;
  justify-self:center;
  align-self:center;
  margin-right:6px;
  background:transparent !important;
  border:1px solid rgba(255,100,108,.48) !important;
  box-shadow:none !important;
}
body.theme-dark #view-calc .start-search-clear-btn:hover{
  background:rgba(255,90,94,.06) !important;
  border-color:rgba(255,110,118,.74) !important;
  box-shadow:none !important;
}
body.theme-dark #view-calc .start-search-empty.start-results-stage,
body.theme-dark #view-calc .start-search-empty-waiting.start-results-stage{
  min-height:76px;
  padding:18px 24px !important;
}
body.theme-dark #view-calc .start-waiting span{
  background:rgba(165,184,208,.72);
  box-shadow:0 0 0 1px rgba(124,151,184,.22);
}


/* === 2026-03-20: start visual micro-tune === */
#view-calc .start-hero,
body.theme-dark #view-calc .start-hero{
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  padding:18px 10px 12px !important;
}
#view-calc .start-hero::before,
body.theme-dark #view-calc .start-hero::before{
  display:none !important;
}
#view-calc .start-panorama,
body.theme-dark #view-calc .start-panorama{
  height:22px !important;
  min-height:22px !important;
  margin-bottom:8px !important;
  opacity:.58 !important;
  border-radius:12px !important;
}
#view-calc .start-panorama-line-1{ top:4px !important; }
#view-calc .start-panorama-line-2{ top:10px !important; }
#view-calc .start-panorama-line-3{ bottom:4px !important; }
#view-calc .start-panorama-glow{ inset:2px 18% 2px 14% !important; filter:blur(8px) !important; }

#view-calc .start-search-shell,
body.theme-dark #view-calc .start-search-shell{
  border-width:2px !important;
  box-shadow:none !important;
}
#view-calc .start-search-input,
#view-calc .start-search-input:focus,
body.theme-dark #view-calc .start-search-input,
body.theme-dark #view-calc .start-search-input:focus{
  padding:0 32px 0 38px !important;
}
#view-calc .start-search-clear-btn,
body.theme-dark #view-calc .start-search-clear-btn{
  width:72px !important;
  min-width:72px !important;
  height:72px !important;
  min-height:72px !important;
  flex-basis:72px !important;
  margin-right:12px !important;
  border-radius:50% !important;
  font-size:60px !important;
  line-height:1 !important;
  color:rgba(255,102,110,.5) !important;
  display:grid !important;
  place-items:center !important;
}
#view-calc .start-search-clear-btn:hover,
body.theme-dark #view-calc .start-search-clear-btn:hover{
  color:rgba(255,118,126,.68) !important;
}
#view-calc .start-search-meta,
body.theme-dark #view-calc .start-search-meta{
  padding-left:24px !important;
}
#view-calc .start-results-stage,
body.theme-dark #view-calc .start-results-stage{
  margin-top:16px !important;
  padding:4px 0 0 !important;
  min-height:54px !important;
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  border-radius:0 !important;
}
#view-calc .start-search-empty.start-results-stage,
#view-calc .start-search-empty-waiting.start-results-stage,
body.theme-dark #view-calc .start-search-empty.start-results-stage,
body.theme-dark #view-calc .start-search-empty-waiting.start-results-stage{
  min-height:54px !important;
  padding:8px 0 !important;
}

/* === 2026-03-20 late polish: Start micro tweaks === */
#view-calc .start-search-shell,
body.theme-dark #view-calc .start-search-shell{
  width:85% !important;
  min-height:unset !important;
  padding:10px 16px 10px 18px !important;
  gap:14px !important;
  margin-left:0 !important;
}

#view-calc .start-panorama,
body.theme-dark #view-calc .start-panorama{
  height:30% !important;
  min-height:26px !important;
  max-height:34px !important;
  margin-bottom:10px !important;
}

#view-calc .start-search-input,
body.theme-dark #view-calc .start-search-input{
  min-height:64px !important;
  font-size:clamp(26px, 2.2vw, 34px) !important;
  padding-left:34px !important;
}

#view-calc .start-search-clear-btn,
body.theme-dark #view-calc .start-search-clear-btn{
  width:54px !important;
  min-width:54px !important;
  height:54px !important;
  min-height:54px !important;
  flex:0 0 54px !important;
  padding:0 !important;
  border-radius:999px !important;
  font-size:34px !important;
  line-height:1 !important;
  color:rgba(255,94,112,.5) !important;
  background:transparent !important;
  box-shadow:none !important;
}

#view-calc .start-search-price,
#view-calc .start-search-group-count,
body.theme-dark #view-calc .start-search-price,
body.theme-dark #view-calc .start-search-group-count{
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  padding:0 !important;
}

#view-calc .start-search-group-count,
body.theme-dark #view-calc .start-search-group-count{
  min-width:auto !important;
  border-radius:0 !important;
}

#view-calc .start-search-meta,
body.theme-dark #view-calc .start-search-meta{
  margin-left:22px !important;
}

#view-calc .start-search-empty.start-results-stage,
#view-calc .start-search-empty-waiting.start-results-stage,
body.theme-dark #view-calc .start-search-empty.start-results-stage,
body.theme-dark #view-calc .start-search-empty-waiting.start-results-stage{
  border:none !important;
  background:transparent !important;
  box-shadow:none !important;
  padding:14px 0 0 !important;
}

@media (max-width: 900px){
  #view-calc .start-search-shell,
  body.theme-dark #view-calc .start-search-shell{width:100% !important;}
  #view-calc .start-search-input,
  body.theme-dark #view-calc .start-search-input{font-size:24px !important;}
}

/* === 2026-03-21: start width + waiting dots alignment === */
#view-calc .start-search-shell,
body.theme-dark #view-calc .start-search-shell{
  width:100% !important;
  max-width:none !important;
}

#view-calc .start-results-stage,
body.theme-dark #view-calc .start-results-stage,
#view-calc .start-search-empty.start-results-stage,
#view-calc .start-search-empty-waiting.start-results-stage,
body.theme-dark #view-calc .start-search-empty.start-results-stage,
body.theme-dark #view-calc .start-search-empty-waiting.start-results-stage{
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
}

#view-calc .start-waiting,
body.theme-dark #view-calc .start-waiting{
  display:flex !important;
  justify-content:flex-start !important;
  margin-left:10% !important;
}


/* ===== OPERACJE / CHIRURGICZNY PREMIUM LAYOUT ===== */
#view-ops{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}
#view-ops > .grid2{display:block !important;}
.ops-hero-bar{
  display:flex;
  justify-content:space-between;
  align-items:stretch;
  gap:18px;
  padding:22px 24px;
  border:1px solid #dbe4ef;
  border-radius:22px;
  background:linear-gradient(135deg,#ffffff 0%,#f5f9ff 55%,#eef5ff 100%);
  box-shadow:0 18px 48px rgba(15,23,42,.06);
}
.ops-hero-copy{display:flex;flex-direction:column;justify-content:center;gap:6px;min-width:0;}
.ops-eyebrow{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:#64748b;
  font-weight:900;
}
.ops-hero-title{
  margin:0;
  font-size:28px;
  line-height:1.05;
  letter-spacing:-.03em;
  color:#0f172a;
}
.ops-hero-subtitle{color:#64748b;max-width:820px;font-size:14px;}
.ops-hero-stats{
  display:grid;
  grid-template-columns:repeat(3,minmax(140px,1fr));
  gap:12px;
  min-width:min(100%,520px);
}
.ops-stat-card{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:8px;
  padding:16px 18px;
  border-radius:18px;
  background:rgba(255,255,255,.82);
  border:1px solid rgba(191,219,254,.9);
  box-shadow:0 10px 28px rgba(37,99,235,.08);
}
.ops-stat-label{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#64748b;font-weight:800;}
.ops-stat-value{font-size:24px;line-height:1;font-weight:900;color:#0f172a;letter-spacing:-.03em;}
.ops-grid-shell{
  display:grid;
  grid-template-columns:1.05fr 1.25fr;
  gap:18px;
  align-items:start;
}
.ops-card{padding:18px;border-radius:22px;}
.ops-card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin-bottom:14px;
}
.ops-card-head-tight{margin-bottom:16px;}
.ops-card .card-h{margin-bottom:6px;padding-bottom:0;border-bottom:none;}
.ops-card-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end;}
.ops-table-wrap{max-height:430px !important;}
.ops-table-wrap-wide{max-height:430px !important;}
.ops-note{margin-top:14px;}
.ops-card-rates{grid-column:1;}
.ops-card-opslist{grid-column:2;}
.ops-card-editor{grid-column:1;}
.ops-card-rules{grid-column:2;}
.ops-editor-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:32px;
  padding:0 12px;
  border-radius:999px;
  background:#eff6ff;
  border:1px solid #bfdbfe;
  color:#1d4ed8;
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}
.ops-form-grid{display:grid;gap:10px;}
#view-ops .row{
  grid-template-columns:180px minmax(0,1fr);
  margin:0;
  padding:10px 0;
  border-bottom:1px solid #eef2f7;
}
#view-ops .row:last-child{border-bottom:none;padding-bottom:0;}
#view-ops .row-textarea{align-items:start;}
#view-ops textarea{min-height:118px;}
.ops-editor-actions{margin-top:16px;}
.ops-rule-stack{display:grid;gap:12px;}
.ops-rule-item{
  padding:14px 16px;
  border-radius:16px;
  background:linear-gradient(180deg,#f8fbff,#f3f7fc);
  border:1px solid #e2e8f0;
}
.ops-rule-k{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:#64748b;font-weight:900;margin-bottom:6px;}
.ops-rule-v{font-size:15px;color:#0f172a;font-weight:700;line-height:1.45;}
#view-ops #rateTable td input{
  background:#f8fbff;
  border-color:#dbeafe;
  font-weight:800;
}
#view-ops #opTable tbody tr.is-editing td{
  background:#eff6ff !important;
}
#view-ops #opTable tbody tr.is-editing{
  outline:2px solid rgba(37,99,235,.18);
  outline-offset:-2px;
}
@media (max-width: 1380px){
  .ops-hero-bar{flex-direction:column;}
  .ops-hero-stats{grid-template-columns:repeat(3,minmax(0,1fr));min-width:0;}
  .ops-grid-shell{grid-template-columns:1fr;}
  .ops-card-rates,.ops-card-opslist,.ops-card-editor,.ops-card-rules{grid-column:auto;}
}
@media (max-width: 820px){
  .ops-hero-title{font-size:22px;}
  .ops-hero-stats{grid-template-columns:1fr;}
  #view-ops .row{grid-template-columns:1fr;}
  .ops-card-head{flex-direction:column;}
  .ops-card-actions{justify-content:flex-start;}
}


/* === ARCYDZIELO: command center + premium summaries === */
.command-grid{display:grid;grid-template-columns:1.2fr .9fr;gap:16px;align-items:start;margin-top:18px}
.command-card{min-height:100%}
.quick-actions-card{grid-column:1 / -1}
.quick-action-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.quick-action-tile{appearance:none;border:1px solid rgba(199,214,230,.95);background:linear-gradient(180deg,#ffffff,#f7fbff);border-radius:20px;padding:18px;text-align:left;display:grid;gap:8px;cursor:pointer;box-shadow:0 10px 24px rgba(15,23,42,.05);transition:.18s ease;color:var(--text)}
.quick-action-tile:hover{transform:translateY(-2px);border-color:#b9d2ec;box-shadow:0 18px 34px rgba(15,23,42,.08)}
.quick-action-kicker{font-size:11px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#7287a1}
.quick-action-tile strong{font-size:20px;line-height:1.1}
.quick-action-tile span:last-child{font-size:13px;color:var(--muted);line-height:1.45}
.cc-stats-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.cc-stat{border:1px solid rgba(215,225,236,.92);background:linear-gradient(180deg,#ffffff,#f7fbff);border-radius:18px;padding:14px 15px;box-shadow:0 8px 22px rgba(15,23,42,.04)}
.cc-stat-label{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#7187a0}
.cc-stat-value{font-size:28px;font-weight:900;line-height:1.05;margin-top:8px;color:#0f172a}
.cc-stat-sub{font-size:12px;color:#6f8398;margin-top:6px}
.cc-list{display:grid;gap:10px}
.cc-item{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:12px 14px;border-radius:16px;border:1px solid rgba(215,225,236,.92);background:linear-gradient(180deg,#ffffff,#f8fbff);box-shadow:0 6px 18px rgba(15,23,42,.04)}
.cc-item-main{display:grid;gap:4px;min-width:0}
.cc-item-title{font-weight:800;color:#112133}
.cc-item-sub{font-size:12px;color:#6f8398}
.cc-item-tag{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#6f8398;background:#eef4fb;border:1px solid #d9e5f2;border-radius:999px;padding:6px 9px;white-space:nowrap}
.cc-item-alert .cc-item-tag{background:#fff7ed;border-color:#fed7aa;color:#b45309}
.cc-item-empty{padding:14px 16px;border-radius:16px;border:1px dashed #cfdae7;background:linear-gradient(180deg,#fbfdff,#f5f9fd);color:#6f8398}
.flow-strip{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.flow-step{border:1px solid rgba(215,225,236,.92);background:linear-gradient(180deg,#ffffff,#f7fbff);border-radius:18px;padding:15px;display:grid;gap:7px;box-shadow:0 8px 22px rgba(15,23,42,.04)}
.flow-step span{font-size:11px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#7a8ea5}
.flow-step strong{font-size:17px}
.flow-step small{font-size:12px;color:#6f8398;line-height:1.45}
.premium-summary{display:grid;gap:12px;margin:14px 0 18px}
.premium-summary-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.premium-summary-6{grid-template-columns:repeat(6,minmax(0,1fr))}
.premium-metric{border:1px solid rgba(215,225,236,.92);background:linear-gradient(180deg,#ffffff,#f7fbff);border-radius:18px;padding:14px 15px;display:grid;gap:8px;box-shadow:0 8px 22px rgba(15,23,42,.04)}
.premium-metric span{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#7187a0}
.premium-metric strong{font-size:22px;line-height:1.1;color:#0f172a}
.premium-metric-strong{background:linear-gradient(180deg,#eff6ff,#dbeafe);border-color:#bfdbfe;box-shadow:0 12px 28px rgba(37,99,235,.10)}
.premium-metric-strong strong{color:#1d4ed8}
#productEditorModal .premium-summary,#formatkaEditorModal .premium-summary,#naEditorModal .premium-summary{position:relative;z-index:1}
@media (max-width:1180px){.command-grid{grid-template-columns:1fr}.cc-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.quick-action-grid,.flow-strip,.premium-summary-6{grid-template-columns:repeat(2,minmax(0,1fr))}.premium-summary-4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:720px){.quick-action-grid,.flow-strip,.cc-stats-grid,.premium-summary-6,.premium-summary-4{grid-template-columns:1fr}}
body.theme-dark .quick-action-tile,body.theme-dark .cc-stat,body.theme-dark .cc-item,body.theme-dark .flow-step,body.theme-dark .premium-metric{background:linear-gradient(180deg,#142132,#0f1827);border-color:#2c3d55;box-shadow:none}
body.theme-dark .quick-action-kicker,body.theme-dark .cc-stat-label,body.theme-dark .cc-stat-sub,body.theme-dark .cc-item-sub,body.theme-dark .flow-step span,body.theme-dark .flow-step small,body.theme-dark .premium-metric span{color:#9cb0c6}
body.theme-dark .quick-action-tile strong,body.theme-dark .cc-stat-value,body.theme-dark .cc-item-title,body.theme-dark .flow-step strong,body.theme-dark .premium-metric strong{color:#edf4ff}
body.theme-dark .cc-item-tag{background:#172437;border-color:#32455f;color:#c6dbf3}
body.theme-dark .cc-item-alert .cc-item-tag{background:#3a2312;border-color:#74401e;color:#ffd29b}
body.theme-dark .cc-item-empty{border-color:#32455f;background:linear-gradient(180deg,#111c2d,#0f1827);color:#9cb0c6}
body.theme-dark .premium-metric-strong{background:linear-gradient(180deg,#173152,#122843);border-color:#4f79b9}
body.theme-dark .premium-metric-strong strong{color:#d9eaff}


.premium-summary-5{grid-template-columns:repeat(5,minmax(0,1fr))}
.decision-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:14px}
.decision-card{border:1px solid rgba(215,225,236,.92);background:linear-gradient(180deg,#ffffff,#f7fbff);border-radius:18px;padding:14px 15px;display:grid;gap:7px;box-shadow:0 8px 22px rgba(15,23,42,.04)}
.decision-card span{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#7187a0}
.decision-card strong{font-size:20px;line-height:1.1;color:#0f172a}
.decision-card small{font-size:12px;line-height:1.45;color:#6f8398}
.decision-card-strong{background:linear-gradient(180deg,#eff6ff,#dbeafe);border-color:#bfdbfe;box-shadow:0 12px 28px rgba(37,99,235,.10)}
.decision-card-strong strong{color:#1d4ed8}
.editor-section-shell{border:1px solid rgba(215,225,236,.9);border-radius:20px;padding:14px 15px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(246,250,254,.98));box-shadow:0 8px 22px rgba(15,23,42,.04)}
.editor-section-shell + .editor-section-shell{margin-top:14px}
.editor-section-shell .card-h.small{font-size:15px;margin-bottom:10px}
#circleCalcModal .calc-hero-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-bottom:14px}
#circleCalcModal .calc-hero-card{border:1px solid rgba(215,225,236,.92);background:linear-gradient(180deg,#ffffff,#f7fbff);border-radius:18px;padding:14px 15px;display:grid;gap:7px;box-shadow:0 8px 22px rgba(15,23,42,.04)}
#circleCalcModal .calc-hero-card span{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#7187a0}
#circleCalcModal .calc-hero-card strong{font-size:21px;line-height:1.1;color:#0f172a}
#circleCalcModal .calc-hero-card small{font-size:12px;color:#6f8398;line-height:1.4}
#circleCalcModal .calc-hero-card-strong{background:linear-gradient(180deg,#eff6ff,#dbeafe);border-color:#bfdbfe;box-shadow:0 12px 28px rgba(37,99,235,.10)}
#circleCalcModal .calc-hero-card-strong strong{color:#1d4ed8}
@media (max-width:1180px){.decision-grid,.premium-summary-5,#circleCalcModal .calc-hero-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:720px){.decision-grid,.premium-summary-5,#circleCalcModal .calc-hero-grid{grid-template-columns:1fr}}
body.theme-dark .decision-card,body.theme-dark #circleCalcModal .calc-hero-card{background:linear-gradient(180deg,#142132,#0f1827);border-color:#2c3d55;box-shadow:none}
body.theme-dark .decision-card span,body.theme-dark .decision-card small,body.theme-dark #circleCalcModal .calc-hero-card span,body.theme-dark #circleCalcModal .calc-hero-card small{color:#9cb0c6}
body.theme-dark .decision-card strong,body.theme-dark #circleCalcModal .calc-hero-card strong{color:#edf4ff}
body.theme-dark .decision-card-strong,body.theme-dark #circleCalcModal .calc-hero-card-strong{background:linear-gradient(180deg,#173152,#122843);border-color:#4f79b9}
body.theme-dark .decision-card-strong strong,body.theme-dark #circleCalcModal .calc-hero-card-strong strong{color:#d9eaff}
body.theme-dark .editor-section-shell{background:linear-gradient(180deg,#111c2d,#0f1827);border-color:#2c3d55;box-shadow:none}


/* === Arcydzielo pass: wspolny rytm premium === */
.tabs{backdrop-filter: blur(10px);}
.modal-card-product{max-width:min(1500px,calc(100vw - 48px));}
.modal-card-product .modal-body{background:linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));}
.modal-card-product .card{
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 16px 44px rgba(0,0,0,.16);
}
.section-note{max-width:90ch; line-height:1.45;}
.premium-summary{
  margin:14px 0 18px;
  padding:12px;
  border-radius:22px;
  border:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06), 0 16px 34px rgba(0,0,0,.12);
}
.premium-metric{
  min-height:84px;
  justify-content:space-between;
}
.premium-metric span{font-size:12px; text-transform:uppercase; letter-spacing:.08em; opacity:.72;}
.premium-metric strong{font-size:22px; line-height:1.15;}
.premium-metric-strong{
  background:linear-gradient(180deg, rgba(34,197,94,.18), rgba(34,197,94,.08));
  border-color:rgba(34,197,94,.28);
}
.kpi,.kpi.slim{
  border-radius:18px;
  border:1px solid rgba(255,255,255,.07);
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
}
.table-wrap{
  border-radius:18px;
  overflow:auto;
  border:1px solid rgba(255,255,255,.07);
}
.table thead th{position:sticky; top:0; z-index:1; backdrop-filter:blur(12px);}
.decision-card{
  border:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  box-shadow:0 14px 30px rgba(0,0,0,.10);
}
.calc-hero-card{
  border-radius:20px;
  border:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}
.calc-hero-card-strong{
  border-color:rgba(34,197,94,.28);
  background:linear-gradient(180deg, rgba(34,197,94,.18), rgba(34,197,94,.08));
}
.start-hero.card,
.command-card,
.ops-card{
  box-shadow:0 18px 44px rgba(0,0,0,.14);
}


.modal[data-dirty="true"] .modal-card{
  box-shadow: 0 28px 70px rgba(15,23,42,.22), 0 0 0 1px rgba(248,113,113,.20);
}
.modal[data-dirty="true"] .modal-title::after{
  content: " • niezapisane";
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--danger, #dc2626);
}


/* --- FORMATIX premium evolution: module chrome + modal state --- */
.module-hero-card{
  display:grid;
  grid-template-columns:minmax(260px,1.35fr) minmax(220px,0.95fr) auto;
  gap:18px;
  align-items:center;
  padding:20px 22px;
  margin:0 0 18px;
  border:1px solid rgba(110,160,255,.18);
  border-radius:24px;
  background:linear-gradient(180deg, rgba(14,30,58,.94), rgba(10,23,44,.9));
  box-shadow:0 18px 48px rgba(3,10,24,.22), inset 0 1px 0 rgba(255,255,255,.04);
}
.theme-dark .module-hero-card{
  border-color:rgba(133,177,255,.18);
  background:linear-gradient(180deg, rgba(10,25,48,.98), rgba(6,16,33,.98));
  box-shadow:0 20px 54px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
}
.module-hero-kicker{
  font-size:11px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:rgba(195,214,255,.72);
  margin-bottom:8px;
}
.module-hero-title{
  margin:0;
  font-size:30px;
  line-height:1.05;
  color:#f6fbff;
}
.module-hero-subtitle{
  margin-top:8px;
  color:rgba(215,228,255,.82);
  max-width:760px;
}
.module-hero-stats{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.module-hero-stat{
  padding:12px 14px;
  border-radius:18px;
  border:1px solid rgba(135,176,255,.14);
  background:rgba(255,255,255,.045);
}
.module-hero-stat span{
  display:block;
  font-size:12px;
  color:rgba(198,215,250,.74);
  margin-bottom:4px;
}
.module-hero-stat strong{
  display:block;
  font-size:18px;
  color:#fff;
}
.module-hero-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:10px;
}
.module-hero-action{ white-space:nowrap; }
.modal-state-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(131,170,247,.18);
  background:rgba(255,255,255,.055);
  font-size:12px;
  font-weight:800;
  letter-spacing:.03em;
  color:var(--text);
}
.modal-state-badge.is-clean{
  color:#9ab4d7;
}
.modal-state-badge.is-dirty{
  color:#fff4ca;
  border-color:rgba(255,214,102,.36);
  background:linear-gradient(180deg, rgba(255,214,102,.22), rgba(255,175,52,.12));
}
.modal-head .modal-state-badge{
  margin-left:10px;
}
#view-products,
#view-formatki,
#view-naWymiar,
#view-sales,
#view-materials,
#view-circles,
#view-spools,
#view-rozkroje,
#view-rates,
#view-ops,
#view-measure,
#view-help{
  display:flex;
  flex-direction:column;
  gap:18px;
}
@media (max-width: 1180px){
  .module-hero-card{
    grid-template-columns:1fr;
  }
  .module-hero-actions{
    justify-content:flex-start;
  }
}
@media (max-width: 720px){
  .module-hero-title{ font-size:24px; }
  .module-hero-stats{ grid-template-columns:1fr; }
  .module-hero-card{ padding:18px; border-radius:20px; }
}


/* --- FORMATIX premium evolution: rowny standard paneli --- */
.module-panel-card{
  position:relative;
  overflow:hidden;
}
.module-panel-rail{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin:-2px 0 14px;
  padding:0 0 14px;
  border-bottom:1px solid rgba(136,161,196,.18);
}
.module-panel-rail-main{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
}
.module-panel-pill{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid rgba(110,160,255,.18);
  background:rgba(66,132,255,.08);
  color:#6b8fcf;
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.module-panel-name{
  font-size:18px;
  line-height:1.2;
  color:#132238;
}
.module-panel-note{
  max-width:520px;
  color:#6d8099;
  font-size:13px;
  line-height:1.45;
  text-align:right;
}
.module-panel-title-source{
  display:none !important;
}
.editor-section-shell.module-panel-card > .toolbar:first-of-type,
.module-panel-card > .toolbar:first-of-type,
.module-panel-card > .toolbar-stack:first-of-type{
  margin-top:2px;
}
.theme-dark .module-panel-rail{
  border-bottom-color:rgba(136,161,196,.16);
}
.theme-dark .module-panel-pill{
  border-color:rgba(133,177,255,.22);
  background:rgba(88,140,255,.12);
  color:#b8ceff;
}
.theme-dark .module-panel-name{
  color:#edf4ff;
}
.theme-dark .module-panel-note{
  color:#9cb0c6;
}
@media (max-width: 900px){
  .module-panel-rail{
    flex-direction:column;
    align-items:flex-start;
  }
  .module-panel-note{
    text-align:left;
    max-width:none;
  }
}

/* ===== OPERACJE / SYSTEM CHROME OVERRIDE 2026-03-24 ===== */
#view-ops{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:16px !important;
  align-items:start;
}
#view-ops > .grid2{display:block !important;}
#view-ops .ops-hero-bar,
#view-ops .ops-card{
  border:1px solid rgba(110,160,255,.16) !important;
  background:linear-gradient(180deg, rgba(14,30,58,.94), rgba(10,23,44,.90)) !important;
  box-shadow:0 18px 48px rgba(3,10,24,.24), inset 0 1px 0 rgba(255,255,255,.04) !important;
  color:#e8eefc;
}
.theme-dark #view-ops .ops-hero-bar,
.theme-dark #view-ops .ops-card{
  border-color:rgba(133,177,255,.16) !important;
  background:linear-gradient(180deg, rgba(10,25,48,.98), rgba(6,16,33,.98)) !important;
  box-shadow:0 20px 54px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.04) !important;
}
#view-ops .ops-hero-bar{
  display:grid !important;
  grid-template-columns:minmax(360px,1.35fr) minmax(280px,.95fr) !important;
  gap:18px !important;
  padding:20px 22px !important;
  border-radius:24px !important;
  align-items:center !important;
}
#view-ops .ops-eyebrow{
  color:#7dd3fc !important;
  letter-spacing:.16em !important;
}
#view-ops .ops-hero-title{
  margin:0 !important;
  color:#f8fbff !important;
  font-size:28px !important;
  line-height:1.05 !important;
  letter-spacing:-.03em !important;
}
#view-ops .ops-hero-subtitle{
  color:#9fb1cc !important;
  font-size:14px !important;
  max-width:900px !important;
}
#view-ops .ops-hero-stats{
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:12px !important;
  min-width:0 !important;
}
#view-ops .ops-stat-card{
  padding:14px 16px !important;
  border-radius:18px !important;
  border:1px solid rgba(120,170,255,.16) !important;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03)) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03) !important;
}
#view-ops .ops-stat-label,
#view-ops .ops-rule-k{
  color:#8ea6c8 !important;
}
#view-ops .ops-stat-value,
#view-ops .ops-hero-title,
#view-ops .ops-rule-v,
#view-ops .ops-card .card-h,
#view-ops .ops-editor-badge{
  color:#f8fbff !important;
}
#view-ops .ops-grid-shell{
  display:grid !important;
  grid-template-columns:minmax(360px,.98fr) minmax(480px,1.22fr) !important;
  gap:16px !important;
  align-items:start !important;
}
#view-ops .ops-card{
  padding:18px !important;
  border-radius:22px !important;
  min-height:unset !important;
}
#view-ops .ops-card-head{
  display:flex !important;
  justify-content:space-between !important;
  align-items:flex-start !important;
  gap:12px !important;
  margin-bottom:14px !important;
}
#view-ops .ops-card .card-h{
  margin:0 0 4px !important;
  padding:0 !important;
  border:none !important;
}
#view-ops .ops-card .muted,
#view-ops .ops-note,
#view-ops .note,
#view-ops .section-note{
  color:#93a8c6 !important;
}
#view-ops .ops-card-actions{gap:8px !important;flex-wrap:wrap !important;}
#view-ops .ops-table-wrap,
#view-ops .ops-table-wrap-wide,
#view-ops .table-wrap{
  max-height:430px !important;
  overflow:auto !important;
  border:1px solid rgba(120,170,255,.10) !important;
  border-radius:16px !important;
  background:rgba(6,16,33,.34) !important;
}
#view-ops table{
  background:transparent !important;
}
#view-ops thead th{
  background:rgba(12,27,49,.92) !important;
  color:#9fb6d7 !important;
  border-bottom:1px solid rgba(120,170,255,.12) !important;
}
#view-ops tbody td{
  color:#e6eefc !important;
  border-bottom:1px solid rgba(120,170,255,.08) !important;
}
#view-ops tbody tr:hover td{
  background:rgba(255,255,255,.03) !important;
}
#view-ops #opTable tbody tr.is-editing td,
#view-ops #rateTable tbody tr.is-editing td{
  background:rgba(59,130,246,.14) !important;
}
#view-ops #opTable tbody tr.is-editing,
#view-ops #rateTable tbody tr.is-editing{
  outline:1px solid rgba(96,165,250,.34) !important;
  outline-offset:-1px !important;
}
#view-ops input,
#view-ops select,
#view-ops textarea{
  background:rgba(7,18,36,.92) !important;
  border:1px solid rgba(120,170,255,.14) !important;
  color:#f8fbff !important;
  box-shadow:none !important;
}
#view-ops input::placeholder,
#view-ops textarea::placeholder{color:#6f88aa !important;}
#view-ops input:focus,
#view-ops select:focus,
#view-ops textarea:focus{
  border-color:rgba(74,222,128,.44) !important;
  box-shadow:0 0 0 3px rgba(34,197,94,.12) !important;
}
#view-ops .row{
  grid-template-columns:170px minmax(0,1fr) !important;
  gap:12px !important;
  padding:10px 0 !important;
  border-bottom:1px solid rgba(120,170,255,.08) !important;
}
#view-ops .row label{color:#9fb1cc !important;font-weight:700 !important;}
#view-ops .ops-editor-badge{
  background:rgba(34,197,94,.14) !important;
  border:1px solid rgba(74,222,128,.24) !important;
}
#view-ops .ops-rule-stack{gap:10px !important;}
#view-ops .ops-rule-item{
  padding:14px 16px !important;
  border-radius:16px !important;
  border:1px solid rgba(120,170,255,.10) !important;
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)) !important;
}
#view-ops .ops-note{
  margin-top:12px !important;
  padding:10px 12px !important;
  border-radius:14px !important;
  background:rgba(255,255,255,.03) !important;
  border:1px solid rgba(120,170,255,.08) !important;
}
@media (max-width: 1280px){
  #view-ops .ops-hero-bar,
  #view-ops .ops-grid-shell{grid-template-columns:1fr !important;}
}
@media (max-width: 820px){
  #view-ops .ops-hero-stats{grid-template-columns:1fr !important;}
  #view-ops .row{grid-template-columns:1fr !important;}
  #view-ops .ops-card-head{flex-direction:column !important;}
  #view-ops .ops-card-actions{justify-content:flex-start !important;}
}


/* === 2026-03-24: jasne napisy w listach import/export === */
body.theme-dark .hub-panel-title{
  color:#b7c9dd !important;
}
body.theme-dark .hub-item{
  color:#eef4fb !important;
}
body.theme-dark .hub-item span:last-child{
  color:#eef4fb !important;
}
body.theme-dark .hub-item-icon{
  background:#e9f1ff !important;
  color:#17314f !important;
}
body.theme-dark .hub-item:hover{
  background:#16273c !important;
  border-color:#416389 !important;
}

.cp-thickness-options{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.cp-thickness-options .chip-check{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;border:1px solid rgba(148,163,184,.26);background:rgba(15,23,42,.04);cursor:pointer;font-weight:700}
.cp-thickness-options .chip-check input{margin:0}
.cp-thickness-options .chip-check.active{border-color:rgba(34,197,94,.38);background:rgba(34,197,94,.10)}
body.theme-dark .cp-thickness-options .chip-check{background:rgba(15,23,42,.55)}
body.theme-dark .cp-thickness-options .chip-check.active{background:rgba(34,197,94,.14)}


/* === 20260324 circles matrix visibility tweak === */
#view-circles .circles-table-wrap{
  max-height:68vh !important;
}
#view-circles .circles-table{
  min-width:1020px;
}
#view-circles .circles-table th,
#view-circles .circles-table td{
  min-width:138px;
}
#view-circles .circles-table .sticky-col{
  min-width:180px;
}
#view-circles .circles-cell{
  padding-top:12px;
  padding-bottom:46px;
  min-height:92px;
}
#view-circles .circles-cell .main{
  font-size:17px;
  line-height:1.12;
}
#view-circles .circles-cell .cell-indicators{
  bottom:6px;
  gap:6px;
}
#view-circles .circles-cell .indicator-badge{
  width:18px;
  height:18px;
  font-size:10px;
}
@media (max-width: 1280px){
  #view-circles .circles-table th,
  #view-circles .circles-table td{min-width:126px;}
}


/* === Entity report modal === */
#entityReportModal{
  position:fixed;
  inset:0;
  z-index:13050;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:22px;
}
#entityReportModal.hidden{display:none !important;}
#entityReportModal .modal-backdrop{
  position:absolute; inset:0; background:rgba(15,23,42,.42); backdrop-filter:blur(6px) saturate(120%);
}
#entityReportModal .modal-card-report{
  position:relative; z-index:1; width:min(1180px, calc(100vw - 44px)); max-height:calc(100dvh - 44px); overflow:auto;
  border-radius:30px; border:1px solid rgba(201,215,232,.92);
  background:linear-gradient(180deg,rgba(255,255,255,.985),rgba(245,249,255,.97));
  box-shadow:0 34px 90px rgba(15,23,42,.22);
}
#entityReportModal .modal-head{position:sticky; top:0; z-index:2; background:rgba(255,255,255,.92); backdrop-filter:blur(12px);}
#entityReportBody{display:grid; gap:18px;}
.report-kpis{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px;}
.report-kpi{padding:16px 18px; border:1px solid var(--line); border-radius:20px; background:linear-gradient(180deg,#fff,#f8fbff); box-shadow:0 10px 24px rgba(15,23,42,.04);}
.report-kpi span{display:block; font-size:12px; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); font-weight:800; margin-bottom:6px;}
.report-kpi strong{display:block; font-size:28px; line-height:1.1; color:#102136;}
.report-kpi small{display:block; margin-top:6px; color:var(--muted);}
.report-grid{display:grid; grid-template-columns:1.1fr .9fr; gap:18px;}
.report-section{padding:18px 20px; border:1px solid var(--line); border-radius:22px; background:linear-gradient(180deg,#fff,#f8fbff); box-shadow:0 10px 26px rgba(15,23,42,.04);}
.report-section h3{margin:0 0 12px; font-size:15px;}
.report-list{display:grid; gap:10px;}
.report-row{display:flex; justify-content:space-between; gap:14px; align-items:flex-start; padding:9px 0; border-bottom:1px dashed #dbe4ef;}
.report-row:last-child{border-bottom:none;}
.report-row-main{min-width:0;}
.report-row-title{font-weight:800; color:#122033;}
.report-row-sub{margin-top:3px; font-size:12px; color:var(--muted); line-height:1.4;}
.report-row-value{white-space:nowrap; text-align:right; font-weight:800; color:#102136;}
.report-tree{display:grid; gap:10px;}
.report-node{border:1px solid #dbe4ef; border-radius:18px; background:linear-gradient(180deg,#fff,#fbfdff); padding:14px 16px;}
.report-node-head{display:flex; justify-content:space-between; gap:12px; align-items:flex-start;}
.report-node-title{font-weight:900; color:#0f172a;}
.report-node-meta{margin-top:4px; font-size:12px; color:var(--muted);}
.report-node-kpis{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px;}
.report-pill{display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; background:#eef4ff; border:1px solid #d7e5ff; color:#234; font-size:12px; font-weight:800;}
.report-children{display:grid; gap:10px; margin-top:12px; padding-left:18px; border-left:2px solid #e7edf6;}
.report-empty{padding:14px 16px; border-radius:16px; border:1px dashed #d7e2ef; color:var(--muted); background:#f8fbff;}
@media (max-width:980px){
  #entityReportModal{padding:10px;}
  #entityReportModal .modal-card-report{width:min(100vw - 20px, 1180px); max-height:calc(100dvh - 20px);}
  .report-kpis, .report-grid{grid-template-columns:1fr;}
}

/* ===== mobile browser shell 2026-03-26 ===== */
.mobile-menu-toggle{display:none;white-space:nowrap;min-height:40px;padding:0 14px;font-weight:800}
.mobile-nav-backdrop{display:none}

@media (max-width: 900px){
  .mobile-menu-toggle{display:inline-flex;align-items:center;justify-content:center}
  .brand-minimal{flex-wrap:wrap}
  .logo-minimal,.brand-copy{display:none}
  .topbar{position:sticky;top:0;left:0;right:0;z-index:220;padding:12px 14px !important}
  .top-actions{width:100%;overflow:auto;flex-wrap:nowrap;padding:6px 0 0;border:none;background:transparent;box-shadow:none}
  .top-actions .btn{flex:0 0 auto}
  .mobile-nav-backdrop{display:block;position:fixed;inset:0;background:rgba(15,23,42,.42);backdrop-filter:blur(3px);z-index:209}
  .mobile-nav-backdrop.hidden{display:none !important}

  .tabs{
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    bottom:0 !important;
    width:min(82vw,320px) !important;
    height:100dvh;
    padding:18px 12px 18px !important;
    flex-direction:column !important;
    flex-wrap:nowrap !important;
    align-items:stretch !important;
    gap:8px !important;
    border-right:1px solid #dde5ef;
    border-bottom:none !important;
    box-shadow:0 20px 60px rgba(15,23,42,.22);
    background:linear-gradient(180deg,#f8fafc 0%,#f1f5f9 100%);
    overflow:auto;
    transform:translateX(-104%);
    transition:transform .2s ease;
    z-index:210;
  }
  body.mobile-nav-open .tabs{transform:translateX(0)}
  .tab{width:100% !important;justify-content:flex-start !important}
  .wrap{padding:14px !important}

  /* tylko zakladki telefoniczne */
  .tab[data-view="sales"],
  .tab[data-view="rates"],
  .tab[data-view="ops"],
  .tab[data-view="measure"],
  .tab[data-view="help"]{display:none !important}

  /* bardziej telefoniczne karty */
  .card{padding:14px;border-radius:18px}
  .section-note{font-size:12px;line-height:1.45}
  .toolbar,.toolbar-row,.products-actions-row,.products-filters-row,.na-toolbar-row{display:flex !important;flex-direction:column;align-items:stretch;gap:10px}
  .toolbar input,.toolbar select,.toolbar .btn,.toolbar .inline,.products-actions-row .btn,.products-filters-row input,.products-filters-row select{width:100%;max-width:none !important}
  .products-actions-row .btn,.top-actions .btn,.actions .btn{min-height:44px}
  .table-wrap{max-height:none !important;overflow:auto}

  /* modale i edytory fullscreen na telefonie */
  #productEditorModal,
  #formatkaEditorModal,
  #naEditorModal,
  #materialEditorModal,
  #extraMaterialEditorModal,
  #tubeEditorModal,
  #spoolEditorModal,
  #cutplanEditorModal,
  #circleCalcModal{
    inset:0 !important;
    padding:0 !important;
    z-index:23000 !important;
  }
  #productEditorModal .modal-card,
  #formatkaEditorModal .modal-card,
  #naEditorModal .modal-card,
  #materialEditorModal .modal-card,
  #extraMaterialEditorModal .modal-card,
  #tubeEditorModal .modal-card,
  #spoolEditorModal .modal-card,
  #cutplanEditorModal .modal-card,
  #circleCalcModal .modal-card,
  #productEditorModal .modal-card-product,
  #formatkaEditorModal .modal-card-product,
  #naEditorModal .modal-card-product,
  #materialEditorModal .modal-card-product,
  #extraMaterialEditorModal .modal-card-product,
  #tubeEditorModal .modal-card-product,
  #spoolEditorModal .modal-card-product,
  #cutplanEditorModal .modal-card-product{
    width:100vw !important;
    max-width:100vw !important;
    height:100dvh !important;
    max-height:100dvh !important;
    margin:0 !important;
    border-radius:0 !important;
    border:none !important;
  }
  #productEditorModal .modal-body,
  #formatkaEditorModal .modal-body,
  #naEditorModal .modal-body,
  #materialEditorModal .modal-body,
  #extraMaterialEditorModal .modal-body,
  #tubeEditorModal .modal-body,
  #spoolEditorModal .modal-body,
  #cutplanEditorModal .modal-body,
  #circleCalcModal .modal-body{padding:14px !important}
  #productEditorModal .grid2,
  #formatkaEditorModal .grid2,
  #naEditorModal .grid2,
  #materialEditorModal .grid2,
  #extraMaterialEditorModal .grid2,
  #tubeEditorModal .grid2,
  #spoolEditorModal .grid2,
  #cutplanEditorModal .grid2,
  #circleCalcModal .grid2{grid-template-columns:1fr !important;gap:14px !important}
  #productEditorModal .row,
  #formatkaEditorModal .row,
  #naEditorModal .row,
  #materialEditorModal .row,
  #extraMaterialEditorModal .row,
  #tubeEditorModal .row,
  #spoolEditorModal .row,
  #cutplanEditorModal .row,
  #circleCalcModal .row{grid-template-columns:1fr !important;gap:8px !important}

  /* start i widoki */
  .quick-action-grid,.dashboard-grid,.command-grid,.na-summary-grid,.decision-grid{grid-template-columns:1fr !important}
  .start-search-shell{display:flex;gap:8px;align-items:center}
  .start-search-input{font-size:16px;min-width:0}
}

/* ONLINE STATUS */
.server-status-wrap{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.server-status-chip{display:flex;flex-direction:column;justify-content:center;min-width:150px;padding:6px 12px;border:1px solid rgba(84,134,255,.25);border-radius:16px;background:rgba(9,20,44,.72)}
.server-status-badge{font-weight:800;font-size:12px;letter-spacing:.08em;text-transform:uppercase}
.server-status-meta{font-size:11px;opacity:.72;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}
.server-status-badge.is-ok{color:#86efac}
.server-status-badge.is-warn{color:#fde68a}
.server-status-badge.is-bad{color:#fca5a5}
.server-status-badge.is-offline{color:#cbd5e1}
@media (max-width: 900px){
  .server-status-wrap{width:100%;order:99}
  .server-status-chip{flex:1;min-width:0}
  .server-status-meta{max-width:none}
}


/* === 20260326 header minimal + mobile polish === */
#btnExport,
#btnImport,
#btnRememberKey,
#btnReset,
.quick-actions-card{
  display:none !important;
}

.topbar{
  padding:12px 18px !important;
}
.top-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  width:auto;
  padding:8px 10px;
  border:1px solid rgba(205,216,231,.88);
  border-radius:22px;
  background:linear-gradient(180deg,rgba(255,255,255,.90),rgba(245,249,255,.86));
  box-shadow:0 16px 34px rgba(15,23,42,.07);
  backdrop-filter:blur(14px);
}
.hub-wrap{order:1;}
.server-status-wrap{
  order:2;
  display:grid;
  grid-template-columns:minmax(190px,1fr) auto auto;
  align-items:center;
  gap:8px;
  min-width:min(520px,58vw);
}
.server-status-chip{
  min-width:0;
  padding:8px 12px;
  border-radius:18px;
  border:1px solid rgba(96,165,250,.18);
  background:linear-gradient(180deg,rgba(7,15,28,.96),rgba(11,25,46,.92));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 10px 24px rgba(15,23,42,.12);
}
.server-status-badge{
  font-size:11px;
  letter-spacing:.16em;
}
.server-status-meta{
  margin-top:3px;
  font-size:11px;
  line-height:1.25;
  color:rgba(226,232,240,.78);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:none;
}
#btnSaveNow,
#btnHistoryOpen,
#btnThemeToggle,
.btn-icon-hub{
  min-height:42px;
  border-radius:16px;
}
#btnSaveNow,
#btnHistoryOpen{
  padding:0 14px;
  white-space:nowrap;
}
#btnThemeToggle{
  order:3;
  width:42px;
  min-width:42px;
  padding:0;
  justify-content:center;
}
#btnThemeToggle .theme-toggle-label,
#btnThemeToggle .btn-glyph + span{
  display:none !important;
}
#btnThemeToggle .btn-glyph{
  margin:0 !important;
  font-size:17px;
}
.btn-icon-hub{
  min-width:46px;
  padding:0 14px;
  gap:8px;
}
.hub-label{
  font-size:13px;
}
.start-stage .command-grid{
  grid-template-columns:1fr .95fr;
}
.start-stage .quick-actions-card + .command-card{
  grid-column:auto;
}

@media (max-width: 1200px){
  .server-status-wrap{
    min-width:0;
    grid-template-columns:minmax(180px,1fr) auto auto;
  }
}

@media (max-width: 900px){
  .topbar{
    padding:10px 12px !important;
  }
  .top-actions{
    width:100%;
    display:grid;
    grid-template-columns:1fr auto auto;
    gap:8px;
    padding:8px;
    overflow:visible;
    border:1px solid rgba(205,216,231,.72);
    border-radius:18px;
    background:linear-gradient(180deg,rgba(255,255,255,.90),rgba(247,250,255,.86));
    box-shadow:0 12px 26px rgba(15,23,42,.06);
  }
  .hub-wrap{order:1;}
  .server-status-wrap{
    order:2;
    grid-column:1 / -1;
    grid-template-columns:1fr auto auto;
    width:100%;
  }
  .server-status-chip{
    padding:9px 12px;
    border-radius:16px;
  }
  .server-status-meta{
    font-size:10px;
  }
  #btnSaveNow,
  #btnHistoryOpen{
    min-width:42px;
    padding:0 12px;
  }
  #btnSaveNow span:last-child,
  #btnHistoryOpen span:last-child{
    display:none;
  }
  #btnSaveNow .btn-glyph,
  #btnHistoryOpen .btn-glyph{
    margin:0;
    font-size:15px;
  }
  .btn-icon-hub{
    min-width:44px;
    padding:0 12px;
  }
  .hub-label{
    display:none;
  }
  #btnThemeToggle{
    width:44px;
    min-width:44px;
    justify-self:end;
  }
}

@media (max-width: 640px){
  .top-actions{
    grid-template-columns:1fr auto auto auto;
    align-items:stretch;
  }
  .server-status-wrap{
    grid-column:1 / -1;
    grid-template-columns:1fr auto auto;
  }
  .server-status-chip{
    min-height:42px;
  }
}


/* na wymiar final tidy */
#btnNaAddCustomCurrent,
#naCurrentTable [data-na-cur-copy]{display:none !important;}
#naCurrentTable [data-na-cur-qty]{min-width:98px !important; width:98px !important;}
#view-naWymiar .na-actions-col{gap:0;}
#view-naWymiar .na-board-stage{background:linear-gradient(180deg,#f8fbfc,#edf3f9);}
#view-naWymiar .na-piece{border-radius:10px; box-shadow:inset 0 1px 0 rgba(255,255,255,.35);}


/* Auth + role access */
.auth-card .auth-form{ display:grid; gap:10px; margin-top:14px; }
.auth-card .input{ width:100%; padding:12px 14px; border-radius:12px; border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.06); color:inherit; }
.auth-user-chip{ min-width:160px; }
.role-panel-readonly{ position:relative; }
.role-panel-readonly::after{ content:"Tylko podgląd"; position:absolute; top:10px; right:10px; padding:6px 10px; border-radius:999px; background:rgba(255,180,0,.15); border:1px solid rgba(255,180,0,.35); font-size:12px; }
body.role-readonly .btn:not(#btnLogoutTop):not([data-view]):not([data-mobile-view]),
body.role-readonly input,
body.role-readonly textarea,
body.role-readonly select{ pointer-events:none; opacity:.75; }
body.role-readonly #tabs .tab, body.role-readonly .mobile-dock-btn, body.role-readonly #btnLogoutTop{ pointer-events:auto; opacity:1; }
body.role-readonly .table tbody tr{ pointer-events:none; }
body.role-readonly #view-quotes .btn,
body.role-readonly #view-quotes input,
body.role-readonly #view-quotes textarea,
body.role-readonly #view-quotes select,
body.role-readonly #view-quotes .table tbody tr,
body.role-readonly #view-quotes .quote-list-row{
  pointer-events:auto !important;
  opacity:1 !important;
}

.subqueue-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid rgba(255,255,255,.08)}
.subqueue-actions{display:flex;gap:8px;flex-wrap:wrap}
.users-admin-grid{align-items:start}
#usersTable input,#usersTable select{min-width:150px}
#usersTable .inline{justify-content:flex-start;gap:6px;flex-wrap:nowrap}
#userPasswordResult b{user-select:all}
.status-pill{display:inline-flex;align-items:center;margin-top:6px;padding:4px 8px;border-radius:999px;font-size:11px;font-weight:800;letter-spacing:.02em;text-transform:uppercase}
.status-draft{color:#f6c453;background:rgba(246,196,83,.14);border:1px solid rgba(246,196,83,.28)}

.mobile-life-shell{ display:none !important; }
body.role-readonly #startGlobalSearch,
body.role-readonly #prodSearch,
body.role-readonly #formatkiSearch,
body.role-readonly #naSearch,
body.role-readonly #matSearch,
body.role-readonly #extraMatSearch,
body.role-readonly #tubeSearch,
body.role-readonly #spoolSearch,
body.role-readonly #cutplanSearch,
body.role-readonly #btnStartSearchClear{ pointer-events:auto !important; opacity:1 !important; }
.diff-group{ padding:12px 0; border-bottom:1px solid rgba(255,255,255,.08); }
.diff-columns{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-top:10px; }
.diff-columns ul{ margin:8px 0 0 18px; }
@media (max-width: 900px){ .diff-columns{ grid-template-columns:1fr; } }


/* ===== REPORT SYSTEM REPAIR ===== */
#entityReportModal{
  position:fixed;
  inset:var(--header-h) 0 0 var(--sidebar-w);
  z-index:13050;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:18px;
}
#entityReportModal.hidden{display:none !important;}
#entityReportModal .modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.44);
  backdrop-filter:blur(6px) saturate(120%);
}
#entityReportModal .modal-card-report{
  position:relative;
  z-index:1;
  width:min(1320px, calc(100% - 12px));
  max-height:calc(100dvh - var(--header-h) - 36px);
  overflow:auto;
  border-radius:28px;
  border:1px solid rgba(197,211,226,.96);
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,250,255,.98));
  box-shadow:0 34px 90px rgba(15,23,42,.22);
}
#entityReportModal .modal-head{
  position:sticky;
  top:0;
  z-index:2;
  padding:18px 22px;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);
}
#entityReportBody{display:grid;gap:18px;padding:22px;}
.report-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.report-kpi{padding:16px 18px;border:1px solid var(--line);border-radius:20px;background:linear-gradient(180deg,#fff,#f8fbff);box-shadow:0 10px 24px rgba(15,23,42,.04);}
.report-kpi span{display:block;font-size:12px;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);font-weight:800;margin-bottom:6px;}
.report-kpi strong{display:block;font-size:28px;line-height:1.1;color:#102136;}
.report-kpi small{display:block;margin-top:6px;color:var(--muted);}
.report-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;}
.report-grid-3{grid-template-columns:repeat(3,minmax(0,1fr));}
.report-section{padding:18px 20px;border:1px solid var(--line);border-radius:22px;background:linear-gradient(180deg,#fff,#f8fbff);box-shadow:0 10px 26px rgba(15,23,42,.04);}
.report-section-span-2{grid-column:span 2;}
.report-section-span-3{grid-column:1 / -1;}
.report-section h3{margin:0 0 12px;font-size:15px;}
.report-list{display:grid;gap:10px;}
.report-row{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:9px 0;border-bottom:1px dashed #dbe4ef;}
.report-row:last-child{border-bottom:none;}
.report-row-main{min-width:0;}
.report-row-title{font-weight:800;color:#122033;}
.report-row-sub{margin-top:3px;font-size:12px;color:var(--muted);line-height:1.4;}
.report-row-value{text-align:right;font-weight:800;color:#102136;}
.report-tree{display:grid;gap:10px;}
.report-node{border:1px solid #dbe4ef;border-radius:18px;background:linear-gradient(180deg,#fff,#fbfdff);padding:14px 16px;}
.report-node-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;}
.report-node-title{font-weight:900;color:#0f172a;}
.report-node-meta{margin-top:4px;font-size:12px;color:var(--muted);}
.report-node-kpis{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;}
.report-pill{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;background:#eef4ff;border:1px solid #d7e5ff;color:#234;font-size:12px;font-weight:800;}
.report-children{display:grid;gap:10px;margin-top:12px;padding-left:18px;border-left:2px solid #e7edf6;}
.report-empty{padding:14px 16px;border-radius:16px;border:1px dashed #d7e2ef;color:var(--muted);background:#f8fbff;}
.report-cutplan-table-wrap{max-height:none;overflow:auto;}
.report-cutplan-table{min-width:960px;}
.report-export-surface{background:#fff;color:#111;}
@media (max-width: 1140px){
  #entityReportModal{inset:0 !important;padding:10px;}
  #entityReportModal .modal-card-report{width:min(100vw - 20px, 1180px);max-height:calc(100dvh - 20px);}
}
@media (max-width: 900px){
  .report-kpis,.report-grid,.report-grid-3{grid-template-columns:1fr;}
  .report-section-span-2,.report-section-span-3{grid-column:auto;}
}


/* ===== REPORTS FINAL BASE FIX ===== */
#entityReportModal{
  position:fixed !important;
  inset:var(--header-h) 0 0 var(--sidebar-w) !important;
  z-index:13050 !important;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:18px;
}
#entityReportModal.hidden{display:none !important;}
#entityReportModal .modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.40);
  backdrop-filter:blur(6px) saturate(120%);
}
#entityReportModal .modal-card-report{
  position:relative;
  z-index:1;
  width:min(1280px, calc(100% - 12px));
  max-height:calc(100dvh - var(--header-h) - 36px);
  overflow:auto;
  border-radius:28px;
  border:1px solid rgba(205,218,233,.95);
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,255,.97));
  box-shadow:0 36px 90px rgba(15,23,42,.18), 0 4px 24px rgba(37,99,235,.06);
}
#entityReportModal .modal-head{
  position:sticky;
  top:0;
  z-index:2;
  padding:18px 22px;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(14px) saturate(125%);
  border-bottom:1px solid rgba(215,225,236,.95);
}
#entityReportBody{
  padding:22px;
  display:grid;
  gap:18px;
}
.report-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.report-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;}
.report-grid-3{grid-template-columns:repeat(3,minmax(0,1fr));}
.report-kpi,.report-section,.report-node{
  border:1px solid var(--line);
  border-radius:22px;
  background:linear-gradient(180deg,#fff,#f8fbff);
  box-shadow:0 10px 24px rgba(15,23,42,.04);
}
.report-kpi{padding:16px 18px;}
.report-section{padding:18px 20px;}
.report-section-span-2{grid-column:span 2;}
.report-section-span-3{grid-column:1 / -1;}
.report-cutplan-table-wrap{max-height:none;overflow:auto;background:transparent;}
.report-cutplan-table,.report-cutplan-table thead,.report-cutplan-table tbody,.report-cutplan-table tr,.report-cutplan-table th,.report-cutplan-table td{background:transparent;}
.report-export-surface{background:#ffffff;color:#111;}
.report-export-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  padding:0 0 14px;
  margin-bottom:12px;
  border-bottom:2px solid #dbe6f5;
}
.report-export-brand-mark{
  font-size:30px;
  font-weight:950;
  letter-spacing:-0.04em;
  color:#0f172a;
  text-transform:uppercase;
  line-height:1;
}
.report-export-brand-sub{
  margin-top:6px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#5f738a;
}
.report-export-docmeta{text-align:right;}
.report-export-doclabel{
  font-size:12px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#2563eb;
}
.report-export-docdate{margin-top:6px;font-size:12px;color:#5f738a;}
.report-export-hero{margin:0 0 16px;padding:0 2px;}
.report-export-title{font-size:26px;font-weight:900;letter-spacing:-0.03em;color:#0f172a;line-height:1.1;}
.report-export-subtitle{margin-top:6px;font-size:13px;color:#5f738a;}
@media (max-width: 1140px){
  #entityReportModal{inset:0 !important;padding:10px;}
  #entityReportModal .modal-card-report{width:min(100vw - 20px, 1180px);max-height:calc(100dvh - 20px);}
}
@media (max-width: 900px){
  .report-kpis,.report-grid,.report-grid-3{grid-template-columns:1fr;}
  .report-section-span-2,.report-section-span-3{grid-column:auto;}
}


/* ===== REPORT TEXT FIT FIX ===== */
.report-grid,
.report-grid-3,
.report-section,
.report-kpis,
.report-kpi,
.report-row,
.report-row-main,
.report-row-value,
.report-tree,
.report-node,
.report-node-head,
.report-node-title,
.report-node-meta,
.report-pill{
  min-width:0;
}
.report-row{
  align-items:flex-start;
}
.report-row-main{
  flex:1 1 auto;
}
.report-row-title,
.report-row-sub,
.report-node-title,
.report-node-meta,
.report-pill,
.report-kpi span,
.report-kpi small,
.report-kpi strong{
  overflow-wrap:anywhere;
  word-break:break-word;
}
.report-row-value{
  flex:0 1 42%;
  white-space:normal;
  text-align:right;
  overflow-wrap:anywhere;
  word-break:break-word;
  line-height:1.35;
}
.report-node-head{
  flex-wrap:wrap;
}
.report-node-head .report-row-value{
  flex:0 1 100%;
  text-align:left;
}
.report-section h3{
  overflow-wrap:anywhere;
  word-break:break-word;
}


/* ===== TOPBAR COMPACT FIX ===== */
:root{
  --header-h:64px;
}
.topbar{
  min-height:var(--header-h) !important;
  height:var(--header-h) !important;
  padding:8px 14px !important;
  gap:12px !important;
}
.brand-minimal{
  gap:10px;
  min-width:0;
}
.logo-minimal{
  width:42px;
  height:42px;
  border-radius:14px;
}
.title-minimal{
  font-size:18px;
}
.title-minimal::after{
  width:44px;
  margin-top:6px;
}
.top-actions{
  flex:1 1 auto;
  min-width:0;
  gap:6px !important;
  padding:5px 6px !important;
  border-radius:16px !important;
}
.top-actions .btn,
.top-actions .btn-toolbar,
.top-actions .btn-icon-hub{
  min-height:36px !important;
  height:36px;
  padding:0 10px !important;
  border-radius:12px !important;
  font-size:12px !important;
}
.btn-toolbar .btn-glyph,
.btn-icon-hub .hub-icon{
  font-size:13px;
}
.server-status-wrap{
  min-width:0 !important;
  grid-template-columns:minmax(150px,1fr) auto auto !important;
  gap:6px !important;
}
.server-status-chip,
.auth-user-chip{
  min-width:0 !important;
  padding:6px 10px !important;
  border-radius:14px !important;
}
.server-status-meta{
  font-size:10px !important;
}
#btnSaveNow span:last-child,
#btnHistoryOpen span:last-child,
#btnAdminQueueTop span:last-child,
#btnLogoutTop span:last-child,
#btnThemeToggle .theme-toggle-label,
.btn-icon-hub .hub-label{
  display:none !important;
}
#btnSaveNow,
#btnHistoryOpen,
#btnAdminQueueTop,
#btnLogoutTop,
#btnThemeToggle,
.btn-icon-hub{
  width:36px;
  min-width:36px !important;
  justify-content:center !important;
  padding:0 !important;
}
#btnSaveNow .btn-glyph,
#btnHistoryOpen .btn-glyph,
#btnAdminQueueTop .btn-glyph,
#btnLogoutTop .btn-glyph,
#btnThemeToggle .btn-glyph,
.btn-icon-hub .hub-icon{
  margin:0 !important;
}
#btnExport,
#btnImport,
#btnRememberKey,
#btnReset{
  display:none !important;
}
@media (max-width: 1280px){
  .server-status-wrap{
    grid-template-columns:minmax(128px,1fr) auto auto !important;
  }
  .title-minimal{
    font-size:16px;
  }
}


/* ===== TOPBAR FINAL POLISH / HOVER HINTS ===== */
.brand-minimal{position:relative;}
.brand-minimal::after{
  content:"ONLINE";
  position:absolute;
  left:58px;
  top:38px;
  font-size:10px;
  letter-spacing:.22em;
  font-weight:800;
  color:rgba(148,163,184,.72);
}
.logo-minimal{
  box-shadow:0 12px 28px rgba(15,23,42,.16), inset 0 1px 0 rgba(255,255,255,.06);
}
.top-actions [data-top-hint]{position:relative;}
.top-actions [data-top-hint]:hover::after{
  content:attr(data-top-hint);
  position:absolute;
  left:50%;
  bottom:calc(100% + 8px);
  transform:translateX(-50%);
  white-space:nowrap;
  padding:6px 9px;
  border-radius:10px;
  background:rgba(7,15,28,.96);
  color:#e2e8f0;
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  box-shadow:0 10px 24px rgba(15,23,42,.18);
  pointer-events:none;
  z-index:20;
}
.top-actions [data-top-hint]:hover::before{
  content:"";
  position:absolute;
  left:50%;
  bottom:calc(100% + 2px);
  transform:translateX(-50%);
  border:6px solid transparent;
  border-top-color:rgba(7,15,28,.96);
  pointer-events:none;
  z-index:20;
}
.auth-user-chip .server-status-badge{
  letter-spacing:.12em;
}
.auth-user-chip .server-status-meta{
  text-transform:none;
}
.top-actions .btn:hover,
.top-actions .btn-icon-hub:hover,
.top-actions .server-status-chip:hover{
  transform:translateY(-1px);
}
@media (max-width: 1280px){
  .brand-minimal::after{display:none;}
}

/* ===== REPORTS DARK THEME FIX ===== */
body.theme-dark #entityReportModal .modal-card-report,
body.dark-mode #entityReportModal .modal-card-report,
html[data-theme="dark"] #entityReportModal .modal-card-report,
body[data-theme="dark"] #entityReportModal .modal-card-report{
  border:1px solid rgba(71,85,105,.55) !important;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.14), transparent 24%),
    linear-gradient(180deg, rgba(8,15,28,.98), rgba(11,20,38,.97)) !important;
  box-shadow:0 34px 90px rgba(0,0,0,.42), 0 6px 24px rgba(37,99,235,.12) !important;
}
body.theme-dark #entityReportModal .modal-head,
body.dark-mode #entityReportModal .modal-head,
html[data-theme="dark"] #entityReportModal .modal-head,
body[data-theme="dark"] #entityReportModal .modal-head{
  background:rgba(7,14,26,.88) !important;
  border-bottom:1px solid rgba(71,85,105,.4) !important;
}
body.theme-dark #entityReportTitle,
body.dark-mode #entityReportTitle,
html[data-theme="dark"] #entityReportTitle,
body[data-theme="dark"] #entityReportTitle,
body.theme-dark #entityReportSubtitle,
body.dark-mode #entityReportSubtitle,
html[data-theme="dark"] #entityReportSubtitle,
body[data-theme="dark"] #entityReportSubtitle{
  color:#e5edf8 !important;
}
body.theme-dark #entityReportBody,
body.dark-mode #entityReportBody,
html[data-theme="dark"] #entityReportBody,
body[data-theme="dark"] #entityReportBody{
  background:transparent !important;
}
body.theme-dark .report-kpi,
body.theme-dark .report-section,
body.theme-dark .report-node,
body.dark-mode .report-kpi,
body.dark-mode .report-section,
body.dark-mode .report-node,
html[data-theme="dark"] .report-kpi,
html[data-theme="dark"] .report-section,
html[data-theme="dark"] .report-node,
body[data-theme="dark"] .report-kpi,
body[data-theme="dark"] .report-section,
body[data-theme="dark"] .report-node{
  border:1px solid rgba(71,85,105,.42) !important;
  background:linear-gradient(180deg, rgba(20,31,50,.96), rgba(14,24,41,.96)) !important;
  box-shadow:0 12px 28px rgba(0,0,0,.22) !important;
}
body.theme-dark .report-kpi span,
body.theme-dark .report-kpi small,
body.theme-dark .report-row-sub,
body.theme-dark .report-node-meta,
body.theme-dark .report-section h3,
body.dark-mode .report-kpi span,
body.dark-mode .report-kpi small,
body.dark-mode .report-row-sub,
body.dark-mode .report-node-meta,
body.dark-mode .report-section h3,
html[data-theme="dark"] .report-kpi span,
html[data-theme="dark"] .report-kpi small,
html[data-theme="dark"] .report-row-sub,
html[data-theme="dark"] .report-node-meta,
html[data-theme="dark"] .report-section h3,
body[data-theme="dark"] .report-kpi span,
body[data-theme="dark"] .report-kpi small,
body[data-theme="dark"] .report-row-sub,
body[data-theme="dark"] .report-node-meta,
body[data-theme="dark"] .report-section h3{
  color:#9fb3cc !important;
}
body.theme-dark .report-kpi strong,
body.theme-dark .report-row-title,
body.theme-dark .report-row-value,
body.theme-dark .report-node-title,
body.dark-mode .report-kpi strong,
body.dark-mode .report-row-title,
body.dark-mode .report-row-value,
body.dark-mode .report-node-title,
html[data-theme="dark"] .report-kpi strong,
html[data-theme="dark"] .report-row-title,
html[data-theme="dark"] .report-row-value,
html[data-theme="dark"] .report-node-title,
body[data-theme="dark"] .report-kpi strong,
body[data-theme="dark"] .report-row-title,
body[data-theme="dark"] .report-row-value,
body[data-theme="dark"] .report-node-title{
  color:#edf4ff !important;
}
body.theme-dark .report-row,
body.dark-mode .report-row,
html[data-theme="dark"] .report-row,
body[data-theme="dark"] .report-row{
  border-bottom:1px dashed rgba(96,165,250,.18) !important;
}
body.theme-dark .report-pill,
body.dark-mode .report-pill,
html[data-theme="dark"] .report-pill,
body[data-theme="dark"] .report-pill{
  background:rgba(37,99,235,.14) !important;
  border:1px solid rgba(96,165,250,.25) !important;
  color:#dbeafe !important;
}
body.theme-dark .report-children,
body.dark-mode .report-children,
html[data-theme="dark"] .report-children,
body[data-theme="dark"] .report-children{
  border-left:2px solid rgba(96,165,250,.18) !important;
}
body.theme-dark .report-empty,
body.dark-mode .report-empty,
html[data-theme="dark"] .report-empty,
body[data-theme="dark"] .report-empty{
  background:rgba(15,23,42,.42) !important;
  border:1px dashed rgba(96,165,250,.22) !important;
  color:#9fb3cc !important;
}
body.theme-dark .report-cutplan-table thead th,
body.dark-mode .report-cutplan-table thead th,
html[data-theme="dark"] .report-cutplan-table thead th,
body[data-theme="dark"] .report-cutplan-table thead th{
  background:linear-gradient(180deg, rgba(22,36,58,.98), rgba(16,28,47,.98)) !important;
  color:#c9d8ea !important;
  border-bottom:1px solid rgba(71,85,105,.42) !important;
}
body.theme-dark .report-cutplan-table td,
body.dark-mode .report-cutplan-table td,
html[data-theme="dark"] .report-cutplan-table td,
body[data-theme="dark"] .report-cutplan-table td{
  color:#e5edf8 !important;
  border-bottom:1px solid rgba(71,85,105,.26) !important;
}

/* ===== WYCENY / OFERTY ===== */
.btn-quote-new{
  min-width:220px;
  min-height:50px;
  padding:0 24px;
  border-radius:14px;
  border-color:#86efac;
  background:linear-gradient(180deg,#34d399,#16a34a);
  color:#052e16;
  font-size:15px;
  font-weight:900;
  box-shadow:0 14px 30px rgba(22,163,74,.22);
}
.btn-start-quote:hover,
.btn-quote-new:hover{
  border-color:#bbf7d0;
  background:linear-gradient(180deg,#4ade80,#15803d);
  color:#041b0d;
  box-shadow:0 18px 36px rgba(22,163,74,.28);
}
.btn-quote-new{justify-content:center;}
#view-quotes .quote-list-card .section-head-inline{
  grid-template-columns:1fr;
  gap:10px;
}
#btnQuoteNew{
  width:100%;
  min-height:58px;
  border-radius:16px;
  font-size:16px;
  letter-spacing:.1px;
}
.quote-shell{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:16px;align-items:start;}
.quote-list-card,.quote-editor-card{min-width:0;}
.quote-list{display:flex;flex-direction:column;gap:8px;margin-top:12px;}
.quote-list-row{width:100%;display:flex;justify-content:space-between;gap:12px;align-items:center;text-align:left;border:1px solid var(--border);background:var(--card);border-radius:8px;padding:10px 12px;cursor:pointer;color:var(--text);}
.quote-list-row:hover,.quote-list-row.is-active{border-color:#2563eb;box-shadow:0 8px 22px rgba(37,99,235,.10);}
.quote-list-row span{display:flex;flex-direction:column;gap:3px;min-width:0;}
.quote-list-row strong,.quote-list-row small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.quote-list-row small,.quote-list-row em{color:var(--muted);font-style:normal;font-size:12px;}
.quote-list-row .quote-list-items{color:#2563eb;font-weight:700;}
.quote-view-toggle{display:flex;gap:6px;align-items:center;}
.quote-view-toggle .is-active{border-color:#2563eb;background:#eff6ff;color:#1d4ed8;}
.quote-list-notebook{gap:6px;}
.quote-notebook-row{width:100%;display:grid;grid-template-columns:74px minmax(120px,1fr) minmax(150px,1.4fr) 44px minmax(96px,.8fr) minmax(100px,1fr);gap:8px;align-items:center;text-align:left;border:1px solid var(--border);background:var(--card);border-radius:8px;padding:9px 10px;cursor:pointer;color:var(--text);}
.quote-notebook-row:hover,.quote-notebook-row.is-active{border-color:#2563eb;box-shadow:0 8px 22px rgba(37,99,235,.10);}
.quote-notebook-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.quote-notebook-row b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;}
.quote-notebook-row small,.quote-notebook-row em{display:block;color:var(--muted);font-style:normal;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.quote-nb-date,.quote-nb-qty{font-size:12px;color:var(--muted);font-weight:800;}
.quote-nb-value{text-align:right;}
.quote-ok,.quote-risk{display:inline-flex;align-self:flex-end;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:800;}
.quote-ok{background:#dcfce7;color:#166534;}
.quote-risk{background:#fef3c7;color:#92400e;}
.quote-empty{padding:16px;border:1px dashed var(--border);border-radius:8px;color:var(--muted);}
.quote-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:14px;}
.quote-add-row{display:grid;grid-template-columns:150px minmax(180px,1fr) minmax(160px,1fr) 120px 90px;gap:8px;align-items:center;margin:10px 0 14px;}
.quote-add-row #quoteCustomCost.hidden + #quoteItemQty{grid-column:auto;}
.quote-extra-row{
  display:grid;
  grid-template-columns:minmax(260px,360px) minmax(260px,360px) minmax(300px,1fr);
  gap:10px;
  align-items:end;
  margin:0 0 14px;
  padding:10px 12px;
  border:1px solid rgba(22,163,74,.22);
  border-radius:8px;
  background:rgba(34,197,94,.06);
}
.quote-extra-row .row{margin:0;}
.quote-extra-hint{min-height:40px;display:flex;align-items:center;color:var(--muted);font-size:12px;font-weight:700;}
.quote-items-table input{min-width:82px;width:100%;}
.quote-item-main-row td{vertical-align:top;}
.quote-row-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end;}
.quote-line-note-input{margin-top:7px;min-width:180px!important;font-size:12px;}
.quote-addon-preview-row td{padding-top:0!important;background:rgba(59,130,246,.035);}
.quote-addon-chips{display:flex;gap:6px;flex-wrap:wrap;align-items:center;}
.quote-addon-chip{display:inline-flex;gap:6px;align-items:center;border:1px solid #bfdbfe;background:#eff6ff;color:#1e3a8a;border-radius:999px;padding:4px 8px;font-size:12px;font-weight:800;}
.quote-addon-chip.is-cost-changed{border-color:#fecaca;background:#fff1f2;color:#991b1b;}
.quote-addon-chip em{font-style:normal;color:inherit;opacity:.78;font-weight:700;}
.quote-addon-chip button{border:0;background:transparent;color:inherit;font-weight:900;cursor:pointer;padding:0 1px;}
.quote-line-note-preview{margin-top:6px;color:var(--muted);font-size:12px;font-weight:700;}
.quote-addon-editor-row td{background:#f8fafc!important;}
.quote-addon-editor{display:grid;grid-template-columns:145px minmax(180px,1fr) minmax(140px,1fr) minmax(150px,1fr) 72px 74px 98px 98px 112px minmax(140px,1fr) minmax(180px,1fr) auto auto;gap:8px;align-items:center;}
.quote-addon-editor input,.quote-addon-editor select{min-width:0!important;width:100%;}
.quote-addon-save-base{font-size:12px;color:var(--muted);font-weight:800;}
.quote-cost-delta{margin-top:4px;color:#b45309;font-size:11px;font-weight:800;}
.quote-summary-grid{margin-top:12px;}
.quote-editor-tools{display:flex;align-items:center;gap:8px;}
.quote-company-icon-btn{
  width:36px;
  height:36px;
  min-width:36px;
  padding:0;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:transparent;
  color:var(--muted);
  border:1px solid var(--border);
}
.quote-company-icon-btn svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.quote-company-icon-btn:hover{
  color:#166534;
  border-color:#86efac;
  background:rgba(34,197,94,.08);
}
.quote-company-strip{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  margin:-2px 0 14px;
  padding:9px 11px;
  border:1px solid var(--border);
  border-radius:8px;
  background:rgba(148,163,184,.08);
}
.quote-company-strip span{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}
.quote-company-strip strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--text);
  font-size:13px;
}
.quote-company-strip.is-empty{
  border-style:dashed;
}
.quote-decision-badge{border-radius:999px;padding:6px 10px;background:#dcfce7;color:#166534;font-weight:900;font-size:12px;}
.quote-decision-badge.is-warning{background:#fef3c7;color:#92400e;}
.quote-reasons{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0;}
.quote-reasons span{border:1px solid #fbbf24;background:#fef3c7;color:#92400e;border-radius:999px;padding:5px 9px;font-size:12px;font-weight:800;}
.quote-reasons .is-ok{border-color:#86efac;background:#dcfce7;color:#166534;}
.quote-comments-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:12px;}
.quote-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px;}
.quote-cost-alerts{display:grid;gap:6px;margin-top:10px;}
.quote-cost-alert{border:1px solid #fed7aa;background:#fff7ed;color:#9a3412;border-radius:8px;padding:8px 10px;font-size:12px;font-weight:800;}
.quote-current-cost-panel,.quote-client-history,.quote-client-variants{border:1px solid var(--border);border-radius:8px;background:var(--card);padding:10px 12px;margin-top:10px;}
.quote-panel-title{font-size:12px;font-weight:900;color:var(--muted);text-transform:uppercase;margin-bottom:8px;}
.quote-panel-empty{color:var(--muted);font-size:12px;font-weight:800;line-height:1.45;}
.quote-current-head,.quote-client-history-row,.quote-variant-row{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;}
.quote-current-head span,.quote-client-history-row span,.quote-client-history-row small,.quote-variant-row span,.quote-variant-row small{display:block;color:var(--muted);font-size:12px;margin-top:2px;}
.quote-current-rows,.quote-client-history-list,.quote-variant-list{display:grid;gap:8px;}
.quote-current-rows div{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;align-items:center;border-top:1px solid var(--border);padding-top:7px;}
.quote-current-rows b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.quote-current-rows em{font-style:normal;font-weight:900;color:#b45309;}
.quote-current-actions{margin-top:10px;}
.quote-client-history-row,.quote-variant-row{border-top:1px solid var(--border);padding-top:8px;}
.quote-client-history-row:first-child,.quote-variant-row:first-child{border-top:0;padding-top:0;}
.quote-client-history-row strong{display:block;margin-bottom:4px;text-align:right;}
.quote-history-card{margin-top:14px;border:1px solid var(--border);border-radius:8px;padding:10px 12px;background:var(--card);}
.quote-history{display:grid;gap:8px;margin-top:10px;}
.quote-history div{display:flex;justify-content:space-between;gap:12px;border-top:1px solid var(--border);padding-top:8px;}
.quote-history span{color:var(--muted);font-size:12px;}
.quote-status-robocza,.quote-status-archiwum{color:#64748b;font-weight:800;}
.quote-status-do-akceptacji{color:#b45309;font-weight:800;}
.quote-status-zatwierdzona,.quote-status-zaakceptowana{color:#15803d;font-weight:800;}
.quote-status-wyslana{color:#0369a1;font-weight:800;}
.quote-status-odrzucona{color:#b91c1c;font-weight:800;}
.approval-top{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:12px;}
.approval-top div{display:flex;flex-direction:column;gap:4px;}
.approval-top span{color:var(--muted);font-size:13px;}
.approval-details p{margin:8px 0 0;color:var(--muted);}
.fx-notify-host{position:fixed;right:18px;bottom:18px;display:flex;flex-direction:column;gap:8px;z-index:99999;pointer-events:none;}
.fx-toast{min-width:180px;max-width:340px;border-radius:8px;padding:10px 12px;color:#0f172a;background:#fff;border:1px solid #cbd5e1;box-shadow:0 16px 36px rgba(15,23,42,.16);opacity:0;transform:translateY(6px);transition:opacity .18s ease,transform .18s ease;font-weight:800;}
.fx-toast.is-visible{opacity:1;transform:translateY(0);}
.fx-toast-success{border-color:#86efac;background:#dcfce7;color:#166534;}
.fx-toast-warning{border-color:#fbbf24;background:#fef3c7;color:#92400e;}
.fx-toast-error{border-color:#fca5a5;background:#fee2e2;color:#991b1b;}
body.theme-dark .quote-list-row,
body.theme-dark .quote-history-card,
body.theme-dark .quote-company-strip,
body.theme-dark .quote-notebook-row,
body.theme-dark .quote-current-cost-panel,
body.theme-dark .quote-client-history,
body.theme-dark .quote-client-variants{background:rgba(15,23,42,.72);}
body.theme-dark .quote-addon-editor-row td{background:rgba(15,23,42,.82)!important;}
body.theme-dark .quote-addon-chip{background:rgba(37,99,235,.18);border-color:rgba(96,165,250,.42);color:#bfdbfe;}
body.theme-dark .quote-addon-chip.is-cost-changed{background:rgba(127,29,29,.22);border-color:rgba(248,113,113,.45);color:#fecaca;}
body.theme-dark .quote-cost-alert{background:rgba(120,53,15,.24);border-color:rgba(251,146,60,.42);color:#fed7aa;}
body.theme-dark .fx-toast{box-shadow:0 16px 36px rgba(0,0,0,.34);}
#quoteCompanyModal .modal-card{
  width:min(1040px,calc(100vw - 48px));
  max-height:calc(100dvh - 48px);
  overflow:auto;
  border-radius:16px;
}
.quote-company-modal-grid{
  display:grid;
  grid-template-columns:minmax(230px,310px) minmax(0,1fr);
  gap:16px;
  padding:18px;
}
.quote-company-list-panel,
.quote-company-form-panel{
  min-width:0;
}
.quote-company-list-title{
  margin:0 0 8px;
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
}
.quote-company-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.quote-company-row{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  text-align:left;
  border:1px solid var(--border);
  border-radius:8px;
  padding:9px 10px;
  background:var(--card);
  color:var(--text);
  cursor:pointer;
}
.quote-company-row:hover,
.quote-company-row.is-selected{
  border-color:#86efac;
  box-shadow:0 8px 22px rgba(22,163,74,.10);
}
.quote-company-row span:first-child{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}
.quote-company-row strong,
.quote-company-row small{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.quote-company-row small{
  color:var(--muted);
  font-size:12px;
}
.quote-company-row-tags{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:4px;
  flex:0 0 auto;
}
.quote-company-row-tags b,
.quote-company-row-tags em{
  border-radius:999px;
  padding:2px 7px;
  font-size:10px;
  font-style:normal;
  font-weight:900;
}
.quote-company-row-tags b{background:#dcfce7;color:#166534;}
.quote-company-row-tags em{background:#e2e8f0;color:#475569;}
.quote-company-empty{
  border:1px dashed var(--border);
  border-radius:8px;
  padding:14px;
  color:var(--muted);
  font-size:13px;
}
.quote-company-current{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  margin-bottom:12px;
  padding:9px 11px;
  border:1px solid rgba(34,197,94,.25);
  border-radius:8px;
  background:rgba(34,197,94,.06);
}
.quote-company-current span{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}
.quote-company-current strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.quote-company-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px 12px;
}
.quote-company-form-grid .span2{grid-column:1 / -1;}
.quote-company-logo-control{
  display:grid;
  grid-template-columns:110px minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
}
.quote-company-logo-preview{
  width:110px;
  height:58px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed var(--border);
  border-radius:8px;
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  background:rgba(148,163,184,.08);
  overflow:hidden;
}
.quote-company-logo-preview img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  display:block;
}
.quote-company-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px;
  margin-top:14px;
}
body.theme-dark #quoteCompanyModal .modal-card,
body.dark-mode #quoteCompanyModal .modal-card,
html[data-theme="dark"] #quoteCompanyModal .modal-card,
body[data-theme="dark"] #quoteCompanyModal .modal-card{
  background:#0f1826;
  color:#e5edf7;
  border-color:rgba(148,163,184,.22);
}
body.theme-dark .quote-company-row,
body.dark-mode .quote-company-row,
html[data-theme="dark"] .quote-company-row,
body[data-theme="dark"] .quote-company-row{
  background:rgba(15,23,42,.72);
}
body.theme-dark .quote-company-row-tags em,
body.dark-mode .quote-company-row-tags em,
html[data-theme="dark"] .quote-company-row-tags em,
body[data-theme="dark"] .quote-company-row-tags em{
  background:rgba(148,163,184,.18);
  color:#cbd5e1;
}
#tabs .tab[data-view="quotes"]{
  background:linear-gradient(90deg,rgba(22,163,74,.10),rgba(255,255,255,.84));
  border-left:3px solid rgba(22,163,74,.55) !important;
}
#tabs .tab[data-view="quotes"]::before{content:'+';}
#tabs .tab[data-view="quotes"].active{
  border-left-color:#16a34a !important;
  box-shadow:inset 3px 0 0 rgba(22,163,74,.30),0 10px 22px rgba(22,163,74,.10);
}
body.theme-dark #tabs .tab[data-view="quotes"],
body.dark-mode #tabs .tab[data-view="quotes"],
html[data-theme="dark"] #tabs .tab[data-view="quotes"],
body[data-theme="dark"] #tabs .tab[data-view="quotes"]{
  background:linear-gradient(90deg,rgba(34,197,94,.13),rgba(15,24,38,.92)) !important;
  border-left:3px solid rgba(74,222,128,.55) !important;
}
@media (max-width: 1100px){
  .quote-shell{grid-template-columns:1fr;}
  .quote-form-grid,.quote-comments-grid{grid-template-columns:1fr 1fr;}
  .quote-add-row,.quote-extra-row{grid-template-columns:1fr 1fr;}
  .quote-notebook-row{grid-template-columns:82px minmax(120px,1fr) minmax(160px,1.3fr) 52px minmax(110px,.8fr);}
  .quote-nb-note{grid-column:1 / -1;}
  .quote-addon-editor{grid-template-columns:repeat(3,minmax(0,1fr));}
  .quote-company-modal-grid{grid-template-columns:1fr;}
}
@media (max-width: 700px){
  .quote-form-grid,.quote-comments-grid,.quote-add-row,.quote-extra-row,.quote-company-form-grid,.quote-company-strip,.quote-company-logo-control{grid-template-columns:1fr;}
  .quote-list-row{align-items:flex-start;flex-direction:column;}
  .quote-notebook-row{grid-template-columns:1fr 1fr;}
  .quote-nb-item,.quote-nb-note{grid-column:1 / -1;}
  .quote-nb-value{text-align:left;}
  .quote-addon-editor{grid-template-columns:1fr;}
  .quote-current-head,.quote-client-history-row,.quote-variant-row{flex-direction:column;}
  .quote-current-rows div{grid-template-columns:1fr;}
  .quote-history div,.approval-top{flex-direction:column;}
  #quoteCompanyModal .modal-card{width:min(100vw - 20px,1040px);max-height:calc(100dvh - 20px);}
  .quote-company-modal-grid{padding:14px;}
}
