/* ----------------------------------------------------
   HỆ THỐNG BIẾN THẨM MỸ (DESIGN SYSTEM STYLE)
   Màu chủ đạo: Rose Gold, Nền Kem Ấm, chữ Slate tối giản
   ---------------------------------------------------- */
:root {
  color-scheme: only light !important;
  supported-color-schemes: light;
  
  --color-primary: #c5a880;          /* Rose Gold chuẩn */
  --color-primary-hover: #b3946d;    /* Rose Gold đậm khi hover */
  --color-primary-light: #f7f3ed;    /* Nền Rose Gold cực nhạt */
  --color-primary-glow: rgba(197, 168, 128, 0.25);
  
  --color-bg: #fdfcfb;               /* Nền kem ấm, sang trọng */
  --color-card-bg: rgba(255, 255, 255, 0.95);
  --color-white: #ffffff;            /* Màu trắng chuẩn */
  --color-text-main: #332d29;        /* Chữ màu than ấm */
  --color-text-muted: #70655e;       /* Chữ chú thích, mờ hơn */
  --color-border: #ede7e1;           /* Viền thanh mảnh màu ấm */
  --color-header-bg: #f7f3ed;        /* Màu nền header bảng */
  --color-table-row-hover: rgba(247, 243, 237, 0.3);
  --color-bg-gradient-1: rgba(247, 243, 237, 0.5);
  --color-bg-gradient-2: rgba(243, 235, 225, 0.4);
  
  --color-success: #67856f;          /* Sage dịu, hợp nền kem atelier */
  --color-success-bg: #eff5f0;       /* Nền hàng hoàn thành */
  --color-success-border: #c8d8cb;
  
  --color-danger: #f43f5e;           /* Đỏ cho hành động xoá, huỷ */
  --color-danger-bg: #fff1f2;
  --color-danger-border: #fecdd3;

  /* Trạng thái lịch dùng chung cho mọi theme sáng. */
  --status-completed-text: #166534;
  --status-completed-bg: #ecfdf3;
  --status-completed-border: #86efac;
  --status-overdue-text: #92400e;
  --status-overdue-bg: #fffbeb;
  --status-overdue-border: #fcd34d;
  --status-canceled-text: #b42318;
  --status-canceled-bg: #fff1f0;
  --status-canceled-border: #fda29b;

  --shadow-sm: 0 2px 8px rgba(51, 45, 41, 0.04);
  --shadow-md: 0 8px 24px rgba(197, 168, 128, 0.08);
  --shadow-lg: 0 16px 40px rgba(197, 168, 128, 0.15);

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;

  --transition: color 0.4s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.4s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.4s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.4s cubic-bezier(0.32, 0.72, 0, 1), transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  --transition-spring: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.5s ease, background-color 0.5s ease;

  /* Component personality: Rose Gold mềm, thoáng và trang trọng */
  --ui-radius-control: 12px;
  --ui-radius-card: 22px;
  --ui-radius-modal: 20px;
  --ui-radius-badge: 999px;
  --ui-border-width: 1px;
  --ui-card-shadow: 0 10px 30px rgba(197, 168, 128, 0.11);
  --ui-control-height: 42px;
  --ui-heading-font: 'Playfair Display', Georgia, serif;
  --ui-heading-tracking: 0.01em;
  --ui-label-transform: uppercase;
  --ui-label-tracking: 0.08em;
  --ui-table-cell-y: 12px;
  --ui-table-cell-x: 12px;
  --ui-hover-lift: -2px;
  --ui-press-scale: 0.96;
  --ui-motion-duration: 320ms;
  --ui-motion-easing: cubic-bezier(0.32, 0.72, 0, 1);

  /* Theme Tokens Mặc Định (Rose Gold Classic) */
  --theme-header-bar: linear-gradient(90deg, #e5c158, var(--color-primary), #dfb689);
  --theme-bg-glow-1: rgba(247, 243, 237, 0.5);
  --theme-bg-glow-2: rgba(243, 235, 225, 0.4);
  --theme-btn-gradient: linear-gradient(135deg, #c5a880, #b3946d);
  --theme-btn-text: #ffffff;
  --theme-btn-shadow: 0 4px 14px rgba(197, 168, 128, 0.35);
  --theme-fab-bg: linear-gradient(135deg, #c5a880, #b3946d);
  --theme-fab-color: #ffffff;
  --theme-fab-shadow: 0 4px 14px rgba(197, 168, 128, 0.45);

  --theme-stat-total-bg: #f7f3ed;
  --theme-stat-total-border: #ede7e1;
  --theme-stat-total-text: #332d29;
  
  --theme-stat-completed-bg: #eff5f0;
  --theme-stat-completed-border: #c8d8cb;
  --theme-stat-completed-text: #67856f;
  
  --theme-stat-revenue-bg: #fdf8f3;
  --theme-stat-revenue-border: #e8d7c3;
  --theme-stat-revenue-text: #b3946d;

  --theme-table-header-bg: #f7f3ed;
  --theme-table-header-text: #332d29;
  --theme-table-date-border: #c5a880;

  /* Theme Modal & Financial Tokens */
  --theme-modal-title-color: #332d29;
  --theme-modal-title-gradient: linear-gradient(135deg, #2b2623, #c5a880);
  --theme-modal-fin-bg: #fdfaf6;
  --theme-modal-fin-border: #ede7e1;
  --theme-modal-fin-shadow: 0 4px 16px rgba(197, 168, 128, 0.08);
  --theme-fin-deposit-color: #10b981;
  --theme-fin-remaining-color: #b3946d;
  --theme-fin-remaining-border: rgba(197, 168, 128, 0.35);
  --theme-fin-total-color: #332d29;
  --theme-fin-total-border: #c5a880;
  --theme-btn-secondary-bg: #f7f3ed;
  --theme-btn-secondary-color: #b3946d;
  --theme-btn-secondary-border: #ede7e1;
  --theme-btn-secondary-hover-bg: #ede7e1;
  --theme-btn-secondary-hover-border: #c5a880;
}

/* ====================================================
   APP THEMES (HỆ THỐNG GIAO DIỆN ĐA TẦNG NGHỆ THUẬT)
   ==================================================== */

/* 1. Classic Retro (nhựa xám hoài cổ + cụm nút máy chơi game) */
[data-theme="classic-gray"] {
  --color-primary: #365fb8;
  --color-primary-hover: #294b93;
  --color-primary-light: #eceef0;
  --color-primary-glow: rgba(54, 95, 184, 0.24);
  
  --color-bg: #d9dade;
  --color-card-bg: #f1f2f3;
  --color-white: #fafaf8;
  --color-text-main: #282c33;
  --color-text-muted: #575e68;
  --color-border: #9b9fa7;
  --color-header-bg: #e7e8ea;
  --color-table-row-hover: rgba(255, 255, 255, 0.56);
  --color-bg-gradient-1: rgba(255, 255, 255, 0.56);
  --color-bg-gradient-2: rgba(54, 95, 184, 0.1);
  --shadow-sm: 0 2px 0 rgba(255, 255, 255, 0.78), 0 4px 8px rgba(41, 45, 52, 0.1);
  --shadow-md: 0 3px 0 rgba(255, 255, 255, 0.82), 0 12px 24px rgba(41, 45, 52, 0.14);
  --shadow-lg: 0 4px 0 rgba(255, 255, 255, 0.82), 0 20px 42px rgba(41, 45, 52, 0.18);

  --retro-button-red: #d95850;
  --retro-button-yellow: #e8b94f;
  --retro-button-blue: #3d6fd3;
  --retro-button-green: #3c9a70;
  --retro-graphite: #343942;

  --theme-header-bar: linear-gradient(90deg, #d95850 0 25%, #e8b94f 25% 50%, #3d6fd3 50% 75%, #3c9a70 75% 100%);
  --theme-bg-glow-1: rgba(255, 255, 255, 0.62);
  --theme-bg-glow-2: rgba(54, 95, 184, 0.1);
  --theme-btn-gradient: linear-gradient(180deg, #4778dc, #3159aa);
  --theme-btn-text: #ffffff;
  --theme-btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 2px 0 #244486, 0 6px 12px rgba(41, 45, 52, 0.2);
  --theme-fab-bg: linear-gradient(180deg, #e16961, #c54740);
  --theme-fab-color: #ffffff;
  --theme-fab-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 5px 0 #9e312c, 0 12px 22px rgba(41, 45, 52, 0.28);

  --theme-stat-total-bg: #f0f2f4;
  --theme-stat-total-border: #8ea5d9;
  --theme-stat-total-text: #3159aa;
  
  --theme-stat-completed-bg: #edf4f0;
  --theme-stat-completed-border: #79a88e;
  --theme-stat-completed-text: #287755;
  
  --theme-stat-revenue-bg: #f6f1df;
  --theme-stat-revenue-border: #c9aa58;
  --theme-stat-revenue-text: #8c6815;

  --theme-table-header-bg: #343942;
  --theme-table-header-text: #f4f4f1;
  --theme-table-date-border: #3d6fd3;

  --theme-modal-title-color: #292d34;
  --theme-modal-title-gradient: linear-gradient(135deg, #292d34, #365fb8);
  --theme-modal-fin-bg: #eaebed;
  --theme-modal-fin-border: #a3a7ae;
  --theme-modal-fin-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --theme-fin-deposit-color: #287755;
  --theme-fin-remaining-color: #a83c36;
  --theme-fin-remaining-border: rgba(217, 88, 80, 0.38);
  --theme-fin-total-color: #3159aa;
  --theme-fin-total-border: #365fb8;
  --theme-btn-secondary-bg: #e6e8eb;
  --theme-btn-secondary-color: #343942;
  --theme-btn-secondary-border: #969aa2;
  --theme-btn-secondary-hover-bg: #f3f4f5;
  --theme-btn-secondary-hover-border: #343942;

  /* Tactile console: bo mềm, viền kép và phản hồi như nút vật lý */
  --ui-radius-control: 12px;
  --ui-radius-card: 16px;
  --ui-radius-modal: 18px;
  --ui-radius-badge: 999px;
  --ui-border-width: 2px;
  --ui-card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #8f939a, 0 12px 24px rgba(41, 45, 52, 0.16);
  --ui-control-height: 42px;
  --ui-heading-font: 'Outfit', Arial, sans-serif;
  --ui-heading-tracking: -0.02em;
  --ui-label-tracking: 0.08em;
  --ui-table-cell-y: 11px;
  --ui-hover-lift: -2px;
  --ui-press-scale: 0.97;
  --ui-motion-duration: 210ms;
  --ui-motion-easing: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 2. Professional Dark (design-system navy + single blue accent) */
[data-theme="dark-mode"] {
  color-scheme: dark only !important;
  supported-color-schemes: dark;
  
  --color-primary: #5b7cf7;
  --color-primary-hover: #7290ff;
  --color-primary-light: rgba(91, 124, 247, 0.13);
  --color-primary-glow: rgba(91, 124, 247, 0.24);
  
  --color-bg: #191b24;
  --color-card-bg: #252938;
  --color-white: #303445;
  --color-text-main: #f5f6fb;
  --color-text-muted: #b2b9ca;
  --color-border: #444a60;
  --color-header-bg: #303445;
  --color-table-row-hover: rgba(91, 124, 247, 0.12);
  --color-bg-gradient-1: rgba(91, 124, 247, 0.07);
  --color-bg-gradient-2: rgba(50, 61, 96, 0.18);
  --color-success: #55d5a6;
  --color-success-bg: rgba(85, 213, 166, 0.12);
  --color-success-border: rgba(85, 213, 166, 0.38);
  --color-danger: #ff91a0;
  --color-danger-bg: rgba(255, 115, 134, 0.12);
  --color-danger-border: rgba(255, 115, 134, 0.4);
  --status-completed-text: #6ee7b7;
  --status-completed-bg: rgba(16, 185, 129, 0.16);
  --status-completed-border: rgba(110, 231, 183, 0.5);
  --status-overdue-text: #fcd34d;
  --status-overdue-bg: rgba(245, 158, 11, 0.16);
  --status-overdue-border: rgba(252, 211, 77, 0.52);
  --status-canceled-text: #fda4af;
  --status-canceled-bg: rgba(244, 63, 94, 0.16);
  --status-canceled-border: rgba(253, 164, 175, 0.52);
  
  --shadow-sm: 0 2px 8px rgba(8, 9, 14, 0.22);
  --shadow-md: 0 10px 28px rgba(8, 9, 14, 0.3);
  --shadow-lg: 0 22px 54px rgba(8, 9, 14, 0.42);

  --theme-header-bar: #5b7cf7;
  --theme-bg-glow-1: rgba(91, 124, 247, 0.07);
  --theme-bg-glow-2: rgba(54, 62, 92, 0.2);
  --theme-btn-gradient: #5b7cf7;
  --theme-btn-text: #f7f8fc;
  --theme-btn-shadow: 0 6px 16px rgba(38, 53, 115, 0.3);
  --theme-fab-bg: #5b7cf7;
  --theme-fab-color: #ffffff;
  --theme-fab-shadow: 0 10px 24px rgba(38, 53, 115, 0.42);

  --theme-stat-total-bg: #2c3040;
  --theme-stat-total-border: #4b526b;
  --theme-stat-total-text: #9db0ff;
  
  --theme-stat-completed-bg: #29343a;
  --theme-stat-completed-border: #42635a;
  --theme-stat-completed-text: #55d5a6;
  
  --theme-stat-revenue-bg: #2b3040;
  --theme-stat-revenue-border: #4b526b;
  --theme-stat-revenue-text: #b7c4f8;

  --theme-table-header-bg: #303445;
  --theme-table-header-text: #f1f3f9;
  --theme-table-date-border: #5b7cf7;

  --theme-modal-title-color: #f5f6fb;
  --theme-modal-title-gradient: linear-gradient(135deg, #f5f6fb, #9fb0ff);
  --theme-modal-fin-bg: #2d3141;
  --theme-modal-fin-border: #4a5066;
  --theme-modal-fin-shadow: 0 8px 24px rgba(8, 9, 14, 0.26);
  --theme-fin-deposit-color: #55d5a6;
  --theme-fin-remaining-color: #8fa5ff;
  --theme-fin-remaining-border: rgba(91, 124, 247, 0.35);
  --theme-fin-total-color: #f5f6fb;
  --theme-fin-total-border: #5b7cf7;
  --theme-btn-secondary-bg: #303445;
  --theme-btn-secondary-color: #eef1f8;
  --theme-btn-secondary-border: #51586f;
  --theme-btn-secondary-hover-bg: #3a3f53;
  --theme-btn-secondary-hover-border: #5b7cf7;

  /* Professional dark: ít hiệu ứng, bề mặt phân cấp rõ */
  --ui-radius-control: 10px;
  --ui-radius-card: 14px;
  --ui-radius-modal: 16px;
  --ui-radius-badge: 999px;
  --ui-border-width: 1px;
  --ui-card-shadow: 0 12px 32px rgba(8, 9, 14, 0.28);
  --ui-control-height: 42px;
  --ui-heading-font: 'Outfit', Arial, sans-serif;
  --ui-heading-tracking: -0.025em;
  --ui-label-tracking: 0.08em;
  --ui-table-cell-y: 11px;
  --ui-hover-lift: -1px;
  --ui-press-scale: 0.98;
  --ui-motion-duration: 180ms;
  --ui-motion-easing: ease-out;
}

/* 3. Pastel Pop Studio (hộp mỹ phẩm pastel + sticker stationery) */
[data-theme="pastel-pop"] {
  color-scheme: only light !important;
  supported-color-schemes: light;

  --color-primary: #765fd6;
  --color-primary-hover: #624abf;
  --color-primary-light: #f1ecff;
  --color-primary-glow: rgba(118, 95, 214, 0.22);

  --color-bg: #fff8f5;
  --color-card-bg: #fffcfe;
  --color-white: #ffffff;
  --color-text-main: #40364d;
  --color-text-muted: #6e637b;
  --color-border: #e7dceb;
  --color-header-bg: #f8f1ff;
  --color-table-row-hover: rgba(255, 145, 168, 0.09);
  --color-bg-gradient-1: rgba(140, 120, 232, 0.12);
  --color-bg-gradient-2: rgba(255, 145, 168, 0.12);
  --color-success: #3f8c73;
  --color-success-bg: #e9f8f2;
  --color-success-border: #9dd9c5;
  --color-danger: #c94767;
  --color-danger-bg: #fff0f3;
  --color-danger-border: #f5b8c7;

  --shadow-sm: 0 4px 12px rgba(108, 82, 145, 0.08);
  --shadow-md: 0 12px 28px rgba(108, 82, 145, 0.12);
  --shadow-lg: 0 24px 52px rgba(108, 82, 145, 0.16);

  --pastel-lavender: #8c78e8;
  --pastel-peach: #ff91a8;
  --pastel-mint: #69cfae;
  --pastel-butter: #ffd66b;
  --pastel-plum: #40364d;

  --theme-header-bar: linear-gradient(100deg, #8c78e8 0%, #d888cb 30%, #ff9ead 50%, #91d7c1 76%, #ffd66b 100%);
  --theme-bg-glow-1: rgba(140, 120, 232, 0.14);
  --theme-bg-glow-2: rgba(255, 145, 168, 0.13);
  --theme-btn-gradient: #e8dfff;
  --theme-btn-text: #4f3f67;
  --theme-btn-shadow: 0 3px 10px rgba(108, 82, 145, 0.12);
  --theme-fab-bg: #ffd8e2;
  --theme-fab-color: #40364d;
  --theme-fab-shadow: 0 4px 12px rgba(201, 71, 103, 0.14);

  --theme-stat-total-bg: #f1ecff;
  --theme-stat-total-border: #b8a9ee;
  --theme-stat-total-text: #624abf;

  --theme-stat-completed-bg: #e9f8f2;
  --theme-stat-completed-border: #9dd9c5;
  --theme-stat-completed-text: #3f6f60;

  --theme-stat-revenue-bg: #fff4c7;
  --theme-stat-revenue-border: #e8c45f;
  --theme-stat-revenue-text: #7b5a00;

  --theme-table-header-bg: #51435f;
  --theme-table-header-text: #fff9fd;
  --theme-table-date-border: #8c78e8;

  --theme-modal-title-color: #40364d;
  --theme-modal-title-gradient: linear-gradient(135deg, #40364d, #765fd6);
  --theme-modal-fin-bg: #fff7fb;
  --theme-modal-fin-border: #e7d7ee;
  --theme-modal-fin-shadow: 0 8px 22px rgba(108, 82, 145, 0.1);
  --theme-fin-deposit-color: #3f8c73;
  --theme-fin-remaining-color: #9d3f59;
  --theme-fin-remaining-border: rgba(255, 145, 168, 0.52);
  --theme-fin-total-color: #624abf;
  --theme-fin-total-border: #8c78e8;
  --theme-btn-secondary-bg: #fff4f8;
  --theme-btn-secondary-color: #6f5277;
  --theme-btn-secondary-border: #e8cee0;
  --theme-btn-secondary-hover-bg: #ffe8ee;
  --theme-btn-secondary-hover-border: #ff91a8;

  /* Soft stationery: card giấy bo lớn, nút gumdrop và chuyển động nhẹ */
  --ui-radius-control: 15px;
  --ui-radius-card: 26px;
  --ui-radius-modal: 28px;
  --ui-radius-badge: 12px;
  --ui-border-width: 2px;
  --ui-card-shadow: 0 5px 0 rgba(197, 178, 218, 0.52), 0 16px 34px rgba(108, 82, 145, 0.11);
  --ui-control-height: 44px;
  --ui-heading-font: 'Nunito', 'Outfit', Arial, sans-serif;
  --ui-heading-tracking: -0.025em;
  --ui-label-transform: none;
  --ui-label-tracking: 0.035em;
  --ui-table-cell-y: 12px;
  --ui-hover-lift: -3px;
  --ui-press-scale: 0.96;
  --ui-motion-duration: 260ms;
  --ui-motion-easing: cubic-bezier(0.34, 1.42, 0.64, 1);
}

/* 4. Mochi Pink (kawaii hồng berry + linh vật thỏ mochi) */
[data-theme="mochi-pink"] {
  color-scheme: only light !important;
  supported-color-schemes: light;

  --color-primary: #b83c75;
  --color-primary-hover: #922a5a;
  --color-primary-light: #fff0f6;
  --color-primary-glow: rgba(184, 60, 117, 0.22);

  --color-bg: #fff7fa;
  --color-card-bg: rgba(255, 253, 254, 0.97);
  --color-white: #ffffff;
  --color-text-main: #4b2f3e;
  --color-text-muted: #745968;
  --color-border: #efcddd;
  --color-header-bg: #fff0f6;
  --color-table-row-hover: rgba(184, 60, 117, 0.07);
  --color-bg-gradient-1: rgba(248, 164, 198, 0.18);
  --color-bg-gradient-2: rgba(224, 196, 247, 0.16);

  /* Semantic status colors stay separate from the pink brand palette. */
  --color-success: #2d7563;
  --color-success-bg: #e8f7f1;
  --color-success-border: #9bcfbe;
  --color-danger: #b43d32;
  --color-danger-bg: #fff0ed;
  --color-danger-border: #e8aaa3;
  --color-pending: #76540d;
  --color-pending-bg: #fff8d9;
  --color-pending-border: #dfc568;

  --shadow-sm: 0 4px 12px rgba(125, 57, 91, 0.07);
  --shadow-md: 0 12px 30px rgba(153, 63, 106, 0.12);
  --shadow-lg: 0 24px 54px rgba(153, 63, 106, 0.16);

  --mochi-pink: #e56fa5;
  --mochi-berry: #922a5a;
  --mochi-blush: #ffdbe9;
  --mochi-cream: #fffaf5;
  --mochi-lavender: #d8b9ef;

  --theme-header-bar: linear-gradient(90deg, #f69ac0, #d95891 52%, #c37bd7);
  --theme-bg-glow-1: rgba(248, 164, 198, 0.2);
  --theme-bg-glow-2: rgba(216, 185, 239, 0.16);
  --theme-btn-gradient: linear-gradient(135deg, #c5427e, #a93269);
  --theme-btn-text: #ffffff;
  --theme-btn-shadow: 0 6px 14px rgba(146, 42, 90, 0.24);
  --theme-fab-bg: linear-gradient(145deg, #d85891, #ad356d);
  --theme-fab-color: #ffffff;
  --theme-fab-shadow: 0 7px 16px rgba(146, 42, 90, 0.28);

  --theme-stat-total-bg: #fff0f6;
  --theme-stat-total-border: #e8b9cf;
  --theme-stat-total-text: #922a5a;
  --theme-stat-completed-bg: #e8f7f1;
  --theme-stat-completed-border: #9bcfbe;
  --theme-stat-completed-text: #2f6f5e;
  --theme-stat-revenue-bg: #f5edfb;
  --theme-stat-revenue-border: #cfb3e3;
  --theme-stat-revenue-text: #68427c;

  --theme-table-header-bg: #62394f;
  --theme-table-header-text: #fff9fc;
  --theme-table-date-border: #b83c75;

  --theme-modal-title-color: #4b2f3e;
  --theme-modal-title-gradient: linear-gradient(135deg, #4b2f3e, #b83c75);
  --theme-modal-fin-bg: #fff7fb;
  --theme-modal-fin-border: #ebc7d8;
  --theme-modal-fin-shadow: 0 8px 22px rgba(153, 63, 106, 0.1);
  --theme-fin-deposit-color: #2d7563;
  --theme-fin-remaining-color: #922a5a;
  --theme-fin-remaining-border: rgba(184, 60, 117, 0.34);
  --theme-fin-total-color: #4b2f3e;
  --theme-fin-total-border: #b83c75;
  --theme-btn-secondary-bg: #fff5f9;
  --theme-btn-secondary-color: #922a5a;
  --theme-btn-secondary-border: #e9bfd2;
  --theme-btn-secondary-hover-bg: #ffe7f1;
  --theme-btn-secondary-hover-border: #cf5d92;

  --ui-radius-control: 20px;
  --ui-radius-card: 30px;
  --ui-radius-modal: 30px;
  --ui-radius-badge: 999px;
  --ui-border-width: 2px;
  --ui-card-shadow: 0 5px 0 rgba(226, 168, 195, 0.48), 0 16px 34px rgba(153, 63, 106, 0.1);
  --ui-control-height: 44px;
  --ui-heading-font: 'Nunito', 'Outfit', Arial, sans-serif;
  --ui-heading-tracking: -0.028em;
  --ui-label-transform: none;
  --ui-label-tracking: 0.025em;
  --ui-table-cell-y: 12px;
  --ui-hover-lift: -3px;
  --ui-press-scale: 0.95;
  --ui-motion-duration: 280ms;
  --ui-motion-easing: cubic-bezier(0.34, 1.45, 0.64, 1);
}

/* 5. Bạch Ly Ngọc (thanh lịch cao cấp, ivory + olive + pollen gold) */
[data-theme="lily-ivory"] {
  color-scheme: only light !important;
  supported-color-schemes: light;

  --color-primary: #354d37;
  --color-primary-hover: #283d2b;
  --color-primary-light: #eef1e8;
  --color-primary-glow: rgba(53, 77, 55, 0.18);

  --color-bg: #f8f8f2;
  --color-card-bg: rgba(255, 254, 250, 0.97);
  --color-white: #fffefa;
  --color-text-main: #263128;
  --color-text-muted: #697268;
  --color-border: #d9ded3;
  --color-header-bg: #eef1e8;
  --color-table-row-hover: rgba(130, 155, 90, 0.08);
  --color-bg-gradient-1: rgba(130, 155, 90, 0.12);
  --color-bg-gradient-2: rgba(200, 168, 78, 0.08);

  --color-success: #456a49;
  --color-success-bg: #ecf4ea;
  --color-success-border: #b9cdb1;
  --color-danger: #a5433d;
  --color-danger-bg: #fff1ee;
  --color-danger-border: #e5b5ae;
  --color-pending: #80691e;
  --color-pending-bg: #fbf6e7;
  --color-pending-border: #ddca89;

  --shadow-sm: 0 4px 12px rgba(53, 77, 55, 0.06);
  --shadow-md: 0 14px 34px rgba(53, 77, 55, 0.1);
  --shadow-lg: 0 26px 58px rgba(53, 77, 55, 0.14);

  --theme-header-bar: linear-gradient(90deg, #829b5a 0 72%, #c8a84e 72% 100%);
  --theme-bg-glow-1: rgba(130, 155, 90, 0.14);
  --theme-bg-glow-2: rgba(200, 168, 78, 0.08);
  --theme-btn-gradient: #354d37;
  --theme-btn-text: #fffefa;
  --theme-btn-shadow: 0 7px 16px rgba(53, 77, 55, 0.2);
  --theme-fab-bg: #354d37;
  --theme-fab-color: #fffefa;
  --theme-fab-shadow: 0 8px 18px rgba(53, 77, 55, 0.24);

  --theme-stat-total-bg: #fffefa;
  --theme-stat-total-border: #d9ded3;
  --theme-stat-total-text: #354d37;
  --theme-stat-completed-bg: #eef1e8;
  --theme-stat-completed-border: #b9c9a7;
  --theme-stat-completed-text: #354d37;
  --theme-stat-revenue-bg: #fbf6e7;
  --theme-stat-revenue-border: #ddca89;
  --theme-stat-revenue-text: #80691e;

  --theme-table-header-bg: #354d37;
  --theme-table-header-text: #fffefa;
  --theme-table-date-border: #829b5a;

  --theme-modal-title-color: #263128;
  --theme-modal-title-gradient: linear-gradient(135deg, #263128, #5f744b);
  --theme-modal-fin-bg: #fffefa;
  --theme-modal-fin-border: #d9ded3;
  --theme-modal-fin-shadow: 0 9px 24px rgba(53, 77, 55, 0.08);
  --theme-fin-deposit-color: #456a49;
  --theme-fin-remaining-color: #80691e;
  --theme-fin-remaining-border: rgba(200, 168, 78, 0.48);
  --theme-fin-total-color: #263128;
  --theme-fin-total-border: #829b5a;
  --theme-btn-secondary-bg: #fffefa;
  --theme-btn-secondary-color: #354d37;
  --theme-btn-secondary-border: #cbd3c4;
  --theme-btn-secondary-hover-bg: #eef1e8;
  --theme-btn-secondary-hover-border: #829b5a;

  --ui-radius-control: 13px;
  --ui-radius-card: 22px;
  --ui-radius-modal: 22px;
  --ui-radius-badge: 999px;
  --ui-border-width: 1px;
  --ui-card-shadow: 0 16px 38px rgba(53, 77, 55, 0.09);
  --ui-control-height: 44px;
  --ui-heading-font: 'Playfair Display', Georgia, serif;
  --ui-heading-tracking: 0.005em;
  --ui-label-transform: none;
  --ui-label-tracking: 0.07em;
  --ui-table-cell-y: 12px;
  --ui-hover-lift: -2px;
  --ui-press-scale: 0.98;
  --ui-motion-duration: 220ms;
  --ui-motion-easing: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Reset Styles cơ bản */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
  font-variant-numeric: tabular-nums;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--color-bg);
  background-image: 
    radial-gradient(at 0% 0%, var(--theme-bg-glow-1, var(--color-bg-gradient-1)) 0px, transparent 50%),
    radial-gradient(at 100% 100%, var(--theme-bg-glow-2, var(--color-bg-gradient-2)) 0px, transparent 50%);
  color: var(--color-text-main);
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Không để nội dung quản lý xuất hiện trước khi Supabase xác nhận phiên đăng nhập. */
html.auth-gate-locked,
html.auth-gate-locked body {
  overflow: hidden;
}

html.auth-gate-locked .app-wrapper,
html.auth-gate-locked .fab-btn {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* HIỆU ỨNG TƯƠNG TÁC VI MÔ (MICRO-INTERACTIONS) */
.btn, .btn-action, .btn-filter-dropdown, .filter-option, .fab-btn, .settings-btn {
  transition: transform var(--ui-motion-duration) var(--ui-motion-easing), box-shadow var(--ui-motion-duration) ease, background var(--ui-motion-duration) ease, border-color var(--ui-motion-duration) ease !important;
}

.btn:active, .btn-action:active, .btn-filter-dropdown:active, .filter-option:active {
  transform: scale(var(--ui-press-scale)) !important;
  transition: transform 0.08s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}
.fab-btn:active, .settings-btn:active {
  transform: scale(0.93) !important;
  transition: transform 0.08s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

:where(button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--color-primary-glow);
}

:where(button, a, [role="button"]) {
  touch-action: manipulation;
}

.modal-overlay,
.auth-overlay,
.welcome-overlay,
.activation-overlay {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  color: inherit;
  overscroll-behavior: contain;
}

dialog:not([open]) {
  display: none;
}

.modal-overlay::backdrop,
.auth-overlay::backdrop,
.welcome-overlay::backdrop,
.activation-overlay::backdrop {
  background: transparent;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Container ứng dụng */
.app-wrapper {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* HEADER: Tiêu đề Spa sang trọng & cao cấp (FLOATING GLASS ISLAND) */
.app-header {
  text-align: center;
  padding: 18px 24px 20px;
  background: var(--color-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--ui-radius-card);
  box-shadow: var(--ui-card-shadow), inset 0 1px 1px rgba(255, 255, 255, 0.24);
  border: var(--ui-border-width) solid var(--color-border);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--theme-header-bar, linear-gradient(90deg, #e5c158, var(--color-primary), #dfb689));
}

.header-top-bar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.header-actions-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
}

.brand-content-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  min-width: 0;
}

.brand-subtitle {
  font-size: 12px;
  text-transform: none;
  letter-spacing: max(0.055em, var(--ui-label-tracking));
  color: var(--color-primary);
  font-weight: 600;
  max-width: min(100%, 28rem);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.brand-title {
  font-family: var(--ui-heading-font);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: var(--ui-heading-tracking);
  line-height: 1.2;
}

.brand-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
  text-wrap: balance;
}

.user-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
  padding: 0;
  border-radius: 50%;
  color: var(--color-primary-hover);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: var(--transition);
}

.sync-status-badge,
.header-actions-right .btn-pill,
.settings-btn {
  flex-shrink: 0;
}

.personalize-field-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.personalize-field-row .input-control {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.personalize-field-row .btn {
  flex-shrink: 0;
  min-height: 38px;
  padding: 8px 16px;
  white-space: nowrap;
  font-size: 13px;
}

.user-badge-pill:hover {
  border-color: var(--color-primary);
  background: var(--color-bg);
}

.sync-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-badge);
  background: var(--color-card-bg);
  color: var(--color-text-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-status-badge[data-state="synced"] {
  color: var(--color-success);
  border-color: var(--color-success-border);
  background: var(--color-success-bg);
}

.sync-status-badge[data-state="syncing"],
.sync-status-badge[data-state="pending"] {
  color: var(--color-primary-hover);
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.sync-status-badge[data-state="offline"],
.sync-status-badge[data-state="error"] {
  color: var(--color-danger);
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.06);
}

.settings-btn {
  position: static;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--ui-radius-badge);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.settings-btn.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--color-white);
  border-color: transparent;
}

.settings-btn i, .settings-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

/* MAIN APP CONTENT */
main {
  flex-grow: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

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

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

.form-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px;
}

.form-title-area i {
  color: var(--color-primary);
  width: 28px;
  height: 28px;
}

.form-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-main);
}

#makeup-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 10px;
  overflow: hidden;
}

.form-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  min-height: 0;
  margin-bottom: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}

.customer-clipboard-bar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 9px 10px 9px 12px;
  color: var(--color-text-main);
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-control);
}

.customer-clipboard-bar[hidden] {
  display: none !important;
}

.customer-clipboard-summary,
.customer-clipboard-actions {
  display: flex;
  align-items: center;
  min-width: 0;
}

.customer-clipboard-summary {
  gap: 8px;
  font-size: 12.5px;
}

.customer-clipboard-summary > svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  color: var(--color-primary-hover);
}

.customer-clipboard-summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-clipboard-actions {
  flex: 0 0 auto;
  gap: 6px;
}

.customer-clipboard-paste-btn,
.customer-clipboard-clear-btn {
  min-height: 34px;
  color: var(--color-primary-hover);
  background: var(--color-card-bg);
  border: 1px solid var(--color-primary);
  border-radius: var(--ui-radius-control);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.customer-clipboard-paste-btn {
  padding: 7px 11px;
  font: 700 12px 'Outfit', sans-serif;
  white-space: nowrap;
}

.customer-clipboard-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  padding: 0;
}

.customer-clipboard-clear-btn > svg {
  width: 15px;
  height: 15px;
}

.customer-clipboard-paste-btn:hover,
.customer-clipboard-clear-btn:hover {
  color: var(--theme-btn-text);
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.customer-clipboard-paste-btn:active,
.customer-clipboard-clear-btn:active {
  transform: scale(0.97);
}

.customer-clipboard-paste-btn:focus-visible,
.customer-clipboard-clear-btn:focus-visible {
  outline: 3px solid var(--color-primary-glow);
  outline-offset: 2px;
}

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

.form-group.full-width {
  grid-column: span 2;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: var(--ui-label-transform);
  letter-spacing: var(--ui-label-tracking);
}

.input-control {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-control);
  min-height: var(--ui-control-height);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.input-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  background-color: var(--color-white);
}

.currency-suffix {
  position: relative;
  width: 100%;
}

/* Date & Time Input Placeholder System */
.input-datetime-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.input-datetime-wrapper .datetime-placeholder {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  opacity: 0.7;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  line-height: 1;
}

.input-datetime-wrapper.has-value .datetime-placeholder {
  opacity: 0;
  visibility: hidden;
}

.input-datetime-wrapper:not(.has-value) input[type="date"]::-webkit-datetime-edit,
.input-datetime-wrapper:not(.has-value) input[type="time"]::-webkit-datetime-edit {
  color: transparent !important;
}

.input-datetime-wrapper.has-value input[type="date"]::-webkit-datetime-edit,
.input-datetime-wrapper.has-value input[type="time"]::-webkit-datetime-edit {
  color: inherit !important;
}

.input-datetime-wrapper input[type="date"],
.input-datetime-wrapper input[type="time"] {
  min-height: 48px;
  cursor: pointer;
}

.input-datetime-wrapper input[type="date"]::-webkit-calendar-picker-indicator,
.input-datetime-wrapper input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 4px;
}

.input-datetime-wrapper input[type="date"]::-webkit-calendar-picker-indicator:hover,
.input-datetime-wrapper input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.form-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  padding: 4px 0 8px;
  overflow: visible;
}

.form-actions .btn {
  flex-shrink: 1;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.form-actions .btn-icon-bubble {
  flex: 0 0 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--ui-radius-control);
  min-height: var(--ui-control-height);
  cursor: pointer;
  transition: var(--transition);
}

.btn-pill {
  border-radius: 9999px !important;
  padding: 10px 18px 10px 24px !important;
  gap: 10px !important;
}

.btn-icon-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.btn-primary:hover .btn-icon-bubble {
  transform: scale(1.15) rotate(8deg);
}



.btn-primary {
  color: var(--theme-btn-text, #ffffff) !important;
  background: var(--theme-btn-gradient, linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)));
  box-shadow: var(--theme-btn-shadow, 0 4px 14px var(--color-primary-glow));
}

.btn-primary:hover {
  box-shadow: var(--theme-btn-shadow, 0 8px 20px var(--color-primary-glow));
  transform: translateY(var(--ui-hover-lift));
}

.btn-secondary {
  background-color: var(--theme-btn-secondary-bg, var(--color-primary-light));
  color: var(--theme-btn-secondary-color, var(--color-primary-hover));
  border: 1px solid var(--theme-btn-secondary-border, var(--color-border));
}

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

.btn-filter-dropdown {
  background-color: var(--color-card-bg);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.btn-filter-dropdown:hover {
  border-color: var(--color-primary) !important;
  background-color: var(--color-primary-light) !important;
  box-shadow: 0 4px 12px var(--color-primary-glow);
  transform: translateY(-1px);
}

/* LIST CONTAINER & SPREADSHEET TABLE */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-panel {
  background: var(--color-card-bg);
  border-radius: var(--ui-radius-card);
  padding: 18px 24px;
  border: var(--ui-border-width) solid var(--color-border);
  box-shadow: var(--ui-card-shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.filter-date-input {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-control);
  min-height: var(--ui-control-height);
  background-color: var(--color-bg);
  outline: none;
  transition: var(--transition);
}

.filter-date-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 6px 14px;
  border-radius: var(--ui-radius-control);
  border: var(--ui-border-width) solid var(--color-border);
  background: var(--color-primary-light);
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.stat-item:nth-child(1) {
  background: var(--theme-stat-total-bg, var(--color-primary-light));
  border-color: var(--theme-stat-total-border, var(--color-border));
}
.stat-item:nth-child(1) .stat-val {
  color: var(--theme-stat-total-text, var(--color-text-main));
}

.stat-item:nth-child(2) {
  background: var(--theme-stat-completed-bg, var(--color-primary-light));
  border-color: var(--theme-stat-completed-border, var(--color-border));
}
.stat-item:nth-child(2) .stat-val {
  color: var(--theme-stat-completed-text, var(--color-success));
}

.stat-item:nth-child(3) {
  background: var(--theme-stat-revenue-bg, var(--color-primary-light));
  border-color: var(--theme-stat-revenue-border, var(--color-primary));
}
.stat-item:nth-child(3) .stat-val {
  color: var(--theme-stat-revenue-text, var(--color-primary-hover));
}

.stat-label {
  font-size: 11px;
  text-transform: var(--ui-label-transform);
  letter-spacing: var(--ui-label-tracking);
  color: var(--color-text-muted);
}

.stat-val {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--color-text-main);
}

.table-wrapper {
  background: var(--color-card-bg);
  border-radius: var(--ui-radius-card);
  border: var(--ui-border-width) solid var(--color-border);
  box-shadow: var(--ui-card-shadow);
  overflow: hidden;
  position: relative;
}

.table-scroll-viewport {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.spreadsheet-table {
  width: 865px;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
  table-layout: fixed;
  zoom: var(--booking-table-zoom, 1);
}

.booking-col-date { width: 90px; }
.booking-col-time { width: 60px; }
.booking-col-customer { width: 75px; }
.booking-col-quantity { width: 75px; }
.booking-col-address { width: 75px; }
.booking-col-platform { width: 110px; }
.booking-col-total { width: 125px; }
.booking-col-completed { width: 75px; }
.booking-col-actions { width: 180px; }

.spreadsheet-table td.address-cell {
  max-width: 75px;
}

@media (min-width: 1024px) {
  .spreadsheet-table {
    width: 100%;
  }

  .booking-col-date { width: 10%; }
  .booking-col-time { width: 6%; }
  .booking-col-customer { width: 13%; }
  .booking-col-quantity { width: 9%; }
  .booking-col-address { width: 16%; }
  .booking-col-platform { width: 11%; }
  .booking-col-total { width: 13%; }
  .booking-col-completed { width: 8%; }
  .booking-col-actions { width: 14%; }

  .spreadsheet-table td.address-cell {
    max-width: none;
  }
}

.spreadsheet-table td.address-cell .inline-copy-trigger {
  display: -webkit-box;
  overflow: hidden;
  max-height: calc(7 * 1.35em);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

.table-cell-clamp {
  display: -webkit-box;
  overflow: hidden;
  max-height: calc(7 * 1.35em);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

.spreadsheet-table th {
  background-color: var(--theme-table-header-bg, var(--color-header-bg));
  color: var(--theme-table-header-text, var(--color-text-main));
  font-weight: 600;
  padding: calc(var(--ui-table-cell-y) + 2px) var(--ui-table-cell-x);
  border-bottom: 2px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  text-transform: var(--ui-label-transform);
  font-size: 11.5px;
  letter-spacing: var(--ui-label-tracking);
  position: sticky;
  top: 0;
  z-index: 10;
}

.spreadsheet-table th:last-child {
  border-right: none;
}

.spreadsheet-table td {
  padding: var(--ui-table-cell-y) var(--ui-table-cell-x);
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  vertical-align: middle;
  transition: background-color 0.2s ease;
}

.spreadsheet-table td:last-child {
  border-right: none;
}

.spreadsheet-table td.customer-cell {
  position: relative;
  padding: 0;
  cursor: pointer;
}

[data-customer-copy-id] {
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
}

.customer-cell-content {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: var(--ui-table-cell-y) var(--ui-table-cell-x);
  overflow: hidden;
  color: var(--color-primary-hover);
  font-weight: 600;
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.customer-name-wrap {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.customer-cell.has-deposit .customer-name-wrap {
  padding-left: 14px;
}

.customer-name-text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  max-height: calc(7 * 1.35em);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

.customer-cell.is-canceled .customer-name-text {
  color: var(--status-canceled-text);
  text-decoration: line-through;
}

.customer-cell.is-long-pressing {
  background-color: var(--color-primary-light);
  box-shadow: inset 0 0 0 2px var(--color-primary);
}

.customer-cell.customer-copy-success .customer-cell-content {
  color: var(--color-success);
  transform: scale(0.98);
}

.customer-cell:focus-visible,
.day-action-btn:focus-visible {
  outline: 3px solid var(--color-primary-glow);
  outline-offset: -3px;
}

.spreadsheet-table tr:hover td {
  background-color: var(--color-table-row-hover);
}

.spreadsheet-table td.grouped-date-cell {
  background-color: var(--color-primary-light);
  text-align: center;
  font-weight: 600;
  border-right: 2px solid var(--theme-table-date-border, var(--color-primary));
  vertical-align: middle;
  color: var(--color-text-main);
}

.weekday {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--color-primary-hover);
  letter-spacing: 0.5px;
  font-weight: 700;
}

.date-val {
  font-size: 13.5px;
  color: var(--color-text-main);
}

.spreadsheet-table tr.group-boundary td {
  border-top: 2px solid var(--color-primary);
}

.spreadsheet-table tr.row-completed td {
  background-color: var(--status-completed-bg) !important;
}

.spreadsheet-table tr.row-overdue td {
  background-color: var(--status-overdue-bg) !important;
  color: var(--status-overdue-text);
}

.spreadsheet-table tr.row-canceled td {
  background-color: var(--status-canceled-bg) !important;
}

.spreadsheet-table tr.row-completed td.grouped-date-cell,
.spreadsheet-table tr.row-overdue td.grouped-date-cell,
.spreadsheet-table tr.row-canceled td.grouped-date-cell {
  background-color: var(--color-primary-light) !important;
  color: var(--color-text-main);
}

.cell-number {
  text-align: right;
  font-family: monospace;
  font-size: 13.5px;
  font-weight: 500;
}

.cell-total-revenue {
  font-weight: 600;
  color: var(--color-text-main);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-messenger { background-color: #e8f2ff; color: #0066fe; }
.badge-zalo { background-color: #e3f2fd; color: #0d47a1; }
.badge-tiktok { background-color: #ffeef2; color: #ff0050; }
.badge-other { background-color: #f5f5f5; color: #616161; }

.spreadsheet-table td.platform-cell {
  overflow: hidden;
  text-align: center;
}

.platform-cell .badge {
  max-width: 100%;
  justify-content: center;
}

@media (max-width: 1023px) {
  .spreadsheet-table td.platform-cell {
    padding-right: 4px;
    padding-left: 4px;
  }

  .platform-cell .badge-messenger {
    padding-right: 4px;
    padding-left: 4px;
    font-size: 9px;
    letter-spacing: -0.1px;
  }
}

.checkbox-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.checkbox-completed {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-success);
}

.actions-cell {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.btn-action {
  background: transparent;
  border: none;
  padding: 6px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--ui-radius-control);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-action-tip { color: #65a30d; }
.btn-action-tip:hover { background-color: rgba(101, 163, 13, 0.12); transform: scale(1.1); }

.btn-action-edit { color: var(--color-primary-hover); }
.btn-action-edit:hover { background-color: var(--color-primary-light); transform: scale(1.1); }

.btn-action-cancel { color: #ef4444; }
.btn-action-cancel:hover { background-color: rgba(239, 68, 68, 0.12); transform: scale(1.1); }
.btn-action-cancel.active { color: #b91c1c; background-color: rgba(239, 68, 68, 0.2); }

.btn-action-delete { color: #dc2626; }
.btn-action-delete:hover { background-color: var(--color-danger-bg); transform: scale(1.1); }

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

.backup-card {
  background: var(--color-card-bg);
  border-radius: var(--ui-radius-card);
  padding: 32px;
  border: var(--ui-border-width) solid var(--color-border);
  box-shadow: var(--ui-card-shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
}

.upload-btn-wrapper {
  position: relative;
  overflow: visible;
  display: inline-block;
  width: 100%;
}

.file-input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* TOAST SYSTEM */
.toast-container {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 24px;
  z-index: 10060 !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--color-white);
  border-left: 4px solid var(--color-primary);
  box-shadow: var(--ui-card-shadow);
  padding: 14px 20px;
  border-radius: var(--ui-radius-control);
  color: var(--color-text-main);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 450px;
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  border: 1px solid var(--color-border);
  border-left-width: 4px;
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: #f59e0b; }
.toast.info { border-left-color: var(--color-primary); }

.toast i { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success i { color: var(--color-success); }
.toast.error i { color: var(--color-danger); }
.toast.warning i { color: #f59e0b; }
.toast.info i { color: var(--color-primary); }

@keyframes toastIn {
  from { transform: translateX(-100%) translateY(0); opacity: 0; }
  to { transform: translateX(0) translateY(0); opacity: 1; }
}

.toast.fade-out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}

@media (max-width: 480px) {
  .toast-container {
    bottom: 16px;
    left: 16px;
    right: 16px;
    align-items: center;
  }

  .toast {
    width: 100%;
    min-width: unset;
    max-width: 100%;
    font-size: 13px;
    padding: 12px 16px;
  }
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(51, 45, 41, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 20px 10px;
}

.modal-overlay[open] {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--color-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--ui-radius-modal);
  padding: 24px 20px;
  width: 90%;
  max-width: 500px;
  height: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--color-primary);
  box-shadow: var(--ui-card-shadow);
  transform: scale(0.9);
  transition: transform var(--ui-motion-duration) var(--ui-motion-easing);
  position: relative;
  touch-action: auto;
  overscroll-behavior: contain;
}

.modal-overlay[open] .modal-box {
  transform: scale(1);
}

.modal-title {
  font-family: var(--ui-heading-font);
  letter-spacing: var(--ui-heading-tracking);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 12px;
  padding-right: 32px;
}

.modal-msg {
  font-size: 14.5px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-btns {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
}

footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  margin-top: 48px;
}

footer a {
  color: var(--color-primary-hover);
  text-decoration: none;
  font-weight: 500;
}

.deposit-status-icon {
  position: absolute;
  top: -3px;
  left: 0;
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}

.inline-copy-trigger {
  width: auto;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.inline-copy-trigger:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.fab-btn {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--theme-fab-bg, linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)));
  color: var(--theme-fab-color, #ffffff) !important;
  border: none;
  box-shadow: var(--theme-fab-shadow, 0 4px 12px rgba(197, 168, 128, 0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: var(--transition);
}

.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--theme-fab-shadow, 0 6px 16px rgba(197, 168, 128, 0.6));
}
.fab-btn i { width: 20px; height: 20px; }

#confirm-modal { z-index: 10050 !important; }
#confirm-modal .modal-box { height: auto; min-height: 200px; max-height: 45vh; }
.modal-box.tip-modal-box {
  width: min(400px, calc(100vw - 28px));
  height: auto;
  min-height: 0;
  max-height: min(90dvh, 460px);
  padding: 20px;
  justify-content: flex-start;
  gap: 16px;
}

.tip-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.tip-modal-booking-info {
  margin: 0;
  color: var(--color-text-main);
  font-size: 13.5px;
  line-height: 1.45;
  text-align: left;
}

.tip-modal-form-group {
  margin: 0;
  text-align: left;
}

.tip-modal-actions {
  gap: 10px;
  margin-top: 2px;
}
.modal-box.filter-modal-box { height: auto; min-height: 320px; max-height: 65vh; }

.detail-modal-box .modal-title {
  color: var(--theme-modal-title-color, var(--color-text-main));
  background: var(--theme-modal-title-gradient, none);
  -webkit-background-clip: text;
  background-clip: text;
}

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; text-align: left; }
.detail-group { display: flex; flex-direction: column; gap: 2px; border-bottom: 1px dashed var(--color-border); padding-bottom: 8px; }
.detail-group:last-child { border-bottom: none; }
.detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-muted); font-weight: 600; }
.detail-value { font-size: 15px; color: var(--color-text-main); font-weight: 500; }
.detail-phone-container { display: flex; align-items: center; gap: 8px; }
.detail-phone-val { font-size: 15px; color: var(--color-primary-hover); font-weight: 600; cursor: pointer; }
.detail-phone-val:hover { color: var(--color-primary); text-decoration: underline; }

.detail-financial-box { 
  background: var(--theme-modal-fin-bg, var(--color-primary-light)); 
  border: 1px solid var(--theme-modal-fin-border, var(--color-border)); 
  border-radius: var(--ui-radius-control);
  padding: 16px; 
  margin-top: 12px;
  box-shadow: var(--theme-modal-fin-shadow, none);
}

.financial-row { 
  display: flex; 
  justify-content: space-between; 
  padding: 6px 0; 
  font-size: 13.5px; 
  color: var(--color-text-main);
}

.financial-row.deposit-row .val {
  color: var(--theme-fin-deposit-color, var(--color-success)) !important;
  font-weight: 700;
}

.financial-row.remaining-row { 
  font-weight: 700; 
  font-size: 15px; 
  border-top: 1px dashed var(--theme-fin-remaining-border, var(--color-border));
  padding-top: 8px;
  margin-top: 4px;
}

.financial-row.remaining-row .label,
.financial-row.remaining-row .val {
  color: var(--theme-fin-remaining-color, var(--color-primary-hover)) !important;
}

.financial-row.total-row { 
  font-weight: 700; 
  font-size: 15.5px; 
  border-top: 2px solid var(--theme-fin-total-border, var(--color-primary)); 
  padding-top: 10px; 
  margin-top: 6px; 
}

.financial-row.total-row .val {
  color: var(--theme-fin-total-color, var(--color-primary-hover)) !important;
  font-weight: 800;
}

.filter-option-group { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; text-align: left; }
.filter-option { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.filter-option input[type="radio"] { width: 18px; height: 18px; accent-color: var(--color-primary); }
.filter-dates-inputs { display: flex; flex-direction: column; gap: 10px; padding-left: 26px; margin-top: 8px; }

@media (max-width: 768px) {
  .app-wrapper { padding: 12px; gap: 16px; }
  .app-header { padding: 14px 14px 16px; gap: 6px; }
  .header-actions-right { width: 100%; gap: 5px; }
  .brand-title { font-size: 22px; line-height: 1.16; }
  .brand-desc { margin-top: 3px; font-size: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: span 1; }
  
  .filter-panel { 
    flex-direction: column; 
    align-items: stretch; 
    padding: 12px 14px; 
    gap: 12px; 
    box-sizing: border-box;
    width: 100%;
  }
  
  .filter-left { 
    display: flex;
    justify-content: space-between; 
    align-items: center;
    flex-wrap: nowrap;
    width: 100%; 
    gap: 8px;
    box-sizing: border-box;
  }

  .filter-left .search-box-container {
    flex: 1 1 0;
    min-width: 0 !important;
  }

  .filter-left .search-box-container .filter-date-input {
    min-width: 0;
  }

  .filter-left .btn-filter-dropdown {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  
  /* BENTO GRID 2 + 1 CHO THẺ THỐNG KÊ TRÊN MOBILE */
  .stats-summary { 
    display: grid; 
    grid-template-columns: repeat(2, minmax(0, 1fr)); 
    gap: 8px; 
    border-top: 1px solid var(--color-border); 
    padding-top: 12px; 
    width: 100%; 
    box-sizing: border-box;
  }
  
  .stat-item {
    min-width: 0;
    box-sizing: border-box;
  }

  /* Thẻ 1 (Tổng lịch hẹn) & Thẻ 2 (Hoàn thành) - Hàng 1 chia đôi */
  .stat-item:nth-child(1),
  .stat-item:nth-child(2) {
    grid-column: span 1;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 10px;
  }

  .stat-item:nth-child(1) .stat-label,
  .stat-item:nth-child(2) .stat-label {
    font-size: 10.5px;
    letter-spacing: 0.3px;
    white-space: nowrap;
  }

  .stat-item:nth-child(1) .stat-val,
  .stat-item:nth-child(2) .stat-val {
    font-size: 16.5px;
    font-weight: 700;
    margin-top: 2px;
  }

  /* Thẻ 3 (Tổng doanh thu dự kiến) - Hàng 2 chiếm trọn 100% bề ngang */
  .stat-item:nth-child(3) {
    grid-column: span 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    width: 100%;
  }

  .stat-item:nth-child(3) .stat-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: normal;
  }

  .stat-item:nth-child(3) .stat-val {
    font-size: 16px;
    font-weight: 800;
    margin-top: 0;
    white-space: nowrap;
  }

  .modal-overlay { align-items: center; justify-content: center; }
  .modal-box { padding: 20px 16px; width: 95%; margin: auto; }
  .modal-box.tip-modal-box {
    width: calc(100vw - 28px);
    padding: 18px 16px;
    gap: 14px;
  }
}

.empty-state-card {
  background: var(--color-card-bg);
  border-radius: var(--ui-radius-card);
  border: 1px dashed var(--color-primary);
  padding: 60px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  box-shadow: var(--ui-card-shadow);
  margin-top: 10px;
  animation: fadeIn 0.4s ease;
}

.empty-state-icon-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  background-color: var(--color-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty-state-main-icon { width: 36px; height: 36px; color: var(--color-primary-hover); }
.empty-state-sparkles { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; color: #f59e0b; animation: pulse 2s infinite ease-in-out; }
.empty-state-title { font-family: var(--ui-heading-font); letter-spacing: var(--ui-heading-tracking); font-size: 22px; font-weight: 700; color: var(--color-text-main); }
.empty-state-desc { font-size: 14.5px; color: var(--color-text-muted); max-width: 420px; line-height: 1.6; margin-bottom: 12px; }

@keyframes pulse {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
  50% { transform: scale(1.2) rotate(15deg); opacity: 1; }
}

::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
html { scrollbar-width: none; -ms-overflow-style: none; }
select.input-control option { background-color: var(--color-bg); color: var(--color-text-main); }



.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 60px;
  gap: 6px;
}

.calendar-day-cell {
  appearance: none;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-control);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 0;
  transition: var(--transition);
  cursor: pointer;
  font: inherit;
  position: relative;
}

@media (max-width: 768px) {
  .calendar-days-grid {
    grid-auto-rows: 56px;
    gap: 4px;
  }

  .calendar-day-cell {
    padding: 4px;
  }

  .calendar-day-badge {
    width: 20px;
    height: 20px;
  }
}

.calendar-day-cell:hover {
  border-color: var(--color-primary) !important;
  transform: translateY(-1px) !important;
  box-shadow: var(--shadow-sm) !important;
}

.calendar-day-cell:focus-visible {
  outline: 3px solid var(--color-primary-glow);
  outline-offset: 2px;
}

.calendar-day-cell.today {
  border-color: var(--color-primary);
  border-width: 2px;
  background-color: var(--color-primary-light);
}

.calendar-day-cell.out-of-month { opacity: 0.4; }
.calendar-day-label { font-size: 13px; font-weight: 600; color: var(--color-text-main); }
.calendar-day-label.today { color: var(--color-primary-hover); }

.calendar-day-badge {
  width: 20px; height: 20px; border-radius: 50%; font-size: 10px;
  display: flex; align-items: center; justify-content: center; font-weight: 700; margin-top: 0;
  background-color: var(--color-pending-bg, var(--color-primary-light));
  color: var(--color-pending, var(--color-primary-hover));
  border: 1px solid var(--color-pending-border, var(--color-primary-hover));
}

.calendar-day-badge.status-completed {
  color: var(--status-completed-text);
  background-color: var(--status-completed-bg);
  border-color: var(--status-completed-border);
}

.calendar-day-badge.status-overdue {
  color: var(--status-overdue-text);
  background-color: var(--status-overdue-bg);
  border-color: var(--status-overdue-border);
}

.calendar-day-badge.status-canceled {
  color: var(--status-canceled-text);
  background-color: var(--status-canceled-bg);
  border-color: var(--status-canceled-border);
}

.day-booking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--color-pending-bg, var(--color-primary-light));
  border: 1px solid var(--color-pending-border, var(--color-border));
  border-radius: var(--ui-radius-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: var(--transition);
}

.day-booking-item.day-booking-completed {
  background-color: var(--status-completed-bg);
  border-color: var(--status-completed-border);
}
.day-booking-item.day-booking-overdue { 
  background-color: var(--status-overdue-bg);
  border-color: var(--status-overdue-border);
  color: var(--status-overdue-text);
}
.day-booking-item.day-booking-canceled {
  background-color: var(--status-canceled-bg);
  border-color: var(--status-canceled-border);
}
.day-booking-item.day-booking-canceled .day-booking-name {
  text-decoration: line-through;
  color: var(--status-canceled-text);
}

.day-booking-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--ui-radius-badge);
  margin-left: 6px;
  vertical-align: middle;
}
.day-booking-tag.tag-overdue {
  background-color: var(--status-overdue-bg);
  color: var(--status-overdue-text);
  border: 1px solid var(--status-overdue-border);
}
.day-booking-tag.tag-completed {
  background-color: var(--status-completed-bg);
  color: var(--status-completed-text);
  border: 1px solid var(--status-completed-border);
}
.day-booking-tag.tag-canceled {
  background-color: var(--status-canceled-bg);
  color: var(--status-canceled-text);
  border: 1px solid var(--status-canceled-border);
}

.day-booking-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex-grow: 1;
  padding: 4px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--ui-radius-control);
  font: inherit;
  text-align: left;
}

.day-booking-title-row {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-booking-time {
  font-weight: 700;
  color: var(--color-text-main);
}

.day-booking-name {
  font-weight: 700;
  color: var(--color-primary-hover);
}

.day-booking-sub-row {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.day-booking-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.day-action-btn {
  background: transparent;
  border: none;
  padding: 6px;
  width: 32px;
  height: 32px;
  border-radius: var(--ui-radius-control);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-hover);
  transition: var(--transition);
}

.day-action-btn:hover {
  background-color: rgba(197, 168, 128, 0.18);
  transform: scale(1.1);
}

.day-action-btn.btn-delete {
  color: #e11d48;
}

.day-action-btn.btn-delete:hover {
  background-color: rgba(225, 29, 72, 0.12);
  transform: scale(1.1);
}

.day-action-btn i, .day-action-btn svg {
  width: 17px;
  height: 17px;
}




/* ==========================================
   SUPABASE AUTH OVERLAY (ĐĂNG NHẬP / ĐĂNG KÝ)
   ========================================== */
.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(18, 16, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.4s ease;
}

.auth-overlay[open] {
  display: flex;
}

.auth-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-primary);
  border-radius: var(--ui-radius-modal);
  box-shadow: var(--ui-card-shadow);
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  border-top: 5px solid var(--color-primary);
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-header h2 {
  font-family: var(--ui-heading-font);
  letter-spacing: var(--ui-heading-tracking);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0;
}

.auth-header p {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0;
}

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

.auth-error {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  display: none;
}

.auth-success {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  display: none;
  font-weight: 500;
  line-height: 1.4;
}

.btn-google-auth {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--color-white);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: var(--transition);
}

.btn-google-auth:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 168, 128, 0.15);
}

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 14px 0 2px 0;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider span {
  padding: 0 12px;
}



/* ==========================================
   MÀN HÌNH KHÓA KÍCH HOẠT (LICENSING SCREEN)
   ========================================== */
.activation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(18, 16, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.4s ease;
}

.activation-overlay[open] {
  display: flex;
}

.activation-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-primary);
  border-radius: var(--ui-radius-modal);
  box-shadow: var(--ui-card-shadow);
  padding: 28px;
  width: 100%;
  max-width: 880px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  border-top: 5px solid var(--color-primary);
}

.activation-card.is-checkout {
  max-width: 600px;
}

.license-account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-control);
  background: var(--color-bg);
}

.license-account-strip[hidden] {
  display: none;
}

.license-account-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.license-account-identity span {
  color: var(--color-text-muted);
  font-size: 10.5px;
  font-weight: 600;
}

.license-account-identity strong {
  overflow: hidden;
  color: var(--color-text-main);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-switch-account-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--color-primary);
  border-radius: var(--ui-radius-control);
  background: var(--color-card-bg);
  color: var(--color-primary-hover);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
}

.license-switch-account-btn:hover {
  background: var(--color-primary-light);
}

.license-switch-account-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.license-switch-account-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.license-flow-step {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: license-step-enter 160ms ease-out;
}

.license-flow-step[hidden] {
  display: none;
}

@keyframes license-step-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.activation-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.shield-icon-wrapper {
  background: var(--color-primary-light);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border: 1px solid var(--color-primary);
}

.activation-icon {
  color: var(--color-primary);
  width: 22px;
  height: 22px;
}

.activation-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0;
}

.activation-header p {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

.license-billing-toggle {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-control);
  background: var(--color-bg);
}

.license-billing-toggle button {
  min-height: 42px;
  padding: 7px 12px;
  border: 0;
  border-radius: calc(var(--ui-radius-control) - 4px);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.license-billing-toggle button span {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  font-weight: 700;
  color: inherit;
}

.license-billing-toggle button.active {
  background: var(--color-card-bg);
  color: var(--color-primary-hover);
  box-shadow: var(--shadow-sm);
}

.license-billing-toggle button:focus-visible,
.license-plan-select:focus-visible,
.license-key-shortcut:focus-visible,
.license-back-button:focus-visible,
.btn-copy-sm:focus-visible {
  outline: 3px solid var(--color-primary-glow);
  outline-offset: 2px;
}

.license-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.license-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-card);
  background: var(--color-card-bg);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.license-plan-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

.license-plan-card.selected {
  border-color: var(--color-primary);
  box-shadow: 0 12px 28px var(--color-primary-glow);
}

.license-plan-card-vip {
  background: linear-gradient(150deg, var(--color-card-bg), var(--color-primary-light));
}

.license-popular-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ui-radius-badge);
  background: var(--color-primary-hover);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.license-popular-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 9px;
}


.vip-feature-control {
  position: relative;
  overflow: visible;
}

.vip-crown-indicator {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  color: #ffffff;
  background: var(--color-primary-hover);
  border: 2px solid var(--color-card-bg);
  border-radius: 50%;
  box-shadow: 0 3px 8px var(--color-primary-glow);
  pointer-events: none;
}

.vip-crown-indicator > svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.4;
}

.vip-feature-control-compact .vip-crown-indicator {
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-width: 1.5px;
}

.vip-feature-control-compact .vip-crown-indicator > svg {
  width: 9px;
  height: 9px;
}

[data-vip-locked="false"] > .vip-crown-indicator {
  display: none;
}

.license-plan-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 4px;
}

.license-plan-card-vip .license-plan-heading {
  padding-right: 92px;
}

.license-plan-heading > svg {
  width: 24px;
  height: 24px;
  color: var(--color-primary-hover);
  flex-shrink: 0;
}

.license-plan-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
}

.license-plan-heading h3 {
  margin: 0;
  color: var(--color-text-main);
  font-family: var(--ui-heading-font);
  font-size: 23px;
}

.license-plan-price {
  display: flex;
  flex-direction: column;
  min-height: 70px;
}

.license-price-original {
  min-height: 17px;
  color: var(--color-text-muted);
  font-size: 12px;
  text-decoration: line-through;
}

.license-price-current {
  color: var(--color-text-main);
  font-family: 'Outfit', sans-serif;
  font-size: clamp(24px, 4vw, 31px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.license-price-period {
  margin-left: 4px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.license-price-saving {
  margin-top: 4px;
  color: var(--color-success);
  font-size: 11.5px;
  font-weight: 700;
}

.license-feature-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-muted);
  font-size: 12.5px;
}

.license-feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.license-feature-list svg {
  width: 15px;
  height: 15px;
  color: var(--color-success);
  flex-shrink: 0;
}

.license-plan-select {
  width: 100%;
  margin-top: auto;
  justify-content: center;
}

.license-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.license-plan-actions > .btn {
  flex: 1 1 220px;
  justify-content: center;
}

.license-key-shortcut {
  align-self: center;
  min-height: 36px;
  padding: 7px 14px;
  color: var(--color-primary-hover);
  border-color: var(--color-primary);
}

.license-back-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--ui-radius-control);
  background: transparent;
  color: var(--color-primary-hover);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.license-back-button:hover {
  background: var(--color-primary-light);
}

.license-back-button:active,
.license-plan-select:active,
.license-key-shortcut:active {
  transform: translateY(1px);
}

.license-back-button svg {
  width: 16px;
  height: 16px;
}

.activation-checkout-header {
  margin-top: -8px;
}

.payment-section {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selected-license-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.selected-license-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.selected-license-summary span {
  color: var(--color-text-muted);
  font-size: 11px;
}

.selected-license-summary strong {
  color: var(--color-text-main);
  font-size: 14px;
}

#selected-plan-amount {
  color: var(--color-primary-hover);
  font-size: 20px;
  white-space: nowrap;
}

.bank-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
}

