/* ==========================================================================
   QALIS NOVA DÉPANNAGE - Design System & Modern UI
   ========================================================================== */

:root {
  /* Color Palette - Deep Slate & Electric Aqua/Blue */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(56, 189, 248, 0.3);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Accent & Status Colors */
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  
  --status-new: #38bdf8;
  --status-pending: #f59e0b;
  --status-validated: #8b5cf6;
  --status-in-progress: #06b6d4;
  --status-done: #10b981;
  --status-urgent: #ef4444;

  --whatsapp-green: #25d366;
  --whatsapp-hover: #1ebd56;

  /* Geometry & Shadow */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --glass-backdrop: blur(16px);

  /* Fonts */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.08) 0%, transparent 45%);
}

/* Layout Grid */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.brand-text h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text h2 span {
  color: var(--accent-cyan);
}

.brand-text p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: left;
}

.nav-item i {
  font-size: 20px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--status-pending);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.nav-item .badge.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-cyan);
  border: 1px solid var(--border-highlight);
}

.user-info .name {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.user-info .role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 32px;
  max-width: 1600px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-stats-pill {
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid rgba(37, 211, 102, 0.3);
  padding: 8px 16px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--whatsapp-green);
}

.whatsapp-color {
  color: var(--whatsapp-green);
}

.pdf-icon-color {
  color: #ef4444;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-whatsapp {
  background: var(--whatsapp-green);
  color: #ffffff;
}

.btn-whatsapp:hover {
  background: var(--whatsapp-hover);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

.btn-success {
  background: #10b981;
  color: #fff;
}

.btn-large {
  padding: 14px 24px;
  font-size: 15px;
}

.full-width {
  width: 100%;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-cyan);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.btn-text:hover {
  text-decoration: underline;
}

/* Dispatch Flex Buttons */
.dispatch-options-card {
  margin-top: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.dispatch-options-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
}

.dispatch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.flex-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
}

.flex-btn i {
  font-size: 24px;
}

.flex-btn strong {
  display: block;
  font-size: 13px;
}

.flex-btn small {
  font-size: 11px;
  opacity: 0.8;
}

/* Tab Panels */
.tab-page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-main);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-icon.blue { background: rgba(56, 189, 248, 0.15); color: var(--status-new); }
.kpi-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--status-pending); }
.kpi-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--status-done); }
.kpi-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--status-validated); }

.kpi-details {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  margin: 2px 0;
}

.kpi-trend {
  font-size: 11px;
  color: var(--status-done);
  font-weight: 600;
}

.kpi-subtext {
  font-size: 11px;
  color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-urgent {
  color: var(--status-urgent);
}

.input-search {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  width: 220px;
}

.input-search:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Data Table */
.table-wrapper {
  overflow-x: auto;
}

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

.data-table th {
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-status-select {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.badge-status-select::-ms-expand {
  display: none;
}

.badge-status-select:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.badge-status-select:focus {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.badge-status-select option {
  background: #1c1c1c;
  color: #ffffff;
  font-size: 13px;
  padding: 8px 12px;
}

.status-NEW {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--status-new);
  border: 1px solid rgba(56, 189, 248, 0.35);
  background-image: none !important;
}

.status-SENT_SYNDIC {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--status-pending);
  border: 1px solid rgba(245, 158, 11, 0.35);
  background-image: none !important;
}

.status-VALIDATED {
  background-color: rgba(139, 92, 246, 0.15);
  color: var(--status-validated);
  border: 1px solid rgba(139, 92, 246, 0.35);
  background-image: none !important;
}

.status-REFUSED {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background-image: none !important;
}

.status-IN_PROGRESS {
  background-color: rgba(6, 182, 212, 0.15);
  color: var(--status-in-progress);
  border: 1px solid rgba(6, 182, 212, 0.35);
  background-image: none !important;
}

.status-DONE {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--status-done);
  border: 1px solid rgba(16, 185, 129, 0.35);
  background-image: none !important;
}

/* Team Mini Cards */
.team-mini-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.tech-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.tech-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tech-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.tech-name {
  font-size: 13px;
  font-weight: 600;
}

.tech-task {
  font-size: 11px;
  color: var(--text-muted);
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.indicator.dispo { background: var(--status-done); box-shadow: 0 0 8px var(--status-done); }
.indicator.occupied { background: var(--status-pending); box-shadow: 0 0 8px var(--status-pending); }

.syndic-quick-access h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.syndic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.syndic-chip {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-secondary);
}

/* Interventions Cards (Tab 2) */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group.right {
  margin-left: auto;
}

.select-field, .input-field {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
}

.select-field:focus, .input-field:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.interventions-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.intervention-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.2s ease;
}

