:root {
  /*
   * Dark mode color scheme (default)
   * --------------------------------
   * Background base:  #161922
   * Sidebar:          #1a1e2a
   * Cards / surfaces: #1e2230
   * Hover surfaces:   #2a2f40
   * Borders:          #32384a
   * Primary text:     #eef0f6
   * Muted text:       #9aa0b5
   * Brand primary:    #10b981
   * Smoke title gold: #D4AF37  (metallic gold)
   * Gold (light UI):  #B8860B  (darkgoldenrod — contrast on light)
   */
  --bg-dark: #161922;
  --bg-card: #1e2230;
  --bg-sidebar: #1a1e2a;
  --bg-hover: #2a2f40;
  --border: #32384a;
  --text: #eef0f6;
  --text-muted: #9aa0b5;
  --primary: #10b981;
  --primary-dark: #059669;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  /* Gold tokens */
  --gold: #D4AF37;
  --gold-dark: #B8860B;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /*
   * Smoke title zoom scale factors (exact)
   * 0%   → scale(0.20)
   * 15%  → scale(1.20)   peak zoom-in
   * 28%  → scale(1.00)   settle
   * 55%  → scale(2.50)   expand
   * 80%  → scale(3.75)   wide smoke
   * 100% → scale(5.00)   full fade-out
   */
  --smoke-scale-start: 0.20;
  --smoke-scale-peak: 1.20;
  --smoke-scale-settle: 1.00;
  --smoke-scale-expand: 2.50;
  --smoke-scale-wide: 3.75;
  --smoke-scale-end: 5.00;
}

/* Scoped — NEVER style global body/html outside CIMS UI */
.cims-wrap,
.cims-wrap *,
.invome-auth-wrap,
.invome-auth-wrap *,
.portal-wrap,
.portal-wrap * {
  box-sizing: border-box;
}

.cims-wrap {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  min-height: calc(100vh - 32px);
  overflow-x: hidden;
  margin: 0 0 0 -20px;
}

.cims-wrap #app,
#cims-app-root #app {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  min-height: calc(100vh - 32px);
  background: var(--bg-dark);
  color: var(--text);
}

.cims-wrap .cims-sidebar,
#app .cims-sidebar {
  width: 260px;
  max-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex !important;
  flex-direction: column;
  position: relative;
  top: 0;
  height: auto;
  min-height: calc(100vh - 32px);
  z-index: 10;
  flex-shrink: 0;
  overflow-y: auto;
}

/* ========== SIDEBAR ========== */
.cims-wrap .cims-sidebar,
#app .cims-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 32px;
  height: calc(100vh - 32px);
  z-index: 10;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
}

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.logo-datetime {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-days-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 180px;
}
.logo-days-left .days-left-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.logo-days-left .days-left-value {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #10b981);
  white-space: nowrap;
  line-height: 1.3;
}
.logo-days-left.urgent .days-left-value,
.sub-countdown.urgent,
.sub-countdown.urgent .sub-cd-num {
  color: #ef4444 !important;
}

.sub-countdown-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.sub-countdown-banner.urgent {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border-color: rgba(239, 68, 68, 0.4);
}
.sub-countdown {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--accent, #10b981);
}
.sub-countdown .sub-cd-unit {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.75;
  margin: 0 2px;
}
.sub-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.sub-plan-card {
  border: 1px solid var(--border, #2a2e3b);
  border-radius: 14px;
  padding: 18px;
  background: var(--card, #1a1d29);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sub-plan-card.featured {
  border-color: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35);
}
.sub-plan-card h4 {
  margin: 0;
  font-size: 1.05rem;
}
.sub-plan-card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #10b981;
}
.sub-plan-card .price span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}
.sub-plan-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex: 1;
}
.sub-manage-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border, #2a2e3b);
  background: rgba(0, 0, 0, 0.15);
}
.sub-manage-panel label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}
.sub-manage-panel select,
.sub-manage-panel input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, #2a2e3b);
  background: var(--input-bg, #12141c);
  color: inherit;
  margin-bottom: 10px;
}
.modal-overlay.blur-bg {
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  background: rgba(8, 10, 16, 0.55);
}

.nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.2s ease;
  position: relative;
  border: 1px solid transparent;
}

.nav-item i { width: 20px; text-align: center; font-size: 0.95rem; }

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary);
}

/* Glassmorphism active tab (dark mode) */
.cims-wrap:not(.theme-light) .nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(16, 185, 129, 0.2) 45%,
    rgba(255, 255, 255, 0.06) 100%
  );
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.28),
    0 0 18px rgba(16, 185, 129, 0.4),
    0 0 36px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  text-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}
.cims-wrap:not(.theme-light) .nav-item.active i {
  color: #6ee7b7;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.75));
}
.cims-wrap:not(.theme-light) .nav-item.active .badge {
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.55);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}

.cims-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: 10px;
}

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
}

.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ========== MAIN ========== */
.cims-wrap .main,
#app .main {
  flex: 1;
  margin-left: 0; /* flex row with sidebar — do not offset */
  min-width: 0;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
}

/* CIMS topbar must stay visible in fullscreen */
.cims-wrap .topbar,
.cims-wrap header.topbar,
body.cims-fullscreen-dashboard .cims-wrap .topbar {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  pointer-events: auto !important;
}
.cims-wrap .topbar-right {
  display: flex !important;
  visibility: visible !important;
}
@media (min-width: 901px) {
  .cims-wrap .search-box {
    display: flex !important;
    visibility: visible !important;
  }
  .cims-wrap .topbar-flag {
    display: flex !important;
    visibility: visible !important;
  }
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff; /* white tab titles in dark mode */
}
.cims-wrap.theme-light .page-title {
  color: #111827;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 240px;
}

.search-box i { color: var(--text-muted); font-size: 0.85rem; }
.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9rem;
  width: 100%;
  font-family: inherit;
}

.content {
  padding: 32px 36px 32px 40px; /* more space left, top, centre */
  flex: 1;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.mobile-toggle { display: none; }

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ========== STAT CARDS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  color: #ffffff;
}