.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
}

.bank-label { color: var(--color-text-muted); }
.bank-value { font-weight: 600; color: var(--color-text-main); }

.bank-copy-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-copy-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-primary-hover);
  cursor: pointer;
}

.btn-copy-sm:hover {
  background: var(--color-primary-light);
}

.btn-copy-sm svg {
  width: 14px;
  height: 14px;
}

.payment-note {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  color: var(--color-text-muted);
  line-height: 1.4;
  background: var(--color-card-bg);
  border-left: 3px solid var(--color-primary);
  padding: 6px 8px;
  border-radius: 2px;
  margin-top: 4px;
}

.payment-note > span,
.payment-note small {
  color: var(--color-text-muted);
}

.payment-note > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.payment-note strong {
  color: var(--color-text-main);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.activation-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 11.5px;
}

.activation-divider::before,
.activation-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--color-border);
}

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

#activation-input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-main);
  font-size: 15px;
  letter-spacing: 2px;
  text-align: center;
  font-family: monospace;
  font-weight: 600;
  transition: border-color 0.3s;
}

#activation-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.activation-input-label {
  margin-bottom: -5px;
  color: var(--color-text-main);
  font-size: 12.5px;
  font-weight: 700;
}

.btn-start-trial {
  width: 100%;
  justify-content: center;
  color: var(--color-primary-hover);
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.trial-upgrade-note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.activation-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.activation-contact svg {
  width: 14px;
  height: 14px;
  color: var(--color-primary-hover);
}

.activation-error {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.activation-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  display: none;
  padding: 6px;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.activation-close-btn:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary-hover);
}

