:root {
  --primary: #e94560;
  --primary-dark: #c23152;
  --bg-dark: #0f0f23;
  --bg-card: #1a1a2e;
  --bg-surface: #16213e;
  --bg-input: #1a1a3e;
  --bg-main: #0f0f23;
  --text: #eee;
  --text-secondary: #8892b0;
  --text-muted: #5a6380;
  --border: #2a2a4a;
  --success: #00c853;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #2196f3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --nav-height: 65px;
  --header-height: 56px;
  --sig-stroke: #ffffff;
  --sig-baseline: rgba(255, 255, 255, 0.08);
  --sig-canvas-bg: rgba(255, 255, 255, 0.03);
  --sig-hint-color: rgba(255, 255, 255, 0.2);
  --hover-overlay: rgba(255,255,255,0.03);
}

/* ==================== LIGHT THEME ==================== */
[data-theme="light"] {
  --primary: #d63851;
  --primary-dark: #b52e44;
  --bg-dark: #f0f2f5;
  --bg-card: #ffffff;
  --bg-surface: #f5f7fa;
  --bg-input: #ffffff;
  --bg-main: #f0f2f5;
  --text: #111111;
  --text-secondary: #333333;
  --text-muted: #555555;
  --border: #d4d8e0;
  --success: #00a844;
  --warning: #e68a00;
  --danger: #d32f2f;
  --info: #1976d2;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --sig-stroke: #111111;
  --sig-baseline: rgba(0, 0, 0, 0.12);
  --sig-canvas-bg: rgba(0, 0, 0, 0.02);
  --sig-hint-color: rgba(0, 0, 0, 0.35);
  --hover-overlay: rgba(0,0,0,0.04);
}

/* Light theme — specific overrides that can't use vars */
[data-theme="light"] body {
  background: var(--bg-dark);
  color: var(--text);
}

[data-theme="light"] .login-container {
  background: linear-gradient(135deg, #e8ecf1 0%, #f5f7fa 100%);
}

[data-theme="light"] #lock-screen .login-container {
  background: linear-gradient(135deg, #dde1e8 0%, #eef1f5 100%);
}

[data-theme="light"] .login-logo-img {
  filter: drop-shadow(0 4px 20px rgba(214, 56, 81, 0.2));
}

[data-theme="light"] .lock-user-info {
  background: rgba(214, 56, 81, 0.08);
  border-color: rgba(214, 56, 81, 0.2);
}

[data-theme="light"] .job-card:hover {
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

[data-theme="light"] .job-card-title {
  color: #111111;
}

[data-theme="light"] .job-card-info {
  color: #222222;
}

[data-theme="light"] .job-card-info i {
  color: #444444;
}

[data-theme="light"] .job-card-desc {
  color: #444444;
}

[data-theme="light"] .job-card-footer {
  color: #444444;
}

[data-theme="light"] .job-assigned {
  color: #0d9488;
}
[data-theme="light"] .job-assigned i {
  color: #0d9488 !important;
}

[data-theme="light"] .job-border-done {
  background: rgba(46,204,113,0.06);
}
[data-theme="light"] .job-border-cancelled {
  background: rgba(149,165,166,0.06);
}
[data-theme="light"] .job-border-external {
  background: rgba(255,87,34,0.06);
}

/* Chat */
[data-theme="light"] .chat-message.received {
  background: var(--bg-surface);
  color: var(--text);
}

[data-theme="light"] .chat-message.sent {
  background: var(--primary);
  color: white;
}

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #c0c4cc;
}

/* Workload */
[data-theme="light"] .workload-job-mini {
  background: var(--bg-surface);
}
[data-theme="light"] .workload-job-mini:hover {
  background: rgba(214, 56, 81, 0.08);
}

/* Leaflet */
[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #fff !important;
  color: #222 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
}
[data-theme="light"] .leaflet-popup-tip {
  background: #fff !important;
}

/* GPS marker */
[data-theme="light"] .gps-marker-label {
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Reports */
[data-theme="light"] .report-table tr:hover td {
  background: rgba(0,0,0,0.02);
}

[data-theme="light"] .tech-report-header:hover {
  background: rgba(0,0,0,0.02);
}

/* Notes */
[data-theme="light"] .notes-add-bar {
  background: var(--bg-dark);
}

/* Protocol form */
[data-theme="light"] .protocol-email-section {
  border-color: rgba(25, 118, 210, 0.3) !important;
  background: rgba(25, 118, 210, 0.04) !important;
}

[data-theme="light"] .email-highlight-box {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.06), rgba(99, 102, 234, 0.04));
  border-color: rgba(25, 118, 210, 0.2);
}

[data-theme="light"] .email-highlight-label {
  color: #111111 !important;
}

[data-theme="light"] .email-input-wrap {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .email-highlight-input {
  color: #111111 !important;
}

[data-theme="light"] .email-highlight-input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}

/* Signature canvas in light theme */
[data-theme="light"] .signature-canvas {
  background: var(--sig-canvas-bg);
  border-color: var(--primary);
}

[data-theme="light"] .signature-canvas-wrap::before {
  color: var(--sig-hint-color);
}

/* Text signature cards */
[data-theme="light"] .text-sig-card {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .text-sig-card:hover {
  background: rgba(214, 56, 81, 0.04);
}

[data-theme="light"] .text-sig-cat-btn {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #333333 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .text-sig-cat-btn:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  color: #111111 !important;
}

/* Toggle button styling */
[data-theme="light"] #btn-client-draw-toggle {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.03);
  color: #333333;
}
[data-theme="light"] #btn-client-draw-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #111111;
}