.stat-card.green { background: linear-gradient(135deg, #059669, #10b981); }
.stat-card.orange { background: linear-gradient(135deg, #d97706, #f59e0b); }
.stat-card.blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.stat-card.purple { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }

/* Force white titles & numbers on insight cards (dark + light modes) */
.stat-card .stat-label,
.stat-card .stat-value,
.stat-card .stat-meta,
.cims-wrap.theme-light .stat-card .stat-label,
.cims-wrap.theme-light .stat-card .stat-value,
.cims-wrap.theme-light .stat-card .stat-meta {
  color: #ffffff !important;
}

.stat-label { font-size: 0.8rem; opacity: 0.95; margin-bottom: 6px; color: #ffffff; }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; color: #ffffff; }
.stat-meta { font-size: 0.75rem; opacity: 0.85; margin-top: 8px; color: #ffffff; }

/* ========== GRID LAYOUTS ========== */
.grid-2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ========== TABLES ========== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status.paid { background: rgba(16,185,129,0.15); color: var(--primary); }
.status.pending { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.status.overdue { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.status.draft { background: rgba(139,144,165,0.15); color: var(--text-muted); }
.status.partial { background: rgba(59,130,246,0.15); color: var(--accent-blue); }

/* ========== FORMS ========== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group.full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 80px; }

/* ========== LINE ITEMS ========== */
.line-items {
  margin: 20px 0;
}

.line-item {
  display: grid;
  grid-template-columns: 2fr 80px 110px 110px 40px;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.line-item input { margin: 0; }

/* ========== TOTALS ========== */
.totals {
  margin-left: auto;
  width: 280px;
  margin-top: 16px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.9rem;
}

.totals-row.grand {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

/* ========== FILTERS ========== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

.filters select, .filters input {
  width: auto;
  min-width: 140px;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal.wide { max-width: 960px; }

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

.modal-header h2 { font-size: 1.15rem; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========== TOAST ========== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 280px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.25s ease;
}

.toast.success { border-left: 4px solid var(--primary); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.info { border-left: 4px solid var(--accent-blue); }

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

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* ========== QR / SHARE ========== */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg-dark);
  border-radius: 12px;
}

.share-link {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
}

.share-link input {
  flex: 1;
  font-size: 0.8rem;
}

/* ========== CHART CONTAINER ========== */
.chart-container {
  position: relative;
  height: 260px;
}

/* ========== ACTIONS ========== */
.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.actions button:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ========== PRINT / PDF AREA ========== */
.invoice-print-area {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 800px;
  background: white;
  color: #111;
  padding: 40px;
  font-family: 'Inter', sans-serif;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .cims-wrap .cims-sidebar {
    position: fixed;
    left: 0; top: 46px; bottom: 0;
    transform: translateX(-100%);
    z-index: 100000;
  }
  .cims-wrap .cims-sidebar.open { transform: translateX(0); }
  .cims-wrap .main { margin-left: 0; }
  .mobile-toggle { display: flex !important; }
  .stats-grid { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .line-item { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Preview mode (customer share link) */
.cims-wrap.preview-mode .cims-sidebar,
.cims-wrap.preview-mode .topbar { display: none; }
.cims-wrap.preview-mode .main { margin-left: 0; }
.cims-wrap.preview-mode .content { max-width: 900px; margin: 0 auto; }

/* ========== WordPress Admin Integration ========== */
.cims-wrap,
.cims-wrap * {
  box-sizing: border-box;
}

.cims-wrap {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

/* sidebar layout handled above */

@media screen and (max-width: 782px) {
  .cims-wrap .cims-sidebar {
    top: 46px;
    height: calc(100vh - 46px);
  }
}

/* Ensure buttons look correct inside WP */
.cims-wrap .btn,
.cims-wrap .icon-btn,
.cims-wrap button {
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.4;
}

.cims-wrap input,
.cims-wrap select,
.cims-wrap textarea {
  max-width: none;
  box-shadow: none;
}


/* ========== CIMS WP-Admin layout hard fixes (v1.2.2) ========== */
body.toplevel_page_cims #wpcontent {
  padding-left: 0 !important;
}
body.toplevel_page_cims #wpbody-content {
  padding-bottom: 0 !important;
  float: none !important;
  overflow: visible !important;
}
body.toplevel_page_cims .wrap {
  margin: 0;
}
.cims-wrap {
  display: block !important;
  width: calc(100% + 20px) !important;
  max-width: none !important;
  margin: 0 0 0 -20px !important;
  background: #161922 !important;
  color: #e4e6f0 !important;
  min-height: calc(100vh - 32px) !important;
}
.cims-wrap #cims-app-root {
  display: block;
  width: 100%;
}
.cims-wrap #app {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  width: 100% !important;
  min-height: calc(100vh - 32px) !important;
  background: #161922 !important;
}
.cims-wrap .cims-sidebar {
  display: flex !important;
  flex-direction: column !important;
  width: 260px !important;
  min-width: 260px !important;
  max-width: 260px !important;
  background: #151821 !important;
  border-right: 1px solid #2a2e3b !important;
  position: relative !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: calc(100vh - 32px) !important;
  overflow-y: auto !important;
  z-index: 5 !important;
}
@media (min-width: 901px) {
  .cims-wrap .cims-sidebar {
    transform: none !important;
  }
}
.cims-wrap .main {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  margin-left: 0 !important;
  min-width: 0 !important;
  width: auto !important;
  background: #161922 !important;
  color: #e4e6f0 !important;
}
.cims-wrap .content {
  flex: 1;
  padding: 24px 28px;
  background: #161922;
  color: #e4e6f0;
}
.cims-wrap .stats-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
  margin-bottom: 24px !important;
}
@media (max-width: 1100px) {
  .cims-wrap .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 782px) {
  .cims-wrap .stats-grid { grid-template-columns: 1fr !important; }
  .cims-wrap .cims-sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 46px !important;
    bottom: 0 !important;
    transform: translateX(-100%) !important;
    z-index: 100000 !important;
  }
  .cims-wrap .cims-sidebar.open {
    transform: translateX(0) !important;
  }
}

/* ========== FULL SCREEN ========== */
/* Simple full-viewport shell — do not use column flex on .cims-wrap (breaks sidebar+main). */
.cims-wrap.fullscreen,
.cims-wrap.cims-app-shell,
body.toplevel_page_cims .cims-wrap,
body.cims-fullscreen-dashboard .cims-wrap {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  z-index: 1000 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  display: block !important;
  pointer-events: auto !important;
  background: #161922 !important;
}
.cims-wrap.fullscreen #cims-app-root,
.cims-wrap.cims-app-shell #cims-app-root {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: auto !important;
}
.cims-wrap.fullscreen #app,
body.toplevel_page_cims .cims-wrap #app,
body.cims-fullscreen-dashboard .cims-wrap #app {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  pointer-events: auto !important;
}
/* Desktop left sidebar — always visible & clickable */
@media (min-width: 901px) {
  .cims-wrap .cims-sidebar,
  .cims-wrap.fullscreen .cims-sidebar,
  .cims-wrap.cims-app-shell .cims-sidebar,
  body.toplevel_page_cims .cims-wrap .cims-sidebar,
  body.cims-fullscreen-dashboard .cims-wrap .cims-sidebar,
  #app .cims-sidebar {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    transform: none !important;
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    z-index: 30 !important;
  }
  .cims-wrap .cims-sidebar .nav-item,
  .cims-wrap .cims-sidebar a.nav-item,
  .cims-wrap .cims-sidebar .nav-sub-item {
    pointer-events: auto !important;
    cursor: pointer !important;
  }
}
.cims-wrap.fullscreen .main,
body.toplevel_page_cims .cims-wrap .main,
body.cims-fullscreen-dashboard .cims-wrap .main {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  height: 100% !important;
  overflow: hidden !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 1 !important;
}
.cims-wrap.fullscreen .content,
body.toplevel_page_cims .cims-wrap .content,
body.cims-fullscreen-dashboard .cims-wrap .content,
.cims-wrap #content {
  display: block !important;
  flex: 1 1 auto !important;
  min-height: 120px !important;
  height: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1 !important;
}
#cims-install-banner {
  position: relative !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  z-index: 10 !important;
  pointer-events: auto !important;
}
/* Never let locked styling block dashboard tab */
.nav-item[data-view="dashboard"] {
  pointer-events: auto !important;
  opacity: 1 !important;
}


/* ========== TOPBAR: DATETIME & FLAG ========== */
/* Top centre/topbar date & time — disabled / removed */
.topbar-datetime,
#topbar-datetime,
.topbar-date,
#topbar-date,
.topbar-time,
#topbar-time {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.topbar-flag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.topbar-flag .flag-emoji {
  font-size: 1.25rem;
  line-height: 1;
}
.topbar-flag .flag-country {
  font-weight: 600;
  color: var(--text);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== USER MENU (AVATAR DROPDOWN) ========== */
.user-menu {
  position: relative;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.user-menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}
.user-menu-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 200;
  overflow: hidden;
  padding: 8px 0;
}
.user-menu-dropdown[hidden] { display: none !important; }
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-menu-header .avatar {
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
}
.user-menu-header .user-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.user-menu-header .user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.12s;
}
.user-menu-item:hover {
  background: var(--bg-hover);
  color: var(--primary);
}
.user-menu-item i {
  width: 18px;
  text-align: center;
  color: var(--text-muted);
}
.user-menu-item:hover i { color: var(--primary); }
.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.user-menu-logout { color: var(--accent-red) !important; }
.user-menu-logout i { color: var(--accent-red) !important; }

