/* KBH_STAGE_77_SALES_EDIT_VISIBILITY_ACTIONS_V1 */
/* KBH_STAGE_52_DIMENSIONAL_BASE_PRICE_WEIGHT_V1 */
:root{
  --bg:#0f1115; --fg:#e8ebf0; --muted:#9aa3b2; 
  --brand: #f4c400;
  --brand2: #ffda3a;
  --accent: var(--brand);
  --warn:#ffb74d; --danger:#ff6b6b; --card:#151a21; --border:#232a35;
  --shadow: 0 6px 18px rgba(0,0,0,.25);
}

/* ===== Konto: “hero” nagłówek w panelu (np. Technologia) ===== */
.acc-hero{
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(110,168,254,0.10), rgba(2,6,23,0.12));
  padding: 12px 14px;
  margin: 10px 0 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.acc-hero-title{
  font-size: 15px;
  letter-spacing: .2px;
}
.acc-hero-sub{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}


/* ===== Konto: wygląd modalu ===== */
.acc-top{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  margin-bottom: 6px;
}
.acc-title{ margin:0; font-size:18px; }
.acc-subtitle{ color: var(--muted); font-size: 13px; margin-top: 2px; }
.acc-pill{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#10151d;
  font-size:12px;
}
.acc-x{
  width: 36px; height: 36px;
  border-radius: 10px;
  border:1px solid var(--border);
  background:#10151d;
  color: var(--fg);
  cursor:pointer;
}
.acc-x:hover{ border-color: var(--brand); }


/* ===== Konto: zakładki w modalu ===== */
.acc-tabs{
  display:flex;
  gap:8px;
  border-bottom:1px solid var(--border);
  padding-bottom:8px;
  margin: 6px 0 10px;
  flex-wrap:wrap;
}
.acc-tab{
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#10151d;
  color:var(--fg);
  cursor:pointer;
}
.acc-tab[aria-selected="true"]{
  outline:2px solid var(--brand);
}
.acc-panel{ display:none; }
.acc-panel.active{ display:block; }

/* scroll wewnątrz (ładny jak w aplikacji) */
.acc-scroll{
  /*
    Mobile fix: vh bywa "zawyżone" przez pasek adresu (Safari/Chrome),
    przez co dół modala (np. przycisk "Zapisz") potrafi się przyciąć.
    Minimalnie zmniejszamy wysokość i używamy dvh tam, gdzie dostępne.
  */
  max-height: calc(80vh - 210px);
  max-height: calc(80dvh - 210px);
  overflow-y: auto;
  padding-right: 6px; /* miejsce na scrollbar */
}
.acc-scroll::-webkit-scrollbar{ width: 10px; }
.acc-scroll::-webkit-scrollbar-track{
  background:#0b0e13;
  border-left:1px solid var(--border);
}
.acc-scroll::-webkit-scrollbar-thumb{
  background:#2a3342;
  border-radius:8px;
  border:2px solid #0b0e13;
}

/* ===== CRM: Karta Klienta (Modal) ===== */
.client-card-modal { 
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); 
  display: grid; place-items: center; z-index: 10000; padding: 20px; 
}
.client-card-content { 
  background: var(--card, #151a21); border: 1px solid var(--border, #232a35); 
  border-radius: 16px; width: 100%; max-width: 900px; max-height: 90vh; 
  display: flex; flex-direction: column; overflow: hidden; 
  box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
}
.client-card-header { 
  padding: 20px; border-bottom: 1px solid var(--border); 
  display: flex; justify-content: space-between; align-items: flex-start; 
  background: linear-gradient(to right, rgba(244,196,0,0.05), transparent); 
}
.client-card-body { 
  padding: 20px; overflow-y: auto; display: grid; 
  grid-template-columns: 1fr 1.5fr; gap: 24px; 
}
@media (max-width: 768px) { .client-card-body { grid-template-columns: 1fr; } }
.client-info-section h4, .client-history-section h4 { 
  margin: 0 0 12px; color: var(--brand); font-size: 14px; 
  text-transform: uppercase; letter-spacing: 1px; 
}
.client-details-grid { display: grid; gap: 12px; }
.client-detail-item { display: flex; flex-direction: column; gap: 2px; }
.client-detail-label { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.client-detail-value { font-size: 14px; font-weight: 500; }
.client-history-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.history-item { 
  padding: 10px 12px; border-bottom: 1px solid var(--border); 
  display: flex; justify-content: space-between; align-items: center; 
  background: rgba(255,255,255,0.02); cursor: pointer;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: rgba(244,196,0,0.1); border-color: var(--brand); }
.history-item .date { font-size: 12px; color: var(--muted); }
.history-item .name { font-weight: 500; font-size: 13px; }
.client-card-footer { 
  padding: 16px 20px; border-top: 1px solid var(--border); 
  display: flex; justify-content: flex-end; gap: 10px; 
  background: rgba(0,0,0,0.2); 
}
.btn-icon { 
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); 
  background: #10151d; color: var(--fg); cursor: pointer; transition: all 0.2s; 
}
/* Podświetlanie wierszy - wymuszone dla tabeli zleceń */
#ordersTable tbody tr:hover td {
  background: rgba(244, 196, 0, 0.12) !important;
}

#ordersTable tbody tr {
  transition: background 0.1s;
}

/* Przycisk CRM - styl premium */
#btnQuotesManage {
  background: transparent !important;
  border: 1px solid var(--brand) !important;
  color: var(--brand) !important;
  padding: 6px 16px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
}
#btnQuotesManage:hover {
  background: var(--brand) !important;
  color: #000 !important;
}

.acc-scroll::-webkit-scrollbar-thumb:hover{ background:#3a4558; }
.acc-scroll{ scrollbar-width: thin; scrollbar-color:#2a3342 #0b0e13; }

/* sekcje + linie */
.acc-section{ margin: 10px 0 8px; }
.acc-section-head{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.acc-section-title{ font-size: 14px; }
.acc-section-sub{ font-size: 12px; color: var(--muted); }
.acc-hr{
  height: 1px;
  bbackground: linear-gradient(90deg, transparent, rgba(110,168,254,0.40), transparent);
  margin-top: 8px;
}

/* ===== mocniejsze oddzielenie grup (Czasy/Koszty/…) ===== */
.acc-group{
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 14px;
  padding: 10px 12px 12px;
  background: rgba(2,6,23,0.10);
  margin: 10px 0 12px;
}

.acc-footer{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148,163,184,0.18);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.acc-hint{
  color: var(--muted);
  font-size: 12px;
}
.acc-actions{ margin-top: 0 !important; }
.acc-grid{ grid-template-columns: repeat(2, minmax(240px,1fr)); }
@media (max-width:900px){
  .acc-grid{ grid-template-columns: 1fr; }
}

/* technologia: “kafelki” pól */
.acc-tech-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}
@media (max-width: 900px){
  .acc-tech-grid{ grid-template-columns: 1fr; }
}
.acc-field{
  border: 1px solid rgba(148,163,184,0.20);
  border-radius: 12px;
  background: rgba(2,6,23,0.15);
  padding: 10px 12px;
}
.acc-field-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 8px;
}
.acc-field-title b{
  letter-spacing: .15px;
}
.acc-field-title{
  margin-bottom: 6px;
}
.acc-field input{
  width: 100%;
}
.acc-field-hint{
  margin-top: 6px;
  font-size: 11px;
  color: rgba(154,163,178,0.75);
  font-variant-numeric: tabular-nums;
}

/* Reset & base */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font:16px/1.45 system-ui,Segoe UI,Roboto,Helvetica,Arial;
  background:var(--bg);
  color:var(--fg);
}

/* ===== Sidebar (header) + global layout ===== */
body{
  display: block;
}

/* Lewy panel jako stały sidebar — BEZ ROZMYCIA, z ładnym scrollem i rynną na scrollbar */
header{
  position:fixed;
  left:0;
  top: var(--topbar-h);      /* pod topbarem */
  bottom:0;
  width:220px;
  padding:16px;
  border-right:1px solid var(--border);
  background: var(--card);   /* jednolite tło */
  display:flex;
  flex-direction:column;
  gap:12px;
  z-index:2000;              /* poniżej topbara */
  overflow-y:auto;           /* własny scroll, niezależny od strony */
  overflow-x:hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges; /* rezerwuje miejsce na scrollbar po prawej */
}

/* estetyczny scrollbar w sidebarze */
header::-webkit-scrollbar{ width: 10px; }
header::-webkit-scrollbar-track{
  background:#0b0e13;
  border-left:1px solid var(--border);
}
header::-webkit-scrollbar-thumb{
  background:#2a3342;
  border-radius:8px;
  border:2px solid #0b0e13; /* żeby nie „wchodził” na przyciski */
}
header::-webkit-scrollbar-thumb:hover{ background:#3a4558; }
header{ scrollbar-width: thin; scrollbar-color:#2a3342 #0b0e13; } /* Firefox */

header h1{ margin:0 0 8px; font-size:1.2rem; text-align:center }

/* Nawigacja pionowa w headerze */
header nav, header .nav{
  display:flex;
  flex-direction:column;
  gap:10px;
}
header nav a, header .nav a{
  color:var(--fg);
  text-decoration:none;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  text-align:center;
  background:#121722;
  transition: border-color .15s ease, transform .05s ease, background .15s ease;
}
header nav a:hover, header .nav a:hover{ border-color:var(--brand); background:#161c28 }
header nav a.active, header .nav a.active{ outline:2px solid var(--brand) }

/* TYLKO: Wycena + Zlecenia mają wyglądać jak .navbtn (ikonka + tekst) */
header nav a#navSummary,
header nav a#navOrders,
header nav a#navInquiries,
header nav a#navDrawings,
header nav a#navReports{
  /* jak .navbtn */
  padding: 12px 16px;
  font-size: 0.95rem;
  text-align: center;

  /* ikonka + tekst jak w Ustawieniach */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ikonka przed tekstem (tylko dla tych dwóch linków) */
header nav a#navSummary::before,
header nav a#navOrders::before,
header nav a#navInquiries::before,
header nav a#navDrawings::before,
header nav a#navReports::before{
  content: attr(data-icon);
  display: inline-block;
  line-height: 1;
}



/* „Hamburger” na pasku */
header nav .navbtn{
  appearance:none; border:1px solid var(--border); border-radius:8px; background:#121722; color:var(--fg);
  padding:12px 16px;
  cursor:pointer; text-align:center; width:100%;
  font-size:0.95rem;
}
header nav .navbtn:hover{ border-color:var(--brand); background:#161c28; }

/* Stopka wewnątrz lewego paska – „© CUTOR” */
.sidebar-footer{
  margin-top:auto;
  border-top:1px solid var(--border);
  color:var(--muted);

  font-size:.75rem;          /* delikatnie mniejsza czcionka */
  text-align:left;           /* wyrównanie do lewej */
  padding:6px 10px 4px 10px; /* lekko „wjeżdża” w lewo */
}

/* Główna kolumna po prawej od sidebaru */
main{
  flex:1;
  padding:16px 24px;
  margin-left:220px; /* miejsce na sidebar */
  min-width:0;
  margin-right:360px; /* rezerwa miejsca na prawy panel */
}

/* Headings */
h1,h2,h3{margin:8px 0 12px}

/* Steps / routes */
.step,
.route {
  display: none;
  background: var(--card);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  /* NAJWAŻNIEJSZE: pełna szerokość, bez centrowania */
  max-width: none;
  width: 100%;
  margin: 0 0 20px;
}

.step.active,
.route.active {
  display: block;
}


.hidden{display:none !important}

/* Layout grids */
.grid{
  display:grid; grid-template-columns:repeat(2,minmax(240px,1fr)); gap:12px;
}
@media (max-width:900px){
  .grid{ grid-template-columns:1fr }
}

/* Form controls */
label{display:block; color:var(--muted); margin-bottom:6px}
input, textarea, select,
label input, label textarea{
  width:100%; padding:10px; border:1px solid var(--border); border-radius:8px;
  background:#0b0e13; color:var(--fg); outline:none;
}
textarea{min-height:110px; resize:vertical}

/* Buttons / actions */
.actions, .nav{
  margin-top:16px;display:flex;gap:12px;flex-wrap:wrap
}
button, .buttonlike{
  padding:10px 14px; border:1px solid var(--border); border-radius:8px;
  background:#182235; color:var(--fg); cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center;
  transition:transform .05s ease, border-color .15s ease;
}
button:hover,.buttonlike:hover{border-color:var(--brand)}
button:active{ transform: translateY(1px) }
button.secondary,.buttonlike.secondary{background:#141c2b}
button.toggle.active{outline:2px solid var(--brand)}

/* przycisk-ikona (kosz) */
button.icon{
  width:28px; height:28px; padding:0; display:grid; place-items:center; border-radius:8px;
}
button.icon svg{ display:block; width:16px; height:16px; }

/* === KROK 2: lista rysunków z grubością === */
#drawingsList{
  list-style:none;
  padding:0;
  margin:10px 0;
  display:block;              /* zamiast gridu kart */
}

/* jeden wiersz: 1/3 nazwa + 2/3 pola */
#drawingsList li{
  border:1px dashed var(--border);
  border-radius:8px;
  padding:8px;
  background:#0c1016;

  display:grid;
  grid-template-columns:2fr 1fr;  /* 1/3 : 2/3 */
  align-items:center;
  gap:12px;
}

/* select z jednostkami nie rozciąga się */
#drawingsList li select{
  width: auto;         /* realna szerokość nada mu skrypt – = szerokości przycisku */
  flex: 0 0 auto;      /* nie rośnie */
}

/* prawa część w jednej linii */
#drawingsList li > div:last-child{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
}

/* input na grubość */
#drawingsList li input[type="number"]{
  width:80px;
  text-align:right;
}

#drawingsList img{max-width:100%;display:block}

/* Toolbar & canvas / SVG */
.selector{margin:10px 0}
.toolbar{display:flex;gap:8px;margin:8px 0 12px;flex-wrap:wrap}

/* --- PODGLĄD --- */
#canvasWrap{
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px;
  background:#0c1016;
  height:600px;
  overflow:hidden;
  box-shadow:var(--shadow);
  position:relative; /* może zostać, niczemu nie szkodzi */
}

/* Canvas = jedyny viewer w Kroku 3 */
#cadCanvas{
  background:#0b0f16;
  border-radius:8px;
  width:100%;
  height:100%;
  display:block;
}

/* Stary SVG w Kroku 3 chowamy – służy tylko jako źródło geometrii */
#svgContainer{
  display:none;
}



/* Picklists */
.picklist{ list-style:none; margin:8px 0 12px; padding:0; display:grid; gap:8px }
.picklist li{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px; background:#111722; border:1px solid var(--border); border-radius:10px;
  font-variant-numeric: tabular-nums;
}
.picklist li.active{
  outline: 2px solid var(--brand);
  box-shadow: 0 0 0 2px rgba(74,163,255,0.35), 0 0 14px rgba(74,163,255,0.20);
}

/* Kolory i glow per lista (Krok 3) */
#cutsList.picklist li.active{
  outline-color: #61d095;
  box-shadow: 0 0 0 2px rgba(97,208,149,0.55), 0 0 16px rgba(97,208,149,0.35);
  background: rgba(97,208,149,0.08);
}
#drillsList.picklist li.active{
  outline-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56,189,248,0.55), 0 0 16px rgba(56,189,248,0.35);
  background: rgba(56,189,248,0.08);
}
.picklist .name{ cursor:pointer }
.picklist .name:hover{ text-decoration:underline }
.picklist .del:hover{ color:var(--danger) }

/* Cards & price box */
.card{
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px;
  background:#111722;
  margin-top:12px;
  box-shadow:var(--shadow);
  width:100%;           /* nowość – wypełnij całą sekcję */
  box-sizing:border-box;/* uwzględnij padding w szerokości */
}

.price{
  margin-top:16px;
  font-size:18px;
  display:flex;
  align-items:center;
  gap:12px;
  background:#10151d;
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px 14px;
  width:100%;           /* opcjonalnie też na full szerokość */
  box-sizing:border-box;
}

.price strong{ font-size:22px }

/* SVG highlight feedback */
.highlight{ filter: drop-shadow(0 0 6px rgba(88,214,141,.85)); stroke: var(--accent) !important }

/* ==== Responsywność sidebaru ==== */
@media (max-width: 860px){
  header{ width: 180px; padding:12px; }
  main{ margin-left:180px }
}
/* Przy 640px NIE zmieniamy już sidebara na sticky — nadal jest fixed */
@media (max-width: 640px){
  main{ margin-left:0; margin-right:0; } /* możesz chcieć nadpisać niżej; zostawiam jak było */
}

/* ==== KROK 3: scena ==== */
.stage3{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
  align-items: start;
}

/* ==== PRAWY PANEL ==== */
.sidepane-fixed {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);   /* pod topbarem */
  right: 0;
  width: 340px;

  background: #111722;
  border-left: 1px solid var(--border);
  border-radius: 10px 0 0 10px;
  box-shadow: -3px 0 12px rgba(0,0,0,0.3);
  padding: 10px;

  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;

  /* Klucz: wysokość zależna od zawartości, ale z limitem = wysokość okna */
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
}


/* akordeon */
.acc-item{
  border:1px solid var(--border);
  border-radius:10px;
  background:#111722;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.acc-btn{
  width:100%;
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:12px 14px; 
  background:#121722; 
  border:0; 
  border-bottom:1px solid var(--border);
  cursor:pointer; 
  font-weight:600;
  
    /* tu dochodzi animacja */
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}
.acc-btn:hover{ border-color:var(--brand) }
.acc-caret{ font-size:14px; opacity:.9 }
.acc-panel{ display:none; padding:10px 12px; }
.acc-item.acc-open .acc-panel{ display:block }
.acc-panel .picklist{ margin:8px 0 10px }

/* Nagłówek aktywnej (rozwiniętej) sekcji */
.acc-item.acc-open > .acc-btn{
  background-color:#182335;                 /* trochę jaśniejsze tło */
  box-shadow:0 0 0 1px #2e3b55 inset;       /* delikatna obwódka */
  color:#ffffff;
}


/* Scrollbar dla list – stała wysokość, bez zależności od vh */
#cutsList.picklist,
#drillsList.picklist{
  max-height: 320px;          /* ~5–6 pozycji, możesz zmienić np. na 280/360 */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #354158 #0b0e13;
}

#cutsList.picklist::-webkit-scrollbar,
#drillsList.picklist::-webkit-scrollbar{ width: 8px; }
#cutsList.picklist::-webkit-scrollbar-track,
#drillsList.picklist::-webkit-scrollbar-track{
  background: #0b0e13;
  border-left: 1px solid var(--border);
}
#cutsList.picklist::-webkit-scrollbar-thumb,
#drillsList.picklist::-webkit-scrollbar-thumb{
  background: #2a3342;
  border-radius: 8px;
  border: 1px solid #0b0e13;
}
#cutsList.picklist::-webkit-scrollbar-thumb:hover,
#drillsList.picklist::-webkit-scrollbar-thumb:hover{
  background: #354158;
}

/* Na węższych ekranach panel pod treścią */
@media (max-width: 900px){
  .sidepane-fixed{
    position: static; width: 100%;
    border-left: none; border-radius: 0; box-shadow: none; margin-top: 10px; max-height: none;
  }
  main{ margin-right:0; }
}

/* LIGHT THEME */
.theme-light{
  --bg:#f7f8fa; --fg:#0c1220; --muted:#5e6b7f; 
  --brand:#0b63ff; 
  --accent: var(--brand);
  --warn:#f39c12; --danger:#e74c3c; --card:#ffffff; --border:#dfe6ef;
}

/* Modal */
.modal{ position:fixed; inset:0; display:grid; place-items:center; background:rgba(0,0,0,.5); z-index:9999; }
.modal.hidden{ display:none !important; }
.modal-card{
  width:min(720px, 92vw);
  background:var(--card);
  color:var(--fg);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  padding:16px;
}


/* ===== "Moje konto" (Dane konta) – podniesienie okna na mobile =====
   Na telefonach dół bywa ucinany (vh + paski przeglądarki).
   Podnosimy całą kartę o ok. 1.5 wysokości przycisku (zapas sterowany clamp). */
:root{
  --acc-modal-lift: clamp(64px, 9vh, 96px);
}
@media (max-width: 700px){
  .modal.acc-modal{
    /* trochę oddechu od krawędzi + bezpieczny obszar iOS */
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
  }
  .modal.acc-modal .modal-card.acc-modal-card{
    transform: translateY(calc(-1 * var(--acc-modal-lift)));
  }

  /* ✅ iOS/Safari: dół modala bywa "ucięty" przez pasek + safe-area.
     Dajemy zapas od dołu i ograniczamy wysokość karty, żeby footer (Zapisz) zawsze był w całości. */
  .modal.acc-modal .modal-card.acc-modal-card{
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    margin-bottom: calc(10px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 24px - env(safe-area-inset-bottom) - var(--acc-modal-lift)) !important;
  }

}

.modal-card h3{ margin:0 0 12px; }
.modal-card .grid{
  display:grid;
  grid-template-columns: 1fr; 
  gap:12px;
}
.modal-card .actions{ display:flex; gap:8px; justify-content:flex-end; margin-top:8px; }
.modal-card button.secondary{ background:transparent; border:1px solid var(--border); }

