.spin{
  width:22px;
  height:22px;
  border-radius:50%;
  border:3px solid rgba(0,0,0,.15);
  border-top-color: rgba(0,0,0,.7);
  animation: spin 0.85s linear infinite;
}
@keyframes spin{
  to { transform: rotate(360deg); }
}

/* ===== ROW ENABLE/DISABLE (checkbox) ===== */
tr.row-disabled td:not(.color-cell){
  opacity: .45;
  filter: grayscale(100%);
}
/* Kolumna Kolor ZAWSZE pełna widoczność (nigdy nie wyszazała) */
.color-cell{
  opacity: 1 !important;
  filter: none !important;
}
tr.row-disabled .color-cell,
tr.row-disabled .color-cell *{
  opacity: 1 !important;
  filter: none !important;
}
tr.row-disabled input[type="number"],
tr.row-disabled input[type="text"]{
  background: #f0f2f5;
}

tr.row-missing td{
  border-color: #d43f3a !important;
}
tr.row-missing input,
tr.row-missing select{
  border-color: #d43f3a !important;
  background: #fff4f4;
}

/* ===== HIGHLIGHT WIERSZA (Z SVG HOVER) ===== */
tr.highlight-row{
  outline: 2px solid #87ceeb;
  outline-offset: -2px;
  background-color: #e6f2fb;
}

/* ===== TOPBAR + MENU ===== */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: #b8bbbf;
  border-bottom: 1px solid #d8dde3;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4a4f57;
  user-select: none;
}

.brand-mark{
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: currentColor;
}

.brand .mk.stroke{
  fill: none;
  stroke: currentColor;
  stroke-width: 4.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .95;
}

.brand .mk.dot{
  fill: currentColor;
  opacity: .9;
}

.brand-text{
  display: flex;
  align-items: baseline;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 1.03rem;
  line-height: 1;
}

.brand-text .cut,
.brand-text .pilot{
  opacity: .95;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
}

