/* ==========================================================================
   Panel Transportowy — arkusz stylów
   Motyw: "dyspozytornia" — ciemny, spokojny pasek boczny z akcentem
   bursztynowym (barwa świateł ostrzegawczych/drogowych), jasna, czytelna
   przestrzeń robocza z danymi. Fonty utylitarne dla liczb/tabel.
   ========================================================================== */

:root {
  --granat-900: #0f172a;
  --granat-800: #1a2436;
  --granat-700: #26344a;
  --szary-100: #f4f6f8;
  --szary-200: #e7ebef;
  --szary-400: #94a3b8;
  --szary-600: #526071;
  --tekst-glowny: #1a2436;
  --bursztyn: #e8912d;
  --bursztyn-ciemny: #c9761a;
  --zielen: #1f9d6b;
  --czerwien: #d64545;
  --bialy: #ffffff;

  --font-tekst: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-dane: 'IBM Plex Mono', 'Courier New', monospace;

  --promien: 8px;
  --cien: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-tekst);
  background: var(--szary-100);
  color: var(--tekst-glowny);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--bursztyn-ciemny); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Layout główny ---------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 120px;
  flex-shrink: 0;
  background: var(--granat-900);
  color: var(--szary-200);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 16px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  border-bottom: 1px solid var(--granat-700);
  margin-bottom: 8px;
}

.brand-mark {
  color: var(--bursztyn);
  font-size: 20px;
  transform: rotate(0deg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 6px 8px;
}

/* Sygnatura wizualna: przerywana "linia trasy" łącząca punkty nawigacji,
   jak trasa na mapie spedytora. */
.sidebar-nav::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background-image: linear-gradient(var(--granat-700) 60%, transparent 0%);
  background-size: 1px 8px;
  background-repeat: repeat-y;
  z-index: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: var(--promien);
  color: var(--szary-400);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

.nav-item:hover {
  background: var(--granat-800);
  color: var(--szary-200);
  text-decoration: none;
}

.nav-item.active {
  background: var(--granat-700);
  color: var(--bialy);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--szary-600);
  flex-shrink: 0;
}

.nav-item.active .nav-dot,
.nav-item:hover .nav-dot {
  background: var(--bursztyn);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 0;
  border-top: 1px solid var(--granat-700);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bursztyn);
  color: var(--granat-900);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name { font-size: 11.5px; font-weight: 600; color: var(--bialy); word-break: break-word; }
.logout-link { font-size: 11px; color: var(--szary-400); }

.content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1280px;
}

/* ---------------- Elementy wspólne ---------------- */

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.page-heading h1 { font-size: 22px; margin: 0; }

.page-subtitle {
  color: var(--szary-600);
  max-width: 720px;
  margin: 0 0 24px;
  font-size: 14px;
}

.card {
  background: var(--bialy);
  border-radius: var(--promien);
  box-shadow: var(--cien);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.card h3 { margin-top: 0; font-size: 15px; }

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.span-2 { grid-column: span 2; }

.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
}
.detail-list dt { color: var(--szary-600); font-size: 13px; }
.detail-list dd { margin: 0; font-family: var(--font-dane); font-size: 14px; }

.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { padding: 8px 0; border-bottom: 1px solid var(--szary-200); font-size: 14px; }
.contact-list li:last-child { border-bottom: none; }

/* ---------------- Tabele danych ---------------- */

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--szary-600);
  padding: 8px 12px;
  border-bottom: 2px solid var(--szary-200);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--szary-200);
  font-family: var(--font-dane);
}
.data-table tbody tr:hover { background: var(--szary-100); }
.data-table-compact td, .data-table-compact th { padding: 6px 10px; font-size: 13px; }
.th-sort { color: inherit; text-decoration: none; }
.th-sort:hover { color: var(--pomaranczowy-600, #c2660a); text-decoration: underline; }

.empty-state { color: var(--szary-400); font-family: var(--font-tekst); font-style: italic; }
.text-warning { color: var(--czerwien); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--szary-200);
  font-size: 12px;
  font-family: var(--font-tekst);
}

.link-details { font-weight: 600; white-space: nowrap; }

/* ---------------- Kalendarz ---------------- */

.calendar-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--szary-600);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-fracht { background: #2563eb; }
.dot-urodziny { background: #c084fc; }
.dot-urlop { background: #f59e0b; }
.dot-magazyn { background: #059669; }
.dot-serwis { background: #dc2626; }
.dot-wlasne { background: #6b7280; }

#kalendarz {
  background: var(--bialy);
  border-radius: var(--promien);
  box-shadow: var(--cien);
  padding: 16px;
}

/* ---------------- Formularze ---------------- */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--szary-600);
  margin: 12px 0 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--szary-200);
  border-radius: var(--promien);
  font-family: var(--font-tekst);
  font-size: 14px;
  background: var(--bialy);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bursztyn);
  box-shadow: 0 0 0 3px rgba(232, 145, 45, 0.18);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--promien);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-tekst);
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--bursztyn); color: var(--granat-900); }
.btn-primary:hover { background: var(--bursztyn-ciemny); }

