/* ============================================================
   Heart to Heart Safaris — Admin Dashboard Styles
   ============================================================ */
:root {
  --primary: #c9a227;
  --primary-dark: #a8861d;
  --primary-light: rgba(201, 162, 39, 0.12);
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1f2a37;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --info: #2563eb;
  --sidebar-w: 260px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }

/* ===== Password field with eye toggle ===== */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  padding-right: 42px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s;
}
.password-toggle:hover {
  color: var(--text);
  background: var(--bg);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
}

/* ===== Alerts ===== */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ===== Login ===== */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 55fr 45fr;
  background: var(--bg);
}

/* Left — Maasai with the Lesso tour image */
.login-hero {
  position: relative;
  min-height: 100vh;
  background: url("/images/image/hero1.jpg") center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 36px;
  overflow: hidden;
}
.login-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 18, 30, 0.55) 0%,
    rgba(10, 18, 30, 0.15) 45%,
    rgba(10, 18, 30, 0.82) 100%
  );
}
.login-hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.login-hero-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.login-hero-brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.login-hero-caption {
  position: relative;
  z-index: 1;
  color: #fff;
  max-width: 480px;
}
.login-hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(15, 23, 42, 0.55);
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.login-hero-caption h2 {
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 10px;
}
.login-hero-caption p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

/* Right — sign-in panel (full-width, no white card box) */
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 40px 48px;
  background: linear-gradient(180deg, #fbfcfd 0%, var(--bg) 100%);
}
.login-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  width: 100%;
  max-width: 460px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand img { width: 76px; height: 76px; border-radius: 50%; margin-bottom: 12px; object-fit: cover; }
.login-brand h1 { font-size: 22px; color: var(--text); }
.login-brand p { color: var(--text-muted); font-size: 13.5px; }

/* Login-only: fuller fields that span the panel (no cramped card look) */
.login-card .form-group input,
.login-card .form-control {
  padding: 12px 14px;
  font-size: 15px;
}
.login-card .password-field input {
  padding-right: 46px;
}
.login-card .btn-block {
  padding: 12px 16px;
  font-size: 15px;
}

/* Responsive: single column, image becomes a compact top banner */
@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-hero {
    min-height: 0;
    height: 230px;
    padding: 18px 20px;
  }
  .login-hero-caption h2 { font-size: 24px; }
  .login-hero-caption p { display: none; }
  .login-hero-eyebrow { margin-bottom: 8px; }
  .login-panel { padding: 24px 16px; }
}

/* Forgot password (login card) */
.login-forgot{margin-top:12px;text-align:center;font-size:13px}
.login-forgot a{color:var(--primary);text-decoration:none}
.login-forgot a:hover{text-decoration:underline}
.forgot-title{text-align:center;color:var(--text);margin-bottom:14px;font-size:17px}
.forgot-note{font-size:12px;color:var(--text-muted);margin-top:10px;text-align:center}