.intervention-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-ref {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 14px;
}

.card-syndic {
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}

.card-body-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-item i {
  color: var(--accent-cyan);
}

.card-price-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.price-amount {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

/* ==========================================
   TECHNICIAN FIELD CARD (PALETTE OFFICIELLE QALIS NOVA : #1c1c1c, #f2f1ed, #d69b31)
   ========================================== */
.tech-card {
  background: #1c1c1c !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-lg);
  padding: 20px !important;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0 !important;
}

.tech-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #d69b31;
}

.tech-card:hover {
  transform: translateY(-2px);
  border-color: #d69b31 !important;
}

.tech-card-header {
  margin-bottom: 14px;
}

.tech-card-ref {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: #d69b31;
  letter-spacing: 0.5px;
}

.tech-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #f2f1ed;
  margin-top: 4px;
  line-height: 1.3;
}

.tech-slot-pill {
  background: rgba(214, 155, 49, 0.12);
  border: 1px solid rgba(214, 155, 49, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tech-slot-date {
  font-size: 13px;
  font-weight: 600;
  color: #d69b31;
}

.tech-slot-time {
  font-size: 13px;
  font-weight: 700;
  color: #f2f1ed;
}

.tech-card-block {
  background: #272727;
  border: 1px solid #363636;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.tech-block-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tech-block-value {
  font-size: 14px;
  font-weight: 700;
  color: #f2f1ed;
  margin-bottom: 2px;
}

.tech-notes-block {
  font-size: 12px;
  color: #d69b31;
  background: rgba(214, 155, 49, 0.12);
  border-left: 3px solid #d69b31;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.tech-complete-btn {
  background: #f2f1ed !important;
  color: #1c1c1c !important;
  font-weight: 800;
  font-size: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: none;
  box-shadow: 0 4px 14px rgba(242, 241, 237, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tech-complete-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(242, 241, 237, 0.4);
  background: #ffffff !important;
}

.tech-complete-btn.completed {
  background: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
  box-shadow: none;
  border: 1px solid #363636;
}

/* SLIDE SWITCH FOR TECHNICIAN COMPLETION */
.completion-slide-container {
  background: rgba(16, 185, 129, 0.1);
  border: 1px dashed rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.completion-slide-container label {
  font-size: 12px;
  font-weight: 600;
  color: var(--status-done);
  display: flex;
  align-items: center;
  gap: 6px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--status-done);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* TAB 3: NEW BON LAYOUT */
.new-bon-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--accent-cyan);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section {
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.span-2 { grid-column: span 2; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.grid-selector-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.label-sub {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  display: block;
}

.price-items-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}

.picker-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.picker-item input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 16px;
  height: 16px;
}

.border-bottom { border-bottom: 1px solid var(--border-color); padding-bottom: 16px; margin-bottom: 20px; }
.border-top { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: 24px; }

.ref-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* Document Preview Panel */
.bon-preview-document {
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 16px;
}

.company-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #1c1c1c;
}

.company-logo img {
  width: 58px;
  height: 58px;
  padding: 5px;
  object-fit: contain;
  background: #1c1c1c;
  border: 1px solid #1c1c1c;
}

.company-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.company-logo strong {
  display: block;
  color: #1c1c1c;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.company-logo span {
  color: #1c1c1c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  margin-top: 2px;
}

.company-logo small {
  color: #77756e;
  font-size: 8px;
  margin-top: 5px;
}

.doc-ref-box { text-align: right; }
.ref-title { display: block; font-size: 11px; font-weight: 700; color: #6b7280; }
.ref-num { font-size: 16px; font-weight: 800; color: #111827; }

.doc-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
}

.doc-breakdown h4 {
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 8px;
}

.breakdown-list {
  list-style: none;
  margin-bottom: 16px;
}

.breakdown-list li {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #e5e7eb;
}

.empty-msg {
  color: #9ca3af;
  font-style: italic;
}

.doc-totals {
  border-top: 2px solid #e5e7eb;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.total-line {
  font-size: 12px;
  display: flex;
  gap: 20px;
  width: 220px;
  justify-content: space-between;
}

.grand-total {
  font-size: 15px;
  font-weight: 800;
  color: #1c1c1c;
  margin-top: 4px;
}

/* WhatsApp Box */
.whatsapp-box {
  background: rgba(37, 211, 102, 0.05);
  border: 1px solid rgba(37, 211, 102, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
}

.wa-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.wa-icon {
  font-size: 32px;
  color: var(--whatsapp-green);
}

.wa-header h4 {
  font-size: 14px;
  font-weight: 700;
}

.wa-header p {
  font-size: 11px;
  color: var(--text-secondary);
}

.wa-preview-text {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  font-family: monospace;
  white-space: pre-wrap;
  color: #d1d5db;
  margin-bottom: 12px;
  max-height: 140px;
  overflow-y: auto;
}

.wa-actions {
  display: flex;
  gap: 10px;
}

/* Team Grid (Tab 5) */
.team-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.team-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.team-avatar-large {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  animation: modalUp 0.25s ease;
}

@keyframes modalUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-cyan);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s forwards;
}

.toast.success { border-left-color: var(--status-done); }
.toast.whatsapp { border-left-color: var(--whatsapp-green); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* PRINT STYLES — export only the intervention document as an A4 page */
@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  html,
  body {
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    color: #000 !important;
    background: #fff !important;
  }

  .sidebar,
  .topbar,
  .form-panel,
  .preview-panel > .panel-header,
  .dispatch-options-card,
  .toast-container,
  .modal-backdrop,
  .tab-page:not(#tab-new-bon) {
    display: none !important;
  }

  .main-content,
  #tab-new-bon,
  .new-bon-layout,
  .preview-panel {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #bon-preview-doc {
    display: block !important;
    width: 190mm !important;
    max-width: 190mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 10mm !important;
    color: #1c1c1c !important;
    background: #fff !important;
    border: 1px solid #d8d7d1 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    break-inside: avoid;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* ==========================================================================
   QALIS NOVA — Brand-aligned operational interface
   Visual language derived from qalis-nova.com: graphite, warm ivory,
   square geometry, strong typographic hierarchy and restrained accents.
   ========================================================================== */

:root {
  --bg-primary: #f2f1ed;
  --bg-secondary: #1c1c1c;
  --bg-card: #ffffff;
  --bg-card-hover: #faf9f6;
  --border-color: #deddd7;
  --border-highlight: #b9b8b2;
  --text-primary: #1c1c1c;
  --text-secondary: #696862;
  --text-muted: #929088;
  --accent-cyan: #1c1c1c;
  --accent-blue: #3d3d3b;
  --accent-gradient: linear-gradient(135deg, #1c1c1c 0%, #3b3b39 100%);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --shadow-main: 0 18px 50px rgba(28, 28, 28, 0.08);
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg-primary);
  background-image:
    linear-gradient(rgba(28, 28, 28, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 28, 28, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text-primary);
}

.sidebar {
  width: 256px;
  padding: 24px 18px;
  color: #fff;
  background: #1c1c1c;
  border-right: 0;
}

.brand {
  gap: 14px;
  padding: 0 4px 24px;
  border-color: rgba(255, 255, 255, 0.14);
  margin-bottom: 24px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 56px;
}

.brand-text h2 {
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.16em;
  font-weight: 650;
}

.brand-text p {
  color: rgba(255, 255, 255, 0.48);
  font-size: 10px;
  line-height: 1.35;
  margin-top: 3px;
}

.brand-text .brand-activity {
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.25em;
}

.brand-text > span {
  display: block;
  color: rgba(255, 255, 255, 0.42);
  font-size: 9px;
  margin-top: 4px;
}

.nav-menu {
  gap: 4px;
}

.nav-item {
  min-height: 48px;
  padding: 12px 13px;
  color: rgba(255, 255, 255, 0.62);
  border-radius: 4px;
  font-size: 13px;
  letter-spacing: 0.005em;
}

.nav-item i {
  font-size: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: #1c1c1c;
  background: #edede9;
  box-shadow: none;
}

.nav-item .badge {
  background: #d69b31;
  color: #1c1c1c;
}

.nav-item .badge.secondary {
  background: rgba(28, 28, 28, 0.12);
  color: inherit;
}

.sidebar-footer {
  border-color: rgba(255, 255, 255, 0.14);
}

.user-card {
  background: rgba(255, 255, 255, 0.06);
}

.avatar {
  border-radius: 4px;
  color: #1c1c1c;
  background: #edede9;
  border: 0;
}

.user-info .name { color: #fff; }
.user-info .role { color: rgba(255, 255, 255, 0.45); }

.main-content {
  margin-left: 256px;
  max-width: none;
  padding: 34px 40px 56px;
}

.topbar {
  position: relative;
  align-items: flex-start;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 28px;
}

.page-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.page-title h1 {
  font-size: clamp(26px, 2.4vw, 38px);
  font-weight: 620;
  letter-spacing: -0.035em;
}

.page-title p {
  color: var(--text-secondary);
  margin-top: 7px;
}

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

.quick-stats-pill {
  color: #267449;
  background: #e7f2e9;
  border-color: #c9dfce;
  border-radius: 4px;
}

.btn {
  border-radius: 3px;
  min-height: 40px;
  box-shadow: none;
}

.btn-primary {
  color: #fff;
  background: #1c1c1c;
  box-shadow: none;
}

.btn-primary:hover {
  background: #383836;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(28, 28, 28, 0.16);
}

.btn-secondary {
  color: var(--text-primary);
  background: #fff;
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #f7f6f2;
}

.btn-text {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.glass-panel,
.kpi-card,
.intervention-card,
.team-card,
.modal-card {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-main);
  backdrop-filter: none;
}

.kpi-grid {
  gap: 14px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 140px;
  border-radius: 6px;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #1c1c1c;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 3px;
}

.kpi-icon.blue { background: #e6edf2; color: #2c5d78; }
.kpi-icon.orange { background: #f5ead7; color: #96631d; }
.kpi-icon.green { background: #e4efe6; color: #33714a; }
.kpi-icon.purple { background: #ebe7ef; color: #655076; }
.kpi-value { color: #1c1c1c; }

.dashboard-grid {
  gap: 18px;
  grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr);
}

.glass-panel {
  border-radius: 6px;
  min-width: 0;
}

.main-panel,
.side-panel,
.table-wrapper {
  min-width: 0;
}

.panel-header {
  border-color: var(--border-color);
}

.panel-header h3,
.section-title {
  color: var(--text-primary);
}

.input-field,
.select-field,
.input-search,
textarea {
  color: var(--text-primary);
  background: #fbfaf7;
  border-color: #cfcec8;
  border-radius: 3px;
}

.input-field:focus,
.select-field:focus,
.input-search:focus,
textarea:focus {
  border-color: #1c1c1c;
  box-shadow: 0 0 0 3px rgba(28, 28, 28, 0.08);
}

.data-table th {
  color: #74726b;
  background: #f6f5f1;
  border-color: var(--border-color);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table td {
  color: var(--text-primary);
  border-color: #e7e6e1;
}

.data-table tbody tr:hover {
  background: #faf9f6;
}

.intervention-card {
  border-radius: 6px;
}

.card-price-tag,
.completion-slide-container,
.tech-status-card,
.syndic-chip {
  background: #f6f5f1;
  border-color: var(--border-color);
}

.price-amount {
  color: #1c1c1c;
}

.tech-avatar,
.team-avatar-large {
  border-radius: 3px;
  background: #1c1c1c;
}

.modal-backdrop {
  background: rgba(20, 20, 19, 0.72);
}

.modal-card {
  border-radius: 6px;
}

.toast {
  color: #fff;
  background: #1c1c1c;
  border-radius: 3px;
}

/* Branded quote / intervention document */
.bon-preview-document {
  color: #1c1c1c;
  background: #fff;
  border: 1px solid #d8d7d1;
  border-radius: 2px;
  box-shadow: 0 16px 40px rgba(28, 28, 28, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.bon-preview-document * {
  font-family: inherit;
}

.doc-header {
  border-bottom: 1px solid #1c1c1c;
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.doc-ref-box {
  padding-left: 18px;
  border-left: 1px solid #d8d7d1;
}

.ref-title {
  color: #77756e;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.ref-num {
  color: #1c1c1c;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.doc-meta-grid {
  color: #1c1c1c;
  background: #f2f1ed;
  border: 1px solid #e0dfda;
  border-radius: 2px;
  padding: 14px;
}

.doc-meta-grid strong,
.doc-breakdown h4 {
  color: #1c1c1c;
  font-weight: 700;
}

.doc-meta-grid small {
  color: #77756e;
}

.breakdown-list li {
  border-color: #d8d7d1;
}

.doc-totals {
  border-color: #1c1c1c;
}

.grand-total {
  padding-top: 6px;
  border-top: 1px solid #1c1c1c;
}

.bon-preview-document .total-line {
  width: 100%;
  max-width: 280px;
}

.bon-preview-document .total-line span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
}

.doc-conditions {
  margin-top: 18px;
  padding-top: 12px;
  color: #66645e;
  border-top: 1px solid #d8d7d1;
  font-size: 9px;
  line-height: 1.45;
}

.doc-company-footer {
  margin-top: 8px;
  padding-top: 8px;
  color: #1c1c1c;
  border-top: 1px solid #d8d7d1;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wa-preview-text {
  color: #fff;
  background: #111;
  border: 1px solid #343434;
  box-shadow: inset 3px 0 0 var(--whatsapp-green);
}

/* Dedicated travel selection */
.travel-selector-box {
  margin-top: 16px;
  padding: 16px;
  background: #f3eee2;
  border: 1px solid #d9c9a8;
  border-left: 4px solid #a67525;
  border-radius: 4px;
}

.client-prefill-notice {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 0;
  margin-top: 6px;
  color: #5e674f;
  font-size: 9px;
  line-height: 1.4;
}

.client-prefill-notice:empty {
  display: none;
}

.travel-selector-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: #1c1c1c;
}

.travel-selector-heading > i {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  color: #fff;
  background: #8d641f;
  border-radius: 3px;
  font-size: 19px;
}

.travel-selector-heading strong,
.travel-selector-heading small {
  display: block;
}

.travel-selector-heading small {
  margin-top: 2px;
  color: #776a53;
  font-size: 11px;
}

.travel-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.travel-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 10px;
  color: #1c1c1c;
  background: #fff;
  border: 1px solid #d9c9a8;
  border-radius: 3px;
  cursor: pointer;
}

.travel-item:has(input:checked) {
  border-color: #8d641f;
  box-shadow: 0 0 0 2px rgba(141, 100, 31, 0.13);
}

.travel-item input {
  accent-color: #8d641f;
}

.travel-item strong,
.travel-item small {
  display: block;
}

.travel-item strong {
  font-size: 12px;
}

.travel-item small {
  margin-top: 2px;
  color: #77756e;
  font-size: 10px;
}

.travel-none {
  background: #faf9f6;
}

/* Clients & history */
.clients-header .input-search {
  width: min(360px, 100%);
}

.clients-history-grid {
  display: grid;
  gap: 14px;
}

.client-history-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 5px;
}

.client-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
}

.client-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.client-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: #fff;
  background: #1c1c1c;
  border-radius: 3px;
  font-weight: 700;
}

.client-identity h4 {
  font-size: 15px;
}

.client-identity a {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-summary {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 0 6px;
  text-align: right;
}

.client-summary > strong {
  font-size: 20px;
}

.client-summary > span {
  color: var(--text-muted);
  font-size: 10px;
}

.client-summary > b {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: #1c1c1c;
  font-size: 13px;
}

.client-history-details {
  border-top: 1px solid var(--border-color);
}

.client-history-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  color: var(--text-secondary);
  background: #f7f6f2;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.client-history-details[open] summary i {
  transform: rotate(180deg);
}

.client-history-list {
  padding: 0 18px;
}

.client-history-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto 90px;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid #ecebe7;
  font-size: 12px;
}

.client-history-row:last-child {
  border-bottom: 0;
}

.client-history-row > div strong,
.client-history-row > div span {
  display: block;
}

.client-history-row > div span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.client-history-amount {
  color: #1c1c1c;
  text-align: right;
}

.client-history-document {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
}

.invoice-folder-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  color: #fff;
  background: #1c1c1c;
  border: 0;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}

.invoice-pending {
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.clients-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--text-muted);
  gap: 8px;
}

.clients-empty i {
  font-size: 32px;
}

/* Email verification */
.email-preview-modal {
  max-width: 720px;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.email-preview-body {
  min-height: 310px;
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.email-preview-note {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  color: #5f594d;
  background: #f3eee2;
  border: 1px solid #ded2ba;
  font-size: 11px;
}

.completion-preview-modal {
  max-width: 760px;
}

.completion-invoice-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  background: #d8d7d1;
  border: 1px solid #d8d7d1;
}

.completion-invoice-summary > div {
  padding: 12px;
  background: #f7f6f2;
}

.completion-invoice-summary span,
.completion-invoice-summary strong {
  display: block;
}

.completion-invoice-summary span {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.completion-invoice-summary strong {
  color: #1c1c1c;
  font-size: 12px;
}

.invoice-view-modal {
  max-width: 760px;
}

.invoice-document {
  padding: 26px;
  color: #1c1c1c;
  background: #fff;
  border: 1px solid #d8d7d1;
}

.invoice-document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid #1c1c1c;
}

.invoice-document-head > div {
  display: flex;
  flex-direction: column;
}

.invoice-document-head > div:first-child strong {
  letter-spacing: 0.14em;
}

.invoice-document-head > div:first-child span {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.invoice-document-head > div:last-child {
  text-align: right;
}

.invoice-document-head small {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.invoice-document-head > div:first-child small {
  margin-top: 7px;
  letter-spacing: 0;
}

.invoice-meta-grid,
.invoice-address-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.invoice-legal-block,
.invoice-dates-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
}

.invoice-legal-block small,
.invoice-client-block small {
  margin-bottom: 4px;
  color: #77746d;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.invoice-dates-block {
  padding: 12px;
  background: #f2f1ed;
}

.invoice-dates-block span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.invoice-client-block {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  margin: 0;
  padding: 14px;
  background: #f2f1ed;
  font-size: 11px;
}

.invoice-client-block span {
  margin-top: 3px;
  color: #66645e;
}

.invoice-lines {
  margin-top: 18px;
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.invoice-lines th,
.invoice-lines td {
  padding: 9px;
  border-bottom: 1px solid #deddd7;
  text-align: left;
}

.invoice-lines th:last-child,
.invoice-lines td:last-child {
  text-align: right;
}

.invoice-lines th:nth-child(n+3),
.invoice-lines td:nth-child(n+3) {
  white-space: nowrap;
  text-align: right;
}

.invoice-lines small {
  display: block;
  color: var(--text-muted);
}

.invoice-totals {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}

.invoice-totals span {
  display: flex;
  justify-content: space-between;
  width: 250px;
  font-size: 11px;
}

.invoice-totals span:last-child {
  padding-top: 7px;
  border-top: 1px solid #1c1c1c;
  font-size: 14px;
  font-weight: 700;
}

.invoice-payment-terms {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #deddd7;
  color: #595750;
  font-size: 9px;
}

.invoice-payment-terms strong {
  color: #1c1c1c;
}

@media print {
  body.printing-invoice .sidebar,
  body.printing-invoice .topbar,
  body.printing-invoice .main-content,
  body.printing-invoice .toast-container,
  body.printing-invoice .modal-backdrop:not(#modal-invoice) {
    display: none !important;
  }

  body.printing-invoice #modal-invoice {
    position: static !important;
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.printing-invoice #modal-invoice .modal-card {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-invoice #modal-invoice .modal-header,
  body.printing-invoice #modal-invoice .modal-footer {
    display: none !important;
  }

  body.printing-invoice #modal-invoice .modal-body {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.printing-invoice #modal-invoice .invoice-document {
    display: block !important;
    box-sizing: border-box !important;
    width: 190mm !important;
    min-height: 277mm !important;
    margin: 0 !important;
    padding: 10mm !important;
    border: 0 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* Unified inbound inbox */
.inbound-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px;
}

.inbound-toolbar-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 170px 180px;
  gap: 10px;
  flex: 1;
}

.inbound-toolbar .input-search {
  max-width: none;
}

.inbound-sync-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  padding: 11px 14px;
  color: #5d553f;
  background: #f3eee2;
  border: 1px solid #ded2ba;
  border-radius: 4px;
}

.inbound-sync-banner > i {
  font-size: 20px;
}

.inbound-sync-banner strong,
.inbound-sync-banner span {
  display: block;
}

.inbound-sync-banner strong {
  font-size: 11px;
}

.inbound-sync-banner span {
  margin-top: 2px;
  font-size: 10px;
}

.inbound-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(480px, 1.45fr);
  gap: 16px;
  align-items: start;
}

.inbound-list-panel,
.inbound-detail-panel {
  padding: 0;
  overflow: hidden;
}

.inbound-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px;
  border-bottom: 1px solid var(--border-color);
}

.inbound-list-heading h3 {
  font-size: 16px;
}

.inbound-list-heading span {
  color: var(--text-muted);
  font-size: 10px;
}

.inbound-list {
  max-height: 680px;
  overflow-y: auto;
}

.inbound-message-card {
  display: block;
  width: 100%;
  padding: 15px 18px;
  color: var(--text-primary);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  cursor: pointer;
}

.inbound-message-card:hover,
.inbound-message-card.selected {
  background: #f5f4f0;
}

.inbound-message-card.selected {
  box-shadow: inset 3px 0 0 #1c1c1c;
}

.inbound-message-card.unread > strong {
  font-weight: 800;
}

.inbound-message-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.inbound-message-card time {
  color: var(--text-muted);
  font-size: 9px;
}

.inbound-channel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inbound-channel.email {
  color: #31586d;
  background: #e3edf2;
}

.inbound-channel.whatsapp {
  color: #216b42;
  background: #e2f2e8;
}

.inbound-channel.manual {
  color: #695625;
  background: #f1ead6;
}

.inbound-message-card > strong,
.inbound-card-subject {
  display: block;
}

.inbound-message-card > strong {
  font-size: 13px;
}

.inbound-card-subject {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 650;
}

.inbound-message-card > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 7px 0 10px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.inbound-status {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
}

.inbound-status-new {
  color: #945c12;
  background: #fff3dd;
  border-color: #e7c687;
}

.inbound-status-progress {
  color: #31586d;
  background: #e9f1f5;
  border-color: #bdd1dc;
}

.inbound-status-converted {
  color: #287049;
  background: #e6f2e9;
  border-color: #bdd9c5;
}

.inbound-status-archived {
  color: #6f6d66;
  background: #f0efeb;
  border-color: #d2d0c9;
}

.inbound-list-empty,
.inbound-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 300px;
  padding: 30px;
  color: var(--text-muted);
  text-align: center;
}

.inbound-list-empty i,
.inbound-empty-state i {
  margin-bottom: 10px;
  font-size: 34px;
}

.inbound-empty-state h3 {
  color: var(--text-primary);
  font-size: 17px;
}

.inbound-empty-state p {
  max-width: 360px;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
}

#form-inbound-detail {
  padding: 20px;
}

.inbound-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.inbound-detail-header h3 {
  margin-top: 9px;
  font-size: 20px;
}

.inbound-detail-header p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.inbound-original-message {
  margin: 18px 0;
  padding: 14px;
  background: #f5f4f0;
  border-left: 3px solid #1c1c1c;
}

.inbound-original-message > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
}

