/* ===========================
   TrọBill — style.css
   =========================== */

/* ----- Reset & Tokens ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Light Theme (Default) */
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  --electric: #d97706;
  --water: #0891b2;
  --wifi: #7c3aed;
  --green: #16a34a;
  --red: #dc2626;
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, .04);
  --transition: .18s ease;
}

[data-theme="dark"] {
  /* Dark Theme (Regal Purple Glassmorphism) */
  --bg: #0c0d18;
  --bg2: rgba(22, 24, 44, 0.72);
  --bg3: rgba(32, 35, 64, 0.85);
  --bg-card: rgba(22, 24, 44, 0.72);
  --border: rgba(167, 139, 250, 0.16);
  --text: #f8fafc;
  --text-muted: #9ba3b8;
  --primary: #a855f7;
  --primary-d: #9333ea;
  --primary-light: rgba(168, 85, 247, 0.22);
  --electric: #fbbf24;
  --water: #38bdf8;
  --wifi: #c084fc;
  --green: #34d399;
  --red: #fb7185;
  --danger: #f43f5e;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(124, 58, 237, 0.1);
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg2);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===========================
   NAV
   =========================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
  overflow: visible;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.brand-icon {
  font-size: 1.4rem;
}

.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--primary);
  letter-spacing: -.5px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-tab .tab-icon {
  font-size: 1.5rem;
  margin-bottom: 2px;
  transition: transform var(--transition), text-shadow var(--transition);
}

.nav-tab:hover {
  color: var(--text);
  background: var(--bg3);
}

.nav-tab.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-tab.active .tab-icon {
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
  font-variation-settings: 'FILL' 1, 'wght' 500;
}

.btn-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  color: var(--text);
}

.btn-theme-toggle:hover {
  background: var(--bg3);
  border-color: var(--primary);
  transform: scale(1.05);
}

/* ===========================
   MAIN / PAGES
   =========================== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(76px + env(safe-area-inset-top, 0px)) 20px 32px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Page Header ----- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.5px;
}

.page-sub {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ----- Period Switcher ----- */
.period-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
}

.period-label {
  font-weight: 700;
  font-size: 1rem;
  min-width: 76px;
  text-align: center;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--bg3);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 700;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--primary);
  color: #fff;
}

/* ===========================
   CARDS
   =========================== */
.cards-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  margin-bottom: 20px;
}

@media (min-width: 769px) {
  .cards-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
  }
}

.card {
  background: var(--bg2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  position: relative;
  overflow: hidden;
  min-width: 0 !important;
  box-sizing: border-box;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.15);
}

.card--primary::before {
  background: linear-gradient(90deg, var(--primary), #a78bfa);
}

.card--electric::before {
  background: var(--electric);
}

.card--water::before {
  background: var(--water);
}

.card--status::before {
  background: var(--green);
}

.card--danger::before {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

.card-label {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-value {
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   SECTION HEADER
   =========================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
}

/* ===========================
   ROOM STATUS LIST
   =========================== */
.room-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.room-status-item {
  background: var(--bg2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color var(--transition), transform var(--transition);
}

.room-status-item:hover {
  border-color: var(--primary);
}

.room-status-name {
  font-weight: 700;
  font-size: .95rem;
}

.room-status-total {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary);
}

.room-status-detail {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge--ok {
  background: rgba(16, 185, 129, .15);
  color: var(--green);
}

.badge--empty {
  background: rgba(136, 146, 164, .1);
  color: var(--text-muted);
}

.badge--paid {
  background: rgba(108, 99, 255, .15);
  color: var(--primary);
}

/* ===========================
   SETTINGS
   =========================== */
.settings-card {
  background: var(--bg2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: block;
  width: 100%;
  font-size: .85rem;
  color: var(--text-muted);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.settings-card:hover {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.08);
}

.settings-card-header {
  margin-bottom: 12px;
}

.settings-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.settings-card-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
  line-height: 1.4;
}

.settings-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-input {
  width: 130px;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
}

.inline-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===========================
   ROOMS LIST
   =========================== */
.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-card {
  background: var(--bg2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.room-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12);
}

.room-card-info {
  flex: 1;
}

.room-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 8px;
}

.room-card-name {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.room-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .84rem;
  color: var(--text-muted);
}

.room-detail-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .82rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition);
}

.room-detail-chip:hover {
  border-color: rgba(168, 85, 247, 0.4);
}

.chip-icon {
  font-size: 15px !important;
  vertical-align: middle;
  margin-right: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chip-icon--rent, .chip-icon--purple { color: #a78bfa !important; }
.chip-icon--deposit, .chip-icon--emerald { color: #34d399 !important; }
.chip-icon--elec, .chip-icon--amber { color: #fbbf24 !important; }
.chip-icon--water, .chip-icon--sky { color: #38bdf8 !important; }
.chip-icon--people, .chip-icon--indigo { color: #818cf8 !important; }
.chip-icon--trash, .chip-icon--slate { color: #94a3b8 !important; }
.chip-icon--wifi { color: #c084fc !important; }
.chip-icon--manage, .chip-icon--pink { color: #f472b6 !important; }
.chip-icon--rose, .chip-icon--red { color: #f43f5e !important; }
.chip-icon--notes { color: #94a3b8 !important; }

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.status-dot--occupied {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.status-dot--vacant {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.btn-icon-svg {
  font-size: 16px !important;
  vertical-align: middle;
  margin-right: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-squircle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-light, rgba(124, 58, 237, 0.12));
  color: var(--primary);
  border: 1px solid rgba(124, 58, 237, 0.25);
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
  padding: 0;
  box-sizing: border-box;
}

.icon-squircle .material-symbols-outlined {
  margin: 0 !important;
  padding: 0 !important;
  font-size: inherit !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.icon-squircle--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 16px !important;
}

.icon-squircle--md {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 18px !important;
}

.icon-squircle--lg {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px !important;
}

.modal-title .material-symbols-outlined:not(.icon-squircle *) {
  font-size: 20px;
  vertical-align: middle;
  margin-right: 6px;
}

.empty-icon .material-symbols-outlined {
  font-size: 3.2rem;
  color: var(--primary);
  opacity: 0.85;
}

.room-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ===========================
   BILLING TABLE
   =========================== */
.billing-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.billing-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg2);
}

.billing-table th {
  padding: 12px 12px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.billing-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
  vertical-align: middle;
}

.billing-table th:first-child,
.billing-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg2);
  border-right: 1px solid var(--border);
}

.billing-table th:first-child {
  z-index: 11;
  background: var(--bg3);
}

/* Billing Table Property Separator Header Row */
.billing-property-header-row td {
  background: var(--bg3) !important;
  padding: 10px 14px !important;
  border-top: 2px solid var(--primary-light) !important;
  border-bottom: 1px solid var(--border) !important;
  position: sticky;
  left: 0;
  z-index: 9;
}

.billing-property-header-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.billing-property-header-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--primary);
  letter-spacing: 0.3px;
}

.billing-property-header-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.billing-table tr:last-child td {
  border-bottom: none;
}

.billing-table tr:hover td {
  background: var(--bg3);
}

.billing-table input[type="number"] {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  transition: border-color var(--transition);
  min-width: 84px;
}

.billing-table input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}

.kwh-cell {
  font-weight: 700;
  color: var(--electric);
}

.total-cell {
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
}

/* Wifi toggle in billing */
.wifi-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: .82rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: 20px;
  transition: .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--wifi);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(16px);
}

.billing-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 4px;
  font-size: .85rem;
  color: var(--text-muted);
}

.billing-legend strong {
  color: var(--text);
}

/* ===========================
   REPORT CARDS
   =========================== */
.report-summary-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.report-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
  box-sizing: border-box;
}

.report-summary-val {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
}

.report-deduction-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.report-deduction-header {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.deduction-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.deduction-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.deduction-delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0 0 2px;
  line-height: 1;
}

.btn-add-deduction-chip {
  background: transparent;
  border: 1px dashed var(--primary);
  color: var(--primary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-add-deduction-chip:hover {
  background: rgba(37, 99, 235, 0.1);
}

.deduction-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}

.deduction-prop-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
}

.deduction-prop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.deduction-prop-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.deduction-prop-total {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--danger);
  white-space: nowrap;
  margin-left: auto;
}

.deduction-prop-items {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.report-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bill-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.bill-card:hover {
  border-color: var(--primary);
}

.bill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.bill-room-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.bill-total-big {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
}

.bill-body {
  padding: 14px 18px;
}

.bill-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}

.bill-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: .9rem;
  gap: 8px;
}