.btn-secondary { background: var(--bialy); color: var(--tekst-glowny); border-color: var(--szary-200); }
.btn-secondary:hover { background: var(--szary-100); }

.btn-block { width: 100%; justify-content: center; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------- Modale ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--bialy);
  border-radius: var(--promien);
  padding: 28px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.modal-box-wide { max-width: 640px; }
.modal-box h2 { margin-top: 0; font-size: 18px; }

/* ---------------- Komunikaty flash ---------------- */

.flash {
  padding: 12px 16px;
  border-radius: var(--promien);
  margin-bottom: 20px;
  font-size: 14px;
}
.flash-success { background: #e5f8ef; color: #0f6b45; }
.flash-error   { background: #fdecec; color: #9c2626; }
.flash-info    { background: #eef4fb; color: #205a9c; }

/* ---------------- Strona logowania ---------------- */

.login-body {
  background: var(--granat-900);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-tekst);
}

.login-card {
  background: var(--bialy);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 24px;
  color: var(--granat-900);
}
.login-brand .brand-mark { color: var(--bursztyn); font-size: 22px; }

/* ---------------- Responsywność ---------------- */

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-nav::before { display: none; }
  .content { padding: 20px; }
  .detail-grid, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}

/* Widoczny fokus klawiatury - dostępność */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--bursztyn);
  outline-offset: 2px;
}

/* ---------------- Planowanie dnia (przeciąganie zleceń na kierowców) ---------------- */

.planowanie-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
.planowanie-kolumna { display: flex; flex-direction: column; gap: 14px; }
.kierowca-strefa h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.licznik {
  margin-left: auto;
  background: var(--szary-200);
  color: var(--szary-700, #444);
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 9px;
  font-weight: 600;
}
.badge-urlop {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.planowanie-lista {
  min-height: 70px;
  border: 2px dashed transparent;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.12s, border-color 0.12s;
}
.planowanie-lista.strefa-nad {
  border-color: var(--bursztyn);
  background: #fff7ed;
}
.zlecenie-karta {
  background: #fff;
  border: 1px solid var(--szary-200);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.zlecenie-karta span { color: var(--szary-600); font-size: 12px; }
.zlecenie-karta.jest-ciagniona { opacity: 0.4; }
.planowanie-placeholder { font-size: 13px; margin: 4px 0; }

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

/* ---------------- Frachtbrief: status rachunku (klikalna plakietka) ---------------- */

.rachunek-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.rachunek-badge:hover { filter: brightness(0.95); }
.rachunek-niewystawiony { background: #fee2e2; color: #991b1b; }
.rachunek-wystawiony    { background: #fef3c7; color: #92400e; }
.rachunek-zaplacony     { background: #dcfce7; color: #166534; }

/* ---------------- Kalendarz: strzałki prev/next bez czcionki ikon ---------------- */
/* FullCalendar domyślnie rysuje te strzałki własną czcionką ikon wczytywaną
   z CDN — jeśli z jakiegoś powodu się nie załaduje (CSP, cache, blokada sieci
   na hostingu), widać "rozjechane" kwadraciki z kodem znaku zamiast strzałki.
   Prostsze i pewniejsze rozwiązanie: nie polegać na żadnej czcionce z zewnątrz
   - podmieniamy ikony na zwykłe znaki tekstowe, które są wszędzie. */
.fc .fc-icon { font-family: inherit !important; }
.fc .fc-prev-button,
.fc .fc-next-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
.fc .fc-prev-button .fc-icon,
.fc .fc-next-button .fc-icon {
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
}
.fc .fc-prev-button .fc-icon::before,
.fc .fc-next-button .fc-icon::before {
  font-size: 22px;
  line-height: 1;
  display: block;
  transform: translateY(-2px); /* znaki ‹ › optycznie siedzą trochę za nisko */
}
.fc .fc-prev-button .fc-icon::before { content: "‹"; }
.fc .fc-next-button .fc-icon::before { content: "›"; }
