/* style.css - Modern Finance Grade AR & Collection CRM Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Color Palette - Finance Slate / Indigo */
  --bg-main: #0a0e17;
  --bg-surface: #111827;
  --bg-surface-elevated: #162032;
  --bg-card: rgba(19, 27, 43, 0.75);
  --bg-card-hover: rgba(26, 38, 61, 0.85);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Functional Status Colors */
  --color-critical: #ef4444;
  --color-critical-bg: rgba(239, 68, 68, 0.12);
  --color-critical-border: rgba(239, 68, 68, 0.3);

  --color-high: #f97316;
  --color-high-bg: rgba(249, 115, 22, 0.12);
  --color-high-border: rgba(249, 115, 22, 0.3);

  --color-medium: #eab308;
  --color-medium-bg: rgba(234, 179, 8, 0.12);
  --color-medium-border: rgba(234, 179, 8, 0.3);

  --color-low: #64748b;
  --color-low-bg: rgba(100, 116, 139, 0.12);
  --color-low-border: rgba(100, 116, 139, 0.3);

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-border: rgba(16, 185, 129, 0.3);

  --color-info: #0ea5e9;
  --color-info-bg: rgba(14, 165, 233, 0.12);
  --color-info-border: rgba(14, 165, 233, 0.3);

  --color-wa: #25d366;
  --color-wa-hover: #20ba59;
  --color-wa-bg: rgba(37, 211, 102, 0.12);
  --color-wa-border: rgba(37, 211, 102, 0.3);

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow-wa: 0 0 18px rgba(37, 211, 102, 0.25);
}

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

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

/* Glassmorphism Background Gradients */
.bg-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb-1 {
  position: absolute;
  top: -100px;
  left: 15%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  filter: blur(60px);
}

.glow-orb-2 {
  position: absolute;
  top: 250px;
  right: -80px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  filter: blur(80px);
}

/* App Wrapper */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1540px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

/* Header Section */
header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.brand-info h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-info .badge-company {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
}

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

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

.date-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
}

.date-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 30px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: white;
}

.user-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

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

/* Action Header Buttons */
.btn-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-header:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* KPI Summary Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-accent, var(--color-primary));
}

.kpi-card.critical::before { --kpi-accent: var(--color-critical); }
.kpi-card.warning::before { --kpi-accent: var(--color-high); }
.kpi-card.due-today::before { --kpi-accent: var(--color-medium); }
.kpi-card.commitment::before { --kpi-accent: #a855f7; }
.kpi-card.success::before { --kpi-accent: var(--color-success); }

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

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-sub.highlight {
  color: var(--color-critical);
  font-weight: 600;
}

/* Quick Navigation Tabs */
.tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  padding-bottom: 4px;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: #fff;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
}

.tab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.tab-badge.badge-red {
  background: var(--color-critical-bg);
  color: #fca5a5;
  border: 1px solid var(--color-critical-border);
}

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

/* Primary Action Buttons */
.btn-primary {
  background: var(--color-primary-gradient);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-medium);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

/* Control & Filter Toolbar */
.toolbar-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-size: 13px;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

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

.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--color-primary);
}

.active-filter-badge {
  font-size: 11.5px;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.active-filter-badge button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-weight: bold;
}

/* Tab Panels */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* Card Container for Tables & Sections */
.content-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.content-card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Data Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

table.data-table thead th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

table.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

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

table.data-table td {
  padding: 14px 18px;
  vertical-align: middle;
}

/* Table Elements: Company Cell */
.company-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.company-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.company-industry {
  font-size: 11px;
  color: var(--text-dim);
}

/* PIC & WhatsApp Cell */
.pic-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pic-name {
  font-weight: 600;
  color: var(--text-main);
}

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

/* WhatsApp Direct Pill */
.wa-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-wa-bg);
  color: #4ade80;
  border: 1px solid var(--color-wa-border);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.wa-link-pill:hover {
  background: var(--color-wa);
  color: #0b1e10;
  box-shadow: var(--shadow-glow-wa);
  transform: translateY(-1px);
}

.wa-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Invoice Cell */
.invoice-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.invoice-number {
  font-weight: 600;
  color: #93c5fd;
}

.invoice-dates {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin-top: 2px;
}

/* Overdue Badge */
.overdue-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.overdue-pill.pill-critical {
  background: var(--color-critical-bg);
  color: #fca5a5;
  border: 1px solid var(--color-critical-border);
}