.bill-row-label {
  color: var(--text-muted);
}

.bill-row-formula {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.bill-row-val {
  font-weight: 600;
  white-space: nowrap;
}

.bill-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.bill-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ===========================
   HISTORY
   =========================== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.property-history-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.property-history-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(124, 58, 237, 0.1) 100%);
  border-bottom: 1px solid var(--border);
}

.property-history-block-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.property-history-block-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.property-history-block-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-month-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.history-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.history-month-header:hover {
  background: var(--bg3);
}

.history-month-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.history-month-meta {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-month-total {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.05rem;
}

.history-month-body {
  padding: 12px 18px;
  display: none;
}

.history-month-body.open {
  display: block;
}

.history-room-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 49, 72, .4);
  font-size: .9rem;
}

.history-room-row:last-child {
  border-bottom: none;
}

.history-room-name {
  font-weight: 600;
}

.history-room-total {
  font-weight: 700;
  color: var(--green);
}

.history-badges {
  display: flex;
  gap: 6px;
}

.history-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  justify-content: flex-end;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-d);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn--danger {
  background: rgba(239, 68, 68, .12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .3);
}

.btn--danger:hover {
  background: var(--red);
  color: #fff;
}

.btn--sm {
  padding: 6px 12px;
  font-size: .82rem;
}

.btn--paid {
  background: rgba(16, 185, 129, .12);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .3);
}

.btn--paid.is-paid {
  background: var(--green);
  color: #fff;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
}

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
  overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  background: var(--bg2, #1e293b);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  min-height: 420px;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: auto;
  flex-shrink: 0;
}

#confirm-modal {
  z-index: 99999 !important;
}

#confirm-modal .modal,
#edit-old-modal .modal,
#donate-modal .modal {
  min-height: 160px !important;
  max-height: 80% !important;
}

#whats-new-modal .modal {
  max-width: 580px;
  min-height: 280px !important;
  max-height: 92% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden;
}

#whats-new-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#whats-new-modal .modal-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--bg2, #1e293b);
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}

/* Mobile Responsive Overlay Padding & Heights (Pure px & % - 100% vh/dvh-free) */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 12px 12px calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    align-items: center !important;
  }

  .modal {
    min-height: 400px !important;
    max-height: 85% !important;
    margin: auto !important;
  }

  #confirm-modal .modal,
  #edit-old-modal .modal,
  #donate-modal .modal {
    min-height: 160px !important;
    max-height: 80% !important;
    margin: auto !important;
  }

  #whats-new-modal .modal {
    max-height: 92% !important;
    min-height: 280px !important;
    margin: auto !important;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg3);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--red);
  color: #fff;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
  padding: 16px 20px;
}

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
}

.help-section {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--bg3);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.help-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--primary-light);
}

.help-section p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row--3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-input {
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
  flex-shrink: 0;
}

/* ===========================
   EMPTY STATE
   =========================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

/* ===========================
   TOAST
   =========================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 100000;
  animation: fadeIn .2s ease;
  white-space: nowrap;
}

.toast[hidden] {
  display: none !important;
}

.toast--success {
  border-color: var(--green);
  color: var(--green);
}

.toast--error {
  border-color: var(--red);
  color: var(--red);
}

.toast--info {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===========================
   PRINT AREA (hidden on screen)
   =========================== */
.print-area {
  display: none;
}

/* ===========================
   RESPONSIVE
   =========================== */
/* Bottom nav: hidden on desktop */
.bottom-nav {
  display: none;
}

#btn-open-auth-modal {
  white-space: nowrap !important;
  flex-shrink: 0;
}

#auth-btn-label {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 960px) {
  #auth-btn-label {
    display: none !important;
  }

  #btn-open-auth-modal {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  /* Ẩn tabs trên desktop-nav khi ở mobile, foldable & tablet */
  .nav-tabs--desktop {
    display: none !important;
  }

  /* Mở bottom nav */
  .bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff !important;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    z-index: 200;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
  }

  [data-theme="dark"] .bottom-nav {
    background: #111322 !important;
  }

  /* Tab styles trong bottom nav */
  .bottom-nav .nav-tab {
    height: 100%;
    border-radius: 0;
    padding: 4px 2px;
    justify-content: center;
    background: none !important;
  }

  .bottom-nav .nav-tab .tab-label {
    display: block !important;
    font-size: 0.58rem;
    margin-top: 2px;
    line-height: 1.2;
  }

  /* Đẩy nội dung lên để không bị bottom-nav che */
  .main {
    padding: calc(72px + env(safe-area-inset-top, 0px)) 16px calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* Force bottom nav by JS overflow detection if needed on any custom screen */
body.force-bottom-nav .nav-tabs--desktop {
  display: none !important;
}

body.force-bottom-nav .bottom-nav {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #ffffff !important;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
  z-index: 200;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
}

[data-theme="dark"] body.force-bottom-nav .bottom-nav {
  background: #111322 !important;
}

body.force-bottom-nav .main {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 640px) {
  /* iOS WebKit auto-zoom prevention: inputs must be >= 16px on mobile */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .form-row--2col,
  .form-row--3col {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
  }

  .period-switcher {
    align-self: flex-start;
  }
}

/* ===========================
   @MEDIA PRINT
   =========================== */
@media print {

  /* Hide everything */
  body>* {
    display: none !important;
  }

  /* Show only print area */
  .print-area {
    display: block !important;
    font-family: 'Inter', sans-serif;
    color: #111;
    background: #fff;
    padding: 0;
  }

  .print-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ddd;
  }

  .print-header h1 {
    font-size: 20pt;
    margin-bottom: 4px;
  }

  .print-header p {
    font-size: 11pt;
    color: #555;
  }

  .print-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
  }

  .print-summary-item {
    flex: 1;
    min-width: 120px;
  }

  .print-summary-label {
    font-size: 8pt;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .5px;
  }

  .print-summary-val {
    font-size: 13pt;
    font-weight: 700;
  }

  .print-bill {
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-bill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    font-weight: 700;
  }

  .print-bill-header .room {
    font-size: 11pt;
  }

  .print-bill-header .total {
    font-size: 12pt;
    color: #4c46d6;
  }

  .print-bill-body {
    padding: 0;
  }

  .print-bill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }

  .print-bill-table td {
    padding: 6px 14px;
    border-bottom: 1px solid #eee;
  }

  .print-bill-table tr:last-child td {
    border-bottom: none;
  }

  .print-bill-table .label {
    color: #555;
  }

  .print-bill-table .formula {
    color: #888;
    font-size: 8pt;
  }

  .print-bill-table .amount {
    text-align: right;
    font-weight: 600;
  }

  .print-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 9pt;
    color: #888;
    padding-top: 12px;
    border-top: 1px solid #ddd;
  }

  @page {
    size: A4;
    margin: 16mm 14mm;
  }
}