.upload-buttons {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.btn-primary,
.btn-secondary {
  font-size: 1rem;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover{
  background-color: var(--brand);
  color: #111;
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 0 0 4px rgba(244,196,0,0.18);
}


.btn-secondary {
  background-color: #555;
  color: white;
}

.btn-secondary:hover {
  background-color: #333;
}

.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spin {
  -moz-appearance: textfield;
}

/* ===== Okno operacji (draggable, 5 zakładek, sticky foot) ===== */
.op-dialog {
  position: fixed;
  left: 50%;
  top: 15vh;                 /* 1/4 wysokości ekranu od góry */
  transform: translateX(-50%); /* centrowanie w poziomie */
  z-index: 99999;
  width: min(900px, 92vw);
  max-height: 92vh;              /* okno mieści się w viewport */
  overflow: auto;                /* ewentualny scroll całego okna */  
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow:
     0 18px 55px rgba(0,0,0,.55),
     0 0 0 2px rgba(255,255,255,.03),
     0 0 28px rgba(80,160,255,.25); /* jaśniejszy glow */
  pointer-events: auto;
}

.op-head {
  cursor: move; user-select: none;
  display:flex; align-items:center; gap:8px;
  padding: 10px 12px; border-bottom:1px solid var(--border); background:#121722;
  border-radius:12px 12px 0 0;
}
.op-head h3 { margin:0; font-size:16px }
.op-actions{ margin-left:auto; display:flex; gap:8px; }
.op-body { padding: 10px 12px 12px; /* bez sztywnego max-height */ }.op-tabs { display:flex; gap:8px; border-bottom:1px solid var(--border); padding-bottom:8px; margin-bottom:8px; flex-wrap:wrap }
.op-tab {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;   /* było border-raius */
  background: #10151d;
  cursor: pointer;
}

.op-tab[aria-selected="true"] { outline:2px solid var(--brand) }
.op-panel { display:none }
.op-panel.active { display:block }
/* przyciski w nagłówku */
.op-actions .save   { background:#ffe600; color:#111; border-color:#d4c400; cursor:pointer; }
.op-actions .gen    { background:#4a90e2; color:#fff; border-color:#3f7cc2; cursor:pointer; }
.op-actions .cancel { background:#f7d7c8; color:#2b100a; border-color:#e8c1af; cursor:pointer; }

/* małe detale dla formularza */
.op-body .grid { display:grid; grid-template-columns: 1fr 1fr; gap:10px }
.op-body .grid.onecol { grid-template-columns: 1fr; }
@media (max-width: 780px){ .op-body .grid { grid-template-columns: 1fr } }

/* pole opisowe */
.field { display:flex; flex-direction:column; gap:4px }
.field small { opacity:.65; font-style:italic }
.row { display:flex; align-items:center; gap:10px; flex-wrap:wrap }
.grow { flex:1 1 200px }
input[type="number"], input[type="text"], select {
  width: 100%; padding:8px 10px; background:#0f141c; color:var(--fg);
  border:1px solid var(--border); border-radius:6px;
}
/* zielone przyciski wyboru (pojedynczy wybór w grupie) */
.choice-group { display:flex; gap:8px; flex-wrap:wrap }
.choice{
  padding:6px 12px;
  border:1px solid #355a8a;    /* niebieskawa ramka */
  background:#1b2a42;          /* ciemny, niebieskawy „idle” */
  color:#eaf1ff;
  border-radius:6px;
  cursor:pointer; user-select:none;
}
.choice:hover{
  border-color: var(--brand);
  background:#213352;
}
.choice[aria-pressed="true"]{
  background: var(--brand);     /* aktywny = brand */
  color:#fff;
  border-color: var(--brand);
}


.choice[disabled] { opacity:.45; cursor:not-allowed }
/* prawy panel z parametrami narzędzia */
.tool-summary { min-width: 220px; border:1px dashed var(--border); border-radius:8px; padding:10px 12px; }
.tool-summary dt { opacity:.7 }
.tool-summary dd { margin:0 0 6px 0 }

/* ładne scrollbary tylko w oknie operacji */
.op-body::-webkit-scrollbar { width: 12px }
.op-body::-webkit-scrollbar-thumb { background:#2a3444; border-radius:10px }
.op-body::-webkit-scrollbar-track { background:transparent }


/* ——— Ujednolicenie pól w oknie operacji — naprawa łamania ——— */
:root{ --op-num-width: 160px; }

/* liczby: stała, wąska szerokość jak RPM, ale bez wymuszania szerokiego flex-basis */
.op-dialog .op-panel .row input[type="number"]{
  width: var(--op-num-width) !important;
  flex: 0 0 auto !important;   /* było: 0 0 var(--op-num-width) → robiło twarde „min” */
}

/* tekst/textarea/select: pozwól rosnąć, ale bez 240px minimalnej szerokości */
.op-dialog .op-panel .row input[type="text"],
.op-dialog .op-panel .row textarea,
.op-dialog .op-panel .row select{
  width: 100% !important;
  flex: 1 1 0% !important;     /* było: 1 1 240px — to podnosiło wysokość wierszy */
  min-width: 0 !important;     /* zapobiega wymuszonym zawijaniom w flexboxie */
}

/* CV/CCV obok RPM – niech zajmują tylko swoją naturalną szerokość + przesunięcie 16px */
.op-dialog .op-panel .row .choice-group{
  flex: 0 0 auto !important;
  white-space: nowrap;      /* nie rozpychaj wiersza */
  margin-left: 26px !important;  /* <<< przesunięcie w prawo */
}


/* na wszelki wypadek, zostaw „gap” wierszy jak wcześniej */
.op-dialog .op-panel .row{ gap:10px; }  /* w obu plikach było 10px */



/* ===== Tryb pełnoekranowy obszaru roboczego (pseudo-FS w obrębie strony) ===== */
.fs-mode header{ display:none !important; }
.fs-mode main{ margin-left:0 !important; margin-right:0 !important; padding:8px !important; }
.fs-mode .sidepane-fixed{ z-index:1000; } /* panel zawsze nad obszarem roboczym */

.fs-mode #canvasWrap{
  position: fixed !important;
  inset: 8px var(--fs-right, 360px) 8px 8px;  /* miejsce na prawy panel */
  height: auto !important;
  z-index: 500;  /* pod panelem, nad tłem */
}

@media (max-width: 900px){
  /* na wąskich – panel i tak robi się „nie-fixed”; w FS wymuszamy pełny ekran pod panelem */
  .fs-mode #canvasWrap{ inset: 8px 8px 8px 8px; }
}

/* Pływający, okrągły przycisk w prawym dolnym rogu obszaru roboczego */
#canvasWrap .fs-btn{
  position: absolute;
  right: 14px; bottom: 14px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #121722;
  color: var(--fg);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
}
#canvasWrap .fs-btn:hover{ border-color: var(--brand); }

/* (komentarz funkcyjny pozostawiony z poprzedniej wersji pliku)
W oknie głónym z lewej strony w tym panelu bocznym, po Krok 3 a przed Wycena, powinien być przycisk "Parametry" ...
*/

/* === Przyciski w krokach formularza === */
button,
input[type="button"],
input[type="submit"] {
  background-color: #1a1f2a;         /* ciemny granat, pasuje do tła */
  color: #ddd;                       /* jasny tekst */
  border: 1px solid #2b3240;         /* delikatna ramka */
  padding: 6px 14px;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover {
  background-color: #2b3240;         /* trochę jaśniejszy przy najechaniu */
  color: #fff;
  border-color: #3a4354;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active {
  background-color: #394253;         /* ciut ciemniejszy klik */
}

/* Dodatkowy kolor akcentu dla ważnych akcji */
button.primary,
input[type="submit"].primary {
  background-color: var(--brand);          /* żółty */
  border-color: rgba(0,0,0,0.12);
  color: #111;
  box-shadow: 0 0 0 4px rgba(244,196,0,0.18);
}
button.primary:hover,
input[type="submit"].primary:hover {
  background-color: #4d7dff;
}

/* === Delikatne niebieskie podświetlenie wybranych przycisków === */
#openQuoteBtn,
#openQuoteConfirm,
a.buttonlike[href="#/step2"] {
  background-color: #1e2a44;       /* ciemny niebiesko-szary */
  color: #eaf1ff;                  /* lekko błękitny tekst */
  border: 1px solid #355a8a;       /* niebieskawe obramowanie */
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

#openQuoteBtn:hover,
#openQuoteConfirm:hover,
a.buttonlike[href="#/step2"]:hover {
  background-color: #f4c400;       /* jasny, delikatny niebieski */
  border-color: #f4c400;
  color: #fff;
}

/* ===== Topbar ===== */
#topbar{
  position: fixed;                  /* <<< NA STAŁE U GÓRY */
  top: 0; 
  left: 0;                          /* <<< pełna szerokość od lewej */
  right: 0;                         /* <<< pełna szerokość do prawej */
  width: 100%;                      /* <<< bezwzględnie 100% */
  z-index: 3000;                    /* nad sidebarami i treścią */
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0));
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
  margin-left: 0;                   /* <<< nic nie przesuwa topbara */
}

/* na wąskim układzie topbar pozostaje fixed na pełną szerokość */
@media (max-width: 640px){
  #topbar{ position: fixed; top: 0; left: 0; right: 0; width:100%; }
}

#topbar .tb-left, #topbar .tb-right{ display:flex; align-items:center; gap:8px; }

#topbar .tb-logo{
  display:inline-flex; align-items:center; gap:0px;  /* mniejsza przerwa między ikoną a tekstem */
  border:0px solid var(--border); border-radius:8px;
  padding:0px 0px;                                   /* to zwęża i obniża przycisk */
  background:#121722; color:var(--fg); cursor:pointer;
}

#topbar .tb-logo svg{
  /* większa zawartość: logo + napis */
  display:block;
  height:40px;              /* powiększony środek */
  width:120px;
}


#topbar .tb-btn{
  display:flex; align-items:center; gap:0px;
  padding:8px 12px; border:1px solid var(--border); border-radius:999px;
  background:#121722; color:var(--fg); cursor:pointer;
  transition: border-color .15s ease, background .15s ease, transform .05s ease;
}
#topbar .tb-btn:hover{ border-color: var(--brand); background:#161c28; }
#topbar .tb-btn:active{ transform: translateY(1px); }
#topbar .tb-btn svg{ width:16px; height:16px; fill:currentColor; opacity:.95 }

/* delikatny wariant */
#topbar .tb-btn.soft{ background:#10151d; }

/* dropdown */
.tb-dropdown{ position:relative; }
.tb-menu{
  position:absolute; right:0; top: calc(100% + 6px);
  min-width: 220px;
  background: var(--card); border:1px solid var(--border); border-radius:10px;
  box-shadow: var(--shadow); padding:6px; display:none;
}
.tb-dropdown[aria-open="true"] .tb-menu{ display:block; }
.tb-item{
  width:100%; text-align:left; padding:8px 10px;
  background:transparent; color:var(--fg);
  border:1px solid transparent; border-radius:8px; cursor:pointer;
}
.tb-item:hover{ background:#121722; border-color:var(--border); }
.tb-item.danger{ color: var(--danger); }

/* topbar + fixed right panel spacing still OK */
body > main{ margin-top: 8px; }

/* ==== Layout z konfigurowalną szerokością lewego paska ==== */
:root { --sidebar-w: 220px; --topbar-h: 56px; }

/* ujednolicamy szerokość sidebara i margines main */
header{ width: var(--sidebar-w); }
main{ margin-left: var(--sidebar-w); }

/* TOPBAR – zawsze na górze i na całą szerokość */
#topbar{
  position: fixed;
  top: 0; 
  left: 0;                 /* <<< pełna szerokość */
  right: 0;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 12px;
  background: linear-gradient(180deg, rgba(16,21,30,.9), rgba(16,21,30,.75));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
  z-index: 3000;
}
body{ padding-top: var(--topbar-h); }  /* zrób miejsce na topbar pod spodem */

/* przyciski/rozwijane w topbarze */
#topbar .tb-left, #topbar .tb-right{ display:flex; align-items:center; gap:8px; }
#topbar .tb-btn{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--border); border-radius:8px; padding:8px 10px;
  background:#121722; color:var(--fg); cursor:pointer;
}
#topbar .tb-btn.soft{ background:#10151d; }
#topbar .tb-btn:hover{ border-color: var(--brand); }
#topbar .tb-dropdown{ position:relative; }
#topbar .tb-menu{
  position:absolute; top:100%; right:0;
  min-width: 220px;
  background:#0f141e; border:1px solid var(--border); border-radius:10px;
  box-shadow: var(--shadow); padding:6px; display:none;
  font-size: 16px; text-align: left;               /* (6) większa czcionka + wyrównanie do lewej */
}
#topbar .tb-dropdown[aria-open="true"] .tb-menu{ display:block; }
#topbar .tb-item{
  width:100%; text-align:left; padding:8px 10px; border-radius:8px; border:1px solid transparent;
}
#topbar .tb-item:hover{ border-color: var(--brand); background:#161c28; }

/* ====== Zwinięcie lewego paska (4) ====== */
body.sidebar-collapsed{ --sidebar-w: 64px; }
body.sidebar-collapsed header h1 { display:none; }
body.sidebar-collapsed #navParamsList { display:none !important; }
body.sidebar-collapsed header nav a,
body.sidebar-collapsed header nav .navbtn{
  font-size: 0; padding: 10px; text-align:center;
}
body.sidebar-collapsed header nav a::before,
body.sidebar-collapsed header nav .navbtn::before{
  content: attr(data-icon);
  font-size: 18px; line-height: 1; display:inline-block;
}
/* topbar NIE przesuwa się przy zwinięciu paska */
body.sidebar-collapsed #topbar{ left: 0; }

/* (pozostawiony komentarz – w poprzedniej wersji był tu blok JS, który nie powinien być w CSS) */

/* Widok zwinięty – teksty znikają, zostaje ikonka z data-icon */
body.sidebar-collapsed header{
  width: var(--sidebar-w-collapsed) !important;
}
body.sidebar-collapsed main{
  margin-left: var(--sidebar-w-collapsed) !important;
}

/* Każdy .navbtn z atrybutem data-icon pokaże samą ikonkę */
header .navbtn[data-icon]::before{
  content: attr(data-icon);
  margin-right: 8px;
}
body.sidebar-collapsed header .navbtn span{
  display: none !important;       /* chowamy napisy */
}
body.sidebar-collapsed header .navbtn{
  text-align: center;
  padding: 10px;
}
body.sidebar-collapsed header .navbtn[data-icon]::before{
  margin-right: 0;                 /* ikonka wyśrodkowana */
  display: inline-block;
  font-size: 18px;
}

/* Szerokości w trybie normalnym */
header{ width: var(--sidebar-w); }
main{ margin-left: var(--sidebar-w); }

.vh{
  position:absolute!important; width:1px!important; height:1px!important;
  padding:0!important; margin:-1px!important; overflow:hidden!important;
  clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important;
}

/* Wymuś układ dwukolumnowy także na małych szerokościach
   i utrzymaj stały, przyklejony sidebar po lewej */
@media (max-width: 640px){
  body{ flex-direction: row !important; }
  header{
    position: fixed !important;
    left: 0 !important;
    top: var(--topbar-h) !important; 
    bottom: 0 !important;
    width: var(--sidebar-w) !important;
    border-right: 1px solid var(--border);
    border-bottom: 0 !important;
    overflow-y: auto !important;      /* niezależny scroll */
  }
  body.sidebar-collapsed header{ width: var(--sidebar-w-collapsed) !important; }
  main{
    margin-left: var(--sidebar-w) !important;
    margin-right: 0 !important;
  }
  body.sidebar-collapsed main{ margin-left: var(--sidebar-w-collapsed) !important; }
}
/* === [PATCH] 1) Usuń napis "CUTOR" na lewym pasku === */
/* Pokrywamy kilka możliwych wariantów znacznika/klasy */
header h1,
header .logo,
header .brand,
header .logo-text{
  display: none !important;
}

/* === [PATCH] 2) Przyciski w kolumnie – jednakowa szerokość (także po zwinięciu) === */
header nav a,
header .nav a,
header .navbtn,
header nav .navbtn{
  display: block !important;
  width: 100% !important;      /* wszystkie identyczna szerokość */
  box-sizing: border-box !important;
}

/* W trybie zwiniętym – wszystkie tylko ikonka, wyśrodkowane i tej samej szerokości */
body.sidebar-collapsed header nav a,
body.sidebar-collapsed header .nav a,
body.sidebar-collapsed header .navbtn,
body.sidebar-collapsed header nav .navbtn{
  font-size: 0 !important;     /* chowa tekst */
  text-align: center !important;
  padding: 10px !important;
  min-width: 0 !important;     /* brak „rozpychania” */
}
body.sidebar-collapsed header nav a::before,
body.sidebar-collapsed header .nav a::before,
body.sidebar-collapsed header .navbtn::before,
body.sidebar-collapsed header nav .navbtn::before{
  content: attr(data-icon);
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  margin: 0;
}

/* === [PATCH] 3) Panel: układ nad stopką + ukrycie duplikatu z różowej ramki === */
/* Ustawiamy kolejność w kolumnie: najpierw nawigacja, potem #toggleRightPanel, na końcu stopka */
header{ display: flex !important; flex-direction: column !important; }
header nav{ order: 1; }
#toggleRightPanel{ order: 2; margin-top: 12px; margin-bottom: 8px; }
.sidebar-footer{ order: 3; }

/* Jeśli w layoucie jest „drugi” (zbędny) przycisk panelu na samym dole,
   schowaj go niezależnie od dokładnej klasy/tekstu. Poniższe selektory
   trafią w najczęstsze warianty: */
header .navbtn[title*="'- -'"],
header .navbtn[data-extra="duplicate"],
header .navbtn.duplicate{
  display: none !important;
}

/* A na wszelki wypadek: jeżeli JAKIKOLWIEK przycisk z atrybutem data-dup jest w sidebarze – schowaj */
header .navbtn[data-dup="true"]{ display: none !important; }

/* ===== [FIX] Stabilna szerokość lewego paska + treść nigdy pod nim ===== */

/* 1) Model szerokości oparty o jedną zmienną */
:root{
  --sidebar-wide: 220px;   /* standard */
  --sidebar-wide-sm: 180px;/* dla średnich ekranów */
  --sidebar-narrow: 64px;  /* zwinięty */
  --sidebar-current: var(--sidebar-wide);
}

/* 2) Zastosuj tę samą wartość do sidebara i marginesu treści */
header{
  width: var(--sidebar-current) !important;
  min-width: var(--sidebar-current) !important;
  max-width: var(--sidebar-current) !important;
  box-sizing: border-box !important;
}
main{
  margin-left: var(--sidebar-current) !important;   /* treść zawsze obok paska */
}

/* 3) Tryb zwinięty – jedna linia zmienia wszystko */
body.sidebar-collapsed{ --sidebar-current: var(--sidebar-narrow); }

/* 4) Średnie ekrany: węższy, ale spójny sidebar, treść nadal obok */
@media (max-width: 980px){
  :root{ --sidebar-current: var(--sidebar-wide-sm); }
  body.sidebar-collapsed{ --sidebar-current: var(--sidebar-narrow); }
}

/* 5) Małe ekrany: trzy rzeczy
      - zachowaj układ w wierszu,
      - sidebar dalej fixed, o stałej szerokości,
      - treść odsunięta dokładnie o szerokość paska. */
@media (max-width: 640px){
  body{ flex-direction: row !important; }

  header{
    position: fixed !important;
    left: 0 !important;
    top: var(--topbar-h) !important;
    bottom: 0 !important;
    width: var(--sidebar-current) !important;
    min-width: var(--sidebar-current) !important;
    max-width: var(--sidebar-current) !important;
    border-right: 1px solid var(--border);
    border-bottom: 0 !important;
    overflow-y: auto !important;
  }

  main{
    margin-left: var(--sidebar-current) !important;
    margin-right: 0 !important;
  }
}

/* 6) Nic wewnątrz sidebara nie może go rozszerzać */
header *{ max-width: 100% !important; }
header .navbtn,
header nav a,
header .nav a{
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden;            /* np. długi tekst/ikona nie „rozpycha” */
  text-overflow: ellipsis;
}

/* 7) Drobna kosmetyka: gdy pasek zwinięty – ikonki wyśrodkowane, bez wpływu na szerokość */
body.sidebar-collapsed header .navbtn,
body.sidebar-collapsed header nav a,
body.sidebar-collapsed header .nav a{
  font-size: 0 !important;
  text-align: center !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}
body.sidebar-collapsed header .navbtn::before,
body.sidebar-collapsed header nav a::before,
body.sidebar-collapsed header .nav a::before{
  content: attr(data-icon);
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  margin: 0;
}
/* === Patch: szerszy zwinięty sidebar, żeby scrollbar nie przycinał ikon === */
:root{
  --sbw: 2px;                 /* szacowana szerokość scrollbara (Windows/Chrome ~12px) */
}

/* zwinięty pasek: było 64px, dodajemy miejsce na scrollbar */
:root{
  --sidebar-narrow: calc(84px + var(--sbw));
}

/* upewnij się, że w trybie zwiniętym faktycznie używamy nowej szerokości */
body.sidebar-collapsed{ --sidebar-current: var(--sidebar-narrow); }

/* zachowaj „rynienkę” na scrollbar (żeby nie wchodził na treść w pasku) */
header{ scrollbar-gutter: stable both-edges; }

/* === FINAL PATCH: zwinięty pasek nie zachodzi na treść === */

/* 1) Szerokość scrollbara i szerokość paska w trybie zwiniętym */
:root{
  --sbw: 2px;
  --sidebar-narrow: calc(90px + var(--sbw));  /* BYŁO 80px */
  --sidebar-w-collapsed: var(--sidebar-narrow);
}

/* 2) W trybie zwiniętym używamy w całym layoucie jednej zmiennej */
body.sidebar-collapsed{
  --sidebar-current: var(--sidebar-narrow);
}

/* 3) Twardo nadpisz szerokość sidebara i odsunięcie treści (wygrywa z wcześniejszymi !important) */
body.sidebar-collapsed header{
  width: var(--sidebar-current) !important;
  min-width: var(--sidebar-current) !important;
  max-width: var(--sidebar-current) !important;
}
body.sidebar-collapsed main{
  margin-left: var(--sidebar-current) !important;
}


/* 4) Scrollbar w pasku – rynna po prawej, żeby nie nachodził na przyciski */
header{ scrollbar-gutter: stable both-edges; }

/* === FIX: zwinięty lewy pasek – ikony nie są przycinane (także na dużym oknie) === */

/* 1) Jedno źródło prawdy dla szerokości w trybie zwiniętym + zapas na scrollbar */
:root{
  --sbw: 12px;                          /* typowa szerokość scrollbara Windows/Chrome */
  --sidebar-collapsed-base: 64px;       /* docelowa szerokość „ikonkowa” bez zapasu */
  --sidebar-narrow: calc(var(--sidebar-collapsed-base) + var(--sbw) + 8px);
  /* alias dla starszych reguł, gdyby gdzieś jeszcze były użyte */
  --sidebar-w-collapsed: var(--sidebar-narrow);
}

/* 2) W trybie zwiniętym wszędzie używamy tej samej wartości */
body.sidebar-collapsed{
  --sidebar-current: var(--sidebar-narrow);
  --sidebar-w: var(--sidebar-narrow);   /* dla starych reguł header/main, gdyby działały wcześniej */
}

/* 3) Twardo nadpisz width/padding sidebara i margines treści (żeby nic nie weszło pod pasek) */
body.sidebar-collapsed header{
  width: var(--sidebar-current) !important;
  min-width: var(--sidebar-current) !important;
  max-width: var(--sidebar-current) !important;
  padding-left: 4px !important;         /* mniej wewnętrznego marginesu = więcej miejsca na ikonę */
  padding-right: 4px !important;
}
body.sidebar-collapsed main{
  margin-left: var(--sidebar-current) !important;
}

/* 4) Scrollbar po prawej ma „rynienkę”, więc nie nachodzi na przyciski */
header{ scrollbar-gutter: stable both-edges; }

/* 5) [Hotfix literówki] – jeśli wcześniej w arkuszu pojawiło się 'body.sidebar-collapsed main{S',
      ta poprawna reguła je nadpisze i przywróci odsunięcie treści. */

#camSvgContainer{
  height: calc(100vh - 260px); /* wygodna wysokość pod Twój layout */
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0f16;
  overflow: hidden;          /* nie wylewa się pod nawigację */
  position: relative;
}
#camSvgContainer{
  height: calc(100vh - 260px);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0f16;
  overflow: hidden;           /* trzyma rysunek w ramce */
  position: relative;         /* dla HUD-a */
}