/* Workload badge light fix */
[data-theme="light"] .workload-badge.total {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

/* Billing / Status options */
[data-theme="light"] .billing-option {
  background: var(--bg-surface);
}

[data-theme="light"] .status-option {
  background: var(--bg-surface);
}

/* Quick job */
[data-theme="light"] .workload-tech-row:hover {
  background: rgba(214, 56, 81, 0.05);
}
[data-theme="light"] .workload-tech-row.unassigned-row {
  background: rgba(230, 138, 0, 0.06);
}

/* Client signature text preview */
[data-theme="light"] .client-sig-text-preview {
  border-color: rgba(0, 0, 0, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ==================== SCREENS ==================== */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ==================== LOGIN ==================== */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-surface) 100%);
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo-img {
  width: 180px;
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 20px rgba(233, 69, 96, 0.3));
}

.login-logo h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--primary);
}

.login-logo p {
  font-size: 14px;
  letter-spacing: 8px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-subtitle {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==================== LOCK SCREEN ==================== */
#lock-screen .login-container {
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
}

.lock-user-info {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
  padding: 12px 24px;
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: var(--radius-sm);
}

#lock-form {
  width: 100%;
  max-width: 360px;
}

#lock-logout-btn {
  max-width: 360px;
  opacity: 0.6;
  font-size: 13px;
}

#lock-logout-btn:hover {
  opacity: 1;
}

#login-form {
  width: 100%;
  max-width: 360px;
}