/* ===========================
   OCR CAMERA MODULE
   =========================== */

/* Wrapper input + camera button trong billing table */
.ocr-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Nút camera nhỏ bên cạnh input số điện / nước */
.btn-ocr {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
}

.btn-ocr[data-target="elec"] {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.btn-ocr[data-target="elec"]:hover {
  background: #fbbf24;
  color: #1e1b4b;
  border-color: #fbbf24;
  transform: scale(1.1);
}

.btn-ocr[data-target="water"] {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}

.btn-ocr[data-target="water"]:hover {
  background: #38bdf8;
  color: #0c0d18;
  border-color: #38bdf8;
  transform: scale(1.1);
}

.btn-ocr:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

.btn-ocr:active {
  transform: scale(0.95);
}

/* Modal OCR: wider để chứa camera */
.ocr-modal-inner {
  max-width: 560px;
  width: calc(100% - 32px);
}

/* Video wrapper với guide box overlay */
.ocr-video-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16/9;
  margin-top: 6px;
  margin-bottom: 12px;
}

.ocr-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: move;
}

/* Khung ngắm màu đỏ ở giữa video/canvas */
.ocr-guide-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 15.3%;
  border: 2.5px solid #ff3b3b;
  border-radius: 6px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.ocr-guide-box::before,
.ocr-guide-box::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: #ff3b3b;
  border-style: solid;
}

.ocr-guide-box::before {
  top: -3px;
  left: -3px;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}

.ocr-guide-box::after {
  bottom: -3px;
  right: -3px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 0;
}

.ocr-guide-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* Controls row (Zoom & Invert) */
.ocr-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ocr-zoom-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.ocr-zoom-slider {
  flex: 1;
  cursor: pointer;
}

/* Cropped Image preview styles */
.ocr-crop-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  background: var(--bg3);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.ocr-crop-preview-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.ocr-crop-canvas {
  height: 35px;
  width: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  display: block;
}

/* Hàng kết quả OCR */
.ocr-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.ocr-result-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.ocr-result-input {
  width: 130px;
  padding: 6px 10px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-align: center;
}

.ocr-result-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Status text */
.ocr-status {
  min-height: 1.4em;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Action buttons row */
.ocr-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Green success button variant */
.btn--success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn--success:hover {
  filter: brightness(1.1);
}

.btn--success:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

/* ============================================================
   TENANTS MANAGEMENT & CCCD QR SCANNER (CR3)
   ============================================================ */
.tenants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.tenant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 12px;
  transition: border-color var(--transition);
}

.tenant-item:hover {
  border-color: var(--primary);
}

.tenant-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.tenant-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tenant-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

#tenant-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

#cccd-qr-reader {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
}

#cccd-qr-reader video {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
}

/* Edit Old Meter Reading Button & Monthly Bill Note */
.btn-edit-old {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--text-muted, #64748b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.btn-edit-old:hover {
  opacity: 1;
  color: var(--primary, #4f46e5);
  background: rgba(127, 127, 127, 0.15);
}

.btn-edit-old .material-symbols-outlined {
  color: inherit;
  font-size: 14px;
}

[data-theme="dark"] .btn-edit-old {
  color: var(--text-muted, #9ba3b8);
}

[data-theme="dark"] .btn-edit-old:hover {
  color: var(--primary, #a855f7);
  background: rgba(168, 85, 247, 0.2);
}

.bill-note-input {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  width: 110px;
  transition: border-color 0.2s;
}

.bill-note-input:focus {
  outline: none;
  border-color: var(--primary);
}

.report-bill-note {
  font-size: 0.82rem;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Responsive Navigation Bar for Mobile vs Desktop */
@media (max-width: 640px) {
  .nav-tabs--desktop {
    display: none !important;
  }

  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: #ffffff !important;
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
  }

  [data-theme="dark"] .bottom-nav {
    background: #111322 !important;
  }

  .bottom-nav .nav-tab {
    flex: 1;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 2px;
  }

  .bottom-nav .tab-icon {
    font-size: 1.15rem;
  }
}

@media (min-width: 641px) {
  .bottom-nav {
    display: none !important;
  }

  .nav-tabs--desktop {
    display: flex !important;
    gap: 4px;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
      max-width: 100%;
  }

  .nav-tabs--desktop::-webkit-scrollbar {
    display: none;
  }
}

/* Tablet Mini / Foldable / Medium Screen (641px to 959px): Icon-on-top, Text-below vertical stack */
@media (min-width: 641px) and (max-width: 959px) {
  .nav-inner {
    padding: 0 10px !important;
    gap: 6px !important;
    height: 56px !important;
  }

  .nav-brand {
    gap: 4px !important;
  }

  .brand-name {
    font-size: 0.98rem !important;
  }

  .property-select {
    max-width: 115px !important;
    font-size: 0.75rem !important;
    padding: 3px 6px !important;
  }

  .nav-tabs--desktop .nav-tab {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1px !important;
    padding: 3px 6px !important;
    font-size: 0.68rem !important;
    line-height: 1.1 !important;
    flex-shrink: 0;
  }

  .nav-tabs--desktop .nav-tab .tab-icon {
    font-size: 1.05rem !important;
  }
}

/* Large Desktop (960px+): Icon & Text side-by-side */
@media (min-width: 960px) {
  .nav-tabs--desktop .nav-tab {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 6px 10px !important;
    font-size: 0.83rem !important;
    flex-shrink: 0;
  }

  .nav-tabs--desktop .nav-tab .tab-icon {
    font-size: 0.95rem !important;
  }
}

/* Ultra-Narrow Mobile Screen (width <= 380px) */
@media (max-width: 380px) {
  html {
    font-size: 14.5px;
  }

  .bottom-nav .nav-tab {
    font-size: 0.65rem;
    padding: 2px 1px;
  }

  .bottom-nav .tab-icon {
    font-size: 1rem;
  }
}

/* Room Card Responsive Layout (<768px): Full-width chips and clean vertical stacking */
@media (max-width: 768px) {
  .room-card {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
    gap: 10px;
  }

  .room-card-info {
    width: 100%;
  }

  .room-card-details {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .room-card-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }
}

/* ===========================
   PROPERTY SWITCHER & BADGES
   =========================== */
.property-switcher-wrap {
  display: flex;
  align-items: center;
  margin-left: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0 4px 0 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.property-switcher-wrap:hover,
.property-switcher-wrap:focus-within {
  border-color: var(--primary);
}

.property-switcher-icon {
  font-size: 16px !important;
  color: var(--text-muted);
  flex-shrink: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.property-select {
  background: transparent;
  color: var(--text);
  border: none;
  padding: 5px 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 170px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-select:hover,
.property-select:focus {
  outline: none;
}

.room-property-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  margin-bottom: 6px;
}

.property-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.property-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.property-item-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===========================
   IN-APP GUIDE & TUTORIAL
   =========================== */
.help-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.help-section h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-section p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* ===========================
   PROPERTY COMPARISON CARD (QoL 2)
   =========================== */
.prop-comp-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.prop-comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.prop-comp-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.prop-comp-amount {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
}

.prop-comp-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.prop-comp-progress-bg {
  width: 100%;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.prop-comp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* MoMo Button & PayOS Modal Custom Styles */
.btn--momo {
  background: #a50064 !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600;
  transition: background 0.18s ease, transform 0.1s ease;
}

.btn--momo:hover {
  background: #8e0055 !important;
  transform: translateY(-1px);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===========================
   AUTH SPLIT-PANEL MODAL (Landing Page Dark Glassmorphism Chrome)
   =========================== */
.auth-modal-card {
  max-width: 840px !important;
  padding: 0 !important;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(124, 58, 237, 0.15) !important;
  border-radius: 20px !important;
  background: #0f172a !important;
}

.auth-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.auth-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.auth-close-btn:hover {
  color: #f8fafc;
  background: rgba(124, 58, 237, 0.3);
  border-color: rgba(124, 58, 237, 0.5);
  transform: rotate(90deg);
}

.auth-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 500px;
}

/* Left Panel: Purple -> Teal Gradient Glass */
.auth-left-panel {
  background: linear-gradient(135deg, #090d16 0%, #1e1b4b 50%, #2e1065 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.auth-left-panel::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.auth-left-panel::before {
  content: '';
  position: absolute;
  top: -50px;
  left: -50px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.35);
  filter: blur(50px);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 28px;
}

.auth-brand-name {
  background: linear-gradient(135deg, #ffffff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #ffffff 0%, #ddd6fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.auth-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.check-icon {
  background: rgba(124, 58, 237, 0.25);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.35);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
}

/* Right Panel: Form Styling */
.auth-right-panel {
  padding: 40px 36px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-header {
  margin-bottom: 24px;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Form inputs & labels */
.auth-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.auth-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
  background: rgba(30, 41, 59, 1);
}

#btn-toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

#btn-toggle-password:hover {
  opacity: 1;
}

/* Auth Buttons */
.auth-btn-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  border-radius: 10px !important;
  padding: 12px !important;
  width: 100% !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4) !important;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
  transition: all 0.2s ease !important;
}

.auth-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6) !important;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: #64748b;
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-divider span {
  padding: 0 12px;
}

.auth-btn-google {
  background: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  padding: 11px !important;
  width: 100% !important;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease !important;
}

.auth-btn-google:hover {
  background: rgba(51, 65, 85, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.auth-footer-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}

.auth-footer-switch a {
  color: #c084fc;
  font-weight: 700;
  text-decoration: none;
  margin-left: 6px;
}

.auth-footer-switch a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .auth-split-container {
    grid-template-columns: 1fr;
  }

  .auth-left-panel {
    display: none;
  }

  .auth-right-panel {
    padding: 30px 24px;
  }

  .auth-modal-card {
    max-width: 420px !important;
  }
}

/* Mobile Topbar Auth Icon Optimization */
@media (max-width: 640px) {
  #btn-open-auth-modal #auth-btn-label {
    display: none !important;
  }

  #btn-open-auth-modal {
    padding: 6px 8px !important;
    font-size: 0.95rem !important;
    min-width: 34px !important;
    height: 34px !important;
    justify-content: center !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
  }
}

/* Room Status Badge Alignment Fix */
.room-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1.3;
  vertical-align: middle;
}