/* ========== MODAL BLUR & THEMES ========== */
.modal-overlay {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.55);
}
.modal-overlay.open { display: flex; }

/* Invoice create/edit: white bg, black text */
.modal.theme-invoice,
.modal.theme-white {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}
.modal.theme-invoice .modal-header,
.modal.theme-white .modal-header {
  border-bottom-color: #e5e7eb;
  color: #111827;
}
.modal.theme-invoice .modal-header h2,
.modal.theme-white .modal-header h2 {
  color: #111827;
}
.modal.theme-invoice .modal-body,
.modal.theme-white .modal-body {
  color: #111827;
}
.modal.theme-invoice .modal-footer,
.modal.theme-white .modal-footer {
  border-top-color: #e5e7eb;
  background: #f9fafb;
}
.modal.theme-invoice label,
.modal.theme-white label {
  color: #374151;
}
.modal.theme-invoice input,
.modal.theme-invoice select,
.modal.theme-invoice textarea,
.modal.theme-white input,
.modal.theme-white select,
.modal.theme-white textarea {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #111827;
}
.modal.theme-invoice input:focus,
.modal.theme-invoice select:focus,
.modal.theme-invoice textarea:focus,
.modal.theme-white input:focus,
.modal.theme-white select:focus,
.modal.theme-white textarea:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.modal.theme-invoice .icon-btn,
.modal.theme-white .icon-btn {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}
.modal.theme-invoice .icon-btn:hover,
.modal.theme-white .icon-btn:hover {
  background: #e5e7eb;
  color: #111827;
}
.modal.theme-invoice .btn-secondary,
.modal.theme-white .btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}
.modal.theme-invoice .form-group p,
.modal.theme-white .form-group p,
.modal.theme-invoice .text-muted,
.modal.theme-white .text-muted {
  color: #6b7280 !important;
}