/* HUD legend (stała w rogu, ponad SVG) */
.cam-hud-legend{
  position: absolute;
  left: 16px; top: 16px;
  font-size: 12px; color: #cbd5e1;
  line-height: 1.4;
  pointer-events: none;
  user-select: none;
}
.cam-hud-legend .it{
  display: flex; align-items: center; gap: 10px; margin: 4px 0;
}
.cam-hud-legend .sw{
  width: 60px; height: 0; border-top-width: 2px; border-top-style: solid;
}
.cam-hud-legend .in  { border-top-color: #6ee7a8; }
.cam-hud-legend .cut { border-top-color: #4aa3ff; }
.cam-hud-legend .out { border-top-color: #f7c34c; }
.cam-hud-legend .rap { border-top-color: #ff6b6b; border-top-style: dashed; }

.cam-pane{
  position:absolute; left:8px; top:8px; bottom:8px; width:280px;
  background:#0f172a; border:1px solid var(--border); border-radius:8px;
  padding:10px; overflow:auto; z-index:10;
}
.cam-modes label { display:block; margin-bottom:6px; }
.cam-modes button { margin-top:6px; }
.cam-summary{ margin:10px 0; padding:8px; background:#0b1222; border:1px solid var(--border); border-radius:6px; }
.cam-ops-header{ font-weight:700; margin:6px 0; }
.cam-op-card{
  border:1px solid var(--border); border-radius:6px; padding:8px; margin-bottom:8px; background:#0b1222;
}
.cam-op-card .op-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.cam-op-card small{ opacity:.75; }
.cam-op-card .op-actions button{ margin-right:6px; }
/* Małe, kwadratowe ikonki w kartach operacji */
.cam-op-card .op-actions .iconbtn{
  width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center;
  padding:0; border:1px solid var(--border); border-radius:6px; background:#121722; color:var(--fg); cursor:pointer;
}
.cam-op-card .op-actions .iconbtn + .iconbtn{ margin-left:6px; }
.cam-op-card .op-actions .iconbtn.danger{ color:var(--danger); border-color:#5a2d2d; }
.cam-group-title{ margin:10px 0 6px; font-weight:700; color:#9cd3ff; }

/* —— Nowy wygląd: jedna grupa operacji (shape1) —— */
.op-group{border:1px solid var(--border); border-radius:10px; background:#0b1222; padding:10px; margin:10px 0 12px;}
.opg-head{display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px;}
.opg-head .title{font-weight:700; color:#9cd3ff}
.opg-list{list-style:none; margin:0; padding:0; display:grid; gap:8px;}
.opg-item{display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border:1px solid var(--border); border-radius:8px; background:#0f172a;}
.opg-label{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width: 190px;}
.op-group .actions .btn{ padding:6px 10px; border:1px solid var(--border); border-radius:8px; background:#121722; color:var(--fg); cursor:pointer; }
.op-group .actions .btn:hover{ border-color: var(--brand); background:#161c28; }
.op-group .actions .btn.danger{ color:#ff6b6b; border-color:#5a2d2d; }

/* na wszelki wypadek: ukryj „plusy” jeśli jakiś stary renderer je wstawi */
.opg-item [data-act="add"],
.cam-op-card [data-act="add"]{ display:none !important; }


/* Belka aktywnej operacji (w pasku #camToolbar) */
.cam-opbar{
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--border); border-radius:10px;
  padding:8px; background:#0b1222; margin-left:auto;
  max-width:min(640px, 100%); flex:1 1 380px;
}
.cam-opbar .name{
  flex:1; display:flex; align-items:center; gap:8px;
  padding:6px 10px; border:1px solid var(--border); border-radius:8px;
  background:#0f172a;
}
.cam-opbar .name input{
  flex:1; background:transparent; border:0; color:var(--fg); outline:none;
  font:600 14px/1.2 system-ui,Segoe UI,Roboto,Helvetica,Arial;
}
.cam-opbar .actions{ display:flex; gap:8px; }
.cam-opbar .actions .btn{ padding:8px 12px; border:1px solid var(--border); border-radius:8px; background:#121722; color:var(--fg); cursor:pointer; }
.cam-opbar .actions .btn:hover{ border-color:var(--brand); background:#161c28; }
.cam-opbar .actions .danger{ color:#ff6b6b; border-color:#5a2d2d; }
.cam-opbar .actions .save{
  padding:10px 18px; font-weight:700; border:0;
  background: var(--brand); color:#fff; border-radius:10px;
}
.cam-opbar .actions .save:hover{ filter: brightness(1.05); }

/* Panel CAM niech nie zasłania SVG — tylko siedzi z boku */
.camArea { display:flex; gap:12px; align-items:flex-start; }
.cam-pane { position:relative; flex:0 0 280px; }

/* Tryby jako buttony */
.cam-mode-btns { display:flex; gap:6px; margin-bottom:8px; }
.cam-mode-btns button {
  flex:1;
  padding:6px 8px;
  border:1px solid var(--border);
  border-radius:6px;
  background:#0b1222;
  color:#cbd5e1;
  cursor:pointer;
}
.cam-mode-btns button.active {
  background:#2563eb;
  color:#fff;
}

/* Legenda CAM */
.cam-legend {
  margin-top:6px;
  padding:6px 8px;
  border:1px solid var(--border);
  border-radius:6px;
  background:#0b1222;
  font-size:13px;
}
.cam-legend div {
  display:flex;
  align-items:center;
  gap:6px;
  margin-bottom:3px;
}
.cam-legend span {
  width:20px; height:2px; display:inline-block;
}
.cam-legend .lead-in  { background:#6ee7a8; }
.cam-legend .cut      { background:#4aa3ff; }
.cam-legend .lead-out { background:#f7c34c; }
.cam-legend .rapid    { background:#ff6b6b; }

/* Układ CAM: panel + duży viewer */
.camArea { display:flex; gap:16px; align-items:flex-start; }
.cam-pane { flex:0 0 300px; position:relative; }
.cam-view { flex:1 1 auto; min-width:0; }

/* === Przybornik Wiercenia obok przycisku "Wiercenia" w CAM === */

/* upewniamy się, że przycisk + przybornik stoją ładnie w jednym rzędzie */
.cam-mode-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* same "pudełko" przybornika – baza */
.cam-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;          /* odstęp od przycisku Wiercenia */
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  border: 1px solid var(--border, #333);
  background: rgba(0, 0, 0, 0.45); /* domyślnie coś sensownego pod dark mode */
}

.cam-toolbar--hidden {
  display: none;
}

/* przyciski w przyborniku */
.cam-toolbar__btn {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
}

/* trochę "klikowalności" */
.cam-toolbar__btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* =========================================================
   MOTYW: CIEMNY  (setTheme = "dark")
   ========================================================= */
body[data-theme="dark"] .cam-toolbar,
body.theme-dark .cam-toolbar {
  background: #111822;
  border-color: var(--border, #333);
}

body[data-theme="dark"] .cam-toolbar__btn,
body.theme-dark .cam-toolbar__btn {
  color: #f5f7fb;
}

body[data-theme="dark"] .cam-toolbar__btn:hover,
body.theme-dark .cam-toolbar__btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* =========================================================
   MOTYW: JASNY  (setTheme = "light")
   ========================================================= */
body[data-theme="light"] .cam-toolbar,
body.theme-light .cam-toolbar {
  background: #f5f7fb;
  border-color: var(--border, #ccc);
}

body[data-theme="light"] .cam-toolbar__btn,
body.theme-light .cam-toolbar__btn {
  color: #111827;
}

body[data-theme="light"] .cam-toolbar__btn:hover,
body.theme-light .cam-toolbar__btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* =========================================================
   MOTYW: PREMIUM DARK MODE  (setTheme = "premium")
   ========================================================= */
body[data-theme="premium"] .cam-toolbar,
body.theme-premium .cam-toolbar {
  background: radial-gradient(circle at top left, #1d2738, #05070c);
  border-color: rgba(110, 168, 254, 0.5); /* pod var(--brand) */
}

body[data-theme="premium"] .cam-toolbar__btn,
body.theme-premium .cam-toolbar__btn {
  color: #e5edff;
  border-color: transparent;
}

body[data-theme="premium"] .cam-toolbar__btn:hover,
body.theme-premium .cam-toolbar__btn:hover {
  background: rgba(110, 168, 254, 0.16);
}



/* Pasek CAM jako elastyczny wiersz */
#camToolbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

#camToolbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
}


#camSvgContainer {
  height: 74vh;               /* duży obszar roboczy */
  min-height: 520px;
  width: 100%;
  border:1px solid var(--border);
  border-radius:8px;
  background:#0b0f16;
  position:relative;
  overflow:hidden;            /* brak pasków */
}

/* niech wstrzyknięte <svg> wypełnia kontener */
#camSvgContainer svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Edycja operacji (karta) */
.cam-op-card .op-edit {
  display:grid;
  grid-template-columns: 1fr;
  gap:8px;
  align-items:stretch;
  margin-top:6px;
}
.cam-op-card .op-edit label { font-size:12px; opacity:.85; display:block; }
.cam-op-card .op-edit input, .cam-op-card .op-edit select {
  width:100%; background:#0b1222; color:#cbd5e1; border:1px solid var(--border);
  border-radius:6px; padding:4px 6px;
}
.cam-op-card .op-actions button { margin-left:6px; }

/* Pływające okno Narzędzia */
.tools-window{
  position:fixed; top:6rem; right:2rem; width:420px; max-height:80vh;
  background:#fff; color:#0c1220; box-shadow:0 10px 30px rgba(0,0,0,.2);
  border-radius:8px; overflow:hidden; z-index:9999; display:none;
}
.tools-window header{
  display:flex; align-items:center; justify-content:space-between;
  padding:.6rem .8rem; font-weight:600; background:#f5f5f7; cursor:move;
}
.tools-window .body{ padding:.8rem; overflow:auto; max-height:calc(80vh - 46px); }
.tools-window .close{ border:0; background:transparent; font-size:1.2rem; }
.tools-window.show{ display:block; }   /* <<< to przełącza widoczność */

.seg-btn.active { background: var(--brand); color: #fff; }

 /* Dialog: bez natywnej ramki i z lekkim tłem */
 dialog { border: none; padding: 0; background: transparent; }
 dialog::backdrop { background: rgba(0,0,0,.45); }
 dialog .modal-card { max-width: 720px; }
 dialog .modal-body .grid label > input,
 dialog .modal-body .grid label > select { width: 100%; }
 
/* === CAM: belka aktywnej operacji – w środku #camToolbar === */
.cam-opbar{
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--border); border-radius:10px;
  padding:8px; background:#0b1222; margin-left:auto;
  max-width:min(640px, 100%); flex:1 1 380px;
}
.cam-opbar .name{
  flex:1; display:flex; align-items:center; gap:8px;
  padding:6px 10px; border:1px solid var(--border); border-radius:8px;
  background:#0f172a;
}
.cam-opbar .name input{
  flex:1; background:transparent; border:0; color:var(--fg); outline:none;
  font:600 14px/1.2 system-ui,Segoe UI,Roboto,Helvetica,Arial;
}
.cam-opbar .actions{ display:flex; gap:8px; }
.cam-opbar .actions .btn{ padding:8px 12px; border:1px solid var(--border); border-radius:8px; background:#121722; color:var(--fg); cursor:pointer; }
.cam-opbar .actions .btn:hover{ border-color:var(--brand); background:#161c28; }
.cam-opbar .actions .danger{ color:#ff6b6b; border-color:#5a2d2d; }
.cam-opbar .actions .save{
  padding:10px 18px; font-weight:700; border:0;
  background: var(--brand); color:#fff; border-radius:10px;
}
.cam-opbar .actions .save:hover{ filter: brightness(1.05); }
 
 
/* Ukrywanie prawego panelu Toolbox + korekta marginesu main */
.rightpane-hidden #rightPanel3 { display: none !important; }
.rightpane-hidden main { margin-right: 0 !important; }

/* ==== OPERACJE (lewy pasek) – kafelek jak "Parametry" ==== */

/* cały shelf z Operacjami w lewym pasku */
#cadOpsShelf{
  margin-top: 10px;
}

/* nagłówek "Operacje" – wizualnie taki sam jak pozostałe przyciski w sidebarze */
#cadOpsShelf .hdr .title{
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;              /* jak inne przyciski */
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121722;
  color: var(--fg);
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .05s ease;
}

/* kontener Operacji w lewym pasku – bez ramki, bez paddingu */
header nav #cadOpsShelf{
  padding: 0;
  border: 0;
  background: transparent;
}


/* cały shelf z Operacjami w lewym pasku */
#cadOpsShelf{
  margin-top: 0;                    /* odstęp robi już gap:10px z header nav */
}

/* nagłówek "Operacje" – jak przycisk "Parametry" */
#cadOpsShelf .hdr .title{
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;               /* jak .navbtn */
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121722;
  color: var(--fg);
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
  font-size: 0.95rem;               /* jak .navbtn */
  font-weight: 400;                 /* żeby nie było „pogrubione” */
  font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial;
  transition: border-color .15s ease, background .15s ease, transform .05s ease;
}

#cadOpsShelf .hdr .title:hover{
  border-color: var(--brand);
  background: #161c28;
}

/* trójkącik po lewej – „kolumna” jak zębatka przy Parametrach */
#cadOpsShelf .hdr .title .toggle{
  width: 1.2em;                     /* stała szerokość jak ikona */
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 0.95rem;
  margin-right: 4px;                /* mała przerwa przed tekstem */
}

/* tekst "Operacje" – środek przycisku */
#cadOpsShelf .hdr .title .label{
  flex: 1 1 auto;
  font-size: 0.95rem;
}

/* licznik (badge) – gdy będzie użyty, siedzi przy prawej krawędzi */
#cadOpsShelf .hdr .title .badge{
  font-size: 0.8rem;
  opacity: 0.8;
  margin-left: 6px;
}



/* Lewy pasek zwinięty: w "Operacje" zostaw tylko trójkąt */
body.sidebar-collapsed #cadOpsShelf .hdr .title{
  font-size: 0 !important;          /* chowa tekst "Operacje" */
  justify-content: center !important;
}
body.sidebar-collapsed #cadOpsShelf .hdr .title .badge{
  display: none !important;          /* chowa licznik */
}
body.sidebar-collapsed #cadOpsShelf .hdr .title .toggle{
  /* jedyny widoczny element: trójkąt ▼/▲, który JS już przełącza */
  font-size: 18px !important;
  line-height: 1 !important;
  width: 28px !important;            /* stała szerokość jak wcześniej */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
}

/* Lewy pasek zwinięty: "Operacje" ma taki sam kafelek jak reszta */
body.sidebar-collapsed #cadOpsShelf{
  padding: 0 !important;              /* bez dodatkowego marginesu w środku */
}

body.sidebar-collapsed #cadOpsShelf .hdr .title{
  padding: 10px !important;           /* dokładnie tyle samo co inne navbtn */
  font-size: 0 !important;            /* chowa tekst */
  justify-content: center !important;
}

body.sidebar-collapsed #cadOpsShelf .hdr .title .badge{
  display: none !important;
}

body.sidebar-collapsed #cadOpsShelf .hdr .title .toggle{
  font-size: 18px !important;
  line-height: 1 !important;
  width: 28px !important;             /* możesz zostawić lub lekko skorygować */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
}


/* ===== CAM Toolbox (prawy panel) ===== */
#camToolbox{ display:flex; flex-direction:column; gap:10px; }
.cam-tbx-group{ border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.cam-tbx-head{ display:flex; align-items:center; justify-content:space-between;
  gap:8px; padding:6px 10px; background: #0f1827; border-bottom:1px solid var(--border); }
.cam-tbx-head strong{ font-weight:600; }
.cam-tbx-list{ display:flex; flex-direction:column; }
.cam-tbx-item{ display:flex; align-items:center; gap:8px; padding:6px 10px;
  border-top:1px solid var(--border); }
.cam-tbx-item:first-child{ border-top:none; }
.cam-tbx-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cam-tbx-actions{ display:flex; gap:4px; }
.icon-ud{ width:auto; min-width:22px; padding:2px 6px; line-height:1; }
.icon-ud[disabled]{ opacity:.5; cursor:not-allowed; }
.icon-del{ padding:2px 6px; }



/* CAM: menu + pozycje wyrównane do lewej */
.tb-dropdown.align-left .tb-menu {
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  text-align: left !important;   /* na wypadek, gdy .tb-item nie jest flexem */
}

/* jeśli pozycje są flexowane (często tak bywa w toolbarach) */
.tb-dropdown.align-left .tb-item {
  text-align: left !important;    /* gdy .tb-item ma display:block */
  justify-content: flex-start !important; /* gdy .tb-item ma display:flex */
  width: 100%;                    /* żeby klikalny obszar wypełniał wiersz */
}

/* czasem label/ikona są w wewnętrznym wrapie – też pchnij je w lewo */
.tb-dropdown.align-left .tb-item > *,
.tb-dropdown.align-left .tb-item .label {
  text-align: left !important;
  justify-content: flex-start !important;
}

/* CAM: wiersz "Aktywuj CAM" – wysokość / spacing */
#topbar .tb-menu .tb-item.cam-activate {
  min-height: 40px;     /* podbij wysokość pola */
  line-height: 1.2;     /* bez „ściśnięcia” tekstu */
  padding: 8px 10px;    /* możesz zmniejszyć np. do 6px 10px, jeśli trzeba */
}

/* (opcjonalnie) jeśli całe menu ma być „luźniejsze” */
#topbar .tb-menu .tb-item { 
  /* min-height: 36px;  */
  /* line-height: 1.25; */
}
/* CAM: wiersz "Aktywuj CAM" – wysokość / spacing */
#topbar .tb-menu .tb-item.cam-activate{
  min-height: 50px !important;
  line-height: 1.2 !important;
  padding: 10px 12px !important;
  display: flex !important;
  align-items: center !important;
}




/* Małe ikonowe przyciski pod listami */
.actions-small {
  display: flex;
  gap: 6px;
  margin: 6px 0 8px;
}

/* Baza dla wszystkich ikon – prostokątne, jak mini-kafle */
.icon-btn {
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px; /* zamiast 999px – prostokąt z lekkim zaokrągleniem */
  border: 1px solid var(--border, #1f2937);
  background: #020617;          /* ciemne tło zbliżone do strony */
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

/* Warianty kolorów – tylko delikatny akcent na tle */
#selectAllCuts,
#selectAllDrills {
  background: rgba(129, 140, 248, 0.12);      /* fiolet/indigo */
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.6);
}

#deselectAllCuts,
#deselectAllDrills {
  background: rgba(248, 113, 113, 0.12);      /* czerwony */
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.6);
}

#clearAllCuts,
#clearAllDrills {
  background: rgba(148, 163, 184, 0.12);      /* szaro-niebieski */
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.7);
}

/* Hover – lekkie rozjaśnienie i cień */
.icon-btn:hover {
  transform: translateY(-1px);
  background: #02081a;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4),
              0 6px 14px rgba(15, 23, 42, 0.75);
}

/* Hover dla wariantów – podbicie koloru akcentu */
#selectAllCuts:hover,
#selectAllDrills:hover {
  background: rgba(129, 140, 248, 0.3);
}

#deselectAllCuts:hover,
#deselectAllDrills:hover {
  background: rgba(248, 113, 113, 0.3);
}

#clearAllCuts:hover,
#clearAllDrills:hover {
  background: rgba(148, 163, 184, 0.28);
}

/* Active – wrażenie „wciśnięcia” */
.icon-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.5),
              0 2px 6px rgba(15, 23, 42, 0.95);
}

/* Focus (klawiatura) – wyraźny ring */
.icon-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1px #93c5fd,
    0 0 0 3px rgba(59, 130, 246, 0.6);
}

/* Disabled – przygaszone, bez interakcji */
.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Save – przyciski z plusem i sakiewką */
.save-btn {
  min-width: 44px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.18);              /* zielonkawy akcent */
  border-color: rgba(34, 197, 94, 0.7);
  color: #bbf7d0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;                                         /* odstęp między + i 💰 */
  font-size: 15px;
}

.save-btn .save-icon {
  display: inline-block;
  line-height: 1;
}

/* trochę mocniejszy efekt na hover – spójny z .icon-btn:hover */
.save-btn:hover {
  background: rgba(34, 197, 94, 0.32);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6),
              0 6px 14px rgba(15, 23, 42, 0.8);
}

/* aktywny klik – jak inne przyciski */
.save-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.7),
              0 2px 6px rgba(15, 23, 42, 0.9);
}
/* Krok 1 – siatka formularza klienta:
   niech sama decyduje, czy 1, czy 2 kolumny,
   żeby nie wychodzić poza kartę przy węższych oknach */
#clientForm .grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
/* Krok 1 – siatka w okienku "Otwórz istniejącą wycenę" */
#openPanel .grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
/* ===== KROK 2 – lista rysunków: lepsze zawijanie prawej części ===== */

/* Sam wiersz niech będzie zawsze w 2 kolumnach,
   ale prawa kolumna nie może rozpychać całego wiersza */
#drawingsList li {
  grid-template-columns: minmax(0, 1fr) auto !important;
  box-sizing: border-box;
}

/* Prawa część (grubość, jednostka, przyciski) */
#drawingsList li > div:last-child {
  min-width: 0 !important;          /* zamiast max-content z JS */
  flex-wrap: wrap !important;       /* pozwól zawijać się do drugiej linii */
  justify-content: flex-end;
}

/* Przy bardzo wąskim środku – rozbij na 2 wiersze (info nad sterowaniem) */
@media (max-width: 1200px) {
  #drawingsList li {
    grid-template-columns: 1fr !important;  /* lewa nad prawą */
    row-gap: 8px;
  }

  #drawingsList li > div:last-child {
    justify-content: flex-start;
  }
}


/* CAM – toolbar dla wierceń */
.cam-toolbar--drill {
  /* upewniamy się, że zachowuje się jak wiersz pod przyciskami */
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 6px;

  /* wyśrodkowanie przycisków */
  justify-content: center;
  gap: 8px;
}

.cam-toolbar--drill .cam-toolbar__btn {
  /* trochę większe i bardziej czytelne */
  padding: 6px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;

  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
  color: #e5edff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.85);

  white-space: nowrap;
}

/* CAM – kolory ścieżek i otworów wg data-kind
   (działa i dla <path>, i dla <circle>) */
#camSvgContainer [data-kind="lead-in"] {
  stroke: #6ee7a8;
  stroke-width: 1.5;
  fill: none;
}

#camSvgContainer [data-kind="cut"] {
  stroke: #4aa3ff;
  stroke-width: 1.5;
  fill: none;
}

#camSvgContainer [data-kind="lead-out"] {
  stroke: #f7c34c;
  stroke-width: 1.5;
  fill: none;
}

#camSvgContainer [data-kind="rapid"] {
  stroke: #ff6b6b;
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  fill: none;
}

/* CAM – wizualizacja otworów wiercenia (pełne, półprzezroczyste kółka) */
#camSvgContainer [data-kind="drill-hole"] {
  stroke: #38bdf8;                        /* niebieska obwódka */
  stroke-width: 1.4;
  fill: rgba(56, 189, 248, 0.22);         /* delikatnie niebieskie, półprzezroczyste */
}

/* po kliknięciu oczka – mocniejsze zaznaczenie */
#camSvgContainer g[data-op].focus [data-kind="drill-hole"] {
  stroke-width: 2.4;
  fill: rgba(56, 189, 248, 0.40);
}

/* Stała wysokość przycisków "Ustawienia" i "Panel" */
#openSettings,
#collapseSidebar {
  display: inline-flex;        /* ładne wyśrodkowanie tekstu */
  align-items: center;
  justify-content: center;

  height: 36px;                /* wysokość jak przy full screen – dostosuj np. 40px */
  padding: 0 14px;             /* poziome odstępy, bez zmiany wysokości */

  flex-shrink: 0;              /* ❗ nie pozwalaj flexboxowi ich zgniatać */
  box-sizing: border-box;
}


/* CANVAS */

/* Canvas CAD – nie pokazujemy już ikonek +/×, ale logika zostaje */
svg#cutor-svg .pick-icon {
  display: none;
}

/* Ikony +/× w SVG chowamy – klikamy po canvasie */
svg#cutor-svg .pick-icon {
  display: none;
}


/*CAD2D */

/* === Tryb CAD – przełączanie lewego paska === */

#wizardNav,
#cadNav {
  transition: opacity .25s ease, transform .25s ease;
}

#cadNav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

body.cad-mode #wizardNav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
}

body.cad-mode #cadNav {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

#cadNav .cad-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #10151d;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.85rem;
}

#cadNav .cad-btn + .cad-btn {
  margin-top: 4px;
}

#cadNav .cad-btn.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(74,163,255,0.4);
}

/* === Tryb CAD – uproszczony widok kroku 3 === */

/* w trybie CAD chowamy pasek trybów (Cięcie/Wiercenie itd.) */
body.cad-mode #step3 .toolbar {
  display: none;
}

/* chowamy prawy panel z listą cięć / otworów */
body.cad-mode #rightPanel3 {
  display: none;
}

/* zostaje tylko wybór rysunku + canvas */
body.cad-mode #step3 .selector {
  margin-bottom: 10px;
}

/* nagłówek w trybie CAD może wyglądać trochę inaczej (opcjonalnie) */
body.cad-mode #step3 h2 {
  color: var(--brand);
}

/* w trybie CAD chowamy stary pasek skali i status */
body.cad-mode #cadUiBar,
body.cad-mode #cadStatusBar {
  display: none !important;
}

/* =========================================================
   FINAL FIX v2 – środkowy panel między lewym panelem
   a toolboxem (albo do krawędzi okna, gdy toolbox schowany)
   ========================================================= */

/* Umowna „szerokość” prawego panelu + marginesu */
:root{
  --rightpane-w: 360px;   /* 340px panel + trochę luzu */
}

/* Na dużych ekranach liczymy szerokość main z 100vw i zmiennych */
@media (min-width: 901px){

  /* główny środek aplikacji */
  #app-root main{
    box-sizing: border-box;

    /* nie chcemy już starego margin-right:360px */
    margin-left: var(--sidebar-current) !important;
    margin-right: 0 !important;

    /* szerokość = szerokość okna - lewy pasek - toolbox */
    width: calc(100vw - var(--sidebar-current) - var(--rightpane-w));
    max-width: calc(100vw - var(--sidebar-current) - var(--rightpane-w));
  }

  /* gdy toolbox schowany – dociągnij do prawej krawędzi okna */
  body.rightpane-hidden #app-root main{
    width: calc(100vw - var(--sidebar-current));
    max-width: calc(100vw - var(--sidebar-current));
  }

  /* sekcje kroków wypełniają cały main */
  #app-root main .step,
  #app-root main .route{
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* karty / boxy cenowe też na całą szerokość sekcji */
  #app-root main .card,
  #app-root main .price{
    width: 100% !important;
    box-sizing: border-box;
  }
}

#summary #quoteName{
  font-weight:600;    /* 🔹 bold jak nagłówek */
  font-size:14px;     /* 🔹 taka sama czcionka jak reszta wiersza */
}

/* Parametry: grid ma się sam składać, gdy robi się za wąsko (np. przez prawy panel) */
#params .grid{
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
}

/* Dodatkowa ochrona przed “rozpychaniem” kolumn przez zawartość */
#params .grid > *{
  min-width: 0;
}


/* =========================================================
   ZLECENIE / OKNO WYCENY (Klient + Vendor) — nowy układ
   (layout jak na 2 screenie: Informacje Ogólne -> Porównanie -> Szczegóły -> Propozycja)
   ========================================================= */

#order.order-view{
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

#order.order-view .order-title{
  font-size: 40px;
  letter-spacing: .2px;
  margin: 0 0 6px;
}

#order.order-view .order-meta{
  opacity: .9;
  margin: 0 0 14px;
}

#order.order-view .order-card{ margin-top: 14px; }

/* Niebieskie obramowanie "Informacje Ogólne" */
#order.order-view .order-general{
  border: 2px solid rgba(74,163,255,0.55);
  box-shadow:
    0 0 0 3px rgba(74,163,255,0.16),
    var(--shadow);
}

/* Ujednolicenie .btnrow (w wielu miejscach było inline) */
#order.order-view .btnrow{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

/* Porównanie cen */
#order.order-view .order-price-compare{
  display:flex;
  gap:14px;
  align-items:center;
  min-width: 0; /* ważne w flexboxie, żeby nie rozpychać rodzica */
}

#order.order-view .order-big-arrow{
  font-size: 56px;
  line-height: 1;
  padding: 8px 12px;
  color: #fb7185; /* różowo-czerwony jak strzałka na screenie */
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.35));
  user-select:none;
  animation: orderArrowGlow 1.6s ease-in-out infinite;
  transform-origin: center;
}
/* NOWY UKŁAD */
#order.order-view .order-price-compare-body{
  min-width: 0;
  width: 100%;
}

#order.order-view .order-price-title{
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .2px;
  margin-bottom: 10px;
}

#order.order-view .order-price-block{
  display:flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(2,6,23,0.10);
}

#order.order-view .order-price-label{
  font-size: 14px;
  opacity: .95;
}

#order.order-view .order-price-value{
  font-size: 20px;
  letter-spacing: .2px;
}

#order.order-view .order-price-divider{
  height: 1px;
  margin: 10px 4px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,0.35), transparent);
}


@keyframes orderArrowGlow{
  0%, 100%{
    filter:
      drop-shadow(0 8px 18px rgba(0,0,0,0.35))
      drop-shadow(0 0 0 rgba(251,113,133,0.00));
    transform: translateY(0) scale(1);
  }
  50%{
    filter:
      drop-shadow(0 10px 22px rgba(0,0,0,0.38))
      drop-shadow(0 0 16px rgba(251,113,133,0.55))
      drop-shadow(0 0 34px rgba(251,113,133,0.25));
    transform: translateY(-1px) scale(1.03);
  }
}

/* jeżeli ktoś ma w systemie ograniczenie animacji */
@media (prefers-reduced-motion: reduce){
  #order.order-view .order-big-arrow{ animation: none; }
}

#order.order-view .order-price-line{
  font-size: 20px;
  display:flex;
  gap:10px;
  align-items:baseline;
  flex-wrap:wrap;
  min-width: 0;
  overflow-wrap: anywhere;   /* pozwól łamać długie fragmenty */
  word-break: break-word;
}

#order.order-view .order-price-sep{ opacity:.9; margin-inline: 6px; }

#order.order-view .order-price-labels{
  display:flex;
  justify-content:space-between;
  gap:16px;
  margin-top:6px;
  min-width: 0;
}

#order.order-view .order-price-labels > span{ white-space:nowrap; }


/* === MOBILE FIX: "Porównanie Wycen" nie może wychodzić poza kartę === */
@media (max-width: 520px){
  #order.order-view .order-price-compare{
    flex-direction: column;      /* strzałka nad tekstem */
    align-items: flex-start;
    gap: 8px;
  }
  #order.order-view .order-big-arrow{
    font-size: 44px;
    padding: 4px 6px;
  }
  #order.order-view .order-price-title{
    font-size: 20px;
  }
}

