:root {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  --dark: #0f172a;
  --dark-surface: #1e293b;
  --gray-bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-focus: #10b981;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.07);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--gray-bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary-hover);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 3px 10px;
  border-radius: 9999px;
  margin-bottom: 6px;
}

.header-brand h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 8px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  font-size: 13px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Main Layout */
.main-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Card Common */
.input-card, .stats-section, .groups-container, .zero-codes-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card-header h2, .section-title-row h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
}

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

.help-hint {
  font-size: 13px;
  color: var(--primary-hover);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
}

/* Inputs */
.input-group {
  margin-top: 16px;
}

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

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.code-counter {
  font-size: 13px;
  color: var(--text-muted);
}

textarea#bill-codes {
  width: 100%;
  min-height: 180px;
  max-height: 400px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fdfdfd;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea#bill-codes:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  background: #fff;
}

.textarea-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary-hover);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-text.text-danger {
  color: var(--danger);
}

/* Config Row */
.config-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 24px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.group-count-wrap {
  margin-top: 0;
}

.number-input-box {
  display: flex;
  align-items: center;
  margin-top: 6px;
}

.number-input-box input[type="number"] {
  width: 80px;
  height: 42px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: 0;
  outline: none;
  -moz-appearance: textfield;
}

.number-input-box input[type="number"]::-webkit-outer-spin-button,
.number-input-box input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-step {
  width: 42px;
  height: 42px;
  background: #f1f5f9;
  border: 1.5px solid var(--border);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-step:first-child {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.btn-step:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.btn-step:hover {
  background: #e2e8f0;
}

.quick-preset-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.preset-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-preset {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-preset:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.btn-preset.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary .btn-text {
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: #fff;
  color: var(--dark);
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Progress box */
.progress-box {
  margin-top: 20px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.progress-content {
  flex: 1;
}

.progress-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 30%;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  animation: progressPulse 1.5s infinite ease-in-out;
}

@keyframes progressPulse {
  0% { transform: translateX(-100%); width: 40%; }
  100% { transform: translateX(300%); width: 60%; }
}

/* Stats Section */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
}

.stat-value.text-success {
  color: #059669;
}

.stat-value.text-primary {
  color: #0284c7;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.stats-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.btn-copy-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--dark-surface);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-copy-all:hover {
  background: var(--dark);
}

.btn-export-excel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.3);
  transition: all 0.15s;
}

.btn-export-excel:hover {
  background: #14532d;
  transform: translateY(-1px);
}

/* Groups Area */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.group-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.group-card-header {
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.group-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-badge-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.group-title-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
}

.group-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-tag-count {
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: 4px;
}

.group-summary-banner {
  padding: 12px 16px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #edf2f7;
}

.group-total-amount {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.group-diff-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.diff-balanced {
  background: #ecfdf5;
  color: #059669;
}

.diff-positive {
  background: #fffbeb;
  color: #b45309;
}

.diff-negative {
  background: #eff6ff;
  color: #1d4ed8;
}

.group-table-wrap {
  flex: 1;
  max-height: 380px;
  overflow-y: auto;
}

.group-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.group-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.group-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.group-table tr:last-child td {
  border-bottom: none;
}

.group-table tr:hover {
  background-color: #f8fafc;
}

.group-table .col-stt {
  width: 50px;
  color: var(--text-light);
  text-align: center;
}

.group-table .col-code {
  font-weight: 600;
  color: var(--dark);
}

.group-table .col-amount {
  text-align: right;
  font-weight: 700;
  color: #047857;
}

.group-card-footer {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

.btn-copy-group {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1.5px solid var(--primary);
  color: var(--primary-hover);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-copy-group:hover {
  background: var(--primary);
  color: #fff;
}

.btn-copy-group.copied {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

/* Zero codes details */
.zero-codes-card {
  border-color: #fed7aa;
  background: #fffaf0;
}

.zero-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #9a3412;
  user-select: none;
}

.btn-xs {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #fdba74;
  background: #fff;
  color: #c2410c;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.btn-xs:hover {
  background: #ffedd5;
}

.data-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 6px;
}

.data-table th, .data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #fef3c7;
  text-align: left;
}

.data-table th {
  background: #fff7ed;
  font-weight: 700;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark-surface);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 9999;
  animation: slideUp 0.2s ease-out;
}

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

/* Footer */
.app-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 640px) {
  .app-container {
    padding: 16px 12px 40px;
  }
  .header-brand h1 {
    font-size: 20px;
  }
  .config-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-primary, .btn-secondary {
    width: 100%;
  }
}