.room-status-badge.status-occupied {
  color: var(--green);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.room-status-badge.status-vacant {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ============================================================
   NARROW SCREEN & FOLDABLE PHONE COMPATIBILITY FIXES (< 380px)
   ============================================================ */
@media (max-width: 380px) {

  /* Topbar Header Adjustments */
  .nav-brand {
    font-size: 0.9rem !important;
    gap: 4px !important;
  }

  .property-switcher-wrap {
    padding: 0 2px 0 5px !important;
    margin-left: 4px !important;
  }

  .property-switcher-icon {
    font-size: 13px !important;
  }

  #property-switcher,
  .property-select {
    max-width: 115px !important;
    font-size: 0.72rem !important;
    padding: 3px 4px !important;
  }

  /* Property Block Header Layout */
  .property-history-block-header {
    padding: 10px 12px !important;
  }

  .property-history-block-title {
    font-size: 0.95rem !important;
  }

  .property-history-block-sub {
    font-size: 0.75rem !important;
  }

  /* Page Header Action Buttons Grid */
  .page-header-actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .page-header-actions .btn {
    flex: 1 1 calc(50% - 4px) !important;
    font-size: 0.75rem !important;
    padding: 6px 6px !important;
    justify-content: center !important;
  }

  /* Report Card Footer Action Buttons (2x2 Grid) */
  .bill-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .bill-footer .btn {
    width: 100% !important;
    padding: 6px 4px !important;
    font-size: 0.75rem !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Report Card Inputs (Chiết khấu & Đã trả) */
  .report-card-input-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .report-card-input-row label {
    font-size: 0.76rem !important;
    white-space: nowrap !important;
  }

  .report-card-input-row input {
    width: 95px !important;
    padding: 3px 6px !important;
    font-size: 0.78rem !important;
  }

  /* Room Card Header on Narrow Screens */
  .room-card-header {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .room-card-actions {
    width: 100% !important;
    justify-content: flex-start !important;
    gap: 4px !important;
  }

  .room-card-actions .btn {
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
  }

  /* Deductions Breakdown Card Padding */
  .deduction-prop-card {
    padding: 8px 10px !important;
  }

  .deduction-prop-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
  }

  /* Main Container Padding on Foldable screens */
  .main {
    padding: 64px 8px 80px !important;
  }

  /* Billing Card Narrow & Foldable Fixes (<380px) */
  .billing-cards-wrap {
    gap: 10px !important;
  }

  .billing-card {
    padding: 10px 10px !important;
  }

  .billing-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
  }

  .billing-card-total-box {
    text-align: left !important;
    width: 100% !important;
  }

  .billing-card-total-breakdown {
    font-size: 0.68rem !important;
  }

  .billing-card-label {
    font-size: 0.72rem !important;
  }

  .ocr-input-wrap {
    gap: 4px !important;
  }

  .btn-ocr {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.8rem !important;
  }
}

/* ============================================================
   SPRINT V2.4 NEW FEATURES & UI COMPONENT STYLES
   ============================================================ */

/* 1. Pull-to-Refresh Indicator (Chỉ hiển thị khi đang swipe down) */
.ptr-indicator {
  display: none !important;
}

.ptr-indicator[hidden] {
  display: none !important;
}

.ptr-indicator.active {
  display: flex !important;
  position: fixed;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  align-items: center;
  gap: 6px;
  z-index: 9999;
  animation: fadeIn 0.15s ease;
}

.ptr-spinning {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* 2. View Mode Toggle (📊 Bảng / 📇 Thẻ) */
.view-toggle-wrap {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle-btn.active {
  background: var(--bg2);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 3. Billing Entry Filter Tabs & Progress Bar */
.billing-filter-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.billing-filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.billing-filter-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.billing-filter-tab.active {
  background: var(--primary);
  color: #fff;
}

.billing-progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 180px;
  justify-content: flex-end;
}

.billing-progress-bar-wrap {
  width: 100px;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.billing-progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.billing-progress-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 4. Card View Layout (Mobile Billing Card View) */
/* 4. Card View Layout (Mobile Billing Card View) */
.billing-cards-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.billing-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
}

.billing-card.entered {
  border-left: 4px solid var(--green);
}

.billing-card.pending {
  border-left: 4px solid var(--amber);
}

.billing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.billing-card-room {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.billing-card-total-box {
  text-align: right;
  min-width: 0;
  max-width: 100%;
}

.billing-card-total {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.billing-card-total-breakdown {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-top: 2px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.billing-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.billing-card-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0 !important;
  width: 100%;
  box-sizing: border-box;
}

.billing-card-input-group .ocr-input-wrap {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
}

.billing-card-input-group .ocr-input-wrap input,
.billing-card-input-group .ocr-input-wrap .form-input {
  min-width: 0 !important;
  flex: 1 1 0% !important;
  width: 100%;
  box-sizing: border-box;
}

.billing-card-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.billing-card-calc-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  word-break: break-word;
}

.billing-card-services-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg3);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
  box-sizing: border-box;
  width: 100%;
}

.billing-card-row-full {
  grid-column: span 2;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

@media (max-width: 768px) {
  .billing-card {
    padding: 12px 12px;
  }

  .billing-card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .billing-card-row-full {
    grid-column: span 1;
  }

  .billing-card-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

/* 5. Actionable Alert Banners */
.dashboard-alert-banners {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.dashboard-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.dashboard-alert-item:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.dashboard-alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.dashboard-alert-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

/* 6. Debt Ranking Board */
.debt-ranking-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.debt-ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.debt-ranking-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.debt-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.debt-ranking-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.debt-ranking-item:hover {
  border-color: var(--red);
}

.debt-rank-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
}

.debt-rank-1 {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red);
}

.debt-rank-2 {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber);
}

.debt-rank-3 {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
}

/* 7. Collection Rate KPI Card */
.collection-rate-display {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.collection-rate-good {
  color: var(--green);
}

.collection-rate-warn {
  color: var(--amber);
}

.collection-rate-danger {
  color: var(--red);
}

/* 8. CH Play CTA Floating Pill */
.app-download-banner {
  position: fixed;
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 961px) {
  .app-download-banner {
    bottom: 24px;
    right: 24px;
  }
}

@media (max-width: 960px) {
  .app-download-banner {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 14px;
  }
}

body.force-bottom-nav .app-download-banner {
  bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
}

.app-download-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  color: #ffffff !important;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
  border: 1px solid rgba(167, 139, 250, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.app-download-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(124, 58, 237, 0.65);
  background: linear-gradient(135deg, #8b5cf6 0%, #5b21b6 100%);
  color: #ffffff !important;
}

.app-download-cta-btn .play-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.app-download-close-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #94a3b8;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.app-download-close-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: scale(1.1);
}

/* Quick Language Toggle Button on Topbar (ala Landing Page) */
.btn-top-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 9px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  transition: all 0.2s ease;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

[data-theme="dark"] .btn-top-lang-toggle {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(167, 139, 250, 0.35);
  color: #c4b5fd;
}

[data-theme="light"] .btn-top-lang-toggle {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.25);
  color: #6d28d9;
}

.btn-top-lang-toggle:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-top-lang-toggle .lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-top-lang-toggle .lang-flag svg {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  display: block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-top-lang-toggle .lang-label {
  display: inline-block;
  line-height: 1;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-top-lang-toggle .lang-chevron {
  font-size: 0.65rem;
  opacity: 0.75;
  margin-left: 1px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.btn-top-lang-toggle[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

/* Topbar Language Dropdown Menu */
.top-lang-dropdown-wrapper {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  overflow: visible !important;
}

.top-lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 165px;
  max-height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 4px;
  z-index: 10000;
  animation: topLangFadeIn 0.15s ease-out;
  touch-action: pan-y;
}

@keyframes topLangFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .top-lang-menu {
  background: #1e1b2e;
  border-color: rgba(167, 139, 250, 0.3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.top-lang-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text, #0f172a);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.top-lang-item * {
  pointer-events: none;
}

[data-theme="dark"] .top-lang-item {
  color: var(--text, #ffffff);
}

.top-lang-item:hover {
  background: rgba(124, 58, 237, 0.12);
  color: var(--primary);
}

.top-lang-item.active {
  background: rgba(124, 58, 237, 0.2);
  color: var(--primary);
  font-weight: 700;
}

.top-lang-item-flag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.top-lang-item-flag svg {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  display: block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.top-lang-item-name {
  flex: 1;
  white-space: nowrap;
}

.top-lang-item-check {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 800;
}

/* Scrollbar styles for Language Dropdowns */
.top-lang-menu::-webkit-scrollbar,
.custom-lang-menu::-webkit-scrollbar {
  width: 5px;
}
.top-lang-menu::-webkit-scrollbar-track,
.custom-lang-menu::-webkit-scrollbar-track {
  background: transparent;
}
.top-lang-menu::-webkit-scrollbar-thumb,
.custom-lang-menu::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.top-lang-menu::-webkit-scrollbar-thumb:hover,
.custom-lang-menu::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Regional Cluster Divider */
.lang-menu-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--border);
  opacity: 0.65;
}

#card-settings-lang-currency {
  position: relative;
  z-index: 30;
}

#card-settings-payment {
  position: relative;
  z-index: 20;
}

.custom-lang-select-wrap,
.custom-lang-select-wrapper {
  position: relative;
  display: inline-block;
  min-width: 220px;
  z-index: 40;
}

.custom-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 220px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.custom-lang-btn * {
  pointer-events: none;
}

.custom-lang-btn:hover {
  border-color: var(--primary);
  background: var(--bg3);
}

[data-theme="dark"] .custom-lang-btn:hover {
  background: rgba(124, 58, 237, 0.15);
}

.custom-lang-flag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.custom-lang-flag svg,
.custom-lang-item-flag svg,
.lang-item-flag svg {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.custom-lang-name,
.custom-lang-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-lang-chevron {
  font-size: 20px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  margin-left: auto;
}

.custom-lang-select-wrap.open .custom-lang-chevron,
.custom-lang-select-wrapper.open .custom-lang-chevron {
  transform: rotate(180deg);
}

.custom-lang-dropdown,
.custom-lang-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  max-width: min(360px, 92vw);
  max-height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: var(--bg2, #ffffff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  padding: 6px;
  z-index: 10000;
  animation: topLangFadeIn 0.15s ease-out;
}

[data-theme="dark"] .custom-lang-dropdown,
[data-theme="dark"] .custom-lang-menu {
  background: #1e1b2e;
  border-color: rgba(167, 139, 250, 0.3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.custom-lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}

.custom-lang-item * {
  pointer-events: none;
}

.custom-lang-item:hover {
  background: rgba(124, 58, 237, 0.08);
  color: var(--primary);
}

.custom-lang-item.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--primary);
  font-weight: 700;
}

[data-theme="dark"] .custom-lang-item:hover {
  background: rgba(124, 58, 237, 0.15);
}

[data-theme="dark"] .custom-lang-item.active {
  background: rgba(124, 58, 237, 0.25);
  color: #c4b5fd;
}

.custom-lang-item-flag,
.lang-item-flag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.custom-lang-item-name,
.lang-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-lang-item-check,
.lang-item-check {
  color: var(--primary);
  font-weight: bold;
  font-size: 0.9rem;
  margin-left: 6px;
}

[data-theme="dark"] .custom-lang-item-check,
[data-theme="dark"] .lang-item-check {
  color: #c4b5fd;
}

.custom-lang-item .lang-item-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.lang-menu-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 10px 2px;
  -webkit-user-select: none;
  user-select: none;
}

.lang-item-badge {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-left: auto;
}

/* Compact Top Header Download App Button (Desktop & Mobile) */
.btn-top-download-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #ffffff !important;
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-top-download-app:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #8b5cf6 0%, #5b21b6 100%);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.55);
  color: #ffffff !important;
}

.btn-top-download-app .play-icon {
  flex-shrink: 0;
}

/* Responsive Topbar for Narrow Screens (<640px and <380px Foldable) */
@media (max-width: 640px) {
  .nav {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
    overflow: visible !important;
  }
  .nav-inner {
    padding: 0 8px !important;
    gap: 4px !important;
    overflow: visible !important;
  }
  .nav-nav-wrap {
    overflow: visible !important;
  }
  .nav-brand {
    gap: 4px !important;
    font-size: 0.95rem !important;
  }
  .nav-brand .brand-name {
    font-size: 0.98rem !important;
  }
  .nav-brand .brand-icon {
    font-size: 1.15rem !important;
  }
  #property-switcher {
    max-width: 95px !important;
    font-size: 0.72rem !important;
    padding: 3px 4px !important;
    border-radius: 8px !important;
  }
  .nav-nav-wrap {
    gap: 4px !important;
  }
  .btn-top-lang-toggle {
    height: 29px !important;
    padding: 0 6px !important;
    font-size: 0.75rem !important;
    gap: 3px !important;
    border-radius: 8px !important;
  }
  .btn-top-lang-toggle .lang-flag svg {
    width: 15px !important;
    height: 10px !important;
  }
  .btn-theme-toggle {
    width: 29px !important;
    height: 29px !important;
    min-width: 29px !important;
    padding: 0 !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .btn-top-download-app {
    width: 29px !important;
    height: 29px !important;
    min-width: 29px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .btn-top-download-app .play-icon {
    width: 14px !important;
    height: 14px !important;
  }
  #btn-open-auth-modal {
    width: 29px !important;
    height: 29px !important;
    min-width: 29px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  #btn-open-auth-modal #auth-btn-label {
    display: none !important;
  }
  #btn-open-auth-modal #auth-btn-icon {
    margin: 0 !important;
    font-size: 0.85rem !important;
  }
}

/* Feature #15 Narrow Screen Fix for Galaxy S20 Ultra & Z Fold (<412px) */
@media (max-width: 412px) {
  .room-card-details {
    font-size: clamp(0.75rem, 3.2vw, 0.84rem) !important;
  }
  .billing-card-grid {
    grid-template-columns: 1fr !important;
  }
  .billing-card-row-full {
    grid-column: span 1 !important;
  }
}

/* Premium IAP Card in Settings */
@media (max-width: 480px) {
  .premium-actions-wrap {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .premium-actions-wrap .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.76rem;
    padding: 6px 4px;
  }
}

/* Meter Override / Auto Badges */
.badge-edited {
  font-size: 0.65rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  display: inline-block;
  line-height: 1.3;
  letter-spacing: 0.2px;
  vertical-align: middle;
}

[data-theme="light"] .badge-edited,
:root:not([data-theme="dark"]) .badge-edited {
  color: #d97706;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.3);
}

.badge-auto {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.85;
  display: inline-block;
  line-height: 1.3;
  vertical-align: middle;
}

/* ============================================================
   NATIVE ANDROID / IOS STRICT SUPPRESSION
   ============================================================ */
body.is-native-app .btn-top-download-app,
html.is-native-app .btn-top-download-app,
body.is-native-app #btn-top-download-app,
html.is-native-app #btn-top-download-app,
body.is-native-app .app-download-banner,
html.is-native-app .app-download-banner,
body.is-native-app #app-download-banner,
html.is-native-app #app-download-banner,
body.is-native-app .adsense-skyscraper,
html.is-native-app .adsense-skyscraper,
body.is-app-mode .btn-top-download-app,
html.is-app-mode .btn-top-download-app,
body.is-app-mode #btn-top-download-app,
html.is-app-mode #btn-top-download-app,
body.is-app-mode .app-download-banner,
html.is-app-mode .app-download-banner,
body.is-app-mode #app-download-banner,
html.is-app-mode #app-download-banner,
body.is-app-mode .adsense-skyscraper,
html.is-app-mode .adsense-skyscraper {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.is-native-app .nav,
html.is-native-app .nav,
body.is-app-mode .nav,
html.is-app-mode .nav {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
  overflow: visible !important;
}

/* ============================================================
   WEBAPP ADSENSE DESKTOP SKYSCRAPERS (Left & Right)
   ============================================================ */
.adsense-skyscraper {
  position: fixed;
  top: 75px;
  width: 120px;
  height: 600px;
  z-index: 85;
  pointer-events: auto;
}
.adsense-skyscraper--left {
  left: 10px;
}
.adsense-skyscraper--right {
  right: 10px;
}
.adsense-skyscraper-inner {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: var(--surface);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
@media (max-width: 1280px) {
  .adsense-skyscraper {
    display: none !important;
  }
}

/* ============================================================
   ENLARGED HIGH-IMPACT ADSENSE BANNER (WEBAPP)
   ============================================================ */
.adsense-banner-wrap {
  width: 100%;
  position: relative;
  z-index: 40;
  margin-bottom: 16px;
}
.adsense-remote-frame {
  width: 100%;
  border: none;
  overflow: hidden;
  display: block;
  min-height: 76px;
  border-radius: 12px;
  background: transparent;
  transition: height 0.2s ease;
}
.adsense-card-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  margin: 0;
  width: 100%;
}
.adsense-card-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.cross-promo-card-left {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 14px;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.cross-promo-card-left .cross_promo_logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.cross-promo-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.adsense-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.adsense-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2, #2a2a38);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.adsense-badge-eco {
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.adsense-promo-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.btn-adsense-upgrade {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-adsense-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.45);
}
@media (max-width: 640px) {
  .adsense-card-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  .cross-promo-card-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    width: 100%;
  }
  .cross-promo-card-left .cross_promo_logo {
    width: 38px;
    height: 38px;
  }
  .adsense-card-right {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: flex-end;
  }
  .btn-adsense-upgrade {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
  }
}

/* Native Top Banner Slider (Alternating Cross-Promo & Pro Upgrade) */
.adsense-card-banner.adsense-slider-banner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 10px 16px 8px 16px;
  overflow: hidden;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}
.adsense-slider-viewport {
  width: 100%;
  overflow: hidden;
  position: relative;
}
.adsense-slider-track {
  display: flex;
  width: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
  align-items: stretch;
}
.adsense-slide {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}
.adsense-slider-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 2px;
}
.adsense-slider-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--text-muted);
  opacity: 0.35;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  cursor: pointer;
}
.adsense-slider-dot.active {
  width: 18px;
  background: var(--primary, #7c3aed);
  opacity: 0.95;
}
.adsense-slider-dot[data-slide-to="0"].active {
  background: #ff385c;
}
.adsense-slider-dot[data-slide-to="1"].active {
  background: #ee4d2d;
}
.adsense-slider-dot[data-slide-to="2"].active {
  background: var(--primary, #7c3aed);
}

@media (max-width: 640px) {
  .adsense-card-banner.adsense-slider-banner {
    padding: 10px 12px 6px 12px;
  }
  .adsense-slide {
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    min-height: 84px;
  }
}

.premium-card-pulse {
  animation: premiumHighlightGlow 1.8s ease-in-out;
}

@keyframes premiumHighlightGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.7);
    border-color: #7c3aed;
    background-color: rgba(124, 58, 237, 0.12);
  }
  50% {
    box-shadow: 0 0 24px 6px rgba(124, 58, 237, 0.45);
    border-color: #a855f7;
    background-color: rgba(124, 58, 237, 0.2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
    border-color: var(--border);
    background-color: transparent;
  }
}