/* Customers: blue background */
.modal.theme-customers {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}
.modal.theme-customers .modal-header {
  border-bottom-color: #bfdbfe;
  background: #dbeafe;
}
.modal.theme-customers .modal-header h2 { color: #1e40af; }
.modal.theme-customers .modal-footer {
  border-top-color: #bfdbfe;
  background: #dbeafe;
}
.modal.theme-customers label { color: #1e40af; }
.modal.theme-customers input,
.modal.theme-customers select,
.modal.theme-customers textarea {
  background: #fff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}
.modal.theme-customers input:focus,
.modal.theme-customers select:focus,
.modal.theme-customers textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.modal.theme-customers .icon-btn {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

/* Payments / Receipts / Services: default dark with blur (already have blur) */
.modal.theme-blur {
  /* inherits default dark card */
}

/* Clickable table cells */
.clickable-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.clickable-link:hover {
  text-decoration: underline;
}
tr.row-clickable { cursor: pointer; }
tr.row-clickable:hover { background: var(--bg-hover); }

/* ========== SETTINGS: WHITE THEME ========== */
.settings-white {
  background: #ffffff !important;
  color: #111827 !important;
  border-color: #e5e7eb !important;
  border-radius: 16px;
  padding: 28px 32px !important;
  max-width: 800px;
}
.settings-white .card-header,
.settings-white .card-title {
  color: #111827 !important;
}
.settings-white h3 {
  color: #111827 !important;
  font-weight: 700;
}
.settings-white label {
  color: #374151 !important;
  font-weight: 600;
}
.settings-white p,
.settings-white .text-muted {
  color: #6b7280 !important;
}
.settings-white input,
.settings-white select,
.settings-white textarea {
  background: #fff !important;
  border: 1px solid #d1d5db !important;
  color: #111827 !important;
}
.settings-white input:focus,
.settings-white select:focus,
.settings-white textarea:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.settings-white .btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

/* Responsive topbar */
@media (max-width: 900px) {
  .topbar-datetime { display: none; }
  .search-box { min-width: 140px; }
}
@media (max-width: 640px) {
  .topbar-flag .flag-country { display: none; }
  .search-box { display: none; }
}

/* ========== THEME TOGGLE (right center) ========== */
.cims-theme-toggle {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10050;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.cims-theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.25);
}
.cims-theme-toggle:active {
  transform: translateY(-50%) scale(0.97);
}
.cims-theme-toggle .theme-icon {
  position: absolute;
  font-size: 1.15rem;
  line-height: 1;
  transition: opacity 0.2s, transform 0.2s;
}
.cims-theme-toggle .theme-icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.cims-theme-toggle .theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }

/* When light mode is active, show sun icon */
.cims-wrap.theme-light .cims-theme-toggle .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
.cims-wrap.theme-light .cims-theme-toggle .theme-icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
  color: #f59e0b;
}

/* ========== LIGHT THEME ========== */
.cims-wrap.theme-light {
  --bg-dark: #f3f4f6;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  background: var(--bg-dark);
  color: var(--text);
}
.cims-wrap.theme-light #app,
.cims-wrap.theme-light .main,
.cims-wrap.theme-light .content {
  background: var(--bg-dark) !important;
  color: var(--text) !important;
}
.cims-wrap.theme-light .cims-sidebar {
  background: var(--bg-sidebar) !important;
  border-right-color: var(--border) !important;
}
.cims-wrap.theme-light .topbar {
  background: var(--bg-sidebar);
  border-bottom-color: var(--border);
}
.cims-wrap.theme-light .card {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.cims-wrap.theme-light .search-box {
  background: var(--bg-card);
  border-color: var(--border);
}
.cims-wrap.theme-light .search-box input {
  color: var(--text);
}
.cims-wrap.theme-light .nav-item {
  color: var(--text-muted);
}
.cims-wrap.theme-light .nav-item:hover,
.cims-wrap.theme-light .nav-item.active {
  background: var(--bg-hover);
  color: var(--primary);
}
.cims-wrap.theme-light .page-title {
  color: var(--text);
}
.cims-wrap.theme-light table th {
  color: var(--text-muted);
  border-bottom-color: var(--border);
}
.cims-wrap.theme-light table td {
  border-bottom-color: var(--border);
  color: var(--text);
}
.cims-wrap.theme-light tr.row-clickable:hover {
  background: var(--bg-hover);
}
.cims-wrap.theme-light .icon-btn {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-muted);
}
.cims-wrap.theme-light .icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.cims-wrap.theme-light .btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}
.cims-wrap.theme-light .modal {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.cims-wrap.theme-light .modal-header,
.cims-wrap.theme-light .modal-footer {
  border-color: var(--border);
}
.cims-wrap.theme-light .user-menu-btn,
.cims-wrap.theme-light .user-menu-dropdown,
.cims-wrap.theme-light .topbar-flag {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.cims-wrap.theme-light .user-menu-item {
  color: var(--text);
}
.cims-wrap.theme-light .user-menu-item:hover {
  background: var(--bg-hover);
}
.cims-wrap.theme-light .logo {
  border-bottom-color: var(--border);
}
.cims-wrap.theme-light .cims-sidebar-footer {
  border-top-color: var(--border);
}
.cims-wrap.theme-light .stat-card,
.cims-wrap.theme-light [class*="stat"] {
  color: var(--text);
}
.cims-wrap.theme-light input,
.cims-wrap.theme-light select,
.cims-wrap.theme-light textarea {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.cims-wrap.theme-light .filters select,
.cims-wrap.theme-light .filters input {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
/* Settings white card stays readable in light mode */
.cims-wrap.theme-light .settings-white {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #111827 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

@media (max-width: 782px) {
  .cims-theme-toggle {
    right: 12px;
    width: 42px;
    height: 42px;
  }
}

/* ========== LOGOUT NAV ITEM (red glow) ========== */
.nav-item-logout,
.nav-item.nav-item-logout {
  color: #f87171 !important;
  margin-top: 8px;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.55), 0 0 16px rgba(239, 68, 68, 0.3);
}
.nav-item-logout i {
  color: #f87171 !important;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.7));
}
.nav-item-logout:hover {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fecaca !important;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.8), 0 0 24px rgba(239, 68, 68, 0.4);
}
.nav-item-logout:hover i {
  color: #fecaca !important;
}

/* ========== SUPPORT NAV ITEM (green) ========== */
.nav-item-support,
.nav-item.nav-item-support {
  color: #10b981 !important;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.45);
}
.nav-item-support i {
  color: #10b981 !important;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.65));
}
.nav-item-support:hover {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
}
.nav-item-support:hover i {
  color: #34d399 !important;
}

.support-wa-frame-wrap {
  position: relative;
  width: 100%;
  min-height: 420px;
  border-radius: 12px;
  overflow: hidden;
  background: #0b141a;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.support-wa-frame-wrap iframe {
  width: 100%;
  height: 460px;
  border: 0;
  background: #0b141a;
}
.support-wa-fallback {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Deeper modal blur backdrop */
.modal-overlay {
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  background: rgba(0, 0, 0, 0.6);
}

/* Extra breathing room in full-screen layout */
.cims-wrap.fullscreen .content,
body.toplevel_page_cims .cims-wrap .content {
  padding: 36px 40px 36px 44px !important;
}
.cims-wrap.fullscreen .topbar,
body.toplevel_page_cims .cims-wrap .topbar {
  padding: 18px 36px 18px 32px;
}
.cims-wrap.fullscreen .cims-sidebar .logo,
body.toplevel_page_cims .cims-wrap .cims-sidebar .logo {
  padding: 28px 20px 20px;
}

/* Ensure page title stays white in dark mode even with overrides */
.cims-wrap:not(.theme-light) .page-title {
  color: #ffffff !important;
}

/* Lighter dark theme hard overrides used elsewhere */
.cims-wrap:not(.theme-light) .main,
.cims-wrap:not(.theme-light) .content {
  background: #161922 !important;
  color: #eef0f6 !important;
}
.cims-wrap:not(.theme-light) .cims-sidebar {
  background: #1a1e2a !important;
}

/* ========== SMOKE / ZOOM TITLE POPOUT ========== */
.cims-smoke-title {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}
.cims-smoke-title-text {
  font-family: var(--font);
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gold); /* #D4AF37 — solid metallic gold, no glow */
  text-shadow: none;
  border: none;
  box-shadow: none;
  outline: none;
  transform: scale(var(--smoke-scale-start));
  opacity: 0;
  filter: blur(0px);
  will-change: transform, opacity, filter;
  white-space: nowrap;
}
.cims-wrap.theme-light .cims-smoke-title-text {
  color: var(--gold-dark); /* #B8860B */
  text-shadow: none;
}
.cims-smoke-title--play {
  opacity: 1;
}
.cims-smoke-title--play .cims-smoke-title-text {
  animation: cimsSmokeTitle 1.65s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
/* Exact zoom scale timeline: 0.20 → 1.20 → 1.00 → 2.50 → 3.75 → 5.00 */
@keyframes cimsSmokeTitle {
  0% {
    opacity: 0;
    transform: scale(0.20);
    filter: blur(0px);
    letter-spacing: -0.02em;
  }
  15% {
    opacity: 1;
    transform: scale(1.20);
    filter: blur(0px);
  }
  28% {
    opacity: 1;
    transform: scale(1.00);
    filter: blur(0px);
  }
  55% {
    opacity: 0.55;
    transform: scale(2.50);
    filter: blur(8px);
    letter-spacing: 0.12em;
  }
  80% {
    opacity: 0.2;
    transform: scale(3.75);
    filter: blur(20px);
    letter-spacing: 0.28em;
  }
  100% {
    opacity: 0;
    transform: scale(5.00);
    filter: blur(32px);
    letter-spacing: 0.4em;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cims-smoke-title--play .cims-smoke-title-text {
    animation-duration: 0.45s;
  }
}

/* ========== MOBILE DRAWER + TOPBAR RENEW + SMART SCREENS ========== */

/* White burger button */
.mobile-toggle,
#mobile-toggle {
  display: none;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  z-index: 100020;
  position: relative;
  flex-shrink: 0;
  pointer-events: auto !important;
  cursor: pointer !important;
}
.mobile-toggle i,
#mobile-toggle i {
  color: #ffffff !important;
  font-size: 1.15rem;
}
.mobile-toggle:hover,
#mobile-toggle:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

.topbar-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.topbar-renew {
  display: none; /* shown on mobile */
  line-height: 1.25;
}
.topbar-renew-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffffff;
  opacity: 0.85;
  font-weight: 600;
}
.topbar-renew-countdown {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}
.topbar-renew.urgent .topbar-renew-countdown {
  color: #fca5a5 !important;
}

/* Backdrop when mobile menu is open */
.cims-wrap.mobile-menu-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 100010;
}

@media (max-width: 900px) {
  .mobile-toggle,
  #mobile-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .topbar-renew {
    display: block;
  }

  .topbar {
    padding: 10px 12px;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .topbar-left {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .page-title {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search-box {
    display: none !important;
  }

  /* Off-canvas sidebar — works even in fullscreen mode */
  .cims-wrap .cims-sidebar,
  .cims-wrap.fullscreen .cims-sidebar,
  body.toplevel_page_cims .cims-wrap .cims-sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    width: min(280px, 86vw) !important;
    max-width: 280px !important;
    transform: translateX(-105%) !important;
    transition: transform 0.25s ease !important;
    z-index: 100015 !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .cims-wrap .cims-sidebar.open,
  .cims-wrap.fullscreen .cims-sidebar.open,
  body.toplevel_page_cims .cims-wrap .cims-sidebar.open,
  .cims-wrap.mobile-menu-open .cims-sidebar {
    transform: translateX(0) !important;
  }

  .cims-wrap .main,
  .cims-wrap.fullscreen .main,
  body.toplevel_page_cims .cims-wrap .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .content {
    padding: 16px 12px 28px !important;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .card {
    padding: 14px !important;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .table-wrap table {
    min-width: 560px;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
  }

  .line-item {
    grid-template-columns: 1fr 1fr !important;
  }

  .modal {
    width: calc(100vw - 20px) !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    margin: 10px;
  }

  .modal.wide {
    max-width: 100% !important;
  }

  .sub-plans-grid {
    grid-template-columns: 1fr !important;
  }

  .topbar-right {
    gap: 6px;
  }

  .topbar-flag .flag-country {
    display: none;
  }
}

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

  .page-title {
    font-size: 0.95rem;
  }

  .topbar-renew-countdown {
    font-size: 0.75rem;
  }

  .btn {
    padding: 8px 12px;
  }

  .content {
    padding: 12px 10px 24px !important;
  }
}

/* Prevent body scroll when drawer is open */
body.cims-mobile-nav-open {
  overflow: hidden !important;
}

/* ========== SMOOTH SLIDE ANIMATIONS ========== */
.cims-wrap .cims-sidebar {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
}
.cims-wrap .content {
  animation: cimsContentIn 0.32s ease;
}
@keyframes cimsContentIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-overlay {
  transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
}
.modal-overlay.open .modal {
  animation: cimsModalSlide 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cimsModalSlide {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.nav-item {
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.nav-item:active {
  transform: scale(0.98);
}

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

/* Aria FAQ nav */
.nav-item-aria,
.nav-item.nav-item-aria {
  color: #38bdf8 !important;
  font-weight: 600;
}
.nav-item-aria i {
  color: #38bdf8 !important;
}
.nav-item-aria:hover {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #7dd3fc !important;
}

/* Aria chat — white panel, clear spacing, narrower width */
.modal.theme-aria {
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid #e5e7eb !important;
  max-width: 420px !important;
  width: min(420px, calc(100vw - 24px)) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.modal.theme-aria .modal-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e5e7eb !important;
}
.modal.theme-aria .modal-header h2,
.modal.theme-aria #modal-title {
  color: #111827 !important;
  font-weight: 700;
}
.modal.theme-aria .modal-body {
  background: #ffffff !important;
  color: #111827 !important;
  padding: 16px 18px 8px !important;
}
.modal.theme-aria .modal-footer {
  background: #ffffff !important;
  border-top: 1px solid #e5e7eb !important;
}
.modal.theme-aria .icon-btn {
  color: #111827 !important;
  border-color: #e5e7eb !important;
  background: #f9fafb !important;
}

.aria-chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 280px;
  max-height: min(65vh, 480px);
  color: #111827;
}
.aria-intro {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 14px;
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
}
.aria-intro-text {
  flex: 1;
  min-width: 0;
}
.aria-name {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}
.aria-desc {
  margin: 0;
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.55;
}
.aria-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #fce7f3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #f9a8d4;
}
.aria-avatar-svg {
  width: 48px;
  height: 48px;
  display: block;
}
.aria-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 8px;
  min-height: 140px;
  max-height: 260px;
}
.aria-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #111827;
}
.aria-msg p {
  margin: 6px 0 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.aria-msg-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 2px;
}
.aria-msg-user {
  align-self: flex-end;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.aria-msg-aria {
  align-self: flex-start;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}
.aria-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}
.aria-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 0.9rem;
}
.aria-form input::placeholder {
  color: #9ca3af;
}
.aria-form input:focus {
  outline: 2px solid rgba(236, 72, 153, 0.35);
  outline-offset: 1px;
  border-color: #f9a8d4;
}
.aria-send {
  flex-shrink: 0;
  background: #ec4899 !important;
  border: none !important;
  color: #fff !important;
  padding: 11px 16px !important;
}
.aria-send:hover {
  background: #db2777 !important;
}

@media (max-width: 600px) {
  .modal.theme-aria {
    max-width: calc(100vw - 20px) !important;
    width: calc(100vw - 20px) !important;
  }
  .aria-chat {
    max-height: min(72vh, 520px);
    gap: 14px;
  }
  .aria-messages {
    max-height: 200px;
  }
  .aria-form {
    flex-wrap: wrap;
  }
  .aria-form .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cims-wrap .cims-sidebar,
  .cims-wrap .content,
  .modal-overlay.open .modal,
  .nav-item {
    transition: none !important;
    animation: none !important;
  }
}

/* ========== MOBILE NAV DROPDOWN (FORCE FIX) ========== */
.mobile-nav-wrap {
  position: relative;
  display: none;
  flex-shrink: 0;
  z-index: 100100;
}

#mobile-toggle.mobile-toggle,
.mobile-nav-wrap .mobile-toggle,
button#mobile-toggle {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  border-radius: 10px !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 100110 !important;
  position: relative !important;
  -webkit-tap-highlight-color: transparent;
}
#mobile-toggle.mobile-toggle i,
.mobile-nav-wrap .mobile-toggle i,
button#mobile-toggle i,
button#mobile-toggle .fa-bars {
  color: #ffffff !important;
  font-size: 1.25rem !important;
  opacity: 1 !important;
  visibility: visible !important;
}
#mobile-toggle.is-open {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #10b981 !important;
}