@media (max-width: 720px) {
  .activation-overlay {
    align-items: flex-start;
    padding: 10px;
  }

  .activation-card {
    max-height: calc(100dvh - 20px);
    padding: 24px 16px;
    gap: 17px;
  }

  .activation-card.is-checkout {
    max-width: none;
  }

  .license-account-strip {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .license-switch-account-btn {
    width: 100%;
  }

  .license-flow-step {
    gap: 17px;
  }

  .activation-header h2 {
    font-size: 21px;
  }

  .license-plan-grid {
    grid-template-columns: 1fr;
  }

  .license-plan-card {
    padding: 17px;
  }

  .selected-license-summary {
    align-items: flex-start;
  }

  .license-plan-actions {
    flex-direction: column;
  }

  .license-plan-actions > .btn {
    flex-basis: auto;
    width: 100%;
  }

  .activation-checkout-header {
    margin-top: -4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .activation-overlay,
  .license-plan-card,
  .license-flow-step,
  .license-billing-toggle button {
    animation: none;
    transition: none;
  }

  .license-plan-card:hover {
    transform: none;
  }
}

/* Banner Thông Báo Dùng Thử 7 Ngày */
.trial-banner {
  width: 100%;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(202, 138, 4, 0.12) 0%, rgba(197, 168, 128, 0.18) 100%);
  border: 1px solid rgba(202, 138, 4, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.trial-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--color-text-main);
}

.trial-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.trial-banner-icon {
  width: 18px;
  height: 18px;
  color: #ca8a04;
  flex-shrink: 0;
}

#trial-timer-text {
  color: var(--color-primary-hover);
  font-weight: 700;
  font-size: 14px;
  background: rgba(202, 138, 4, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
}

.btn-trial-activate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(197, 168, 128, 0.3);
}

