/* ========================================
   АСУБ CRM - Main Styles
   ======================================== */

:root {
  --bg-main: #E7F7FF;
  --bg-sidebar: #D2E7F6;
  --text-main: #000926;
  --card-bg: #FFFFFF;
  --card-border: rgba(0, 9, 38, 0.06);
  --border-light: rgba(0, 9, 38, 0.08);
  --primary: #2563eb;
  --primary-light: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  overflow: hidden;
  height: 100vh;
  color: var(--text-main);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease;
  min-width: 300px;
  max-width: 400px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.toast-message { font-size: 13px; color: #64748b; }
.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
}
.toast-close:hover { color: #64748b; }

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

/* ========== APP LAYOUT ========== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: 200px;
  background-color: var(--bg-sidebar);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: width 0.3s ease;
  overflow: hidden;
  position: relative;
}

.sidebar.collapsed {
  width: 60px;
  padding: 16px 8px;
}

.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }

.sidebar-toggle {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: #667eea;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
  gap: 8px;
}

.sidebar-toggle:hover { background: #5a67d8; }
.sidebar.collapsed .sidebar-toggle { padding: 10px 0; }
.sidebar.collapsed .sidebar-toggle .toggle-text { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  position: relative;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-ai {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  margin-top: auto;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
}

.sidebar-ai:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-ai-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  object-fit: contain;
  border-radius: 6px;
}

.sidebar-ai-text {
  font-weight: 600;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-ai-text { display: none; }
.sidebar.collapsed .sidebar-ai { justify-content: center; padding: 12px 8px; }
.sidebar-ai.active { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-item--active { background: #FFFFFF; }
.nav-item:hover { background: rgba(255, 255, 255, 0.7); }

.nav-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-label {
  font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-badge { display: none !important; }

/* ========== AUTH ========== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 9, 38, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-overlay.hidden { display: none; }

.auth-modal {
  background: #fff;
  border-radius: 20px;
  width: 420px;
  max-width: 95%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
}

.auth-tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border: none;
  background: transparent;
  transition: all 0.2s;
}

.auth-tab:hover { background: var(--bg-main); }
.auth-tab.active {
  background: var(--bg-main);
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.auth-form { padding: 24px; display: none; }
.auth-form.active { display: block; }
.auth-form h3 { margin: 0 0 20px; font-size: 20px; text-align: center; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 14px;
  transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: white;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-tab:hover { background: #f0f9ff; }
.btn-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.module-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.module-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 2px solid var(--border-light);
  font-weight: 600;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
}
.module-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}
.module-table tr:hover { background: #f0f9ff; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: white;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  position: relative;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.kpi-card .kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.3;
}

.kpi-detail-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  min-width: 320px;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.16);
  z-index: 2000;
  display: none;
}
.kpi-detail-popup.show { display: block; }
.kpi-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1999;
  display: none;
}
.kpi-detail-overlay.show { display: block; }

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}
.auth-error.show { display: block; }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.2s;
  position: relative;
}
.user-info:hover { background: rgba(0, 9, 38, 0.05); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-name { font-size: 14px; font-weight: 500; }
.user-logout { font-size: 12px; color: var(--danger); cursor: pointer; }
.user-logout:hover { text-decoration: underline; }

/* ========== MAIN ========== */
.main {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow-y: auto;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.main-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.main-subtitle { font-size: 13px; opacity: 0.8; }

.main-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 20px;
  align-items: flex-start;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 14px 12px;
  border: 1px solid var(--card-border);
}

.card-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 13px;
  margin-bottom: 6px;
}

.card-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-meta { font-size: 12px; opacity: 0.8; }

.section {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 16px 16px 12px;
  border: 1px solid var(--card-border);
  margin-bottom: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 15px;
}

.section-subtitle { font-size: 12px; opacity: 0.8; }

/* ========== AI PANEL ========== */
.ai-panel {
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 16px 16px 12px;
  border: 1px solid var(--card-border);
}

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

.ai-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 15px;
}

.ai-toggle {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 9, 38, 0.12);
  background: #F4FAFF;
  color: var(--text-main);
  cursor: pointer;
}

.ai-toggle:hover { background: #E7F7FF; }
.ai-panel-body { font-size: 13px; }

/* ========== LISTS ========== */
.status-list,
.clients-list,
.calls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.status-item,
.client-item,
.call-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #F4FAFF;
}