#order.order-view .order-diff-list{
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Dwie kolumny w "Szczegóły wersji" */
#order.order-view .order-two-cols{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px){
  #order.order-view .order-two-cols{ grid-template-columns: 1fr; }
}

#order.order-view .order-col h4{
  margin: 0 0 10px;
  font-size: 16px;
}

/* "Aktywny rysunek" jako pasek */
#order.order-view .order-active-drawing{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(74,163,255,0.45);
  background: rgba(74,163,255,0.08);
  margin-bottom: 10px;
}

/* lista podsumowania */
#order.order-view .order-summary-list{
  margin: 0;
  padding-left: 18px;
  line-height: 1.65;
}
#order.order-view .order-summary-list li{ margin: 2px 0; }

/* Dolny kafelek "Twoja propozycja" */
#order.order-view .order-proposal-head{
  display:flex;
  gap:12px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}

#order.order-view .order-proposal-actions{
  justify-content:flex-end;
}

/* Cena (ręcznie) – przeniesione z inline */
#order.order-view .order-price-edit{
  margin-top: 8px;
}
#order.order-view .order-price-edit input{
  width: 260px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.25);
  background: rgba(2,6,23,0.09);
  color: #e5e7eb;
  outline: none;
}
#order.order-view .order-price-edit input:focus{
  border-color: rgba(74,163,255,0.7);
  box-shadow: 0 0 0 3px rgba(74,163,255,0.16);
}

/* ===== ZLECENIA: tabela + ikonowe akcje ===== */
#ordersTable.orders-table{
  border-collapse: collapse;
}

#ordersTable.orders-table th,
#ordersTable.orders-table td{
  padding: 10px 12px;
  vertical-align: middle;
}

/* === Separatory wierszy: równa linia niezależnie od wysokości komórek === */
#ordersTable.orders-table tbody tr{
  border-bottom: 1px solid var(--border);
}
#ordersTable.orders-table tbody td{
  border-bottom: 0; /* linia jest na <tr>, nie na <td> */
}

/* === Status: stabilny układ 2-liniowy (Status + PO TERMINIE pod spodem) === */
#ordersTable td.cell-status{
  text-align: center;
  vertical-align: middle;
}
.status-stack{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.status-stack .badge-warn{
  margin-left: 0 !important; /* wcześniej było 8px */
}



#ordersTable.orders-table thead tr:first-child th{
  background: #121722;
  position: sticky;
  top: 0;
  z-index: 2;
}

#ordersTable.orders-table thead tr:nth-child(2) th{
  background: #0f1521;
  position: sticky;
  top: 44px; /* wysokość pierwszego rzędu nagłówka */
  z-index: 1;
}

#ordersTable.orders-table tbody tr:hover{
  background: rgba(74,163,255,0.06);
}

#ordersTable.orders-table tbody tr:hover > td{
  background: rgba(74,163,255,0.06);
}

#ordersTable .cell-name{
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ordersTable .cell-info{
  max-width: 520px;
  white-space: normal;
  word-break: break-word;
}

#ordersTable .cell-actions{ white-space: nowrap; }

.orders-actions{
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

#ordersTable .order-open-program-btn{
  padding: 6px 10px;
  height: 32px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1;
}

/* ikonki w akcjach */
.o-ico{ width: 18px; height: 18px; display:block; }

/* drobny wariant icon-btn w tabeli */
#ordersTable .icon-btn.order-act{
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border-radius: 10px;
}

#ordersTable .icon-btn.order-act.danger{
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fecaca;
}
#ordersTable .icon-btn.order-act.danger:hover{
  background: rgba(248, 113, 113, 0.22);
}

/* status jako "pill" */
.status-pill{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.status-pill[data-status="Zakończono"]{
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
}
.status-pill[data-status="Oczekuje"]{
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}
.status-pill[data-status="W realizacji"]{
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.55);
  color: #bfdbfe;
}

.badge-warn{
  margin-left: 0;
  margin-top: 6px; /* pod statusem */
  padding: 3px 8px;
  border: 1px solid rgba(239, 68, 68, 0.75);     /* czerwony */
  background: rgba(239, 68, 68, 0.14);           /* czerwony */
  color: #ffffff;                                 /* czcionka biała */
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

/* tooltip (dymek) dla elementów z data-tip */
[data-tip]{ position: relative; }
[data-tip]::after{
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-2px);
  background: var(--tooltip-bg, rgba(2, 6, 23, 0.96));
  color: var(--tooltip-fg, #ffffff);
  border: 1px solid var(--tooltip-border, var(--border));
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 10000;
}
[data-tip]::before{
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(2, 6, 23, 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 10000;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tip]:hover::before,
[data-tip]:focus-visible::before{ opacity: 1; }

/* ===== ZLECENIA: przełącznik "Wszystkie / Tylko aktywne" ===== */
#activeOnlyWrap { display:inline-flex; align-items:center; }

.orders-active-toggle{
  display:inline-flex;
  align-items:center;
  cursor:pointer;
  user-select:none;
}

/* ===== ZLECENIA: (MOBILE) przełącznik "Widok pełny / Kompaktowy" (niebieski) ===== */
#compactViewWrap { display:none; }
.orders-compact-toggle{
  display:inline-flex;
  align-items:center;
  cursor:pointer;
  user-select:none;
}
.orders-compact-toggle input{
  position:absolute;
  opacity:0;
  width:1px; height:1px;
  pointer-events:none;
}
.orders-compact-toggle__ui{
  position:relative;
  display:flex;
  align-items:center;
  width: 230px;
  height: 34px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(2,6,23,0.22);
  box-shadow: 0 0 0 1px rgba(148,163,184,0.18), 0 10px 24px rgba(0,0,0,0.25);
  overflow:hidden;
}
.orders-compact-toggle__txt{
  flex:1;
  text-align:center;
  font-size: 12px;
  line-height: 1;
  z-index:1;
  color: rgba(229,231,235,0.78);
  white-space:nowrap;
}
.orders-compact-toggle__txt--off{ color: #e5e7eb; }
.orders-compact-toggle__txt--on{ opacity:0.75; }
.orders-compact-toggle__knob{
  position:absolute;
  top:3px; left:3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  border: 1px solid rgba(148,163,184,0.35);
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}

/* ZLECENIA: termin zmieniony przez vendora – podświetl do czasu akceptacji klienta */
#ordersTable td.due-pending{
  color: #fff;
  font-weight: 700;
}
#ordersTable td.due-pending::after{
  content: " •";
  color: rgba(110, 168, 254, 0.95); /* niebieski akcent */
}
#ordersTable td.due-pending{
  background: rgba(110, 168, 254, 0.10);
  border-radius: 10px;
}

/* checked = "Kompaktowy" (prawa strona) */
.orders-compact-toggle input:checked + .orders-compact-toggle__ui .orders-compact-toggle__knob{
  transform: translateX(100%);
  background: rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.55);
}
.orders-compact-toggle input:checked + .orders-compact-toggle__ui .orders-compact-toggle__txt--on{
  color: #bfdbfe;
  opacity:1;
}
.orders-compact-toggle input:checked + .orders-compact-toggle__ui .orders-compact-toggle__txt--off{
  opacity:0.65;
  color: rgba(229,231,235,0.78);
}
.orders-compact-toggle input:focus-visible + .orders-compact-toggle__ui{
  box-shadow: 0 0 0 1px #93c5fd, 0 0 0 3px rgba(59,130,246,0.35);
}

.orders-active-toggle input{
  position:absolute;
  opacity:0;
  width:1px; height:1px;
  pointer-events:none;
}

.orders-active-toggle__ui{
  position:relative;
  display:flex;
  align-items:center;
  width: 230px;              /* szerszy, żeby mieścił tekst */
  height: 34px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--orders-toggle-bg, rgba(2,6,23,0.22));
  box-shadow: 0 0 0 1px rgba(148,163,184,0.18), 0 10px 24px rgba(0,0,0,0.25);
  overflow:hidden;
}

.orders-active-toggle__txt{
  flex:1;
  text-align:center;
  font-size: 12px;
  line-height: 1;
  z-index:1;
  color: var(--orders-toggle-fg, rgba(229,231,235,0.78));
  white-space:nowrap;
}

.orders-active-toggle__txt--off{ color: var(--orders-toggle-fg-strong, #e5e7eb); }
.orders-active-toggle__txt--on{ opacity:0.75; }

.orders-active-toggle__knob{
  position:absolute;
  top:3px; left:3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  border: 1px solid rgba(148,163,184,0.35);
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}

/* checked = "Tylko aktywne" (prawa strona) */
.orders-active-toggle input:checked + .orders-active-toggle__ui .orders-active-toggle__knob{
  transform: translateX(100%);
  background: rgba(34,197,94,0.16);
  border-color: rgba(34,197,94,0.45);
}
.orders-active-toggle input:checked + .orders-active-toggle__ui .orders-active-toggle__txt--on{
  color: #181818;
  opacity:1;
}
.orders-active-toggle input:checked + .orders-active-toggle__ui .orders-active-toggle__txt--off{
  opacity:0.65;
  color: rgba(41, 41, 41, 0.78);
}

/* focus ring (klawiatura) */
.orders-active-toggle input:focus-visible + .orders-active-toggle__ui{
  box-shadow: 0 0 0 1px #93c5fd, 0 0 0 3px rgba(59,130,246,0.35);
}

/* ===== ZLECENIA: brak poziomego scrolla + pełna wysokość + ładny scroll ===== */

/* 1) Sekcja Zleceń ma wypełniać wysokość ekranu (pod topbarem) */
/* UWAGA: #orders NIE może mieć display:flex zawsze, bo nadpisuje .route{display:none;}
   i wtedy Zlecenia "wpychają się" w inne kroki. */
#orders.route.active,
#orders.step.active{
  height: calc(100vh - var(--topbar-h) - 24px); /* lekki zapas na paddingi/marginesy */
  display: flex;
  flex-direction: column;
}

/* 2) Główna karta w środku też jako kolumna i ma się rozciągać */
#orders > .card{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* ważne, żeby scroll działał w środku */
}

/* 3) Wrapper tabeli: tylko pionowy scroll, bez poziomego */
#orders .orders-table-wrap{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 10px;
  scrollbar-gutter: stable;
}

/* WAŻNE: nie włączamy poziomego scrolla w wrapie,
   bo ma być tylko jeden (dolny) scrollbar: .orders-hscroll */
#orders.orders-hscroll-on .orders-table-wrap{
  overflow-x: hidden;
}

/* ✅ Touch/mobile: pozwól przewijać tabelę gestem w bok,
   ale ukryj “drugi” scrollbar w wrapie (żeby widoczny był tylko dolny pasek). */
@media (pointer: coarse){
  #orders.orders-hscroll-on .orders-table-wrap{
    overflow-x: auto;                 /* gest L/R działa */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;            /* Firefox: ukryj */
  }
  #orders.orders-hscroll-on .orders-table-wrap::-webkit-scrollbar{
    height: 0 !important;             /* WebKit: ukryj poziomy */
  }
}

/* ładny ciemny scrollbar jak w innych oknach */
#orders .orders-table-wrap::-webkit-scrollbar{ width: 12px; }
#orders .orders-table-wrap::-webkit-scrollbar-thumb{
  background:#2a3444;
  border-radius:10px;
  border: 3px solid rgba(0,0,0,0); /* optycznie cieńszy */
  background-clip: padding-box;
}
#orders .orders-table-wrap::-webkit-scrollbar-track{ background: transparent; }
#orders .orders-table-wrap{ scrollbar-width: thin; scrollbar-color:#2a3444 transparent; }

/* 4) Tabela: ma się zmieścić bez poziomego scrolla */
#ordersTable{
  width: 100% !important;
  table-layout: fixed;             /* klucz do braku rozjeżdżania */
}
/* ===== ZLECENIA: toolbar ma równo wrapować ===== */
#orders .btnrow{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
}



/* ZLECENIA – hint pod tabelą (mobile) */
.orders-swipe-hint{
  display:none;
  width: 100%;
  text-align: center;
}

/* ZLECENIA: klik w wiersz = Zobacz */
#ordersTable tbody tr[data-order-id]{
  cursor: pointer;
}
#ordersTable tbody tr[data-order-id]:hover{
  background: rgba(148,163,184,0.08);
}

/* żeby przyciski w Akcjach nadal wyglądały jak przyciski (nie “dziedziczą” cursor:pointer z wiersza) */
#ordersTable tbody tr[data-order-id] button{
  cursor: pointer;
}

/* ===== Dolny pasek przewijania (pokazujemy tylko gdy potrzeba) ===== */
.orders-hscroll{
  display:none;
  margin-top: 8px;
  height: 14px;              /* sam pasek */
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
.orders-hscroll__inner{
  height: 1px;               /* tylko “wypełniacz” szerokości */
}

/* WebKit scrollbar (poziomy) */
.orders-hscroll::-webkit-scrollbar{ height: 12px; }
.orders-hscroll::-webkit-scrollbar-thumb{
  background:#2a3444;
  border-radius:10px;
  border: 3px solid rgba(0,0,0,0);
  background-clip: padding-box;
}
.orders-hscroll::-webkit-scrollbar-track{ background: transparent; }
.orders-hscroll{ scrollbar-width: thin; scrollbar-color:#2a3444 transparent; }

/* gdy JS wykryje przycinanie – włącz przewijanie + pokaż hint */
#orders.orders-hscroll-on .orders-hscroll{ display:block; }
#orders.orders-hscroll-on .orders-swipe-hint{ display:block; }

/* hint "Widok wykonawcy..." ma być zawsze w nowej linii (pod przełącznikami) */
#orders #ordersModeHint{
 flex-basis: 100%;
  width: 100%;
  order: 99;                 /* na końcu toolbara */
  margin-left: 0 !important; /* nadpisuje inline margin-left:auto */
  margin-top: 2px;
  line-height: 1.2;
}


/* ===== MOBILE: poziomy scroll tabeli + kompaktowy widok ===== */
@media (max-width: 900px){
  /* hint "Widok wykonawcy..." ma być w nowej linii (pod przełącznikami) */
  #orders #ordersModeHint{
    flex-basis: 100%;
    width: 100%;
    order: 99;           /* zawsze na końcu toolbara */
    margin-left: 0 !important;
    margin-top: 2px;
    line-height: 1.2;
  }
  /* pokaż przełącznik widoku tabeli tylko na mobile */
  #compactViewWrap{
    display:inline-flex !important;
    align-items:center;
  }

  /* NIE robimy poziomego scrolla na wrapie – ma być tylko dolny pasek */
  #orders .orders-table-wrap{
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable both-edges;
  }

  /* poziomy scrollbar (WebKit) */
  #orders .orders-table-wrap::-webkit-scrollbar{
    height: 12px; /* poziomy */
    width: 12px;  /* pionowy zostaje */
  }
  /* (opcjonalnie) zostawiamy tylko pionowy scrollbar w wrapie */
  #orders .orders-table-wrap::-webkit-scrollbar-thumb{
    background:#2a3444;
    border-radius:10px;
    border: 3px solid rgba(0,0,0,0);
    background-clip: padding-box;
  }
  #orders .orders-table-wrap::-webkit-scrollbar-track{ background: transparent; }

  /* na mobile nie wymuszaj "fixed", bo chcemy naturalną szerokość + scroll */
  #ordersTable{
    table-layout: auto !important;
    min-width: 980px;      /* wymusza sensowną szerokość do scrollowania */
  }

  .orders-swipe-hint{
    margin-top: 8px;
    font-size: 12px;
    opacity: .75;
    text-align: center;
    width: 100%;
    user-select: none;
  }


  /* ===== Kompaktowy widok: tylko "Nazwa wyceny" + "Akcje" ===== */
  #orders.orders-compact #ordersTable thead tr > th:not(:first-child):not(:last-child),
  #orders.orders-compact #ordersTable tbody tr > td:not(:first-child):not(:last-child){
    display:none !important;
  }

  /* KOMPAKT: bez scrolla – tabela ma się zmieścić w ekranie */
  #orders.orders-compact #ordersTable{
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  /* w kompaktowym: akcje węższe */
  #orders.orders-compact #ordersTable th:last-child,
  #orders.orders-compact #ordersTable td:last-child{
    width: 128px;
    white-space: nowrap;
    vertical-align: middle;
    text-align: right;
  }

  /* w kompaktowym: nazwa ma się zmieścić bez scrolla – pozwól na zawijanie */
  #orders.orders-compact #ordersTable td.cell-name{
    white-space: normal !important;
    line-height: 1.2;
    padding-right: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* kompakt: ciaśniejsze komórki */
  #orders.orders-compact #ordersTable th,
  #orders.orders-compact #ordersTable td{
    padding: 8px 8px;
  }

  /* kompakt: hint swipe niepotrzebny */
  #orders.orders-compact .orders-swipe-hint{ display:none; }
}

/* Vendor: ikonowy przycisk "Program" (gdy jest w kompaktowym) */
#orders.orders-compact .order-open-program-btn{
  width: 34px;
  height: 32px; /* wyrównaj do ikon-btn (u Ciebie mają 32px) */
  padding: 0;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
}
#orders.orders-compact .order-open-program-btn .prog-ico{
  font-size: 16px;
  line-height: 1;
}

/* zmniejsz trochę paddingi, żeby zrobić miejsce */
#ordersTable th, #ordersTable td{
  padding: 9px 10px;
}

/* ellipsis tylko tam gdzie faktycznie chcemy ucinać tekst */
#ordersTable td.cell-name,
#ordersTable td.cell-info{
  overflow: hidden;
  text-overflow: ellipsis;
}

/* (opcjonalnie) jeśli masz kolumnę klienta jako zwykłe <td> bez klasy,
   możesz ucinać ją selektorem kolumny – dopasuj numer jeśli u Ciebie jest inaczej */
#ordersTable td:nth-child(5){
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* kolumny daty i cena – niech nie puchną */
#ordersTable th:nth-child(3), #ordersTable td:nth-child(3),
#ordersTable th:nth-child(4), #ordersTable td:nth-child(4){
  width: 130px;
  white-space: nowrap;
}
#ordersTable th:nth-child(5), #ordersTable td:nth-child(5){
  width: 115px;
  white-space: nowrap;
}

/* STATUS – zaraz po Nazwa wyceny */
#ordersTable th:nth-child(2), #ordersTable td:nth-child(2){
  width: 130px;
  white-space: normal;
  text-align: center;
  overflow: visible;
  text-overflow: clip;
}

/* Status w 2 liniach: status na górze, "PO TERMINIE" pod spodem */
#ordersTable tbody td:nth-child(2){
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#ordersTable tbody td:nth-child(2) .status-pill,
#ordersTable tbody td:nth-child(2) .badge-warn{
  display: inline-flex;
  justify-content: center;
}

/* Nazwa + Wykonawca/Klient – utnij ładnie */
#ordersTable th:nth-child(1), #ordersTable td:nth-child(1){
  white-space: nowrap;
}
#ordersTable th:nth-child(7), #ordersTable td:nth-child(7){
  white-space: nowrap;
}

/* ===== Sortowanie kolumn w Zleceniach ===== */
#ordersTable thead th .th-sort{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

#ordersTable thead th .th-sort:focus-visible{
  outline: 0;
  box-shadow: 0 0 0 2px rgba(59,130,246,.45);
  border-radius: 10px;
}

#ordersTable thead th .th-sort-label{
  display: inline-block;
}

#ordersTable thead th .sort-ico{
  width: 14px;
  height: 14px;
  opacity: .55;
  transition: transform .14s ease, opacity .14s ease;
}

#ordersTable thead th .th-sort.active .sort-ico{
  opacity: 1;
}

#ordersTable thead th .th-sort[data-dir="desc"] .sort-ico{
  transform: rotate(180deg);
}

/* ===== Globalny tooltip (zawsze na wierzchu, nieuciany przez overflow) ===== */

/* gdy włączymy globalne tooltipy, wyłącz pseudo-elementowe dymki */
body.has-global-tooltips [data-tip]::before,
body.has-global-tooltips [data-tip]::after{
  display: none !important;
}

.global-tooltip{
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, 0);
  background: var(--tooltip-bg, rgba(2, 6, 23, 0.96));
  color: var(--tooltip-fg, #ffffff);
  border: 1px solid var(--tooltip-border, var(--border));
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  z-index: 999999;            /* NAD wszystkim */
  transition: opacity .12s ease, transform .12s ease;
}

.global-tooltip.show{
  opacity: 1;
}

.global-tooltip::before{
  content:'';
  position:absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
}

/* strzałka gdy tooltip jest pod elementem */
.global-tooltip[data-pos="bottom"]::before{
  top: -12px;
  bborder-top-color: var(--tooltip-bg, rgba(2, 6, 23, 0.96));
}

/* strzałka gdy tooltip jest nad elementem */
.global-tooltip[data-pos="top"]::before{
  bottom: -12px;
  border-top-color: rgba(2, 6, 23, 0.96);
}

/* --- Date filter (Otrzymano/Realizacja) --- */
.datefilter{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:34px;
}

.datefilter-btn{
  width:34px;
  height:34px;
  border-radius:12px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.35);
  color:#e5e7eb;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.datefilter-btn:hover{
  background: rgba(2,6,23,.55);
}

.datefilter-label{
  font-size:12px;
  opacity:.9;
  white-space:nowrap;
}

/* Popover */
.orders-date-popover{
  position:fixed;
  z-index: 100000; /* zawsze nad tabelą */
  width: 320px;
  max-width: calc(100vw - 24px);
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(15,23,42,.98);
  border-radius: 14px;
  box-shadow: 0 20px 70px rgba(0,0,0,.55);
  padding: 12px;
  display:none;
}

.orders-date-popover.open{ display:block; }

.orders-date-popover .head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.orders-date-popover .title{
  font-weight:700;
  font-size:13px;
}

.orders-date-popover .close{
  width:28px;
  height:28px;
  border-radius:10px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.35);
  color:#e5e7eb;
  cursor:pointer;
}

.orders-date-popover .tabs{
  display:flex;
  gap:8px;
  margin-bottom:10px;
}

.orders-date-popover .tab{
  flex:1;
  padding:8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.25);
  color:#e5e7eb;
  cursor:pointer;
  font-size:12px;
}

.orders-date-popover .tab.active{
  background: rgba(59,130,246,.22);
  border-color: rgba(59,130,246,.45);
}

.orders-date-popover .row{
  display:grid;
  grid-template-columns: 1fr;
  gap:8px;
  margin-bottom:10px;
}

.orders-date-popover label{
  font-size:12px;
  opacity:.85;
}

.orders-date-popover input[type="date"]{
  width:100%;
  box-sizing:border-box;
  padding:10px 10px;
  border-radius: 12px;
  border:1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.35);
  color:#e5e7eb;
  outline:none;
}

.orders-date-popover .range{
  display:grid;
  grid-template-columns: 1fr; /* Od + input, potem Do + input (pionowo) */
  gap:10px;
}

.orders-date-popover .actions{
  display:flex;
  justify-content:space-between;
  gap:8px;
  margin-top:8px;
}

.orders-date-popover .actions button{
  padding:9px 10px;
  border-radius:12px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.35);
  color:#e5e7eb;
  cursor:pointer;
  font-size:12px;
}

.orders-date-popover .actions .primary{
  background: rgba(59,130,246,.25);
  border-color: rgba(59,130,246,.55);
}
/* ===== Własna biała ikonka kalendarza (nie do zakrycia) ===== */
.date-ico-wrap{
  position: relative;
  display: block;
}

.date-ico-wrap input[type="date"]{
  padding-right: 44px; /* miejsce na ikonę */
}

/* biała ikonka nad inputem */
.date-ico-wrap::after{
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none; /* klik nadal idzie w input */
  opacity: .95;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}


/* ===== Wymuszona biała ikonka kalendarza w input[type="date"] (dark UI) =====
   Uwaga: natywny picker potrafi przykrywać prawą część inputa, więc
   rysujemy ikonę jako background przesunięty w lewo, a natywną ikonkę ukrywamy. */
input[type="date"]{
  color-scheme: dark;
  padding-right: 58px !important; /* miejsce na tekst + klikalny obszar ikony
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-size: 18px 18px !important;
  /* umieść ikonę W ŚRODKU klikalnego obszaru pickera (po prawej) */
  background-position: right 16px center !important;
}

/* ukryj natywną ikonkę, ale zostaw klikany obszar po prawej */
input[type="date"]::-webkit-calendar-picker-indicator{
  opacity: 0 !important;
  width: 58px !important;  /* klikalny obszar obejmuje ikonę */
  height: 100% !important;
  cursor: pointer;
}
/* USER: nie pokazuj "Parametry" w lewym panelu */
body.role-user #navParamsToggle,
body.role-user #navParamsList {
  display: none !important;
}
/* USER: nie pokazuj "Operacje" w lewym panelu */
body.role-user #cadOpsShelf{
  display: none !important;
}


/* Wycena + Zlecenia: wygląd jak navbtn + odstęp ikonka–tekst */

header nav a#navSummary,
header nav a#navOrders,
header nav a#navInquiries,
header nav a#navDrawings{
  display: inline-flex !important;      /* przebija display:block !important z patchy */
  align-items: center;
  justify-content: center;
  text-align: center;
}

header nav a#navSummary::before,
header nav a#navOrders::before,
header nav a#navInquiries::before,
header nav a#navDrawings::before{
  content: attr(data-icon);
  display: inline-block;
  line-height: 1;
  margin-right: 10px;                  /* +2px względem 8px z navbtn */
}