/* ==================== FORM ==================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group label i { margin-right: 6px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.error-message {
  margin-top: 12px;
  padding: 10px;
  background: rgba(244,67,54,0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
}
.btn-icon:hover { color: var(--primary); background: rgba(233,69,96,0.1); }

/* ==================== HEADER ==================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left h2 {
  font-size: 18px;
  font-weight: 600;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  height: 32px;
  width: auto;
}

.connection-status {
  font-size: 10px;
  line-height: 1;
}

.connection-status.online { color: var(--success); }
.connection-status.offline { color: var(--danger); animation: blink 1s infinite; }

@keyframes blink { 50% { opacity: 0.3; } }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==================== GLOBAL SEARCH ==================== */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  min-width: 0;
}
.global-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  max-height: 420px;
  overflow-y: auto;
  z-index: 9999;
  min-width: 360px;
}
.gs-section-title {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.gs-item {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.gs-item:last-child { border-bottom: none; }
.gs-item:hover { background: var(--bg-hover, rgba(255,255,255,0.05)); }
.gs-item i {
  width: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.gs-item .gs-main { flex: 1; min-width: 0; }
.gs-item .gs-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item .gs-main small { color: var(--text-muted); font-size: 11px; }
.gs-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
@media (max-width: 600px) {
  .header-center { padding: 0 6px; }
  .global-search-dropdown { min-width: 280px; left: -40px; right: -40px; }
  #global-search-input { font-size: 12px; padding: 6px 10px 6px 28px; }
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  position: relative;
  min-width: 0;
  flex: 1;
}

.nav-btn i { font-size: 18px; }
.nav-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-btn.active { color: var(--primary); }
.nav-btn:hover { color: var(--primary); }

.nav-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.page { display: none; padding: 16px; min-height: 100%; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h3 { font-size: 16px; font-weight: 600; }

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==================== FILTER TABS ==================== */
.filter-tabs {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-tab.active {
  background: var(--primary);
  color: white;
}

/* ==================== JOB CARDS ==================== */
.jobs-list { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 10px; 
}

@media (min-width: 700px) {
  .jobs-list {
    grid-template-columns: repeat(2, 1fr);
  }
  .jobs-list > div[style*="padding:6px 12px"] {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1200px) {
  .jobs-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.job-card:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }

/* Obramówki statusu zlecenia */
.job-border-done { border-left: 4px solid #2ecc71; border-color: rgba(46,204,113,0.3); background: rgba(46,204,113,0.05); }
.job-border-assigned { border-left: 4px solid #f39c12; border-color: rgba(243,156,18,0.3); }
.job-border-unassigned { border-left: 4px solid #3498db; border-color: rgba(52,152,219,0.3); }
.job-border-external { border-left: 4px solid #ff5722; border-color: rgba(255,87,34,0.3); background: rgba(255,87,34,0.05); }
.job-border-cancelled { border-left: 4px solid #95a5a6; border-color: rgba(149,165,166,0.3); background: rgba(149,165,166,0.05); }

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.job-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.job-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-nowe { background: rgba(33,150,243,0.2); color: var(--info); }
.status-przydzielone { background: rgba(255,152,0,0.2); color: var(--warning); }
.status-w_drodze { background: rgba(156,39,176,0.2); color: #ce93d8; }
.status-w_trakcie { background: rgba(255,152,0,0.2); color: var(--warning); }
.status-zewnetrzna { background: rgba(255,87,34,0.2); color: #ff5722; }
.status-zakonczone { background: rgba(255,193,7,0.2); color: #ffc107; }
.status-zakonczone_protokol { background: rgba(0,200,83,0.2); color: var(--success); }
.status-anulowane { background: rgba(244,67,54,0.2); color: var(--danger); }

.job-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  color: var(--text-secondary);
}

.job-card-info i {
  width: 18px;
  text-align: center;
  margin-right: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.job-assigned {
  color: #4ECDC4;
  font-weight: 600;
}

.job-assigned i {
  color: #4ECDC4 !important;
}

.job-unassigned {
  color: var(--warning);
}

.job-unassigned i {
  color: var(--warning) !important;
}

.job-card-desc {
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.3;
  font-size: 12px;
}

.job-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  gap: 4px;
}

/* ==================== JOB DETAIL ==================== */
.job-detail {
  max-width: 600px;
}

.job-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.job-detail-header .btn-icon { font-size: 20px; }

.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.detail-section h4 {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}

.detail-row i {
  width: 20px;
  text-align: center;
  color: var(--primary);
  margin-top: 2px;
}

.detail-row .label {
  color: var(--text-secondary);
  min-width: 80px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn-navigate {
  background: #34a853;
  color: white;
  font-size: 14px;
}

.btn-navigate:hover { background: #2d9249; }

/* ==================== CHAT ==================== */
.chat-container {
  display: flex;
  height: calc(100vh - var(--header-height) - var(--nav-height) - 32px);
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.chat-sidebar {
  width: 240px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.chat-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.chat-channel:hover { background: var(--bg-surface); }
.chat-channel.active { background: var(--bg-surface); color: var(--primary); }

.chat-channel .unread-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-users-header {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.chat-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.chat-user-item:hover { background: var(--bg-surface); }
.chat-user-item.active { background: var(--bg-surface); color: var(--primary); }

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.online-dot.online { background: var(--success); }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
}

.chat-message.sent {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received {
  align-self: flex-start;
  background: var(--bg-surface);
  border-bottom-left-radius: 4px;
}

.chat-message .sender-name {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
}

.chat-message .msg-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.msg-read-status {
  font-size: 10px;
  font-weight: 600;
}

.msg-read-status.read {
  color: #4fc3f7;
  opacity: 1;
}

.msg-read-status.unread {
  opacity: 0.5;
}

.chat-message {
  position: relative;
}

.msg-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 4px 6px;
  border-radius: 4px;
}

.chat-message:hover .msg-delete-btn {
  opacity: 0.5;
}

.msg-delete-btn:hover {
  opacity: 1 !important;
  color: var(--danger);
  background: rgba(255,0,0,0.1);
}

.chat-message.received .msg-delete-btn {
  left: 4px;
  right: auto;
}

.chat-typing {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.chat-input input:focus { outline: none; border-color: var(--primary); }

.chat-input .btn {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
}

.chat-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.chat-photo-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.chat-image-wrap {
  cursor: pointer;
  margin: 4px 0;
}

.chat-image {
  max-width: 240px;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.chat-message.sent .chat-image {
  max-width: 240px;
}

.chat-message.received .chat-image {
  max-width: 240px;
}

@media (max-width: 500px) {
  .chat-image {
    max-width: 180px;
    max-height: 160px;
  }
}

/* ==================== GPS ==================== */
.svc-map-container { height: calc(100vh - var(--header-height) - var(--nav-height) - 32px); display: flex; flex-direction: column; }

.svc-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.svc-map-header h3 { font-size: 16px; }

.svc-map-view {
  flex: 1;
  min-height: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.svc-map-view iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Leaflet marker styles */
.gps-leaflet-marker {
  background: none !important;
  border: none !important;
}

.gps-marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  pointer-events: none;
}

.gps-marker-pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: absolute;
  left: 50%;
  bottom: 0;
  margin-left: -18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  border: 2px solid #fff;
}

.gps-marker-pin span {
  transform: rotate(45deg);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper {
  background: var(--bg-card, #1e1e2e) !important;
  color: var(--text, #e0e0e0) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-tip {
  background: var(--bg-card, #1e1e2e) !important;
}

.leaflet-popup-content a {
  color: var(--primary, #3498db) !important;
}

.svc-map-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.gps-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gps-card:hover { background: var(--bg-main); }
.gps-card-online { border-left: 3px solid #00E676; }

.gps-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gps-card-info .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.gps-card-details h4 { font-size: 14px; margin-bottom: 2px; }
.gps-card-details p { font-size: 12px; color: var(--text-secondary); margin: 0; }

.gps-card-actions { display: flex; gap: 6px; align-items: center; }

.gps-history-icon { background: transparent !important; border: none !important; }
.gps-history-dot { background: transparent !important; border: none !important; }

.battery-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==================== USERS ==================== */
.users-list { display: flex; flex-direction: column; gap: 10px; }

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.user-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-card .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.user-card-details h4 { font-size: 14px; margin-bottom: 2px; }
.user-card-details p { font-size: 12px; color: var(--text-secondary); }

.user-card-actions { display: flex; gap: 6px; }

.user-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.role-admin { background: rgba(233,69,96,0.2); color: var(--primary); }
.role-serwisant { background: rgba(33,150,243,0.2); color: var(--info); }

/* ==================== SETTINGS ==================== */
.settings-container { max-width: 500px; }

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.settings-section h4 {
  margin-bottom: 16px;
  font-size: 15px;
}

.settings-section h4 i { margin-right: 8px; color: var(--primary); }

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 18px; }

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: white;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  min-width: 250px;
  box-shadow: var(--shadow);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(100%); }
}

/* ==================== LOADING ==================== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.loading i { margin-right: 8px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }

.jobs-filter-info {
  grid-column: 1 / -1;
}

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
  .chat-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 10;
    background: var(--bg-card);
  }

  .chat-sidebar.hidden { display: none; }
  .chat-back-btn { display: block !important; }

  .form-row { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .filter-tabs { width: 100%; overflow-x: visible; display: flex; flex-wrap: wrap; gap: 4px; border: none; background: none; }
  .filter-tab { flex: 0 0 auto; text-align: center; padding: 6px 10px; font-size: 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; }

  .job-card-footer { flex-direction: column; align-items: flex-start; gap: 4px; }

  .chat-container { position: relative; }
}

@media (max-width: 400px) {
  .nav-btn span { font-size: 9px; }
  .nav-btn i { font-size: 16px; }
  .nav-btn { padding: 6px 3px; gap: 1px; }
}

/* ==================== RAPORTY ==================== */
.reports-container {
  padding: 0;
}

.reports-header {
  padding: 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.reports-title h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: var(--text);
}

.reports-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.period-buttons {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.period-btn {
  padding: 8px 20px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.period-btn.active {
  background: var(--primary);
  color: white;
}

.period-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.period-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-input);
}

#reports-content {
  padding: 16px;
}

/* Globalne statystyki */
.report-global-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-total .stat-number { color: var(--info); }
.stat-done .stat-number { color: var(--success); }
.stat-progress .stat-number { color: var(--warning); }
.stat-waiting .stat-number { color: #64b5f6; }
.stat-cancelled .stat-number { color: var(--danger); }

/* Sekcje raportu */
.report-section {
  margin-bottom: 24px;
}

.report-section h4 {
  font-size: 15px;
  margin: 0 0 12px 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tabela serwisantów */
.report-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th {
  background: var(--bg-surface);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.report-table tr:last-child td {
  border-bottom: none;
}

.report-table tr:hover td {
  background: var(--hover-overlay);
}

.report-table .num {
  text-align: center;
  font-weight: 500;
}

.tech-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-inactive {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--danger);
  color: white;
  border-radius: 4px;
}

/* Karty serwisantów */
.tech-report-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  overflow: hidden;
}

.tech-report-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  gap: 12px;
  transition: background 0.2s;
}

.tech-report-header:hover {
  background: var(--hover-overlay);
}

.tech-report-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.tech-report-name i {
  color: var(--primary);
}

.tech-report-name strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tech-job-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.tech-report-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.tech-report-bar span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 35px;
  text-align: right;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.toggle-icon {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s;
}

.tech-report-body {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}

.tech-mini-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.tech-mini-stats i {
  margin-right: 4px;
}

/* Lista zleceń w raporcie */
.tech-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-job-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}

.report-job-row:hover {
  background: var(--bg-input);
}

.rjr-status {
  width: 6px;
  height: 36px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rjr-info {
  flex: 1;
  min-width: 0;
}

.rjr-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rjr-client {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rjr-client i {
  margin-right: 3px;
  font-size: 10px;
}

.rjr-address {
  color: var(--text-muted);
}

.rjr-date {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.rjr-time {
  font-size: 11px;
  color: var(--text-muted);
}

.rjr-badge {
  flex-shrink: 0;
}

.rjr-badge .job-status {
  font-size: 10px;
  padding: 3px 8px;
}

/* Modal szczegółów serwisanta */
.tech-detail-period {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-detail-summary {
  font-size: 13px;
}

.tech-detail-summary strong {
  color: var(--success);
}

.tech-daily-breakdown {
  max-height: 50vh;
  overflow-y: auto;
}

.daily-row {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.daily-row.daily-empty {
  opacity: 0.5;
}

.daily-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  font-size: 13px;
}

.daily-header strong {
  color: var(--text);
}

.daily-header span {
  color: var(--text-secondary);
  font-size: 12px;
}

.daily-count {
  margin-left: auto;
  font-weight: 600;
  color: var(--primary) !important;
}

.daily-no-jobs {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.daily-jobs {
  padding: 8px;
}

.daily-jobs .report-job-row {
  margin-bottom: 4px;
}

/* Historia */
.tech-history-section {
  margin-top: 16px;
}

.tech-history-section h4 {
  font-size: 14px;
  margin: 0 0 8px 0;
  color: var(--text);
}

.tech-history-list {
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.history-time {
  color: var(--text-muted);
  min-width: 110px;
  white-space: nowrap;
}

.history-job {
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-change {
  color: var(--info);
  white-space: nowrap;
}

/* Responsywność raportów */
@media (max-width: 600px) {
  .report-global-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-number { font-size: 22px; }
  .stat-label { font-size: 10px; }

  .period-label {
    min-width: 120px;
    font-size: 12px;
  }

  .tech-report-bar {
    min-width: 80px;
  }

  .report-table { font-size: 12px; }
  .report-table th, .report-table td { padding: 8px 6px; }

  .rjr-badge { display: none; }

  .reports-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .period-nav {
    justify-content: center;
  }
}

/* ==================== ZDJĘCIA ZLECEŃ ==================== */
.photos-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.photo-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.photo-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.2s;
  display: block;
}

.photo-item img:hover {
  opacity: 0.8;
}

.photo-info {
  padding: 4px 6px;
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.photo-author {
  font-weight: 500;
  color: var(--text-secondary);
}

.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: var(--danger);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-item:hover .photo-delete-btn {
  opacity: 1;
}

/* Na telefonie zawsze widoczny */
@media (max-width: 768px) {
  .photo-delete-btn {
    opacity: 0.7;
  }
  .photos-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ==================== DAILY WORKLOAD ==================== */
.daily-workload-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.daily-workload-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.daily-workload-date-label {
  font-weight: 600;
  font-size: 14px;
  min-width: 140px;
  text-align: center;
}

.daily-workload-content {
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.daily-workload-content.collapsed {
  max-height: 0;
  padding: 0;
  overflow: hidden;
}

.workload-tech-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.workload-tech-row:last-child {
  border-bottom: none;
}

.workload-tech-row:hover {
  background: rgba(233, 69, 96, 0.08);
}

.workload-tech-row.unassigned-row {
  background: rgba(255, 152, 0, 0.08);
}

.workload-tech-name {
  font-weight: 600;
  font-size: 13px;
  min-width: 100px;
  flex-shrink: 0;
}

.workload-tech-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.workload-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.workload-badge.total { background: var(--hover-overlay); color: var(--text); }
.workload-badge.done { background: rgba(0,200,83,0.2); color: #4caf50; }
.workload-badge.doing { background: rgba(33,150,243,0.2); color: #42a5f5; }
.workload-badge.road { background: rgba(156,39,176,0.2); color: #ba68c8; }
.workload-badge.waiting { background: rgba(255,152,0,0.2); color: #ffb74d; }

.workload-tech-total {
  font-weight: 700;
  font-size: 18px;
  min-width: 30px;
  text-align: center;
  color: var(--primary);
}

.workload-jobs-preview {
  display: none;
  padding: 0 12px 8px 12px;
}

.workload-jobs-preview.open {
  display: block;
}

.workload-job-mini {
  font-size: 12px;
  padding: 5px 8px;
  margin: 3px 0;
  background: var(--bg-dark);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.workload-job-mini:hover {
  background: rgba(233, 69, 96, 0.12);
}

.workload-job-mini .wj-time {
  font-weight: 600;
  color: var(--info);
  min-width: 42px;
  font-size: 11px;
}

.workload-job-mini .wj-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-job-mini .wj-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

@media (max-width: 500px) {
  .workload-tech-name {
    min-width: 70px;
    font-size: 12px;
  }
  .workload-badge {
    font-size: 10px;
    padding: 1px 5px;
  }
  .daily-workload-content {
    max-height: 250px;
  }
}

/* ==================== ZLECENIE OD SERWISANTA + MIKROFON ==================== */
.input-with-mic {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.input-with-mic input,
.input-with-mic textarea {
  flex: 1;
  min-width: 0;
}

.btn-mic {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-mic:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.btn-mic.mic-active {
  border-color: var(--danger);
  color: white;
  background: var(--danger);
  animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.dictation-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 10px;
}

.dictation-pulse {
  font-size: 10px;
  animation: dictation-blink 0.8s ease-in-out infinite;
}

@keyframes dictation-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.quick-job-card {
  border-left: 3px solid var(--warning) !important;
}

/* ==================== DATY ZLECEŃ ==================== */
.job-date-scheduled {
  font-size: 13px;
}

.job-date-scheduled i {
  width: 18px;
  text-align: center;
  margin-right: 5px;
}

.date-today {
  color: #4CAF50 !important;
}
.date-today i { color: #4CAF50 !important; }

.date-tomorrow {
  color: #2196F3 !important;
}
.date-tomorrow i { color: #2196F3 !important; }

.date-overdue {
  color: #f44336 !important;
}
.date-overdue i { color: #f44336 !important; }

.date-future {
  color: #FF9800 !important;
}
.date-future i { color: #FF9800 !important; }

.date-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.date-badge-today {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
}

.date-badge-tomorrow {
  background: rgba(33, 150, 243, 0.2);
  color: #2196F3;
}

.date-badge-overdue {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  animation: pulse-overdue 2s infinite;
}

@keyframes pulse-overdue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ==================== KLIENCI ====================  */
.clients-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.client-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.client-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.client-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.client-card-info {
  flex: 1;
  min-width: 0;
}

.client-card-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-nip {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.client-card-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.client-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.client-badge.devices {
  background: rgba(33, 150, 243, 0.15);
  color: var(--info);
}

.client-badge.jobs {
  background: rgba(0, 200, 83, 0.15);
  color: var(--success);
}

.client-card-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 52px;
}

.client-card-details i {
  width: 14px;
  color: var(--text-muted);
  margin-right: 6px;
}

/* ==================== URZĄDZENIA ====================  */
.device-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.device-card:hover {
  border-color: var(--info);
}

.device-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(33, 150, 243, 0.12);
  color: var(--info);
  flex-shrink: 0;
}

.device-icon.device-type-kserokopiarka { color: #42a5f5; background: rgba(66, 165, 245, 0.12); }
.device-icon.device-type-drukarka { color: #66bb6a; background: rgba(102, 187, 106, 0.12); }
.device-icon.device-type-skaner { color: #ab47bc; background: rgba(171, 71, 188, 0.12); }
.device-icon.device-type-ploter { color: #ff7043; background: rgba(255, 112, 67, 0.12); }
.device-icon.device-type-skladarka { color: #26c6da; background: rgba(38, 198, 218, 0.12); }

.device-info {
  flex: 1;
  min-width: 0;
}

.device-info strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.device-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

.device-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.device-detail-row {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-left: 46px;
}

.device-detail-row i {
  width: 14px;
  margin-right: 6px;
}

/* ==================== TYP ZLECENIA ====================  */
.job-type-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.job-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 70px;
  text-align: center;
  background: var(--bg-surface);
}

.job-type-option:hover {
  border-color: var(--primary);
}

.job-type-option.active {
  border-color: var(--primary);
  background: rgba(233, 69, 96, 0.12);
}

.job-type-option input[type="radio"] {
  display: none;
}

.job-type-option span {
  font-size: 22px;
  margin-bottom: 4px;
}

.job-type-option small {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.job-type-option.active small {
  color: var(--primary);
}

.job-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.job-type-dzierzawa {
  background: rgba(33, 150, 243, 0.15);
  color: #42a5f5;
}

.job-type-platne {
  background: rgba(255, 152, 0, 0.15);
  color: #ffb74d;
}

.job-type-gwarancja {
  background: rgba(102, 187, 106, 0.15);
  color: #66bb6a;
}

/* ==================== CLIENT SUGGESTIONS (autocomplete) ====================  */
.client-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}

.client-suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.15s;
}

.client-suggestion-item:hover {
  background: var(--bg-surface);
}

.client-suggestion-item:last-child {
  border-bottom: none;
}

/* Client detail job items */
.client-job-item {
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.client-job-item:hover {
  border-color: var(--primary);
}

/* Client detail */
.client-detail {
  padding: 16px;
}

/* Device Picker Modal */
.device-picker-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-card);
}

.device-picker-item:hover {
  border-color: var(--primary);
  background: var(--bg-surface);
}

.device-picker-item.device-picker-selected {
  border-color: var(--success);
  background: rgba(76, 175, 80, 0.08);
}

/* Pływający przycisk Wróć do zleceń */


/* ====== POWIADOMIENIA ADMINA ====== */
#notifications-list {
  padding: 0 8px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
  position: relative;
}

.notification-item:hover {
  background: var(--hover-overlay);
}

.notification-unread {
  background: rgba(59, 130, 246, 0.06);
  border-left: 3px solid var(--primary);
}

.notification-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-card);
}

.notification-body {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 3px;
}

.notification-message {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.notification-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

.notification-time i {
  margin-right: 3px;
  font-size: 10px;
}

.notification-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ==================== PROPOZYCJE ==================== */
.proposals-filters {
  padding: 0 16px 8px;
}

.proposal-card {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.proposal-card:active {
  transform: scale(0.98);
}

.proposal-card .job-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.status-nowa {
  background: var(--warning);
  color: #000;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.status-przedstawiona {
  background: var(--info);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.status-negocjacje {
  background: #6366f1;
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.status-zaakceptowana {
  background: var(--success);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.status-odrzucona {
  background: var(--danger);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* ==================== PODSUMOWANIE PROPOZYCJI ==================== */
.proposal-summary {
  margin: 0 16px 10px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.proposal-summary-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

.proposal-summary-toggle:active {
  background: var(--bg-hover);
}

.proposal-summary-body {
  padding: 0 16px 16px;
}

.summary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 4px;
}

.summary-nav-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  min-width: 160px;
  text-align: center;
}

.summary-nav .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.proposal-summary-block {
  background: var(--bg-main);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.proposal-summary-block:last-child {
  margin-bottom: 0;
}

.proposal-summary-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
}

.proposal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.summary-stat {
  text-align: center;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 8px 4px;
}

.summary-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.summary-stat.stat-success .summary-stat-value {
  color: var(--success);
}

.summary-stat.stat-danger .summary-stat-value {
  color: var(--danger);
}

.summary-stat.stat-warning .summary-stat-value {
  color: var(--warning);
}

.summary-stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.proposal-summary-details {
  font-size: 13px;
}

.summary-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  color: var(--text-secondary);
}

.summary-detail-row strong {
  color: var(--text);
}

/* ==================== ZAKŁADKI PROPOZYCJI ==================== */
.proposal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}

.proposal-tabs::-webkit-scrollbar {
  display: none;
}

.proposal-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.proposal-tab:active {
  transform: scale(0.95);
}

.proposal-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.proposal-tab-count {
  background: rgba(255,255,255,0.2);
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}

.proposal-tab.active .proposal-tab-count {
  background: rgba(255,255,255,0.3);
  color: #fff;
}

.proposal-tab:not(.active) .proposal-tab-count {
  background: var(--bg-main);
  color: var(--text-muted);
}

/* === Kanban Board === */
.proposal-kanban {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 12px;
  min-height: 300px;
}

.proposal-kanban::-webkit-scrollbar {
  height: 4px;
}

.proposal-kanban::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.kanban-column {
  min-width: 220px;
  max-width: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.kanban-count {
  background: var(--bg-main);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.kanban-column-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.kanban-card:active {
  transform: scale(0.97);
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kanban-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px 0;
}

/* === Grupowanie wg firmy === */
.proposal-group-items {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.proposal-group-items.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.proposal-group-items:not(.collapsed) {
  max-height: 5000px;
  opacity: 1;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* Warianty propozycji */
.variant-card {
  background: var(--bg-card);
  transition: transform 0.15s;
}

.variant-card h4 {
  font-size: 14px;
}

.variant-card .detail-row {
  padding: 3px 0;
}

/* ==================== NOTATKI / DO ZROBIENIA ==================== */
.notes-add-bar {
  padding: 12px 0 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-main);
}

.note-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.note-item:active {
  transform: scale(0.98);
}

.note-item.note-done {
  opacity: 0.55;
}

.note-item.note-done .note-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.note-check {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.note-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.note-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.note-time {
  font-size: 11px;
  color: var(--text-muted);
}

.note-delete {
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  border-radius: 8px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.note-delete:hover,
.note-delete:active {
  color: var(--danger);
  background: rgba(244, 67, 54, 0.1);
}

/* ==== PROTOKÓŁ SERWISOWY ==== */

.protocol-form-page {
  padding: 0 12px 100px;
}

.protocol-form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.protocol-form-header h3 {
  font-size: 18px;
  margin: 0;
  flex: 1;
}

.protocol-job-number {
  background: linear-gradient(135deg, var(--primary), #764ba2);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
}

.btn-back-protocol {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.protocol-info-card {
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 8px;
}

.protocol-info-card h4 {
  color: var(--primary);
  font-size: 15px;
  margin-bottom: 10px;
}

.protocol-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  gap: 8px;
}

.protocol-info-row span:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
}

.protocol-info-row strong {
  text-align: right;
}

.protocol-location {
  background: rgba(76, 175, 80, 0.1);
  padding: 8px 10px;
  margin: 8px -6px;
  border-radius: 8px;
  border-left: 3px solid #4caf50;
}

.protocol-fault-card {
  border-left-color: var(--warning);
}
.protocol-fault-card h4 { color: var(--warning); }
.protocol-fault-card p {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 13px;
  color: var(--text);
}

.protocol-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.protocol-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

.protocol-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 480px) {
  .protocol-form-row {
    flex-direction: column;
    gap: 8px;
  }
}

.protocol-field {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.protocol-field.full-width {
  width: 100%;
  margin-bottom: 12px;
}

.protocol-field label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-size: 13px;
}

.protocol-field label.required::after {
  content: ' *';
  color: var(--danger);
}

.protocol-field input[type="text"],
.protocol-field input[type="number"],
.protocol-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s;
}

.protocol-field input:focus,
.protocol-field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.protocol-field textarea {
  resize: vertical;
  min-height: 60px;
}

/* Wykonane czynności — 5 numbered inputs */
.actions-numbered-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-numbered-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-numbered-row .action-number {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.action-numbered-row input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--hover-overlay);
  color: var(--text);
  font-size: 14px;
  transition: border 0.2s;
}

.action-numbered-row input[type="text"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.15);
}

.action-numbered-row input[type="text"]::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Parts table */
.parts-table-wrap {
  overflow-x: auto;
}

.parts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.parts-table th {
  background: var(--primary);
  color: #fff;
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.parts-table td {
  padding: 4px;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.parts-table td input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
}

.part-lp {
  text-align: center;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  width: 35px;
}

.btn-remove-part {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.btn-add-part {
  margin-top: 10px;
  background: var(--success) !important;
  color: #fff !important;
}

.parts-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Billing options */
.billing-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billing-option {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.billing-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(78, 205, 196, 0.08);
}

.billing-option input[type="radio"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.billing-label strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.billing-label small {
  color: var(--text-muted);
  font-size: 12px;
}

/* Status options */
.status-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-option {
  display: flex;
  align-items: center;
  padding: 14px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.status-option:has(input:checked) {
  border-color: var(--primary);
}

.status-completed:has(input:checked) {
  border-color: var(--success);
  background: rgba(76, 175, 80, 0.08);
}

.status-return:has(input:checked) {
  border-color: var(--danger);
  background: rgba(244, 67, 54, 0.08);
}

.status-option input[type="radio"] {
  margin-right: 14px;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.status-option strong {
  display: block;
  font-size: 15px;
  color: var(--text);
}

.status-option small {
  color: var(--text-muted);
  font-size: 12px;
}

.protocol-status-section {
  background: rgba(255, 193, 7, 0.08);
  border-color: var(--warning);
}

/* Signature cards */
.signature-card {
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.signature-card h4 {
  color: var(--primary);
  margin-bottom: 12px;
  font-size: 15px;
}

.required-star {
  color: var(--danger);
}

.signature-canvas {
  width: 100%;
  height: 150px;
  border: 2px dashed var(--primary);
  border-radius: 12px;
  cursor: crosshair;
  background: var(--sig-canvas-bg);
  touch-action: none;
  margin-bottom: 8px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  position: relative;
}

/* Podpowiedź wizualna "Podpisz się tutaj" */
.signature-canvas-wrap {
  position: relative;
  touch-action: none;
  -ms-touch-action: none;
}

.signature-canvas-wrap::before {
  content: '✍️ Podpisz się tutaj palcem lub myszką';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  color: var(--sig-hint-color);
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
  font-weight: 500;
}

.signature-canvas-wrap.has-signature::before {
  display: none;
}

/* Na telefonie — większy canvas */
@media (max-width: 768px) {
  .signature-canvas {
    height: 200px;
    border-width: 3px;
  }
}

@media (max-width: 480px) {
  .signature-canvas {
    height: 180px;
  }
}

.signature-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sig-status {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ============================================================
   EMAIL KLIENTA — wyrazista sekcja wysyłki protokołu
   ============================================================ */

.protocol-email-section {
  border: 2px solid rgba(78, 205, 196, 0.4) !important;
  background: rgba(78, 205, 196, 0.05) !important;
}

.email-highlight-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.08), rgba(102, 126, 234, 0.06));
  border: 2px solid rgba(78, 205, 196, 0.25);
  border-radius: 14px;
}

.email-highlight-icon {
  font-size: 36px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.email-highlight-content {
  flex: 1;
  min-width: 0;
}

.email-highlight-label {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin-bottom: 4px !important;
  display: block;
}

.email-highlight-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

.email-highlight-desc strong {
  color: var(--primary);
}

.email-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.email-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

.email-input-wrap.valid {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.email-input-wrap.invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.email-input-icon {
  font-size: 20px;
  padding: 0 4px 0 14px;
  flex-shrink: 0;
  line-height: 1;
}

.email-highlight-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 14px 16px 14px 8px !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  outline: none !important;
  box-shadow: none !important;
  letter-spacing: 0.3px;
}

.email-highlight-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 15px;
}

.email-validation-msg {
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.email-validation-msg.valid {
  color: #28a745;
}

.email-validation-msg.invalid {
  color: #dc3545;
}

@media (max-width: 480px) {
  .email-highlight-box {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .email-highlight-icon {
    font-size: 28px;
  }
  .email-highlight-input {
    font-size: 16px !important;
    padding: 12px 12px 12px 6px !important;
  }
}

/* Submit button */
.btn-protocol-submit {
  width: 100%;
  padding: 16px !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--primary), #764ba2) !important;
  border: none !important;
  color: #fff !important;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.btn-protocol-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Success screen */
.protocol-success {
  text-align: center;
  padding: 40px 20px;
}

.protocol-success-icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: protocolBounce 0.8s ease;
}

@keyframes protocolBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
}

.protocol-success h2 {
  color: var(--success);
  margin-bottom: 10px;
  font-size: 24px;
}

.protocol-success p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 14px;
}

.protocol-success-info {
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  padding: 14px;
  border-radius: 8px;
  text-align: left;
  margin-bottom: 24px;
  font-size: 13px;
}

.protocol-success-info div {
  margin-bottom: 6px;
}

.protocol-success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.protocol-success-actions .btn {
  padding: 14px;
  font-size: 15px;
  border-radius: 10px;
}

/* ============================================================
   CLIENT SIGNATURE — tryb tekstowy / ręczny
   ============================================================ */

.client-sig-text-preview {
  border: 2px dashed var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-height: 55px;
}

#btn-client-draw-toggle {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--hover-overlay);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

#btn-client-draw-toggle:hover {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--primary);
}

/* ============================================================
   TEXT SIGNATURE GENERATOR
   ============================================================ */

.text-sig-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--hover-overlay);
}

.text-sig-card:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.text-sig-card.selected {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.08);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.text-sig-card.selected::after {
  content: '✅';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 16px;
}

.text-sig-card {
  position: relative;
}

.text-sig-cat-btn {
  background: var(--bg-surface) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border) !important;
  transition: all 0.2s ease;
}

.text-sig-cat-btn:hover {
  background: var(--hover-overlay) !important;
  color: var(--text) !important;
}

.text-sig-cat-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Scrollbar w generatorze podpisów */
#text-sig-list-container::-webkit-scrollbar {
  width: 6px;
}

#text-sig-list-container::-webkit-scrollbar-track {
  background: var(--hover-overlay);
  border-radius: 3px;
}

#text-sig-list-container::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

#text-sig-list-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Responsywność — na małych ekranach 1 kolumna */
@media (max-width: 500px) {
  #text-sig-list {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   THEME TOGGLE UI
   ============================================================ */
.theme-toggle-row {
  display: flex;
  gap: 14px;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--bg-surface);
}

.theme-option:hover {
  border-color: var(--primary);
  background: var(--hover-overlay);
}

.theme-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.25);
}

.theme-option span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-preview {
  width: 80px;
  height: 50px;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid rgba(128,128,128,0.2);
}

.theme-preview.dark-preview {
  background: #0f0f23;
}

.theme-preview.light-preview {
  background: #f0f2f5;
}

.theme-preview .tp-header {
  height: 8px;
  border-radius: 3px;
  width: 60%;
}

.theme-preview .tp-line {
  height: 5px;
  border-radius: 2px;
  width: 100%;
}

.theme-preview .tp-line.short {
  width: 70%;
}

.dark-preview .tp-header {
  background: #e94560;
}
.dark-preview .tp-line {
  background: rgba(255,255,255,0.12);
}

.light-preview .tp-header {
  background: #d63851;
}
.light-preview .tp-line {
  background: rgba(0,0,0,0.1);
}

/* Light theme scrollbar overrides */
[data-theme="light"] #text-sig-list-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] #text-sig-list-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] #text-sig-list-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Light theme global scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ==================== MODUŁ GWARANCJI ==================== */
.warranty-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border-left: 4px solid var(--success);
}
.warranty-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.warranty-card.warranty-expired { border-left-color: var(--danger); }
.warranty-card.warranty-ending { border-left-color: #f39c12; }
.warranty-card.warranty-active { border-left-color: var(--success); }

.warranty-card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.warranty-card-client { font-size: 14px; }
.warranty-card-client strong { color: var(--text); }
.warranty-status-icon { font-size: 14px; }

.warranty-contract-badge {
  background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
}
.warranty-contract-badge-lg {
  background: var(--primary); color: #fff; padding: 4px 16px; border-radius: 20px;
  font-size: 14px; font-weight: 700;
}

.warranty-card-body { font-size: 13px; color: var(--text-muted); }
.warranty-device { margin-bottom: 4px; }
.warranty-device i { margin-right: 4px; }
.warranty-dates { display: flex; gap: 16px; margin-bottom: 6px; font-size: 12px; }
.warranty-dates i { margin-right: 3px; }

.warranty-timer {
  font-size: 13px; font-weight: 600; padding: 4px 0;
}
.warranty-timer.warranty-active { color: var(--success); }
.warranty-timer.warranty-ending { color: #f39c12; }
.warranty-timer.warranty-expired { color: var(--danger); }
.warranty-timer i { margin-right: 4px; }

.warranty-card-footer {
  display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 8px;
}
.warranty-card-footer i { margin-right: 3px; }
.warranty-price { margin-left: auto; font-weight: 600; color: var(--text); }

/* Detail view */
.warranty-big-timer {
  text-align: center; padding: 24px 16px; border-radius: 16px; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(46,204,113,0.15), rgba(46,204,113,0.05));
  border: 2px solid var(--success);
}
.warranty-big-timer.warranty-expired {
  background: linear-gradient(135deg, rgba(231,76,60,0.15), rgba(231,76,60,0.05));
  border-color: var(--danger);
}
.warranty-big-timer.warranty-ending {
  background: linear-gradient(135deg, rgba(243,156,18,0.15), rgba(243,156,18,0.05));
  border-color: #f39c12;
}
.warranty-timer-label { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.warranty-big-timer.warranty-active .warranty-timer-label { color: var(--success); }
.warranty-big-timer.warranty-expired .warranty-timer-label { color: var(--danger); }
.warranty-big-timer.warranty-ending .warranty-timer-label { color: #f39c12; }

.warranty-timer-countdown {
  font-size: 32px; font-weight: 800; font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text); margin-bottom: 6px; letter-spacing: 2px;
}
.warranty-timer-end { font-size: 12px; color: var(--text-muted); }

.warranty-section {
  background: var(--bg-card); border-radius: 12px; padding: 16px; margin-bottom: 12px;
}
.warranty-section h4 {
  font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--primary);
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.warranty-section h4 i { margin-right: 6px; }

.warranty-info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.warranty-info-grid > div { font-size: 13px; }
.warranty-info-grid label {
  display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 2px;
}
.warranty-info-grid span { color: var(--text); font-weight: 500; }

@media (max-width: 480px) {
  .warranty-info-grid { grid-template-columns: 1fr; }
}

.warranty-reviews-list { margin-top: 12px; }
.warranty-review-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.warranty-review-item:last-child { border-bottom: none; }
.warranty-review-item i { color: var(--success); }

.warranty-files-list { display: flex; flex-direction: column; gap: 6px; }
.warranty-file-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg-input); border-radius: 8px; font-size: 13px;
}
.warranty-file-link { color: var(--primary); text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warranty-file-link:hover { text-decoration: underline; }
.warranty-file-link i { margin-right: 6px; }
.warranty-file-size { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

/* Form */
.warranty-form { padding: 0; }
.warranty-form .form-group { margin-bottom: 14px; }
.warranty-form .form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.warranty-form .form-group label i { margin-right: 4px; color: var(--primary); }
.warranty-form input, .warranty-form select, .warranty-form textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
  font-size: 14px; box-sizing: border-box;
}
.warranty-form small { display: block; margin-top: 3px; }
.warranty-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .warranty-form .form-row { grid-template-columns: 1fr; } }
.warranty-form .form-section-title {
  font-size: 15px; font-weight: 700; color: var(--primary); margin: 20px 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--primary);
}
.warranty-form .form-section-title i { margin-right: 6px; }

/* Filter tabs for warranties */
.warranty-filter-tab {
  display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 12px;
  background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s; margin-right: 4px;
}
.warranty-filter-tab:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.warranty-filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