.mobile-nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: min(280px, calc(100vw - 24px));
  max-height: min(75vh, 520px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #1a1e2a;
  border: 1px solid #2a2e3b;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  padding: 8px 0;
  z-index: 100120;
  animation: cimsDropIn 0.2s ease;
}
.mobile-nav-dropdown[hidden] {
  display: none !important;
}
.mobile-nav-dropdown.is-open {
  display: block !important;
}
@keyframes cimsDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-nav-section {
  padding: 8px 14px 4px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b90a5;
  font-weight: 700;
}
.mobile-nav-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: #e4e6f0 !important;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none !important;
  box-sizing: border-box;
}
.mobile-nav-item:hover,
.mobile-nav-item:focus {
  background: rgba(16, 185, 129, 0.15);
  outline: none;
}
.mobile-nav-item i {
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}
.mobile-nav-support { color: #10b981 !important; }
.mobile-nav-aria { color: #38bdf8 !important; }
.mobile-nav-logout { color: #f87171 !important; }

/* Smaller topbar renew on mobile */
.topbar-renew-label {
  font-size: 0.55rem !important;
  line-height: 1.2;
}
.topbar-renew-countdown {
  font-size: 0.68rem !important;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Desktop: hide mobile dropdown chrome */
@media (min-width: 901px) {
  .mobile-nav-wrap {
    display: none !important;
  }
  .mobile-toggle,
  #mobile-toggle {
    display: none !important;
  }
  .topbar-renew {
    display: none !important;
  }
}

/* Phones / tablets */
@media (max-width: 900px) {
  .mobile-nav-wrap {
    display: block !important;
  }
  .mobile-toggle,
  #mobile-toggle,
  button#mobile-toggle {
    display: flex !important;
  }
  .topbar-renew {
    display: block !important;
  }
  .page-title {
    font-size: 0.95rem !important;
  }

  /* Keep desktop sidebar off-screen on mobile so only dropdown is used */
  .cims-wrap .cims-sidebar,
  .cims-wrap.fullscreen .cims-sidebar,
  body.toplevel_page_cims .cims-wrap .cims-sidebar,
  #app .cims-sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    transform: translateX(-100%) !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 1 !important;
  }
  .cims-wrap .main,
  .cims-wrap.fullscreen .main {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
}

.cims-wrap.theme-light .mobile-nav-dropdown {
  background: #ffffff;
  border-color: #e5e7eb;
}
.cims-wrap.theme-light .mobile-nav-item {
  color: #111827 !important;
}
.cims-wrap.theme-light .mobile-nav-section {
  color: #6b7280;
}

/* Support on-page chat (no redirect) */
.support-onpage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.support-onpage-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.support-onpage-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.support-onpage-title {
  font-weight: 700;
  color: #111827;
}
.support-onpage-sub {
  font-size: 0.8rem;
  color: #6b7280;
}
.support-wa-frame-wrap {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #f0fdf4;
}
.support-wa-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.support-onpage-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
}
.support-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}
.support-msg p { margin: 4px 0 0; }
.support-msg-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #6b7280;
}
.support-msg-user {
  align-self: flex-end;
  background: #ecfdf5;
}
.support-msg-support {
  align-self: flex-start;
  background: #f3f4f6;
}
.support-onpage-form {
  display: flex;
  gap: 8px;
}
.support-onpage-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}
.support-onpage-note {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
}


/* Flag only — hide country name in topbar */
.topbar-flag .flag-country,
#flag-country {
  display: none !important;
}