/* na wszelki wypadek, żeby tekst nie robił "ramki"/bloków */
header nav a#navSummary > span,
header nav a#navOrders > span,
header nav a#navInquiries > span,
header nav a#navDrawings > span{
  display: inline;
}




/* Animacja zwijania paska + odsunięcia main */
header{
  transition: width .18s ease, min-width .18s ease, max-width .18s ease, padding .18s ease;
}
main{
  transition: margin-left .18s ease;
}


/* WYCENA/ZLECENIA – zachowanie jak navbtn + animacja tekstu */
header nav a#navSummary,
header nav a#navOrders,
header nav a#navInquiries,
header nav a#navDrawings{
  /* przebijamy patcha, który wymusza display:block !important */
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

/* ikonka ma płynnie zmieniać odstęp */
header nav a#navSummary::before,
header nav a#navOrders::before,
header nav a#navInquiries::before,
header nav a#navDrawings::before{
  content: attr(data-icon);
  display: inline-block;
  line-height: 1;
  margin-right: 10px;                 /* Twój odstęp */
  transition: margin-right .18s ease; /* animacja jak w navbtn */
}

/* tekst nie znika display:none – tylko się zwija i zanika */
header nav a#navSummary > span,
header nav a#navOrders > span,
header nav a#navInquiries > span,
header nav a#navDrawings > span{
  display: inline-block;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  opacity: 1;
  transform: translateX(0);
  transition: opacity .18s ease, transform .18s ease, max-width .18s ease;
}

/* zwinięty pasek: ikonka zostaje, tekst płynnie znika */
body.sidebar-collapsed header nav a#navSummary::before,
body.sidebar-collapsed header nav a#navOrders::before,
body.sidebar-collapsed header nav a#navInquiries::before,
body.sidebar-collapsed header nav a#navDrawings::before{
  margin-right: 0;
}

body.sidebar-collapsed header nav a#navSummary > span,
body.sidebar-collapsed header nav a#navOrders > span,
body.sidebar-collapsed header nav a#navInquiries > span,
body.sidebar-collapsed header nav a#navDrawings > span{
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
}
/* =========================
   NAV: Wycena – gold accent
   ========================= */
button.wycena,
.buttonlike.wycena{
  border-color: rgba(244,196,0,0.45);
}

button.wycena:hover,
.buttonlike.wycena:hover{
  background: rgba(244,196,0,0.18);
  border-color: rgba(244,196,0,0.85);
  color: #111;
  box-shadow: 0 0 0 3px rgba(244,196,0,0.18);
}

button.wycena.active,
.buttonlike.wycena.active{
  background: rgba(244,196,0,0.22);
  border-color: rgba(244,196,0,0.95);
  font-weight: 700;
}
/* =========================
   NAV: Zlecenia – slate / neutral
   ========================= */
button.zlecenia,
.buttonlike.zlecenia{
  border-color: rgba(148,163,184,0.55); /* slate */
}

button.zlecenia:hover,
.buttonlike.zlecenia:hover{
  background: rgba(148,163,184,0.14);
  border-color: rgba(148,163,184,0.85);
  color: var(--fg);
}

button.zlecenia.active,
.buttonlike.zlecenia.active{
  background: rgba(148,163,184,0.18);
  border-color: rgba(148,163,184,0.95);
  font-weight: 650;
}

/* ===== KROK 2: responsywna siatka + jasny przycisk "Przejdź do kroku 3" ===== */

/* Na średnich/węższych ekranach pola w Kroku 2 mają się układać jedno pod drugim */
@media (max-width: 1200px){
  #step2 #baseForm .grid{
    grid-template-columns: 1fr !important;
  }
}

/* Link "Przejdź do kroku 3" jako jasny/żółty przycisk */
#step2 #baseForm .actions a.buttonlike{
  background: #f5c400;
  border-color: #e0b000;
  color: #111;
  font-weight: 600;
}

#step2 #baseForm .actions a.buttonlike:hover{
  filter: brightness(0.98);
}

#step2 #baseForm .actions a.buttonlike:active{
  transform: translateY(1px);
}

/* KROK 1: żółty przycisk "Przejdź do kroku 2" */
#step1 .actions a.buttonlike[href="#/step2"]{
  background: #f5c400;
  border-color: #e0b000;
  color: #111;
  font-weight: 600;
}

#step1 .actions a.buttonlike[href="#/step2"]:hover{
  filter: brightness(0.98);
}


/* =========================================================
   KROK 3 – accordion grup (ładniej, wyżej, z ikonką)
   Nie dotyka akordeonu w prawym panelu (cięcia/wiercenia), bo scope = #step3ParamsContainer
   ========================================================= */

#step3ParamsContainer{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#step3ParamsContainer .acc-item{
  border-radius: 14px;
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
}

#step3ParamsContainer .acc-btn{
  padding: 14px 16px;                /* minimalnie wyższe belki */
  font-weight: 800;
  letter-spacing: .2px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* "żółta" (brand) belka tylko dla rozwiniętej grupy */
#step3ParamsContainer .acc-item.acc-open > .acc-btn{
  background: linear-gradient(180deg, rgba(244,196,0,0.22), rgba(244,196,0,0.06));
  box-shadow:
    0 10px 28px rgba(0,0,0,0.08),
    0 0 0 1px rgba(244,196,0,0.28) inset;
}

/* lewy "brand strip" – widoczny tylko gdy otwarte */
#step3ParamsContainer .acc-btn::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
}
#step3ParamsContainer .acc-item.acc-open > .acc-btn::before{
  background: var(--brand);
}

/* układ: ikonka + tytuł po lewej */
#step3ParamsContainer .acc-left{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#step3ParamsContainer .acc-icon{
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.04);
  font-size: 16px;
  flex: 0 0 auto;
}

/* caret bardziej "nowoczesny" */
#step3ParamsContainer .acc-caret{
  font-size: 14px;
  opacity: .9;
  transition: transform .18s ease;
}
#step3ParamsContainer .acc-item.acc-open .acc-caret{
  transform: rotate(0deg);
}
#step3ParamsContainer .acc-item:not(.acc-open) .acc-caret{
  transform: rotate(-90deg);
}

/* WOW: delikatny lift na hover (tylko w kroku 3) */
#step3ParamsContainer .acc-item:hover{
  transform: translateY(-1px);
}

/* =========================
   KROK 3: SHIMMER (premium, delikatny)
   ========================= */

#step3ParamsContainer .acc-item.acc-open > .acc-btn{
  position: relative;
  overflow: hidden;
}

/* shimmer tylko na aktywnej belce */
#step3ParamsContainer .acc-item.acc-open > .acc-btn::after{
  content:"";
  position:absolute;
  top:0;
  left:-40%;
  width:40%;
  height:100%;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.18) 45%,
    rgba(255,255,255,0) 100%
  );
  transform: skewX(-18deg);
  opacity: .35;
  pointer-events:none;
  animation: step3Shimmer 2.6s ease-in-out infinite;
}

@keyframes step3Shimmer{
  0%   { left:-45%; }
  55%  { left:110%; }
  100% { left:110%; }
}

/* troszkę gładsze wejście/wyjście panelu */
#step3ParamsContainer .acc-panel{
  transform-origin: top;
}

.admin-tools { display:flex; gap:10px; align-items:center; }
.admin-tools.hidden { display:none !important; }
.btn.btn-ghost { background: transparent; border: 1px solid var(--border); }

/* KROK 3: żółty przycisk "Przejdź do wyceny" jak w Kroku 2 */
#step3 .actions a.buttonlike[href="#/summary"]{
  background: #f5c400;
  border-color: #e0b000;
  color: #111;
  font-weight: 600;
}
#step3 .actions a.buttonlike[href="#/summary"]:hover{
  filter: brightness(0.98);
}
#step3 .actions a.buttonlike[href="#/summary"]:active{
  transform: translateY(1px);
}

/* === KROK 1: DANE KLIENTA – jedna kolumna + węższa szerokość, przyciski pod spodem === */

/* karta z formularzem klienta */
#step1 #clientForm{
  display: flex;
  flex-direction: column;   /* grid u góry, actions pod spodem */
  align-items: flex-start;
}

/* siatka pól w Kroku 1: jedna kolumna + ~połowa szerokości karty */
#step1 #clientForm .grid{
  grid-template-columns: 1fr;
  max-width: 520px;
  width: 100%;
}

/* przyciski w formularzu klienta – normalnie pod spodem */
#step1 #clientForm .actions{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

/* (opcjonalnie, ale polecam) panel "Zapisane wyceny" ma ten sam układ */
#step1 #openPanel{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
#step1 #openPanel .grid{
  grid-template-columns: 1fr;
  max-width: 520px;
  width: 100%;
}
#step1 #openPanel .actions{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

/* === KROK 1: Otwórz wycenę – żółta ramka === */
#step1 #openQuoteBtn{
  border: 2px solid var(--brand);          /* żółta ramka */
  background: #ffffff;                     /* jasne tło */
  color: var(--fg);                        /* normalny kolor tekstu */
}

/* hover – delikatny premium efekt */
#step1 #openQuoteBtn:hover{
  background: rgba(244,196,0,0.10);        /* lekki żółty tint */
  border-color: var(--brandDeep, #eab308);
}


/* === KROK 2: nowy, wielowarstwowy UX z kafelkami – PREMIUM === */
#step2{
  overflow: hidden;
}

#step2 .step2-flow-card,
#step2 .step2-form-card,
#step2 .base-price-card{
  width: 100%;
  box-sizing: border-box;
}

#step2 .step2-flow-card{
  padding: 20px;
  background:
    radial-gradient(1200px 340px at -5% -10%, rgba(244,196,0,0.18), rgba(255,255,255,0) 56%),
    radial-gradient(900px 260px at 110% 0%, rgba(15,23,42,0.06), rgba(255,255,255,0) 45%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.93));
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow:
    0 24px 70px rgba(15,23,42,0.10),
    0 1px 0 rgba(255,255,255,0.90) inset,
    0 0 0 1px rgba(244,196,0,0.07) inset;
  border-radius: 24px;
  backdrop-filter: blur(8px);
}

#step2 .step2-flow-head{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

#step2 .step2-breadcrumbs{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

#step2 .step2-crumb,
#step2 .step2-crumb-back{
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}

#step2 .step2-crumb{
  background: rgba(15,23,42,0.04);
  border: 1px solid rgba(15,23,42,0.10);
  font-weight: 800;
  color: rgba(15,23,42,0.84);
}

#step2 .step2-crumb.is-current{
  background: linear-gradient(180deg, rgba(244,196,0,0.22), rgba(244,196,0,0.10));
  border-color: rgba(244,196,0,0.55);
  box-shadow: 0 8px 22px rgba(244,196,0,0.16);
}

#step2 .step2-crumb-back{
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(15,23,42,0.12);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15,23,42,0.06);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

#step2 .step2-crumb-back:hover{
  transform: translateY(-1px);
  border-color: rgba(244,196,0,0.70);
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(244,196,0,0.08));
  box-shadow: 0 14px 28px rgba(15,23,42,0.10), 0 0 0 4px rgba(244,196,0,0.10);
}

#step2 .step2-crumb-back.is-current-like{
  border-color: rgba(244,196,0,0.45);
}

#step2 .step2-crumb-back-arrow{
  font-weight: 900;
  font-size: 14px;
}

#step2 .step2-crumb-sep{
  color: rgba(15,23,42,0.30);
  font-weight: 800;
}

#step2 .step2-flow-intro{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

#step2 .step2-chooser-root{
  position: relative;
  min-height: 320px;
}

#step2 .step2-layer{
  display: none;
  opacity: 0;
  transform: translateX(34px) scale(0.985);
  transform-origin: center;
}

#step2 .step2-layer.is-active{
  display: block;
  animation: step2LayerIn .34s cubic-bezier(.22,.9,.24,1) both;
}

#step2 .step2-layer-head{
  margin-bottom: 18px;
}

#step2 .step2-layer-head h3{
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: .1px;
}

#step2 .step2-layer-head p{
  margin: 0;
  color: var(--muted);
}

#step2 .step2-layer-backbar{
  margin-bottom: 12px;
}

#step2 .step2-inline-back{
  appearance: none;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.92);
  color: var(--fg);
  border-radius: 999px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15,23,42,0.07);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

#step2 .step2-inline-back:hover{
  transform: translateY(-1px);
  border-color: rgba(244,196,0,0.70);
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(244,196,0,0.08));
  box-shadow: 0 16px 30px rgba(15,23,42,0.10), 0 0 0 4px rgba(244,196,0,0.09);
}

#step2 .step2-choice-grid{
  display: grid;
  gap: 18px;
  align-items: stretch;
}

#step2 .step2-choice-grid-categories{
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#step2 .step2-choice-grid-weights{
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#step2 .step2-choice-tile{
  appearance: none;
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 24px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(250,250,252,0.96));
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 260px;
  transition: transform .18s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
  box-shadow:
    0 16px 36px rgba(15,23,42,0.08),
    0 1px 0 rgba(255,255,255,0.90) inset;
  position: relative;
  overflow: hidden;
}

#step2 .step2-choice-tile::before{
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(244,196,0,0.14), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0));
  pointer-events: none;
}

#step2 .step2-choice-tile:hover{
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(244,196,0,0.72);
  box-shadow:
    0 24px 48px rgba(15,23,42,0.12),
    0 0 0 4px rgba(244,196,0,0.10),
    0 1px 0 rgba(255,255,255,0.92) inset;
}

#step2 .step2-choice-media{
  position: relative;
  min-height: 170px;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(244,196,0,0.24), rgba(255,255,255,0) 42%),
    linear-gradient(135deg, rgba(248,250,252,1), rgba(241,245,249,0.92));
  display: grid;
  place-items: center;
  border: 1px solid rgba(15,23,42,0.06);
}

#step2 .step2-choice-media img{
  width: 100%;
  height: 100%;
  min-height: 170px;
  object-fit: cover;
  display: block;
}

#step2 .step2-choice-fallback{
  width: 100%;
  height: 100%;
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  font-size: clamp(19px, 2vw, 29px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: .2px;
  color: rgba(15,23,42,0.86);
  background:
    radial-gradient(circle at top left, rgba(244,196,0,0.26), rgba(255,255,255,0) 40%),
    radial-gradient(circle at bottom right, rgba(15,23,42,0.05), rgba(255,255,255,0) 38%),
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,250,252,0.98));
}

#step2 .step2-choice-title{
  font-size: 18px;
  font-weight: 850;
  color: var(--fg);
  letter-spacing: .1px;
}

#step2 .step2-choice-subtitle{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

#step2 .step2-choice-tile-weight{
  min-height: 170px;
  justify-content: center;
}

#step2 .step2-choice-tile-weight .step2-choice-media{
  min-height: 94px;
}

#step2 .step2-choice-tile-weight .step2-choice-fallback{
  min-height: 94px;
  font-size: clamp(30px, 3vw, 42px);
}

#step2 #baseForm{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 18px;
}

#step2 #baseForm .grid{
  grid-template-columns: 1fr;
  max-width: 620px;
  width: 100%;
}

#step2 #baseForm .actions{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

#step2 #b_side_doors{
  display: none;
}

#step2 .field:has(#b_side_doors){
  margin-top: 28px;
}

#step2 .field:has(#b_side_doors) .lbl,
#step2 .roof-type-field .lbl{
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
}

#step2 .roof-type-field{
  margin-top: 18px;
}

#step2 .base-price-card{
  margin-top: 14px;
  max-width: 620px;
  border: 2px solid rgba(244,196,0,0.42);
  box-shadow:
    0 20px 50px rgba(15,23,42,0.08),
    0 0 0 1px rgba(244,196,0,0.08) inset;
}

#step2 .base-price-results{
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

#step2 .base-price-result,
#step2 .base-weight-result{
  margin-top: 0;
  font-size: 16px;
  font-weight: 700;
}

#step2 .base-weight-result{
  padding-top: 8px;
  border-top: 1px solid rgba(148,163,184,0.28);
}

#step2 .base-price-model-note{
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

@keyframes step2LayerIn {
  from {
    opacity: 0;
    transform: translateX(34px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (max-width: 1100px){
  #step2 .step2-choice-grid-categories{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #step2 .step2-choice-grid-weights{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px){
  #step2 .step2-choice-grid-categories,
  #step2 .step2-choice-grid-weights{
    grid-template-columns: 1fr;
  }

  #step2 .step2-choice-tile{
    min-height: 220px;
  }

  #step2 .step2-flow-card{
    padding: 14px;
    border-radius: 18px;
  }

  #step2 .step2-choice-tile{
    border-radius: 20px;
  }
}

/* CRM SUGGESTIONS - Autouzupełnianie firm */
.crm-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border-radius: 0 0 4px 4px;
}

.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9em;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background-color: #f0f7ff;
}

.suggestion-item strong {
  color: #333;
}

.suggestion-item small {
  color: #666;
  background: #eee;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.8em;
}

/* KBH_STAGE_25_ORDER_FULFILLMENT_V3
   Legacy: dawne kolumny "Od kogo/Wykonawca" były ukrywane po numerach 6/7.
   W tabeli operacyjnej v3 te pozycje oznaczają Termin Wykonawcy i Cenę Wykonawcy,
   więc nie wolno ich ukrywać zależnie od roli. */

.btn-contractor {
  background: #f97316 !important;
  border-color: #ea580c !important;
  color: #fff !important;
}

.btn-sales {
  background: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #fff !important;
}

.btn-accept {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #fff !important;
}

.btn-reject {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  color: #fff !important;
}

.btn-technical {
  background: #6b7280 !important;
  border-color: #4b5563 !important;
  color: #fff !important;
}

.proposal-diff-section {
  margin-top: 16px;
}

.proposal-diff-section h4 {
  margin: 0 0 10px;
}

.proposal-diff-item {
  padding: 10px 12px;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 10px;
  margin-bottom: 10px;
  background: rgba(148,163,184,.06);
}

/* niby położenie górnego paska edycji zlecenia */

body.active-order-bar-visible #app-root {
  padding-top: 52px !important;
}
body.active-order-bar-visible {
  padding-top: 56px !important;
}

body.active-order-bar-visible #activeOrderBar {
  height: 44px;
}

/* nowe położenie górnego paska edycji zlecenia */

#activeOrderBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #eee;
    padding: 8px;
    z-index: 1000;
}

.hidden {
    display: none;
}

.diff-row {
    border-bottom: 1px solid #ccc;
    padding: 5px;
}

.revision {
    border: 1px solid #ddd;
    margin: 5px;
    padding: 5px;
}

/*wyższe wiersze zleceń */
#ordersTable.orders-table tbody tr,
#ordersTable tbody tr {
  min-height: 72px;
}

#ordersTable.orders-table tbody td,
#ordersTable tbody td {
  padding-top: 18px !important;
  padding-bottom: 18px !important;
  vertical-align: middle;
  white-space: normal;
}

#ordersTable td.cell-status,
#ordersTable tbody td:nth-child(2) {
  line-height: 1.35;
  min-width: 220px;
}

.order-revisions-box {
  margin-top: 8px;
}

.order-revisions-box summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 0;
}

.revision {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
}

/* Kapsułka statusu ma nie nachodzić na treść*/

#ordersTable tbody tr {
  height: auto !important;
  min-height: 96px !important;
}

#ordersTable tbody td {
  height: auto !important;
  min-height: 96px !important;
  padding-top: 20px !important;
  padding-bottom: 20px !important;
  vertical-align: top !important;
  white-space: normal !important;
}

#ordersTable .cell-status {
  min-width: 260px !important;
  max-width: 360px !important;
}

#ordersTable .status-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
  position: static !important;
}

#ordersTable .status-pill {
  display: inline-block !important;
  position: static !important;
  white-space: normal !important;
  max-width: 320px !important;
  line-height: 1.35 !important;
  padding: 6px 10px !important;
  height: auto !important;
  word-break: normal !important;
}

#ordersTable .badge-warn {
  position: static !important;
  display: inline-block !important;
  margin-top: 4px !important;
}

/*styl paska w topbarze*/

#topbar {
  gap: 10px;
}

#topbar .tb-left,
#topbar .tb-right {
  flex: 0 0 auto;
}

#activeOrderBar.topbar-order-bar {
  flex: 1 1 auto;
  min-width: 320px;
  max-width: 900px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: #fff7df;
  color: #111827;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
}

#activeOrderBar.topbar-order-bar.hidden {
  display: none !important;
}

#activeOrderBar.topbar-order-bar > div:first-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#activeOrderBar.topbar-order-bar button {
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

/*Kapsułki statusu jako szeroki pasek między wierszami*/

#ordersTable tbody tr {
  position: relative;
}

#ordersTable tbody td {
  padding-top: 54px !important;
  vertical-align: top !important;
}

#ordersTable td.cell-status {
  position: static !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#ordersTable .status-stack {
  position: absolute !important;
  top: 12px;
  left: 270px;
  right: 170px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  z-index: 2;
  pointer-events: none;
}

#ordersTable .status-pill {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  max-width: none !important;
  width: auto !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  padding: 6px 14px !important;
  height: auto !important;
  font-size: 12px !important;
  pointer-events: auto;
}

#ordersTable .badge-warn {
  position: static !important;
  white-space: nowrap !important;
  pointer-events: auto;
}
body.active-order-bar-visible,
body.active-order-bar-visible #app-root {
  padding-top: 0 !important;
}

#activeOrderBar {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: auto !important;
}

#activeOrderBar.topbar-order-bar {
  flex: 1 1 auto !important;
  min-width: 280px;
  max-width: 900px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: #fff7df;
  color: #111827;
  font-size: 12px;
  overflow: hidden;
}

#activeOrderBar.hidden {
  display: none !important;
}

.topbar-order-main {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-order-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.topbar-order-actions button {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

/*status w osobnym wierszu*/
#ordersTable tr.order-status-row td {
  padding: 10px 12px 0 12px !important;
  border-bottom: 0 !important;
  background: transparent !important;
}

#ordersTable tr.order-main-row td {
  padding-top: 12px !important;
  padding-bottom: 22px !important;
  vertical-align: top !important;
}

#ordersTable .order-status-row-inner {
  margin-left: 305px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

#ordersTable .order-status-row-inner .status-pill {
  white-space: nowrap !important;
  max-width: none !important;
  width: auto !important;
  text-align: left !important;
  line-height: 1.2 !important;
}

#ordersTable .order-status-row-inner .badge-warn {
  white-space: nowrap !important;
}

#ordersTable .order-main-row .cell-status {
  min-width: 0 !important;
  width: 110px !important;
}

#ordersTable .status-stack {
  position: static !important;
}

/* poprawka: pasek zlecenia ma być częścią topbara, nie nakładką */
#topbar {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}

#activeOrderBar.topbar-order-bar {
  position: static !important;
  flex: 1 1 auto !important;
  max-width: none !important;
  min-width: 300px !important;
  margin: 0 12px !important;
}

#activeOrderBar.topbar-order-bar.hidden {
  display: none !important;
}

/* tabela zleceń na całą szerokość */
#orders .orders-table-wrap {
  width: 100% !important;
  max-width: none !important;
  overflow-x: auto !important;
}

#ordersTable {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: auto !important;
}

/* usuń górne kreski i popraw status jako osobny wiersz */
#ordersTable tr.order-status-row td {
  border-top: 0 !important;
  border-bottom: 0 !important;
  padding: 12px 12px 0 12px !important;
}

#ordersTable tr.order-main-row td {
  border-top: 0 !important;
  padding-top: 10px !important;
  padding-bottom: 26px !important;
}

#ordersTable .order-status-row-inner {
  margin-left: 305px !important;
  justify-content: flex-start !important;
}

/*kolumny cen*/

.proposal-price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

.proposal-price-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.proposal-price-col input {
  width: 100%;
  box-sizing: border-box;
}

.margin-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
}

.order-revisions-card {
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .proposal-price-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 700px) {
  .proposal-price-grid {
    grid-template-columns: 1fr;
  }
}

/*tło wiersza statusu jak linia oddzielająca*/

#ordersTable tr.order-status-row td {
  background: #f3f4f6 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

#ordersTable tr.order-main-row td {
  border-top: 0 !important;
}

#ordersTable .order-status-row-inner {
  justify-content: flex-start !important;
}

/*przyciski do cen w szczegółach zlecenia */

.proposal-price-col #fetchExcelPriceBtn,
.proposal-price-col #insertOfferPriceBtn {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  align-self: stretch !important;
}

/* dodatkowe pola dla innego zlecenia będą w osobnej estetycznej karcie w górnej sekcji Kroku 2.*/
/* ===== KROK 2: dodatkowe informacje o zleceniu — premium yellow ===== */

.step2-extra-fields {
  margin-top: 20px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(244, 196, 0, 0.35);
  background:
    linear-gradient(180deg, rgba(244, 196, 0, 0.10), rgba(255, 255, 255, 0.55));
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  display: grid;
  gap: 16px;
}

.step2-extra-fields::before,
.step2-extra-fields::after {
  content: none !important;
}

.step2-extra-fields label {
  margin: 0;
  color: #555;
  font-weight: 700;
}

.step2-extra-fields input,
.step2-extra-fields textarea {
  margin-top: 8px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(180, 180, 180, 0.45);
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.035);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.step2-extra-fields input:focus,
.step2-extra-fields textarea:focus {
  border-color: #f4c400;
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(244, 196, 0, 0.18),
    0 10px 26px rgba(0, 0, 0, 0.06);
  outline: none;
}

.step2-extra-fields textarea {
  min-height: 130px;
  resize: vertical;
}