.btn-trial-activate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(197, 168, 128, 0.4);
}

/* Đảm bảo Modal Thùng rác nằm đè lên Modal Cài đặt nhưng dưới Modal Xác Nhận */
#trash-modal {
  z-index: 2500 !important;
}

/* ==========================================
   MÀN HÌNH CHÀO MỪNG HIGH-END FULL SCREEN
   ========================================== */
.welcome-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100dvh;
  background: linear-gradient(180deg, #FDFCFB 0%, #F8F4EE 100%);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  animation: fadeIn 0.4s ease;
}

.welcome-overlay[open] {
  display: flex;
}

.welcome-shell {
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.welcome-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 48px 24px 40px 24px;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 20px;
  position: relative;
  overflow-y: auto;
  box-shadow: none;
}

.welcome-top-spacer {
  height: 20px;
  flex-shrink: 0;
}

.welcome-center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  margin: auto 0;
}

.welcome-logo-badge {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 28px;
  padding: 5px;
  background: linear-gradient(135deg, rgba(197, 168, 128, 0.4) 0%, rgba(247, 243, 237, 0.9) 100%);
  box-shadow: 0 14px 32px rgba(197, 168, 128, 0.3);
  margin-bottom: 8px;
}

.welcome-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 23px;
}

.welcome-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0;
  letter-spacing: 0.5px;
}