.inbound-original-message > div:first-child span {
  color: var(--text-muted);
}

.inbound-original-message .form-group {
  margin-top: 10px;
  margin-bottom: 0;
}

.inbound-original-message textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.inbound-prefill-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 13px;
}

.inbound-prefill-heading > i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: #1c1c1c;
  border-radius: 3px;
}

.inbound-prefill-heading strong,
.inbound-prefill-heading span {
  display: block;
}

.inbound-prefill-heading strong {
  font-size: 13px;
}

.inbound-prefill-heading span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.inbound-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.inbound-detail-actions > div {
  display: flex;
  gap: 7px;
}

.inbound-delete-btn {
  color: #a33838;
  background: #fff;
  border: 1px solid #e1c4c4;
}

.inbound-compose-modal {
  max-width: 720px;
}

.inbound-message-input {
  min-height: 210px;
  resize: vertical;
  line-height: 1.55;
}

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

  .client-history-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .client-summary {
    text-align: left;
  }

  .client-history-row {
    grid-template-columns: 1fr auto;
  }

  .client-history-row > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .completion-invoice-summary {
    grid-template-columns: 1fr;
  }

  .inbound-toolbar,
  .inbound-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .inbound-toolbar-filters,
  .inbound-layout {
    grid-template-columns: 1fr;
  }

  .inbound-detail-actions > div {
    flex-wrap: wrap;
  }
}

