/* =========================================================
   CALENDAR 2026 - ADVANCED DUAL THEME (DARK & LIGHT)
   Distinct Colorful Monthly Backgrounds & Typography Tuning
   ========================================================= */

/* ---------------------------------------------------------
   1. COLOR TOKENS: DARK THEME (DEFAULT)
   --------------------------------------------------------- */
:root, [data-theme="dark"] {
  --bg-main: #0B0F19;
  --bg-surface: #111827;
  --bg-card: #182234;
  --bg-card-hover: #1E293B;
  --bg-input: rgba(0, 0, 0, 0.45);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-focus: rgba(245, 158, 11, 0.5);

  --text-main: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --accent-gold: #F59E0B;
  --accent-gold-dark: #D97706;
  --accent-gold-glow: rgba(245, 158, 11, 0.25);

  --accent-emerald: #10B981;
  --accent-sky: #0EA5E9;
  --accent-indigo: #6366F1;
  --accent-rose: #F43F5E;
  --accent-purple: #A855F7;
  --accent-teal: #14B8A6;
  --accent-orange: #F97316;

  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 14px 36px rgba(0, 0, 0, 0.5);
  --item-bg: rgba(255, 255, 255, 0.035);
  --item-hover: rgba(255, 255, 255, 0.075);
  --header-bg: rgba(11, 15, 25, 0.94);
  --table-header-bg: #162032;
  --table-border: rgba(255, 255, 255, 0.06);

  --body-radial: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.07) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.06) 0px, transparent 50%);
}

/* ---------------------------------------------------------
   2. COLOR TOKENS: LIGHT THEME (GIAO DIỆN SÁNG)
   --------------------------------------------------------- */
[data-theme="light"] {
  --bg-main: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-input: #FFFFFF;
  --border-color: #E2E8F0;
  --border-hover: #CBD5E1;
  --border-focus: rgba(217, 119, 6, 0.5);

  --text-main: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-dim: #94A3B8;

  --accent-gold: #D97706;
  --accent-gold-dark: #B45309;
  --accent-gold-glow: rgba(217, 119, 6, 0.2);

  --accent-emerald: #059669;
  --accent-sky: #0284C7;
  --accent-indigo: #4F46E5;
  --accent-rose: #E11D48;
  --accent-purple: #9333EA;
  --accent-teal: #0D9488;
  --accent-orange: #EA580C;

  --card-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --card-shadow-hover: 0 10px 28px rgba(15, 23, 42, 0.1);
  --item-bg: #F8FAFC;
  --item-hover: #F1F5F9;
  --header-bg: rgba(255, 255, 255, 0.94);
  --table-header-bg: #F1F5F9;
  --table-border: #E2E8F0;

  --body-radial: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.05) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.04) 0px, transparent 50%);
}

/* =========================================================
   BASE RESET & GLOBAL SETTINGS
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
}

body {
  background-color: var(--bg-main);
  background-image: var(--body-radial);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 30px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Utilities */
.text-amber { color: var(--accent-gold) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-sky { color: var(--accent-sky) !important; }
.text-indigo { color: var(--accent-indigo) !important; }
.text-danger { color: var(--accent-rose) !important; }
.text-success { color: var(--accent-emerald) !important; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }

/* =========================================================
   APP WRAPPER & HEADER
   ========================================================= */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1650px;
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: max(14px, calc(env(safe-area-inset-top, 0px) + 12px)) 24px 14px 24px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

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

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

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
  color: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px var(--accent-gold-glow);
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.year-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 9999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
  color: #0F172A;
  box-shadow: 0 4px 14px var(--accent-gold-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

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

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

[data-theme="light"] .btn-outline {
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

[data-theme="light"] .btn-outline:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
}

.btn-theme {
  font-weight: 700;
}

.btn-theme i {
  color: var(--accent-gold);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

[data-theme="light"] .btn-secondary {
  background: #E2E8F0;
  color: var(--text-secondary);
}

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

/* =========================================================
   MAIN CONTENT AREA
   ========================================================= */
.app-main {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* =========================================================
   STATS KPI DASHBOARD
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--card-shadow);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stat-main-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.stat-text-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.stat-main-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
}

.stat-card.stat-total {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, var(--bg-surface) 100%);
  border-color: rgba(245, 158, 11, 0.35);
}

.stat-card.stat-current {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, var(--bg-surface) 100%);
  border-color: rgba(14, 165, 233, 0.3);
}

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bg-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }
.bg-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.bg-indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.bg-sky { background: rgba(14, 165, 233, 0.15); color: var(--accent-sky); }

.stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  white-space: nowrap;
  line-height: 1.2;
}

.stat-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* =========================================================
   CONTROLS & SEARCH BAR
   ========================================================= */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: var(--card-shadow);
}

.search-box {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 0.95rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0 38px 0 38px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-gold-glow);
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-clear-search:hover { color: var(--text-main); }

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

.select-control {
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.select-control option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.view-switch-tabs {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 3px;
}

[data-theme="light"] .view-switch-tabs {
  background: #E2E8F0;
}

.switch-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.switch-tab:hover {
  color: var(--text-main);
}

.switch-tab.active {
  background: var(--accent-gold);
  color: #0F172A;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.tab-text-short {
  display: none;
}

.tab-text-full {
  display: inline;
}

/* Layout Columns Switcher (3 Cols / 2 Cols) */
.layout-switch-tabs {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 3px;
}

[data-theme="light"] .layout-switch-tabs {
  background: #E2E8F0;
}

.layout-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.layout-tab:hover {
  color: var(--text-main);
}

.layout-tab.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-weight: 700;
}

[data-theme="light"] .layout-tab.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (max-width: 820px) {
  .layout-switch-tabs {
    display: none;
  }
}

/* =========================================================
   VIEW 1: 12-MONTH CALENDAR GRID
   Default: 3 Columns per row (4 Quý chuẩn đẹp & rộng rãi)
   ========================================================= */
.calendar-months-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  transition: all 0.3s ease;
}

/* Khi người dùng chọn chế độ 2 Cột */
.calendar-months-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 1100px) {
  .calendar-months-grid,
  .calendar-months-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .calendar-months-grid,
  .calendar-months-grid.cols-2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* Individual Month Card */
.month-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.month-box:hover {
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-3px);
}

/* ---------------------------------------------------------
   DISTINCT SEASONAL BACKGROUND THEMES FOR 12 MONTHS
   --------------------------------------------------------- */
/* Tháng 1: Winter Sky Blue */
.month-theme-1 {
  --m-color: #0284C7;
  --m-gradient: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(2, 132, 199, 0.25) !important;
}

/* Tháng 2: Festive Ruby Red / Tết Cổ Truyền */
.month-theme-2 {
  --m-color: #E11D48;
  --m-gradient: linear-gradient(135deg, #E11D48 0%, #BE123C 100%);
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.09) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(225, 29, 72, 0.25) !important;
}

