/* ==========================================================================
   MANDOOBI ENTERPRISE EMPLOYEE 360 DEDICATED FULL-PAGE DESIGN SYSTEM
   Full Financial Treasury, Inventory, CRM & Operational Replay Workspace
   ========================================================================== */

:root {
  --bg-app: #0b1120;
  --bg-panel: #0f172a;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  
  --border-color: #e2e8f0;
  --border-dark: #1e293b;
  --border-light: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f8fafc;

  --brand-primary: #4f46e5;
  --brand-cyan: #0284c7;
  --brand-success: #10b981;
  --brand-warning: #f59e0b;
  --brand-danger: #ef4444;
  --brand-purple: #8b5cf6;

  --font-arabic: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace, sans-serif;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-arabic);
}

body.theme-rep-360 {
  background: #f1f5f9;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Helpers */
.mono { font-family: var(--font-mono) !important; }
.text-bold { font-weight: 800 !important; }
.text-success { color: var(--brand-success) !important; }
.text-emerald { color: #059669 !important; }
.text-danger { color: var(--brand-danger) !important; }
.text-warning { color: var(--brand-warning) !important; }
.text-cyan { color: var(--brand-cyan) !important; }

/* ==========================================================================
   1. TOP EXECUTIVE APP BAR
   ========================================================================== */
.p360-header {
  background: #0b1120;
  border-bottom: 1.5px solid #1e293b;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-inverse);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.p360-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-back-cmd {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-back-cmd:hover { background: #334155; color: #fff; }

.header-divider {
  width: 1px;
  height: 24px;
  background: #334155;
}

.p360-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.p360-badge {
  background: linear-gradient(135deg, #4f46e5, #0284c7);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.p360-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #f8fafc;
}

.p360-header-center {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rep-seq-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.btn-seq {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-seq:hover { background: #334155; color: #fff; }

.seq-current-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 900;
  color: #38bdf8;
  padding: 0 4px;
}

.system-clock {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  color: #f8fafc;
  background: #1e293b;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.p360-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action-p360 {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s;
}
.btn-action-p360:hover { opacity: 0.9; }

.btn-wa { background: #10b981; color: #fff; }
.btn-call { background: #0284c7; color: #fff; }
.btn-handover { background: #059669; color: #fff; }
.btn-transfer { background: #8b5cf6; color: #fff; }
.btn-assign { background: #4f46e5; color: #fff; }

/* ==========================================================================
   2. EMPLOYEE PROFILE BANNER & TELEMETRY
   ========================================================================== */
.emp-profile-banner {
  background: #0f172a;
  border-bottom: 1.5px solid #1e293b;
  padding: 14px 24px;
  color: #fff;
}

.banner-main-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.emp-avatar-box {
  position: relative;
  width: 58px;
  height: 58px;
  background: #1e293b;
  border: 2px solid #4f46e5;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.live-pulse-dot {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #0f172a;
  border-radius: 50%;
  animation: pulseLive 1.8s infinite;
}

@keyframes pulseLive {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.emp-profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 320px;
}

.emp-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.emp-name {
  font-size: 18px;
  font-weight: 900;
  color: #f8fafc;
}

.emp-code {
  background: #1e293b;
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.emp-role-pill {
  background: rgba(79, 70, 229, 0.2);
  color: #818cf8;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(79, 70, 229, 0.4);
}

.emp-status-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
}
.emp-status-badge.live { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

.emp-telemetry-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: #cbd5e1;
}

.tel-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tel-lbl { color: #94a3b8; font-weight: 700; }
.tel-val { font-weight: 800; }

.date-selector-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ds-lbl { font-size: 10.5px; font-weight: 700; color: #94a3b8; }

.date-pills {
  display: flex;
  gap: 4px;
  background: #1e293b;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.date-pill {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.date-pill:hover { color: #f8fafc; }
.date-pill.active { background: #4f46e5; color: #ffffff; }

/* ==========================================================================
   3. LEVEL 2 QUICK KPI METRICS STRIP
   ========================================================================== */
.kpi-metrics-strip {
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border-color);
  padding: 10px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.kpi-chip {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.kpi-chip:hover { border-color: #6366f1; box-shadow: var(--shadow-sm); }

.chip-icon { font-size: 20px; }
.chip-content { display: flex; flex-direction: column; gap: 1px; }
.chip-label { font-size: 10.5px; font-weight: 700; color: var(--text-muted); }
.chip-value { font-size: 14px; font-weight: 900; color: var(--text-primary); }
.chip-sub { font-size: 10px; font-weight: 700; color: var(--text-secondary); }

/* ==========================================================================
   4. NAVIGATION TABS
   ========================================================================== */
.p360-nav-tabs {
  display: flex;
  background: #ffffff;
  border-bottom: 1.5px solid var(--border-color);
  padding: 0 24px;
  gap: 6px;
  overflow-x: auto;
}

.nav-tab-btn {
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nav-tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: #faf5ff;
}

/* ==========================================================================
   5. MAIN CONTENT PANES
   ========================================================================== */
.p360-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane {
  display: none;
  flex: 1;
  overflow: hidden;
}
.tab-pane.active { display: flex; }

/* PANE 1: JOURNEY SPLIT VIEW */
.journey-split-view {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 560px;
  height: calc(100vh - 250px);
  min-height: 650px;
  overflow: hidden;
}

@media (max-width: 1100px) {
  .journey-split-view {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }
}

.journey-map-panel {
  display: flex;
  flex-direction: column;
  border-left: 1.5px solid var(--border-color);
  background: #e2e8f0;
  height: 100%;
}

.replay-player-bar {
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-bottom: 1.5px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.rpb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.playback-controls { display: flex; gap: 6px; }

.rpb-btn {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.rpb-btn.btn-play-main { background: #4f46e5; border-color: #6366f1; }
.rpb-btn:hover { background: #334155; }

.speed-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #1e293b;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid #334155;
}
.speed-lbl { font-size: 11px; color: #94a3b8; }

.speed-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.speed-btn.active { background: #4f46e5; color: #fff; }

.rpb-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.time-label { font-size: 11px; font-weight: 800; color: #38bdf8; min-width: 55px; }
.replay-slider { flex: 1; accent-color: #4f46e5; cursor: pointer; height: 6px; }

.rpb-event-status {
  background: #1e293b;
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  border: 1px solid #334155;
}
.event-desc { font-weight: 700; color: #e2e8f0; }

.journey-map-canvas {
  flex: 1;
  width: 100%;
  height: calc(100% - 130px);
  min-height: 480px;
}

/* TIMELINE PANEL */
.journey-timeline-panel {
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.timeline-toolbar {
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1.5px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tt-title { font-size: 13px; font-weight: 800; color: var(--text-primary); }
.tt-filters { display: flex; gap: 4px; }

.tf-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-secondary);
  cursor: pointer;
}
.tf-btn.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }

.timeline-stream-container {
  flex: 1;
  overflow-y: auto !important;
  max-height: calc(100vh - 320px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom scrollbars for timeline */
.timeline-stream-container::-webkit-scrollbar {
  width: 8px;
}

.timeline-stream-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.timeline-stream-container::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

.timeline-stream-container::-webkit-scrollbar-thumb:hover {
  background: #4f46e5;
}

/* TIMELINE NODES */
.timeline-node {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
}

.timeline-node::before {
  content: '';
  position: absolute;
  right: 18px;
  top: 36px;
  bottom: -20px;
  width: 2.5px;
  background: #cbd5e1;
  z-index: 1;
}
.timeline-node:last-child::before { display: none; }

.timeline-node.active-highlight .node-card {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35), 0 8px 20px rgba(2, 132, 199, 0.15) !important;
  transform: translateY(-2px);
  background: #f0f9ff !important;
}

@keyframes pulseRadar {
  0% { transform: scale(0.9); opacity: 0.9; box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7); }
  70% { transform: scale(1.4); opacity: 0; box-shadow: 0 0 0 16px rgba(2, 132, 199, 0); }
  100% { transform: scale(0.9); opacity: 0; box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

.replay-live-marker-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.replay-live-marker-radar {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(2, 132, 199, 0.25);
  animation: pulseRadar 1.6s infinite ease-out;
}

.replay-live-marker-icon {
  position: relative;
  z-index: 2;
  width: 38px;
  height: 38px;
  background: #0284c7;
  color: #fff;
  border: 2.5px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.5);
  transition: transform 0.3s ease;
}

.node-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.node-signin, .node-signout {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-color: #334155;
}
.node-signin .node-title { color: #38bdf8; font-size: 13.5px; font-weight: 900; }

.node-travel { background: #f0f9ff; border-color: #bae6fd; }
.node-travel .node-title { color: #0369a1; font-size: 12.5px; font-weight: 800; }

.node-stop { border-right: 4px solid var(--brand-primary); }
.node-stop.stop-completed { border-right-color: var(--brand-success); }
.node-stop.stop-active { border-right-color: var(--brand-warning); background: #fffbeb; }

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.node-heading-group { display: flex; align-items: center; gap: 8px; }
.node-icon-bubble {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.node-title-meta { display: flex; flex-direction: column; }
.node-title { font-size: 13px; font-weight: 800; color: var(--text-primary); }
.node-time-badge { font-size: 10.5px; font-weight: 800; color: var(--text-muted); }
.node-status-pill { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 10px; }

.node-chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rel-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rel-chip:hover { background: #4f46e5; color: #fff; }

/* ==========================================================================
   6. TREASURY, INVENTORY & CRM FULL VIEWS
   ========================================================================== */
.ledger-full-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ledger-header-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.lhc-title { font-size: 16px; font-weight: 900; color: var(--text-primary); }
.lhc-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.btn-trigger-action {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  text-decoration: none;
  color: #fff;
  transition: opacity 0.15s;
}
.btn-trigger-action:hover { opacity: 0.9; }
.btn-handover-trigger { background: #059669; }
.btn-transfer-trigger { background: #4f46e5; }
.btn-crm-link { background: #0284c7; }

.treasury-cards-grid, .inventory-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.ledger-metric-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}
.ledger-metric-box .lmb-lbl { font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.ledger-metric-box .lmb-val { font-size: 20px; font-weight: 900; font-family: var(--font-mono); color: var(--text-primary); }

.history-table-wrap {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.enterprise-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: right;
}

.enterprise-table th {
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
}

.enterprise-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.crm-interactions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.crm-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.crm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.crm-cust-name { font-size: 13.5px; font-weight: 800; color: var(--text-primary); }

/* ==========================================================================
   7. LEVEL 5 DRILLDOWN DRAWER & MODALS
   ========================================================================== */
.drilldown-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: flex-start;
  z-index: 2000;
}
.drilldown-drawer-overlay.active { display: flex; }

.drilldown-drawer {
  background: #ffffff;
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
  animation: drawerSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  background: #0f172a;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close-drawer {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-close-drawer:hover { background: #ef4444; color: #fff; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.audit-certificate-box {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cert-icon { font-size: 26px; }
.cert-title { font-size: 12.5px; font-weight: 800; color: #15803d; }
.cert-sub { font-size: 11px; color: #166534; }

.audit-grid {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  padding: 16px;
}
.modal-overlay.active { display: flex; }

.modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.modal-header {
  padding: 14px 20px;
  background: #0f172a;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close-modal {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11.5px; font-weight: 800; color: var(--text-secondary); }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  font-size: 12px;
  font-weight: 700;
  outline: none;
}
.form-control:focus { border-color: #4f46e5; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}


/* ========================================================================== */
/* IN-APP WHATSAPP MESSENGER (GOWS REALTIME CHAT) STYLES */
/* ========================================================================== */

.modal-wa-card {
  max-width: 580px !important;
  width: 95% !important;
  height: 650px !important;
  max-height: 90vh !important;
  background: #111b21 !important;
  color: #e9edef !important;
  padding: 0 !important;
  border-radius: 20px !important;
  border: 1px solid #2a3942 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 168, 132, 0.15) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  font-family: inherit !important;
  direction: rtl !important;
}

.wa-chat-header {
  background: #202c33;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2a3942;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
}

.wa-user-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884 0%, #005c4b 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  border: 2px solid #00a884;
}

.wa-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00a884;
  border: 2px solid #202c33;
  box-shadow: 0 0 8px #00a884;
}

.wa-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wa-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-name-row h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #e9edef;
  letter-spacing: -0.3px;
}

.wa-badge-official {
  background: rgba(0, 168, 132, 0.15);
  color: #00a884;
  border: 1px solid rgba(0, 168, 132, 0.3);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 800;
}

.wa-info p {
  margin: 0;
  font-size: 0.75rem;
  color: #8696a0;
}

.wa-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-wa-header {
  background: transparent;
  border: none;
  color: #aebac1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-wa-header:hover {
  background: #374248;
  color: #ffffff;
}

.btn-wa-close:hover {
  background: rgba(241, 92, 108, 0.2);
  color: #f15c6c;
}

.wa-quick-bar {
  background: #182229;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid #222e35;
  scrollbar-width: thin;
}

.wa-pill {
  background: #202c33;
  color: #aebac1;
  border: 1px solid #2a3942;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.wa-pill:hover {
  background: #005c4b;
  color: #d9fdd3;
  border-color: #00a884;
}

.wa-chat-messages {
  flex: 1;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wa-msg.outbound {
  align-self: flex-start;
  background: #005c4b;
  color: #e9edef;
  border-top-right-radius: 2px;
}

.wa-msg.inbound {
  align-self: flex-end;
  background: #202c33;
  color: #e9edef;
  border-top-left-radius: 2px;
}

.wa-msg-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 800;
  color: #00a884;
  margin-bottom: 2px;
}

.wa-msg.inbound .wa-msg-header {
  color: #53bdeb;
}

.wa-msg-body {
  white-space: pre-wrap;
}

.wa-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 0.68rem;
  color: #8696a0;
  margin-top: 2px;
}

.wa-ticks {
  color: #53bdeb;
  font-weight: 900;
  font-size: 0.78rem;
}

.wa-chat-footer {
  background: #202c33;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #2a3942;
}

.wa-input-wrap {
  flex: 1;
  background: #2a3942;
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
}

.wa-input-wrap textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #e9edef;
  font-size: 0.86rem;
  font-family: inherit;
  resize: none;
  max-height: 80px;
}

.btn-wa-send {
  background: linear-gradient(135deg, #00a884 0%, #008f6f 100%);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.35);
  transition: all 0.2s ease;
}

.btn-wa-send:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-wa-send:active {
  transform: translateY(1px);
}

.wa-chat-loader {
  text-align: center;
  color: #8696a0;
  font-size: 0.82rem;
  padding: 30px;
}
