/* ==========================================================================
   ERP SYS - MODERN ENTERPRISE SAAS DESIGN SYSTEM (2026 EDITION)
   Mobile-First, Ultra-Responsive, Clean, Fast & Touch-Optimized
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --success: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-hover: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  --dark-bg: #090d16;
  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-hover: #1e293b;

  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: #f1f5f9;
  color: var(--gray-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

/* ==========================================================================
   APP SHELL & LAYOUT (Desktop & Mobile)
   ========================================================================== */

.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Desktop Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  font-size: 20px;
  font-weight: 800;
  padding: 22px 24px;
  background: var(--dark-bg);
  color: #34d399;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.02em;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--gray-400);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.sidebar-user {
  padding: 18px 24px;
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 13px;
  color: var(--gray-400);
  line-height: 1.5;
  background: rgba(30, 41, 59, 0.4);
}

.sidebar-user b {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  display: inline-block;
  margin-top: 2px;
}

.sidebar-user small {
  display: inline-block;
  background: #334155;
  color: #94a3b8;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 10px;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: #cbd5e1;
  font-weight: 500;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  border-left-color: var(--primary);
  padding-left: 28px;
}

.sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--sidebar-border);
  background: var(--dark-bg);
}

.sidebar-overlay {
  display: none;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f1f5f9;
  position: relative;
}

/* Top Header */
.top-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px 32px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.03);
}

.header-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  background: #f8fafc;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.mobile-menu-btn:active {
  background: var(--gray-200);
  transform: scale(0.96);
}