/* Placeholdery + mikrocopy */
.step2-extra-fields input::placeholder,
.step2-extra-fields textarea::placeholder {
  color: rgba(0,0,0,0.35);
  font-style: italic;
}

/* ukrywanie sekcji w krok 2 przy Inne zlecenie */
.step2-hidden {
  display: none !important;
}

/* zwijanie grup diff w zleceniu */

.diff-group {
  margin: 10px 0;
  border: 1px solid #d9dee8;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.diff-group summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
  background: #f3f6fb;
  user-select: none;
}

.diff-group-body {
  padding: 8px 12px 12px;
}

.diff-level-2 {
  margin-left: 12px;
  border-color: #e1e6ef;
}

.diff-level-2 summary {
  background: #f8fafc;
  font-weight: 600;
}

.diff-level-3 {
  margin-left: 18px;
  border-style: dashed;
}

.diff-level-3 summary {
  background: #ffffff;
  font-weight: 600;
}

.diff-row {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid #8aa4d6;
  background: #fafcff;
  border-radius: 6px;
}

.diff-row span {
  display: block;
  margin-top: 3px;
}

/* podgląd rewizji */
.revision-clickable {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #d9dee8;
  background: #ffffff;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  cursor: pointer;
}

.revision-clickable:hover {
  background: #f3f6fb;
}

.order-revision-preview {
  margin-top: 14px;
}

.revision-preview-box {
  border: 1px solid #d9dee8;
  border-radius: 12px;
  background: #fafcff;
  padding: 14px;
}

.revision-preview-section {
  margin-top: 12px;
  border: 1px solid #e1e6ef;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
}

.revision-preview-section summary {
  cursor: pointer;
  font-weight: 700;
}

.revision-preview-row {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #eef1f6;
}

.revision-preview-row:last-child {
  border-bottom: none;
}

.revision-preview-row b {
  min-width: 260px;
}

/* podświetlenie i animacja rewizji */
.revision-clickable {
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.revision-clickable.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.16);
  transform: translateY(-1px);
}

.order-revision-preview {
  animation: revisionPreviewFadeIn 180ms ease-out;
}

.revision-preview-box {
  animation: revisionPreviewSlideIn 220ms ease-out;
}

@keyframes revisionPreviewFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes revisionPreviewSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ceny i terminy w zleceniu */
/* ===== Propozycja: oddzielenie cen i terminów ===== */

#order.order-view .proposal-section {
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.28);
}

#order.order-view .proposal-section + .proposal-section {
  margin-top: 18px;
}

#order.order-view .proposal-section h3 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

#order.order-view .proposal-section-dates {
  background: rgba(30, 41, 59, 0.32);
}

#order.order-view .proposal-dates-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

#order.order-view input[type="date"] {
  cursor: pointer;
}

#order.order-view input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  filter: invert(1);
}

@media (max-width: 900px) {
  #order.order-view .proposal-dates-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Propozycja: Nr projektu ===== */

#order.order-view .proposal-section-production-number {
  background: rgba(30, 41, 59, 0.22);
}

#order.order-view .proposal-production-number-grid {
  grid-template-columns: minmax(220px, 420px);
}

#order.order-view #projectNumberInput {
  text-transform: uppercase;
}

/* ===== Status produkcji ===== */

#order.order-view .order-production-status {
  margin-top: 18px;
}

.production-status-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13px;
}

.production-status-table th,
.production-status-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  text-align: left;
  vertical-align: top;
}

.production-status-table th {
  font-weight: 800;
  background: rgba(15, 23, 42, 0.08);
}

.production-status-row {
  cursor: pointer;
}

.production-status-row:hover {
  background: rgba(250, 204, 21, 0.12);
}

.production-status-row.active {
  background: rgba(250, 204, 21, 0.22);
}

.production-status-details {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.05);
}

.production-status-details h4 {
  margin: 0 0 12px;
}

.production-details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.production-detail-item {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.production-detail-label {
  font-size: 12px;
  font-weight: 800;
  opacity: 0.7;
  margin-bottom: 4px;
}

.production-detail-value {
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .production-status-table {
    display: block;
    overflow-x: auto;
  }

  .production-details-grid {
    grid-template-columns: 1fr;
  }
}

#order.order-view #refreshProductionStatusBtn {
  margin-top: 10px;
  width: 100%;
}

/* ===== Status produkcji: odświeżanie bez ukrywania tabeli ===== */

#productionStatusTableWrap {
  position: relative;
}

/* ===== Status produkcji: animowane szczegóły ===== */

.production-status-details {
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    max-height 220ms ease;
}

.production-status-details.is-open {
  opacity: 1;
  transform: translateY(0);
  max-height: 1200px;
}

/* ===== Grupa Produkcja ===== */

#order.order-view .production-group {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(234, 179, 8, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
}

#order.order-view .production-group > h3 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 900;
}

#order.order-view .proposal-section-production-number {
  background: rgba(248, 250, 252, 0.9);
}

#order.order-view .proposal-section-production-number h4,
#order.order-view .order-production-status h4 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 900;
}

#order.order-view .order-production-status {
  margin-top: 18px;
  box-shadow: none;
}

#order.order-view .proposal-section-production-number label {
  display: none;
}

/* ===== Globalne wyszukiwanie ===== */

.global-search-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.global-search-box {
  position: relative;
  width: min(620px, 100%);
}

#globalSearchInput {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  font-size: 14px;
}

.global-search-box::before {
  content: "⌕";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.7;
  pointer-events: none;
  z-index: 2;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  z-index: 9999;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.global-search-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.global-search-item:hover {
  background: rgba(250, 204, 21, 0.16);
}

.global-search-title {
  font-weight: 900;
  margin-bottom: 3px;
}

.global-search-subtitle {
  font-size: 13px;
  opacity: 0.75;
  margin-bottom: 8px;
}

.global-search-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.global-search-meta span {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
}

.global-search-empty {
  padding: 14px;
  font-size: 13px;
  opacity: 0.75;
}

@media (max-width: 900px) {
  .global-search-box {
    min-width: 100%;
    max-width: none;
  }
}

/*======= RAPORTY =======*/

.reports-page {
  padding: 24px;
}

.reports-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.reports-header h2 {
  margin: 0;
}

.reports-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.reports-tab {
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
  cursor: default;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

#ganttStatus {
  margin: 8px 0 10px;
  color: #475569;
  font-size: 13px;
}

/* GÓRNE AKCJE */
/* ===== GANTT: STEROWANIE ===== */

.gantt-refresh-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
  transition: transform .14s ease, box-shadow .14s ease;
}

.gantt-refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .30);
}

.gantt-search-row {
  display: flex;
  justify-content: center;
  margin: 12px 0 14px;
}

.gantt-search-box {
  position: relative;
  width: min(620px, 100%);
}

.gantt-search-box::before {
  content: "⌕";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: .7;
  pointer-events: none;
  z-index: 2;
}

#ganttSearch {
  width: 100%;
  min-height: 44px;
  padding: 0 16px 0 44px;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  outline: none;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .06);
}

#ganttSearch:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* duże kafelki liczników */

.gantt-counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
}

.gantt-counters div {
  border-radius: 18px;
  padding: 14px 16px;
  color: #0f172a;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, .24);
  box-shadow: 0 5px 18px rgba(15, 23, 42, .07);
  
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gantt-counters div:nth-child(1) {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: rgba(37, 99, 235, .18);
}

.gantt-counters div:nth-child(2) {
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.gantt-counters div:nth-child(3),
.gantt-counters .danger {
  background: linear-gradient(135deg, #fff1f2, #fee2e2);
  border-color: rgba(220, 38, 38, .25);
}

.gantt-counters div:nth-child(4) {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: rgba(22, 163, 74, .20);
}

.gantt-counters b {
  display: block;
  font-size: 26px;
  line-height: 1;
  color: #0f172a;
}

.gantt-counters span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #475569;
  font-weight: 800;
}

.gantt-counters .danger b {
  color: #dc2626;
}

/* pasek przycisków nad wykresem */

.gantt-subbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  margin: 0 0 36px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(148, 163, 184, .20);
  box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}
.gantt-subbar-separator {
  flex: 1 1 24px;
  min-width: 12px;
}

.gantt-subbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.gantt-subbar button,
.gantt-sort-select,
.gantt-chip {
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .28);
  background: #fff;
  color: #0f172a;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.gantt-subbar button:hover,
.gantt-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .10);
  border-color: rgba(37,99,235,.26);
}

.gantt-subbar button,
.gantt-sort-select,
.gantt-chip {
  flex: 0 0 auto;
  box-sizing: border-box;
}
.gantt-sort-select {
  width: auto;
  min-width: 0;
  padding-right: 34px;
  flex: 0 0 auto;
}

.gantt-sort-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.gantt-subbar button.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.gantt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 145px;

  user-select: none;

  background: linear-gradient(
    180deg,
    rgba(248,250,252,.96),
    rgba(241,245,249,.96)
  );

  border: 1px solid rgba(37,99,235,.12);

  box-shadow:
    0 3px 10px rgba(37,99,235,.05);
}

.gantt-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gantt-chip:has(input:checked) {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .20);
}

.gantt-chip:has(#ganttLateOnly:checked) {
  background: #dc2626;
  border-color: #dc2626;
}

@media (max-width: 900px) {
  .gantt-counters {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .gantt-subbar {
    align-items: stretch;
  }

  .gantt-subbar-left,
  .gantt-subbar-right {
    width: 100%;
  }
}


/* GŁÓWNY WYKRES */

.gantt-wrap {
  position: relative;
  overflow: auto;
  height: auto;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .28);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .14), transparent 28%),
    linear-gradient(180deg, #172033, #202b3f);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .20);
  cursor: grab;
}

.gantt-wrap.is-dragging {
  cursor: grabbing;
}

/* KBH_STAGE_19_GANTT_DRAG_SIDEBAR_FRAME_V1
   Podczas przesuwania osi czasu tekst nie może wejść w natywną selekcję. */
.gantt-wrap.is-dragging,
.gantt-wrap.is-dragging *,
body.gantt-dragging,
body.gantt-dragging * {
  -webkit-user-select: none !important;
  user-select: none !important;
}

.gantt-chart {
  position: relative;
  min-width: 100%;
}

/* NAGŁÓWEK CZASU */

.gantt-time-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(15, 23, 42, .90));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}

.gantt-month {
  position: absolute;
  top: 13px;
  height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  z-index: 35;
}

.gantt-day {
  position: absolute;
  top: 42px;
  width: 24px;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(226, 232, 240, .72);
  font-size: 11px;
  font-weight: 800;
  z-index: 35;
}

/* SIATKA */

.gantt-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(148, 163, 184, .12);
  z-index: 1;
}

.gantt-week-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, .16);
  z-index: 2;
}

.gantt-weekend {
  position: absolute;
  top: 54px;
  bottom: 0;
  background: rgba(255, 255, 255, .025);
  z-index: 1;
}

.gantt-current-week {
  position: absolute;
  top: 54px;
  bottom: 0;
  background: rgba(250, 204, 21, .05);
  border-left: 1px solid rgba(250, 204, 21, .25);
  border-right: 1px solid rgba(250, 204, 21, .25);
  z-index: 1;
}

/* DZISIAJ */

.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 18;
  box-shadow: 0 0 10px rgba(239, 68, 68, .65);
}

.gantt-today::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 0;
  bottom: 0;
  width: 28px;
  background: rgba(239, 68, 68, .08);
}

/* LEWA KOLUMNA */

.gantt-row-label {
  position: sticky;
  z-index: 22;
  left: 0;
  width: 160px;
  height: 42px;
  display: flex;
  align-items: center;
  padding-left: 18px;
  color: #dbeafe;
  font-size: 13px;
  z-index: 22;
  border-bottom: 1px solid rgba(148, 163, 184, .10);
  background: linear-gradient(90deg, rgba(15, 23, 42, .98), rgba(15, 23, 42, .88));
  backdrop-filter: blur(8px);
}

/* KAFELKI */

.gantt-bar {
  position: absolute;
  z-index: 10;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 12px;
  padding: 0 14px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.gantt-bar:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .28);
}

.gantt-bar-title {
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  position: relative;
  z-index: 2;
}

.gantt-bar-dates {
  font-size: 11px;
  opacity: .72;
  font-weight: 700;
  position: relative;
  z-index: 2;
}

/* CZERWONY KAFELEK */

.gantt-bar.gantt-bar-late {
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(220, 38, 38, .35) !important;
  border: 1px solid rgba(254, 202, 202, .65) !important;
  box-shadow:
  0 0 0 1px rgba(255,255,255,.08),
  0 6px 18px rgba(220,38,38,.30),
  inset 0 0 18px rgba(255,255,255,.06) !important;
}

.gantt-bar.gantt-bar-late:hover {
  background: #b91c1c !important;
  box-shadow: 0 8px 24px rgba(220, 38, 38, .45) !important;
}

/* KRÓTKIE ZLECENIA */

.gantt-bar-short::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .18);
}

/* POPUP - zostawiony awaryjnie */

.gantt-popup {
  position: fixed;
  z-index: 99999;
  width: 300px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .96);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, .35);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
}

.gantt-popup h4 {
  margin: 0 28px 10px 0;
}

.gantt-popup div {
  margin: 6px 0;
  font-size: 13px;
}

.gantt-popup-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

/* MINI MAPA */

.gantt-minimap {
  margin-top: 8px;
}

.gantt-minimap-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  border: 1px solid rgba(148, 163, 184, .25);
  overflow: hidden;
}

.gantt-minimap-track span {
  position: absolute;
  top: 4px;
  height: 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, .65);
}

.gantt-minimap-track span.late {
  background: rgba(239, 68, 68, .80);
}

.gantt-minimap-window {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .10);
  pointer-events: none;
}

/* PANEL BOCZNY */

.gantt-side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  box-sizing: border-box;
  max-width: 100vw;  
  height: 100vh;
  z-index: 100000;
  transform: translateX(105%);
  transition: transform .22s ease;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, .22), transparent 32%),
    rgba(15, 23, 42, .98);
  color: #e5e7eb;
  border-left: 1px solid rgba(148, 163, 184, .28);
  box-shadow: -24px 0 70px rgba(0, 0, 0, .45);
  padding: 26px;
  overflow: auto;
}

.gantt-side-panel.open {
  transform: translateX(0);
}

.gantt-side-close {
  position: absolute;
  right: 18px;
  top: 14px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

.gantt-side-panel h3 {
  margin: 18px 40px 18px 0;
  font-size: 24px;
}

.gantt-side-panel h4 {
  margin-top: 24px;
}

.gantt-side-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(34, 197, 94, .18);
  color: #bbf7d0;
  font-weight: 900;
  font-size: 12px;
}

.gantt-side-badge.late {
  background: rgba(239, 68, 68, .20);
  color: #fecaca;
}

.gantt-side-grid {
  display: grid;
  gap: 10px;
}

.gantt-side-grid div,
.gantt-history div {
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(148, 163, 184, .16);
}

.gantt-side-grid span {
  display: block;
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 4px;
}

.gantt-side-grid b {
  display: block;
  color: white;
}

.gantt-history {
  display: grid;
  gap: 10px;
}

.gantt-history b {
  display: block;
  color: white;
  margin-bottom: 4px;
}

.gantt-history span {
  color: #cbd5e1;
}

/* RESPONSYWNOŚĆ */

@media (max-width: 900px) {
  .gantt-toolbar {
    grid-template-columns: 1fr;
  }

  .gantt-counters {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* HOVER wiersza Ganta */
.gantt-row-hover {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 12px;
  background: transparent;
  pointer-events: none;
  z-index: 3;
  transition: background .12s ease, box-shadow .12s ease;
}

.gantt-row-hover.active {
  background: rgba(255, 255, 255, .055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

/* topbar z odśwież Gant */
.gantt-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 18px;
}

#ganttStatus {
  margin: 0;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}

/* dodaj załączniki */
.step3-attachments-card {
  border: 1px solid rgba(244, 196, 0, 0.35);
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(244,196,0,0.08),
    rgba(255,255,255,0.85)
  );
  box-shadow: 0 16px 40px rgba(0,0,0,0.06);
  padding: 18px;
}

.step3-attachments-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.step3-attachments-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: .3px;
}

.step3-attachments-section-title {
  margin: 16px 0 8px;
  font-weight: 700;
  color: #111;
}

.step3-attachment-inputs {
  display: grid;
  gap: 10px;
}

.step3-attachment-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 14px;
  background: rgba(255,255,255,.85);
}

.step3-attachment-row input[type="file"] {
  background: #fff;
  border-radius: 10px;
}

.step3-attachments-list {
  display: grid;
  gap: 8px;
}

.step3-attachment-file {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 12px;
  background: rgba(255,255,255,.9);
}

.step3-attachment-file a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  word-break: break-word;
}

.step3-attachment-file a:hover {
  text-decoration: underline;
}

.step3AttachmentDeleteBtn {
  color: #b91c1c !important;
  border-color: rgba(185,28,28,.35) !important;
  background: rgba(254,226,226,.8) !important;
}

@media (max-width: 800px) {
  .step3-attachment-row {
    grid-template-columns: 1fr;
  }

  .step3-attachment-file {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Przycisk Dodaj załącznik */
.step3-file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 12px;
  background: rgba(255,255,255,.95);
  cursor: pointer;
  overflow: hidden;
}

.step3-file-picker input[type="file"] {
  display: none;
}

.step3-file-picker-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.35);
  background: linear-gradient(
    180deg,
    rgba(255,255,255,1),
    rgba(241,245,249,1)
  );
  font-weight: 600;
  transition: .15s ease;
}

.step3-file-picker:hover .step3-file-picker-btn {
  background: linear-gradient(
    180deg,
    rgba(255,255,255,1),
    rgba(226,232,240,1)
  );
}

.step3-file-picker-name {
  color: #475569;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ikona przycisku Raporty */
#navReports .nav-card-icon{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;

  background: linear-gradient(
    180deg,
    rgba(255,255,255,.95),
    rgba(226,232,240,.95)
  );

  border:1px solid rgba(148,163,184,.35);

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 2px 8px rgba(15,23,42,.08);

  flex: 0 0 36px;

  font-size: 18px;
}

/* =========================================
   LISTA
========================================= */

.lista-page {
  padding: 24px;
}

.lista-header {
  margin-bottom: 20px;
}

.lista-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #2d2d2d;
}

/* SEGMENTY */

.lista-segments {
  --lista-slider-bg:
    linear-gradient(
      135deg,
      #ffe08a 0%,
      #f3c44b 55%,
      #ddb129 100%
    );  
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  width: max-content;
  margin: 0 auto 22px auto;

  gap: 4px;
  padding: 6px;

  border-radius: 999px;

  background: #f7f7f4;
  border: 1px solid rgba(214, 163, 0, 0.22);

  box-shadow:
    0 10px 24px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.9);
}

.lista-segment-slider {
  position: absolute;
  left: 6px;
  top: 6px;

  border-radius: 999px;

  background: var(--lista-slider-bg);

  transition:
    transform 0.26s cubic-bezier(.2,.8,.2,1),
    width 0.26s cubic-bezier(.2,.8,.2,1);

  z-index: 1;
  pointer-events: none;

  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.16),
    0 4px 10px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.42);
}


.lista-segment {
  position: relative;
  z-index: 2;

  border: none;
  outline: none;

  background: transparent;
  box-shadow: none;

  color: #5f6368;

  padding: 10px 22px;

  border-radius: 999px;

  font-size: 14px;
  font-weight: 700;

  cursor: pointer;

  transition:
    color 0.2s ease,
    transform 0.16s ease;
}

.lista-segment:hover {
  transform: translateY(-1px);
}

.lista-segment.active {
  color: #2f2500;
  text-shadow: none;
}

/* LISTA — mocne nadpisanie stylów globalnych przycisków */

#lista .lista-segment {
  appearance: none !important;
  -webkit-appearance: none !important;

  background: transparent !important;
  background-color: transparent !important;

  border: 0 !important;
  box-shadow: none !important;

  color: #5f6368 !important;
}

#lista .lista-segment:hover,
#lista .lista-segment:focus,
#lista .lista-segment:active {
  background: transparent !important;
  background-color: transparent !important;

  border: 0 !important;
  box-shadow: none !important;
}

#lista .lista-segment.active {
  background: transparent !important;
  background-color: transparent !important;

  border: 0 !important;
  box-shadow: none !important;

  color: #2f2500 !important;
}

/* LISTA — wyszukiwarka */

.lista-search-wrap {
  width: min(760px, 100%);
  margin: 0 auto 22px auto;
}

.lista-search {
  width: 100%;

  padding: 14px 18px;

  border-radius: 18px;
  border: 1px solid rgba(214, 163, 0, 0.22);

  background: rgba(255,255,255,0.86);

  font-size: 15px;
  font-weight: 500;
  color: #242424;

  box-shadow:
    0 10px 24px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.85);

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.lista-search::placeholder {
  color: rgba(60,60,60,0.48);
}

.lista-search:focus {
  border-color: rgba(214, 163, 0, 0.5);

  background: #fff;

  box-shadow:
    0 12px 28px rgba(0,0,0,0.08),
    0 0 0 4px rgba(240, 191, 47, 0.16);
}

/* LISTA — tabela */

.lista-table-wrap {
  width: 100%;
  margin: 0 auto;

  overflow-x: auto;

  border-radius: 22px;

  background: rgba(255,255,255,0.84);

  border: 1px solid rgba(214, 163, 0, 0.16);

  box-shadow:
    0 14px 34px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.9);
}

.lista-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;

  font-size: 14px;
}

.lista-table thead th {
  padding: 14px 14px;

  text-align: left;
  white-space: nowrap;

  font-size: 13px;
  font-weight: 800;

  color: #5a4a12;

  background:
    linear-gradient(
      180deg,
      rgba(255,248,220,0.95) 0%,
      rgba(246,232,180,0.92) 100%
    );

  border-bottom: 1px solid rgba(214, 163, 0, 0.18);
}

.lista-table thead th:first-child {
  border-top-left-radius: 22px;
}

.lista-table thead th:last-child {
  border-top-right-radius: 22px;
}

.lista-table tbody td {
  padding: 14px 14px;

  border-bottom: 1px solid rgba(0,0,0,0.06);

  color: #2b2b2b;
}

.lista-table tbody tr:last-child td {
  border-bottom: none;
}

.lista-table tbody tr:hover td {
  background: rgba(255, 244, 203, 0.35);
}

.lista-empty {
  text-align: center;
  padding: 32px 14px !important;

  color: rgba(50,50,50,0.55);
  font-weight: 600;
}

/* LISTA — akcje */

.lista-action-btn {
  border: none;

  padding: 8px 14px;

  border-radius: 12px;

  cursor: pointer;

  font-size: 13px;
  font-weight: 700;

  color: #3d3200;

  background:
    linear-gradient(
      180deg,
      #ffe38d 0%,
      #f3c13b 100%
    );

  box-shadow:
    0 4px 10px rgba(214,163,0,0.18);

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.lista-action-btn:hover {
  transform: translateY(-1px);

  box-shadow:
    0 6px 14px rgba(214,163,0,0.24);
}

/* ===== Powiadomienia - dzwonek w topbarze ===== */

.tb-notifications {
  position: relative;
}

.notification-bell {
  position: relative;
  min-width: 42px;
  justify-content: center;
}

.notification-bell-icon {
  line-height: 1;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.notification-badge.hidden {
  display: none;
}

.notification-menu {
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 0;
  overflow: hidden;
}

.notification-menu-title {
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.notification-menu-list {
  max-height: 320px;
  overflow-y: auto;
}

.notification-empty {
  padding: 16px 14px;
  color: var(--muted);
  font-size: 14px;
}

.notification-show-all {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-weight: 700;
  cursor: pointer;
}

.notification-show-all:hover {
  background: rgba(245, 158, 11, 0.12);
}

/* ===== Powiadomienia - podstrona ===== */

.notification-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.notification-page-list-wrap,
.notification-page-settings {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--card);
}

.notifications-page-list {
  display: grid;
  gap: 8px;
}

.notification-setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
}

.notification-setting-row input {
  width: 16px;
  height: 16px;
}

@media (max-width: 850px) {
  .notification-page-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== Elementy powiadomień ===== */

.notification-item,
.notification-page-open {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.notification-item:hover,
.notification-page-open:hover {
  background: rgba(245, 158, 11, 0.08);
}

.notification-item.unread,
.notification-page-item.unread {
  background: rgba(245, 158, 11, 0.10);
}

.notification-item-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.notification-item-text {
  font-size: 14px;
  opacity: 0.9;
}

.notification-item-date {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.6;
}

.notification-page-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.notification-page-actions {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.notification-read-btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.15);
  color: var(--fg);
}

/* przycisk usuń notyfikację */
.notification-delete-btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
  margin-left: 8px;
}

.notification-delete-btn:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* filtry powiadomień */
.notification-filters {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}

.notification-filter-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-weight: 700;
}

.notification-filter-btn.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
}

.notification-filter-btn:hover {
  background: rgba(245, 158, 11, 0.10);
}

/* ===== Nowoczesna lista powiadomień ===== */

.notifications-page-list {
  display: grid;
  gap: 10px;
}

.notification-page-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.notification-page-item.unread {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(
    90deg,
    rgba(245, 158, 11, 0.12),
    rgba(245, 158, 11, 0.03)
  );
}

.notification-page-open {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.notification-page-open:hover {
  background: rgba(245, 158, 11, 0.08);
}

.notification-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.5);
}

.notification-page-item.unread .notification-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.notification-page-main {
  min-width: 0;
}

.notification-item-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.notification-item-text {
  font-size: 14px;
  opacity: 0.82;
  line-height: 1.35;
}

.notification-page-date {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.notification-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-left: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.04);
}