/* Gemini / AI Sparkle Blink & Glow Animation */
@keyframes aiSparklePulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 2px rgba(251, 191, 36, 0.4));
    opacity: 0.85;
    color: #fbbf24;
  }
  50% {
    transform: scale(1.22) rotate(12deg);
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 14px rgba(168, 85, 247, 0.65));
    opacity: 1;
    color: #f59e0b;
  }
}

.icon-ai-sparkle {
  display: inline-block !important;
  animation: aiSparklePulse 2s ease-in-out infinite;
  transform-origin: center;
  color: #fbbf24;
}

/* ============================================================
   DIGITAL POS MINI-RECEIPT (E-RECEIPT SLIP) STYLING (80mm)
   ============================================================ */
#receipt-preview-modal .modal,
.receipt-modal-box {
  width: 95% !important;
  max-width: 460px !important;
  height: 92% !important;
  max-height: 92% !important;
  min-height: 480px !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 14px !important;
  background: var(--bg2, #1e293b) !important;
}

.pos-receipt-modal-body {
  flex: 1 1 auto !important;
  min-height: 220px !important;
  overflow-y: auto !important;
  padding: 14px 10px !important;
  background: var(--bg-surface-subtle, #0b0c16) !important;
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;
}

.pos-receipt-preview-body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  margin: 0 auto;
  width: 100%;
}

.pos-receipt-paper {
  width: 100%;
  max-width: 360px;
  background: #ffffff;
  color: #000000;
  padding: 18px 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 12.5px;
  line-height: 1.35;
  position: relative;
  border: 1px solid #e2e8f0;
  box-sizing: border-box;
  border-radius: 8px;
}

.pos-receipt-header {
  text-align: center;
}

.pos-receipt-title {
  font-size: 14.5px;
  font-weight: 900;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin: 0;
  line-height: 1.3;
}

.pos-receipt-room-sub {
  font-size: 14px;
  font-weight: 800;
  color: #000000;
  text-transform: uppercase;
  margin-top: 2px;
}

.pos-receipt-meta {
  font-size: 11.5px;
  color: #000000;
  font-weight: 500;
  text-align: center;
}

.pos-receipt-dash {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: #000000;
  text-align: center;
  margin: 6px 0;
  overflow: hidden;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0.85;
}

.pos-receipt-qr-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0;
}