.top-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.top-actions-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.content-wrapper {
  padding: 24px 32px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ==========================================================================
   CARDS & CONTAINERS
   ========================================================================== */

.card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 22px;
  margin-bottom: 22px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  transition: box-shadow 0.2s ease;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
  letter-spacing: -0.01em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr; } }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* ==========================================================================
   FORMS & INPUTS (Touch-friendly 44px)
   ========================================================================== */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--gray-900);
  background-color: #ffffff;
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
  color: var(--gray-400);
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-row > div {
  flex: 1;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #ffffff; }
.btn-success:hover { background: var(--success-hover); }

.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-warning { background: var(--warning); color: #ffffff; }
.btn-warning:hover { background: var(--warning-hover); }

.btn-secondary { background: var(--gray-600); color: #ffffff; }
.btn-secondary:hover { background: var(--gray-700); }

.w-100 {
  width: 100%;
}

/* ==========================================================================
   TABLES (Clean, Modern, Scrollable)
   ========================================================================== */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.table th {
  background: var(--gray-50);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 12px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 14px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
  color: var(--gray-800);
}

.table tr:hover td {
  background-color: #f8fafc;
}

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */

.badge {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.02em;
  line-height: 1.4;
  border: 1px solid transparent;
}

.bg-yellow { background: var(--warning-light); color: #b45309; border-color: var(--warning-border); }
.bg-blue   { background: var(--primary-light); color: #1d4ed8; border-color: var(--primary-border); }
.bg-green  { background: var(--success-light); color: #15803d; border-color: var(--success-border); }
.bg-red    { background: var(--danger-light); color: #b91c1c; border-color: var(--danger-border); }
.bg-gray   { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.bg-primary{ background: var(--primary); color: #ffffff; }
.bg-warning{ background: var(--warning); color: #ffffff; }

/* Alerts */
.alert-success {
  padding: 14px 18px;
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: #166534;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

.alert-danger {
  padding: 14px 18px;
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: #991b1b;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

/* ==========================================================================
   ACCORDIONS & MODALS
   ========================================================================== */

.accordion-header {
  background: #ffffff;
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  gap: 10px;
}

.accordion-header:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.accordion-content {
  display: none;
  padding: 20px;
  border: 1px solid var(--gray-200);
  border-top: none;
  background: #f8fafc;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-top: -6px;
  margin-bottom: 16px;
  overflow-x: auto;
}

/* Modal Popup */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  background: #ffffff;
  padding: 28px;
  border-radius: var(--radius-lg);
  width: 100% !important;
  max-width: 760px !important;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  position: relative;
}

#map {
  width: 100%;
  height: 480px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark-bg);
  padding: 16px;
}

.login-screen .card {
  width: 100% !important;
  max-width: 420px !important;
  margin: 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 1024px) {
  /* Mobile Sidebar Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    height: 100vh;
    z-index: 1050;
    transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.35);
  }

  body.sidebar-open .sidebar {
    left: 0;
  }

  .sidebar-close-btn {
    display: inline-block;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  /* Mobile Top Navigation */
  .top-header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .mobile-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .top-header h2 {
    font-size: 18px;
  }

  .top-actions-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 8px;
  }

  .top-actions-wrapper .btn {
    flex-shrink: 0;
    font-size: 12px;
    padding: 8px 12px;
    min-height: 38px;
  }

  .content-wrapper {
    padding: 14px 12px;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .form-row {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .form-row > div {
    width: 100% !important;
  }

  .form-control {
    font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
  }

  .card {
    padding: 16px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
  }

  .accordion-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
  }

  .accordion-header > div:last-child {
    align-self: flex-end;
  }

  /* Mobile bottom sheet for modals */
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    border-radius: 20px 20px 0 0 !important;
    max-height: 92vh;
    padding: 22px 18px;
  }

  #map {
    height: 360px;
  }
}

@media (max-width: 480px) {
  .top-header h2 {
    font-size: 16px;
  }
  
  .table th, .table td {
    padding: 10px 8px;
    font-size: 13px;
  }
  
  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
}


/* ==========================================================================
   FAZA 1.5 & FAZA 2: WIDESCREEN DISPATCHER (30% / 40% / 30%) & DMC BAR
   ========================================================================== */

.dispatcher-widescreen {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr); /* 30% / 40% / 30% bez poziomego przewijania przy odstępach */
  gap: 16px;
  align-items: start;
  width: 100%;
}

.dispatcher-col {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dispatcher-scroll-list {
  max-height: calc(100vh - 230px);
  overflow-y: auto;
  padding: 14px;
  background: var(--gray-50);
}

.order-dispatch-item {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-left: 6px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.order-dispatch-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Pasek DMC (Soft Limit 24.60t) */
.dmc-bar-wrapper {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 9999px;
  height: 22px;
  width: 100%;
  overflow: hidden;
  margin: 8px 0;
  position: relative;
}

.dmc-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #2563eb);
  transition: width 0.25s ease, background 0.25s ease;
}

.dmc-bar-fill.overweight {
  background: linear-gradient(90deg, #ef4444, #b91c1c) !important;
}

.dmc-soft-warning {
  display: none;
  background: var(--danger-light);
  border: 2px solid var(--danger);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

@media (max-width: 1200px) {
  .dispatcher-widescreen {
    grid-template-columns: 1fr;
  }
  .dispatcher-scroll-list {
    max-height: 420px;
  }
}

/* ===== V23: pozycje zamówienia, gratisy ===== */
.item-row .row-remove { padding: 8px 12px; min-height: 0; align-self: flex-start; }
.item-row .price-hint { display: block; color: #64748b; font-size: 11px; margin-top: 3px; }
.item-row .gratis-badge { display: none; margin-top: 4px; font-size: 12px; font-weight: 800; color: #15803d; }
.gratis-row { background: #ecfdf5; border: 2px dashed #16a34a; border-radius: 8px; padding: 6px; }
.gratis-row .gratis-badge { display: inline-block; }
.gratis-row .price-input { display: none; }
.gratis-hint { background: #ecfdf5; border: 1px solid #86efac; color: #166534; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-weight: 700; font-size: 13px; }

/* ===== V23: dyspozytor – optymalizacja i „Dopełnij auto” ===== */
.route-info { margin-top: 8px; background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.fill-suggestions { background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px; padding: 10px; margin-bottom: 14px; }
.fill-suggestions .fill-title { font-weight: 800; font-size: 13px; color: #166534; margin-bottom: 6px; }
.fill-suggestions .fill-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff; border: 1px solid #d1fae5; border-radius: 6px; padding: 6px 8px; margin-bottom: 5px; font-size: 12px; }
.fill-suggestions .fill-item .btn { padding: 4px 10px; min-height: 28px; font-size: 12px; }
.route-economics { background: #f5f3ff; border: 1px solid #c4b5fd; border-radius: 8px; padding: 10px 12px; margin-bottom: 15px; font-size: 13px; }

/* ===== V23: tryb tabletowy (przełącznik w menu, zapamiętany na koncie) ===== */
body.ui-tablet { font-size: 17px; }
body.ui-tablet .sidebar {
  position: fixed; top: 0; left: -300px; height: 100vh; z-index: 1050;
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 10px 0 30px rgba(0, 0, 0, 0.35);
}
body.ui-tablet.sidebar-open .sidebar { left: 0; }
body.ui-tablet .sidebar-close-btn { display: inline-block; }
body.ui-tablet .sidebar-overlay {
  display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65); z-index: 1040;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
body.ui-tablet.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
body.ui-tablet .mobile-menu-btn { display: flex; min-width: 56px; min-height: 56px; font-size: 26px; }
body.ui-tablet .top-header h2 { font-size: 22px; }
body.ui-tablet .btn { min-height: 56px; padding: 14px 22px !important; font-size: 17px !important; border-radius: 12px; }
body.ui-tablet .form-control { min-height: 54px; font-size: 18px; padding: 12px 14px; }
body.ui-tablet input[type="checkbox"] { transform: scale(1.8); margin-right: 12px; }
body.ui-tablet .nav-link { padding: 16px 24px; font-size: 17px; }
body.ui-tablet .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.ui-tablet .table th, body.ui-tablet .table td { padding: 14px 12px; font-size: 16px; }
body.ui-tablet .badge { font-size: 14px !important; padding: 6px 12px; }
body.ui-tablet .card { padding: 20px; }
body.ui-tablet .grid-2, body.ui-tablet .grid-3, body.ui-tablet .dispatcher-widescreen { grid-template-columns: 1fr; }
body.ui-tablet .form-row { flex-wrap: wrap; }
body.ui-tablet .accordion-header { padding: 18px; font-size: 17px; }

/* ===== V24: zakres ilości ===== */
.range-toggle { margin-top: 4px; background: none; border: 1px dashed #93c5fd; color: #1d4ed8; border-radius: 6px; font-size: 11px; padding: 2px 8px; cursor: pointer; }
.range-box { margin-top: 6px; background: #eff6ff; border-radius: 6px; padding: 6px; }
.range-box .form-control { padding: 6px; font-size: 13px; }
.range-quick { font-size: 11px; color: #475569; margin-top: 4px; }
.range-quick button { border: 1px solid #93c5fd; background: #fff; border-radius: 4px; margin: 0 2px; padding: 1px 6px; cursor: pointer; }
.gratis-row .range-toggle, .gratis-row .range-box { display: none !important; }

/* ===== V24: Planowanie dnia ===== */
.planner-top { padding: 12px 16px; margin-bottom: 12px; }
.planner-top-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.planner-save-state { font-size: 12px; color: #64748b; }
.planner-week { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; }
.week-day { flex: 1 0 110px; border: 1px solid #cbd5e1; background: #fff; border-radius: 8px; padding: 6px 8px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.week-day.active { border: 2px solid #2563eb; background: #eff6ff; }
.week-draft { color: #b45309; font-weight: 700; }
.planner-grid { display: grid; grid-template-columns: minmax(0, 28fr) minmax(0, 40fr) minmax(0, 32fr); gap: 12px; align-items: start; }
.planner-col { min-height: 560px; }
.planner-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; font-weight: 400; align-items: center; }
.planner-filters .form-control { padding: 6px 8px; font-size: 12px; flex: 1 1 140px; }
.planner-orders, .planner-trucks { max-height: calc(100vh - 290px); overflow-y: auto; padding: 10px; background: #f8fafc; }
.region-group { margin-bottom: 8px; }
.region-group summary { cursor: pointer; padding: 6px 8px; background: #e2e8f0; border-radius: 6px; font-size: 13px; }
.region-sum { float: right; font-weight: 700; color: #1e3a8a; }
.plan-order { background: #fff; border: 1px solid #e2e8f0; border-left: 5px solid #94a3b8; border-radius: 8px; padding: 8px 10px; margin: 6px 0; cursor: grab; font-size: 13px; }
.plan-order.leftover { background: #fffbeb; }
.po-meta { color: #475569; font-size: 12px; margin-top: 3px; }
.po-actions { margin-top: 5px; display: flex; gap: 6px; }
.po-actions button, .truck-actions button, .stop-ctl button, .req button { border: 1px solid #cbd5e1; background: #fff; border-radius: 5px; padding: 2px 8px; font-size: 11px; cursor: pointer; }
.wait-badge { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.wait-green { background: #dcfce7; color: #166534; } .wait-yellow { background: #fef9c3; color: #854d0e; } .wait-orange { background: #ffedd5; color: #9a3412; } .wait-red { background: #fee2e2; color: #991b1b; }
.planner-legend { font-size: 11px; color: #475569; display: inline-flex; gap: 8px; flex-wrap: wrap; }
.planner-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }
.planner-corridor { background: #f0fdf4; border-bottom: 1px solid #86efac; padding: 8px 12px; font-size: 12px; max-height: 220px; overflow-y: auto; }
.corridor-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px dashed #bbf7d0; flex-wrap: wrap; }
.truck-card { background: #fff; border: 1px solid #cbd5e1; border-top: 6px solid #2563eb; border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.truck-card.active { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35); }
.truck-card.drag-over { background: #eff6ff; }
.truck-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.truck-head .form-control, .truck-extra .form-control { padding: 5px 8px; font-size: 12px; flex: 1 1 120px; min-height: 0; }
.truck-extra summary { font-size: 11px; color: #64748b; cursor: pointer; margin-top: 4px; }
.truck-metrics { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #334155; }
.prost { font-weight: 800; border-radius: 5px; padding: 0 6px; }
.prost.ok { background: #dcfce7; color: #166534; } .prost.mid { background: #fef3c7; color: #92400e; } .prost.bad { background: #fee2e2; color: #991b1b; }
.truck-warn { font-size: 12px; color: #92400e; background: #fffbeb; border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.truck-sugg { font-size: 12px; background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a; border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.sugg-btn { border: 1px solid #2563eb; background: #fff; color: #1d4ed8; border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; margin: 2px; }
.truck-stops { list-style: none; padding: 0; margin: 8px 0; }
.truck-stop { border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; font-size: 12px; cursor: grab; }
.stop-head { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; }
.stop-meta { color: #475569; margin-top: 2px; }
.stop-note { color: #92400e; margin-top: 2px; }
.stop-item { margin-top: 4px; }
.qbtn { border: 1px solid #94a3b8; background: #f8fafc; border-radius: 5px; width: 24px; height: 22px; cursor: pointer; font-weight: 800; }
.range-note { color: #1d4ed8; }
.req { margin-top: 4px; border-radius: 6px; padding: 4px 6px; }
.req.pending { background: #fef3c7; } .req.ok { background: #dcfce7; } .req.bad { background: #fee2e2; }
.drop-hint { color: #94a3b8; border: 2px dashed #cbd5e1; border-radius: 8px; padding: 14px; text-align: center; }
.truck-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.truck-actions button:disabled { opacity: 0.4; cursor: default; }
.truck-actions .danger { color: #dc2626; margin-left: auto; }
.truck-pending { margin-top: 6px; font-size: 12px; font-weight: 700; color: #92400e; }
@media (max-width: 1200px) { .planner-grid { grid-template-columns: 1fr; } }
body.ui-tablet .planner-grid { grid-template-columns: 1fr; }
.qty-requests { border: 2px solid #f59e0b; background: #fffbeb; }
.qty-request-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px dashed #fcd34d; font-size: 14px; }
.qty-request-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ===== V25 ===== */
.user-companies { font-size: 12px; color: #334155; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: #f8fafc; border-radius: 6px; padding: 4px 8px; }
.order-timeline { list-style: none; padding: 0; margin: 0; }
.order-timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #e2e8f0; font-size: 13px; }
.ot-icon { font-size: 18px; width: 26px; text-align: center; }

/* V25: centrum „Wymaga uwagi” */
.attention-list { display: grid; gap: 8px; }
.attention-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; text-decoration: none; color: #0f172a; border-left: 5px solid; background: #f8fafc; font-size: 14px; }
.attention-item:hover { background: #f1f5f9; }
.attention-item .att-icon { font-size: 18px; }
.attention-item .att-go { margin-left: auto; color: #64748b; font-weight: 700; }
.att-red { border-color: #dc2626; background: #fef2f2; }
.att-orange { border-color: #f59e0b; background: #fffbeb; }
.att-blue { border-color: #2563eb; background: #eff6ff; }
.goal-bar { height: 10px; background: #e2e8f0; border-radius: 6px; overflow: hidden; min-width: 120px; }
.goal-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); }
.goal-bar.over > span { background: linear-gradient(90deg, #7c3aed, #a855f7); }
.week-day.over-limit { border-color: #dc2626; background: #fef2f2; }
.week-over { color: #dc2626; font-weight: 700; }

/* V26: ustawienia WZ */
.wz-editor { display: grid; grid-template-columns: minmax(340px, 5fr) 6fr; gap: 20px; align-items: start; }
.wz-form details { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.wz-form summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.wz-form details[open] summary { margin-bottom: 10px; }
.wz-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 10px; }
.wz-check { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.wz-swatch { width: 28px; height: 28px; border-radius: 6px; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; }
.wz-preview-card { position: sticky; top: 10px; }
.wz-preview-card iframe { width: 100%; height: 82vh; border: 1px solid #e2e8f0; border-radius: 6px; background: #e2e8f0; }
@media (max-width: 1100px) { .wz-editor { grid-template-columns: 1fr; } .wz-preview-card { position: static; } .wz-checks { grid-template-columns: 1fr; } }

/* V27: trasy – przesunięcie, rezygnacja, podział */
.route-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-start; }
.route-actions details { border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 12px; background: #fff; flex: 1 1 380px; }
.route-actions summary { cursor: pointer; font-weight: 700; }
.route-action-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 10px 0 6px; }
.route-action-form label { display: flex; flex-direction: column; font-size: 12px; font-weight: 700; gap: 2px; }
.replacement-box { border: 1px dashed #f59e0b; background: #fffbeb; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.replacement-list { display: grid; gap: 4px; margin-top: 6px; }
.detach-form { display: flex; gap: 4px; margin-top: 6px; }
.detach-form select { padding: 3px 6px; font-size: 11px; width: auto; max-width: 260px; }
.detach-form button { padding: 3px 8px; font-size: 11px; min-height: 0; }

/* V27: bilans towaru */
.bilans-table td.bil-green { background: #f0fdf4; }
.bilans-table td.bil-orange { background: #fff7ed; }
.bilans-table td.bil-red { background: #fee2e2; color: #991b1b; }

/* V27: telefon – tabele jako karty, większe przyciski */
@media (max-width: 640px) {
    table.mobile-cards thead { display: none; }
    table.mobile-cards, table.mobile-cards tbody, table.mobile-cards tr, table.mobile-cards td { display: block; width: 100%; }
    table.mobile-cards tr { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px; padding: 8px 12px; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
    table.mobile-cards td { border: none !important; padding: 5px 0 !important; text-align: left !important; }
    table.mobile-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; margin-bottom: 2px; }
    table.mobile-cards td:empty { display: none; }
    .btn { min-height: 44px; }
    .card { padding: 14px; }
    .form-control { font-size: 16px; }   /* iPhone nie powiększa strony przy wpisywaniu */
}

/* V27: Analiza (wykresy) */
.viz-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.viz-filters label { display: flex; flex-direction: column; font-size: 12px; font-weight: 700; gap: 4px; }
.viz-tiles .card small { color: #6b7280; }
.viz-hero { font-size: 30px; font-weight: 800; color: #111827; margin: 2px 0; }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-top: 16px; }
.viz-wide { grid-column: 1 / -1; }
.viz-card { margin: 0; }
.viz-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.viz-tbl-btn { border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; color: #374151; }
.viz-legend { display: flex; gap: 14px; font-size: 12px; color: #374151; margin-bottom: 4px; }
.viz-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.viz-tip { position: absolute; display: none; z-index: 50; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); font-size: 12px; pointer-events: none; min-width: 120px; }
.viz-tip-title { color: #6b7280; margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; }
.viz-tip-row i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.viz-tip-row b { color: #111827; }
.viz-tip-row span { color: #6b7280; }
.viz-table { font-size: 12px; margin-top: 10px; }
@media (max-width: 640px) { .viz-grid { grid-template-columns: 1fr; } }


/* ===== V28: pasek nawigacji (Wróć, ścieżka, Wyloguj zawsze u góry) i menu w grupach ===== */
.nav-bar { display:flex; align-items:center; gap:12px; padding:8px 32px; background:#0f172a; color:#cbd5e1; font-size:13px; position:sticky; top:0; z-index:45; flex-wrap:wrap; }
.nav-bar a { color:#e2e8f0; text-decoration:none; }
.nav-back { background:#334155; border-radius:8px; padding:6px 12px; font-weight:700; white-space:nowrap; }
.nav-back:hover { background:#475569; }
.breadcrumb { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.breadcrumb b { color:#fff; }
.nav-user { display:flex; align-items:center; gap:10px; margin-left:auto; }
.nav-user form { margin:0; }
.nav-bell { position:relative; font-size:16px; }
.nav-bell span { position:absolute; top:-6px; right:-10px; background:#ef4444; color:#fff; border-radius:999px; font-size:10px; font-weight:800; padding:1px 6px; }
.nav-me { font-weight:600; }
.nav-logout { background:#dc2626; color:#fff; border:none; border-radius:8px; padding:6px 14px; font-weight:700; cursor:pointer; font-size:13px; }
.nav-logout:hover { background:#b91c1c; }
.top-header { top:46px; }
.nav-link.active { background:var(--sidebar-hover); color:#fff; border-left-color:#34d399; font-weight:700; }
.nav-group summary { list-style:none; cursor:pointer; padding:12px 24px; color:#94a3b8; font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:0.05em; }
.nav-group summary::-webkit-details-marker { display:none; }
.nav-group summary::after { content:' ▸'; }
.nav-group[open] summary::after { content:' ▾'; }
.nav-group .nav-link { padding-left:36px; font-size:13.5px; }
@media (max-width: 1024px) {
  .nav-bar { padding:8px 12px; gap:8px; }
  .nav-me { display:none; }
  .top-header { top:0; position:relative; }
}

/* ===== V28: „Co dziś do zrobienia” i kroki trasy ===== */
.start-actions { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.start-actions .btn { font-size:16px; padding:14px 22px; }
.start-tiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(210px, 1fr)); gap:14px; margin-bottom:22px; }
.start-tile { display:flex; flex-direction:column; gap:4px; padding:18px; border-radius:14px; background:#fff; border:2px solid #e2e8f0; color:#0f172a; text-decoration:none; transition:transform .1s ease; }
.start-tile:hover { transform:translateY(-2px); box-shadow:0 6px 16px rgba(15,23,42,.08); }
.start-tile.urgent { border-color:#f97316; background:#fff7ed; }
.start-tile.todo { border-color:#2563eb; background:#eff6ff; }
.start-tile.zero { opacity:.6; }
.start-icon { font-size:26px; }
.start-n { font-size:34px; font-weight:800; line-height:1; }
.start-label { font-size:14px; font-weight:600; color:#334155; }
.start-route { border-top:1px solid #e2e8f0; padding:14px 0; }
.start-route-head { margin-bottom:8px; font-size:14px; }
.route-steps { background:#f8fafc; border:1px solid #cbd5e1; border-radius:12px; padding:12px 14px; margin-bottom:14px; }
.route-steps ol { list-style:none; display:flex; flex-wrap:wrap; gap:6px; margin:0 0 10px; padding:0; }
.route-steps li { display:flex; align-items:center; gap:6px; padding:6px 12px; border-radius:999px; background:#e2e8f0; color:#475569; font-size:13px; font-weight:600; }
.route-steps li span { display:inline-flex; width:22px; height:22px; border-radius:50%; background:#fff; align-items:center; justify-content:center; font-weight:800; font-size:12px; }
.route-steps li.done { background:#dcfce7; color:#166534; }
.route-steps li.current { background:#1d4ed8; color:#fff; box-shadow:0 0 0 3px #bfdbfe; }
.route-steps li.current span { color:#1d4ed8; }
.route-next { font-size:15px; display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.route-next form { display:inline; margin:0; }
.route-warn { margin-top:8px; color:#b45309; font-weight:600; font-size:13px; }
.btn-sm { padding:6px 12px; font-size:13px; }
.badge.st-search { background:#facc15 !important; color:#1f2937 !important; }
.step-pill { display:inline-block; margin-left:8px; padding:3px 10px; border-radius:999px; background:#1d4ed8; color:#fff; font-size:12px; font-weight:700; }
.step-pill.done { background:#16a34a; }
.step-anchor { scroll-margin-top:120px; }
.step-anchor.highlight { outline:3px solid #1d4ed8; outline-offset:2px; }
.fleet-col { flex:1; min-width:190px; display:flex; flex-direction:column; gap:6px; }
.fleet-col label { font-size:11px; font-weight:700; }
.fleet-new-driver, .fleet-new-vehicle { display:flex; gap:6px; }
.fleet-new-driver input, .fleet-new-vehicle input { min-width:0; }
.manual-status summary { cursor:pointer; color:#475569; font-size:13px; }
.carrier-card summary.carrier-head { cursor:pointer; display:flex; flex-wrap:wrap; gap:6px 18px; align-items:center; font-size:15px; }
.carrier-card summary.carrier-head span { color:#475569; font-size:13px; }
.carrier-card[open] summary.carrier-head { margin-bottom:12px; border-bottom:1px solid #e2e8f0; padding-bottom:10px; }
.carrier-edit { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-bottom:12px; }
.carrier-edit label { display:flex; flex-direction:column; font-size:12px; font-weight:700; gap:4px; flex:1; min-width:180px; }
.fleet-row { display:flex; gap:6px; margin-bottom:6px; align-items:center; }
.fleet-row input { min-width:0; flex:1; }
.fleet-row.add { border-top:1px dashed #cbd5e1; padding-top:8px; margin-top:8px; }
.carrier-card h4 { margin:6px 0 8px; }
.lifo-checks { display:flex; flex-direction:column; gap:8px; } .lifo-checks label { font-weight:600; }

/* ===== V29: okienka i dymki systemowe (zamiast okienek przeglądarki) ===== */
.erp-dlg-layer { position:fixed; inset:0; background:rgba(15,23,42,.55); display:flex; align-items:center; justify-content:center; z-index:3000; padding:16px; animation:erpFade .12s ease; }
.erp-dlg { position:relative; background:#fff; border-radius:14px; box-shadow:0 20px 50px rgba(0,0,0,.3); width:100%; max-width:460px; padding:22px 22px 18px; max-height:92vh; overflow:auto; }
.erp-dlg.wide { max-width:900px; }
.erp-dlg-title { font-size:18px; font-weight:800; margin:0 30px 10px 0; color:#0f172a; }
.erp-dlg-body { font-size:15px; color:#334155; white-space:pre-line; line-height:1.5; }
.erp-dlg.wide .erp-dlg-body { white-space:normal; }
.erp-dlg-x { position:absolute; top:12px; right:12px; width:34px; height:34px; border-radius:50%; border:none; background:#f1f5f9; font-size:16px; cursor:pointer; color:#334155; }
.erp-dlg-x:hover { background:#e2e8f0; }
.erp-dlg-input { margin-top:12px; }
.erp-dlg-bar { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; flex-wrap:wrap; }
.erp-dlg-bar .btn { min-width:110px; padding:10px 18px; font-size:15px; }
.erp-toasts { position:fixed; top:56px; right:16px; z-index:3100; display:flex; flex-direction:column; gap:8px; max-width:min(420px, calc(100vw - 32px)); }
.erp-toast { padding:12px 16px; border-radius:10px; color:#fff; font-weight:600; font-size:14px; box-shadow:0 8px 20px rgba(0,0,0,.18); transition:opacity .5s ease, transform .5s ease; }
.erp-toast.ok { background:#15803d; }
.erp-toast.err { background:#b91c1c; }
.erp-toast.hide { opacity:0; transform:translateY(-8px); }
@keyframes erpFade { from { opacity:0; } to { opacity:1; } }
@media (max-width: 600px) { .erp-dlg { padding:18px 16px 14px; } .erp-dlg-bar .btn { flex:1; } }

/* V29: plakietki statusów – wysoki kontrast */
.badge.st { color:#fff !important; font-weight:800; letter-spacing:.01em; padding:4px 10px; border-radius:999px; font-size:12px; border:none; }
.badge.st-new { background:#475569 !important; }
.badge.st-search { background:#facc15 !important; color:#1f2937 !important; }
.badge.st-planned { background:#1d4ed8 !important; }
.badge.st-confirmed { background:#6d28d9 !important; }
.badge.st-loading { background:#c2410c !important; }
.badge.st-loaded { background:#0f766e !important; }
.badge.st-delivered { background:#15803d !important; }
.badge.st-archived { background:#334155 !important; }

/* V29: trasa w okienku, kroki z blokadą, zbiorowe rozwiązanie */
[hidden] { display:none !important; }
.route-backdrop { position:fixed; inset:0; background:rgba(15,23,42,.55); z-index:2400; }
.accordion-content.route-modal { display:block; position:fixed; top:3vh; left:50%; transform:translateX(-50%); width:min(1200px, 96vw); max-height:94vh; overflow:auto; z-index:2500; background:#fff; border-radius:14px; box-shadow:0 24px 60px rgba(0,0,0,.35); padding:0 20px 20px; margin:0; }
.route-modal-head { position:sticky; top:0; z-index:2; background:#fff; display:flex; justify-content:space-between; align-items:center; gap:10px; padding:14px 0 12px; border-bottom:1px solid #e2e8f0; margin-bottom:14px; font-size:16px; }
.route-close { width:40px; height:40px; border-radius:50%; border:none; background:#f1f5f9; font-size:18px; cursor:pointer; flex:0 0 40px; }
.route-close:hover { background:#e2e8f0; }
body.modal-open { overflow:hidden; }
.accordion-header[data-route] { cursor:pointer; }
.route-open-btn { display:inline-block; background:#1d4ed8; color:#fff; padding:4px 12px; border-radius:999px; font-size:13px; font-weight:700; }
.bulk-pick { width:20px; height:20px; vertical-align:middle; margin-right:8px; cursor:pointer; }
.bulk-bar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; background:#fff; border:1px solid #e2e8f0; border-radius:10px; padding:10px 14px; margin-bottom:12px; font-size:14px; }
.step-sec { background:#fff; padding:15px; border-radius:10px; margin-bottom:15px; border:2px solid #e2e8f0; }
.step-sec.done { background:#f1f5f9; border-color:#cbd5e1; color:#64748b; }
.step-sec.done.editing { background:#fff; color:inherit; }
.step-sec.current { border-color:#1d4ed8; box-shadow:0 0 0 4px #dbeafe; }
.step-sec.later { opacity:.75; }
.step-sec-head { font-weight:800; margin-bottom:8px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.step-sec.current .step-sec-head::after { content:'← teraz ten krok'; color:#1d4ed8; font-size:13px; font-weight:700; }
.step-ok { color:#15803d; font-size:13px; }
.step-hint { color:#94a3b8; font-weight:600; }
.step-summary { font-size:14px; color:#334155; }
@media (max-width: 700px) { .accordion-content.route-modal { top:0; width:100vw; max-height:100vh; height:100vh; border-radius:0; } }

/* V29: Planowanie SMART – czytelne przyciski i korekty ilości */
.po-actions { gap: 8px; margin-top: 7px; }
.po-actions button.po-add, .po-actions button.po-way { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 7px; border: none; color: #fff; }
.po-actions button.po-add { background: #2563eb; }
.po-actions button.po-way { background: #0d9488; }
.po-actions button.po-add:hover { background: #1d4ed8; } .po-actions button.po-way:hover { background: #0f766e; }
.truck-actions button.danger { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; font-weight: 700; font-size: 13px; padding: 5px 12px; }
.truck-actions button.danger:hover { background: #dc2626; color: #fff; }
.truck-actions button.lock { font-size: 12px; }
.truck-actions button.lock.on { background: #dbeafe; border-color: #93c5fd; color: #1e40af; font-weight: 700; }
.req { font-size: 12.5px; line-height: 1.45; border-left: 4px solid transparent; }
.req.ok { border-left-color: #16a34a; } .req.bad { border-left-color: #dc2626; } .req.pending { border-left-color: #d97706; }
.req.adj { background: #eff6ff; border-left-color: #2563eb; }
.req s { color: #64748b; }
.req-who { color: #475569; font-size: 11.5px; }

/* V29: zamówienia – odbiór osobisty, klient nie znaleziony, okienko szczegółów */
.badge.st-pickup { background:#7c3aed !important; color:#fff !important; }
.client-missing { margin-top:8px; padding:10px 12px; border-radius:8px; background:#fef3c7; border:1px solid #f59e0b; display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:space-between; font-size:14px; }
.prev-orders-btn { margin-top:8px; }
.pickup-box { background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:12px 14px; margin-bottom:15px; }
.pickup-box.on { background:#f5f3ff; border-color:#a78bfa; }
.pickup-choice { display:flex; gap:18px; flex-wrap:wrap; font-weight:700; }
.pickup-choice input { transform:scale(1.3); margin-right:6px; }
.pickup-fields { display:none; gap:10px; margin-top:10px; flex-wrap:wrap; }
.pickup-box.on .pickup-fields { display:flex; }
.pickup-fields .form-group { flex:1; min-width:150px; margin-bottom:0; }
.order-link { color:var(--primary); text-decoration:none; white-space:nowrap; }
.order-link:hover { text-decoration:underline; }
.erp-modal-body h4 { margin:16px 0 6px; }
.info-head { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding-bottom:10px; border-bottom:1px solid #e2e8f0; }
.info-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:10px; margin-top:12px; }
.info-box { background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; padding:10px 12px; font-size:13.5px; line-height:1.5; }
.info-box h4 { margin:0 0 6px !important; }
.info-line { font-size:13px; padding:2px 0; }
.info-table { font-size:13px; }
.table-scroll { overflow-x:auto; }
.route-note { color:#64748b; }

/* V29: Panel Załadunku – dzień, filtry, podział i podsumowanie */
.load-tabs { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.load-tabs .btn { padding:10px 18px; font-weight:700; }
.load-filters { display:flex; flex-direction:column; gap:10px; padding:14px 16px; margin-bottom:14px; }
.load-days, .load-search { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.load-days .btn { padding:8px 16px; font-weight:700; }
.load-days input[type=date] { width:170px; }
.load-dayname { font-size:16px; margin-left:6px; text-transform:capitalize; }
.load-search input[type=search] { flex:2; min-width:220px; }
.load-search select { flex:1; min-width:150px; }
.load-summary { padding:14px 16px; margin-bottom:16px; }
.ls-main { display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:10px; }
.ls-main div, .ls-prod { background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:10px 12px; display:flex; flex-direction:column; }
.ls-main b { font-size:26px; line-height:1.1; } .ls-main span { color:#475569; font-size:13px; }
.ls-products { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:10px; margin-top:10px; }
.ls-prod span { font-size:22px; font-weight:800; color:var(--primary); } .ls-prod small { color:#64748b; }
.load-group-title { margin:22px 0 10px; font-size:19px; } .load-group-title span { font-size:13px; font-weight:400; color:#64748b; }
.load-group-title.g-laduje { color:#0369a1; } .load-group-title.g-wyjechalo { color:#15803d; }
.load-list { display:flex; flex-direction:column; gap:14px; }
.load-card { background:#fff; border:1px solid #e2e8f0; border-left:8px solid var(--primary); border-radius:12px; padding:14px 16px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
.load-card.is-pickup { border-left-color:#7c3aed; }
.load-card.g-laduje { border:3px solid #0284c7; border-left-width:8px; background:#f0f9ff; }
.load-card.g-wyjechalo { border-left-color:#16a34a; background:#f8fafc; opacity:.9; padding:10px 16px; }
.load-head { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.load-title > b { font-size:18px; margin-right:6px; }
.load-who { margin-top:4px; font-size:14px; } .load-who span { color:#64748b; }
.load-qty { text-align:right; display:flex; flex-direction:column; } .load-qty b { font-size:22px; } .load-qty span { font-size:16px; font-weight:800; color:var(--primary); }
.load-meta { display:flex; flex-wrap:wrap; gap:6px 16px; margin:8px 0; font-size:14px; color:#334155; }
.plate { background:#fef9c3; border:1px solid #ca8a04; border-radius:4px; padding:0 6px; font-family:monospace; letter-spacing:.5px; }
.load-table { background:#f8fafc; margin:8px 0 10px; font-size:14px; }
.load-table .zone { width:120px; text-align:center; background:#f1f5f9; } .load-table .zone small { display:block; font-weight:700; }
.z-cab { color:var(--danger); } .z-door { color:var(--success); }
.load-table .li { font-size:13px; margin-top:2px; }
.load-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.load-actions form { display:inline-flex; gap:6px; align-items:center; margin:0; }
.load-actions .btn { padding:9px 16px; font-weight:700; }
.load-actions input.form-control { width:140px; }
@media (max-width:600px) { .load-actions .btn { flex:1; } .load-actions form { flex:1; } .load-qty { text-align:left; } }

/* V29: bilans Big-Bagów – kafelki dni */
.bil-help { font-size:13.5px; color:#475569; margin-top:0; line-height:1.6; }
.bil-alert div { margin-top:4px; }
.bil-legend { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; font-size:12.5px; }
.bil-legend span { padding:3px 10px; border-radius:20px; }
.bil-product { border:1px solid #e2e8f0; border-radius:12px; padding:14px; margin-bottom:14px; background:#fff; }
.bil-head { display:flex; gap:14px; flex-wrap:wrap; align-items:flex-end; margin-bottom:12px; }
.bil-name { flex:1; min-width:180px; } .bil-name b { font-size:18px; display:block; } .bil-name small { color:#64748b; }
.bil-stock { font-size:12.5px; font-weight:700; color:#334155; display:flex; flex-direction:column; gap:4px; }
.bil-stock span { display:flex; align-items:center; gap:6px; font-weight:400; } .bil-stock input { width:100px; }
.bil-unplanned { background:#f1f5f9; border-radius:8px; padding:6px 10px; font-size:13px; display:flex; flex-direction:column; } .bil-unplanned small { color:#64748b; }
.bil-nostock { color:#64748b; font-style:italic; margin:0 0 8px; }
.bil-days { display:grid; grid-template-columns:repeat(auto-fit, minmax(110px, 1fr)); gap:8px; }
.bil-day { border-radius:10px; padding:8px 10px; border:1px solid #e2e8f0; background:#f8fafc; }
.bd-date { font-weight:800; text-transform:capitalize; } .bd-date small { font-weight:400; color:#64748b; }
.bd-out { font-size:12.5px; margin:3px 0; } .bd-out span { color:#94a3b8; }
.bd-left { font-size:14px; }
.bil-day.bil-green, .bil-legend .bil-green { background:#dcfce7; border-color:#86efac; color:#14532d; }
.bil-day.bil-orange, .bil-legend .bil-orange { background:#ffedd5; border-color:#fdba74; color:#7c2d12; }
.bil-day.bil-red, .bil-legend .bil-red { background:#fee2e2; border-color:#f87171; color:#7f1d1d; }
.bil-day.bil-red .bd-left b { font-size:16px; }

/* V29: szczegóły powiadomień i zdarzeń – dymek po najechaniu / dotknięciu */
.ev-hint { font-size:12.5px; color:#64748b; margin:4px 0 10px; }
.ev-list { list-style:none; padding:0; margin:0; }
.ev-item { position:relative; padding:12px 15px; border-bottom:1px solid #e2e8f0; cursor:pointer; outline:none; }
.ev-item.unread { background:#fef9c3; font-weight:600; }
.ev-item:hover, .ev-item:focus-within, .ev-item.open { background:#eff6ff; }
.ev-when { color:#64748b; }
.ev-row { position:relative; cursor:pointer; }
.ev-cell { position:relative; }
.ev-tip { display:none; position:absolute; z-index:50; left:12px; right:12px; top:100%; margin-top:2px; background:#0f172a; color:#e2e8f0; border-radius:10px; padding:10px 12px; font-size:13px; font-weight:400; line-height:1.55; box-shadow:0 10px 30px rgba(0,0,0,.3); }
.ev-tip span { color:#94a3b8; } .ev-tip b { color:#fff; }
.ev-tip .ev-full { margin-top:6px; padding-top:6px; border-top:1px solid #334155; white-space:pre-wrap; color:#fff; }
.ev-tip a.ev-link { color:#93c5fd; font-weight:700; margin-right:8px; white-space:nowrap; }
.ev-item.hov > .ev-tip, .ev-item.open > .ev-tip,
.ev-row.hov .ev-tip, .ev-row.open .ev-tip { display:block; }
.ev-item.open, .ev-row.open { outline:2px solid #93c5fd; outline-offset:-2px; }
.ev-tip-x { float:right; border:none; background:#334155; color:#fff; border-radius:6px; padding:1px 8px; margin:-2px -4px 4px 8px; cursor:pointer; font-size:13px; }
.ev-tip-hint { display:block; margin-top:6px; font-size:11.5px; color:#94a3b8; }
.ev-cell .ev-tip { left:auto; right:0; width:min(460px, 80vw); }


/* V30: anulowanie WZ */
.alert-warning { background:#fef3c7; border:1px solid #f59e0b; color:#78350f; padding:12px 14px; border-radius:8px; }
.wz-cancel { display:inline-block; position:relative; }
.wz-cancel > summary { list-style:none; cursor:pointer; }
.wz-cancel > summary::-webkit-details-marker { display:none; }
.wz-cancel-form { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); z-index:900; width:min(380px, 92vw); background:#fff; border:1px solid #fca5a5; border-radius:10px; padding:10px; box-shadow:0 10px 30px rgba(0,0,0,.18); display:flex; flex-direction:column; gap:6px; }
.wz-warn { background:#fee2e2; color:#991b1b; font-weight:700; padding:4px 8px; border-radius:6px; font-size:12px; }
.wz-cancelled-row s { color:#b91c1c; font-weight:700; }

/* V30: powiadomienia – usuwanie, dymek nad pozycją */
.notif-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.notif-actions { display:flex; gap:6px; flex-wrap:wrap; } .notif-actions form { margin:0; }
.notif-all { font-size:13px; display:inline-flex; gap:6px; align-items:center; margin-bottom:6px; }
.ev-row-in { display:flex; gap:10px; align-items:flex-start; }
.ev-body { flex:1; min-width:0; }
.notif-pick { transform:scale(1.25); margin-top:4px; }
.notif-del { margin:0; }
.notif-x { border:none; background:transparent; color:#94a3b8; font-size:16px; cursor:pointer; padding:2px 6px; border-radius:6px; }
.notif-x:hover { background:#fee2e2; color:#b91c1c; }
.ev-tip.up { top:auto; bottom:100%; margin-top:0; margin-bottom:2px; }

/* V30: zmiana kolejności zjazdów */
.reorder-box { margin:8px 0; } .reorder-box > summary { list-style:none; cursor:pointer; display:inline-block; }
.reorder-box > summary::-webkit-details-marker { display:none; }
.reorder-form { margin-top:8px; background:#f8fafc; border:1px solid #cbd5e1; border-radius:10px; padding:10px 12px; max-width:560px; }
.ro-list { margin:6px 0; padding-left:22px; }
.ro-list li { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:5px 6px; border-bottom:1px dashed #e2e8f0; }
.ro-list li.moved { background:#fef9c3; }
.ro-btns button { border:1px solid #cbd5e1; background:#fff; border-radius:6px; padding:3px 9px; cursor:pointer; font-size:13px; }
.ro-km { font-size:13px; color:#1d4ed8; font-weight:700; min-height:1em; }
.ro-bar { display:flex; gap:8px; margin:6px 0; } .ro-bar select { max-width:220px; }
.ro-warn { background:#fee2e2; color:#991b1b; border-radius:6px; padding:6px 8px; font-size:13px; margin-bottom:6px; }
.ro-hint { color:#64748b; }
.side-chk { display:inline-flex; gap:5px; align-items:center; font-size:13px; white-space:nowrap; }
.stat-row { display:flex; justify-content:space-between; padding:6px 0; border-bottom:1px solid #f1f5f9; font-size:14px; }
.bil-save { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; margin-top:10px; } .bil-save label { font-size:12.5px; font-weight:700; display:flex; flex-direction:column; gap:4px; }
.num-cell { display:flex; flex-direction:column; gap:4px; font-size:12px; font-weight:700; } .num-cell input { width:130px; }
.reset-form { display:flex; flex-direction:column; gap:10px; max-width:560px; } .reset-form label { font-size:13px; } .reset-opt { border:1px solid #e2e8f0; border-radius:8px; padding:10px; cursor:pointer; }
.wz-cancel-head { display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:14px; }
/* V31: dymek szczegółów nad całą stroną */
.ev-tip.floating { position:fixed; right:auto; bottom:auto; margin:0; z-index:1500; max-height:calc(100vh - 16px); overflow:auto; }
.pager { display:flex; gap:12px; align-items:center; flex-wrap:wrap; font-size:13px; padding:8px 0; color:#475569; } .pager a { color:var(--primary); font-weight:700; text-decoration:none; } .pager-pp { margin-left:auto; } .pager-pp b, .pager-pp a { padding:2px 6px; border-radius:6px; } .pager-pp b { background:#e2e8f0; }
.order-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; } .order-filters select, .order-filters label { flex:1; min-width:140px; } .order-filters label { display:flex; gap:4px; align-items:center; font-size:13px; } .order-notes summary { cursor:pointer; font-size:12.5px; color:#475569; margin-bottom:4px; }

/* V31: wyszukiwarka na górnym pasku i podgląd powiadomień */
.gsearch { position:relative; flex:1; max-width:420px; margin:0 12px; }
.gsearch-in { width:100%; border-radius:999px; border:1px solid #334155; background:#1e293b; color:#fff; padding:7px 14px; font-size:13.5px; }
.gsearch-in::placeholder { color:#94a3b8; }
.bell-wrap { position:relative; }
.gs-pop { position:absolute; top:calc(100% + 8px); left:0; right:0; z-index:1600; background:#fff; color:#0f172a; border-radius:12px; box-shadow:0 14px 40px rgba(0,0,0,.25); max-height:70vh; overflow:auto; padding:6px; min-width:300px; }
.bell-pop { left:auto; right:-60px; width:min(380px, 92vw); }
.gs-title { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:#64748b; padding:8px 10px 4px; }
.gs-item { display:flex; flex-direction:column; padding:8px 10px; border-radius:8px; text-decoration:none; color:inherit; }
.gs-item:hover { background:#eff6ff; } .gs-item small { color:#64748b; } .gs-item.unread b { color:#1d4ed8; }
.gs-empty { padding:10px; color:#64748b; margin:0; font-size:13px; }
.gs-all { display:block; text-align:center; padding:8px; font-weight:700; color:var(--primary); text-decoration:none; border-top:1px solid #e2e8f0; margin-top:4px; }
@media (max-width:700px) { .gsearch { order:5; flex-basis:100%; max-width:none; margin:6px 0 0; } }
.nav-bar .gs-pop a.gs-item { color:#0f172a; } .nav-bar .gs-pop a.gs-all { color:var(--primary); }
/* V31: kafelki Pulpitu admina */
.kpi-tiles { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:12px; margin-bottom:18px; }
.kpi-tile { background:#fff; border-radius:14px; padding:14px 16px; text-decoration:none; color:#0f172a; box-shadow:0 2px 8px rgba(0,0,0,.06); border-top:5px solid #94a3b8; display:flex; flex-direction:column; gap:2px; transition:transform .1s; }
.kpi-tile:hover { transform:translateY(-2px); } .kpi-tile b { font-size:24px; } .kpi-tile small { color:#475569; font-size:12.5px; } .kpi-icon { font-size:20px; }
.kpi-blue { border-top-color:#2563eb; } .kpi-green { border-top-color:#16a34a; } .kpi-orange { border-top-color:#d97706; } .kpi-red { border-top-color:#dc2626; } .kpi-gray { border-top-color:#94a3b8; }

/* V31: klienci – NIP, duplikaty, pinezka */
.pin-map { width:100%; height:min(60vh, 520px); border-radius:10px; background:#e2e8f0; }
.pin-hint { margin:0 0 8px; font-size:13px; color:#64748b; }
.link-btn { background:none; border:none; padding:0; color:var(--primary); text-decoration:underline; cursor:pointer; font:inherit; }
.dup-box { margin-bottom:12px; } .dup-box ul { margin:6px 0 8px 18px; padding:0; }

/* V31: szerokie tabele jako karty na telefonie (table.m-cards, podpisy z nagłówków dodaje ui.js) */
@media (max-width: 700px) {
    .table-scroll:has(> table.m-cards) { overflow:visible; }
    table.m-cards, table.m-cards tbody, table.m-cards tr, table.m-cards td { display:block; width:100%; }
    table.m-cards thead { display:none; }
    table.m-cards tr { background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:8px 12px; margin-bottom:10px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
    table.m-cards tr.wz-cancelled-row { background:#fef2f2; }
    table.m-cards td { border:none !important; padding:6px 0 !important; text-align:left !important; }
    table.m-cards td + td { border-top:1px dashed #e2e8f0 !important; }
    table.m-cards td[data-label]::before { content:attr(data-label); display:block; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.3px; color:#64748b; margin-bottom:2px; }
    table.m-cards td:empty { display:none; }
    table.m-cards td .btn { min-height:40px; }
}
.muted { color:#64748b; }

/* V31: druk wybranych kart LIFO / WZ */
.print-pick { display:inline-flex; align-items:center; gap:3px; margin-right:6px; padding:2px 6px; border:1px solid #cbd5e1; border-radius:6px; font-size:13px; cursor:pointer; background:#fff; }
.print-pick input { width:17px; height:17px; }
.print-pick-bar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:0 0 12px; font-size:13px; color:#475569; }

/* V32: zakładki „Trasy i załadunki” */
.route-tabs { display:flex; gap:8px; flex-wrap:wrap; margin:0 0 16px; }
.route-tabs a { padding:10px 16px; border-radius:10px; background:#e2e8f0; color:#0f172a; font-weight:800; font-size:15px; text-decoration:none; }
.route-tabs a.on { background:var(--primary); color:#fff; }
.route-tabs a:hover:not(.on) { background:#cbd5e1; }
@media (max-width:600px) { .route-tabs a { flex:1 1 45%; text-align:center; padding:10px 8px; font-size:14px; } }

/* V33 – dostawa pod inny adres (uwaga 76) */
.place-box { background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:12px 14px; margin-bottom:15px; }
.place-box.on { background:#fff7ed; border-color:#fb923c; }
.place-toggle { font-weight:600; display:flex; gap:8px; align-items:center; cursor:pointer; }
.place-fields { display:none; margin-top:10px; }
.place-box.on .place-fields { display:block; }
.place-hint { font-size:12px; color:#64748b; margin:0; }
.badge.st-place { background:#ea580c !important; color:#fff !important; }
.place-tag { margin-top:6px; padding:6px 10px; background:#fff7ed; border-left:4px solid #ea580c; border-radius:6px; font-size:13px; }
.place-list { list-style:none; padding:0; margin:0; }
.place-list li { display:flex; justify-content:space-between; gap:10px; align-items:center; padding:8px 0; border-bottom:1px solid #e2e8f0; }
.place-mark { display:inline-block; margin-left:4px; padding:1px 7px; border-radius:6px; background:#ffedd5; color:#9a3412; font-size:.85em; font-weight:700; white-space:normal; }
@media print { .place-mark { background:none; border:1.5px solid #000; color:#000; } }

/* V34 – wyszukiwarka klienta w zamówieniu (uwagi 81, 82) */
.client-search { display:flex; gap:8px; align-items:flex-start; flex-wrap:wrap; }
.client-pick { position:relative; flex:1 1 260px; min-width:0; }
.client-suggest { position:absolute; left:0; right:0; top:100%; z-index:50; margin-top:2px; max-height:320px; overflow-y:auto; background:#fff; border:1px solid #cbd5e1; border-radius:8px; box-shadow:0 8px 24px rgba(15,23,42,.18); }
.client-suggest .sug { padding:9px 12px; cursor:pointer; border-bottom:1px solid #f1f5f9; display:flex; flex-direction:column; gap:2px; }
.client-suggest .sug small { color:#64748b; }
.client-suggest .sug:hover, .client-suggest .sug.on { background:#eff6ff; }
.client-suggest .sug.none { color:#64748b; cursor:default; }
.client-suggest mark { background:#fde68a; color:inherit; border-radius:2px; padding:0 1px; }
#clientAddBtn { white-space:nowrap; }