.notification-read-btn,
.notification-delete-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 700;
  background: var(--card);
  color: var(--fg);
}

.notification-read-btn:hover {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.notification-delete-btn {
  color: #ef4444;
}

.notification-delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

@media (max-width: 900px) {
  .notification-page-item {
    grid-template-columns: 1fr;
  }

  .notification-page-open {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .notification-page-date {
    grid-column: 2;
    justify-self: start;
    margin-top: 4px;
  }

  .notification-page-actions {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    justify-content: flex-end;
  }
}

/* ===== Poprawki UX powiadomień ===== */

.notification-filters {
  align-items: center;
}

.notification-mark-all-btn {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(245, 158, 11, 0.10);
  color: var(--fg);
  cursor: pointer;
  font-weight: 800;
}

.notification-mark-all-btn:hover {
  background: rgba(245, 158, 11, 0.18);
}

.notification-page-item {
  grid-template-columns: minmax(0, 1fr) 190px;
}

.notification-page-open {
  grid-template-columns: 14px minmax(0, 1fr) 155px;
  border-right: 1px solid var(--border);
}

.notification-page-actions {
  border-left: 0;
  background: transparent;
  justify-content: center;
  padding: 0 12px;
}

.notification-read-btn,
.notification-delete-btn {
  min-width: 78px;
}

.notification-delete-btn {
  background: rgba(239, 68, 68, 0.10);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.22);
}

.notification-delete-btn::before {
  content: "🗑 ";
}

.notification-delete-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #991b1b;
}

.notification-menu {
  width: 430px;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: center;
  color: var(--fg);
}

.notification-item:hover {
  color: var(--fg);
}

.notification-item:hover .notification-item-title,
.notification-item:hover .notification-item-text,
.notification-item:hover .notification-item-date {
  color: var(--fg);
}

.notification-item .notification-item-date {
  justify-self: end;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .notification-mark-all-btn {
    margin-left: 0;
    width: 100%;
  }

  .notification-page-item {
    grid-template-columns: 1fr;
  }

  .notification-page-open {
    border-right: 0;
  }

  .notification-page-actions {
    justify-content: flex-end;
  }
}

/* ===== Poprawka przycisków powiadomień ===== */

.notification-page-actions {
  gap: 10px;
}

.notification-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 86px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.notification-delete-btn::before {
  content: "🗑️";
  font-size: 14px;
  line-height: 1;
}

.notification-delete-btn:hover {
  background: #fecaca;
  color: #991b1b;
  border-color: #fca5a5;
}

.notification-mark-all-btn {
  margin-top: 16px;
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--fg);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.12);
}

.notification-mark-all-btn::before {
  content: "✓";
  font-weight: 900;
}

.notification-mark-all-btn:hover {
  background: rgba(245, 158, 11, 0.24);
  border-color: rgba(245, 158, 11, 0.50);
}

/* ===== Komunikator zlecenia ===== */

.messages-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.message-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(148, 163, 184, 0.05);
}

.message-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.message-author {
  font-weight: 800;
}

.message-date {
  color: var(--muted);
  font-size: 13px;
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.45;
}

.messages-compose {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

#messageTextInput {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px;
  resize: vertical;
  min-height: 110px;
  font: inherit;
  background: var(--card);
  color: var(--fg);
}

.messages-compose-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ===== Wiadomość do Wykonawcy w Kroku 2 ===== */

.message-to-vendor-field {
  display: block;
  margin-top: 14px;
}

.message-to-vendor-field span {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
}

#messageToVendorInput {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font: inherit;
  background: var(--card);
  color: var(--fg);
}

.message-to-vendor-field {
  display: block !important;
  width: 100%;
  margin-top: 18px;
}

.message-to-vendor-field textarea {
  display: block;
  width: 100%;
}

/* ===== Profesjonalny wygląd komunikatora ===== */

.order-messages-card {
  overflow: hidden;
}

.messages-card-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

#messagesCardBody {
  margin-top: 14px;
}

.messages-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(148, 163, 184, 0.06), rgba(255, 255, 255, 0.02));
}

.message-item {
  max-width: 78%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  background: var(--card);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.message-item.message-role-vendor {
  align-self: flex-start;
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.18);
}

.message-item.message-role-user,
.message-item.message-role-client,
.message-item.message-role-superuser {
  align-self: flex-end;
  background: rgba(245, 158, 11, 0.11);
  border-color: rgba(245, 158, 11, 0.22);
}

.message-item-header {
  gap: 8px;
}

.message-author {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.message-date {
  font-size: 12px;
}

.message-text {
  margin-top: 6px;
  font-size: 15px;
}

.messages-compose {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.05);
}

#messageTextInput {
  min-height: 90px;
  background: #fff;
}

#sendMessageBtn {
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
}

@media (max-width: 800px) {
  .message-item {
    max-width: 100%;
  }
}

/* ===== Naprawa dropdowna powiadomień ===== */

.notification-menu {
  width: 420px;
}

.notification-item {
  display: block;
  padding: 12px 14px;
  color: var(--fg);
  text-align: left;
}

.notification-item:hover {
  color: var(--fg);
  background: rgba(245, 158, 11, 0.08);
}

.notification-item-title {
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--fg);
}

.notification-item-text {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  color: var(--fg);
  opacity: 0.86;
}

.notification-item-date {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.75;
  text-align: left;
}

/* ===== Wyróżnienie sekcji wiadomości ===== */

.order-messages-card {
  border: 1px solid rgba(245, 158, 11, 0.26);
  background:
    linear-gradient(
      180deg,
      rgba(255, 248, 220, 0.95),
      rgba(255, 252, 242, 0.98)
    );
  box-shadow:
    0 18px 42px rgba(245, 158, 11, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.7);
}

.messages-card-header {
  cursor: pointer;
  border-bottom: 1px solid rgba(245, 158, 11, 0.18);
  padding-bottom: 12px;
}

.messages-card-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.messages-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  font-size: 13px;
  font-weight: 900;
}

.messages-card-header:hover {
  background: rgba(245, 158, 11, 0.06);
  border-radius: 14px;
}
/* ===== Zarządzanie projektami ===== */

#projectsManageTable {
  border-collapse: separate !important;
  border-spacing: 0;
  width: 100%;
  overflow: hidden;
  font-size: 14px;
}

#projectsManageTable thead th {
  padding: 10px 12px;
  background: rgba(244,196,0,0.12);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  text-align: left;
  font-weight: 800;
  white-space: nowrap;
}

#projectsManageTable tbody td {
  padding: 10px 12px !important;
  border-bottom: 1px solid rgba(148,163,184,0.18);
  vertical-align: middle;
}

#projectsManageTable tbody tr:hover td {
  background: rgba(244,196,0,0.08);
}

#projectsManageTable .pmStatusSelect {
  min-width: 130px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 700;
}

#projectsManageTable button.secondary {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}

#projectsManageTable td:first-child {
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}

/* ===== Stały pasek projektu pod nagłówkiem zakładki ===== */

.project-context-box {
  margin: 6px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(244,196,0,0.45);
  border-radius: 14px;
  background: rgba(244,196,0,0.10);
  color: var(--fg);
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 22px rgba(2,6,23,0.08);
  font-variant-numeric: tabular-nums;
}

.project-context-box::before {
  content: "Projekt: ";
  color: var(--muted);
  font-weight: 600;
}

#ordersTable .cell-project-number {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  text-align: center;
  white-space: nowrap;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

#ordersTable th:first-child {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  text-align: center;
  white-space: nowrap;
}

/* ===== UWAGI / ZGŁOSZENIA ===== */

header nav a#navUwagi {
  padding: 12px 16px;
  font-size: 0.95rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

header nav a#navUwagi::before {
  content: attr(data-icon);
  display: inline-block;
  line-height: 1;
}

.uwagi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.uwagi-header h2 {
  margin-bottom: 4px;
}

.uwagi-new-card {
  margin-bottom: 16px;
}

.uwagi-new-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px;
  gap: 14px;
}

.uwagi-new-grid textarea {
  min-height: 90px;
}

.uwagi-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.uwagi-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

.uwagi-table th,
.uwagi-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  vertical-align: top;
  text-align: left;
}

.uwagi-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
}

.uwagi-opis {
  min-width: 260px;
  white-space: pre-wrap;
}

.uwagi-table textarea {
  width: 100%;
  min-width: 220px;
  min-height: 70px;
  resize: vertical;
}

.uwagi-priority {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.uwagi-priority-zwykły {
  background: rgba(148, 163, 184, .14);
}

.uwagi-priority-krytyczny {
  background: rgba(220, 38, 38, .14);
  color: #dc2626;
  border-color: rgba(220, 38, 38, .35);
}

.uwagi-priority-usprawnienie {
  background: rgba(244, 196, 0, .18);
  color: #7a5b00;
  border-color: rgba(244, 196, 0, .45);
}

.uwagi-done-cell {
  min-width: 170px;
}

.uwagi-done-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  margin: 0;
}

.uwagi-done-label input {
  width: auto;
}

tr.uwaga-done {
  opacity: .55;
}

tr.uwaga-done td {
  background: rgba(148, 163, 184, .08);
}

tr.uwaga-done .uwagi-opis {
  text-decoration: line-through;
}

@media (max-width: 800px) {
  .uwagi-new-grid {
    grid-template-columns: 1fr;
  }
}

.uwagi-filter-btn {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
  font-weight: 800;
  border-radius: 999px !important;
  border: 1px solid var(--border2, var(--border)) !important;
  background: #ffffff !important;
  color: var(--fg) !important;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}

.uwagi-filter-btn:hover {
  border-color: rgba(34, 197, 94, .55) !important;
  background: rgba(34, 197, 94, .10) !important;
}

.uwagi-filter-btn.is-active,
.uwagi-filter-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #34d399, #16a34a) !important;
  color: #ffffff !important;
  border-color: rgba(22, 163, 74, .85) !important;
  box-shadow: 0 12px 26px rgba(22, 163, 74, .26) !important;
}

.uwagi-filter-btn.is-active:hover,
.uwagi-filter-btn[aria-pressed="true"]:hover {
  background: linear-gradient(180deg, #4ade80, #16a34a) !important;
  transform: translateY(-1px);
}

/* ===== EUR pod ceną PLN ===== */

.summary-price-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.15;
}

.summary-pln-price {
  font-size: inherit;
  font-weight: 900;
}

.summary-eur-price {
  font-size: 0.78em;
  font-weight: 850;
  opacity: 0.92;
}

.summary-rate-info {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.72;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.summary-rate-btn {
  font-size: 11px !important;
  padding: 3px 8px !important;
  border-radius: 999px !important;
  line-height: 1.2 !important;
  min-height: auto !important;
}

.summary-rate-btn[disabled] {
  opacity: 0.6;
  cursor: wait;
}

/* KBH_STAGE_06_CLIENT_OWNER_AND_TABLE_LAYOUT_V1
   Uwaga 11 + stabilizacja tabel w DANE KLIENTA. */
#step1 #openPanel{
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

#step1 #quotesManageWrap{
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#step1 .kbh-crm-table-scroll{
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 12px;
  scrollbar-gutter: stable;
}

#step1 table.kbh-crm-table{
  width: 100% !important;
  min-width: 1080px;
  table-layout: auto !important;
  border-collapse: collapse;
}

#step1 #quotesManageWrap table.kbh-crm-table th,
#step1 #quotesManageWrap table.kbh-crm-table td{
  width: auto !important;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  vertical-align: top;
}

#step1 #quotesManageWrap table.kbh-crm-table td{
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
  word-break: normal;
}

#step1 #quotesManageWrap table.kbh-crm-table th:first-child,
#step1 #quotesManageWrap table.kbh-crm-table td:first-child{
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  text-align: center;
}

#step1 #quotesManageWrap .qmFilterInput{
  width: 100% !important;
  min-width: 72px;
  max-width: 100%;
  box-sizing: border-box !important;
}

#step1 #quotesManageWrap .qm-sort{
  max-width: 100%;
}

#step1 #quotesManageWrap .qm-sort-label{
  white-space: normal;
  overflow-wrap: anywhere;
}

#step1 #quotesManageTable .kbh-cm-company{ min-width: 150px; font-weight: 700; }
#step1 #quotesManageTable .kbh-cm-owner{ min-width: 120px; white-space: nowrap !important; }
#step1 #quotesManageTable .kbh-cm-nip{ min-width: 110px; white-space: nowrap !important; }
#step1 #quotesManageTable .kbh-cm-address{ min-width: 190px; }
#step1 #quotesManageTable .kbh-cm-contact{ min-width: 145px; }
#step1 #quotesManageTable .kbh-cm-email{ min-width: 180px; }
#step1 #quotesManageTable .kbh-cm-phone{ min-width: 120px; white-space: nowrap !important; }

#step1 #projectsManageTable select.pmStatusSelect{
  width: 100%;
  min-width: 110px;
  box-sizing: border-box;
}

@media (max-width: 900px){
  #step1 table.kbh-crm-table{ min-width: 980px; }
}

/* KBH_STAGE_07_CLIENT_TABLE_AND_UWAGI_AUTOSAVE_V1
   Uproszczona tabela klientów + status automatycznego zapisu uwag. */
#step1 table.kbh-crm-table{
  min-width: 1000px;
}

#step1 #quotesManageTable tbody tr{
  cursor: pointer;
}

#uwagi .uwagi-save-row,
[data-route="/uwagi"] .uwagi-save-row{
  min-width: 100px;
}

#uwagi .uwagi-save-row.kbh-autosave-saving,
[data-route="/uwagi"] .uwagi-save-row.kbh-autosave-saving{
  opacity: 0.75;
}

#uwagi .uwagi-save-row.kbh-autosave-saved,
[data-route="/uwagi"] .uwagi-save-row.kbh-autosave-saved{
  font-weight: 700;
}

#uwagi .uwagi-save-row.kbh-autosave-error,
[data-route="/uwagi"] .uwagi-save-row.kbh-autosave-error{
  font-weight: 800;
}

@media (max-width: 900px){
  #step1 table.kbh-crm-table{ min-width: 920px; }
}



/* KBH_STAGE_22_ORDER_WORKFLOW_HARDENING_V5 */
.kbh-vehicle-model-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: min(100%, 430px);
}
.kbh-vehicle-model-input-wrap #b_model {
  flex: 1 1 auto;
  min-width: 0;
}
.kbh-vehicle-model-clear {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.excel-sync-status,
.summary-excel-sync-status {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
}
.summary-excel-sync-status {
  margin-bottom: 10px;
}


/* KBH_STAGE_23_VENDOR_REVISIONS_MATRIX_UI_V2 */
#activeOrderBar .topbar-order-actions button {
  color: #111827 !important;
}
#activeOrderBar #owbBackBtn {
  color: #111827 !important;
  font-weight: 800;
  border-color: #111827 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 1px 4px rgba(17,24,39,.28);
}


/* KBH_STAGE_25_ORDER_FULFILLMENT_V2 */
/* Zlecenia: status jako pełny wiersz + operacyjne kolumny. */
#ordersTable.orders-table-operational .order-status-row-inner {
  margin-left: 0 !important;
  padding: 0 4px !important;
  gap: 10px !important;
}
#ordersTable.orders-table-operational .order-status-caption {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
#ordersTable.orders-table-operational tr.order-status-row td {
  background: rgba(244,196,0,.08) !important;
  border-top: 1px solid rgba(244,196,0,.22) !important;
  padding: 8px 12px !important;
}
#ordersTable.orders-table-operational tr.order-main-row td {
  padding-top: 14px !important;
  padding-bottom: 18px !important;
}
#ordersTable.orders-table-operational .orders-term-main {
  font-weight: 700;
  white-space: nowrap;
}
#ordersTable.orders-table-operational .orders-term-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
#ordersTable.orders-table-operational th:nth-child(2),
#ordersTable.orders-table-operational td:nth-child(2) { min-width: 260px; }
#ordersTable.orders-table-operational th:nth-child(5),
#ordersTable.orders-table-operational td:nth-child(5),
#ordersTable.orders-table-operational th:nth-child(6),
#ordersTable.orders-table-operational td:nth-child(6) { min-width: 145px; }
#ordersTable.orders-table-operational th:nth-child(7),
#ordersTable.orders-table-operational td:nth-child(7) { min-width: 150px; }
#ordersTable.orders-table-operational th:nth-child(8),
#ordersTable.orders-table-operational td:nth-child(8) { min-width: 150px; }
#ordersTable.orders-table-operational th:nth-child(9),
#ordersTable.orders-table-operational td:nth-child(9) { min-width: 180px; }

#orderFulfillmentCard .fulfillment-help {
  margin: 6px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(244,196,0,.28);
  border-radius: 12px;
  background: rgba(244,196,0,.08);
  line-height: 1.45;
}
#orderFulfillmentCard .fulfillment-field-hint {
  font-size: 12px;
  line-height: 1.35;
}
#orderFulfillmentCard .fulfillment-grid {
  grid-template-columns: repeat(3, minmax(200px, 1fr));
}
.kbh-stage25v2-modal-backdrop {
  position: fixed; inset: 0; z-index: 10050;
  background: rgba(2,6,23,.55);
  align-items: center; justify-content: center; padding: 18px;
}
.kbh-stage25v2-modal {
  width: min(560px, 96vw);
  border: 1px solid var(--border, #d1d5db);
  background: var(--card, #ffffff);
  color: var(--fg, #111827);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(2,6,23,.28);
}
.kbh-stage25v2-modal h3 { margin: 0 0 10px; }
.kbh-stage25v2-modal input[type="date"] {
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  background: #fff;
  color: var(--fg, #111827);
}
.kbh-stage25v2-modal .btnrow {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 850px) {
  #orderFulfillmentCard .fulfillment-grid { grid-template-columns: 1fr; }
}


/* KBH_STAGE_25_ORDER_FULFILLMENT_V3 */
/* Wspólny, operacyjny układ Zleceń dla Handlowca i Wykonawcy. */
#orders .orders-toolbar-card {
  padding-top: 10px;
  padding-bottom: 10px;
}
#ordersTable.orders-table-operational {
  table-layout: auto;
}
/* Cofnij stare reguły z układu sprzed Etapu 25, które traktowały kolumnę 2 jako Status. */
#ordersTable.orders-table-operational tbody tr.order-main-row td:nth-child(2) {
  display: table-cell !important;
  text-align: left !important;
  white-space: normal !important;
  overflow: visible !important;
}
/* Kluczowe kolumny zawsze widoczne niezależnie od starej klasy roli. */
#orders.orders-hide-fromwho #ordersTable.orders-table-operational th:nth-child(6),
#orders.orders-hide-fromwho #ordersTable.orders-table-operational td:nth-child(6),
#orders.orders-hide-fromwho #ordersTable.orders-table-operational th:nth-child(7),
#orders.orders-hide-fromwho #ordersTable.orders-table-operational td:nth-child(7),
#ordersTable.orders-table-operational th:nth-child(6),
#ordersTable.orders-table-operational td:nth-child(6),
#ordersTable.orders-table-operational th:nth-child(7),
#ordersTable.orders-table-operational td:nth-child(7) {
  display: table-cell !important;
}
#ordersTable.orders-table-operational th:nth-child(1),
#ordersTable.orders-table-operational td:nth-child(1) { width: 88px; min-width: 88px; }
#ordersTable.orders-table-operational th:nth-child(2),
#ordersTable.orders-table-operational td:nth-child(2) { width: auto; min-width: 230px; }
#ordersTable.orders-table-operational th:nth-child(3),
#ordersTable.orders-table-operational td:nth-child(3) { width: 118px; min-width: 118px; }
#ordersTable.orders-table-operational th:nth-child(4),
#ordersTable.orders-table-operational td:nth-child(4) { width: 122px; min-width: 122px; white-space: nowrap; }
#ordersTable.orders-table-operational th:nth-child(5),
#ordersTable.orders-table-operational td:nth-child(5) { width: 145px; min-width: 145px; white-space: nowrap; }
#ordersTable.orders-table-operational th:nth-child(6),
#ordersTable.orders-table-operational td:nth-child(6) { width: 175px; min-width: 175px; }
#ordersTable.orders-table-operational th:nth-child(7),
#ordersTable.orders-table-operational td:nth-child(7) { width: 135px; min-width: 135px; white-space: nowrap; }
#ordersTable.orders-table-operational th:nth-child(8),
#ordersTable.orders-table-operational td:nth-child(8) { width: 145px; min-width: 145px; }
#ordersTable.orders-table-operational th:nth-child(9),
#ordersTable.orders-table-operational td:nth-child(9) {
  width: 122px; min-width: 122px; max-width: 122px;
  text-align: right;
}
#ordersTable.orders-table-operational .cell-actions .orders-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
#ordersTable.orders-table-operational .cell-actions .order-act,
#ordersTable.orders-table-operational .cell-actions .order-open-program-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
}
#ordersTable.orders-table-operational .cell-actions .prog-ico {
  display: inline-flex;
  line-height: 1;
  font-size: 13px;
}
#ordersTable.orders-table-operational .orders-term-main {
  font-weight: 700;
}
#ordersTable.orders-table-operational .orders-term-sub {
  font-size: 11px;
  line-height: 1.25;
}
@media (max-width: 900px) {
  #orders .orders-toolbar-card { display: block; }
}
\n\n/* KBH_STAGE_25_ORDERS_ACTIONS_MESSAGES_ATTACHMENTS_V4 */\n.orders-hide-actions [data-orders-col="actions"] {\n  display: none !important;\n}\n\n.message-attachment-picker {\n  margin-top: 12px;\n  padding: 12px;\n  border: 1px dashed var(--border);\n  border-radius: 14px;\n  background: rgba(148, 163, 184, 0.04);\n}\n\n.message-attachment-label {\n  display: inline-block;\n  font-weight: 800;\n  margin-bottom: 8px;\n}\n\n#messageAttachmentInput {\n  display: block;\n  width: 100%;\n}\n\n.message-attachment-help,\n.message-attachment-name {\n  margin-top: 6px;\n  font-size: 12px;\n}\n\n.message-attachment-v4 {\n  margin-top: 10px;\n}\n\n.message-attachment-link {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  max-width: 100%;\n  padding: 8px 10px;\n  border: 1px solid var(--border);\n  border-radius: 12px;\n  font-weight: 700;\n  text-decoration: none;\n  overflow-wrap: anywhere;\n}\n

/* KBH_STAGE_25_ORDERS_PAIR_STRIPES_V6 */
/* Status i odpowiadający mu wiersz Zlecenia tworzą jedną wizualną parę. */
#ordersTable.orders-table-operational tbody tr.order-pair-gray > td {
  background: #f3f4f6 !important;
}
#ordersTable.orders-table-operational tbody tr.order-pair-white > td {
  background: #ffffff !important;
}

/* Bez linii przecinającej parę pomiędzy Statusem i danymi Zlecenia. */
#ordersTable.orders-table-operational tbody tr.order-status-row.order-pair-gray,
#ordersTable.orders-table-operational tbody tr.order-status-row.order-pair-white {
  border-bottom: 0 !important;
}
#ordersTable.orders-table-operational tbody tr.order-status-row.order-pair-gray > td,
#ordersTable.orders-table-operational tbody tr.order-status-row.order-pair-white > td {
  border-bottom: 0 !important;
}

/* Delikatna linia dopiero pod całą parą. */
#ordersTable.orders-table-operational tbody tr.order-main-row.order-pair-gray,
#ordersTable.orders-table-operational tbody tr.order-main-row.order-pair-white {
  border-bottom: 1px solid var(--border) !important;
}

/* Hover nadal sygnalizuje aktywny wiersz, ale nie gubi naprzemiennego grupowania. */
#ordersTable.orders-table-operational tbody tr.order-pair-gray:hover > td,
#ordersTable.orders-table-operational tbody tr.order-pair-white:hover > td {
  background: rgba(244, 196, 0, 0.12) !important;
}

/* KBH_STAGE_25_QUOTE_TEMPLATE_SINGLE_PROJECT_WIDTH_V9 */
/* Zarządzanie projektami korzysta z quotesManageWrap, gdzie pierwsza kolumna
   tabel wycen ma historycznie 48 px !important. Dla tabeli projektów jawnie
   nadpisujemy tę regułę, żeby "Nr projektu" i numer były w jednym wierszu. */
#step1 #quotesManageWrap #projectsManageTable th:first-child,
#step1 #quotesManageWrap #projectsManageTable td:first-child {
  width: 140px !important;
  min-width: 140px !important;
  max-width: 140px !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  text-align: left !important;
}

/* KBH_STAGE_25_PROJECT_QUOTES_NAME_WIDTH_V10 */
/* Widok: Zarządzanie projektami -> Wyceny.
   Ogólna historyczna reguła dla quotesManageWrap wymuszała pierwszej kolumnie 48 px.
   Ta tabela ma własny identyfikator i biznesowe szerokości kolumn. */
#step1 #quotesManageWrap #projectQuotesManageTable th:first-child,
#step1 #quotesManageWrap #projectQuotesManageTable td:first-child {
  width: 42% !important;
  min-width: 360px !important;
  max-width: none !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}
#step1 #quotesManageWrap #projectQuotesManageTable th:nth-child(2),
#step1 #quotesManageWrap #projectQuotesManageTable td:nth-child(2) {
  width: 120px !important;
  min-width: 120px !important;
  white-space: nowrap !important;
}
#step1 #quotesManageWrap #projectQuotesManageTable th:nth-child(3),
#step1 #quotesManageWrap #projectQuotesManageTable td:nth-child(3) {
  width: 150px !important;
  min-width: 150px !important;
}
#step1 #quotesManageWrap #projectQuotesManageTable th:nth-child(4),
#step1 #quotesManageWrap #projectQuotesManageTable td:nth-child(4) {
  width: 140px !important;
  min-width: 140px !important;
  white-space: nowrap !important;
}
#step1 #quotesManageWrap #projectQuotesManageTable th:nth-child(5),
#step1 #quotesManageWrap #projectQuotesManageTable td:nth-child(5) {
  width: 180px !important;
  min-width: 180px !important;
  white-space: nowrap !important;
}


