/* ==========================================================================
   BÁO CÁO SỨC KHỎE TÀI CHÍNH TUẦN - FINTECH DASHBOARD TRÌNH BAN LÃNH ĐẠO
   Tông màu: Gradient Xanh Indigo - Tím (#4F46E5 -> #7C3AED) & Màu Pastel Tươi Sáng
   Chuẩn mực công nghệ tài chính, icon line-art, bảng công nợ chi tiết & Firebase
   ========================================================================== */

:root {
  /* Tông màu chủ đạo Fintech */
  --fintech-indigo: #4f46e5;     /* Indigo hiện đại (#4F46E5) */
  --fintech-purple: #7c3aed;     /* Tím sang trọng (#7C3AED) */
  --fintech-blue: #2563eb;       /* Xanh dương */
  --fintech-dark: #0f172a;       /* Xanh than Slate 900 */

  --bg-page: #f8fafc;            /* Nền xám nhạt cao cấp */
  --bg-card: #ffffff;            /* Nền thẻ trắng tinh khiết */

  --text-main: #0f172a;          /* Màu chữ chính đậm rõ nét */
  --text-muted: #64748b;         /* Màu chữ phụ */
  --text-subtle: #94a3b8;        /* Chú thích mờ */

  --border-card: #e2e8f0;        /* Viền thẻ */
  --border-input: #cbd5e1;       /* Viền ô nhập */

  /* Bảng màu Pastel Tươi Sáng Theo Yêu Cầu */
  --pastel-good-bg: #ecfdf5;     /* Xanh mint pastel */
  --pastel-good-border: #10b981; /* Xanh mint #10B981 */
  --pastel-good-text: #065f46;
  --pastel-good-pill: #d1fae5;

  --pastel-warn-bg: #fffbeb;     /* Cam vàng pastel */
  --pastel-warn-border: #f59e0b; /* Cam vàng #F59E0B */
  --pastel-warn-text: #92400e;
  --pastel-warn-pill: #fef3c7;

  --pastel-danger-bg: #fef2f2;   /* Đỏ pastel */
  --pastel-danger-border: #ef4444;/* Đỏ #EF4444 */
  --pastel-danger-text: #991b1b;
  --pastel-danger-pill: #fee2e2;

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

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 12px 24px -4px rgba(79, 70, 229, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

/* Reset cơ bản */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .kpi-value, .dashboard-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  letter-spacing: -0.015em;
}

/* Container Dashboard chính */
.dashboard-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  background-color: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 35px -10px rgba(79, 70, 229, 0.07), 0 10px 15px -5px rgba(15, 23, 42, 0.03);
  border: 1px solid var(--border-card);
  overflow: hidden;
}

/* Banner Chế độ Chỉ Xem khi xem lại lịch sử */
.readonly-banner {
  background: linear-gradient(90deg, #1e1b4b 0%, #312e81 100%);
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #818cf8;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.readonly-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.readonly-icon {
  width: 20px;
  height: 20px;
  color: #a5b4fc;
}

/* ==========================================================================
   A. HEADER GRADIENT FINTECH (#4F46E5 -> #7C3AED)
   ========================================================================== */
.dashboard-header {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #7c3aed 100%);
  color: #ffffff;
  padding: 36px 36px 32px;
  position: relative;
  overflow: hidden;
}

.dashboard-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.header-main-content {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
}

.header-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.badge-icon {
  width: 14px;
  height: 14px;
  color: #fef08a;
}

.dashboard-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.dashboard-subtitle {
  font-size: 0.95rem;
  color: #e0e7ff;
  margin-top: 4px;
}

/* Khối metadata: Người lập báo cáo & Thời gian */
.header-meta-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1.6fr 1.8fr;
  gap: 20px;
  align-items: center;
}

.meta-date-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-icon {
  width: 15px;
  height: 15px;
  color: #c7d2fe;
}

.meta-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.meta-input:focus {
  background: #ffffff;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.35);
}

/* ==========================================================================
   B. PHẦN TỔNG QUAN (KPI CARDS + DONUT CHART + OVERALL ASSESSMENT)
   ========================================================================== */
.overview-section {
  padding: 28px 36px 14px;
  background-color: var(--bg-card);
}

.overview-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Hiệu ứng hover nhích nhẹ 2px */
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Màu sắc Pastel tươi sáng cho các thẻ KPI */
.kpi-good {
  background: var(--pastel-good-bg);
  border-color: #a7f3d0;
}
.kpi-good .kpi-icon-wrap {
  background: #ffffff;
  color: var(--pastel-good-border);
  box-shadow: 0 2px 5px rgba(16, 185, 129, 0.15);
}