.pos-receipt-qr-info {
  flex: 1;
  font-size: 11px;
  color: #000000;
  line-height: 1.35;
}

.pos-receipt-qr-prompt {
  font-size: 11px;
  color: #000000;
  font-weight: 600;
  margin-bottom: 6px;
}

.pos-receipt-bank-details {
  font-size: 11px;
  color: #000000;
  line-height: 1.35;
}

.pos-receipt-bank-details strong {
  font-weight: 700;
}

.pos-receipt-qr-wrap {
  flex-shrink: 0;
}

.pos-receipt-qr-img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  background: #ffffff;
  display: block;
  filter: grayscale(100%) contrast(130%);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
}

.pos-receipt-items {
  margin: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pos-receipt-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 3.5px 0;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 12px;
  color: #000000;
}

.pos-receipt-item:last-child {
  border-bottom: none;
}

.pos-receipt-item-info {
  flex: 1;
  padding-right: 8px;
  text-align: left;
}

.pos-receipt-item-name {
  font-weight: 700;
  font-size: 12px;
  color: #000000;
}

.pos-receipt-item-sub {
  font-size: 10.5px;
  color: #000000;
  margin-top: 1px;
}

.pos-receipt-item-val {
  font-weight: 700;
  font-size: 12px;
  color: #000000;
  white-space: nowrap;
  text-align: right;
}

