/* ========================================
   LogiFlow – Design System
   Dark theme, glassmorphism, cyan/purple accents
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-sidebar: rgba(10, 14, 26, 0.95);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 179, 237, 0.4);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #f1f5f9;

  --accent-cyan: #22d3ee;
  --accent-purple: #a78bfa;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-orange: #fb923c;
  --accent-blue: #60a5fa;

  --gradient-primary: linear-gradient(135deg, #22d3ee 0%, #a78bfa 100%);
  --gradient-card: linear-gradient(135deg, rgba(34, 211, 238, 0.05) 0%, rgba(167, 139, 250, 0.05) 100%);
  --gradient-btn: linear-gradient(135deg, #22d3ee 0%, #818cf8 100%);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(34, 211, 238, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --header-height: 64px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background animated gradient */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(34, 211, 238, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(99, 179, 237, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
  backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--header-height);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-logo i {
  color: var(--bg-primary);
  width: 20px;
  height: 20px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-brand span {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(34, 211, 238, 0.1);
  color: var(--accent-cyan);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
}

.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item span {
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-badge {
  margin-left: auto;
  background: var(--gradient-btn);
  color: var(--bg-primary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

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

.sidebar-promo {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.sidebar-promo p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.sidebar-promo .btn-pro {
  font-size: 0.75rem;
  padding: 6px 16px;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-slow);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.main-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 26, 0.6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--accent-cyan);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.menu-toggle:hover {
  background: rgba(34, 211, 238, 0.2);
  color: #fff;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-heading);
}

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

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 24px;
}

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

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.1;
  pointer-events: none;
}

.stat-card.cyan::after { background: var(--accent-cyan); }
.stat-card.purple::after { background: var(--accent-purple); }
.stat-card.green::after { background: var(--accent-green); }
.stat-card.orange::after { background: var(--accent-orange); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-icon.cyan { background: rgba(34, 211, 238, 0.12); color: var(--accent-cyan); }
.stat-icon.purple { background: rgba(167, 139, 250, 0.12); color: var(--accent-purple); }
.stat-icon.green { background: rgba(52, 211, 153, 0.12); color: var(--accent-green); }
.stat-icon.orange { background: rgba(251, 146, 60, 0.12); color: var(--accent-orange); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn i {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--gradient-btn);
  color: var(--bg-primary);
  box-shadow: 0 2px 8px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

.btn-success {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.btn-success:hover {
  background: rgba(52, 211, 153, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
}

.btn-ghost:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

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

.btn-sm i {
  width: 14px;
  height: 14px;
}

.btn-pro {
  background: var(--gradient-primary);
  color: var(--bg-primary);
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

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

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
  background: rgba(255, 255, 255, 0.07);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

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

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.data-table tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

.data-table .actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* --- Search Bar --- */
.search-bar {
  position: relative;
  max-width: 320px;
}

.search-bar input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.search-bar i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
}

.modal-body {
  padding: 24px;
}

.modal-wide {
  max-width: 800px;
}

/* --- Badges & Tags --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-new { background: rgba(34, 211, 238, 0.12); color: var(--accent-cyan); }
.badge-active { background: rgba(52, 211, 153, 0.12); color: var(--accent-green); }
.badge-completed { background: rgba(167, 139, 250, 0.12); color: var(--accent-purple); }
.badge-cancelled { background: rgba(248, 113, 113, 0.12); color: var(--accent-red); }
.badge-pending { background: rgba(251, 146, 60, 0.12); color: var(--accent-orange); }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.35s ease;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.warning { border-left: 3px solid var(--accent-orange); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; }
.toast.success .toast-icon { color: var(--accent-green); }
.toast.error .toast-icon { color: var(--accent-red); }
.toast.warning .toast-icon { color: var(--accent-orange); }
.toast.info .toast-icon { color: var(--accent-cyan); }

.toast-message {
  flex: 1;
  font-size: 0.85rem;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

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

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* --- AI Chat --- */
.ai-chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 48px);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-message {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.6;
  animation: fadeSlideIn 0.3s ease;
}

.ai-message.user {
  align-self: flex-end;
  background: var(--gradient-btn);
  color: var(--bg-primary);
  border-bottom-right-radius: 4px;
}

.ai-message.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.ai-message.system {
  align-self: center;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  max-width: 90%;
  text-align: center;
}

.ai-input-bar {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.ai-input-bar textarea {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.4;
}

.ai-input-bar textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.btn-send {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: var(--gradient-btn);
  border: none;
  color: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 10px rgba(34, 211, 238, 0.3);
}

.btn-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.45);
}

.btn-send:active {
  transform: scale(0.95);
}

.ai-typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  align-self: flex-start;
}

.ai-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* --- Map --- */
.map-container {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.map-info {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

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

.map-info-item i {
  color: var(--accent-cyan);
  width: 18px;
  height: 18px;
}

.map-info-item .value {
  font-weight: 600;
  color: var(--text-heading);
}

.map-info-item .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 4px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Limit Banner --- */
.limit-banner {
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--accent-orange);
}

.limit-banner i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- Loader / Spinner --- */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Settings --- */

.settings-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.settings-row:last-child {
  border-bottom: none;
}

.pro-feature-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.pro-feature-card i {
  width: 28px;
  height: 28px;
  color: var(--accent-purple);
  flex-shrink: 0;
}

.pro-feature-card h5 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
}

.pro-feature-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.pro-badge {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
  }

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

  .sidebar-overlay {
    z-index: 999;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }

  .menu-toggle {
    display: flex !important;
  }

  .page-content {
    padding: 12px;
  }

  .main-header {
    padding: 0 12px;
  }

  .page-title {
    font-size: 1.1rem;
  }

  .page-title-header {
    font-size: 0.9rem;
  }

  /* Stats grid - single column on small screens */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .value {
    font-size: 1.5rem;
  }

  /* Form rows stacked */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Tables: horizontal scroll in card body */
  .card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .data-table .actions {
    display: flex;
    gap: 2px;
  }

  /* Modal - full width on mobile */
  .modal {
    max-width: calc(100% - 16px);
    margin: 8px;
    max-height: 90vh;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
  }

  /* AI Chat */
  .ai-chat-container {
    height: calc(100vh - var(--header-height) - 60px);
  }

  .ai-message {
    max-width: 92%;
    font-size: 0.85rem;
  }

  .ai-input-bar {
    padding: 10px 12px;
  }

  .ai-input-bar textarea {
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  /* Buttons smaller on mobile */
  .btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  /* Cards */
  .card {
    border-radius: var(--radius-sm);
  }

  .card-header {
    padding: 12px 14px;
  }

  .card-body {
    padding: 14px;
  }

  /* Header buttons stacked */
  .page-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Order detail grid */
  .order-detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-row {
    flex-direction: column;
    gap: 2px;
  }

  .detail-label {
    font-size: 0.75rem;
  }

  .detail-value {
    font-size: 0.82rem;
  }

  /* Map container */
  .map-container {
    height: 200px !important;
  }

  .map-info {
    flex-direction: column;
    gap: 8px;
  }

  /* Settings rates grid */
  .card-body [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Pro features grid */
  .card-body [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Sidebar promo */
  .sidebar-footer {
    padding: 10px;
  }

  /* Limit banner */
  .limit-banner {
    font-size: 0.78rem;
    padding: 10px 12px;
  }

  /* Empty state */
  .empty-state {
    padding: 30px 16px;
  }

  .empty-state h4 {
    font-size: 1rem;
  }
}

/* --- Mobile Sidebar Overlay --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  display: none;
}

.sidebar-overlay.active {
  display: block;
}

.tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  font-family: inherit;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* --- Order Detail --- */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .order-detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-heading);
}

/* --- Utility --- */
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-muted { color: var(--text-muted); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* --- Route Planner --- */
.route-planner-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
}

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

.stat-mini {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
}

.stat-mini-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.stat-mini-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Form select */
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-select:focus {
  outline: none;
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

/* Ghost button */
.btn-ghost {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
}