/* Screen visibility controlled by JS inline styles */
.screen {
  display: none;
}

/* ========== DEALS (KANBAN) ========== */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.deal-column {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deal-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 4px;
}

.deal-column-count {
  background: rgba(0, 9, 38, 0.06);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
}

.deal-card {
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  padding: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.deal-card:hover {
  border-color: rgba(0, 9, 38, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.deal-name { font-weight: 600; margin-bottom: 4px; }
.deal-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 4px;
}
.deal-amount { font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.deal-status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  text-transform: uppercase;
}

/* ========== TELEPHONY ========== */
.calling-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.calling-card {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  padding: 16px;
  text-align: center;
}

.dialpad-btn {
  padding: 16px 8px;
  font-size: 20px;
  font-weight: 600;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.2;
}

.dialpad-btn:hover { background: #f1f5f9; transform: scale(1.05); }
.dialpad-btn:active { background: #e2e8f0; transform: scale(0.98); }

.calling-value { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.calling-label { font-size: 11px; opacity: 0.8; text-transform: uppercase; }

.calling-progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 9, 38, 0.08);
  margin-top: 10px;
  overflow: hidden;
}

.calling-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

/* ========== CLIENTS ========== */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.contact-card {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.contact-card:hover {
  border-color: rgba(0, 9, 38, 0.4);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-bottom: 10px;
}

.contact-name { font-weight: 600; margin-bottom: 4px; }
.contact-company { font-size: 12px; opacity: 0.8; margin-bottom: 6px; }
.contact-info { font-size: 12px; opacity: 0.9; line-height: 1.5; }

/* ========== MESSENGER ========== */
.messenger-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-light);
  background: var(--card-bg);
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.messenger-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.messenger-tab:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

.messenger-grid {
  display: grid;
  grid-template-columns: 280px minmax(0,1fr);
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 400px;
  overflow: hidden;
}

.messenger-sidebar {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.messenger-sidebar-search { padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
.messenger-sidebar-search input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  font-size: 12px;
  font-family: inherit;
}

.messenger-list {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.messenger-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}

.messenger-item:hover { background: #F4FAFF; }
.messenger-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(14,165,233,0.12));
  border-left: 3px solid var(--primary);
}

.messenger-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.messenger-info { flex: 1; min-width: 0; }
.messenger-name { font-weight: 600; margin-bottom: 2px; }
.messenger-preview {
  font-size: 11px;
  opacity: 0.8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.messenger-chat {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.messenger-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.message-bubble { display: flex; margin-bottom: 4px; }
.message-bubble.own { justify-content: flex-end; }
.message-text-bubble {
  max-width: 60%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.message-bubble:not(.own) .message-text-bubble { background: #F4FAFF; }
.message-bubble.own .message-text-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #FFFFFF;
}

.messenger-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  align-items: center;
}

.messenger-input input {
  flex: 1;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: #F9FAFB;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.attach-btn:hover { background: #F4FAFF; }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #FFFFFF;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Messenger badges */
.messenger-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Message sender name (group chats) */
.msg-sender-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}

/* Message time */
.msg-time {
  font-size: 10px;
  opacity: 0.5;
  text-align: right;
  margin-top: 4px;
}

/* Typing indicator */
.typing-indicator {
  font-size: 11px;
  opacity: 0.6;
  font-style: italic;
  padding: 4px 8px;
}

/* File preview bar */
.messenger-file-preview {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-light);
  background: #F9FAFB;
  overflow-x: auto;
  flex-wrap: wrap;
}
.file-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  font-size: 11px;
}

/* Message attachments */
.msg-attachment {
  margin-top: 6px;
}
.msg-attachment img {
  max-width: 200px;
  border-radius: 8px;
  cursor: pointer;
}
.msg-file-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  font-size: 12px;
}
.msg-file-link:hover { text-decoration: underline; }

/* New chat contact hover */
.new-chat-contact:hover {
  background: #F4FAFF;
}

/* Custom scrollbar for messenger */
.messenger-messages::-webkit-scrollbar,
.messenger-list::-webkit-scrollbar {
  width: 6px;
}
.messenger-messages::-webkit-scrollbar-track,
.messenger-list::-webkit-scrollbar-track {
  background: transparent;
}
.messenger-messages::-webkit-scrollbar-thumb,
.messenger-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 3px;
}
.messenger-messages::-webkit-scrollbar-thumb:hover,
.messenger-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.25);
}