.welcome-slogan {
  font-size: 14.5px;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
  max-width: 320px;
}

.welcome-bottom-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 440px;
  margin-top: auto;
  flex-shrink: 0;
}

.welcome-pwa-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome-install-btn {
  width: 100%;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)) !important;
  color: #ffffff !important;
  font-size: 14px !important;
  padding: 12px 18px !important;
  border: none !important;
  border-radius: 30px !important;
  box-shadow: 0 4px 16px rgba(197, 168, 128, 0.35) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.welcome-install-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 22px rgba(197, 168, 128, 0.5) !important;
}

.welcome-ios-box {
  font-size: 12.5px;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.8);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(197, 168, 128, 0.4);
  text-align: left;
  line-height: 1.5;
}

.welcome-actions {
  width: 100%;
}

.welcome-cta-btn {
  width: 100%;
  justify-content: space-between;
  padding: 14px 22px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border-radius: 30px !important;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 24px rgba(197, 168, 128, 0.4) !important;
}

.welcome-cta-btn:hover {
  transform: translateY(-2px) scale(1.01) !important;
  box-shadow: 0 10px 28px rgba(197, 168, 128, 0.55) !important;
}

.welcome-cta-btn .btn-icon-bubble {
  background: rgba(255, 255, 255, 0.25);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.welcome-cta-btn:hover .btn-icon-bubble {
  transform: translateX(3px);
}

/* ====================================================
   PERSONALIZATION MODAL & HORIZONTAL THEME PICKERS
   ==================================================== */
.personalize-section-card {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-card);
  background: var(--color-card-bg);
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

.theme-scroll-wrapper {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 4px 14px 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.theme-scroll-wrapper::-webkit-scrollbar {
  height: 6px;
}

.theme-scroll-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 99px;
}

.theme-scroll-wrapper::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 99px;
  transition: background-color 0.2s ease;
}

.theme-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-primary);
}

.theme-sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  padding: 12px 14px;
  border: var(--ui-border-width) solid var(--color-border);
  border-radius: var(--ui-radius-control);
  background: var(--color-primary-light);
}

.theme-sync-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.theme-sync-title {
  color: var(--color-text-main);
  font-size: 13px;
  font-weight: 700;
}