/* Group Name Input */
.group-name-box {
  margin-top: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s;
}

.group-name-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.group-name-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  background: transparent;
}

.group-name-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.group-name-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Export Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #f8fafc;
}

.modal-badge {
  font-size: 11px;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.modal-title-box h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.3px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-close-modal {
  background: #e2e8f0;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-close-modal:hover {
  background: #cbd5e1;
  color: var(--dark);
}

.modal-toolbar {
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-modal-action {
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-copy-code-name {
  background: #15803d;
  color: #fff;
  border: 1.5px solid #15803d;
}

.btn-copy-code-name:hover {
  background: #166534;
}

.btn-copy-name-only {
  background: #fff;
  color: #1e293b;
  border: 1.5px solid var(--border);
}

.btn-copy-name-only:hover {
  border-color: #15803d;
  color: #15803d;
  background: #f0fdf4;
}

.btn-copy-full {
  background: #fff;
  color: #1e293b;
  border: 1.5px solid var(--border);
}

.btn-copy-full:hover {
  border-color: #15803d;
  color: #15803d;
  background: #f0fdf4;
}

.modal-hint {
  font-size: 12px;
  color: #047857;
  font-weight: 500;
}

.excel-table-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  background: #f8fafc;
}

.excel-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.excel-col-letters th {
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
}

.excel-headers th {
  background: #0f5132;
  color: #ffffff;
  font-weight: 800;
  padding: 10px 14px;
  border: 1px solid #166534;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-align: left;
}

.excel-summary-row td {
  background: #fef9c3;
  border: 1px solid #fde047;
  padding: 9px 14px;
  font-weight: 700;
}

.excel-sheet-table tbody td {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.excel-sheet-table tbody tr:hover {
  background: #f1f5f9;
}

.excel-sheet-table tbody tr.row-unassigned td {
  background: #fffbeb;
  color: #9a3412;
}

.excel-tag-name {
  display: inline-block;
  font-weight: 700;
  color: #0f766e;
  background: #ccfbf1;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

/* =========================================================================
   3. BẢNG TỔNG HỢP TRỰC TIẾP TRÊN TRANG (SUMMARY SECTION)
   ========================================================================= */
.summary-section {
  margin-top: 36px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.summary-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.summary-badge-title {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #15803d;
  background: #dcfce7;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

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

.btn-copy-summary-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.28);
  transition: all 0.2s ease;
}

.btn-copy-summary-primary:hover {
  background: #14532d;
  box-shadow: 0 6px 16px rgba(21, 128, 61, 0.35);
  transform: translateY(-1px);
}

.btn-copy-summary-primary.copied {
  background: #047857 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

.btn-copy-summary-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-summary-sub:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.excel-preview-card {
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.excel-hint-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 18px;
  background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
  font-size: 13px;
  color: #166534;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-tag {
  background: #dcfce7;
  color: #15803d;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}

.summary-table-scroll {
  max-height: 540px;
  overflow-y: auto;
  overflow-x: auto;
}

.summary-table-scroll table {
  margin: 0;
}

.summary-table-scroll thead tr.excel-headers th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* =========================================================================
   NÚT TO: ĐÃ ĐIỀN TÊN XONG (CONFIRM BANNER & BUTTON)
   ========================================================================= */
.confirm-name-banner {
  margin-top: 24px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px solid #86efac;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.12);
}

.confirm-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.confirm-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.confirm-title {
  font-size: 16px;
  font-weight: 800;
  color: #166534;
}

.confirm-sub {
  font-size: 13px;
  color: #15803d;
  font-weight: 500;
}

.btn-confirm-names {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}

.btn-confirm-names:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.45);
  background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
}

.btn-confirm-names.loading {
  background: #0284c7 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
  pointer-events: none;
}

.btn-confirm-names.success {
  background: #059669 !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.4) !important;
}

.btn-sync-summary {
  background: #f0fdf4 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.btn-sync-summary:hover {
  background: #dcfce7 !important;
}

.excel-tag-zero {
  display: inline-block;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.excel-tag-missing {
  display: inline-block;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* =========================================================================
   CỘT CHIẾT KHẤU & CÁC CỘT MỚI (ẢNH 1)
   ========================================================================= */
.cell-discount {
  background-color: #ffedd5 !important;
  color: #c2410c !important;
  font-weight: 800 !important;
  text-align: center !important;
  border-left: 1.5px solid #fdba74 !important;
  border-right: 1.5px solid #fdba74 !important;
}

.excel-headers th.th-discount {
  background: #ea580c !important;
  color: #ffffff !important;
  text-align: center !important;
  border-color: #c2410c !important;
}

.cell-after-discount {
  font-weight: 700 !important;
  color: #047857 !important;
  text-align: right !important;
}

.cell-times {
  text-align: center !important;
  font-weight: 700 !important;
  color: #1e293b !important;
}

/* Nút Sao chép Mã & Số tiền (Đứng đầu tiên) */
.btn-copy-code-amount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transition: all 0.2s ease;
}

.btn-copy-code-amount:hover {
  background: #065f46;
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45);
  transform: translateY(-1px);
}

.btn-copy-code-amount.copied {
  background: #15803d !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4);
}

/* =========================================================================
   BỘ LỌC CỘT CHUẨN EXCEL (EXCEL-STYLE COLUMN FILTERS)
   ========================================================================= */
.th-filter-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  user-select: none;
}

.th-title-text {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.btn-filter-col {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-filter-col:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.08);
}

.btn-filter-col.active {
  background: #facc15 !important;
  color: #854d0e !important;
  border-color: #eab308 !important;
  font-weight: 900;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
}

/* Filter Dropdown Popup */
.excel-filter-dropdown {
  position: absolute;
  z-index: 9999;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 260px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #1e293b;
  display: none;
  animation: filterFadeIn 0.15s ease-out;
}

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

.filter-dropdown-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: #0f172a;
}

.filter-dropdown-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0 4px;
  line-height: 1;
}

.filter-dropdown-close:hover {
  color: #ef4444;
}

.filter-dropdown-sort {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-filter-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  text-align: left;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.1s;
}

.btn-filter-sort:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.filter-dropdown-search-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.filter-search-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.filter-search-input:focus {
  border-color: #10b981;
}

.filter-select-all-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  font-size: 11px;
  color: #0284c7;
}

.filter-link-btn {
  background: none;
  border: none;
  color: #0284c7;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 0;
}

.filter-link-btn:hover {
  text-decoration: underline;
}

.filter-options-container {
  max-height: 180px;
  overflow-y: auto;
  padding: 6px 12px;
}

.filter-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 12px;
}

.filter-option-item:hover {
  color: #059669;
}

.filter-option-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: #059669;
}

.filter-option-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-option-count {
  font-size: 11px;
  color: #94a3b8;
}

.filter-dropdown-actions {
  padding: 10px 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-filter-apply {
  padding: 6px 14px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.btn-filter-apply:hover {
  background: #047857;
}

.btn-filter-reset {
  padding: 6px 10px;
  background: #fff;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.btn-filter-reset:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Filter Active Banner */
.filter-active-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #854d0e;
}

.btn-clear-all-filters {
  background: #fef08a;
  border: 1px solid #eab308;
  color: #713f12;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-clear-all-filters:hover {
  background: #fde047;
}

/* Date policy banner */
.discount-policy-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}