/* ========== MODALS ========== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-content {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 9, 38, 0.06);
}

.modal-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.modal-close { font-size: 22px; cursor: pointer; opacity: 0.6; }
.modal-close:hover { opacity: 1; }

.modal-body {
  padding: 20px 24px 24px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  font-size: 13px;
}

.modal-section-title {
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.7;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ========== AI CHAT WIDGET ========== */
.ai-widget {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 210px;
  width: 380px;
  height: min(500px, calc(100vh - 40px));
  max-height: calc(100vh - 40px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  overflow: hidden;
  flex-direction: column;
  z-index: 10000;
  transition: left 0.3s ease;
}

.ai-widget.open { 
  display: flex; 
}

.ai-widget.collapsed { left: 70px; width: 340px; }

.ai-widget-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.ai-widget-header button {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
}
.ai-widget-header button:hover { opacity: 1; }

.ai-widget-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.ai-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
}

.ai-msg-user {
  align-self: flex-end;
  background: #667eea;
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-msg-bot {
  align-self: flex-start;
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ai-widget-input {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  background: white;
}

.ai-widget-input input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 12px 16px;
  outline: none;
  font-size: 14px;
}
.ai-widget-input input:focus { border-color: #667eea; }

.ai-widget-input button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #667eea;
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-widget-input button:hover { background: #5a67d8; }

/* ========== CLIENT AUTOCOMPLETE ========== */
.client-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 9999;
  max-height: 220px;
  overflow-y: auto;
}
.client-autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.client-autocomplete-item:last-child { border-bottom: none; }
.client-autocomplete-item:hover { background: #f0f4ff; }
.client-autocomplete-item .ac-name { font-weight: 500; font-size: 14px; color: #1e293b; }
.client-autocomplete-item .ac-info { font-size: 12px; color: #94a3b8; }

/* ========== IN PROGRESS SCREEN (NEW) ========== */
.inprogress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.lead-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lead-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.lead-card-name { font-weight: 600; font-size: 16px; }
.lead-card-company { font-size: 12px; opacity: 0.7; }
.lead-card-phone { font-size: 14px; margin: 8px 0; }
.lead-card-source { font-size: 11px; opacity: 0.6; }

.lead-card-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.lead-card-status.new { background: #dbeafe; color: #1d4ed8; }
.lead-card-status.in_progress { background: #d1fae5; color: #047857; }
.lead-card-status.contacted { background: #d1fae5; color: #047857; }
.lead-card-status.callback { background: #fef3c7; color: #b45309; }
.lead-card-status.qualified { background: #e0e7ff; color: #4338ca; }

.lead-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.lead-action-btn {
  flex: 1 1 calc(33% - 6px);
  min-width: 80px;
  padding: 10px 6px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
  white-space: nowrap;
}

.lead-action-btn.call { background: var(--success); color: white; }
.lead-action-btn.call:hover { background: #059669; }
.lead-action-btn.reject { background: #fee2e2; color: var(--danger); }
.lead-action-btn.reject:hover { background: #fecaca; }
.lead-action-btn.deal { background: var(--primary); color: white; }
.lead-action-btn.deal:hover { background: #1d4ed8; }
.lead-action-btn.callback { background: var(--warning); color: white; }
.lead-action-btn.callback:hover { background: #d97706; }
.lead-action-btn.share { background: #dbeafe; color: var(--primary); }
.lead-action-btn.share:hover { background: #bfdbfe; }

/* ========== SUPERVISOR SCREEN (NEW) ========== */
.supervisor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.supervisor-panel {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.supervisor-panel-header {
  padding: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.05), rgba(14,165,233,0.05));
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.supervisor-panel-title {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.supervisor-panel-body {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.control-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.control-table th {
  text-align: left;
  padding: 10px 8px;
  background: #f8fafc;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.8;
}

.control-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
}

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

.ai-log-item {
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 10px;
  border-left: 3px solid #667eea;
}

.ai-log-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.ai-log-user { font-weight: 600; }
.ai-log-time { opacity: 0.6; }
.ai-log-query { font-size: 13px; margin-bottom: 4px; }
.ai-log-response { font-size: 12px; opacity: 0.8; }

.chat-preview-item {
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-preview-item:hover { background: #e0f2fe; }

.chat-preview-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.chat-preview-name { font-weight: 600; font-size: 14px; }
.chat-preview-time { font-size: 11px; opacity: 0.6; }
.chat-preview-last { font-size: 13px; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100% !important;
    height: auto !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 8px 12px;
    gap: 4px;
  }
  .sidebar .sidebar-logo { display: none; }
  .sidebar .sidebar-toggle { display: none; }
  .sidebar .sidebar-ai { display: none; }
  .sidebar .sidebar-nav {
    display: flex;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    width: 100%;
    flex: 1;
  }
  .sidebar .nav-separator { display: none; }
  .sidebar .nav-item {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 12px;
  }
  .sidebar .nav-label { font-size: 11px; }
  .sidebar .nav-badge {
    position: static;
    margin-left: 4px;
  }
  .main { padding: 12px; gap: 12px; }
  .main-header { flex-wrap: wrap; gap: 8px; }
  .main-title { font-size: 18px; }
  .main-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deals-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .contacts-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .messenger-grid {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }
  .messenger-sidebar {
    max-height: 250px;
    overflow-y: auto;
  }
  .messenger-chat {
    min-height: 400px;
  }
  .modal-body { grid-template-columns: 1fr; }
  .supervisor-grid { grid-template-columns: 1fr; }
  .section-header { flex-wrap: wrap; gap: 8px; }
  .section-header h2 { font-size: 18px; }
  .messenger-tabs { flex-wrap: wrap; }
  .lead-card-actions { flex-wrap: wrap; }
  .client-item, .call-item, .status-item {
    flex-wrap: wrap;
  }
  .user-header { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 768px) {
  .sidebar .nav-label { display: none; }
  .sidebar .nav-item { padding: 8px; justify-content: center; }
  .cards-grid { grid-template-columns: 1fr; }
  .deals-grid { grid-template-columns: 1fr; }
  .contacts-grid { grid-template-columns: 1fr; }
  .modal-content {
    width: 95% !important;
    max-width: none !important;
    margin: 10px auto;
    padding: 16px;
    border-radius: 12px;
  }
  .modal-header { padding: 12px 16px; }
  .modal-body { padding: 12px 16px; }
  .toast-container {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
  }
  .toast { min-width: auto; max-width: none; }
  .lead-card { padding: 12px; }
  .lead-card-actions { gap: 4px; }
  .lead-action-btn { font-size: 12px; padding: 6px 8px; }
  .messenger-tabs .messenger-tab { padding: 6px 12px; font-size: 12px; }
  .main { padding: 10px; gap: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 12px; }
}

@media (max-width: 480px) {
  .main { padding: 8px; gap: 8px; }
  .main-title { font-size: 16px; }
  .section-header h2 { font-size: 15px; }
  .section-header .section-title { font-size: 15px; }
  .messenger-grid { height: calc(100vh - 160px); }
  .messenger-sidebar { max-height: 180px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .user-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cards-grid { gap: 8px; }
  .card { padding: 12px; }
  .card-value { font-size: 22px; }
  .section { padding: 10px; border-radius: 10px; }
  .lead-card { border-radius: 10px; }
}

/* ========== CALENDAR ========== */
.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 2px;
}
.calendar-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  padding: 8px 0;
}
.calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.calendar-cell {
  min-height: 80px;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.calendar-cell:hover { background: #f0f6ff; }
.calendar-cell.today {
  border-color: #3b82f6;
  background: #eff6ff;
}
.calendar-cell.empty { background: transparent; cursor: default; }
.cal-day-num {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #1e293b;
}
.cal-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.cal-more {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}

/* ========== SETTINGS TABS ========== */
.settings-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}
.settings-tab {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
}
.settings-tab.active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.settings-panel { display: none; }

/* ========== USER DROPDOWN ========== */
.user-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 6px 0;
  min-width: 160px;
  z-index: 1000;
  display: none;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
  display: block;
  padding: 10px 16px;
  color: #1e293b;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
}
.user-dropdown a:hover { background: #f8fafc; }

/* ========== PLAN STATS ========== */
#planStatsCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* ========== LOGISTICS DASHBOARD ========== */
.logistics-dashboard {
  background: var(--bg-main);
  border-radius: 16px;
  padding: 24px;
  color: var(--text-main);
  min-height: calc(100vh - 120px);
}

/* KPI Row */
.log-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.log-kpi-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  border: 1px solid var(--card-border);
  transition: transform 0.15s, box-shadow 0.15s;
}
.log-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.log-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.log-kpi-body { flex: 1; min-width: 0; }
.log-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}
.log-kpi-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}
.log-kpi-delta {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.log-kpi-delta.positive { color: #10b981; background: rgba(16,185,129,0.12); }
.log-kpi-delta.negative { color: #ef4444; background: rgba(239,68,68,0.12); }
.log-kpi-delta.neutral { color: #94a3b8; background: rgba(148,163,184,0.1); }

/* Main Row: Map + Deadlines */
.log-main-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.log-map-wrap, .log-deadlines-wrap {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--card-border);
}
.log-card-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.log-map-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #64748b;
}
.log-legend-item { display: flex; align-items: center; gap: 4px; }
.log-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Leaflet map in dark container */
#logisticsMap {
  background: #f0f7ff;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}
.log-marker { text-align: center; line-height: 1; }

/* Deadlines */
.log-deadlines-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-deadlines-list::-webkit-scrollbar { width: 4px; }
.log-deadlines-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.log-deadline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.02);
  border-left: 3px solid #cbd5e1;
}
.log-deadline-item.overdue { border-left-color: #ef4444; background: rgba(239,68,68,0.06); }
.log-deadline-item.today { border-left-color: #f59e0b; background: rgba(245,158,11,0.06); }
.log-deadline-item.upcoming { border-left-color: #3b82f6; }

.log-deadline-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.log-deadline-badge.overdue { background: rgba(239,68,68,0.15); color: #ef4444; }
.log-deadline-badge.today { background: rgba(245,158,11,0.15); color: #f59e0b; }
.log-deadline-badge.upcoming { background: rgba(59,130,246,0.15); color: #3b82f6; }

.log-deadline-info { flex: 1; min-width: 0; }
.log-deadline-title { font-size: 13px; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-deadline-addr { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-deadline-time { font-size: 12px; color: #64748b; white-space: nowrap; flex-shrink: 0; }

/* Transport Sheets Table */
.log-table-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--card-border);
}
.log-btn-tab {
  padding: 5px 14px;
  border: 1px solid #cbd5e1;
  background: transparent;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.log-btn-tab.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}
.log-btn-tab:hover:not(.active) { border-color: #94a3b8; color: var(--text-main); }

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.log-table thead th {
  text-align: left;
  padding: 10px 12px;
  color: #64748b;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-light);
}
.log-table tbody td {
  padding: 10px 12px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
}
.log-table tbody tr:hover {
  background: rgba(37,99,235,0.04);
}
.log-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  color: var(--badge-color);
}
.log-actions { display: flex; gap: 4px; }
.log-action-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.log-action-btn:hover { opacity: 0.85; }
.log-action-btn.start { background: #f59e0b; color: #1e293b; }
.log-action-btn.complete { background: #10b981; color: white; }
.log-action-btn.view { background: #e2e8f0; color: var(--text-main); }

/* Route detail overlay */
.log-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.log-detail-modal {
  background: var(--card-bg);
  color: var(--text-main);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--card-border);
}
.log-detail-modal h3 { color: var(--text-main); margin: 0 0 12px; }
.log-detail-modal p { margin: 6px 0; font-size: 13px; color: #64748b; }
.log-detail-modal b { color: var(--text-main); }
.log-detail-modal ul { color: var(--text-main); font-size: 13px; }
.log-detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
}
.log-detail-close:hover { color: var(--text-main); }

/* Responsive */
@media (max-width: 1024px) {
  .log-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .log-main-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .log-kpi-row { grid-template-columns: 1fr; }
  .logistics-dashboard { padding: 12px; }
}

/* ========== TASKS / KANBAN ========== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kanban-col {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--card-border);
  min-width: 0;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.kanban-col-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
}
.kanban-col-count {
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.kanban-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  border-left: 3px solid #ccc;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.kanban-card-title {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 4px;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #64748b;
}
.task-list-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid var(--card-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.task-list-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.task-detail-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  z-index: 1000;
  overflow-y: auto;
}
.task-detail-panel .detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.task-detail-panel .detail-header h3 {
  margin: 0;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 18px;
}
.task-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.task-detail-grid .label { opacity: 0.5; }
.task-comment {
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.task-comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.5;
  margin-bottom: 2px;
}
.task-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 1024px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kanban-board { grid-template-columns: 1fr; }
}