.overdue-pill.pill-high {
  background: var(--color-high-bg);
  color: #fdba74;
  border: 1px solid var(--color-high-border);
}

.overdue-pill.pill-medium {
  background: var(--color-medium-bg);
  color: #fde047;
  border: 1px solid var(--color-medium-border);
}

.overdue-pill.pill-ok {
  background: var(--color-success-bg);
  color: #86efac;
  border: 1px solid var(--color-success-border);
}

/* Amount Cell */
.amount-cell {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
}

.amount-outstanding {
  font-weight: 700;
  font-size: 13.5px;
  color: #f87171;
}

.amount-total {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Commitment Cell */
.commitment-cell {
  font-size: 12px;
}

.commitment-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.commitment-badge.pending {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.commitment-badge.missed {
  background: var(--color-critical-bg);
  color: #f87171;
  border: 1px solid var(--color-critical-border);
}

.commitment-badge.fulfilled {
  background: var(--color-success-bg);
  color: #4ade80;
  border: 1px solid var(--color-success-border);
}

.commitment-badge.none {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}

/* Row Action Buttons */
.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.btn-action {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

.btn-action.btn-wa {
  background: var(--color-wa-bg);
  color: #4ade80;
  border-color: var(--color-wa-border);
}

.btn-action.btn-wa:hover {
  background: var(--color-wa);
  color: #0b1e10;
}

.btn-action.btn-commit {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
}

.btn-action.btn-commit:hover {
  background: #a855f7;
  color: white;
}

.btn-action.btn-pay {
  background: var(--color-success-bg);
  color: #4ade80;
  border-color: var(--color-success-border);
}

.btn-action.btn-pay:hover {
  background: var(--color-success);
  color: white;
}

/* Priority Queue Section (Cards Layout) */
.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  padding: 20px;
}

.queue-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
}

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

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

.queue-client-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.queue-client-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.queue-stats-row {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.queue-stat-item {
  display: flex;
  flex-direction: column;
}

.queue-stat-label {
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.queue-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.queue-reason-box {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--color-primary);
  padding: 6px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.queue-card-actions {
  display: flex;
  gap: 8px;
}

.queue-card-actions .btn-action {
  flex: 1;
  justify-content: center;
  padding: 8px 12px;
}

/* Aging Analytics Distribution */
.aging-analytics-container {
  padding: 24px;
}

.aging-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.aging-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.aging-box-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.aging-box-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.aging-box-count {
  font-size: 11px;
  color: var(--text-dim);
}

/* Progress bar visualization */
.aging-progress-bar {
  height: 24px;
  width: 100%;
  background: var(--bg-surface);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
}

.aging-bar-segment {
  height: 100%;
  transition: width 0.3s ease;
  position: relative;
}

.aging-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.aging-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-surface-elevated);
  z-index: 2;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface);
  position: sticky;
  bottom: 0;
}

/* Form Styles inside Modal */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* WhatsApp Template Generator Specific */
.wa-preview-box {
  background: #062b1a;
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
}

.wa-preview-header {
  font-size: 11px;
  font-weight: 700;
  color: #4ade80;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wa-preview-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: #e2e8f0;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Slide-Over Drawer for Customer 360 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 95;
  display: none;
}

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

.drawer-panel {
  position: fixed;
  top: 0;
  right: -580px;
  bottom: 0;
  width: 540px;
  max-width: 95vw;
  background: var(--bg-surface-elevated);
  border-left: 1px solid var(--border-medium);
  z-index: 96;
  box-shadow: var(--shadow-lg);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer-panel.active {
  right: 0;
}

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

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Drawer Section Blocks */
.drawer-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.drawer-section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.info-item label {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
}

.info-item span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* Timeline in Drawer */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding-left: 18px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-medium);
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--bg-surface-elevated);
}

.timeline-item.wa::before { background: var(--color-wa); }
.timeline-item.pay::before { background: var(--color-success); }
.timeline-item.com::before { background: #a855f7; }

.timeline-time {
  font-size: 11px;
  color: var(--text-dim);
}

.timeline-content {
  font-size: 12.5px;
  color: var(--text-main);
  margin-top: 2px;
}

.timeline-note {
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

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

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.toast.success {
  border-color: var(--color-success-border);
  background: #064e3b;
  color: #ecfdf5;
}

.toast.info {
  border-color: var(--color-info-border);
  background: #0c4a6e;
  color: #f0f9ff;
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .toolbar-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .drawer-panel {
    width: 100%;
  }
}
