:root{--bg:#0f172a;--surface:#111827;--muted:#374151;--text:#e5e7eb;--accent:#22c55e;--warn:#f59e0b;--danger:#ef4444;}
*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,'Helvetica Neue',Arial;background:#0b1220;color:var(--text)}
a{color:#93c5fd;text-decoration:none}.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:linear-gradient(90deg,#111827,#0b1220);border-bottom:1px solid #1f2937}
.brand a{font-weight:700;color:#fff}nav a{margin:0 8px;padding:6px 10px;border-radius:8px;background:#111827;border:1px solid #1f2937}
.container{max-width:1150px;margin:20px auto;padding:0 16px}.card{background:#0f172a;border:1px solid #1f2937;border-radius:16px;padding:16px;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.grid{display:grid;gap:16px}.grid.cols-2{grid-template-columns:repeat(2,1fr)}.grid.cols-3{grid-template-columns:repeat(3,1fr)}
.btn{display:inline-block;padding:8px 12px;border-radius:10px;border:1px solid #1f2937;background:#111827;color:#e5e7eb}.btn.primary{background:var(--accent);border-color:transparent;color:#041d0f;font-weight:700}.btn.danger{background:#b91c1c;border-color:#7f1d1d}
.input,select,textarea{width:100%;padding:10px;border-radius:10px;border:1px solid #1f2937;background:#0b1220;color:#e5e7eb}
label{display:block;font-size:14px;color:#cbd5e1;margin-bottom:6px}table{width:100%;border-collapse:collapse;background:#0f172a;border-radius:12px;overflow:hidden}
th,td{padding:10px 12px;border-bottom:1px solid #1f2937}th{background:#0b1220;text-align:left}tr:hover{background:#101826}
.pill{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px}.pill.ok{background:#064e3b;color:#d1fae5}.pill.warn{background:#7c2d12;color:#ffedd5}.pill.danger{background:#7f1d1d;color:#fee2e2}
.flash{background:#065f46;color:#d1fae5;border:1px solid #064e3b;padding:10px 12px;border-radius:10px;margin-bottom:12px}.footer{padding:24px;text-align:center;color:#94a3b8}
.program-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:8px 16px;
}

.program-item {
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#f9fafb;
  padding:6px 10px;
  border-radius:10px;
  box-shadow:0 1px 2px rgba(0,0,0,0.05);
}

.program-name {
  font-size:0.9rem;
  color:#374151;
  font-weight:500;
}

.status-badge {
  font-size:0.8rem;
  padding:2px 8px;
  border-radius:9999px;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  gap:4px;
}

.status-badge.yes {
  background:#dcfce7;
  color:#166534;
}

.status-badge.no {
  background:#fee2e2;
  color:#991b1b;
}
.status-badge {
  display:inline-block;
  padding:2px 8px;
  border-radius:12px;
  font-size:0.8rem;
  font-weight:600;
  color:#fff;
}

.status-badge.in-use {
  background:#16a34a; /* zielony */
}
.status-badge.in-stock {
  background:#2563eb; /* niebieski */
}
.status-badge.service {
  background:#f59e0b; /* pomarańczowy */
}
.status-badge.retired {
  background:#6b7280; /* szary */
}
table td {
  word-break: break-word;
  white-space: normal;
}

td.sprzet-col {
  max-width: 200px;   /* dostosuj do układu */
}

td.sprzet-pozostalo  {
  max-width: 120px;   /* dostosuj do układu */
}
  
/* filters & actions */
.filters { margin:12px 0 16px 0; display:flex; gap:8px; flex-wrap:wrap; align-items:flex-end; }
.filters .actions { display:flex; gap:8px; flex-wrap:nowrap; }
/* nie łam przycisków w kolumnie Akcje */
td.table-actions { white-space:nowrap; }
/* zawijanie treści w komórkach, by nic nie „rozpychało” */
th, td { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }

/* --- Szeroki layout dla list (globalnie) --- */
.container {
  max-width: 1900px;   /* było np. 980/1200 – zwiększamy */
}

/* Na bardzo szerokich ekranach można jeszcze trochę */
@media (min-width: 2300px) {
  .container { max-width: 2300px; }
}

/* Tabela zawsze na pełną szerokość karty */
.card > table {
  width: 100%;
  table-layout: auto;  /* pozwala kolumnom naturalnie się rozszerzać */
}

/* Zapewnia przewijanie w poziomie tylko gdy naprawdę potrzeba */
.table-scroll {
  overflow-x: auto;
}

/* Kolumny tabeli mogą się zawijać (zostawiamy wygląd jak wcześniej) */
table th, table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Pasek narzędzi filtrów i przyciski w jednej linii – bez zmian */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filters .actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

/* Przyciski paginacji – zawsze w jednej linii */
.pagination .btn { white-space: nowrap; }


/* DASHBOARD */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .dash-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi { background: #0b1220; border:1px solid #1f2937; border-radius: 12px; padding:14px; }
.kpi-label { color:#94a3b8; font-size:12px; margin-bottom:6px; }
.kpi-value { font-size:28px; font-weight:700; }
.kpi-value.warn { color:#f59e0b; }
.kpi-value.danger { color:#ef4444; }

.dash-cols {
  display: grid; gap: 12px; margin-top: 12px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 1000px) { .dash-cols { grid-template-columns: 1fr; } }

.bar-row { display:flex; align-items:center; gap:10px; margin:8px 0; }
.bar-label { flex: 0 0 220px; color:#e5e7eb; font-size:14px; }
.bar { flex:1; height:10px; background:#111827; border-radius:999px; overflow:hidden; }
.bar-fill { display:block; height:100%; background:#3b82f6; }
.bar-fill.in-use { background:#10b981; }
.bar-fill.in-stock { background:#60a5fa; }
.bar-fill.service { background:#f59e0b; }
.bar-fill.retired { background:#6b7280; }

.bars-vertical { display:flex; align-items:flex-end; gap:10px; height:160px; }
.vbar { display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:6px; width:34px; }
.vbar-fill { width:100%; background:#3b82f6; border-radius:6px 6px 0 0; }
.vbar-label { font-size:12px; color:#94a3b8; text-align:center; white-space:nowrap; transform: translateY(4px); }

/* pigułki (reuse) */
.pill { display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; }
.pill.ok { background:#0f766e; color:#ecfeff; }
.pill.warn { background:#92400e; color:#fffbeb; }
.pill.danger { background:#7f1d1d; color:#fee2e2; }

/* kolumna sprzet — zawijanie */
.sprzet-col { white-space: normal; word-break: break-word; }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.role-badge.admin {
  background: #b91c1c; /* czerwony */
}

.role-badge.user {
  background: #2563eb; /* niebieski */
}


.tag-chip {
  display:inline-flex; align-items:center; gap:6px;
  padding:2px 8px; border-radius:999px;
  font-size:12px; font-weight:600; color:#fff;
  line-height:1.6; white-space:nowrap;
}
.tag-chip .dot {
  width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,.85);
}
.tag-list { display:flex; gap:6px; flex-wrap:wrap; }

.tag-chip.is-filter { outline:2px solid rgba(0,0,0,.08); background:#111; }


/* podpowiedzi */
.suggest-box{position:absolute;z-index:50;background:#0b1220;color:#e5e7eb;border:1px solid #1f2937;border-radius:10px;padding:6px;margin-top:2px;max-height:220px;overflow:auto;min-width:260px;box-shadow:0 8px 20px rgba(0,0,0,.25)}
.suggest-item{padding:6px 8px;border-radius:8px;cursor:pointer;display:flex;align-items:center;gap:8px}
.suggest-item:hover{background:#111827}
.tag-dot{display:inline-block;width:10px;height:10px;border-radius:50%;flex:0 0 auto}

/* chipsy tagów */
.chip-wrap{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.tag-chip{display:inline-flex;align-items:center;gap:6px;color:#fff;padding:6px 10px;border-radius:999px;font-size:12px;line-height:1;margin-bottom:10px}
.tag-chip button{background:transparent;border:0;color:inherit;cursor:pointer;font-size:14px;line-height:1;padding:0 0 0 2px}

.att-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px;margin-top:10px}
.att-card{border:1px solid #1f2937;border-radius:12px;background:#0b1220;padding:10px;display:flex;flex-direction:column;gap:8px}
.att-head{display:flex;align-items:center;gap:10px}
.att-icon{font-size:22px;line-height:1.1}
.att-title{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.att-body{font-size:13px;color:#e5e7eb}
.att-note{margin-bottom:6px;word-break:break-word}
.att-meta{display:flex;gap:6px;color:#a1a1aa}
.att-actions{display:flex;gap:8px;margin-top:6px}
.dropwrap label{display:block;margin-bottom:6px}
.dropzone{border:1px dashed #334155;border-radius:10px;padding:12px;background:#0b1220;color:#94a3b8;cursor:pointer;text-align:center}
.dropzone:focus{outline:2px solid #334155}
.dropzone.dragover{background:#0f172a;border-color:#64748b;color:#e5e7eb}



table, tbody, tr, td { overflow: visible; } /* ważne w tabelach */

.asset-chooser { position: relative; display:flex; flex-direction:column; gap:6px }
.asset-results{
  position:absolute; top:calc(100% + 4px); left:0; right:0;
  background:#0b1220; border:1px solid #1f2937; border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.45);
  max-height:280px; overflow-y:auto; overscroll-behavior:contain;
  display:none; z-index:999;
}
.asset-result{ padding:8px 10px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; cursor:pointer; }
.asset-result:hover,.asset-result.active{ background:#111827; }
.asset-result.empty{ color:#94a3b8; cursor:default; }


.extra-wrap { display:flex; gap:6px; align-items:center }
.extra-wrap .extra-select { min-width: 280px; }



/* =========================
   HOVERY & ANIMACJE — MINIMAL, BEZ PODNOSZENIA/SLIDE I PODKREŚLEŃ
   ========================= */

/* Płynne przejścia tylko na kolory/cienie (bez transformów) */
a, .btn, nav a, .card, .program-item, .suggest-item, .att-card, .dropzone,
table tr, .tag-chip, .asset-result, .input, select, textarea {
  transition: background-color .22s ease, border-color .22s ease,
              color .22s ease, box-shadow .22s ease, opacity .18s ease;
}

/* Szacunek dla prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- Linki (bez podkreśleń) --- */
a { color:#93c5fd; text-decoration:none; }
a:hover { color:#c7d2fe; }

/* --- Nawigacja --- */
nav a { background:#111827; border:1px solid #1f2937; color:#e5e7eb; }
nav a:hover {
  background:#1c2536;
  border-color:#2f3a4e;
  box-shadow:0 0 12px rgba(36, 42, 58, .45) inset, 0 0 10px rgba(0,0,0,.25);
  color:#fff;
}

/* --- Karty --- */
.card:hover {
  background:#0e1525; /* subtelnie ciemniej */
  border-color:#2a3345;
  box-shadow:0 0 18px rgba(0,0,0,.42);
}

/* --- Wiersze tabeli --- */
table tr:hover { background:#101826; }
table th { position:sticky; top:0; z-index:1; } /* UX: header zawsze widoczny */

/* --- Przyciski --- */
.btn:hover { background:#1c2536; border-color:#2f3a4e; }
.btn.primary { background: var(--accent); color:#041d0f; }
.btn.primary:hover { background:#1ea14a; } /* lekkie przyciemnienie, bez neonów/obrysów */
.btn.danger:hover  { background:#c53030; }

/* --- Focus (klawiatura) — neutralny ring, bez przesuwu --- */
:focus-visible {
  outline:2px solid #3b82f6; /* chłodny niebieski, neutralny */
  outline-offset:2px; border-radius:8px;
}

/* --- Pola formularzy --- */
.input:hover, select:hover, textarea:hover { border-color:#334155; background:#0f172a; }
.input:focus, select:focus, textarea:focus {
  border-color:#3b82f6;
  box-shadow:0 0 0 3px rgba(59,130,246,.15);
  outline: none;
}

/* --- Dropzone --- */
.dropzone.dragover {
  border-color:#475569;
  background:#111827;
  color:#e5e7eb;
  box-shadow:0 0 14px rgba(27,38,54,.35) inset;
}

/* --- Status Badges (bez pulsów, tylko rozjaśnienie) --- */
.status-badge { transition: filter .22s ease, background-color .22s ease; }
.status-badge:hover { filter:brightness(1.12); }

/* --- Tag chips --- */
.tag-chip:hover {
  background:#1c2536;
  box-shadow:0 0 0 1px rgba(255,255,255,.08) inset;
}

/* --- Flash (powiadomienia) --- */
.flash:hover { filter:brightness(1.06); }

/* --- Program items (jasne tło listy) --- */
.program-item:hover { background:#eef2f7; } /* delikatnie ciemniej vs #f9fafb */

/* --- Karty załączników --- */
.att-card:hover { background:#111827; border-color:#2a3345; }

/* --- Badges ról --- */
.role-badge:hover { filter:brightness(1.1); }

/* --- Brand w topbarze (bez podkreśleń/animacji) --- */
.brand a:hover { color:#c7d2fe; }

/* =========================
   ANIMACJA WYPEŁNIANIA PASKÓW (DASHBOARD)
   ========================= */

/* Domyślnie ukryj szerokość, żeby animacja startowała od zera */
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transform-origin: left center;
  transform: scaleX(0);
  animation: barGrow .9s ease-out forwards;
}

/* Subtelny „shine” po napełnieniu */
@keyframes barGrow {
  from { transform: scaleX(0); opacity: .6; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* Dodatkowe wypełnienie kolorem, które już masz */
.bar-fill.in-use    { background: #10b981; animation-delay: .1s; }
.bar-fill.in-stock  { background: #60a5fa; animation-delay: .2s; }
.bar-fill.service   { background: #f59e0b; animation-delay: .3s; }
.bar-fill.retired   { background: #6b7280; animation-delay: .4s; }

/* Neutralne bary (np. Top 5 dostawców) */
.bar-fill:not(.in-use):not(.in-stock):not(.service):not(.retired) {
  background: #3b82f6;
  animation-delay: .1s;
}

/* Możesz dodać subtelny efekt „shine” przy hoverze */
.bar:hover .bar-fill {
  filter: brightness(1.08);
  transition: filter .2s ease;
}


/* =============== LOADER / SPINNER =============== */
#page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11,18,32,0.7);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
#page-loader.active {
  opacity: 1;
  pointer-events: all;
}

/* --- DODANE: wrapper wewnątrz loadera --- */
#page-loader > div {
  display: flex;
  flex-direction: column;     /* pionowo: spinner nad napisem */
  align-items: center;
  justify-content: center;
  gap: 10px;                  /* odstęp między spinnerem i tekstem */
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
  color: #94a3b8;
  font-size: 14px;
  letter-spacing: .3px;
}




/* --- MODAL: płynne wejście/wyjście (bez blokującego !important na opacity/transform) --- */

/* kontener — zawsze flex (żeby wyjście mogło się animować) */
.modal{
  position:fixed; inset:0;
  display:flex !important;
  align-items:center; justify-content:center;
  background: rgba(11,18,32,.55);
  backdrop-filter: blur(3px);
  z-index: 3000;

  /* stan bazowy: niewidoczny i nieklikalny (UWAGA: bez !important) */
  opacity: 0;
  pointer-events: none;
}

/* wejście */
.modal.open{
  pointer-events: auto !important;
  animation: modalFadeIn .28s cubic-bezier(.25,.6,.2,1) forwards;
}

/* wyjście — ważne: dalej display:flex, tylko animujemy do zera */
.modal.closing{
  pointer-events: none !important;
  animation: modalFadeOut .22s cubic-bezier(.25,.6,.2,1) forwards;
}

/* okno */
.modal-card{
  width: 50% !important;          /* Twoja szerokość zostaje */
  max-height: 85vh;
  opacity: 0;                      /* BEZ !important */
  transform: scale(.97) translateY(10px);  /* BEZ !important */
  will-change: opacity, transform;
  /* reszta Twojego stylu (kolory, border, radius, cień) może zostać powyżej w CSS */
}

/* animacje okna */
.modal.open .modal-card{
  animation: modalIn .28s cubic-bezier(.25,.6,.2,1) forwards;
}
.modal.closing .modal-card{
  animation: modalOut .22s cubic-bezier(.25,.6,.2,1) forwards;
}

/* klatki */
@keyframes modalFadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes modalFadeOut { from { opacity:1 } to { opacity:0 } }
@keyframes modalIn  { from { opacity:0; transform:scale(.97) translateY(10px) }
                      to   { opacity:1; transform:scale(1)    translateY(0) } }
@keyframes modalOut { from { opacity:1; transform:scale(1)    translateY(0) }
                      to   { opacity:0; transform:scale(.97) translateY(10px) } }

/* prefer-reduced-motion */
@media (prefers-reduced-motion: reduce){
  .modal, .modal-card { animation:none !important; transform:none !important; opacity:1 !important; }
}


/* === Color Picker – izolacja od globalnych hover/transition === */
.cp, .cp * { transition: none !important; filter: none !important; }

.cp { display: grid; gap: 8px; }
.cp__top { display: flex; align-items: center; gap: 8px; }

.cp__preview {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid #334155; background: #6b7280;
}

.cp__sv, .cp__h { position: relative; isolation: isolate; }
.cp__sv canvas, .cp__h canvas { display: block; width: 100% !important; height: 100% !important; }

.cp__sv { width: 260px; height: 160px; background: #0b1220; border: 1px solid #1f2937; border-radius: 8px; }
.cp__h  { width: 260px; height: 12px;  background: #0b1220; border: 1px solid #1f2937; border-radius: 999px; }

.cp__knob {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5);
  pointer-events: none; transform: translate(-50%, -50%);
}
.cp__knob--h { top: 50%; }                  /* pionowo centrowany suwak H */

/* --- Aktywna pozycja menu --- */
nav a.active {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(0,0,0,.45) inset;
  font-weight: 600;
}


nav a {
  transition: background-color .22s ease, color .22s ease, box-shadow .22s ease;
}


/* NAV: równe odstępy, zero „dziury” po prawej */
header.topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;                  /* zamiast marginów i spacji w HTML */
}

header.topbar nav a {
  margin: 0;                 /* wyłącz własne marginesy */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;         /* symetryczny padding L/R */
  line-height: 1;            /* bez dodatkowej wysokości linii */
  white-space: nowrap;
}

/* Aktywny link — bez szerokiego cienia, delikatny obrys */
header.topbar nav a.active {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06) !important; /* zamiast „glowa” */
  color: #fff !important;
  font-weight: 600;
}

/* Hover na aktywnym — minimalna zmiana, bez „wypychania” tła */
header.topbar nav a.active:hover {
  background: #223047 !important;
  border-color: #3a475f !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08) !important;
}