.kpi-warning {
  background: var(--pastel-warn-bg);
  border-color: #fde68a;
}
.kpi-warning .kpi-icon-wrap {
  background: #ffffff;
  color: var(--pastel-warn-border);
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.15);
}

.kpi-danger {
  background: var(--pastel-danger-bg);
  border-color: #fecaca;
}
.kpi-danger .kpi-icon-wrap {
  background: #ffffff;
  color: var(--pastel-danger-border);
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.15);
}

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-svg {
  width: 24px;
  height: 24px;
}

.kpi-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.kpi-number-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 2px 0;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.kpi-total {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kpi-subtext {
  font-size: 0.74rem;
  font-weight: 600;
}

.text-good { color: var(--pastel-good-border); }
.text-warning { color: var(--pastel-warn-border); }
.text-danger { color: var(--pastel-danger-border); }

/* Thẻ Donut Chart */
.kpi-card.kpi-chart {
  background: #ffffff;
  border: 1px solid var(--border-card);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.chart-wrapper {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  position: relative;
}

.kpi-chart-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-legend-mini {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-mini strong {
  color: var(--text-main);
}

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

.dot-good { background: #10b981; }
.dot-warning { background: #f59e0b; }
.dot-danger { background: #ef4444; }

/* Khối Đánh giá tổng thể tuần này */
.overall-assessment-card {
  background: #f8fafc;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
  box-shadow: var(--shadow-sm);
}

.assessment-pill {
  padding: 6px 18px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill-svg {
  width: 16px;
  height: 16px;
}

.assessment-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fintech-dark);
}

.assessment-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   C. BỐ CỤC 7 MỤC CHI TIẾT (LƯỚI 2 CỘT)
   ========================================================================== */
.checklist-grid-section {
  padding: 24px 36px 36px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-icon {
  width: 20px;
  height: 20px;
  color: var(--fintech-indigo);
}

.section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fintech-dark);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.section-badge {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-icon {
  width: 14px;
  height: 14px;
  color: var(--fintech-indigo);
}

/* Lưới 2 cột */
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.grid-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-left: 5px solid #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-left-color 0.15s ease;
  display: flex;
  flex-direction: column;
}

/* Hiệu ứng hover nhích 2px */
.grid-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Đổi màu viền trái theo trạng thái */
.grid-card.status-active-good {
  border-left-color: #10b981;
}

.grid-card.status-active-warning {
  border-left-color: #f59e0b;
}

.grid-card.status-active-danger {
  border-left-color: #ef4444;
}

/* Tiêu đề mục & Icon Line-Art */
.card-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.item-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hộp icon line-art từng loại */
.item-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-icon-box svg {
  width: 22px;
  height: 22px;
}

.icon-cashflow { background: #eff6ff; color: #2563eb; }
.icon-receivable { background: #ecfdf5; color: #10b981; }
.icon-payable { background: #fff7ed; color: #ea580c; }
.icon-expense { background: #fef2f2; color: #ef4444; }
.icon-treasury { background: #f5f3ff; color: #7c3aed; }
.icon-tax { background: #ecfeff; color: #0891b2; }
.icon-proposal { background: #fefce8; color: #ca8a04; }

.item-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--fintech-dark);
  line-height: 1.3;
}

.item-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

/* 3 Nút chọn trạng thái */
.status-buttons {
  display: inline-flex;
  gap: 6px;
  background: #f8fafc;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  flex-shrink: 0;
}

.btn-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-state .btn-icon {
  width: 14px;
  height: 14px;
}

.btn-state:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* Nổi bật pastel khi được chọn */
.btn-state[data-status="good"].active {
  background: var(--pastel-good-pill);
  border-color: var(--pastel-good-border);
  color: var(--pastel-good-text);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.25);
}

.btn-state[data-status="warning"].active {
  background: var(--pastel-warn-pill);
  border-color: var(--pastel-warn-border);
  color: var(--pastel-warn-text);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.25);
}

.btn-state[data-status="danger"].active {
  background: var(--pastel-danger-pill);
  border-color: var(--pastel-danger-border);
  color: var(--pastel-danger-text);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.25);
}

/* Vùng nhập liệu */
.card-content-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.field-input, .field-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #ffffff;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input:focus, .field-textarea:focus {
  border-color: var(--fintech-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.field-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}

/* ==========================================================================
   BẢNG CÔNG NỢ CHI TIẾT (MỤC 2 & MỤC 3)
   ========================================================================== */
.card-table-hero {
  grid-column: 1 / -1; /* Trải rộng 2 cột */
  background: #ffffff;
}

.debt-summary-strip {
  background: #f8fafc;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
}

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

.strip-stats {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.strip-stats strong {
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.strip-divider {
  color: #cbd5e1;
}

.btn-add-row {
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--fintech-indigo);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-add-row:hover {
  background: #eff6ff;
  border-color: var(--fintech-indigo);
}

.debt-progress-bar {
  display: flex;
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.bar-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.bar-good { background: #10b981; }
.bar-warning { background: #f59e0b; }
.bar-danger { background: #ef4444; }

/* Bảng dữ liệu công nợ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
}

.debt-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.debt-data-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

.debt-data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  vertical-align: middle;
}

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

.partner-name {
  font-weight: 600;
  color: var(--fintech-dark);
}

.debt-amount-col {
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--fintech-dark);
}

/* Badges trạng thái công nợ */
.badge-overdue {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulseOverdue 2.4s infinite ease-in-out;
}

@keyframes pulseOverdue {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(1.02); }
}

.badge-approaching {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-ontime {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.btn-del-row {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-del-row:hover {
  color: #ef4444;
}

/* Mục 7: Đề xuất hành động (Full width hero card) */
.card-action-hero {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border: 1px solid #f0abfc;
  border-left: 6px solid var(--fintech-purple) !important;
}

.card-action-hero .item-icon-box {
  background: #fae8ff;
  color: var(--fintech-purple);
}

.proposal-textarea-large {
  min-height: 110px;
  background: #ffffff;
  border-color: #e879f9;
}

/* ==========================================================================
   G & H. FOOTER ACTION BAR, LỊCH SỬ & IN BÁO CÁO
   ========================================================================== */
.dashboard-footer {
  padding: 0 36px 36px;
}

.footer-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--border-card);
}

.action-left-group, .action-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.btn-light {
  background: #ffffff;
  color: #1e1b4b;
  font-weight: 700;
}

.btn-light:hover {
  background: #f1f5f9;
}

.btn-svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--fintech-indigo) 0%, var(--fintech-purple) 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-save {
  background-color: #10b981;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-save:hover {
  background-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
}

.btn-history {
  background: #eff6ff;
  color: var(--fintech-indigo);
  border: 1.5px solid #c7d2fe;
}

.btn-history:hover {
  background: #e0e7ff;
  border-color: var(--fintech-indigo);
  transform: translateY(-1px);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-muted);
  border: 1.5px solid var(--border-input);
}

.btn-outline:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: var(--fintech-indigo);
  transform: translateY(-1px);
}

.btn-outline-danger:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* ==========================================================================
   MODAL DIALOGS (THÊM CÔNG NỢ & LỊCH SỬ BÁO CÁO)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

.modal-card-wide {
  max-width: 780px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  width: 22px;
  height: 22px;
  color: var(--fintech-indigo);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fintech-dark);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.form-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--fintech-indigo);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.empty-history {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Toast popup */
.toast-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.toast-popup.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   RESPONSIVE (DI ĐỘNG & MÀN HÌNH NHỎ)
   ========================================================================== */
@media (max-width: 900px) {
  .overview-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-meta-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px 8px 40px;
  }

  .dashboard-header {
    padding: 24px 20px;
  }

  .dashboard-title {
    font-size: 1.45rem;
  }

  .overview-section, .checklist-grid-section, .dashboard-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .card-table-hero {
    grid-column: 1;
  }

  .overview-cards-grid {
    grid-template-columns: 1fr;
  }

  .card-top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-buttons {
    width: 100%;
    display: flex;
  }

  .btn-state {
    flex: 1;
    text-align: center;
  }

  .footer-action-bar {
    flex-direction: column;
  }

  .action-left-group, .action-right-group {
    width: 100%;
  }

  .btn {
    flex: 1;
  }
}

/* ==========================================================================
   H. IN / XUẤT BÁO CÁO (CHUẨN TRANG IN A4)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    padding: 0 !important;
  }

  .dashboard-container {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
  }

  .no-print {
    display: none !important;
  }

  .readonly-banner {
    display: none !important;
  }

  .grid-card {
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 14px !important;
  }

  .badge-overdue {
    animation: none !important;
  }

  .field-input, .field-textarea, .meta-input {
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ==========================================================================
   I. FINTECH APP SHELL & LEFT SIDEBAR SYSTEM (MULTI-COMPANY HUB)
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-page);
  position: relative;
}

/* 1. THANH MENU BÊN TRÁI (LEFT SIDEBAR) */
.app-sidebar {
  width: 290px;
  flex-shrink: 0;
  background: #0b1120; /* Deep Slate Fintech */
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-sidebar::-webkit-scrollbar {
  width: 5px;
}
.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

/* Brand Box */
.sidebar-brand-box {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-badge-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
  flex-shrink: 0;
}

.brand-badge-icon svg {
  width: 22px;
  height: 22px;
}

.brand-title-wrap {
  flex: 1;
}

.brand-group-name {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ffffff;
}

.brand-app-name {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #818cf8;
  text-transform: uppercase;
}

.btn-sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.btn-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Sidebar Section Box common */
.sidebar-section-box {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.label-icon {
  width: 14px;
  height: 14px;
  color: #818cf8;
}

/* Company Selector */
.custom-select-wrapper {
  position: relative;
}

.sidebar-company-select {
  width: 100%;
  appearance: none;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: #ffffff;
  padding: 10px 36px 10px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-company-select:hover, .sidebar-company-select:focus {
  border-color: #818cf8;
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.select-arrow-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #818cf8;
  pointer-events: none;
}

.company-quick-tag {
  margin-top: 8px;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid #818cf8;
}

/* Reporter Profile Box */
.reporter-card-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.reporter-card-inner:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(129, 140, 248, 0.25);
}

.reporter-avatar-ring {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.reporter-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f172a;
  box-shadow: 0 0 6px #22c55e;
}

.reporter-details {
  flex: 1;
  min-width: 0;
}

.reporter-full-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reporter-job-title {
  display: block;
  font-size: 0.73rem;
  color: #a5b4fc;
  font-weight: 500;
}

.reporter-meta-time {
  display: block;
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
}

/* Active Role Display (Chỉ hiển thị đúng vai trò đã chọn bên ngoài) */
.active-role-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.active-role-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
}

.role-display-ceo {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22) 0%, rgba(168, 85, 247, 0.12) 100%);
  border-color: rgba(168, 85, 247, 0.35);
}

.role-display-fi {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.22) 0%, rgba(59, 130, 246, 0.12) 100%);
  border-color: rgba(99, 102, 241, 0.35);
}

.ard-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-display-ceo .ard-icon-wrap {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.role-display-fi .ard-icon-wrap {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.ard-icon-wrap svg {
  width: 16px;
  height: 16px;
}

.ard-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ard-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ard-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: #c7d2fe;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-display-ceo .ard-badge {
  color: #e9d5ff;
}

.ard-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  flex-shrink: 0;
}

.sidebar-company-select:disabled {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.12);
  cursor: default;
  color: #f8fafc;
  opacity: 1;
}

.custom-select-wrapper.is-locked .select-arrow-icon {
  display: none;
}

.role-desc-callout {
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.71rem;
  color: #94a3b8;
  line-height: 1.35;
}

.role-desc-callout .callout-icon {
  width: 13px;
  height: 13px;
  color: #818cf8;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Sidebar Nav Menu */
.sidebar-nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-nav-item .nav-icon {
  width: 17px;
  height: 17px;
  color: #64748b;
  transition: color 0.2s ease;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.sidebar-nav-item:hover .nav-icon {
  color: #818cf8;
}

.sidebar-nav-item.active {
  background: rgba(79, 70, 229, 0.16);
  color: #c7d2fe;
  font-weight: 600;
  border-left: 3px solid #818cf8;
}

.sidebar-nav-item.active .nav-icon {
  color: #818cf8;
}

.nav-pill {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.pill-kpi {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.pill-danger {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}

.pill-warning {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
}

.pill-info {
  background: rgba(59, 130, 246, 0.22);
  color: #60a5fa;
}

/* Sidebar Footer */
.sidebar-footer-box {
  margin-top: auto;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-sync-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.71rem;
  color: #94a3b8;
}

.sync-dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulseLive 2s infinite ease-in-out;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.sidebar-version-tag {
  font-size: 0.65rem;
  color: #475569;
  font-weight: 600;
}

/* 2. MAIN WORKSPACE & TOPBAR */
.app-main-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  padding: 0 0 60px 0;
}

.app-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-card);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-topbar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
}

.topbar-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
}

.crumb-group {
  font-weight: 700;
  color: var(--fintech-indigo);
  letter-spacing: 0.02em;
}

.crumb-company {
  font-weight: 600;
  color: var(--text-main);
  background: #f1f5f9;
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.crumb-current {
  color: var(--text-muted);
}

.crumb-sep {
  width: 14px;
  height: 14px;
  color: #cbd5e1;
}

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

.topbar-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.79rem;
  font-weight: 600;
}

.topbar-role-badge .role-badge-icon {
  width: 14px;
  height: 14px;
}

.btn-topbar-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-topbar-action svg {
  width: 15px;
  height: 15px;
}

.btn-topbar-escalate {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-topbar-escalate:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

.btn-topbar-print {
  background: #ffffff;
  border: 1px solid var(--border-input);
  color: var(--text-main);
}

.btn-topbar-print:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* Viewer Mode Banner */
.viewer-mode-banner {
  background: linear-gradient(90deg, #1e1b4b 0%, #312e81 100%);
  color: #ffffff;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #818cf8;
  animation: slideDown 0.3s ease;
}

.viewer-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.viewer-banner-icon {
  width: 26px;
  height: 26px;
  color: #a5b4fc;
  flex-shrink: 0;
}

.viewer-banner-content strong {
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.viewer-banner-content p {
  font-size: 0.78rem;
  color: #c7d2fe;
  margin: 0;
}

/* Header Top Badges */
.header-top-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.header-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #ffffff;
}

/* ==========================================================================
   II. NÚT ĐÔN ĐỐC CÔNG NỢ & NÚT GỬI PHÒNG THANH TOÁN
   ========================================================================== */

.debt-action-button-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-dispatch-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  box-shadow: var(--shadow-sm);
}

.btn-dispatch-action svg {
  width: 15px;
  height: 15px;
}

.btn-dispatch-rec {
  background: linear-gradient(135deg, #ef4444 0%, #e11d48 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-dispatch-rec:hover {
  background: linear-gradient(135deg, #dc2626 0%, #be123c 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
}

.btn-dispatch-pay {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-dispatch-pay:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

.dispatch-badge-count {
  background: #ffffff;
  color: #991b1b;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.btn-dispatch-pay .dispatch-badge-count {
  color: #1e40af;
}

/* Tag tiến độ đôn đốc trong bảng */
.dispatch-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.73rem;
  font-weight: 600;
}

.tag-dispatched {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.tag-scheduled {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.tag-normal {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ==========================================================================
   III. NHẬT KÝ ĐÔN ĐỐC CÔNG NỢ (DISPATCH TRACKING LOG SECTION)
   ========================================================================== */

.dispatch-log-section {
  padding: 0 36px 36px;
}

.badge-dispatch-active {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.dispatch-log-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.dispatch-log-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.dispatch-table th {
  background: #f8fafc;
  font-size: 0.75rem;
}

.dispatch-table td {
  font-size: 0.83rem;
}

.empty-dispatch-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.empty-dispatch-state .empty-icon {
  width: 44px;
  height: 44px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.empty-dispatch-state p {
  font-size: 0.88rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ==========================================================================
   IV. MODAL ĐÔN ĐỐC CÔNG NỢ & KẾ HOẠCH THANH TOÁN (DISPATCH MODALS)
   ========================================================================== */

.modal-dispatch-card {
  max-width: 860px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.modal-header-dispatch-rec {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #e11d48 100%);
  color: #ffffff;
}

.modal-header-dispatch-pay {
  background: linear-gradient(135deg, #0f172a 0%, #1e40af 50%, #4f46e5 100%);
  color: #ffffff;
}

.modal-dispatch-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: rgba(239, 68, 68, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 3px 10px;
  border-radius: 9999px;
  color: #ffffff;
  margin-bottom: 6px;
}

.modal-dispatch-badge-pay {
  background: rgba(37, 99, 235, 0.35);
}

.modal-subtitle {
  font-size: 0.82rem;
  color: #c7d2fe;
  margin-top: 4px;
}

.dispatch-modal-body {
  padding: 24px;
  max-height: 72vh;
  overflow-y: auto;
}

.dispatch-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  margin-bottom: 20px;
}

.dispatch-meta-item label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dispatch-meta-item strong {
  font-size: 0.86rem;
  color: var(--text-main);
}

.form-input-sm {
  padding: 7px 10px;
  font-size: 0.82rem;
}

/* Debt Preview in Modal */
.dispatch-debt-preview {
  margin-bottom: 20px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-header {
  background: #f1f5f9;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border-card);
}

.preview-total-badge {
  font-weight: 700;
  font-size: 0.88rem;
}

.dispatch-preview-table th {
  padding: 8px 12px;
  font-size: 0.74rem;
  background: #fafafa;
}

.dispatch-preview-table td {
  padding: 8px 12px;
  font-size: 0.81rem;
}

/* Memo Textarea */
.dispatch-memo-group {
  margin-bottom: 0;
}

.memo-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.memo-header-row label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.74rem;
}

.dispatch-memo-textarea {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  background: #fafafa;
  color: #1e293b;
  border-color: #cbd5e1;
}

.dispatch-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-card);
}

.footer-left-buttons, .footer-right-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-save-dispatch {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.btn-save-dispatch:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* ==========================================================================
   V. GIAO DIỆN CHẾ ĐỘ NGƯỜI XEM (VIEWER MODE ADAPTATION)
   ========================================================================== */

body.role-viewer-active .btn-add-row,
body.role-viewer-active .btn-del-row,
body.role-viewer-active #btnSaveFirestore,
body.role-viewer-active #btnClearForm {
  display: none !important;
}

body.role-viewer-active .btn-state {
  pointer-events: none !important;
  opacity: 0.45;
}

body.role-viewer-active .btn-state.active {
  opacity: 1 !important;
  box-shadow: 0 0 0 2px #4f46e5;
}

body.role-viewer-active .field-input,
body.role-viewer-active .field-textarea,
body.role-viewer-active .meta-input {
  background-color: #f8fafc;
  border-color: transparent;
  box-shadow: none;
  pointer-events: none;
  color: #1e293b;
  font-weight: 500;
}

body.role-viewer-active .proposal-textarea-large {
  background: #f8fafc;
  border-left: 4px solid var(--fintech-indigo);
}

/* ==========================================================================
   VI. RESPONSIVE MEDIA QUERIES (< 1024px & MOBILE)
   ========================================================================== */

@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.4);
  }

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

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 999;
  }

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

  .btn-sidebar-close {
    display: block;
  }

  .btn-topbar-toggle {
    display: flex;
  }

  .topbar-breadcrumbs .crumb-current {
    display: none;
  }

  .dispatch-meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-topbar {
    padding: 10px 16px;
  }

  .btn-text-desktop {
    display: none;
  }

  .topbar-role-badge {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .dispatch-log-section {
    padding: 0 16px 24px;
  }

  .debt-action-button-group {
    flex-wrap: wrap;
    width: 100%;
    margin-top: 8px;
  }

  .btn-dispatch-action, .btn-add-row {
    flex: 1;
    justify-content: center;
  }

  .dispatch-modal-footer {
    flex-direction: column;
    gap: 12px;
  }

  .footer-left-buttons, .footer-right-buttons {
    width: 100%;
  }

  .footer-left-buttons .btn, .footer-right-buttons .btn {
    flex: 1;
  }
}

/* ==========================================================================
   HỆ THỐNG XÁC THỰC & ĐĂNG NHẬP PHÂN QUYỀN FINTECH (AXYS AUTH SYSTEM)
   ========================================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.auth-card {
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  border: 1px solid var(--border-card);
  animation: authSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
  color: #ffffff;
  padding: 26px 26px 20px;
  text-align: center;
  position: relative;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.auth-brand-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.auth-brand-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 500;
  line-height: 1.4;
}

/* ==========================================================================
   ROLE / MODE SELECTOR UI
   ========================================================================== */
.role-selector-body {
  padding: 22px 26px 20px;
}

.role-selector-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

.role-selector-prompt .prompt-icon {
  width: 17px;
  height: 17px;
  color: var(--fintech-indigo);
}

.role-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.role-option-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.role-option-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
  transform: translateY(-1px);
}

.role-option-card.selected {
  border-color: #4f46e5;
  background: #f5f7ff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.12);
}

.role-option-card[data-mode="ceo"].selected {
  border-color: #7c3aed;
  background: #faf5ff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.12);
}

.role-option-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.role-option-card.selected .role-option-radio {
  border-color: #4f46e5;
}

.role-option-card[data-mode="ceo"].selected .role-option-radio {
  border-color: #7c3aed;
}

.role-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s ease;
}

.role-option-card.selected .role-radio-dot {
  background: #4f46e5;
}

.role-option-card[data-mode="ceo"].selected .role-radio-dot {
  background: #7c3aed;
}

.role-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-icon-ceo {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.role-icon-fi {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.role-option-icon svg {
  width: 22px;
  height: 22px;
}

.role-option-details {
  flex: 1;
  min-width: 0;
}

.role-option-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.role-option-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.role-pill-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill-badge-ceo {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}

.pill-badge-fi {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.role-option-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
  margin: 0;
}

/* Khối Chọn Công Ty Phụ Trách */
.company-assign-wrapper {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  animation: fadeIn 0.2s ease-out;
}

.assign-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.assign-label-icon {
  width: 16px;
  height: 16px;
  color: var(--fintech-indigo);
}

.assign-select-wrapper {
  width: 100%;
  position: relative;
}

.assign-select-field {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  transition: all 0.2s ease;
  appearance: none;
}

.assign-select-field:focus {
  outline: none;
  border-color: var(--fintech-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.assign-name-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}

.preview-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preview-icon-wrap svg {
  width: 15px;
  height: 15px;
}

.preview-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-title {
  font-size: 0.74rem;
  color: #475569;
}

.preview-highlight {
  font-size: 0.9rem;
  font-weight: 800;
  color: #1e40af;
}

/* Nút Vào Hệ Thống */
.btn-role-confirm {
  width: 100%;
  margin-top: 16px;
  padding: 13px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
}

.btn-role-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-role-confirm:active {
  transform: translateY(1px);
}

.btn-arrow-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn-role-confirm:hover .btn-arrow-icon {
  transform: translateX(3px);
}

.auth-footer-note {
  background: #f1f5f9;
  padding: 12px 24px;
  text-align: center;
  font-size: 0.74rem;
  color: #64748b;
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ==========================================================================
   TOPBAR USER BADGE & LOGOUT BUTTON
   ========================================================================== */
.topbar-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  padding: 4px 6px 4px 10px;
  border-radius: 28px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.topbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-user-avatar.avatar-ceo {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3);
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-user-id {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-user-role-tag {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #3730a3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar-user-role-tag.tag-ceo {
  background: #fae8ff;
  color: #86198f;
}

.topbar-user-scope {
  font-size: 0.68rem;
  color: var(--text-muted);
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 4px;
}

.btn-logout:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.btn-logout svg {
  width: 13px;
  height: 13px;
}

/* ==========================================================================
   THANH QUẢN TRỊ & PHÊ DUYỆT BÁO CÁO (APPROVAL GOVERNANCE BAR)
   ========================================================================== */
.approval-governance-bar {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border-card);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.approval-status-col {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.approval-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-approved {
  background: #ecfdf5;
  color: #065f46;
  border: 1.5px solid #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.badge-pending {
  background: #fffbeb;
  color: #92400e;
  border: 1.5px solid #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
  animation: pulseAmber 2s infinite ease-in-out;
}

@keyframes pulseAmber {
  0%, 100% { box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.25); }
}

.badge-draft {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-rejected {
  background: #fef2f2;
  color: #991b1b;
  border: 1.5px solid #ef4444;
}

.approval-badge-pill svg {
  width: 16px;
  height: 16px;
}

.approval-meta-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.approval-action-col {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ceo-feedback-input {
  padding: 7px 12px;
  font-size: 0.82rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  min-width: 260px;
}

.ceo-feedback-input:focus {
  outline: none;
  border-color: var(--fintech-purple);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.btn-approval-approve {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.btn-approval-approve:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-approval-reject {
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-approval-reject:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.btn-approval-submit {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
}

.btn-approval-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-approval-submit svg,
.btn-approval-approve svg,
.btn-approval-reject svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   TRUNG TÂM THẨM ĐỊNH & PHÊ DUYỆT BÁO CÁO CỦA CEO (CEO APPROVAL HUB)
   ========================================================================== */
.ceo-approval-center {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  margin-bottom: 24px;
  overflow: hidden;
  animation: fadeIn 0.3s ease-out;
}

.ceo-center-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #334155 100%);
  color: #ffffff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ceo-center-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ceo-title-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
}

.ceo-title-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.ceo-center-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.ceo-center-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0;
}

.ceo-center-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ceo-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-pending { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.dot-revision { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.dot-approved { background: #10b981; box-shadow: 0 0 6px #10b981; }

.ceo-approval-columns-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 20px 24px 24px;
  background: #f8fafc;
}

.ceo-approval-column {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

.ceo-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.ceo-col-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ceo-col-title-wrap h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.text-pending-icon {
  color: #d97706;
  width: 18px;
  height: 18px;
}

.text-revision-icon {
  color: #dc2626;
  width: 18px;
  height: 18px;
}

.ceo-col-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-pending-count {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-revision-count {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.ceo-col-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.ceo-reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

/* Thẻ báo cáo của từng công ty trong CEO Hub */
.ceo-report-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s ease;
  position: relative;
  border-left-width: 4px;
}

.ceo-report-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.08);
}

.card-pending {
  border-left-color: #f59e0b;
  background: linear-gradient(to right, #fffbeb 0%, #ffffff 25%);
}

.card-revision {
  border-left-color: #ef4444;
  background: linear-gradient(to right, #fef2f2 0%, #ffffff 25%);
}

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

.ceo-card-comp-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ceo-card-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ceo-card-meta-line {
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 8px;
}

.ceo-card-note-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.76rem;
  color: #334155;
  margin-bottom: 10px;
  line-height: 1.45;
}

.ceo-card-directive-box {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.76rem;
  color: #9f1239;
  margin-bottom: 10px;
  line-height: 1.45;
}

.ceo-card-directive-box strong {
  color: #881337;
}

.ceo-card-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

.btn-card-inspect {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-card-inspect:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-card-quick-approve {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-card-quick-approve:hover {
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.btn-card-quick-reject {
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-card-quick-reject:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.ceo-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.ceo-empty-state svg {
  width: 32px;
  height: 32px;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.ceo-empty-state p {
  font-size: 0.8rem;
  margin: 0;
}

/* ==========================================================================
   MODAL 1: CẢNH BÁO BỔ SUNG KHẨN CẤP TỪ CEO (REVISION ALERT MODAL)
   ========================================================================== */
.revision-modal-overlay {
  background: rgba(15, 23, 42, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.revision-alert-card {
  max-width: 620px;
  border: 2px solid #ef4444;
  box-shadow: 0 25px 60px -15px rgba(220, 38, 38, 0.35), 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.revision-card-header {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 60%, #b91c1c 100%);
  color: #ffffff;
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
}

.revision-pulse-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fef08a;
  flex-shrink: 0;
  animation: alertPulse 1.8s infinite;
}

@keyframes alertPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(254, 240, 138, 0.6); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(254, 240, 138, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(254, 240, 138, 0); }
}

.revision-pulse-icon svg {
  width: 26px;
  height: 26px;
}

.revision-header-text {
  flex: 1;
}

.revision-badge-alert {
  display: inline-block;
  background: #fef08a;
  color: #713f12;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.revision-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  line-height: 1.3;
}

.revision-subtitle {
  font-size: 0.82rem;
  color: #fecaca;
  margin: 0;
}

.btn-modal-close-white {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.btn-modal-close-white:hover {
  color: #ffffff;
}

.revision-card-body {
  padding: 22px 24px;
  background: #ffffff;
}

.revision-directive-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.directive-box-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #991b1b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.directive-box-label svg {
  width: 16px;
  height: 16px;
}

.directive-quote-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.55;
  margin: 0 0 10px 0;
  font-style: italic;
  white-space: pre-wrap;
}

.directive-meta-info {
  font-size: 0.74rem;
  color: #7f1d1d;
  font-weight: 500;
}

.revision-report-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.summary-mini-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mini-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mini-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.badge-status-rejected-inline {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.74rem;
  font-weight: 700;
  width: fit-content;
}

.revision-action-guide {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.8rem;
  color: #1e40af;
  line-height: 1.45;
  margin-bottom: 20px;
}

.revision-action-guide .guide-icon {
  width: 18px;
  height: 18px;
  color: #2563eb;
  flex-shrink: 0;
  margin-top: 2px;
}

.revision-action-guide strong {
  display: block;
  margin-bottom: 2px;
  color: #1e3a8a;
}

.revision-action-guide p {
  margin: 0;
}

.revision-modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-revision-proceed {
  width: 100%;
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all 0.2s ease;
}

.btn-revision-proceed:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

/* ==========================================================================
   MODAL 2: TRÌNH CEO PHÊ DUYỆT (SUBMIT APPROVAL MODAL)
   ========================================================================== */
.submit-approval-card {
  max-width: 580px;
}

.submit-card-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  color: #ffffff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.submit-header-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  flex-shrink: 0;
}

.submit-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

.submit-card-subtitle {
  font-size: 0.8rem;
  color: #c7d2fe;
  margin: 0;
}

.submit-card-body {
  padding: 22px 24px;
  background: #ffffff;
}

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

.submit-summary-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.box-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.box-val {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.submit-form-group {
  margin-bottom: 18px;
}

.submit-form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.submit-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.85rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  font-family: inherit;
  resize: vertical;
  background: #ffffff;
  color: var(--text-main);
  box-sizing: border-box;
}

.submit-textarea:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.submit-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-submit-ceo {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  transition: all 0.2s ease;
}

.btn-submit-ceo:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* ==========================================================================
   MODAL 3: CEO YÊU CẦU BỔ SUNG (CEO REJECT MODAL)
   ========================================================================== */
.ceo-reject-card {
  max-width: 580px;
}

.ceo-reject-header {
  background: linear-gradient(135deg, #881337 0%, #be123c 60%, #e11d48 100%);
  color: #ffffff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.reject-header-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fecdd3;
  flex-shrink: 0;
}

.reject-notice-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #9f1239;
  margin-bottom: 16px;
}

.notice-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #e11d48;
}

.directive-textarea {
  border-color: #fca5a5;
  background: #fffbfb;
}

.directive-textarea:focus {
  border-color: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

.btn-reject-confirm {
  background: linear-gradient(135deg, #be123c 0%, #e11d48 100%);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
  transition: all 0.2s ease;
}

.btn-reject-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.4);
}

@media (max-width: 900px) {
  .ceo-approval-columns-grid {
    grid-template-columns: 1fr;
  }
  .revision-report-summary {
    grid-template-columns: 1fr;
  }
  .submit-summary-grid {
    grid-template-columns: 1fr;
  }
}