.theme-sync-description {
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.theme-sync-toggle {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  text-transform: none;
}

.theme-sync-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.theme-sync-track {
  width: 46px;
  height: 26px;
  padding: 3px;
  border-radius: var(--ui-radius-badge);
  border: 1px solid var(--color-border);
  background: var(--color-text-muted);
  transition: background var(--ui-motion-duration) ease, border-color var(--ui-motion-duration) ease;
}

.theme-sync-thumb {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: var(--ui-radius-badge);
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transform: translateX(0);
  transition: transform var(--ui-motion-duration) var(--ui-motion-easing);
}

.theme-sync-toggle input:checked + .theme-sync-track {
  border-color: var(--color-primary);
  background: var(--theme-btn-gradient, var(--color-primary));
}

.theme-sync-toggle input:checked + .theme-sync-track .theme-sync-thumb {
  transform: translateX(20px);
}

.theme-sync-toggle input:focus-visible + .theme-sync-track {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.theme-card-item {
  flex: 0 0 132px;
  scroll-snap-align: start;
  background: var(--color-card-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--ui-radius-control);
  padding: 9px;
  cursor: pointer;
  transition: transform var(--ui-motion-duration) var(--ui-motion-easing), border-color var(--ui-motion-duration) ease, box-shadow var(--ui-motion-duration) ease, background-color var(--ui-motion-duration) ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  user-select: none;
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.auth-text-button {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.theme-card-item:hover {
  border-color: var(--color-primary);
  transform: translateY(var(--ui-hover-lift));
  box-shadow: var(--ui-card-shadow);
}

.theme-card-item:active {
  transform: scale(var(--ui-press-scale));
}

.theme-card-item.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary), 0 8px 20px var(--color-primary-glow);
  background: var(--color-primary-light);
}

/* App Theme Thumbnail Mockup */
.theme-thumbnail-app {
  width: 100%;
  height: 74px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.theme-thumb-header {
  height: 18px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}

.theme-thumb-body {
  flex: 1;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-thumb-btn {
  height: 11px;
  border-radius: 3px;
  width: 48%;
  margin-top: auto;
}

/* Booking Card Thumbnail Mockup */
.theme-thumbnail-card {
  width: 100%;
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  padding: 3px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.card-thumb-inner {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  padding: 3px 4px;
  position: relative;
  gap: 3px;
}

.card-thumb-banner {
  height: 14px;
  border-radius: 3px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb-row {
  height: 3.5px;
  border-radius: 2px;
}

.card-thumb-total {
  height: 13px;
  border-radius: 3px;
  margin-top: auto;
  width: 100%;
}

.theme-label-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-main);
  text-align: center;
  line-height: 1.2;
}

.theme-badge-status {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 3px;
}

.theme-card-item:not(.active) .theme-badge-status {
  display: none;
}

/* ====================================================
   THEME-SPECIFIC COMPONENT ART DIRECTION
   Rose Gold extends the base component styles with quiet atelier details.
   ==================================================== */

/* Rose Gold: quiet atelier surfaces with a restrained satin signature */
:root:not([data-theme]) body {
  background-image:
    radial-gradient(at 0% 0%, rgba(247, 243, 237, 0.68) 0, transparent 48%),
    radial-gradient(at 100% 100%, rgba(222, 204, 181, 0.3) 0, transparent 52%),
    repeating-linear-gradient(115deg, rgba(197, 168, 128, 0.018) 0 1px, transparent 1px 6px);
  background-size: auto, auto, 8px 8px;
}

:root:not([data-theme]) .app-header {
  isolation: isolate;
  box-shadow:
    0 10px 30px rgba(197, 168, 128, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(197, 168, 128, 0.1);
}

.default-monogram {
  display: none;
}

:root:not([data-theme]) .default-monogram {
  display: block;
  position: absolute;
  right: clamp(12px, 4vw, 56px);
  bottom: -30px;
  z-index: 0;
  color: rgba(197, 168, 128, 0.065);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(68px, 11vw, 108px);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

:root:not([data-theme]) .app-header > *:not(.default-monogram) {
  position: relative;
  z-index: 1;
}

:root:not([data-theme]) .empty-state-icon-wrapper {
  border: 1px solid #e8d7c3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 8px 18px rgba(197, 168, 128, 0.1);
}

/* Classic Retro: molded gray console shell and colorful hardware controls */
[data-theme="classic-gray"] body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(255, 255, 255, 0.44), transparent 44%),
    radial-gradient(circle at 105% 108%, rgba(52, 57, 66, 0.07), transparent 50%);
  background-size: auto;
}

[data-theme="classic-gray"] .app-header,
[data-theme="classic-gray"] .filter-panel,
[data-theme="classic-gray"] .table-wrapper,
[data-theme="classic-gray"] .empty-state-card,
[data-theme="classic-gray"] .personalize-section-card,
[data-theme="classic-gray"] .modal-box {
  background-color: #eef0f2;
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(164, 168, 175, 0.08));
  border-color: #969aa2;
}

[data-theme="classic-gray"] .app-header {
  min-height: 164px;
  justify-content: center;
  isolation: isolate;
  border-width: 2px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.82), inset 0 -2px 0 rgba(92, 97, 106, 0.16), var(--ui-card-shadow);
}

[data-theme="classic-gray"] .app-header::before {
  height: 7px;
}

[data-theme="classic-gray"] .app-header::after {
  content: '';
  position: absolute;
  right: clamp(-48px, -2vw, -18px);
  bottom: -74px;
  z-index: -1;
  width: clamp(250px, 31vw, 430px);
  aspect-ratio: 3 / 2;
  background: url('assets/retro-controller-clipart.webp') center / contain no-repeat;
  opacity: 0.26;
  filter: saturate(0.92) contrast(1.04);
  pointer-events: none;
  animation: retro-controller-float 6s ease-in-out infinite;
}

[data-theme="classic-gray"] .app-header > * {
  position: relative;
  z-index: 1;
}

[data-theme="classic-gray"] .brand-subtitle,
[data-theme="classic-gray"] .stat-label,
[data-theme="classic-gray"] .spreadsheet-table th {
  font-family: "Courier New", monospace;
  font-weight: 700;
}

[data-theme="classic-gray"] .brand-subtitle {
  color: var(--retro-graphite);
}

[data-theme="classic-gray"] .brand-title {
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

[data-theme="classic-gray"] .settings-btn {
  color: #5d4813;
  background: linear-gradient(180deg, #f0c963, var(--retro-button-yellow));
  border: 2px solid #a77b20;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52), 0 3px 0 #8a671d, 0 6px 10px rgba(41, 45, 52, 0.2);
}

[data-theme="classic-gray"] .settings-btn:hover {
  color: #343942;
  border-color: #765817;
}

[data-theme="classic-gray"] .btn-primary:active {
  transform: translateY(1px) scale(0.98) !important;
  box-shadow: inset 0 2px 5px rgba(41, 45, 52, 0.24) !important;
}

[data-theme="classic-gray"] .fab-btn:active,
[data-theme="classic-gray"] .settings-btn:active {
  transform: translateY(3px) scale(0.98) !important;
  box-shadow: inset 0 2px 5px rgba(41, 45, 52, 0.24) !important;
}

[data-theme="classic-gray"] .btn-secondary,
[data-theme="classic-gray"] .btn-filter-dropdown,
[data-theme="classic-gray"] .input-control,
[data-theme="classic-gray"] .filter-date-input {
  border-width: 2px;
  box-shadow: inset 0 2px 4px rgba(76, 81, 90, 0.12), 0 1px 0 rgba(255, 255, 255, 0.75);
}

[data-theme="classic-gray"] .stat-item {
  position: relative;
  overflow: hidden;
  min-width: 110px;
  border-width: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76), 0 3px 0 rgba(87, 92, 101, 0.35);
}

[data-theme="classic-gray"] .stat-item::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--retro-button-blue);
}

[data-theme="classic-gray"] .stat-item:nth-child(2)::before {
  background: var(--retro-button-green);
}

[data-theme="classic-gray"] .stat-item:nth-child(3)::before {
  background: var(--retro-button-yellow);
}

[data-theme="classic-gray"] .table-wrapper {
  border-width: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 5px 0 #858a92, 0 16px 30px rgba(41, 45, 52, 0.17);
}

[data-theme="classic-gray"] .spreadsheet-table th {
  border-color: #565c66;
}

[data-theme="classic-gray"] .fab-btn {
  width: 54px;
  height: 54px;
  border: 2px solid #9e312c;
}

[data-theme="classic-gray"] .empty-state-icon-wrapper {
  border: 2px solid #9a9ea5;
  box-shadow: inset 0 2px 4px rgba(74, 79, 88, 0.16), 0 2px 0 #ffffff;
}

[data-theme="classic-gray"] .calendar-day-cell {
  border-width: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 2px 0 rgba(93, 98, 107, 0.35);
}

@keyframes retro-controller-float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
  50% { transform: translate3d(-4px, -5px, 0) rotate(0deg); }
}

/* Pastel Pop: layered stationery surfaces, flat memo controls and a makeup sticker signature */
[data-theme="pastel-pop"] body {
  background-image:
    radial-gradient(circle, rgba(118, 95, 214, 0.12) 1.4px, transparent 1.6px),
    radial-gradient(at 8% 0%, rgba(140, 120, 232, 0.17) 0, transparent 38%),
    radial-gradient(at 100% 95%, rgba(255, 145, 168, 0.16) 0, transparent 42%);
  background-size: 28px 28px, auto, auto;
}

[data-theme="pastel-pop"] .app-header,
[data-theme="pastel-pop"] .filter-panel,
[data-theme="pastel-pop"] .table-wrapper,
[data-theme="pastel-pop"] .empty-state-card,
[data-theme="pastel-pop"] .personalize-section-card,
[data-theme="pastel-pop"] .modal-box {
  background-color: rgba(255, 252, 254, 0.96);
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(241, 236, 255, 0.42));
  border-color: #e2d4eb;
}

[data-theme="pastel-pop"] .app-header {
  min-height: 164px;
  justify-content: center;
  isolation: isolate;
  border-width: 2px;
  border-style: dashed;
  box-shadow: 0 5px 0 rgba(196, 177, 219, 0.48), 0 20px 40px rgba(108, 82, 145, 0.12);
}

[data-theme="pastel-pop"] .app-header::before {
  height: 6px;
  border-radius: 999px 999px 0 0;
}

[data-theme="pastel-pop"] .app-header::after {
  content: '';
  position: absolute;
  right: clamp(-54px, -2vw, -18px);
  bottom: -78px;
  z-index: -1;
  width: clamp(280px, 34vw, 460px);
  aspect-ratio: 3 / 2;
  background: url('assets/pastel-makeup-stickers.webp') center / contain no-repeat;
  opacity: 0.3;
  filter: saturate(0.88) contrast(0.98);
  pointer-events: none;
  animation: pastel-sticker-float 5.5s ease-in-out infinite;
}

[data-theme="pastel-pop"] .app-header > * {
  position: relative;
  z-index: 1;
}

[data-theme="pastel-pop"] .brand-title,
[data-theme="pastel-pop"] .empty-state-title,
[data-theme="pastel-pop"] .modal-title {
  font-family: 'Nunito', 'Outfit', Arial, sans-serif;
  font-weight: 800;
}

[data-theme="pastel-pop"] .brand-subtitle {
  color: #624abf;
}

[data-theme="pastel-pop"] .settings-btn {
  color: #345f52;
  background: #dff5ed;
  border: 1px solid #8fd0ba;
  border-radius: 11px 14px 10px 13px / 13px 10px 14px 11px;
  box-shadow: 0 3px 8px rgba(63, 140, 115, 0.12);
}

[data-theme="pastel-pop"] .btn-primary {
  border: 1px solid #b8a9ee;
  border-radius: 12px 15px 11px 14px / 14px 11px 15px 12px;
}

[data-theme="pastel-pop"] .btn-pill {
  border-radius: 12px 15px 11px 14px / 14px 11px 15px 12px !important;
}

[data-theme="pastel-pop"] .btn-primary:hover {
  background: #ded4ff;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(108, 82, 145, 0.15);
}

[data-theme="pastel-pop"] .btn-primary:active,
[data-theme="pastel-pop"] .fab-btn:active,
[data-theme="pastel-pop"] .settings-btn:active {
  transform: scale(0.98) !important;
  box-shadow: 0 2px 6px rgba(108, 82, 145, 0.12) !important;
}

[data-theme="pastel-pop"] .btn-secondary,
[data-theme="pastel-pop"] .btn-filter-dropdown,
[data-theme="pastel-pop"] .input-control,
[data-theme="pastel-pop"] .filter-date-input {
  border-width: 2px;
  box-shadow: inset 0 1px 0 #ffffff, 0 3px 0 rgba(201, 188, 218, 0.34);
}

[data-theme="pastel-pop"] .btn-secondary {
  background: #fff1f5;
  border-width: 1px;
  border-radius: 14px 11px 15px 12px / 11px 14px 12px 15px;
  box-shadow: 0 3px 8px rgba(108, 82, 145, 0.1);
}

[data-theme="pastel-pop"] .btn-secondary:hover {
  background: #ffe8ee;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(108, 82, 145, 0.13);
}

[data-theme="pastel-pop"] .btn-filter-dropdown {
  background: #fbf7ff;
  border-width: 1px;
  border-radius: 11px 14px 12px 15px / 14px 12px 15px 11px;
  box-shadow: 0 3px 8px rgba(108, 82, 145, 0.1);
}

[data-theme="pastel-pop"] .btn-filter-dropdown:hover {
  background-color: #f3edff !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(108, 82, 145, 0.13);
}

[data-theme="pastel-pop"] .btn-action {
  border-radius: 10px 13px 9px 12px / 12px 9px 13px 10px;
}

[data-theme="pastel-pop"] .stat-item {
  min-width: 112px;
  border-width: 2px;
  box-shadow: 0 4px 0 rgba(172, 151, 194, 0.34), 0 10px 20px rgba(108, 82, 145, 0.08);
}

[data-theme="pastel-pop"] .table-wrapper {
  border-width: 2px;
  box-shadow: 0 5px 0 rgba(196, 177, 219, 0.46), 0 18px 34px rgba(108, 82, 145, 0.11);
}

[data-theme="pastel-pop"] .spreadsheet-table th {
  font-family: 'Nunito', 'Outfit', Arial, sans-serif;
  font-weight: 800;
  border-color: #6b5a7b;
}

[data-theme="pastel-pop"] .fab-btn {
  width: 56px;
  height: 56px;
  border: 1px solid #f0a9ba;
  border-radius: 18px 22px 17px 21px / 21px 17px 22px 18px;
  animation: none;
}

[data-theme="pastel-pop"] .fab-btn:hover {
  background: #ffcbd8;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(201, 71, 103, 0.18);
}

[data-theme="pastel-pop"] .empty-state-icon-wrapper {
  color: #765fd6;
  background: #fff4c7;
  border: 2px solid #e8c45f;
  box-shadow: 0 4px 0 rgba(185, 145, 34, 0.24), 0 12px 24px rgba(108, 82, 145, 0.1);
}

[data-theme="pastel-pop"] .calendar-day-cell {
  border-width: 2px;
  box-shadow: 0 3px 0 rgba(196, 177, 219, 0.36);
}

@keyframes pastel-sticker-float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(1.5deg); }
  50% { transform: translate3d(-5px, -6px, 0) rotate(-0.5deg); }
}

/* Mochi Pink: berry-pink identity, soft mascot surfaces and cream status states */
[data-theme="mochi-pink"] body {
  background-image:
    radial-gradient(circle, rgba(184, 60, 117, 0.08) 1.2px, transparent 1.5px),
    radial-gradient(circle at 4% 0%, rgba(246, 154, 192, 0.2), transparent 38%),
    radial-gradient(circle at 100% 100%, rgba(216, 185, 239, 0.18), transparent 42%);
  background-size: 30px 30px, auto, auto;
}

[data-theme="mochi-pink"] .app-header,
[data-theme="mochi-pink"] .filter-panel,
[data-theme="mochi-pink"] .table-wrapper,
[data-theme="mochi-pink"] .empty-state-card,
[data-theme="mochi-pink"] .personalize-section-card,
[data-theme="mochi-pink"] .modal-box {
  background-color: rgba(255, 253, 254, 0.97);
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 235, 244, 0.34));
  border-color: #ecc5d7;
}

[data-theme="mochi-pink"] .app-header {
  min-height: 164px;
  justify-content: center;
  isolation: isolate;
  border-width: 2px;
  box-shadow: 0 5px 0 rgba(226, 168, 195, 0.48), 0 20px 42px rgba(153, 63, 106, 0.12);
}

[data-theme="mochi-pink"] .app-header::before {
  height: 7px;
  border-radius: 999px 999px 0 0;
}

[data-theme="mochi-pink"] .app-header::after {
  content: '';
  position: absolute;
  right: clamp(-28px, 1vw, 24px);
  bottom: -105px;
  z-index: -1;
  width: clamp(225px, 27vw, 350px);
  aspect-ratio: 1;
  background: url('assets/mochi-bunny-mascot.webp') center / contain no-repeat;
  opacity: 0.28;
  pointer-events: none;
  animation: mochi-mascot-bob 5.2s ease-in-out infinite;
}

[data-theme="mochi-pink"] .app-header > * {
  position: relative;
  z-index: 1;
}

[data-theme="mochi-pink"] .brand-title,
[data-theme="mochi-pink"] .empty-state-title,
[data-theme="mochi-pink"] .modal-title {
  font-family: 'Nunito', 'Outfit', Arial, sans-serif;
  font-weight: 800;
}

[data-theme="mochi-pink"] .brand-subtitle {
  color: #922a5a;
}

[data-theme="mochi-pink"] .settings-btn {
  color: #922a5a;
  background: #fff0f6;
  border: 1px solid #e5abc5;
  border-radius: 44% 56% 48% 52% / 52% 46% 54% 48%;
  box-shadow: 0 3px 8px rgba(146, 42, 90, 0.12);
}

[data-theme="mochi-pink"] .btn-primary,
[data-theme="mochi-pink"] .btn-secondary,
[data-theme="mochi-pink"] .btn-filter-dropdown,
[data-theme="mochi-pink"] .btn-pill {
  border-radius: 18px 23px 17px 22px / 22px 17px 23px 18px !important;
}

[data-theme="mochi-pink"] .btn-primary {
  border: 1px solid #922a5a;
}

[data-theme="mochi-pink"] .btn-primary:hover {
  box-shadow: 0 8px 18px rgba(146, 42, 90, 0.28);
}

[data-theme="mochi-pink"] .btn-icon-bubble {
  border-radius: 46% 54% 45% 55% / 54% 43% 57% 46%;
}

[data-theme="mochi-pink"] .btn-secondary,
[data-theme="mochi-pink"] .btn-filter-dropdown,
[data-theme="mochi-pink"] .input-control,
[data-theme="mochi-pink"] .filter-date-input {
  border-width: 2px;
  box-shadow: inset 0 1px 0 #ffffff, 0 3px 0 rgba(226, 168, 195, 0.28);
}

[data-theme="mochi-pink"] .btn-action {
  border-radius: 45% 55% 48% 52% / 53% 45% 55% 47%;
}

[data-theme="mochi-pink"] .stat-item {
  min-width: 112px;
  border-width: 2px;
  border-radius: 18px 22px 17px 21px / 21px 17px 22px 18px;
  box-shadow: 0 4px 0 rgba(226, 168, 195, 0.32), 0 10px 20px rgba(153, 63, 106, 0.07);
}