.pos-receipt-breakdown {
  margin: 2px 0;
}

.pos-receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 12px;
  color: #000000;
}

.pos-receipt-val {
  font-weight: 600;
  color: #000000;
}

.pos-receipt-row-total {
  font-size: 14.5px;
  font-weight: 900;
  color: #000000;
  padding-top: 2px;
}

.pos-receipt-val-total {
  font-size: 15.5px;
  font-weight: 900;
  color: #000000;
}

.pos-receipt-footer {
  text-align: center;
  font-size: 12px;
  color: #000000;
  margin-top: 4px;
}

.pos-receipt-actions-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

/* ============================================================
   UNIVERSAL PRINT SYSTEM (Single POS 80mm vs Batch A4 2-Col Grid)
   ============================================================ */
@media print {
  body * {
    visibility: hidden;
  }
  #print-area, #print-area * {
    visibility: visible;
  }
  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  }
  @page {
    margin: 0;
  }

  /* Mode A: Single Room Thermal Receipt Slip (80mm) - Luôn in nhiệt K80 */
  #print-area.receipt-mode {
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 auto !important;
    padding: 2mm 0 !important;
    box-sizing: border-box !important;
  }
  #print-area.receipt-mode .pos-receipt-paper {
    box-shadow: none !important;
    border: none !important;
    padding: 2mm 0 !important;
    width: 100% !important;
    max-width: 80mm !important;
    color: #000000 !important;
    background: #ffffff !important;
    border-radius: 0 !important;
  }
  #print-area.receipt-mode .pos-receipt-paper * {
    color: #000000 !important;
    background: transparent !important;
    text-shadow: none !important;
    box-shadow: none !important;
  }
  #print-area.receipt-mode .pos-receipt-qr-img {
    background: #ffffff !important;
    filter: grayscale(100%) contrast(140%) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    display: block !important;
  }

  /* Mode B: Batch All-Rooms Monthly Summary Report (Full A4 2-Column Grid Cards, Max 4-5 Rooms/Page) - Chỉ in A4 */
  #print-area.report-mode {
    max-width: 100% !important;
    width: 100% !important;
    padding: 8mm 10mm !important;
    box-sizing: border-box !important;
  }
  #print-area.report-mode .print-header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #334155;
  }
  #print-area.report-mode .print-header h1 {
    font-size: 16pt;
    font-weight: 800;
    margin: 0 0 4px 0;
    color: #0f172a;
  }
  #print-area.report-mode .print-header p {
    font-size: 10pt;
    color: #475569;
    margin: 0;
  }
  #print-area.report-mode .print-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
  }
  #print-area.report-mode .print-summary-item {
    flex: 1;
    text-align: center;
  }
  #print-area.report-mode .print-summary-label {
    font-size: 8pt;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
  }
  #print-area.report-mode .print-summary-val {
    font-size: 13pt;
    font-weight: 800;
    color: #0f172a;
  }
  #print-area.report-mode .print-bills-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 10px !important;
  }
  #print-area.report-mode .print-bill-card {
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    background: #ffffff !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    font-size: 9pt !important;
    line-height: 1.3 !important;
  }
  #print-area.report-mode .print-bill-header {
    background: #f1f5f9 !important;
    padding: 5px 8px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    margin-bottom: 5px !important;
    font-size: 10pt !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
  #print-area.report-mode .print-bill-header .room {
    font-size: 10.5pt !important;
    font-weight: 800 !important;
    color: #0f172a !important;
  }
  #print-area.report-mode .print-bill-header .total {
    font-size: 11pt !important;
    font-weight: 800 !important;
    color: #1d4ed8 !important;
    white-space: nowrap !important;
  }
  #print-area.report-mode .print-bill-body {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    flex: 1 !important;
  }
  #print-area.report-mode .print-bill-details {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }
  #print-area.report-mode .print-bill-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 1.5px 0 !important;
    border-bottom: 1px dashed #e2e8f0 !important;
  }
  #print-area.report-mode .print-bill-row:last-child {
    border-bottom: none !important;
  }
  #print-area.report-mode .print-bill-row-info {
    flex: 1 !important;
    padding-right: 6px !important;
    text-align: left !important;
  }
  #print-area.report-mode .print-bill-row-info .name {
    font-size: 8.5pt !important;
    font-weight: 700 !important;
    color: #0f172a !important;
  }
  #print-area.report-mode .print-bill-row-info .sub {
    font-size: 7.5pt !important;
    color: #475569 !important;
    margin-top: 1px !important;
  }
  #print-area.report-mode .print-bill-row .val {
    font-size: 9pt !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    white-space: nowrap !important;
    text-align: right !important;
  }
  #print-area.report-mode .print-bill-note {
    font-size: 7.5pt !important;
    font-style: italic !important;
    color: #64748b !important;
    margin-top: 2px !important;
  }
  #print-area.report-mode .print-bill-qr-box {
    flex-shrink: 0 !important;
    text-align: center !important;
    padding-left: 4px !important;
    align-self: center !important;
  }
  #print-area.report-mode .print-bill-qr-img {
    width: 80px !important;
    height: 80px !important;
    object-fit: contain !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    display: block !important;
  }
  #print-area.report-mode .print-footer {
    text-align: center;
    font-size: 8pt;
    color: #94a3b8;
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
  }
}