@media (min-width: 701px) and (max-width: 1120px) {
  .inbound-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .topbar {
    gap: 24px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .quick-stats-pill {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .new-bon-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body.menu-open {
    overflow: hidden;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.28);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    padding-left: 48px;
    position: relative;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-menu-btn {
    display: inline-grid;
    place-items: center;
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    color: #fff;
    background: #1c1c1c;
    border: 0;
    border-radius: 4px;
    font-size: 20px;
    cursor: pointer;
  }

  .topbar-actions {
    display: flex !important;
    gap: 8px;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page-title h1 {
    font-size: 22px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar,
  .form-row.grid-2,
  .form-row.grid-3 {
    grid-template-columns: 1fr;
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 760px;
  }

  .agenda-section-card .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .agenda-nav-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .agenda-planning-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .agenda-table {
    min-width: 680px !important;
  }

  .tech-card {
    padding: 16px !important;
  }

  .tech-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .tech-slot-pill {
    align-self: flex-start;
  }

  .tech-complete-btn {
    width: 100% !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
  }
}

@media (max-width: 560px) {
  .main-content {
    padding: 16px;
  }

  .topbar {
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .page-title p {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .modal-footer,
  .wa-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .interventions-cards-grid,
  .team-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* AUTH & LOGIN MODAL STYLING - QALIS NOVA BRAND IDENTITY */
.login-modal {
  max-width: 440px;
  border: 1px solid #d69b31 !important;
  background: #1c1c1c !important;
  color: #f2f1ed !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9) !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.login-brand {
  text-align: center;
  width: 100%;
  padding-bottom: 8px;
}

.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(214, 155, 49, 0.4));
}

.login-brand h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  letter-spacing: 0.14em;
  color: #f2f1ed !important;
  margin: 0;
  font-weight: 800;
}

.login-brand .brand-activity {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: #d69b31 !important;
  margin-top: 4px;
}

.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: #9ca3af !important;
  margin-bottom: 20px;
}

.login-modal label {
  color: #f2f1ed !important;
  font-weight: 600;
}

.login-modal .input-field {
  background: #242424 !important;
  color: #f2f1ed !important;
  border: 1px solid #333333 !important;
}

.login-modal .input-field:focus {
  border-color: #d69b31 !important;
  box-shadow: 0 0 0 3px rgba(214, 155, 49, 0.2) !important;
}

.login-modal .input-icon-wrapper i {
  color: #d69b31 !important;
}

.login-modal .btn-primary {
  background: #d69b31 !important;
  color: #1c1c1c !important;
  font-weight: 800 !important;
  border: none !important;
}

.login-error-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper i {
  position: absolute;
  left: 12px;
  color: #d69b31;
  font-size: 16px;
  pointer-events: none;
}

.input-icon-wrapper .input-field {
  padding-left: 38px;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

.btn-logout:hover {
  color: #ef4444;
}

/* INVOICE DOCUMENT LOGO (VISIBILITY ON WHITE PAPER) */
.invoice-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: brightness(0.15) !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* AGENDA PLANNING STYLING */
.agenda-planning-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.agenda-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  table-layout: fixed;
}

.agenda-table th {
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  font-size: 13px;
  text-align: center;
  font-weight: 700;
}

.agenda-table th.today-col {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
}

.agenda-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: top;
  min-height: 110px;
  height: 110px;
}

.agenda-table td.today-cell {
  background: rgba(56, 189, 248, 0.025);
}

.agenda-tech-col {
  width: 170px !important;
  font-weight: 700;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  vertical-align: middle !important;
  text-align: left !important;
  padding-left: 14px !important;
}

.agenda-card-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  margin-bottom: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.agenda-card-item:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.agenda-card-item .agenda-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.agenda-card-item .agenda-ref {
  font-weight: 800;
  color: var(--accent-cyan);
}

.agenda-card-item .agenda-syndic {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.agenda-card-item .agenda-title {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-card-item .agenda-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