.status-pill{
  font-size: 13px;
  color:#2b2f36;
  background:#f2f4f7;
  border: 1px solid #e1e6ed;
  padding: 6px 10px;
  border-radius: 999px;
  max-width: 55vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-btn{
  width: 42px;
  height: 34px;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  line-height: 0;
  margin-right: 50px;
}
.menu-btn:hover{ background:#f6f8fb; }

.menu-wrap{ position: relative; }

.dropdown{
  position: absolute;
  right: 0;
  top: 44px;
  width: 240px;
  background: #fff;
  border: 1px solid #d8dde3;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  padding: 6px;
  overflow: hidden;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .22s cubic-bezier(.2,.7,.2,1), opacity .18s ease, padding .22s ease;
  pointer-events: none;
}
.dropdown.open{ 
  opacity: 1;
  transform: scaleY(1);
  padding: 6px;
}

.drop-item{
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
}
.drop-item:hover{ background:#f2f4f7; }
.drop-sep{ height:1px; background:#e6e9ef; margin:6px; }

/* ===== MODALS ===== */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.open{ display:flex; }

.modal{
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  border: 1px solid #d8dde3;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  padding: 14px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-title{
  font-weight: 800;
}
.icon-btn{
  width: 36px;
  height: 32px;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 10px;
  cursor:pointer;
}
.icon-btn:hover{ background:#f6f8fb; }

.modal-x{
  width: 32px;
  min-width: 32px;
  height: 30px;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  margin: 0;
  line-height: 1;
  padding: 0;
  flex: 0 0 auto;
}
.modal-x:hover{ background:#f6f8fb; }

.form-row{
  display:flex;
  gap:10px;
  margin: 10px 0;
  flex-wrap: wrap;
}
.form-row input{
  flex:1;
  min-width: 180px;
  padding: 10px;
}
.modal-actions{
  display:flex;
  gap:10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-actions button{
  width: auto;
  padding: 10px 14px;
  border-radius: 10px;
}
.modal-actions.modal-actions-split{
  justify-content: space-between;
}

.plan-grid{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  align-items: stretch;

}
.plan-card{
  border: 1px solid #d8dde3;
  border-radius: 14px;
  padding: 12px;
  background:#fff;

  display: flex;
  flex-direction: column;
  height: 100%;
}

.plan-card b{ display:block; margin-bottom: 6px; }
.plan-card button{ width:100%; }
@media (max-width: 720px){
  .plan-grid{ grid-template-columns: 1fr; }
}

html, body {
  height: 100%;
  overflow: hidden;          
}

*,
*::before,
*::after {
  box-sizing: border-box;    
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #eef1f4;

  display: flex;            
  flex-direction: column;
}

.app {
  display: grid;
  grid-template-columns: 580px 1fr 336px;
  grid-template-rows: 1fr;   /* ✅ ważne: środkowy obszar ma pełną wysokość */

  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}


/* tryb podglądu: zostaw lewy panel, ale tylko z miniaturami */
.app.view-mode{
  grid-template-columns: 220px 1fr 336px; /* szerokość lewego panelu pod miniatury */
}

/* w view-mode chowamy całe sekcje: Elementy / Płyty / CNC */
.app.view-mode #leftPanel .accordion-section{
  display: none;
}

/* dopinamy, żeby nagłówek "Arkusze" + miniatury dalej były widoczne */
.app.view-mode #leftPanel{
  display: block;
}

/* BEZPIECZNIK: w view-mode zawsze pokazuj środek (podgląd/SVG) */
.app.view-mode .canvas{
  display: flex !important;
}


.panel {
  background: #f7f9fb;
  border-right: 1px solid #ccc;
  padding: 10px;

  overflow: auto;   
  min-height: 0;   
  min-width: 0;    
}

.stats-sections{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.stats-card{
  background: #ffffff;
  border: 1px solid #d8dde3;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}

.stats-card h3{
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #2b2f36;
}

#stats p,
#statsGlobal p{
  margin: 4px 0;
  text-align: left;
  line-height: 1.3;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border: 1px solid #ccc;
  padding: 4px;
  text-align: center;
}
input { width: 100%; }
/* checkboxy/radia nie mogą mieć width:100% */
input[type="checkbox"],
input[type="radio"]{
  width: auto !important;
  margin: 0 8px 0 0;
}

/* ładne wyrównanie: checkbox po lewej, tekst po prawej */
.checkline{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  cursor: pointer;
  user-select: none;
}


button {
  width: 100%;
  margin: 4px 0;
}
button:disabled{
  opacity: .45;
  filter: grayscale(100%);
  cursor: not-allowed;
}


/* ===== ACCORDION ===== */
.accordion-section {
  border: 1px solid #ccc;
  margin-bottom: 8px;
  background: #fff;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  cursor: pointer;
  font-weight: bold;
  background: #e9edf2;
  user-select: none;
}

.accordion-header:hover {
  background: #dde3ea;
}

.accordion-content {
  display: block;
  padding: 0 6px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .22s cubic-bezier(.2,.7,.2,1), opacity .18s ease, padding .22s ease;
}

.accordion-section.open .accordion-content {
  padding: 6px;
  opacity: 1;
}

.accordion-section:not(.open) .accordion-content {
  pointer-events: none;
}

.arrow {
  transition: transform .2s;
}
.accordion-section.open .arrow {
  transform: rotate(180deg);
}

/* ===== SVG ===== */
.canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 16px;             
  overflow: hidden;
  min-height: 0;            /* ✅ pozwala SVG “urosnąć” w grid/flex */
}
.sheetbar{
  width: 100%;
  display:grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items:center;
  gap: 12px;
  margin-bottom: 8px;
}

.sheetbar-left{
  min-width: 0;
}

#sheetInfo{
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheetbar-nav{
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheetbar-right{
  justify-self: end;
  display: flex;
  align-items: center;
}

.sheet-switch-btn{
  width: auto;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}

.sheet-switch-btn:hover{
  background: #f6f8fb;
}

@media (max-width: 1200px){
  .sheet-switch-btn{
    padding: 6px 8px;
    font-size: 11px;
  }
}

.preview-stage{
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.preview-stage #btnOptimize,
.preview-stage .preview-mode-switch{
  opacity: 1;
  transform: translateY(0);
}

.preview-stage.preview-controls-hidden #btnOptimize,
.preview-stage.preview-controls-hidden .preview-mode-switch{
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

#btnOptimize.btn-optimize-floating{
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 6;
  width: auto;
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #0f766e;
  background: linear-gradient(135deg, #0ea5a3, #14b8a6);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1px;
  box-shadow: 0 10px 20px rgba(13, 148, 136, 0.26), 0 2px 4px rgba(15, 118, 110, 0.35);
  transition: transform .14s ease, box-shadow .2s ease, filter .2s ease, opacity .18s ease;
  cursor: pointer;
}

#btnOptimize.btn-optimize-floating:hover{
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 14px 26px rgba(13, 148, 136, 0.3), 0 4px 8px rgba(15, 118, 110, 0.34);
  filter: saturate(1.08);
}

#btnOptimize.btn-optimize-floating:active{
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 5px 12px rgba(15, 118, 110, 0.28);
}

#btnOptimize.btn-optimize-floating:focus-visible{
  outline: 2px solid #99f6e4;
  outline-offset: 2px;
}

#btnOptimize.btn-optimize-floating:disabled{
  transform: none;
  filter: grayscale(35%);
  box-shadow: none;
}

#btnOptimize.btn-optimize-floating.optimize-locked:disabled{
  border: 1px solid #d8dde3;
  background: #ffffff;
  color: #111827;
  box-shadow: none;
  filter: grayscale(100%);
  opacity: .45;
  cursor: not-allowed;
}

.preview-mode-switch{
  position: absolute;
  top: 72px;
  left: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity .18s ease, transform .18s ease;
}

.preview-mode-line{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.preview-tool-row{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  margin-left: 0;
}

.preview-tool-label{
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.preview-tool-input{
  width: 28px;
  min-width: 28px;
  text-align: left;
  font-size: 13px;
  line-height: 1.2;
}

.preview-icon-menu{
  position: absolute;
  top: 0;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  gap: 6px;
  padding: 2px 16px 4px;
  border-left: 2px solid #999;
  border-right: 2px solid #999;
  border-bottom: 2px solid #999;
  border-radius: 0 0 12px 12px;
  background: #eef1f4;
}

.preview-icon-btn{
  height: 26px;
  width: 26px;
  min-width: 26px;
  margin: 0;
  padding: 0;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #0f172a;
}

.preview-icon-btn:hover{
  background: #f6f8fb;
}

.preview-icon-btn.active{
  border-color: #0f766e;
  background: #ccfbf1;
  color: #115e59;
}

.preview-icon{
  font-size: 14px;
  line-height: 1;
}

@media (max-width: 900px){
  .preview-icon-menu{
    top: 0;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: 140px;
    gap: 5px;
    padding: 2px 12px 4px;
    border-radius: 0 0 10px 10px;
  }

  .preview-icon-btn{
    height: 24px;
    width: 24px;
    min-width: 24px;
  }
}


.waste-panel{
  width: min(560px, 100%);
  max-width: 100%;
  max-height: min(300px, 38vh);
  overflow: auto;
  border: 1px solid #d8dde3;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.15);
  padding: 10px;
  margin: 6px 0 0 0;
  transform: translateY(6px);
  opacity: 0;
  animation: wastePanelIn .22s ease forwards;
}
.waste-panel-head{
  position: relative;
  display:flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  padding-right: 44px;
}

.waste-panel-head-row{
  min-height: 30px;
  display: block;
}

.waste-panel-title{
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btnCloseWastePick.waste-panel-close{
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
  flex: 0 0 auto;
  z-index: 2;
}
.muted{ color:#6b7280; font-size:12px; }
#wasteTable{
  width:100%;
  border-collapse: collapse;
  font-size:12px;
}
#wasteTable th, #wasteTable td{
  border: 1px solid #e5e9ef;
  padding: 4px 6px;
  text-align: left;
}

.gear-btn{
  width: 38px;
  height: 34px;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
}
.gear-btn:hover{ background:#f6f8fb; }

.waste-store-btn{
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d8dde3;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: transform .14s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
}
.waste-store-btn:hover{ background:#f6f8fb; }
.waste-store-btn.active{
  border-color:#b9c7d6;
  background:#f6f8fb;
}

.waste-store-btn.waste-save-mode,
.waste-store-btn.waste-ready-mode{
  border: 1px solid #0f766e;
  background: linear-gradient(135deg, #0ea5a3, #14b8a6);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.1px;
  box-shadow: 0 10px 20px rgba(13, 148, 136, 0.26), 0 2px 4px rgba(15, 118, 110, 0.35);
}

.waste-store-btn.waste-save-mode:hover,
.waste-store-btn.waste-ready-mode:hover{
  background: linear-gradient(135deg, #0ea5a3, #14b8a6);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 14px 26px rgba(13, 148, 136, 0.3), 0 4px 8px rgba(15, 118, 110, 0.34);
  filter: saturate(1.08);
}

.waste-store-btn.waste-save-mode:active,
.waste-store-btn.waste-ready-mode:active{
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 5px 12px rgba(15, 118, 110, 0.28);
}

.waste-dock{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  pointer-events: none;
}

.waste-dock-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  pointer-events: none;
}

.waste-dock-btn{
  width: auto;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
}

.manual-edit-menu{
  position: relative;
  pointer-events: auto;
}

.manual-edit-panel{
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}

.manual-edit-menu.open .manual-edit-panel{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.manual-edit-option{
  width: max-content;
}

.waste-panel{
  pointer-events: auto;
}

@keyframes wastePanelIn{
  from{
    transform: translateY(12px);
    opacity: 0;
  }
  to{
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 900px){
  .waste-panel{
    width: min(520px, 100%);
    max-height: min(270px, 34vh);
  }
  .waste-dock-row{
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .manual-edit-panel{
    right: auto;
    left: 0;
    align-items: flex-start;
  }
}


svg.main {
  width: 100%;
  flex: 1 1 auto;     /* ✅ SVG wypełnia wolną wysokość pod sheetbar */
  height: auto;       /* ✅ zamiast 100% (które w view-mode dawało 0) */
  height: 100%;

  max-width: 100%;    
  max-height: 100%;    

  border: 1px solid #999;
  background: #fff;

  display: block;     
}


.miniatures {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.miniature {
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  padding: 4px;
}

.miniature.active {
  border-color: #007acc;
}

.miniature svg {
  width: 100%;
  border: 1px solid #999;
}
/* Ukryj strzałki w input[type=number] — Chrome/Edge/Safari */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Ukryj strzałki w Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.mode-disabled{
  opacity: .45;
  filter: grayscale(100%);
  pointer-events: none;
}
/* Podgląd cięcia (hover na liście) */
.cut-preview{
  stroke: #2563eb;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: none;
  pointer-events: none;
}
.hidden { display: none !important; }

.plan-card button{
  margin-top: auto;   /* wypycha przycisk na dół karty */
}
/* Szersze okno tylko dla "Rozszerz plan" */
#planModal .modal{
  width: min(1050px, 92vw);
  max-width: 92vw;
}

#listaTitle { display: none; }
.view-mode #listaTitle { display: block; }


/* ===== MAGAZYN ODPADÓW: EDYTOR ===== */
.modal.modal-xl{
  width: min(1500px, 98vw);
  max-width: 98vw;
}

/* checkboxy w tabeli magazynu – bez marginesu, ładnie na środku */
#wasteStoreTable th input[type="checkbox"],
#wasteStoreTable td input[type="checkbox"]{
  margin: 0 !important;
  cursor: pointer;
}

.waste-store-filter-row th{
  background: #f8fafc;
  padding: 4px 4px;
}

.waste-store-filter-icon-cell{
  text-align: center;
  font-size: 14px;
  line-height: 1;
  opacity: .8;
  user-select: none;
}

.waste-store-filter-input{
  width: 100%;
  min-width: 52px;
  height: 24px;
  border: 1px solid #d8dde3;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
  background: #fff;
}

.waste-store-filter-input:focus{
  outline: 2px solid rgba(14, 165, 163, 0.22);
  border-color: #14b8a6;
}

.waste-store-qty-filter-wrap{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}

.waste-store-qty-count{
  font: inherit;
  font-weight: 700;
  line-height: 1;
  color: inherit;
  text-align: center;
  white-space: nowrap;
}


.split-rows{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px){
  .split-rows{ grid-template-columns: 1fr; }
}

.h3{
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
}

.table-wrap{
  border: 1px solid #e6e9ef;
  border-radius: 12px;
  overflow: auto;
  max-height: 320px;
}

.row-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

button.primary{
  background: #111827;
  color: #fff;
  border-color: #111827;
}
button.danger{
  background: #fff;
  color: #b91c1c;
  border-color: #f0b4b4;
}
.hint{
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

#partsTable th #partsSelectAll{
  display: block;
  margin: 0 auto !important;
  cursor: pointer;
}

.parts-header-action{
  width: 22px;
  min-width: 22px;
  height: 22px;
  margin: 0 auto;
  padding: 0;
  line-height: 1;
}

.parts-scroll-wrap{
  width: 100%;
}

.parts-scroll-wrap.is-collapsed{
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.parts-scroll-wrap.is-expanded{
  overflow: visible;
}

.parts-expand-toggle{
  display: block;
  width: 100%;
  margin: 0 0 8px 0;
  padding: 6px 8px;
  border: 1px solid #cdd5df;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #edf2f7;
  color: #1f2937;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.parts-expand-toggle:hover{
  background: #e2e8f0;
}

.parts-expand-toggle[hidden]{
  display: none !important;
}
/* ===== LOADING SCREEN ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  background: #060a14;
  display: block;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
  overflow: hidden;
}

.loading-screen-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

/* ===== COOKIE BANNER ===== */
.cookie-banner{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9800;
  display: none;
}

.cookie-banner.open{
  display: block;
}

.cookie-banner-card{
  width: min(860px, 100%);
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #d8dde3;
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  padding: 12px 14px;
}

.cookie-banner-title{
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.cookie-banner-text{
  font-size: 13px;
  line-height: 1.35;
  color: #374151;
}

.cookie-banner-settings{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e9ef;
}

.cookie-switch-line{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #1f2937;
}

.cookie-settings-actions{
  margin-top: 8px;
}

.cookie-banner-actions{
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.cookie-btn{
  width: auto;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d8dde3;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cookie-btn:hover{
  background: #f6f8fb;
}

.cookie-btn.cookie-btn-ghost{
  background: #ffffff;
}

.cookie-btn.cookie-btn-primary{
  border-color: #0f766e;
  background: linear-gradient(135deg, #0ea5a3, #14b8a6);
  color: #ffffff;
}

.cookie-btn.cookie-btn-primary:hover{
  filter: saturate(1.08);
}

@media (max-width: 700px){
  .cookie-banner{
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .cookie-banner-card{
    padding: 10px;
    border-radius: 12px;
  }

  .cookie-banner-actions{
    justify-content: stretch;
  }

  .cookie-btn{
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    padding: 8px 8px;
  }
}

/* ===== LEGAL FOOTER ===== */
.legal-footer{
  position: fixed;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(216, 221, 227, .85);
  backdrop-filter: blur(2px);
  font-size: 11px;
  line-height: 1.2;
}

.legal-footer a{
  color: #334155;
  text-decoration: none;
}

.legal-footer a:hover{
  text-decoration: underline;
}

.legal-dot{
  color: #94a3b8;
}

@media (max-width: 700px){
  .legal-footer{
    max-width: calc(100vw - 10px);
    gap: 4px;
    padding: 2px 6px;
    font-size: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
}