/* KBH_STAGE_38_STEP2_COLLAPSIBLE_ACCESSORIES_V1 */
.step2-collapsible-stack{
  display:grid;
  gap:12px;
}

.step2-collapsible{
  border:1px solid var(--border, rgba(148,163,184,.28));
  border-radius:14px;
  background:var(--panel, rgba(255,255,255,.03));
  overflow:hidden;
}

.step2-collapsible > summary{
  list-style:none;
  cursor:pointer;
  min-height:56px;
  padding:14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  font-weight:800;
  user-select:none;
}

.step2-collapsible > summary::-webkit-details-marker{ display:none; }
.step2-collapsible > summary::after{
  content:'+';
  flex:0 0 auto;
  width:28px;
  height:28px;
  border-radius:50%;
  display:grid;
  place-items:center;
  border:1px solid rgba(250,204,21,.72);
  color:var(--text, #e5e7eb);
  font-size:20px;
  line-height:1;
  transition:transform .18s ease, background .18s ease;
}

.step2-collapsible[open] > summary::after{
  content:'−';
  background:rgba(250,204,21,.12);
}

.step2-collapsible[open] > summary{
  border-bottom:1px solid var(--border, rgba(148,163,184,.22));
}

.step2-collapsible-hint,
.step2-accessories-count{
  margin-left:auto;
  font-size:12px;
  font-weight:700;
  color:var(--muted, #94a3b8);
  white-space:nowrap;
}

.step2-collapsible[open] .step2-collapsible-hint{ visibility:hidden; }

.step2-collapsible-grid{
  padding:16px 18px 18px;
}

.step2-accessories-root{
  padding:8px 18px 18px;
  display:grid;
  gap:16px;
}

.step2-accessory-group{
  display:grid;
  gap:8px;
}

.step2-accessory-group-title{
  margin:8px 0 2px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.055em;
  text-transform:uppercase;
  color:var(--muted, #94a3b8);
}

.step2-accessory-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:16px;
  padding:10px 12px;
  border:1px solid rgba(148,163,184,.20);
  border-radius:11px;
  background:rgba(255,255,255,.025);
}

.step2-accessory-label{
  min-width:0;
  font-size:13px;
  line-height:1.38;
  font-weight:650;
}

.step2-accessory-row .yn-toggle{
  margin:0;
  flex-wrap:nowrap;
}

.step2-accessory-row .yn-toggle button{
  min-width:58px;
}

.step2-accessory-row.is-selected{
  border-color:rgba(250,204,21,.62);
  background:rgba(250,204,21,.07);
}

body[data-theme="light_premium"] .step2-collapsible,
body[data-theme="light"] .step2-collapsible{
  background:rgba(255,255,255,.82);
  border-color:rgba(15,23,42,.14);
}

body[data-theme="light_premium"] .step2-accessory-row,
body[data-theme="light"] .step2-accessory-row{
  background:rgba(248,250,252,.88);
  border-color:rgba(15,23,42,.12);
}

@media (max-width:760px){
  .step2-accessory-row{
    grid-template-columns:1fr;
    align-items:start;
  }
  .step2-accessory-row .yn-toggle{
    justify-content:flex-start;
  }
}

/* KBH_STAGE_39_STEP2_FULL_WIDTH_V1
   Krok 2: rozwijane panele na pelna dostepna szerokosc.
*/
#step2 #baseForm{
  align-items: stretch !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
}

#step2 #baseForm .step2-collapsible-stack{
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  box-sizing: border-box;
}

#step2 #baseForm .step2-collapsible{
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  box-sizing: border-box;
}

#step2 #baseForm .step2-collapsible-grid{
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
}

#step2 #baseForm .step2-accessories-root{
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 640px){
  #step2 #baseForm .step2-collapsible-grid{
    grid-template-columns: 1fr !important;
  }
}



/* KBH_STAGE_50_LIST_PRICE_SOURCE_BASE_PRICE_MEMORY_V1 */
.lista-price-cell{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  line-height:1.15;
}
.lista-price-value{
  font-weight:800;
  white-space:nowrap;
}
.lista-price-source{
  font-size:11px;
  font-weight:700;
  opacity:.64;
  white-space:nowrap;
}
.lista-price-empty{ opacity:.55; }


/* KBH_STAGE_58_HELP_SCENARIOS_JSON_V1 */
header nav a#navPomoc {
  padding: 12px 16px;
  font-size: 0.95rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

header nav a#navPomoc::before {
  content: attr(data-icon);
  display: inline-block;
  line-height: 1;
}

.pomoc-root {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding-bottom: 36px;
}

.pomoc-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  padding: 26px 28px;
}

.pomoc-hero::after {
  content: "?";
  position: absolute;
  right: 22px;
  top: -36px;
  font-size: 180px;
  line-height: 1;
  font-weight: 900;
  opacity: .045;
  pointer-events: none;
}

.pomoc-eyebrow,
.pomoc-scenario-meta {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pomoc-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.pomoc-hero h2,
.pomoc-section-heading h2 {
  margin: 4px 0 6px;
}

.pomoc-hero p,
.pomoc-section-heading p,
.pomoc-scenario-title-wrap p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.pomoc-hero-row > div:first-child {
  max-width: 900px;
}

.pomoc-version {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: rgba(127, 127, 127, .06);
}

.pomoc-search-wrap {
  position: relative;
  margin-top: 20px;
  max-width: 760px;
}

.pomoc-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: var(--muted);
  pointer-events: none;
}

#pomocSearchInput {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px 10px 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  box-sizing: border-box;
}

#pomocSearchInput:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.pomoc-shortcuts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pomoc-shortcuts button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  background: rgba(127, 127, 127, .05);
  cursor: pointer;
  font-family: inherit;
}

.pomoc-shortcuts button:hover {
  border-color: var(--brand);
}

.pomoc-content-section {
  scroll-margin-top: 90px;
  margin-top: 28px;
}

.pomoc-section-heading {
  margin-bottom: 14px;
}

.pomoc-scenarios {
  display: grid;
  gap: 16px;
}

.pomoc-scenario,
.pomoc-tip-group {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(2, 6, 23, .06);
}

.pomoc-scenario {
  padding: 22px 24px;
}

.pomoc-scenario-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.pomoc-scenario-number {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand);
  color: #111827;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 8px 22px rgba(244, 196, 0, .22);
}

.pomoc-scenario-title-wrap h3,
.pomoc-tip-group h3 {
  margin: 3px 0 7px;
}

.pomoc-steps {
  margin: 20px 0 0 62px;
  padding-left: 22px;
}

.pomoc-steps li {
  padding-left: 6px;
  margin: 0 0 12px;
  line-height: 1.55;
}

.pomoc-steps li::marker {
  color: var(--brand);
  font-weight: 900;
}

.pomoc-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 18px 0 0 62px;
}

.pomoc-note {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: rgba(244, 196, 0, .08);
  line-height: 1.45;
}

.pomoc-note strong {
  font-size: 13px;
}

.pomoc-note span {
  color: var(--fg);
}

.pomoc-tips-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pomoc-tip-group {
  padding: 18px 20px;
}

.pomoc-tip-group h3 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.pomoc-tip-group ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.pomoc-tip-group li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.pomoc-tip-group li::marker {
  color: var(--brand);
}

.pomoc-search-empty,
.pomoc-load-error {
  margin-top: 18px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .pomoc-tips-grid {
    grid-template-columns: 1fr;
  }

  .pomoc-hero-row {
    display: block;
  }

  .pomoc-version {
    display: inline-flex;
    margin-top: 12px;
  }
}

@media (max-width: 640px) {
  .pomoc-hero,
  .pomoc-scenario,
  .pomoc-tip-group {
    padding: 16px;
  }

  .pomoc-scenario-head {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
  }

  .pomoc-scenario-number {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 17px;
  }

  .pomoc-steps,
  .pomoc-notes {
    margin-left: 0;
  }

  .pomoc-steps {
    padding-left: 24px;
  }
}

/* KBH_STAGE_67_INQUIRIES_ORDERS_STATUS_NOTIFICATIONS_V1 */
.order-management-control {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
}
.order-management-status {
  min-width: 130px;
  padding: 5px 8px;
  border-radius: 8px;
}
.notification-item-project {
  margin-top: 2px;
  margin-bottom: 2px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .order-management-control { margin-left: 0; flex-wrap: wrap; }
}


/* KBH_STAGE_70_HELP_MANAGEMENT_BACK_SIDEBAR_V1 */
.kbh-manage-back {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 42px;
  padding: 10px 18px !important;
  border: 1px solid #d7aa00 !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffd84a 0%, #f5c400 100%) !important;
  color: #1f2937 !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  box-shadow: 0 8px 20px rgba(244, 196, 0, .18) !important;
  cursor: pointer;
}
.kbh-manage-back:hover {
  filter: brightness(.98);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(244, 196, 0, .24) !important;
}
#ordersManageBackBtn { margin: 0 0 12px 0; }


/* KBH_STAGE_71_UNIFIED_MANAGEMENT_UI_V1 */
/* Jeden wzorzec wizualny dla wszystkich ekranów Zarządzaj. */
.kbh-manage-back {
  min-height: 58px !important;
  min-width: 150px !important;
  padding: 12px 20px !important;
  border-radius: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-size: 16px !important;
  font-weight: 950 !important;
  line-height: 1.15 !important;
  background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%) !important;
  color: #1e3a8a !important;
  border: 2px solid rgba(37, 99, 235, 0.35) !important;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.14) !important;
  text-decoration: none !important;
  cursor: pointer !important;
}
.kbh-manage-back:hover {
  transform: translateY(-2px) !important;
  filter: none !important;
  border-color: rgba(37, 99, 235, 0.55) !important;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.20) !important;
}
.kbh-manage-back:active { transform: translateY(0) !important; }

.kbh-manage-screen-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.kbh-manage-screen-copy {
  min-width: 0;
  padding-top: 3px;
}
.kbh-manage-screen-head h2 {
  margin: 0 0 5px !important;
  font-size: 26px !important;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.kbh-manage-screen-head p {
  margin: 0;
  color: var(--muted, #667085);
  line-height: 1.45;
}
.kbh-manage-surface {
  border-radius: 18px !important;
  border-color: rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06) !important;
}
.kbh-manage-surface > h3:first-child {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 20px;
}

/* Krok 1 jest tylko technicznym hostem dla trzech modułów Zarządzaj.
   W trybie zarządzania nie pokazujemy nagłówka/paska projektu/formularza klienta. */
#step1.kbh-step1-manage-mode > #step1PageTitle,
#step1.kbh-step1-manage-mode > .project-context-box,
#step1.kbh-step1-manage-mode > #step1PrimaryActions {
  display: none !important;
}
#step1.kbh-step1-manage-mode #openPanel {
  margin-top: 0 !important;
}
#step1.kbh-step1-manage-mode #openPanel > .actions {
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
#step1.kbh-step1-manage-mode #openQuoteCancel {
  display: none !important;
}
.kbh-manage-project-summary {
  border-color: rgba(37, 99, 235, 0.14) !important;
  background: rgba(37, 99, 235, 0.035) !important;
}

#orders.kbh-orders-manage-mode > #ordersPageTitle {
  display: none !important;
}
#orders.kbh-orders-manage-mode #ordersListCard {
  margin-top: 0;
}

@media (max-width: 720px) {
  .kbh-manage-screen-head {
    align-items: stretch;
  }
  .kbh-manage-screen-head .kbh-manage-back {
    min-width: 132px !important;
  }
  .kbh-manage-screen-copy {
    flex: 1 1 240px;
  }
}


/* KBH_STAGE_72_ORDER_DETAIL_HISTORY_ATTACHMENTS_SPEC_V1 */
#order.order-view .order-analysis-grid{
  display:grid;
  grid-template-columns:minmax(0,2fr) minmax(280px,1fr);
  gap:14px;
  align-items:start;
}
#order.order-view .order-analysis-main{min-width:0;}
#order.order-view .order-analysis-grid > .order-card,
#order.order-view .order-analysis-main > .order-card{margin-top:14px;}
#order.order-view .kbh-collapsible-card{padding:0;overflow:hidden;}
#order.order-view .kbh-collapsible-summary{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  cursor:pointer;list-style:none;padding:18px 20px;user-select:none;
}
#order.order-view .kbh-collapsible-summary::-webkit-details-marker{display:none;}
#order.order-view .kbh-collapsible-summary h3{margin:0;}
#order.order-view .kbh-collapse-icon{font-size:20px;line-height:1;transition:transform .18s ease;}
#order.order-view details:not([open]) .kbh-collapse-icon{transform:rotate(180deg);}
#order.order-view .order-diff-list,
#order.order-view #orderFullSpecification{padding:0 20px 20px;}
#order.order-view .order-all-attachments{min-width:0;position:sticky;top:12px;}
#order.order-view .kbh-all-attachments-table-wrap{overflow:auto;max-height:70vh;border:1px solid var(--border,rgba(0,0,0,.12));border-radius:10px;}
#order.order-view .kbh-all-attachments-table{width:100%;border-collapse:collapse;font-size:13px;}
#order.order-view .kbh-all-attachments-table th,
#order.order-view .kbh-all-attachments-table td{padding:9px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--border,rgba(0,0,0,.10));}
#order.order-view .kbh-all-attachments-table th{position:sticky;top:0;background:var(--card,#fff);z-index:1;}
#order.order-view .kbh-all-attachments-table td:last-child,
#order.order-view .kbh-all-attachments-table th:last-child{white-space:nowrap;width:1%;}
#order.order-view .kbh-spec-section + .kbh-spec-section{margin-top:18px;}
#order.order-view .kbh-spec-section h4{margin:0 0 8px;}
#order.order-view .kbh-spec-table-wrap{overflow:auto;border:1px solid var(--border,rgba(0,0,0,.10));border-radius:10px;}
#order.order-view .kbh-spec-table{width:100%;border-collapse:collapse;font-size:13px;}
#order.order-view .kbh-spec-table th,#order.order-view .kbh-spec-table td{padding:8px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--border,rgba(0,0,0,.08));}
#order.order-view .kbh-spec-table th{width:38%;font-weight:700;background:rgba(127,127,127,.06);}
@media (max-width: 1050px){
  #order.order-view .order-analysis-grid{grid-template-columns:1fr;}
  #order.order-view .order-all-attachments{position:static;}
}


/* KBH_STAGE_74_WHITE_RAVEN_QUICK_INQUIRY_V1 */
#start .kbh-white-raven-tile {
  border: 2px solid rgba(168, 85, 247, .38);
  background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(250,245,255,.98));
}
#start .kbh-white-raven-tile:hover {
  border-color: rgba(126, 34, 206, .62);
  transform: translateY(-2px);
}
.kbh-white-raven-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 2px solid rgba(126, 34, 206, .30);
  background: linear-gradient(135deg, rgba(250,245,255,.98), rgba(255,255,255,.98));
}
.kbh-white-raven-banner.hidden { display: none !important; }
.kbh-white-raven-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
}
.kbh-white-raven-banner p {
  margin: 0;
  line-height: 1.45;
}
.kbh-white-raven-banner button {
  flex: 0 0 auto;
  max-width: 330px;
}
@media (max-width: 900px) {
  .kbh-white-raven-banner { align-items: stretch; flex-direction: column; }
  .kbh-white-raven-banner button { max-width: none; width: 100%; }
}


/* KBH_STAGE_75_PROJECT_QUOTE_DETAILS_GLOBAL_LIST_V1 */
.lista-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.lista-scope-toggle {
  flex: 0 0 auto;
  min-width: 150px;
}
.lista-scope-toggle.is-global {
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.kbh-stage75-details-cell {
  padding: 0 10px 12px !important;
  background: transparent !important;
}
.kbh-stage75-details-box {
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 12px;
  padding: 12px;
  background: rgba(248, 250, 252, .96);
}
.kbh-stage75-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}
.kbh-stage75-detail-item {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}
.kbh-stage75-detail-item span {
  color: #64748b;
  font-size: .9rem;
}
.kbh-stage75-detail-item b {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
@media (max-width: 900px) {
  .lista-header { align-items: stretch; flex-direction: column; }
  .lista-scope-toggle { width: 100%; }
  .kbh-stage75-details-grid { grid-template-columns: 1fr; }
  .kbh-stage75-detail-item { grid-template-columns: 1fr; gap: 3px; }
}


/* KBH_STAGE_77_SALES_EDIT_VISIBILITY_ACTIONS_V1 */
#order.order-view .order-sales-revision-alert {
  margin: 12px 0 14px;
  padding: 15px 18px;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(251,191,36,.08));
  box-shadow: 0 0 0 4px rgba(245,158,11,.10), 0 12px 30px rgba(0,0,0,.16);
  align-items: center;
  gap: 13px;
}
#order.order-view .order-sales-revision-alert-icon {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f59e0b;
  color: #111827;
  font-weight: 950;
  font-size: 24px;
  line-height: 1;
}
#order.order-view .order-sales-revision-alert-copy { min-width: 0; }
#order.order-view .order-sales-revision-alert-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .1px;
}
#order.order-view .order-sales-revision-alert-text {
  margin-top: 3px;
  line-height: 1.42;
  font-weight: 650;
}
#order.order-view #orderManagementStatusBox {
  width: 100%;
  flex-wrap: wrap;
}
#order.order-view #orderManagementStatusHint {
  flex: 1 1 300px;
}
#order.order-view .order-inquiry-revision-actions {
  margin-left: auto;
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#order.order-view .order-change-inquiry-cta,
#order.order-view .order-send-revision-cta {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 900;
  letter-spacing: .1px;
  cursor: pointer;
}
#order.order-view .order-change-inquiry-cta {
  border: 2px solid #f59e0b;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #111827;
  box-shadow: 0 0 0 3px rgba(245,158,11,.16), 0 8px 18px rgba(245,158,11,.18);
}
#order.order-view .order-change-inquiry-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
#order.order-view .order-send-revision-cta {
  border: 2px solid #2563eb;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.14), 0 8px 18px rgba(37,99,235,.18);
}
#order.order-view .order-send-revision-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
@media (max-width: 900px) {
  #order.order-view .order-inquiry-revision-actions {
    margin-left: 0;
    width: 100%;
  }
  #order.order-view .order-change-inquiry-cta,
  #order.order-view .order-send-revision-cta {
    flex: 1 1 240px;
  }
}


/* KBH_STAGE_78_REVISION_FIELDS_TIMESTAMP_CTA_V1 */
#order.order-view .order-change-inquiry-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 3px solid #dc2626 !important;
  background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%) !important;
  color: #991b1b !important;
  box-shadow: 0 0 0 4px rgba(220,38,38,.13), 0 9px 22px rgba(220,38,38,.18) !important;
}
#order.order-view .order-change-inquiry-cta::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 2px solid #dc2626;
  border-radius: 999px;
  background: #fff;
  color: #dc2626;
  font-size: 17px;
  font-weight: 950;
  line-height: 1;
}
#order.order-view .order-change-inquiry-cta:hover {
  border-color: #b91c1c !important;
  background: linear-gradient(180deg, #ffedd5 0%, #fdba74 100%) !important;
  box-shadow: 0 0 0 5px rgba(220,38,38,.17), 0 11px 24px rgba(220,38,38,.22) !important;
}


/* KBH_STAGE_79_REVISION_CTA_ADJACENT_DIFF_V1 */
/* Stage 79: JS steruje widocznością obu CTA przez inline style. */
#order.order-view .order-change-inquiry-cta {
  display: inline-flex;
}

#order.order-view .order-send-revision-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 3px solid #16a34a !important;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%) !important;
  color: #166534 !important;
  box-shadow: 0 0 0 4px rgba(22,163,74,.12), 0 9px 22px rgba(22,163,74,.16) !important;
}
#order.order-view .order-send-revision-cta::before {
  content: "➤";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 2px solid #16a34a;
  border-radius: 999px;
  background: #fff;
  color: #16a34a;
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
}
#order.order-view .order-send-revision-cta:hover {
  border-color: #15803d !important;
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%) !important;
  box-shadow: 0 0 0 5px rgba(22,163,74,.16), 0 11px 24px rgba(22,163,74,.20) !important;
}

#order.order-view .kbh-version-matrix td.is-adjacent-change {
  background: rgba(248, 113, 113, .20);
}
body[data-theme="light_premium"] #order.order-view .kbh-version-matrix td.is-adjacent-change {
  background: #fee2e2;
}


/* KBH_STAGE_81_CANCEL_REVISION_LAST_BODYWORK_V1 */
#order.order-view .order-send-revision-cta,
#order.order-view .order-cancel-revision-cta,
#order.order-view .order-change-inquiry-cta {
  gap: 12px;
}
#order.order-view .order-send-revision-cta::before,
#order.order-view .order-cancel-revision-cta::before,
#order.order-view .order-change-inquiry-cta::before {
  margin-right: 2px;
}
#order.order-view .order-cancel-revision-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  gap: 12px;
  border: 3px solid #dc2626 !important;
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%) !important;
  color: #991b1b !important;
  box-shadow: 0 0 0 4px rgba(220,38,38,.11), 0 9px 22px rgba(220,38,38,.15) !important;
  font-weight: 900;
  letter-spacing: .1px;
  cursor: pointer;
}
#order.order-view .order-cancel-revision-cta::before {
  content: "×";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin-right: 2px;
  border: 2px solid #dc2626;
  border-radius: 999px;
  background: #fff;
  color: #dc2626;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
}
#order.order-view .order-cancel-revision-cta:hover {
  border-color: #b91c1c !important;
  background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%) !important;
  box-shadow: 0 0 0 5px rgba(220,38,38,.15), 0 11px 24px rgba(220,38,38,.19) !important;
}
@media (max-width: 900px) {
  #order.order-view .order-cancel-revision-cta {
    flex: 1 1 240px;
  }
}


/* KBH_STAGE_83_VERSION_MATRIX_LATEST_STICKY_STATUS_WIDTH_V1 */
#order.order-view .kbh-version-matrix th:first-child,
#order.order-view .kbh-version-matrix td:first-child {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  left: 0;
  background: var(--card, #fff);
}
#order.order-view .kbh-version-matrix thead th:first-child {
  z-index: 12;
  box-shadow: 3px 0 0 rgba(127,127,127,.12);
}
#order.order-view .kbh-version-matrix thead th:not(:first-child) {
  z-index: 2;
}
#order.order-view .kbh-version-matrix tbody td:first-child {
  z-index: 5;
  box-shadow: 2px 0 0 rgba(127,127,127,.08);
}
#order.order-view .kbh-version-matrix .kbh-version-group .kbh-version-group-label {
  z-index: 7;
  white-space: normal;
  overflow-wrap: anywhere;
}
#order.order-view .kbh-version-matrix .kbh-version-group .kbh-version-group-fill {
  position: static;
}
#order.order-view #orderManagementStatusBox > label {
  flex: 0 0 100%;
  margin-bottom: 0;
}
#order.order-view #orderManagementStatusSelect {
  width: 260px !important;
  max-width: 260px;
  min-width: 180px;
  flex: 0 0 260px;
}
#order.order-view #orderManagementStatusHint {
  flex: 1 1 260px;
}
@media (max-width: 900px) {
  #order.order-view #orderManagementStatusSelect {
    width: 100% !important;
    max-width: none;
    flex: 1 1 220px;
  }
}


/* KBH_STAGE_84_MATRIX_HEADER_CLIP_TECH_FIELDS_V1 */
#order.order-view .kbh-version-matrix-wrap {
  position: relative;
  isolation: isolate;
}
#order.order-view .kbh-version-matrix {
  border-collapse: separate !important;
  border-spacing: 0;
}
#order.order-view .kbh-version-matrix thead th:not(:first-child) {
  z-index: 1 !important;
}
#order.order-view .kbh-version-matrix thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 30 !important;
  background: var(--card, #fff) !important;
  background-clip: padding-box;
  overflow: hidden;
}
#order.order-view .kbh-version-matrix tbody td:first-child,
#order.order-view .kbh-version-matrix .kbh-version-group .kbh-version-group-label {
  z-index: 20 !important;
  background: var(--card, #fff) !important;
  background-clip: padding-box;
}
#order.order-view .kbh-version-matrix .kbh-version-group .kbh-version-group-label {
  background: var(--card, #fff) !important;
}


/* Stage 84: nagłówki przewijanych wersji są przycinane do własnych komórek. */
#order.order-view .kbh-version-matrix thead th:not(:first-child) {
  overflow: hidden !important;
  clip-path: inset(0);
  background: var(--card, #fff) !important;
  background-clip: padding-box;
}
#order.order-view .kbh-version-matrix thead th:first-child {
  z-index: 50 !important;
  isolation: isolate;
}

/* Stage 84: pływający poziomy scrollbar macierzy wersji. */
.kbh-version-floating-scroll {
  position: fixed;
  bottom: 10px;
  height: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  display: none;
  z-index: 10000;
  box-sizing: border-box;
  border: 1px solid var(--border, rgba(0,0,0,.18));
  border-radius: 9px;
  background: var(--card, #fff);
  box-shadow: 0 5px 18px rgba(0,0,0,.18);
  scrollbar-gutter: stable;
}
.kbh-version-floating-scroll.is-visible {
  display: block;
}
.kbh-version-floating-scroll-spacer {
  height: 1px;
  min-width: 100%;
}
