:root {
  /* Modern Light Theme with Mộc (Wood) Branding */
  --bg-main: #f0fdf4; /* Nền chính cực kỳ nhạt, có sắc xanh lá nhẹ để tông xuyệt tông với mệnh Mộc */
  --bg-card: #ffffff; /* Nền trắng tinh khôi cho các bảng dữ liệu */
  --bg-modal: #ffffff;
  
  --text-primary: #0f172a; /* Slate 900 - Chữ đen rõ nét */
  --text-secondary: #475569; /* Slate 600 - Chữ xám đậm cho thông tin phụ */
  
  --accent-gold: #059669; /* Emerald 600 - Màu Xanh Lá đậm sang trọng làm màu chủ đạo (Mộc) */
  --accent-gold-hover: #047857; /* Emerald 700 */
  --accent-light: #d1fae5; /* Emerald 100 - Nền highlight nhẹ */
  
  --border-color: #e2e8f0; /* Viền xám nhạt hiện đại */
  --danger: #dc2626; 
  --success: #059669;

  /* Màu đặc trưng của Ngũ Hành - ĐẬM VÀ RÕ RÀNG */
  --element-kim: #f1f5f9; /* Bạc/Trắng xám */
  --element-thuy: #2563eb; /* Xanh dương đậm */
  --element-moc: #059669; /* Xanh lá đậm */
  --element-hoa: #ef4444; /* Đỏ tươi */
  --element-tho: #d97706; /* Nâu đất / Cam đất */
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  background-image: radial-gradient(circle at top right, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at bottom left, rgba(5, 150, 105, 0.05) 0%, transparent 50%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.app-container {
  max-width: 1250px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Header & Nav */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--accent-light);
  margin-bottom: 40px;
}

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

.logo-icon {
  font-size: 2.2rem;
  color: var(--accent-gold);
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.logo h1 span {
  color: var(--accent-gold);
}

.app-nav {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--accent-gold);
  background-color: var(--accent-light);
}

.nav-btn.active {
  color: #ffffff;
  background-color: var(--accent-gold);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2);
}

/* Tabs */
.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-pane.active {
  display: block;
}

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

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

.section-header h2 {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.5rem;
}

/* Modern Clean Table */
.final-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  border: 1px solid var(--border-color);
}

.final-table th, .final-table td {
  padding: 18px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.final-table th {
  background-color: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

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

.final-table tr {
  transition: background-color 0.2s;
}
.final-table tr:hover {
  background-color: #f8fafc;
}

/* Element Badges - Nổi bật đúng nghĩa Ngũ Hành */
.element-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.element-kim { background: var(--element-kim); color: #334155; border: 1px solid #cbd5e1; }
.element-thuy { background: var(--element-thuy); color: #ffffff; }
.element-moc { background: var(--element-moc); color: #ffffff; }
.element-hoa { background: var(--element-hoa); color: #ffffff; }
.element-tho { background: var(--element-tho); color: #ffffff; }

/* Buttons */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.btn-primary {
  background-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2);
}

.btn-primary:hover {
  background-color: var(--accent-gold-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(5, 150, 105, 0.3);
}

.btn-delete {
  background-color: #fef2f2;
  color: var(--danger);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-delete:hover {
  background-color: #fee2e2;
  border-color: #f87171;
}

.btn-assign {
  background-color: var(--accent-gold);
  color: white;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}
.btn-assign:hover {
  background-color: var(--accent-gold-hover);
  transform: translateY(-1px);
}

.badge-assigned {
  background-color: var(--accent-light);
  color: var(--accent-gold-hover);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-phones {
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: var(--bg-modal);
  width: 100%;
  max-width: 480px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalScale 0.3s ease;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover { 
  background: #f1f5f9;
  color: var(--danger); 
}

.modal-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #f8fafc;
}

/* Analysis Section */
.analysis-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 25px;
}

@media (max-width: 850px) {
  .analysis-layout {
    grid-template-columns: 1fr;
  }
}

.user-info-box {
  padding: 24px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  height: fit-content;
}
.user-info-box p {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 20px;
  font-size: 1.1rem;
  background: #f8fafc;
  border-radius: 16px;
  border: 2px dashed #cbd5e1;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}
.result-item:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.1);
  transform: translateY(-2px);
}

.result-info h4 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 800;
}

.result-score {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.score-10 { background: var(--success); color: white; border: none; }
.score-8 { background: #3b82f6; color: white; border: none; }
.score-5 { background: #f59e0b; color: white; border: none; }
.score-3 { background: #f97316; color: white; border: none; }
.score-0 { background: var(--danger); color: white; border: none; }

.result-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === XEM NGÀY TỐT LAYOUT === */
.good-days-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 25px;
  align-items: start;
}

.good-days-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.good-days-sidebar .card {
  margin-bottom: 0;
}

.mb-4 {
  margin-bottom: 20px;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }

@media (max-width: 900px) {
  .good-days-layout {
    grid-template-columns: 1fr;
  }
}

/* === GUEST CARD === */
.guest-card {
  background: linear-gradient(135deg, rgba(5,150,105,0.04) 0%, rgba(16,185,129,0.04) 100%);
  border: 1px solid rgba(5,150,105,0.2) !important;
}

.guest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  padding: 4px 0;
  transition: color 0.2s;
}

.guest-card-header:hover {
  color: var(--accent-gold);
}

.guest-card-header h3 {
  margin: 0;
}

.guest-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  margin-top: 10px;
  line-height: 1.4;
}

/* === SAVED GUESTS LIST === */
.saved-guests-list {
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

.saved-guest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.saved-guest-item:hover {
  background: var(--accent-light);
  border-color: rgba(5,150,105,0.2);
}

/* === TEMP SAVE BOX (Analysis) === */
.temp-save-box {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 14px;
}

.temp-save-header {
  font-weight: 700;
  font-size: 0.9rem;
  color: #92400e;
  margin-bottom: 10px;
}

.temp-save-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.badge-temp-saved {
  background: #fef9c3;
  color: #713f12;
  border: 1px solid #fcd34d;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

/* === BTN TEMP SAVE === */
.btn-temp-save {
  background: #fffbeb;
  color: #92400e;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-temp-save:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* === BTN SECONDARY === */
.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

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

.btn-secondary.active {
  background-color: var(--accent-gold);
  color: white;
  border-color: var(--accent-gold);
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.82rem !important;
}

/* === PAST DATES === */
.past-dates-hint {
  margin-top: 16px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  font-size: 0.9rem;
  text-align: center;
}

.past-dates-table {
  opacity: 0.7;
}

/* === ANALYSIS SIDEBAR improvement === */
.analysis-sidebar .card {
  margin-bottom: 0;
}

/* Card base styles (if not already defined) */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* === DAY EVALUATION BADGES === */
.day-eval-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.eval-badge-very-good {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.eval-badge-good {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

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

.eval-badge-bad {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.eval-badge-very-bad {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.eval-explanation-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.eval-explanation-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 2px 0;
  padding-left: 12px;
  position: relative;
}

.eval-explanation-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-gold);
}