@page {
  margin: 10mm 12mm;
  size: A4 portrait;
}

/* ============================================================
   BATCH CREATION SUITE & PROPERTY SETUP WIZARD
   ============================================================ */
.batch-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.batch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

.batch-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.batch-mode-btn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.batch-mode-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.batch-mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ============================================================
   SPRINT 2.5.2: DEMOGRAPHICS, REVENUE CHARTS & CLOUD SYNC
   ============================================================ */

/* 📊 Demographics Summary Card */
.demographics-summary-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.demographics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.demographics-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.demographics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.demographics-metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.demographics-metric-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.demographics-metric-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.demographics-metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* 🌿 Co-Tenant Hierarchy Tree */
.co-tenant-tree {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px dashed rgba(167, 139, 250, 0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.co-tenant-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg2);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* 📈 Revenue & Cashflow Charts */
.revenue-chart-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}

.revenue-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.revenue-chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.revenue-chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-dot--billed {
  background: #a78bfa;
}

.legend-dot--collected {
  background: #34d399;
}

.revenue-chart-svg-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
}

.revenue-chart-svg {
  width: 100%;
  max-width: 600px;
  height: auto;
  min-height: 140px;
  max-height: 200px;
  display: block;
  margin: 0 auto;
}

.chart-bar-billed {
  fill: #a78bfa;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.chart-bar-collected {
  fill: #34d399;
  opacity: 0.95;
  transition: opacity 0.15s ease;
}

.chart-bar-group:hover .chart-bar-billed,
.chart-bar-group:hover .chart-bar-collected {
  opacity: 1;
  filter: drop-shadow(0 2px 8px rgba(167, 139, 250, 0.4));
}

.chart-label-month {
  fill: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
  text-anchor: middle;
}

.chart-label-amount {
  fill: var(--text);
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  text-anchor: middle;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-dasharray: 4,4;
  stroke-width: 1;
}

/* ☁️ Cloud Sync Status Badge */
.cloud-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.cloud-sync-badge.synced {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.cloud-sync-badge.pending {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

/* 🎁 Freemium 24H Rewarded Trial Reminder Modal (100% vh/dvh-Free Universal Android WebView Safe) */
.modal-box--freemium {
  position: relative;
  width: 100% !important;
  max-width: 520px !important;
  min-height: 420px !important;
  max-height: 88% !important;
  overflow-y: auto !important;
  padding: 24px 20px 20px !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  background: var(--bg2, #ffffff) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 40px rgba(124, 58, 237, 0.12) !important;
  border-radius: 20px !important;
  animation: freemiumSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  display: block !important;
  margin: auto !important;
  flex-shrink: 0 !important;
}

[data-theme="dark"] .modal-box--freemium {
  border-color: rgba(167, 139, 250, 0.35) !important;
  background: linear-gradient(180deg, #181528 0%, #0f0d1b 100%) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(139, 92, 246, 0.25) !important;
}

@media (max-width: 640px) {
  .modal-box--freemium {
    width: 100% !important;
    min-height: 400px !important;
    max-height: 85% !important;
    padding: 20px 16px 16px !important;
    margin: auto !important;
  }
}

@keyframes freemiumSlideIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-box--freemium .btn-freemium-plans {
  width: 100%;
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary, #7c3aed);
  border: 1px solid rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.06);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-box--freemium .btn-freemium-plans:hover {
  background: rgba(124, 58, 237, 0.12);
  border-color: var(--primary, #7c3aed);
}

[data-theme="dark"] .modal-box--freemium .btn-freemium-plans {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

[data-theme="dark"] .modal-box--freemium .btn-freemium-plans:hover {
  background: rgba(251, 191, 36, 0.16);
  border-color: #fbbf24;
}

.modal-box--freemium .freemium-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: var(--primary, #7c3aed);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .modal-box--freemium .freemium-badge {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(167, 139, 250, 0.3);
  color: #c084fc;
}

.modal-box--freemium .freemium-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text, #0f172a);
  margin-bottom: 6px;
  line-height: 1.3;
}

[data-theme="dark"] .modal-box--freemium .freemium-title {
  color: #ffffff;
}

.modal-box--freemium .freemium-tagline {
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 16px;
  line-height: 1.45;
}

[data-theme="dark"] .modal-box--freemium .freemium-tagline {
  color: var(--text-muted, #94a3b8);
}

.modal-box--freemium .freemium-features-box {
  background: var(--bg3, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-theme="dark"] .modal-box--freemium .freemium-features-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.28);
}

.modal-box--freemium .freemium-feature-item {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text, #0f172a);
}

[data-theme="dark"] .modal-box--freemium .freemium-feature-item {
  color: var(--text, #e2e8f0);
}


/* ============================================================
   3RD-PARTY & AFFILIATE BANNER ADS (JSON-Driven)
   ============================================================ */
.affiliate-banners-container {
  margin: 20px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.affiliate-banner-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
  padding: 14px 16px;
  transition: transform var(--transition, 0.2s ease), border-color var(--transition, 0.2s ease), box-shadow var(--transition, 0.2s ease);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.1));
}

.affiliate-banner-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.18);
}

.affiliate-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.affiliate-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light, rgba(124, 58, 237, 0.12));
  padding: 3px 8px;
  border-radius: 6px;
}

.affiliate-label-sponsored {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.affiliate-banner-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.affiliate-banner-img-wrap {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.affiliate-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.affiliate-banner-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.affiliate-banner-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.affiliate-banner-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  transition: gap 0.2s ease;
}

.affiliate-banner-link:hover .affiliate-banner-cta {
  gap: 7px;
}

/* 👤 User Profile Modal (Light & Dark Theme Adaptive) */
.modal-box--profile {
  max-width: 440px;
  border-radius: 20px !important;
  background: var(--bg2, #ffffff) !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12), 0 0 30px rgba(124, 58, 237, 0.08) !important;
}

[data-theme="dark"] .modal-box--profile {
  background: rgba(15, 23, 42, 0.96) !important;
  border: 1px solid rgba(124, 58, 237, 0.35) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(124, 58, 237, 0.2) !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.modal-box--profile .profile-details-card {
  background: var(--bg3, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
}

[data-theme="dark"] .modal-box--profile .profile-details-card {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}



/* Seasonal Holiday Festive Snowflake Overlay */
.festive-snow-canvas {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: 999999 !important;
}