/* Notifications empty state */
.notif-panel { padding: 8px 4px 4px; }
.notif-empty {
  text-align: center;
  padding: 28px 16px 20px;
  color: var(--text-muted, #6b7280);
}
.notif-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.notif-empty-title {
  font-weight: 700;
  color: var(--text, #111827);
  margin: 0 0 6px;
  font-size: 1rem;
}
.notif-empty-desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
}


/* WhatsApp click tracking in notifications (developer) */
.notif-wa-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.08);
  text-align: left;
}
.notif-wa-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #111827;
}
.notif-wa-title i { color: #25d366; margin-right: 6px; }
.notif-wa-hint {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: #6b7280;
}
.notif-wa-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.notif-wa-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  font-size: 0.82rem;
}
.notif-wa-who { font-weight: 600; color: #14532d; }
.notif-wa-meta { font-size: 0.72rem; color: #6b7280; margin-top: 2px; }


/* Dashboard traffic / location */
.traffic-card .traffic-note {
  margin: -4px 0 12px;
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
}
.traffic-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.traffic-live-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}
.traffic-live-pill.is-active {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
}
.traffic-filters select {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--card, #fff);
  color: inherit;
}
.traffic-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.traffic-stat {
  flex: 1;
  min-width: 100px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.08);
  text-align: center;
}
.traffic-stat-val {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text, #111827);
}
.traffic-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.traffic-sub {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
}
.traffic-list, .traffic-recent {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.82rem;
}
.traffic-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.05);
}
.cims-wrap:not(.theme-light) .traffic-row {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.06);
}
.traffic-row-meta {
  color: var(--text-muted, #6b7280);
  font-size: 0.75rem;
  white-space: nowrap;
}
.traffic-grid { margin-top: 4px; }


/* Traffic card — white titles/descriptions in dark mode */
.cims-wrap:not(.theme-light) .traffic-card .card-title,
.cims-wrap:not(.theme-light) .traffic-card .traffic-note,
.cims-wrap:not(.theme-light) .traffic-card .traffic-sub,
.cims-wrap:not(.theme-light) .traffic-card .traffic-stat-val,
.cims-wrap:not(.theme-light) .traffic-card .traffic-stat-lbl,
.cims-wrap:not(.theme-light) .traffic-card .traffic-row,
.cims-wrap:not(.theme-light) .traffic-card .traffic-row-meta,
.cims-wrap:not(.theme-light) .traffic-card .text-muted {
  color: #ffffff !important;
}
.cims-wrap:not(.theme-light) .traffic-card .traffic-note,
.cims-wrap:not(.theme-light) .traffic-card .traffic-stat-lbl,
.cims-wrap:not(.theme-light) .traffic-card .traffic-row-meta,
.cims-wrap:not(.theme-light) .traffic-card .text-muted {
  opacity: 0.9;
}
.cims-wrap:not(.theme-light) .traffic-card .traffic-live-pill {
  color: #e2e8f0;
}
.cims-wrap:not(.theme-light) .traffic-card .traffic-live-pill.is-active {
  color: #6ee7b7;
}

/* Traffic period filter: black text in dark mode for readability */
.cims-wrap:not(.theme-light) .traffic-filters select,
.cims-wrap:not(.theme-light) .traffic-filters select option,
.cims-wrap:not(.theme-light) #traffic-period {
  color: #000000 !important;
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}
.cims-wrap:not(.theme-light) .traffic-filters label,
.cims-wrap:not(.theme-light) .traffic-filters .filter-label {
  color: #000000 !important;
}


/* HELP CENTRE sidebar section */
.nav-section-help,
.mobile-nav-section-help {
  margin-top: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em;
  color: #a7f3d0 !important;
}
.cims-wrap.theme-light .nav-section-help {
  color: #047857 !important;
}

/* Payment / white modals: force black titles & body text even in dark mode */
.modal.theme-white .modal-header h2,
.modal.theme-white #modal-title,
.modal.theme-white .modal-body,
.modal.theme-white .modal-body label,
.modal.theme-white .modal-body p,
.modal.theme-white .modal-body strong,
.modal.theme-white .form-group label {
  color: #111827 !important;
}
.modal.theme-white .modal-body .text-muted,
.modal.theme-white .modal-body p[style*="text-muted"] {
  color: #374151 !important;
}