[data-theme="mochi-pink"] .table-wrapper {
  border-width: 2px;
  box-shadow: 0 5px 0 rgba(226, 168, 195, 0.42), 0 18px 36px rgba(153, 63, 106, 0.1);
}

[data-theme="mochi-pink"] .spreadsheet-table th {
  font-family: 'Nunito', 'Outfit', Arial, sans-serif;
  font-weight: 800;
  border-color: #785168;
}

[data-theme="mochi-pink"] .fab-btn {
  width: 56px;
  height: 56px;
  border: 1px solid #922a5a;
  border-radius: 42% 58% 47% 53% / 56% 44% 56% 44%;
}

[data-theme="mochi-pink"] .fab-btn:hover {
  transform: translateY(-2px) rotate(-2deg);
  box-shadow: 0 10px 20px rgba(146, 42, 90, 0.3);
}

[data-theme="mochi-pink"] .empty-state-icon-wrapper {
  color: #922a5a;
  background: #fff8d9;
  border: 2px solid #dfc568;
  border-radius: 45% 55% 48% 52% / 54% 44% 56% 46%;
  box-shadow: 0 4px 0 rgba(190, 152, 42, 0.2), 0 12px 24px rgba(153, 63, 106, 0.09);
}

[data-theme="mochi-pink"] .calendar-day-cell {
  border-width: 2px;
  box-shadow: 0 3px 0 rgba(226, 168, 195, 0.28);
}

@keyframes mochi-mascot-bob {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(1deg); }
  50% { transform: translate3d(-4px, -6px, 0) rotate(-1deg); }
}

/* Bạch Ly Ngọc: ivory editorial surfaces, botanical detail and restrained gold */
[data-theme="lily-ivory"] body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 8% 0%, rgba(130, 155, 90, 0.14), transparent 34%),
    radial-gradient(circle at 96% 12%, rgba(200, 168, 78, 0.08), transparent 28%);
}

[data-theme="lily-ivory"] .app-header,
[data-theme="lily-ivory"] .filter-panel,
[data-theme="lily-ivory"] .table-wrapper,
[data-theme="lily-ivory"] .empty-state-card,
[data-theme="lily-ivory"] .personalize-section-card,
[data-theme="lily-ivory"] .modal-box {
  background-color: rgba(255, 254, 250, 0.97);
  border-color: #d9ded3;
}

[data-theme="lily-ivory"] .app-header {
  min-height: 164px;
  justify-content: center;
  isolation: isolate;
  border: 1px solid #d9ded3;
  box-shadow: 0 18px 42px rgba(53, 77, 55, 0.1);
}

[data-theme="lily-ivory"] .app-header::before {
  height: 4px;
}

[data-theme="lily-ivory"] .app-header::after {
  content: '';
  position: absolute;
  right: clamp(-12px, 2vw, 28px);
  bottom: -96px;
  z-index: -1;
  width: clamp(230px, 29vw, 360px);
  aspect-ratio: 1;
  background: url('assets/white-lily-botanical.webp') center / contain no-repeat;
  opacity: 0.2;
  pointer-events: none;
}

[data-theme="lily-ivory"] .app-header > * {
  position: relative;
  z-index: 1;
}

[data-theme="lily-ivory"] .brand-title,
[data-theme="lily-ivory"] .empty-state-title,
[data-theme="lily-ivory"] .modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
}

[data-theme="lily-ivory"] .brand-subtitle {
  color: #80691e;
}

[data-theme="lily-ivory"] .settings-btn,
[data-theme="lily-ivory"] .user-badge-pill,
[data-theme="lily-ivory"] .sync-status-badge {
  color: #354d37;
  background: rgba(255, 254, 250, 0.88);
  border-color: #cbd3c4;
  box-shadow: 0 3px 10px rgba(53, 77, 55, 0.08);
}

[data-theme="lily-ivory"] .btn-primary {
  border: 1px solid #354d37;
}

[data-theme="lily-ivory"] .btn-primary:hover,
[data-theme="lily-ivory"] .fab-btn:hover {
  box-shadow: 0 10px 22px rgba(53, 77, 55, 0.24);
}

[data-theme="lily-ivory"] .btn-secondary,
[data-theme="lily-ivory"] .btn-filter-dropdown,
[data-theme="lily-ivory"] .input-control,
[data-theme="lily-ivory"] .filter-date-input {
  background: #fffefa;
  border-color: #cbd3c4;
}

[data-theme="lily-ivory"] .stat-item {
  border-width: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

[data-theme="lily-ivory"] .table-wrapper {
  box-shadow: 0 18px 40px rgba(53, 77, 55, 0.09);
}

[data-theme="lily-ivory"] .spreadsheet-table th {
  font-family: 'Outfit', Arial, sans-serif;
  font-weight: 600;
  border-color: #526a54;
}

[data-theme="lily-ivory"] .calendar-day-cell {
  border-color: #d9ded3;
  box-shadow: 0 4px 12px rgba(53, 77, 55, 0.06);
}

[data-theme="lily-ivory"] .empty-state-icon-wrapper {
  color: #354d37;
  background: #eef1e8;
  border: 1px solid #b9c9a7;
  box-shadow: 0 10px 24px rgba(53, 77, 55, 0.09);
}

[data-theme="lily-ivory"] .fab-btn {
  border: 1px solid #354d37;
}

/* Professional Dark: quiet surfaces, clear elevation and one blue accent */
[data-theme="dark-mode"] body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 50% -20%, rgba(91, 124, 247, 0.11), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(50, 61, 96, 0.12), transparent 46%);
}

[data-theme="dark-mode"] .app-header,
[data-theme="dark-mode"] .filter-panel,
[data-theme="dark-mode"] .table-wrapper,
[data-theme="dark-mode"] .empty-state-card,
[data-theme="dark-mode"] .personalize-section-card,
[data-theme="dark-mode"] .modal-box {
  background: var(--color-card-bg);
  border-color: var(--color-border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

[data-theme="dark-mode"] .app-header,
[data-theme="dark-mode"] .empty-state-card {
  isolation: isolate;
}

[data-theme="dark-mode"] .app-header::after,
[data-theme="dark-mode"] .empty-state-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(91, 124, 247, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 124, 247, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 88%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 88%);
  pointer-events: none;
}

[data-theme="dark-mode"] .app-header > *,
[data-theme="dark-mode"] .empty-state-card > * {
  position: relative;
  z-index: 1;
}

[data-theme="dark-mode"] .app-header {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 12px 34px rgba(8, 9, 14, 0.24);
}

[data-theme="dark-mode"] .app-header::before {
  height: 2px;
}

[data-theme="dark-mode"] .brand-subtitle {
  color: #8fa5ff;
}

[data-theme="dark-mode"] .brand-subtitle,
[data-theme="dark-mode"] .stat-label,
[data-theme="dark-mode"] .stat-val,
[data-theme="dark-mode"] .spreadsheet-table th {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

[data-theme="dark-mode"] .brand-subtitle,
[data-theme="dark-mode"] .stat-label,
[data-theme="dark-mode"] .spreadsheet-table th {
  letter-spacing: 0.075em;
}

[data-theme="dark-mode"] .settings-btn,
[data-theme="dark-mode"] .sync-status-badge,
[data-theme="dark-mode"] .user-badge-pill {
  background: #303445;
  border-color: #51586f;
  color: #d8ddea;
  box-shadow: none;
}

[data-theme="dark-mode"] .btn-primary,
[data-theme="dark-mode"] .fab-btn {
  background-image: none;
}

[data-theme="dark-mode"] .btn-primary:hover,
[data-theme="dark-mode"] .fab-btn:hover {
  background: #6a87f8;
}

[data-theme="dark-mode"] .view-tabs .btn-primary {
  color: #f5f6fb !important;
  background: #2b3040;
  border: 1px solid #5b7cf7;
  box-shadow: inset 3px 0 0 #5b7cf7, 0 6px 14px rgba(8, 9, 14, 0.18);
}

[data-theme="dark-mode"] .view-tabs .btn-primary:hover {
  background: #343a4d;
  box-shadow: inset 3px 0 0 #7290ff, 0 8px 18px rgba(8, 9, 14, 0.24);
}

[data-theme="dark-mode"] .btn-secondary,
[data-theme="dark-mode"] .btn-filter-dropdown,
[data-theme="dark-mode"] .input-control,
[data-theme="dark-mode"] .filter-date-input {
  background-color: #222633;
  border-color: #4a5066;
  color: var(--color-text-main);
  box-shadow: none;
}

[data-theme="dark-mode"] .stat-item {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

[data-theme="dark-mode"] .stat-item::before {
  content: '';
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 2px;
  background: #5b7cf7;
}

[data-theme="dark-mode"] .stat-item:nth-child(2)::before {
  background: #55d5a6;
}

[data-theme="dark-mode"] .stat-item:nth-child(3)::before {
  background: #8fa5ff;
}

[data-theme="dark-mode"] .table-wrapper {
  box-shadow: 0 12px 32px rgba(8, 9, 14, 0.24);
}

[data-theme="dark-mode"] .spreadsheet-table th {
  border-color: #50566d;
}

[data-theme="dark-mode"] .spreadsheet-table td {
  border-color: #41475b;
}

[data-theme="dark-mode"] .calendar-day-cell {
  background: #252938;
}

[data-theme="dark-mode"] .empty-state-icon-wrapper {
  color: #8fa5ff;
  background: #293250;
  border: 1px solid #485a98;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark-mode"] .empty-state-sparkles {
  color: #8fa5ff;
}

[data-theme="dark-mode"] .modal-overlay {
  background: rgba(10, 11, 16, 0.72);
}

[data-theme="dark-mode"] .theme-scroll-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 700px) {
  [data-theme="classic-gray"] .app-header,
  [data-theme="pastel-pop"] .app-header,
  [data-theme="mochi-pink"] .app-header,
  [data-theme="lily-ivory"] .app-header {
    min-height: 148px;
  }

  [data-theme="classic-gray"] .app-header::after {
    right: -74px;
    bottom: -48px;
    width: 238px;
    opacity: 0.15;
  }

  [data-theme="pastel-pop"] .app-header::after {
    right: -82px;
    bottom: -50px;
    width: 250px;
    opacity: 0.16;
  }

  [data-theme="mochi-pink"] .app-header::after {
    right: -55px;
    bottom: -68px;
    width: 210px;
    opacity: 0.18;
  }

  [data-theme="lily-ivory"] .app-header::after {
    right: -48px;
    bottom: -72px;
    width: 220px;
    opacity: 0.18;
  }

  [data-theme="classic-gray"] .empty-state-card,
  [data-theme="dark-mode"] .empty-state-card,
  [data-theme="pastel-pop"] .empty-state-card,
  [data-theme="mochi-pink"] .empty-state-card,
  [data-theme="lily-ivory"] .empty-state-card {
    padding-right: 56px;
    padding-left: 56px;
  }

  [data-theme="classic-gray"] .empty-state-desc,
  [data-theme="dark-mode"] .empty-state-desc,
  [data-theme="pastel-pop"] .empty-state-desc,
  [data-theme="mochi-pink"] .empty-state-desc,
  [data-theme="lily-ivory"] .empty-state-desc {
    max-width: 230px;
  }

  [data-theme="classic-gray"] .fab-btn,
  [data-theme="dark-mode"] .fab-btn,
  [data-theme="pastel-pop"] .fab-btn,
  [data-theme="mochi-pink"] .fab-btn,
  [data-theme="lily-ivory"] .fab-btn {
    right: calc(8px + env(safe-area-inset-right, 0px));
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  .form-actions {
    gap: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  .form-actions .btn-pill {
    padding: 9px 12px !important;
  }

  #btn-cancel-edit {
    flex: 0 1 auto;
  }

  #btn-submit-form {
    flex: 1 1 auto;
  }

  #btn-submit-form > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-clipboard-bar {
    gap: 8px;
    padding-left: 10px;
  }

  .customer-clipboard-summary {
    flex: 1 1 auto;
  }
}

@media (max-width: 440px) {
  .brand-desc {
    display: block;
    max-width: 100%;
    font-size: 10.5px;
    line-height: 1.35;
  }

  :root:not([data-theme]) .default-monogram {
    right: 2px;
    bottom: -20px;
    font-size: 68px;
  }

}

/* ====================================================
   COMPONENT GRAMMAR — mỗi theme có một hệ UI riêng
   ==================================================== */

/* Hooks dùng chung thay cho inline style để theme có thể kiểm soát bố cục. */
.calendar-nav-icon {
  flex: 0 0 auto;
  vertical-align: middle;
}

.calendar-view-container {
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-card);
  box-shadow: var(--shadow-sm);
}

.calendar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
}

.calendar-nav-icon { width: 18px; height: 18px; }
.calendar-month-control { position: relative; display: inline-block; cursor: pointer; }
.calendar-month-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--color-text-main);
  font-family: var(--ui-heading-font);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.calendar-month-picker {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.calendar-grid-wrapper {
  width: 100%;
  padding: 12px;
  overflow: hidden;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--ui-radius-card);
  box-shadow: var(--shadow-md);
}

.calendar-weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 12px;
  padding-bottom: 8px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
  text-transform: uppercase;
}

.calendar-sunday-label { color: var(--color-danger); }