/* ===== Layout ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.brand-text strong { display: block; font-size: 14px; color: #fff; }
.brand-text span { font-size: 11px; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }

.nav-group { margin-bottom: 18px; }
.nav-group-title {
  padding: 6px 16px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 16px;
  color: #cbd5e1;
  background: transparent;
  border: none;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}
.nav-item svg { flex-shrink: 0; opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  color: #fff;
  background: var(--primary-light);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0 6px;
}

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
}
.user-meta { flex: 1; min-width: 0; }
.user-meta strong { display: block; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Main / Topbar ===== */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title h2 { font-size: 17px; font-weight: 700; }
.topbar-title p { font-size: 12px; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-title p { display: none; }
  .topbar-title h2 { font-size: 15px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .btn { padding: 5px 10px; font-size: 11.5px; }
  .topbar .icon-btn { width: 38px; height: 38px; }
}
.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.menu-toggle { display: inline-flex; }

/* Desktop sidebar show/hide via the hamburger toggle */
.app-layout.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.app-layout.sidebar-collapsed .main { margin-left: 0; }
.main { transition: margin-left 0.25s ease; }

.content { padding: 24px; flex: 1; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-header p { font-size: 12px; color: var(--text-muted); }
.card-body { padding: 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-info { min-width: 0; }
.stat-info .stat-value { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

/* Destinations read-only view — search + filters */
.dest-filter-bar{display:flex;flex-direction:column;gap:10px;margin-bottom:16px;padding:14px;background:var(--surface);border:1px solid var(--border);border-radius:10px}
.dest-filter-bar .form-control{max-width:380px}
.dest-filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.dest-filter-row .dest-filter-label{font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;min-width:72px}
.dest-filter-btns{display:flex;flex-wrap:wrap;gap:6px}
.dest-filter-btn{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:5px 11px;font-size:12px;font-weight:600;color:var(--text);cursor:pointer;font-family:inherit;transition:all .15s}
.dest-filter-btn:hover{border-color:var(--primary);color:var(--primary)}
.dest-filter-btn.active{background:var(--primary);border-color:var(--primary);color:#fff}
.dest-filter-btn.disabled{opacity:.35;cursor:not-allowed}
.table th {
  text-align: left;
  padding: 11px 14px;
  background: #f9fafb;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: #f9fafb; }
.table .badge-cell { display: inline-block; }

/* ===== Pagination ===== */
.pagination-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 14px;border-top:1px solid var(--border);background:#f9fafb;font-size:12.5px}
.pagination-bar .page-info{color:var(--text-muted);white-space:nowrap}
.pagination-bar .page-btns{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.pagination-bar .page-btn{min-width:30px;height:30px;padding:0 10px;border:1px solid var(--border);border-radius:7px;background:#fff;color:var(--text);font-size:12.5px;font-weight:600;cursor:pointer;font-family:inherit;transition:all .15s;display:inline-flex;align-items:center;justify-content:center}
.pagination-bar .page-btn:hover:not(:disabled){border-color:var(--primary);color:var(--primary)}
.pagination-bar .page-btn.active{background:var(--primary);border-color:var(--primary);color:#fff}
.pagination-bar .page-btn:disabled{opacity:.4;cursor:not-allowed}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #f0fdf4; color: #15803d; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-info { background: #eff6ff; color: #1d4ed8; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

.status-filter { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Empty / Loading ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state h4 { color: var(--text); margin-bottom: 4px; font-size: 15px; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Spinner (kept for buttons only) ===== */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Skeleton loaders ===== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 6px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.skeleton-block { height: 14px; margin-bottom: 10px; }
.skeleton-block.w-25 { width: 25%; }
.skeleton-block.w-40 { width: 40%; }
.skeleton-block.w-60 { width: 60%; }
.skeleton-block.w-80 { width: 80%; }
.skeleton-block.w-100 { width: 100%; }
.skeleton-circle { border-radius: 50%; }

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.skeleton-stat {
  display: flex;
  align-items: center;
  gap: 14px;
}
.skeleton-stat .skeleton-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}
.skeleton-stat .skeleton-lines { flex: 1; }

.skeleton-table { width: 100%; }
.skeleton-table .skeleton-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.skeleton-table .skeleton-row .skeleton { height: 12px; }

.skeleton-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding-top: 10px;
}
.skeleton-chart .skeleton-bar {
  flex: 1;
  border-radius: 6px 6px 0 0;
  min-height: 8px;
}

/* ===== Progress bar ===== */
.progress-track { height: 8px; background: #f1f5f9; border-radius: 9999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 9999px; transition: width 0.3s; }

/* ===== Chart bars ===== */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar .bar {
  width: 100%;
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
}
.chart-bar .bar-label { margin-top: 8px; font-size: 11px; color: var(--text-muted); }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  min-width: 260px;
  max-width: 360px;
  font-size: 13px;
  border-left: 4px solid var(--primary);
  animation: toast-in 0.3s ease;
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Detail panel ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-item .detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.detail-item .detail-value { font-size: 13.5px; font-weight: 500; word-wrap: break-word; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Confirmation modal ===== */
.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  background: var(--primary-light);
  color: var(--primary);
}
.confirm-icon.danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}
.confirm-icon svg {
  width: 24px;
  height: 24px;
}

.actions-cell { display: flex; gap: 6px; }

/* ===== Search bar ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  min-width: 220px;
}
.search-bar input { border: none; outline: none; flex: 1; font-size: 13px; font-family: inherit; }

/* ===== View header search (bookings) ===== */
.view-header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.view-header-search .search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}
.view-header-search .search-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 260px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.view-header-search .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.view-header-search .search-input::placeholder {
  color: var(--text-muted);
}
.view-header-search .search-icon {
  position: relative;
  margin-right: -26px;
  z-index: 1;
  pointer-events: none;
}
.view-header-search .btn {
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .view-header-search .search-input {
    min-width: 100%;
  }
  .view-header-search {
    width: 100%;
  }
}

/* ===== Detail ===== */
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.view-header h3 { font-size: 18px; font-weight: 700; }

/* ===== Table tools (realtime search + Excel/PDF export) ===== */
.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table-tools-search {
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-tools-search .search-icon {
  color: var(--text-muted);
  position: relative;
  margin-right: -26px;
  z-index: 1;
  pointer-events: none;
}
.table-tools-search .search-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 240px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.table-tools-search .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.table-tools-search .search-input::placeholder {
  color: var(--text-muted);
}
.table-tools-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.table-tools-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}
@media (max-width: 640px) {
  .table-tools-search .search-input {
    min-width: 100%;
  }
  .table-tools-search {
    width: 100%;
  }
}

/* ===== Reviews ===== */
.review-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: none; }
.review-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.review-stars { color: #f59e0b; font-size: 14px; }

/* ===== Live Chat ===== */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  height: calc(100vh - 130px);
  min-height: 480px;
}
.chat-sessions-panel,
.chat-thread-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.chat-panel-header h3 {
  font-size: 15px;
  font-weight: 700;
}
.chat-session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.chat-session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.chat-session-item:hover {
  background: var(--bg);
}
.chat-session-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
}
.chat-session-item.unread {
  border-left: 3px solid var(--primary);
}
.chat-session-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.chat-session-info {
  flex: 1;
  min-width: 0;
}
.chat-session-name {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-unread-badge {
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.chat-session-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-session-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.chat-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* Chat thread */
.chat-thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  gap: 12px;
}
.chat-thread-header strong {
  font-size: 14px;
}
.chat-thread-email {
  font-size: 12px;
  color: var(--text-muted);
}
.chat-thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
.chat-thread-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-thread-msg.visitor {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-thread-msg.admin {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-thread-msg-label {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
  opacity: 0.7;
}
.chat-thread-msg-time {
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.6;
}
.chat-thread-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-thread-input input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.chat-thread-input input:focus {
  border-color: var(--primary);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .chat-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .chat-sessions-panel {
    max-height: 300px;
  }
  .chat-thread-panel {
    min-height: 400px;
  }
}

/* ===== Ads view ===== */
.ad-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f172a;
  display: block;
}
.ad-thumb-video {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  font-size: 18px;
}

/* ===== Ad upload fields ===== */
.ad-upload-status {
  font-size: 12.5px;
  color: var(--success);
  margin-top: 6px;
  min-height: 16px;
}
.ad-upload-status.ad-upload-error {
  color: var(--danger);
}
.ad-upload-preview {
  margin-top: 8px;
  min-height: 0;
}
.ad-upload-preview:empty {
  display: none;
}
.ad-upload-preview img,
.ad-upload-preview video {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ===== Ad upload progress bar ===== */
.ad-upload-progress {
  display: none;
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}
.ad-upload-progress.active {
  display: block;
}
.ad-upload-progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* ===== Ads table (compact — all columns visible) ===== */
.ad-table th,
.ad-table td {
  padding: 8px 10px;
}
.ad-table .ad-thumb {
  width: 72px;
  height: 44px;
}
.ad-link-cell {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--info);
}
@media (max-width: 1100px) {
  .ad-link-cell {
    max-width: 90px;
  }
}

/* Configuration warning banner (payments/email misconfigured) */
.config-banner {
  background: #fff7e6;
  border-bottom: 1px solid #f0d9a8;
  padding: 10px 16px;
  font-size: 13px;
  color: #7a5b1e;
}
.config-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.config-banner-inner strong {
  margin-right: 4px;
}
.config-banner .js-dismiss {
  margin-left: auto;
}
/* ============================================================
   AI Assistant (superuser DeepSeek chat agent)
   ============================================================ */
.ai-modal {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 40px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 300;
  animation: ai-modal-in 0.18s ease;
}
@keyframes ai-modal-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.ai-modal-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ai-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-modal-title-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ai-modal-title-text strong { font-size: 14px; }
.ai-modal-title-text span { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-modal-actions { display: flex; align-items: center; gap: 6px; }
.ai-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.ai-toggle-label input { accent-color: var(--primary); cursor: pointer; }

.ai-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafbfc;
}
.ai-bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ai-bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-bubble.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.ai-system {
  align-self: center;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--primary-light);
  border: 1px solid rgba(201, 162, 39, 0.25);
  padding: 6px 10px;
  border-radius: 20px;
  max-width: 92%;
  word-wrap: break-word;
  white-space: pre-wrap;
  text-align: center;
}
.ai-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.ai-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ai-blink 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Streaming (quick-responder) bubble — live cursor while tokens arrive */
.ai-bubble.streaming .ai-bubble-text::after {
  content: "▋";
  margin-left: 1px;
  color: var(--primary);
  animation: ai-cursor-blink 0.9s infinite;
}
@keyframes ai-cursor-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }


/* Pending action card */
.ai-pending {
  align-self: stretch;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.ai-pending.danger { border-left-color: var(--danger); }
.ai-pending-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.ai-pending-head .ai-pending-icon { font-size: 15px; }
.ai-pending-args {
  font-size: 12px;
  color: var(--text);
  background: #f6f7f9;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  word-wrap: break-word;
  white-space: pre-wrap;
  max-height: 130px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ai-pending.danger .ai-pending-args { border-left: 3px solid var(--danger); }
.ai-pending-btns { display: flex; gap: 8px; justify-content: flex-end; }
.ai-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s ease;
}
.ai-btn:hover { border-color: var(--primary); }
.ai-btn-approve { background: var(--success); border-color: var(--success); color: #fff; }
.ai-btn-approve:hover { background: #128a3d; border-color: #128a3d; }
.ai-btn-deny { background: var(--danger); border-color: var(--danger); color: #fff; }
.ai-btn-deny:hover { background: #b91c1c; border-color: #b91c1c; }
.ai-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* File chip */
.ai-file-chip {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
}
.ai-file-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.ai-file-meta { display: flex; flex-direction: column; min-width: 0; }
.ai-file-meta strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file-meta span { font-size: 11px; color: var(--text-muted); }

/* Composer */
.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.ai-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.ai-composer textarea:focus { border-color: var(--primary); }
.ai-upload-btn, .ai-send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.ai-upload-btn:hover { color: var(--primary); border-color: var(--primary); }
.ai-send-btn { background: var(--primary); border-color: var(--primary); color: #fff; }
.ai-send-btn:hover { background: var(--primary-dark); }
.ai-send-btn:disabled, .ai-upload-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Launch button in the topbar */
#aiAssistantBtn { background: var(--primary); border-color: var(--primary); }

@media (max-width: 640px) {
  .ai-modal { right: 10px; bottom: 10px; width: calc(100vw - 20px); height: calc(100vh - 20px); max-height: none; }
}

/* ============================================================
   DARK MODE — activated via data-theme="dark" on <html>.
   The dashboard already uses semantic variables, so dark mode
   is mostly a variable swap + fixes for hardcoded light colors
   (table headers, skeleton, badges, alerts, etc.).
   ============================================================ */
:root[data-theme="dark"] {
  --bg: #0b1526;
  --surface: #182643;
  --border: #243a5c;
  --text: #e7eef8;
  --text-muted: #8398b4;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}
:root[data-theme="dark"] body { background: var(--bg); color: var(--text); }
:root[data-theme="dark"] ::placeholder { color: var(--text-muted); }
:root[data-theme="dark"] .search-bar input { color: var(--text); }
:root[data-theme="dark"] .chat-thread-input input { background: var(--surface); color: var(--text); }

/* Tables + pagination (hardcoded #f9fafb / #fff surfaces) */
:root[data-theme="dark"] .table th,
:root[data-theme="dark"] .table tbody tr:hover,
:root[data-theme="dark"] .pagination-bar { background: #0e1a2e; }
:root[data-theme="dark"] .pagination-bar .page-btn { background: #182643; }

/* Skeleton loaders */
:root[data-theme="dark"] .skeleton { background: #223454; }
:root[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

/* Progress track */
:root[data-theme="dark"] .progress-track { background: #223454; }

/* Alerts + badges (light pastel hardcoded backgrounds) */
:root[data-theme="dark"] .alert-error { background: #3a1c1c; color: #fca5a5; border-color: #5c2626; }
:root[data-theme="dark"] .alert-success { background: #123523; color: #86efac; border-color: #1d5c38; }
:root[data-theme="dark"] .badge-success { background: #123523; color: #86efac; }
:root[data-theme="dark"] .badge-danger { background: #3a1c1c; color: #fca5a5; }
:root[data-theme="dark"] .badge-warning { background: #3a2c0e; color: #fcd34d; }
:root[data-theme="dark"] .badge-info { background: #16283e; color: #93c5fd; }
:root[data-theme="dark"] .badge-muted { background: #223454; color: #cbd5e1; }

/* Config warning banner */
:root[data-theme="dark"] .config-banner { background: #2a2410; border-bottom-color: #4a3c1a; color: #e8c95b; }

/* Theme toggle in the topbar */
:root[data-theme="dark"] .theme-toggle svg { stroke: var(--text); }
.theme-toggle svg { display: block; }