/* Settings horizontal feature tabs */
.cims-settings-tabs-wrap { overflow: visible; }
.cims-set-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: visible;
  overflow-y: visible;
  padding: 4px 0 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  scrollbar-width: none;
}
.cims-set-tabbar::-webkit-scrollbar { display: none; }
.cims-set-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.cims-set-tab i { font-size: 0.85rem; opacity: 0.85; }
.cims-set-tab:hover {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.cims-set-tab.active {
  background: #059669;
  border-color: #059669;
  color: #fff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.28);
}
.cims-set-tab.active i { opacity: 1; }
.cims-set-panel { min-height: 120px; }
.settings-white .cims-set-tab { color: #334155; }
.settings-white .cims-set-tab.active { color: #fff; }
@media (max-width: 640px) {
  .cims-set-tab span { display: none; }
  .cims-set-tab { padding: 10px 12px; }
  .cims-set-tab i { font-size: 1rem; margin: 0; }
}


/* Invoice list: card layout with top action tabs (no horizontal scroll) */
.cims-inv-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cims-inv-card {
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  overflow: hidden;
}
.cims-wrap.theme-light .cims-inv-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.cims-inv-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--border, #334155);
  background: rgba(0, 0, 0, 0.15);
}
.cims-wrap.theme-light .cims-inv-tabs {
  background: #f1f5f9;
  border-bottom-color: #e2e8f0;
}
.cims-inv-tab {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 0;
  border-right: 1px solid var(--border, #334155);
  background: transparent;
  color: var(--text, #e2e8f0);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.cims-wrap.theme-light .cims-inv-tab {
  color: #334155;
  border-right-color: #e2e8f0;
}
.cims-inv-tab:last-child { border-right: 0; }
.cims-inv-tab:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}
.cims-wrap.theme-light .cims-inv-tab:hover {
  background: #ecfdf5;
  color: #047857;
}
.cims-inv-tab.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.cims-wrap.theme-light .cims-inv-tab.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}
.cims-inv-tab i { font-size: 0.85rem; }
.cims-inv-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 16px;
  padding: 14px 16px 16px;
}
.cims-inv-field label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 2px;
  font-weight: 600;
}
.cims-inv-field .val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #f1f5f9);
  word-break: break-word;
}
.cims-wrap.theme-light .cims-inv-field .val { color: #0f172a; }
.cims-inv-field .val a {
  color: #34d399;
  text-decoration: none;
  font-weight: 700;
}
.cims-wrap.theme-light .cims-inv-field .val a { color: #059669; }
/* Disable horizontal table scroll on invoices page */
.cims-inv-list-wrap .table-wrap {
  overflow-x: visible !important;
  -webkit-overflow-scrolling: auto;
}
.cims-inv-list-wrap .table-wrap table {
  min-width: 0 !important;
  width: 100%;
}
@media (max-width: 640px) {
  .cims-inv-tab span.lbl { display: none; }
  .cims-inv-tab { padding: 12px 6px; }
}


/* Invoice action tabs at bottom of each card */
.cims-inv-tabs-bottom {
  border-bottom: 0;
  border-top: 1px solid var(--border, #334155);
}
.cims-wrap.theme-light .cims-inv-tabs-bottom {
  border-top-color: #e2e8f0;
}

/* Invoice filters: black title/text (including dark mode) */
.cims-wrap .filters select,
.cims-wrap .filters input,
.cims-wrap .filters select option,
.cims-wrap #filter-status,
.cims-wrap #filter-month {
  color: #000000 !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}
.cims-wrap .filters label,
.cims-wrap .filters .filter-label {
  color: #000000 !important;
}

/* No swipe / horizontal slide on invoice list */
.cims-inv-list-wrap,
.cims-inv-list,
.cims-inv-card {
  overflow-x: hidden !important;
  touch-action: pan-y !important;
  overscroll-behavior-x: none;
}


/* Modal blue backdrop (receipt PDF preview) */
.modal-overlay.blue-bg {
  background: rgba(30, 64, 175, 0.88) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* PDF / invoice HTML preview inside modal */
.cims-pdf-preview-scroll {
  max-height: min(70vh, 640px);
  overflow-y: auto;
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  color: #111;
}

/* Dashboard: Filter by month label white */
.cims-wrap .dash-month-filter-label,
.cims-wrap:not(.theme-light) .dash-month-filter-label {
  color: #ffffff !important;
}
.cims-wrap.theme-light .dash-month-filter-label {
  color: #0f172a !important;
}

/* All filter titles / controls black text */
.cims-wrap .filters,
.cims-wrap .filters label,
.cims-wrap .filters select,
.cims-wrap .filters input,
.cims-wrap .filters option,
.cims-wrap #filter-status,
.cims-wrap #filter-month,
.cims-wrap #dash-month-filter {
  color: #000000 !important;
}
.cims-wrap .filters select,
.cims-wrap .filters input,
.cims-wrap #filter-status,
.cims-wrap #filter-month,
.cims-wrap #dash-month-filter {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}
/* Keep the "Filter by month" label white on dark dashboard (override above) */
.cims-wrap:not(.theme-light) .dash-month-filter-label {
  color: #ffffff !important;
}


/* PDF preview table headers always white */
.cims-pdf-preview-force-white-th table thead th,
.cims-pdf-preview-scroll table thead th {
  color: #ffffff !important;
}

/* Subscription Expired label — red */
.cims-expired-label,
#logo-days-left-value.cims-expired-label,
#topbar-renew-countdown.cims-expired-label,
.sub-cd-num.cims-expired-label {
  color: #ef4444 !important;
  font-weight: 800 !important;
}
.cims-sub-expired #logo-days-left-value,
.logo-days-left.cims-sub-expired .days-left-value {
  color: #ef4444 !important;
}

/* Locked nav items when subscription expired */
.nav-item.cims-nav-locked,
.mobile-nav-item.cims-nav-locked {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

/* Customers: vertical actions left of name */
.cims-cust-swipe-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-size: 0.85rem;
  font-weight: 600;
}
.cims-wrap.theme-light .cims-cust-swipe-note {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.cims-cust-card {
  display: flex;
  gap: 14px;
  align-items: stretch;
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
}
.cims-wrap.theme-light .cims-cust-card {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.cims-cust-actions {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border, #334155);
  background: rgba(0, 0, 0, 0.15);
  min-width: 72px;
}
.cims-wrap.theme-light .cims-cust-actions {
  background: #f1f5f9;
  border-right-color: #e2e8f0;
}
.cims-cust-act {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--border, #334155);
  background: transparent;
  color: var(--text, #e2e8f0);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}
.cims-wrap.theme-light .cims-cust-act {
  color: #334155;
  border-bottom-color: #e2e8f0;
}
.cims-cust-act:last-child { border-bottom: 0; }
.cims-cust-act i { font-size: 0.95rem; }
.cims-cust-act:hover { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.cims-wrap.theme-light .cims-cust-act:hover { background: #ecfdf5; color: #047857; }
.cims-cust-act.danger:hover { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.cims-wrap.theme-light .cims-cust-act.danger:hover { background: #fef2f2; color: #b91c1c; }
.cims-cust-main {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
}
.cims-cust-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text, #f1f5f9);
}
.cims-wrap.theme-light .cims-cust-name { color: #0f172a; }
.cims-cust-meta {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.55;
}
.cims-cust-meta i { width: 16px; margin-right: 4px; opacity: 0.8; }


/* Payments analytics period label — white in dark mode */
.cims-wrap:not(.theme-light) .pay-analytics-label {
  color: #ffffff !important;
}
.cims-wrap.theme-light .pay-analytics-label {
  color: #0f172a !important;
}

/* Business Tips */
.cims-tips-wrap .cims-set-tabbar { margin-bottom: 16px; }
.cims-tips-card {
  padding: 4px 2px 8px;
}
.cims-tips-card h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 700;
}
.cims-tips-card h4 {
  margin: 16px 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #10b981;
}
.cims-tips-card ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
  font-size: 0.92rem;
}
.cims-tips-card li { margin-bottom: 8px; }
.cims-tips-disclaimer {
  font-size: 0.8rem;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}
.cims-wrap.theme-light .cims-tips-disclaimer {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}


/* Legal templates & geo */
.cims-geo-pill {
  font-size: 0.82rem;
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}
.cims-wrap.theme-light .cims-geo-pill {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.cims-legal-doc {
  margin: 0 0 12px;
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.12);
}
.cims-wrap.theme-light .cims-legal-doc {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.cims-legal-doc summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  list-style: none;
}
.cims-legal-doc summary::-webkit-details-marker { display: none; }
.cims-legal-doc-body {
  white-space: pre-wrap;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  max-height: 280px;
  overflow-y: auto;
}
.cims-wrap.theme-light .cims-legal-doc-body {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}


/* Settings: live PDF template preview */
.cims-pdf-live-preview-wrap {
  margin-top: 24px;
  border: 1px solid var(--border, #334155);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.15);
}
.cims-wrap.theme-light .cims-pdf-live-preview-wrap {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.cims-pdf-live-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #334155);
}
.cims-pdf-live-preview-type {
  display: flex;
  gap: 8px;
}
.cims-pdf-type-btn.active {
  background: #059669 !important;
  color: #fff !important;
  border-color: #059669 !important;
}
.cims-pdf-live-preview-frame {
  max-height: min(70vh, 720px);
  overflow: auto;
  padding: 16px;
  background: #64748b;
}
.cims-wrap.theme-light .cims-pdf-live-preview-frame {
  background: #94a3b8;
}
.cims-pdf-live-preview-inner {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  overflow: auto;
}
.cims-pdf-live-preview-inner table thead th {
  color: #ffffff !important;
}
.cims-pdf-live-preview-loading {
  text-align: center;
  padding: 40px 16px;
  color: #f8fafc;
  font-size: 0.9rem;
}


/* Caribbean legal comparison table */
.cims-legal-compare-wrap {
  overflow-x: auto;
  margin: 14px 0 18px;
  border-radius: 10px;
  border: 1px solid var(--border, #334155);
}
.cims-legal-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 900px;
}
.cims-legal-compare th,
.cims-legal-compare td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border, #334155);
  line-height: 1.4;
}
.cims-legal-compare thead th {
  background: #059669;
  color: #ffffff !important;
  font-weight: 700;
  position: sticky;
  top: 0;
}
.cims-legal-compare tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.12);
}
.cims-wrap.theme-light .cims-legal-compare tbody tr:nth-child(even) {
  background: #f1f5f9;
}
.cims-wrap.theme-light .cims-legal-compare-wrap {
  border-color: #e2e8f0;
}


/* Accounting nav group */
.nav-group { margin-bottom: 2px; }
.nav-item-parent { position: relative; }
.nav-item-parent .nav-chevron {
  margin-left: auto;
  width: auto;
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}
.nav-group.open .nav-item-parent .nav-chevron { transform: rotate(180deg); }
.nav-sub {
  padding: 2px 0 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-sub[hidden] { display: none !important; }
.nav-sub-item {
  padding: 9px 12px 9px 28px !important;
  font-size: 0.84rem !important;
}
.nav-sub-item i { font-size: 0.85rem; }

/* Accounting views */
.cims-acct-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cims-acct-tabs .btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.cims-acct-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-end;
}
.cims-acct-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.cims-acct-filters input,
.cims-acct-filters select {
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, #fff);
  color: var(--text);
  font-size: 0.85rem;
}
.cims-acct-table-wrap { overflow-x: auto; }
.cims-acct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.cims-acct-table th,
.cims-acct-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.cims-acct-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.cims-coa-section { margin-bottom: 22px; }
.cims-coa-section h3 {
  font-size: 1rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cims-coa-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg-elevated, #fff);
}
.cims-coa-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.cims-coa-group-head:hover { background: var(--bg-hover); }
.cims-coa-group-body {
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
}
.cims-coa-account {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cims-coa-account:last-child { border-bottom: none; }
.cims-coa-account .name { font-weight: 600; font-size: 0.9rem; }
.cims-coa-account .desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.cims-coa-account .meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.cims-recon-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, #f8fafc);
  margin-bottom: 14px;
}
.cims-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.cims-toggle input { accent-color: var(--primary); width: 18px; height: 18px; }

/* ========== Accounting: Transactions & Chart of Accounts text colors ========== */
.cims-accounting-page,
.cims-accounting-page .cims-coa-section,
.cims-accounting-page .cims-coa-section h3,
.cims-accounting-page .cims-coa-group-head,
.cims-accounting-page .cims-coa-group-head span,
.cims-accounting-page .cims-coa-account .name,
.cims-accounting-page .cims-coa-account .desc,
.cims-accounting-page .cims-coa-account .meta,
.cims-accounting-page .cims-coa-group-body,
.cims-accounting-page .cims-coa-group-body p,
.cims-accounting-page .cims-recon-banner,
.cims-accounting-page .cims-recon-banner .text-muted,
.cims-accounting-page .cims-recon-banner strong,
.cims-accounting-page .cims-acct-filters,
.cims-accounting-page .cims-acct-filters label,
.cims-accounting-page .cims-acct-table,
.cims-accounting-page .cims-acct-table th,
.cims-accounting-page .cims-acct-table td,
.cims-accounting-page .text-muted,
.cims-accounting-page h2,
.cims-accounting-page h3,
.cims-accounting-page h4,
.cims-accounting-page p,
.cims-accounting-page td,
.cims-accounting-page th,
.cims-accounting-page label,
.cims-accounting-page .card-title,
.cims-accounting-page .card-header {
  color: #000000 !important;
}
/* Buttons keep white titles/labels */
.cims-accounting-page .btn,
.cims-accounting-page .btn *,
.cims-accounting-page button.btn,
.cims-accounting-page button.btn *,
.cims-accounting-page .cims-acct-tabs .btn,
.cims-accounting-page .cims-acct-tabs .btn * {
  color: #ffffff !important;
}

/* Transactions page: table headers + empty state white; filter labels white; inputs black */
.cims-accounting-page .cims-acct-table thead th,
.cims-accounting-page .cims-acct-table th {
  color: #ffffff !important;
}
.cims-accounting-page .cims-acct-table .cims-acct-empty,
.cims-accounting-page td.cims-acct-empty {
  color: #ffffff !important;
  text-align: center;
  padding: 28px;
}
.cims-accounting-page .cims-acct-filters > label {
  color: #ffffff !important;
}
.cims-accounting-page .cims-acct-filters input,
.cims-accounting-page .cims-acct-filters select,
.cims-accounting-page .cims-acct-filters option {
  color: #000000 !important;
}
.cims-accounting-page .cims-acct-filters input::placeholder {
  color: #333333 !important;
  opacity: 1;
}

/* ========== THEME TOGGLE (right center) ========== */
.cims-theme-toggle {
  position: fixed !important;
  right: 20px !important;
  top: 50% !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 1000002 !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  border: 1px solid var(--border, #2a2e3b) !important;
  background: var(--bg-card, #1e2230) !important;
  color: var(--text, #e4e6f0) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35) !important;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  margin: 0 !important;
  padding: 0 !important;
}
.cims-theme-toggle:hover {
  background: var(--bg-hover, #2a2e3b) !important;
  border-color: var(--primary, #10b981) !important;
  transform: translateY(-50%) scale(1.06) !important;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.25) !important;
}
.cims-theme-toggle:active {
  transform: translateY(-50%) scale(0.97) !important;
}
body.cims-theme-light .cims-theme-toggle,
.cims-wrap.theme-light .cims-theme-toggle {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #111827 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}

@media (max-width: 782px) {
  .cims-theme-toggle {
    right: 12px !important;
    width: 42px !important;
    height: 42px !important;
  }
}


/* Theme via body class (works even if toggle is outside .cims-wrap) */
body.cims-theme-light .cims-wrap {
  --bg-dark: #f3f4f6;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  background: var(--bg-dark);
  color: var(--text);
}
body.cims-theme-light .cims-theme-toggle .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
body.cims-theme-light .cims-theme-toggle .theme-icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
  color: #f59e0b;
}
/* FORCE LIGHT THEME OVERRIDES */

/* FORCE LIGHT THEME OVERRIDES — beat hardcoded #161922 !important */
.cims-wrap.theme-light,
.cims-wrap.theme-light.fullscreen,
.cims-wrap.theme-light.cims-app-shell,
body.cims-theme-light .cims-wrap,
body.cims-theme-light .cims-wrap.fullscreen,
body.cims-theme-light .cims-wrap.cims-app-shell {
  background: #f3f4f6 !important;
  color: #111827 !important;
}
body.cims-theme-light,
html.cims-theme-light body {
  background: #f3f4f6 !important;
}
.cims-wrap.theme-light #cims-app-root,
.cims-wrap.theme-light #app,
.cims-wrap.theme-light .main,
.cims-wrap.theme-light .content,
body.cims-theme-light .cims-wrap #cims-app-root,
body.cims-theme-light .cims-wrap #app,
body.cims-theme-light .cims-wrap .main,
body.cims-theme-light .cims-wrap .content {
  background: #f3f4f6 !important;
  color: #111827 !important;
}
.cims-wrap.theme-light .cims-sidebar,
body.cims-theme-light .cims-wrap .cims-sidebar {
  background: #ffffff !important;
  border-right-color: #e5e7eb !important;
  color: #111827 !important;
}
.cims-wrap.theme-light .topbar,
body.cims-theme-light .cims-wrap .topbar {
  background: #ffffff !important;
  border-bottom-color: #e5e7eb !important;
  color: #111827 !important;
}
.cims-wrap.theme-light .page-title,
body.cims-theme-light .cims-wrap .page-title {
  color: #111827 !important;
}
.cims-wrap.theme-light .card,
body.cims-theme-light .cims-wrap .card {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #111827 !important;
}
.cims-wrap.theme-light .nav-item,
body.cims-theme-light .cims-wrap .nav-item {
  color: #4b5563 !important;
}
.cims-wrap.theme-light .nav-item:hover,
.cims-wrap.theme-light .nav-item.active,
body.cims-theme-light .cims-wrap .nav-item:hover,
body.cims-theme-light .cims-wrap .nav-item.active {
  background: #f3f4f6 !important;
  color: #059669 !important;
}
.cims-wrap.theme-light .search-box,
body.cims-theme-light .cims-wrap .search-box {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
}
.cims-wrap.theme-light .search-box input,
body.cims-theme-light .cims-wrap .search-box input {
  color: #111827 !important;
}
.cims-wrap.theme-light .icon-btn,
body.cims-theme-light .cims-wrap .icon-btn {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #4b5563 !important;
}
.cims-wrap.theme-light table th,
.cims-wrap.theme-light table td,
body.cims-theme-light .cims-wrap table th,
body.cims-theme-light .cims-wrap table td {
  color: #111827 !important;
  border-bottom-color: #e5e7eb !important;
}
.cims-wrap.theme-light .logo-text,
body.cims-theme-light .cims-wrap .logo-text {
  color: #111827 !important;
}
.cims-wrap.theme-light .nav-section,
body.cims-theme-light .cims-wrap .nav-section {
  color: #6b7280 !important;
}