/* Tháng 3: Spring Emerald Green */
.month-theme-3 {
  --m-color: #059669;
  --m-gradient: linear-gradient(135deg, #059669 0%, #047857 100%);
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(5, 150, 105, 0.25) !important;
}

/* Tháng 4: Sunshine Amber / Giỗ Tổ & 30/4 */
.month-theme-4 {
  --m-color: #D97706;
  --m-gradient: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(217, 119, 6, 0.25) !important;
}

/* Tháng 5: Royal Sapphire Blue */
.month-theme-5 {
  --m-color: #2563EB;
  --m-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
}

/* Tháng 6: Summer Amethyst Violet */
.month-theme-6 {
  --m-color: #7C3AED;
  --m-gradient: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(124, 58, 237, 0.25) !important;
}

/* Tháng 7: Ocean Mint Teal */
.month-theme-7 {
  --m-color: #0D9488;
  --m-gradient: linear-gradient(135deg, #0D9488 0%, #0F766E 100%);
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(13, 148, 136, 0.25) !important;
}

/* Tháng 8: Sunset Coral Orange */
.month-theme-8 {
  --m-color: #EA580C;
  --m-gradient: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
  background: linear-gradient(180deg, rgba(234, 88, 12, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(234, 88, 12, 0.25) !important;
}

/* Tháng 9: Autumn Deep Indigo */
.month-theme-9 {
  --m-color: #4F46E5;
  --m-gradient: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(79, 70, 229, 0.25) !important;
}

/* Tháng 10: Rich Gold Amber / Vàng 9999 (Tháng này) */
.month-theme-10 {
  --m-color: #F59E0B;
  --m-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, var(--bg-surface) 40%) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.15) !important;
}

/* Tháng 11: Frost Cyan / Black Friday */
.month-theme-11 {
  --m-color: #0891B2;
  --m-gradient: linear-gradient(135deg, #0891B2 0%, #0E7490 100%);
  background: linear-gradient(180deg, rgba(8, 145, 178, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(8, 145, 178, 0.25) !important;
}

/* Tháng 12: Holiday Velvet Purple / Tích Lũy Cuối Năm */
.month-theme-12 {
  --m-color: #9333EA;
  --m-gradient: linear-gradient(135deg, #9333EA 0%, #7E22CE 100%);
  background: linear-gradient(180deg, rgba(147, 51, 234, 0.08) 0%, var(--bg-surface) 35%) !important;
  border-color: rgba(147, 51, 234, 0.25) !important;
}

/* Month Box Header: Translucent, luxury styling, clickable */
.month-box-header {
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.month-box-header:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%);
}

.month-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.month-num-pill {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--m-gradient, linear-gradient(135deg, #1E293B, #0F172A));
  color: #FFFFFF;
  font-size: 0.92rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

.month-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.month-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.badge-current-month {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #0F172A;
  padding: 1px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-top-month {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.month-subline-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.month-header-hint {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 0.72rem;
  opacity: 0.9;
}

.month-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.month-sum-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.month-sum-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.month-sum-amount {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.month-sum-amount.has-expense {
  color: var(--accent-gold);
}

.btn-month-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-month-add:hover {
  background: var(--accent-gold);
  color: #0F172A;
  border-color: var(--accent-gold);
  transform: scale(1.12);
}

/* Month Family Cash Flow Strip (Thu nhập vs Chi tiêu vs Số dư) */
.month-cashflow-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="light"] .month-cashflow-strip {
  background: #F1F5F9;
}

.month-cashflow-strip:hover {
  background: rgba(255, 255, 255, 0.06);
}

.cf-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cf-label {
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cf-val {
  font-size: 0.82rem;
  white-space: nowrap;
}

.cf-divider {
  width: 1px;
  height: 15px;
  background: var(--border-color);
}

/* Payer Badges */
.item-payer-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.payer-husband {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-sky);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.payer-wife {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.payer-shared {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Salary Modal specific styling */
.salary-scope-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.salary-total-preview-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 14px 18px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.preview-val {
  font-size: 1.25rem;
  letter-spacing: -0.3px;
}

.preview-subline {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Month Items List */
.month-items-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* Luxury Modern Item Row inside Month */
.item-row {
  background: var(--item-bg);
  border: 1px solid var(--border-color);
  border-radius: 13px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.item-row:hover {
  background: var(--item-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.item-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.item-main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-date-badge {
  color: var(--accent-sky);
  font-weight: 700;
}

.item-cat-badge {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
}

[data-theme="light"] .item-cat-badge {
  background: #E2E8F0;
  color: #334155;
}

.item-notes-text {
  color: var(--text-dim);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.item-price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.item-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
  white-space: nowrap;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.item-row:hover .item-actions {
  opacity: 1;
}

.btn-item-action {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-item-action:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.btn-item-del:hover {
  color: var(--accent-rose) !important;
  background: rgba(244, 63, 94, 0.15) !important;
}

/* Month Highlight Pulse Animation */
.month-highlight-pulse {
  animation: pulseMonthGlow 1s ease-in-out 3;
}

@keyframes pulseMonthGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    border-color: rgba(245, 158, 11, 0.9);
  }
  50% {
    box-shadow: 0 0 28px 6px rgba(245, 158, 11, 0.5);
    border-color: rgba(245, 158, 11, 1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    border-color: rgba(245, 158, 11, 0.4);
  }
}

/* Empty Month State */
.month-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 12px;
  color: var(--text-dim);
  gap: 8px;
}

.month-empty i {
  font-size: 1.5rem;
  opacity: 0.35;
}

.month-empty p {
  font-size: 0.8rem;
}

.btn-month-quick-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.btn-month-quick-add:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* =========================================================
   VIEW 2: TABLE LIST VIEW
   ========================================================= */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.custom-table th {
  background: var(--table-header-bg);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tbody tr:hover {
  background: var(--item-hover);
}

.table-total-row td {
  background: var(--table-header-bg);
  font-size: 1rem;
  padding: 16px 16px;
  border-top: 2px solid var(--accent-gold);
}

.table-empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

/* =========================================================
   MODAL DIALOG
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-drag-handle {
  display: none;
}

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

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

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

.modal-title-icon {
  font-size: 1.25rem;
  color: var(--accent-gold);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

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

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 14px;
}

@media (max-width: 500px) {
  .form-row {
    flex-direction: column;
    gap: 14px;
  }
}

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

.form-group.flex-1 { flex: 1; }

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

.form-control {
  width: 100%;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-gold-glow);
}

.modal-salary-card {
  max-width: 820px !important;
  width: 100%;
}

.salary-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin: 6px 0;
}

.salary-col-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

[data-theme="light"] .salary-col-card {
  background: #F8FAFC;
}

.salary-col-card.base-card {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.salary-col-card.bonus-card {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.salary-col-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.salary-col-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.salary-col-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.35;
}

@media (max-width: 768px) {
  .modal-salary-card {
    max-width: 100% !important;
  }
  .salary-two-cols {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.bonus-section-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.bonus-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bonus-section-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.mstat-btn-edit {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.mstat-btn-edit:hover {
  background: rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.input-currency-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-currency-wrap .form-control {
  padding-right: 36px;
}

.currency-symbol {
  position: absolute;
  right: 14px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-gold);
  pointer-events: none;
}

.price-helper {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
}

.quick-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

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

.btn-tag {
  background: var(--item-bg);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tag:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

/* =========================================================
   TOAST NOTIFICATION
   ========================================================= */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  z-index: 2000;
  pointer-events: none;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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

/* =========================================================
   FOOTER
   ========================================================= */
.app-footer {
  padding: 24px;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-text-link {
  background: transparent;
  border: none;
  color: var(--text-dim);
  text-decoration: underline;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-text-link:hover { color: var(--text-muted); }

/* Category Pills Bar (Touch Friendly & Luxury) */
.category-pills-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}

.category-pills-bar::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.cat-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.cat-pill.active {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #0F172A;
  font-weight: 800;
  border-color: var(--accent-gold);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.hidden-select {
  display: none !important;
}

/* Interactive Stat Cards */
.stat-clickable {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-clickable:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15);
}

.stat-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.stat-badge-year {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.stat-pill-action {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-gold);
  white-space: nowrap;
}

.stat-chevron {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Month Details Modal */
.modal-month-card {
  max-width: 620px;
  width: 100%;
}

.month-pill-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #0F172A;
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.modal-month-stat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
}

[data-theme="light"] .modal-month-stat-bar {
  background: #F1F5F9;
}

.month-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mstat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.mstat-val {
  font-size: 1.15rem;
}

.month-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
}

.modal-month-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
}

.modal-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--item-bg);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.modal-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.modal-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-item-idx {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-dim);
}

.modal-item-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.modal-item-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.modal-item-price-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.modal-item-price {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.modal-item-action-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.modal-month-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.month-empty-modal {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-modal-icon {
  font-size: 40px;
  color: var(--text-dim);
  opacity: 0.5;
}

/* TIEN.day Budget Analysis View */
.budget-analysis-view {
  width: 100%;
}

.budget-table-card {
  padding: 24px;
}

.budget-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.budget-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.budget-main-heading {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.budget-sub-heading {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.link-tienday {
  color: var(--accent-gold);
  text-decoration: underline;
  font-weight: 700;
}

.budget-month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.budget-month-picker label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.budget-streams-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.stream-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stream-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stream-amount {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.stream-note {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.budget-cat-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-cat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.budget-type-tag {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
}

.budget-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-good {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-over {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-dim);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* =========================================================
   PASSWORD PROTECTION & LOCK SCREEN MODAL
   ========================================================= */
.lock-screen-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(7, 10, 19, 0.95);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

[data-theme="light"] .lock-screen-backdrop {
  background: rgba(241, 245, 249, 0.96);
}

.lock-screen-backdrop.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.lock-screen-card {
  width: 100%;
  max-width: 430px;
  background: linear-gradient(150deg, #172133 0%, #0D1322 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 26px;
  padding: 36px 30px 30px 30px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.8), 0 0 50px rgba(245, 158, 11, 0.15);
  text-align: center;
  animation: lockCardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .lock-screen-card {
  background: #FFFFFF;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 25px 50px -10px rgba(0, 0, 0, 0.15), 0 0 40px rgba(245, 158, 11, 0.12);
}

@keyframes lockCardPop {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.lock-icon-glow {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px auto;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.1) 100%);
  border: 1px solid rgba(245, 158, 11, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #F59E0B;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.35);
}

.lock-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.lock-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lock-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.lock-input-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lock-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.lock-field-icon {
  position: absolute;
  left: 16px;
  color: var(--text-dim);
  font-size: 1rem;
  pointer-events: none;
}

.lock-input-wrap input {
  width: 100%;
  height: 52px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 0 46px 0 44px;
  font-family: inherit;
  font-size: 1.15rem;
  color: var(--text-main);
  font-weight: 700;
  text-align: center;
  letter-spacing: 3px;
  outline: none;
  transition: all 0.2s ease;
}

[data-theme="light"] .lock-input-wrap input {
  background: #F8FAFC;
}

.lock-input-wrap input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-glow);
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-toggle-eye:hover {
  color: var(--text-main);
}

.lock-error-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #EF4444;
  font-size: 0.82rem;
  font-weight: 600;
  animation: shakeError 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeError {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

.lock-options {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

.lock-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.lock-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.btn-lock-submit {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.38);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-lock-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.5);
}

.lock-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.lock-hint strong {
  color: var(--accent-gold);
}

/* Password Modal Inputs & Eye buttons */
.modal-password-card {
  max-width: 480px !important;
  width: 100%;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-field-wrap .form-control {
  width: 100% !important;
  height: 48px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 0 48px 0 16px !important;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.password-field-wrap .form-control:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-gold-glow);
}

.password-field-wrap .btn-toggle-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  z-index: 2;
}

.password-field-wrap .btn-toggle-eye:hover {
  color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.08);
}

.pwd-error-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #EF4444;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 4px;
}

/* Header Buttons styling */
.btn-pwd,
.btn-lock {
  font-size: 0.85rem;
}

/* Floating Action Button (FAB) for Mobile */
.mobile-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: max(22px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  z-index: 95;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #0F172A;
  border: none;
  border-radius: 9999px;
  padding: 13px 22px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.45);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation;
}

.mobile-fab:active {
  transform: scale(0.94);
}

/* =========================================================
   MOBILE-FIRST BOTTOM SHEET MODAL & RESPONSIVE OPTIMIZATION
   ========================================================= */
@media (max-width: 640px) {
  .app-header {
    padding: max(10px, calc(env(safe-area-inset-top, 0px) + 6px)) 12px 10px 12px;
  }

  .header-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .brand-group {
    gap: 8px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    font-size: 16px;
    border-radius: 9px;
  }

  .brand-title {
    font-size: 1.05rem;
    font-weight: 800;
  }

  .badge-year {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  .brand-subtitle {
    display: none;
  }

  /* Mobile Header Actions */
  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* Hide redundant salary button from header since Card 1 has Sửa Lương */
  .header-actions #btn-open-salary-modal {
    display: none;
  }

  /* Compact round theme button */
  .header-actions #btn-theme-toggle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
  }
  .header-actions #theme-toggle-text {
    display: none;
  }

  /* Compact round Excel button */
  .header-actions #btn-export-excel {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
  }
  .header-actions #btn-export-excel span {
    display: none;
  }

  /* Compact round Password button on mobile */
  .header-actions #btn-open-password-modal {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
  }
  .header-actions #btn-open-password-modal span {
    display: none;
  }

  /* Compact round Lock button on mobile */
  .header-actions #btn-lock-screen {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
  }
  .header-actions #btn-lock-screen span {
    display: none;
  }

  /* Prominent sleek "+ Thêm" button right in Header (Never blocks screen) */
  .header-actions #btn-open-add-modal {
    display: inline-flex !important;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #0F172A;
    border: none;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
    align-items: center;
    gap: 5px;
    white-space: nowrap;
  }
  .header-actions #btn-open-add-modal span {
    display: inline !important;
  }

  /* Completely HIDE the floating FAB that blocked search and tabs */
  .mobile-fab {
    display: none !important;
  }

  .app-main {
    padding: 10px 12px;
    gap: 12px;
  }

  /* Luxury Full-Width Row Cards on Mobile (No text wrapping, no empty holes) */
  .stats-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .stat-card {
    padding: 10px 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-surface);
  }

  .stat-card.stat-income-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, var(--bg-surface) 100%);
    border-color: rgba(16, 185, 129, 0.35);
  }

  .stat-card.stat-total {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-surface) 100%);
    border-color: rgba(245, 158, 11, 0.25);
  }

  .stat-main-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
  }

  .stat-icon-wrap {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 15px;
    border-radius: 10px;
  }

  .stat-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stat-note {
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stat-main-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    text-align: right;
  }

  .stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
  }

  .stat-pill-action,
  .stat-badge-year,
  .stat-badge-status {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
  }

  /* Controls & Search */
  .controls-bar {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 14px;
  }

  .controls-top-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search-box {
    min-width: 0;
    width: 100%;
    height: 38px;
  }

  .filter-actions-group {
    width: 100%;
    justify-content: space-between;
  }

  .view-switch-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .switch-tab {
    flex: 1;
    justify-content: center;
    padding: 6px 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    gap: 4px;
  }

  .tab-text-short {
    display: inline !important;
  }

  .tab-text-full {
    display: none !important;
  }

  /* TIEN.day Budget mobile */
  .budget-streams-strip {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 14px;
  }

  .stream-amount {
    font-size: 1.1rem;
  }

  /* Mobile Bottom Sheet Modal */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 24px 24px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    animation: slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
  }

  .modal-drag-handle {
    display: block;
    width: 48px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    margin: 10px auto 4px auto;
  }

  [data-theme="light"] .modal-drag-handle {
    background: rgba(0, 0, 0, 0.2);
  }

  .modal-header {
    padding: 12px 18px 14px 18px;
  }

  .modal-body {
    padding: 14px 18px;
    max-height: calc(90dvh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 14px;
  }

  /* Prevent iOS automatic zoom by keeping font-size >= 16px */
  .form-control,
  .select-control {
    font-size: 16px !important;
    height: 48px;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .quick-tags {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
  }

  .quick-tags::-webkit-scrollbar {
    display: none;
  }

  .btn-tag {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
    padding: 12px 18px max(14px, env(safe-area-inset-bottom, 14px)) 18px;
    margin: 0 -18px -14px -18px;
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.2);
    z-index: 10;
  }

  .modal-footer .btn {
    flex: 1;
    height: 46px;
    font-size: 0.95rem;
  }
}