/* Rose Gold — appointment ledger và client folio của atelier. */
:root:not([data-theme]) .table-wrapper { border-radius: 4px; box-shadow: 0 18px 42px rgba(113, 86, 61, 0.09); }
:root:not([data-theme]) .spreadsheet-table th {
  background: #2f2a27;
  color: #f8f2e9;
  border-color: #5e534b;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}

:root:not([data-theme]) .spreadsheet-table td { border-right-color: rgba(197, 168, 128, 0.32); }
:root:not([data-theme]) .spreadsheet-table tr:nth-child(even):not(.row-completed):not(.row-overdue):not(.row-canceled) td { background: rgba(247, 243, 237, 0.46); }
:root:not([data-theme]) .spreadsheet-table td.grouped-date-cell {
  background: #faf6f0;
  border-right: 1px solid #c5a880;
  font-family: 'Playfair Display', Georgia, serif;
}

:root:not([data-theme]) .modal-box {
  border-color: #d8c5ad;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(75, 57, 43, 0.2);
}

:root:not([data-theme]) .modal-title {
  padding-bottom: 12px !important;
  border-bottom: 1px solid #c5a880 !important;
  font-family: 'Playfair Display', Georgia, serif !important;
  font-size: 22px;
}

:root:not([data-theme]) .detail-group { border-bottom-style: solid; }
:root:not([data-theme]) .detail-financial-box {
  background: transparent;
  border-width: 1px 0;
  border-radius: 0;
  box-shadow: none;
}

:root:not([data-theme]) .calendar-header,
:root:not([data-theme]) .calendar-grid-wrapper { border-radius: 4px; }
:root:not([data-theme]) .calendar-day-cell { border-radius: 2px; box-shadow: none; }
:root:not([data-theme]) .calendar-day-cell.today { box-shadow: inset 0 0 0 1px #c5a880; }

/* Classic Retro — control deck, CRT data grid và phím vật lý. */
[data-theme="classic-gray"] .modal-box::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 16px;
  width: 68px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d95850 0 25%, #e8b94f 25% 50%, #3d6fd3 50% 75%, #3c9a70 75%);
}
[data-theme="classic-gray"] .table-wrapper {
  padding: 9px;
  background: #b9bdc3;
  border: 2px solid #656b74;
  box-shadow: inset 0 0 0 3px #e5e7e9, 0 5px 0 #727780, 0 18px 34px rgba(41,45,52,.22);
}

[data-theme="classic-gray"] .table-scroll-viewport {
  border-radius: 8px;
}

[data-theme="classic-gray"] .spreadsheet-table { background: #eef0ed; }
[data-theme="classic-gray"] .spreadsheet-table th {
  background: #282d35;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .08em;
}

[data-theme="classic-gray"] .spreadsheet-table td {
  border-color: #a9adb4;
  background-image: none;
}

[data-theme="classic-gray"] .view-tabs,
[data-theme="classic-gray"] .filter-panel {
  background-color: #c7cacf;
  background-image: none;
  border-color: #777d86;
  box-shadow: inset 0 1px 0 #ffffff, 0 3px 0 #8b9098;
}

[data-theme="classic-gray"] .view-tabs {
  padding: 8px !important;
  border: 2px solid #777d86 !important;
  border-radius: 14px;
}

[data-theme="classic-gray"] .spreadsheet-table tr:hover td { box-shadow: inset 3px 0 0 #3d6fd3; }
[data-theme="classic-gray"] .modal-box {
  padding-top: 32px;
  background: #dfe1e4;
  border: 2px solid #666c75;
  box-shadow: inset 0 0 0 3px #f2f3f4, 0 6px 0 #737881, 0 24px 58px rgba(41,45,52,.3);
}

[data-theme="classic-gray"] .modal-title {
  padding: 10px 12px !important;
  color: #f4f4f1 !important;
  background: #343942 !important;
  border: 2px solid #171a1f !important;
  border-radius: 8px;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  font-family: ui-monospace, Consolas, monospace !important;
  text-transform: uppercase;
}

[data-theme="classic-gray"] .detail-financial-box {
  background: #c9ccd1;
  border: 2px solid #858a92;
  box-shadow: inset 0 3px 8px rgba(41,45,52,.16), 0 1px 0 #fff;
}

[data-theme="classic-gray"] .calendar-header,
[data-theme="classic-gray"] .calendar-grid-wrapper {
  background: #c7cacf;
  border: 2px solid #777d86;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #8b9098;
}

[data-theme="classic-gray"] .calendar-day-cell.today::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c9a70;
  box-shadow: 0 0 8px #3c9a70;
}

/* Professional Dark — command bar, telemetry rail và inspector panel. */
[data-theme="dark-mode"] .table-wrapper {
  border-radius: 8px;
  border-color: #444a60;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 16px 40px rgba(8,9,14,.32);
}

[data-theme="dark-mode"] .spreadsheet-table th {
  background: #1d202a;
  border-bottom: 1px solid #5b7cf7;
  font-size: 10px;
}

[data-theme="dark-mode"] .spreadsheet-table td { background: #252938; }
[data-theme="dark-mode"] .spreadsheet-table tr:hover td {
  background: #2c3245;
  box-shadow: inset 0 1px 0 rgba(91,124,247,.38), inset 0 -1px 0 rgba(91,124,247,.38);
}

[data-theme="dark-mode"] .spreadsheet-table td.grouped-date-cell {
  background: #202638;
  border-right: 2px solid #5b7cf7;
  font-family: ui-monospace, Consolas, monospace;
}

[data-theme="dark-mode"] .modal-box {
  background: #20232e;
  border-radius: 10px;
  border-color: #51586f;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}

[data-theme="dark-mode"] .modal-title {
  padding-bottom: 12px !important;
  color: #f5f6fb !important;
  background: none !important;
  border-bottom: 1px solid #5b7cf7 !important;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  font-family: ui-monospace, Consolas, monospace !important;
  font-size: 17px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

[data-theme="dark-mode"] .detail-grid { gap: 0; border: 1px solid #41475b; }
[data-theme="dark-mode"] .detail-group { padding: 10px 12px; border-bottom: 1px solid #41475b; }
[data-theme="dark-mode"] .detail-label { font-family: ui-monospace, Consolas, monospace; color: #8f97aa; }
[data-theme="dark-mode"] .detail-financial-box { border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.02); }
[data-theme="dark-mode"] .calendar-header,
[data-theme="dark-mode"] .calendar-grid-wrapper { background: #20232e; border-radius: 8px; }
[data-theme="dark-mode"] .calendar-weekdays-grid { font-family: ui-monospace, Consolas, monospace; }
[data-theme="dark-mode"] .calendar-day-cell { border-radius: 5px; box-shadow: none; }
[data-theme="dark-mode"] .calendar-day-cell.today { box-shadow: inset 3px 0 0 #5b7cf7; }

/* Pastel Pop — planner giấy kẻ, tab phân trang và sticky notes. */
[data-theme="pastel-pop"] .table-wrapper {
  border-radius: 8px 20px 10px 16px;
  border-style: dashed;
  border-color: #c9b6dc;
  background-color: #fffdfd;
  background-image: repeating-linear-gradient(to bottom, transparent 0 43px, rgba(140,120,232,.08) 43px 44px);
}

[data-theme="pastel-pop"] .filter-panel {
  position: relative;
  overflow: visible;
}

[data-theme="pastel-pop"] .filter-panel::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 2;
  width: 92px;
  height: 21px;
  background: rgba(255, 214, 107, 0.62);
  box-shadow: 0 1px 2px rgba(124, 92, 29, 0.08);
  transform: translateX(-50%) rotate(-1deg);
  pointer-events: none;
}

[data-theme="pastel-pop"] .spreadsheet-table th {
  background: #51435f;
  border-color: #756383;
  text-transform: none;
}

[data-theme="pastel-pop"] .spreadsheet-table td { border-right-style: dashed; background-color: rgba(255,255,255,.7); }
[data-theme="pastel-pop"] .spreadsheet-table td.grouped-date-cell {
  background: #f1ecff;
  border-right: 2px dashed #8c78e8;
}

[data-theme="pastel-pop"] .weekday {
  display: inline-block;
  padding: 2px 5px;
  background: #fff4c7;
  border-radius: 3px;
}

[data-theme="pastel-pop"] .modal-box {
  background-color: #fffdfd;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(140,120,232,.075) 31px 32px);
  border-radius: 8px 22px 10px 18px;
}

[data-theme="pastel-pop"] .modal-box::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  width: 96px;
  height: 22px;
  background: rgba(255,214,107,.62);
  transform: translateX(-50%) rotate(-1deg);
}

[data-theme="pastel-pop"] .modal-title {
  padding-bottom: 10px !important;
  border-bottom: 2px dashed #cfc0dc !important;
  font-family: 'Nunito', 'Outfit', sans-serif !important;
}

[data-theme="pastel-pop"] .detail-group { border-bottom-color: #cfc0dc; }
[data-theme="pastel-pop"] .calendar-header { border-radius: 8px 18px 6px 16px; }
[data-theme="pastel-pop"] .calendar-grid-wrapper {
  border-radius: 8px 20px 10px 18px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 55px, rgba(140,120,232,.08) 55px 56px);
}

[data-theme="pastel-pop"] .calendar-weekdays-grid {
  gap: 4px;
  border-bottom: 0;
}

[data-theme="pastel-pop"] .calendar-weekdays-grid > div {
  padding: 5px 2px;
  background: #f1ecff;
  border-radius: 7px 7px 2px 2px;
}

[data-theme="pastel-pop"] .calendar-day-cell { border-radius: 4px 9px 5px 8px; box-shadow: none; }

/* Mochi Pink — mascot companion, speech bubbles và mochi tiles. */

[data-theme="mochi-pink"] .table-wrapper {
  padding: 4px 8px 10px;
  background: rgba(255,240,246,.72);
  border-radius: 34px 24px 32px 22px;
}

[data-theme="mochi-pink"] .table-scroll-viewport {
  border-radius: 22px 16px 20px 14px;
}

[data-theme="mochi-pink"] .spreadsheet-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

[data-theme="mochi-pink"] .spreadsheet-table th {
  background: #62394f;
  border-right: 0;
  border-bottom: 0;
}

[data-theme="mochi-pink"] .spreadsheet-table th:first-child { border-radius: 18px 0 0 18px; }
[data-theme="mochi-pink"] .spreadsheet-table th:last-child { border-radius: 0 18px 18px 0; }
[data-theme="mochi-pink"] .spreadsheet-table td {
  background: #fffdfd;
  border-top: 1px solid #efcddd;
  border-bottom: 1px solid #efcddd;
  border-right-color: transparent;
}

[data-theme="mochi-pink"] .spreadsheet-table td:first-child { border-left: 1px solid #efcddd; border-radius: 18px 0 0 18px; }
[data-theme="mochi-pink"] .spreadsheet-table td:last-child { border-right: 1px solid #efcddd; border-radius: 0 18px 18px 0; }
[data-theme="mochi-pink"] .spreadsheet-table td.grouped-date-cell {
  background: #fff0f6;
  border-right: 2px solid #b83c75;
}

[data-theme="mochi-pink"] .modal-box {
  overflow: visible;
  isolation: isolate;
  border-radius: 34px 24px 32px 22px;
}

[data-theme="mochi-pink"] .modal-box::before,
[data-theme="mochi-pink"] .modal-box::after {
  content: '';
  position: absolute;
  top: -31px;
  width: 25px;
  height: 43px;
  background:
    linear-gradient(90deg, transparent 27%, rgba(232, 151, 187, 0.34) 28% 72%, transparent 73%),
    #fff0f6;
  border: 2px solid #ecc5d7;
  border-bottom: 0;
  border-radius: 70% 70% 42% 42% / 82% 82% 24% 24%;
  z-index: -1;
  pointer-events: none;
}

[data-theme="mochi-pink"] .modal-box::before {
  left: 38px;
  transform: rotate(-10deg);
}

[data-theme="mochi-pink"] .modal-box::after {
  left: 70px;
  transform: rotate(8deg);
}

[data-theme="mochi-pink"] .modal-title {
  padding-bottom: 10px !important;
  border-bottom: 2px dotted #e8b9cf !important;
  font-family: 'Nunito', 'Outfit', sans-serif !important;
}

[data-theme="mochi-pink"] .detail-financial-box { border-radius: 22px 16px 20px 14px; }
[data-theme="mochi-pink"] .calendar-header { border-radius: 28px 20px 26px 18px; }
[data-theme="mochi-pink"] .calendar-grid-wrapper { border-radius: 32px 24px 30px 22px; }
[data-theme="mochi-pink"] .calendar-day-cell {
  border-radius: 44% 56% 47% 53% / 54% 46% 55% 45%;
  box-shadow: 0 3px 0 rgba(226,168,195,.28);
}

[data-theme="mochi-pink"] .calendar-day-cell.today { box-shadow: inset 0 0 0 3px #ffdbe9, 0 3px 0 rgba(226,168,195,.28); }

/* Bạch Ly Ngọc — botanical editorial, hairline và negative space. */
[data-theme="lily-ivory"] .table-wrapper { border-radius: 2px; box-shadow: 0 20px 50px rgba(53,77,55,.08); }
[data-theme="lily-ivory"] .spreadsheet-table th {
  background: #eef1e8;
  color: #354d37;
  border-bottom: 1px solid #829b5a;
  border-right: 1px solid rgba(82, 106, 84, 0.28);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
}

[data-theme="lily-ivory"] .spreadsheet-table td {
  border-right: 1px solid rgba(82, 106, 84, 0.2);
  border-bottom-color: #e3e6dc;
}
[data-theme="lily-ivory"] .spreadsheet-table th:last-child,
[data-theme="lily-ivory"] .spreadsheet-table td:last-child { border-right: 0; }
[data-theme="lily-ivory"] .spreadsheet-table td.grouped-date-cell {
  background: #f5f6ef;
  border-right: 1px solid #c8a84e;
  font-family: 'Playfair Display', Georgia, serif;
}

[data-theme="lily-ivory"] .modal-box {
  border-width: 1px;
  border-radius: 2px;
  box-shadow: 0 28px 72px rgba(42,58,44,.2);
}

[data-theme="lily-ivory"] .modal-box::after {
  content: '';
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 150px;
  height: 150px;
  background: url('assets/white-lily-botanical.webp') center / contain no-repeat;
  opacity: .08;
  pointer-events: none;
}

[data-theme="lily-ivory"] .modal-title {
  padding-bottom: 12px !important;
  border-bottom: 1px solid #c8a84e !important;
  font-family: 'Playfair Display', Georgia, serif !important;
  font-size: 22px;
}

[data-theme="lily-ivory"] .detail-group { padding-bottom: 10px; border-bottom: 1px solid #d9ded3; }
[data-theme="lily-ivory"] .detail-label { color: #687365; letter-spacing: .11em; }
[data-theme="lily-ivory"] .detail-financial-box {
  background: transparent;
  border-width: 1px 0;
  border-radius: 0;
  box-shadow: none;
}

[data-theme="lily-ivory"] .calendar-header,
[data-theme="lily-ivory"] .calendar-grid-wrapper { border-radius: 2px; box-shadow: 0 14px 34px rgba(53,77,55,.07); }
[data-theme="lily-ivory"] .calendar-weekdays-grid { color: #5f744b; font-family: 'Playfair Display', Georgia, serif; }
[data-theme="lily-ivory"] .calendar-day-cell { border-radius: 50% 50% 46% 54%; box-shadow: none; }
[data-theme="lily-ivory"] .calendar-day-cell.today { border-color: #c8a84e; box-shadow: inset 0 0 0 1px #fffefa; }

@media (max-width: 768px) {
  .calendar-header { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ====================================================
   RESPONSIVE QA HARDENING v2.3
   Giữ cá tính từng theme, chuẩn hóa vùng chạm và modal.
   ==================================================== */

.user-badge-pill,
.settings-btn {
  flex-basis: 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}

.booking-col-date { width: 96px; }
.booking-col-actions { width: 192px; }
.spreadsheet-table {
  width: 100%;
  min-width: 883px;
}
.date-val { white-space: nowrap; }

.actions-cell {
  box-sizing: border-box;
  width: 100%;
  flex-wrap: nowrap;
}

.btn-action {
  min-width: 40px;
  min-height: 40px;
}

.checkbox-container {
  position: relative;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  cursor: pointer;
}

.checkbox-completed {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.checkbox-visual {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border);
  border-radius: max(4px, calc(var(--ui-radius-control) / 2));
  background: var(--color-card-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.checkbox-completed:checked + .checkbox-visual {
  border-color: var(--color-success);
  background: var(--color-success);
}

.checkbox-completed:checked + .checkbox-visual::after {
  content: '';
  display: block;
  width: 6px;
  height: 11px;
  margin: 2px auto 0;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-completed:focus-visible + .checkbox-visual {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 34%, transparent);
  outline-offset: 3px;
}

/* Bạch Ly Ngọc: ô lịch dạng tờ lịch botanical, tách khỏi mochi tile. */
[data-theme="lily-ivory"] .calendar-day-cell {
  border-radius: 3px;
  background:
    linear-gradient(135deg, transparent 0 80%, rgba(200, 168, 78, 0.08) 80% 100%),
    var(--color-card-bg);
}

[data-theme="lily-ivory"] .calendar-day-cell.today {
  border-color: #829b5a;
  box-shadow: inset 0 -3px 0 #c8a84e;
}

[data-theme="lily-ivory"] .calendar-day-cell:focus-visible {
  box-shadow: inset 0 -3px 0 #c8a84e, 0 0 0 3px rgba(130, 155, 90, 0.24);
}

@media (max-width: 768px) {
  .calendar-nav-btn,
  .btn-action {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  [data-theme="classic-gray"] .fab-btn,
  [data-theme="dark-mode"] .fab-btn,
  [data-theme="pastel-pop"] .fab-btn,
  [data-theme="mochi-pink"] .fab-btn,
  [data-theme="lily-ivory"] .fab-btn,
  :root:not([data-theme]) .fab-btn {
    right: calc(12px + env(safe-area-inset-right, 0px));
  }
}
