:root {
  --bg-dark: #0f172a;
  --bg-glass: rgba(30, 41, 59, 0.7);
  --border-glass: rgba(255, 255, 255, 0.1);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #8b5cf6;
  --secondary-hover: #7c3aed;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glow-orange: rgba(249, 115, 22, 0.2);
  --glow-green: rgba(34, 197, 94, 0.2);
  --glow-red: rgba(239, 68, 68, 0.2);
  --gradient-bg: linear-gradient(135deg, #0f172a 0%, #171131 100%);
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-color: white;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--gradient-bg);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 8px 32px 0 rgba(0, 0, 0, 0.22);
}

.glass-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.4rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.glass-header h1 {
  font-size: 1.15rem;
  font-weight: 600;
  background: linear-gradient(to right, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.fee-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.fee-brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #14b8a6, #3b82f6);
  box-shadow: 0 12px 26px rgba(20, 184, 166, 0.22);
  flex: 0 0 auto;
}

.fee-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fee-brand span {
  display: block;
  max-width: min(56vw, 620px);
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-chip {
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.65rem 1rem;
}

.user-profile .avatar {
  background: var(--border-glass);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dashboard-content {
  padding: 1rem 1.4rem 2rem;
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.controls {
  padding: 0;
  overflow: hidden;
}

.filter-panel-toggle {
  width: 100%;
  padding: 1rem 1.15rem;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-main);
  text-align: left;
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(20, 184, 166, 0.12)),
    rgba(15, 23, 42, 0.34);
  border-bottom: 1px solid var(--border-glass);
}

.filter-panel-toggle strong {
  display: block;
  font-size: 1rem;
}

.filter-panel-toggle small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.filter-panel-toggle > i {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #bfdbfe;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.controls.is-collapsed .filter-panel-toggle > i {
  transform: rotate(180deg);
}

.filter-panel-body {
  padding: 0.95rem;
}

.controls.is-collapsed .filter-panel-toggle {
  border-radius: 12px;
}

.controls.is-collapsed .filter-panel-body {
  display: none;
}

.controls.hidden {
  display: none;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.fr-report-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  padding: 0.42rem;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.82)),
    rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

.fr-report-tab {
  position: relative;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.25rem;
  border-radius: 13px;
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.fr-report-tab i {
  font-size: 1.12rem;
  color: #0891b2;
  transition: color 0.18s ease, transform 0.18s ease;
}

.fr-report-tab:hover {
  transform: translateY(-1px);
  color: #0f172a;
  border-color: rgba(8, 145, 178, 0.28);
  background: rgba(236, 253, 245, 0.82);
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.12);
}

.fr-report-tab.is-active {
  color: #ffffff;
  border-color: rgba(14, 165, 233, 0.72);
  background: linear-gradient(135deg, #2563eb 0%, #0891b2 58%, #0f766e 100%);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.fr-report-tab.is-active i {
  color: #ffffff;
  transform: scale(1.05);
}

.fr-report-tab.is-active::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 7px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.receipt-lookup-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 520px);
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.receipt-lookup-panel.hidden {
  display: none;
}

.collection-date-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(360px, 620px);
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.collection-date-panel.hidden {
  display: none;
}

.collection-date-controls.date-range-row {
  grid-column: auto;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  margin: 0;
  padding: 0.8rem;
}

.receipt-lookup-copy h2 {
  margin: 0.15rem 0 0.25rem;
  font-size: clamp(1.25rem, 2vw, 1.85rem);
  color: var(--text-main);
}

.receipt-lookup-copy p {
  margin: 0;
  color: var(--text-muted);
}

.receipt-lookup-controls .input-group {
  margin: 0;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    rgba(15, 23, 42, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.filter-grid > .input-group:nth-child(3n + 1) {
  border-color: rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.11), rgba(255, 255, 255, 0.02));
}

.filter-grid > .input-group:nth-child(3n + 2) {
  border-color: rgba(20, 184, 166, 0.19);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(255, 255, 255, 0.02));
}

.filter-grid > .input-group:nth-child(3n) {
  border-color: rgba(245, 158, 11, 0.18);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(255, 255, 255, 0.02));
}

.input-group label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.receipt-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.btn-mini-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.btn-mini-search:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-main) !important;
  cursor: pointer;
}

.inline-check input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
}

.date-filter-toggle small {
  color: var(--text-muted);
  line-height: 1.45;
}

.date-range-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) repeat(2, minmax(190px, 1fr));
  align-items: end;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.13), rgba(20, 184, 166, 0.08)),
    rgba(15, 23, 42, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: opacity 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

.date-range-row.is-disabled {
  opacity: 0.55;
  filter: saturate(0.65);
  border-color: rgba(148, 163, 184, 0.18);
}

.date-range-row.is-disabled input {
  cursor: not-allowed;
}

.date-range-row input[type="date"] {
  min-height: 46px;
}

.optional-date-row {
  border-color: rgba(20, 184, 166, 0.24);
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(59, 130, 246, 0.08)),
    rgba(15, 23, 42, 0.18);
}

select, input:not([type="radio"]) {
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  color: var(--input-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256' fill='%2394a3b8'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80A8 8 0 0 1 48 88h160a8 8 0 0 1 5.66 13.66z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
}

input[type="checkbox"] {
  padding: 0;
  border-radius: 4px;
}

select:focus, input:not([type="radio"]):focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  background: rgba(30, 41, 59, 0.9);
}

.divider {
    border: none;
    border-top: 1px solid var(--border-glass);
    margin: 1.5rem 0;
}

.scope-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.control-box {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-width: 240px;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(15, 23, 42, 0.2));
}

.control-box h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.control-box label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-main);
    transition: color 0.2s;
}

.control-box label:hover {
    color: var(--primary);
}

input[type="radio"] {
    accent-color: var(--primary);
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.actions {
  display: flex;
  gap: 1.5rem;
}

.report-generate-actions {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 10000;
  width: auto;
  padding: 0.65rem;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.34);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

.report-generate-actions .btn-primary {
  min-width: 190px;
  min-height: 48px;
  border-radius: 14px;
}

button {
  padding: 0.85rem 1.75rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.5);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-msg {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    border-radius: 4px;
    color: #fca5a5;
    font-size: 0.95rem;
}

.error-msg::before {
    content: "⚠";
    display: inline-block;
    margin-right: 0.5rem;
    color: #f87171;
    font-weight: 700;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-card h3 {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.stat-icon {
  display: inline-flex;
  margin-bottom: 0.85rem;
  font-size: 2rem;
  line-height: 1;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  transition: opacity 0.25s ease;
}

.orange-glow { box-shadow: 0 0 40px var(--glow-orange) inset; }
.green-glow { box-shadow: 0 0 40px var(--glow-green) inset; }
.red-glow { box-shadow: 0 0 40px var(--glow-red) inset; }

.orange-glow .stat-icon,
.orange-glow .stat-value { color: #fb923c; }

.green-glow .stat-icon,
.green-glow .stat-value { color: #4ade80; }

.red-glow .stat-icon,
.red-glow .stat-value { color: #f87171; }

.grid-section {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.grid-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.btn-outline i {
  font-size: 1rem;
  line-height: 1;
}

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
}

.btn-remind {
  border-color: rgba(34, 197, 94, 0.24);
}

.btn-remind:hover {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.14);
}

.action-divider {
  width: 1px;
  align-self: stretch;
  min-height: 34px;
  background: rgba(255, 255, 255, 0.15);
}

.fee-report-grid {
  width: 100%;
  height: min(68vh, 760px);
  min-height: 500px;
}

/* Custom AG-Grid modifications */
.ag-theme-alpine-dark {
  --ag-background-color: transparent !important;
  --ag-header-background-color: rgba(15, 23, 42, 0.5) !important;
  --ag-border-color: rgba(255, 255, 255, 0.08) !important;
  --ag-row-border-color: rgba(255, 255, 255, 0.04) !important;
  --ag-data-color: #0f172a !important;
  --ag-font-family: inherit !important;
  --ag-header-foreground-color: #94a3b8 !important;
  border-radius: 8px;
  overflow: hidden;
}

.ag-theme-alpine-dark .ag-root-wrapper {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ag-theme-alpine-dark .ag-row {
  background: #ffffff !important;
  color: #0f172a !important;
}

.ag-theme-alpine-dark .ag-row:nth-child(even) {
  background: #f8fafc !important;
}

.ag-theme-alpine-dark .ag-cell,
.ag-theme-alpine-dark .ag-cell-value {
  color: #0f172a !important;
  font-weight: 600;
}

.ag-theme-alpine-dark .ag-row-hover {
  background-color: rgba(59, 130, 246, 0.12) !important;
}

.ag-theme-alpine-dark .ag-row-hover .ag-cell,
.ag-theme-alpine-dark .ag-row-hover .ag-cell-value,
.ag-theme-alpine-dark .ag-row-selected .ag-cell,
.ag-theme-alpine-dark .ag-row-selected .ag-cell-value {
  color: #0f172a !important;
}

.ag-theme-alpine-dark .ag-cell[col-id="paidAmount"],
.ag-theme-alpine-dark .ag-cell[col-id="grandTotalPaid"] {
  color: #22c55e !important;
  font-weight: 700 !important;
}

.ag-theme-alpine-dark .ag-cell[col-id="remaining"],
.ag-theme-alpine-dark .ag-cell[col-id="grandRemaining"] {
  color: #ef4444 !important;
  font-weight: 700 !important;
}

.ag-theme-alpine-dark .ag-header-cell {
  font-weight: 600;
  font-size: 0.95rem;
}

.ag-theme-alpine-dark .ag-pinned-bottom-row {
  background: rgba(219, 234, 254, 0.96) !important;
  border-top: 1px solid rgba(37, 99, 235, 0.38) !important;
  font-weight: 800;
}

.ag-theme-alpine-dark .ag-pinned-bottom-row .ag-cell,
.ag-theme-alpine-dark .ag-pinned-bottom-row .ag-cell-value {
  color: #0f172a !important;
  font-weight: 800 !important;
}

.erp-grid-loading,
.erp-grid-empty {
  min-width: 260px;
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  padding: 1.2rem 1.35rem;
  color: #475569;
  text-align: center;
}

.erp-grid-loading .erp-loading-skeleton {
  width: 220px;
  height: 12px;
}

.erp-grid-empty i {
  width: 56px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-size: 1.7rem;
}

.erp-grid-empty strong,
.erp-grid-loading strong {
  color: #0f172a;
  font-size: 0.98rem;
}

/* Multiple Themes */
body.theme-light {
  --bg-dark: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-glass: rgba(0, 0, 0, 0.1);
  --primary: #2563eb;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --gradient-bg: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --input-bg: rgba(255, 255, 255, 0.8);
  --input-color: #1e293b;
}

body.theme-light .ag-theme-alpine-dark {
  --ag-header-background-color: rgba(241, 245, 249, 0.8) !important;
  --ag-header-foreground-color: #334155 !important;
  --ag-data-color: #1e293b !important;
  --ag-border-color: rgba(0, 0, 0, 0.1) !important;
  --ag-row-border-color: rgba(0, 0, 0, 0.05) !important;
  --ag-background-color: rgba(255, 255, 255, 0.4) !important;
  --ag-odd-row-background-color: rgba(241, 245, 249, 0.6) !important;
}
body.theme-light .ag-theme-alpine-dark .ag-row-hover {
  background-color: rgba(0, 0, 0, 0.03) !important;
}

body.theme-ocean {
  --bg-dark: #082f49;
  --bg-glass: rgba(12, 74, 110, 0.75);
  --border-glass: rgba(56, 189, 248, 0.2);
  --primary: #0ea5e9;
  --text-main: #f0f9ff;
  --text-muted: #bae6fd;
  --gradient-bg: linear-gradient(135deg, #0c4a6e 0%, #082f49 100%);
  --input-bg: rgba(8, 47, 73, 0.6);
  --input-color: #f0f9ff;
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.theme-select {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--bg-glass);
}

.theme-fab-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
}

.theme-fab-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(14, 165, 233, 0.9));
  color: white;
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.28);
}

.theme-fab-btn i {
  font-size: 1.2rem;
  color: #fff;
  line-height: 1;
}

.theme-fab-panel {
  position: absolute;
  right: 0;
  bottom: 60px;
  min-width: 180px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border-glass);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.3);
}

.theme-fab-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.theme-fab-panel.hidden {
  display: none;
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .dashboard-content {
    width: 100%;
    padding: 0.75rem 0.7rem 1rem;
    gap: 0.8rem;
  }

  .glass-header {
    position: sticky;
    top: 0;
    padding: 0.7rem 0.8rem;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .fee-brand {
    width: 100%;
  }

  .fee-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .fee-brand span {
    max-width: calc(100vw - 6.5rem);
    font-size: 0.82rem;
  }

  .glass-header h1 {
    font-size: 1.05rem;
  }

  .back-chip {
    width: 100%;
    text-align: center;
    min-height: 42px;
    padding: 0.55rem 0.8rem;
  }

  .filter-panel-toggle {
    padding: 0.85rem;
    border-radius: 16px 16px 0 0;
  }

  .filter-panel-toggle strong {
    font-size: 0.95rem;
  }

  .filter-panel-toggle small {
    font-size: 0.74rem;
    line-height: 1.35;
  }

  .filter-panel-body {
    padding: 0.75rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .input-group {
    padding: 0.65rem;
    border-radius: 12px;
  }

  select,
  input:not([type="radio"]) {
    min-height: 44px;
    width: 100%;
    font-size: 16px;
  }

  .receipt-search-row {
    grid-template-columns: 1fr;
  }

  .btn-mini-search {
    min-height: 42px;
  }

  .date-range-row {
    grid-template-columns: 1fr;
    padding: 0.65rem;
    gap: 0.55rem;
  }

  .scope-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .control-box {
    min-width: 0;
    padding: 0.8rem;
    border-radius: 14px;
  }

  .control-box label {
    min-height: 34px;
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 0.7rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
  }

  .stat-card {
    min-width: 150px;
    padding: 0.95rem 0.8rem;
    border-radius: 14px;
  }

  .stat-icon {
    margin-bottom: 0.35rem;
    font-size: 1.35rem;
  }

  .stat-card h3 {
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
  }

  .stat-value {
    font-size: 1.25rem;
    overflow-wrap: anywhere;
  }

  .grid-section {
    padding: 0.8rem;
    border-radius: 16px;
    min-width: 0;
    overflow: hidden;
  }

  .grid-header {
    align-items: stretch;
    margin-bottom: 0.8rem;
  }

  .grid-header h2 {
    font-size: 1rem;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .header-actions .btn-outline {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.6rem;
    font-size: 0.82rem;
    white-space: normal;
  }

  .header-actions .action-divider {
    display: none;
  }

  .fee-report-grid {
    min-width: 780px;
    height: min(64vh, 620px);
    min-height: 430px;
  }

  .ag-theme-alpine-dark {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ag-theme-alpine-dark .ag-root-wrapper {
    min-width: 780px;
  }

  .report-generate-actions {
    left: 0.85rem;
    right: 0.85rem;
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    justify-content: center;
    padding: 0.55rem;
    border-radius: 18px;
  }

  .report-generate-actions .btn-primary {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    font-size: 1rem;
  }
}

@media (max-width: 420px) {
  .header-actions {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(136px, 1fr));
  }

  .stat-card {
    min-width: 136px;
  }

  .fee-report-grid,
  .ag-theme-alpine-dark .ag-root-wrapper {
    min-width: 720px;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  .glass-header, .controls, .stats-row, hr, .header-actions {
    display: none !important;
  }
  .grid-section {
    padding: 0;
    box-shadow: none;
    border: none;
    background: transparent;
  }
  #myGrid {
    height: auto !important;
  }
  .ag-theme-alpine-dark {
    --ag-background-color: white !important;
    --ag-header-background-color: #f1f5f9 !important;
    --ag-header-foreground-color: black !important;
    --ag-data-color: black !important;
    --ag-border-color: #ccc !important;
    --ag-row-border-color: #eee !important;
  }
}

@media screen {
  :root {
    --fee-index-bg: #f5f7fb;
    --fee-index-panel: #ffffff;
    --fee-index-text: #172033;
    --fee-index-muted: #64748b;
    --fee-index-line: #dbe3ef;
    --fee-index-blue: #2563eb;
    --fee-index-green: #0f9f6e;
    --fee-index-amber: #d97706;
    --fee-index-rose: #e11d48;
    --fee-index-cyan: #0891b2;
    --fee-index-shadow: 0 18px 44px rgba(15, 23, 42, 0.11);
  }

  body {
    --bg-glass: rgba(255, 255, 255, 0.86);
    --border-glass: rgba(219, 227, 239, 0.96);
    --primary: var(--fee-index-blue);
    --primary-hover: #1d4ed8;
    --secondary: #7c3aed;
    --text-main: var(--fee-index-text);
    --text-muted: var(--fee-index-muted);
    --input-bg: rgba(255, 255, 255, 0.92);
    --input-color: var(--fee-index-text);
    --gradient-bg:
      radial-gradient(circle at 12% 2%, rgba(37, 99, 235, 0.10), transparent 28%),
      radial-gradient(circle at 88% 0%, rgba(8, 145, 178, 0.12), transparent 30%),
      linear-gradient(135deg, #f8fbff 0%, #eef4fb 48%, #e6edf5 100%);
    background: var(--gradient-bg);
    color: var(--fee-index-text);
  }

  .glass-panel {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
    border: 1px solid var(--fee-index-line);
    box-shadow: var(--fee-index-shadow);
  }

  .glass-header {
    width: min(1600px, calc(100% - 28px));
    margin: 0.7rem auto 0;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(191, 212, 242, 0.78);
    border-radius: 18px;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(233, 241, 255, 0.92));
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.10);
  }

  .glass-header h1 {
    color: #315fdc;
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: clamp(1.45rem, 2vw, 1.9rem);
    font-weight: 800;
  }

  .fee-brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #24b7c7, #2563eb);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.22);
  }

  .fee-brand span {
    color: #64748b;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .dashboard-content {
    max-width: 1640px;
    padding-top: 1rem;
    gap: 1.35rem;
  }

  .controls {
    border-radius: 8px;
  }

  .filter-panel-toggle {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(191, 212, 242, 0.78);
    background:
      linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(8, 145, 178, 0.11), rgba(255, 255, 255, 0.92));
    color: var(--fee-index-text);
  }

  .filter-panel-toggle strong {
    font-size: 1.05rem;
    font-weight: 800;
  }

  .filter-panel-toggle small,
  .input-group label,
  .control-box h3 {
    color: var(--fee-index-muted);
  }

  .filter-panel-toggle > i {
    background: rgba(37, 99, 235, 0.10);
    color: var(--fee-index-blue);
  }

  .filter-panel-body {
    padding: 1.15rem;
  }

  .filter-grid {
    gap: 0.85rem;
  }

  .input-group {
    border-radius: 8px;
    border-color: rgba(191, 212, 242, 0.78);
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.70));
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  }

  .filter-grid > .input-group:nth-child(3n + 2) {
    border-color: rgba(15, 159, 110, 0.18);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(236, 253, 245, 0.72));
  }

  .filter-grid > .input-group:nth-child(3n) {
    border-color: rgba(217, 119, 6, 0.18);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 235, 0.76));
  }

  select,
  input:not([type="radio"]) {
    border: 1px solid rgba(203, 213, 225, 0.92);
    background-color: rgba(255, 255, 255, 0.94);
    color: var(--fee-index-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  }

  select:focus,
  input:not([type="radio"]):focus {
    background: #ffffff;
    border-color: var(--fee-index-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  }

  .inline-check {
    color: var(--fee-index-text) !important;
    font-weight: 700;
  }

  .date-range-row {
    border-radius: 8px;
    border-color: rgba(191, 212, 242, 0.84);
    background:
      linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(8, 145, 178, 0.06)),
      rgba(248, 251, 255, 0.94);
  }

  .date-range-row.is-disabled {
    opacity: 1;
    filter: none;
    background:
      linear-gradient(135deg, rgba(100, 116, 139, 0.10), rgba(226, 232, 240, 0.42)),
      rgba(248, 250, 252, 0.94);
  }

  .date-range-row.is-disabled .input-group {
    opacity: 0.66;
    box-shadow: none;
  }

  .control-box {
    border-radius: 8px;
    border-color: rgba(191, 212, 242, 0.84);
    background:
      linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(37, 99, 235, 0.06)),
      rgba(255, 255, 255, 0.78);
  }

  .control-box label {
    color: var(--fee-index-text);
  }

  .btn-outline {
    border-color: rgba(203, 213, 225, 0.96);
    background: rgba(255, 255, 255, 0.82);
    color: var(--fee-index-text);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
  }

  .btn-outline:hover {
    border-color: rgba(37, 99, 235, 0.36);
    background: rgba(239, 246, 255, 0.94);
  }

  .btn-primary,
  .btn-mini-search {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
  }

  .report-generate-actions {
    border-radius: 8px;
    border-color: rgba(148, 163, 184, 0.30);
    background: rgba(30, 41, 59, 0.90);
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.26);
  }

  .report-generate-actions .btn-primary {
    border-radius: 8px;
    font-weight: 800;
  }

  .stats-row {
    gap: 1rem;
  }

  .stat-card {
    border-radius: 8px;
    padding: 1.4rem 1.15rem;
    text-align: left;
    min-height: 132px;
  }

  .stat-card::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0;
    height: 4px;
    border-radius: 999px 999px 0 0;
    background: currentColor;
  }

  .stat-card h3 {
    color: var(--fee-index-muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .stat-value {
    color: var(--fee-index-text);
    font-size: clamp(2rem, 3vw, 2.8rem);
  }

  .orange-glow {
    color: var(--fee-index-amber);
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.08), var(--fee-index-shadow);
  }

  .green-glow {
    color: var(--fee-index-green);
    box-shadow: inset 0 0 0 1px rgba(15, 159, 110, 0.08), var(--fee-index-shadow);
  }

  .red-glow {
    color: var(--fee-index-rose);
    box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.08), var(--fee-index-shadow);
  }

  .orange-glow .stat-icon,
  .orange-glow .stat-value {
    color: var(--fee-index-amber);
  }

  .green-glow .stat-icon,
  .green-glow .stat-value {
    color: var(--fee-index-green);
  }

  .red-glow .stat-icon,
  .red-glow .stat-value {
    color: #ef4444;
  }

  .grid-section {
    border-radius: 8px;
    padding: 1.35rem;
  }

  .grid-header h2 {
    color: var(--fee-index-text);
    font-weight: 800;
  }

  .action-divider {
    background: var(--fee-index-line);
  }

  .ag-theme-alpine-dark {
    --ag-background-color: #ffffff !important;
    --ag-header-background-color: #eef6ff !important;
    --ag-header-foreground-color: #334155 !important;
    --ag-border-color: #dbe3ef !important;
    --ag-row-border-color: #edf2f7 !important;
    --ag-odd-row-background-color: #f8fbff !important;
    --ag-row-hover-color: #e0f2fe !important;
    border-radius: 8px;
  }

  .ag-theme-alpine-dark .ag-root-wrapper {
    border-color: var(--fee-index-line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  }

  .ag-theme-alpine-dark .ag-header {
    border-bottom: 1px solid var(--fee-index-line);
  }

  .ag-theme-alpine-dark .ag-row:nth-child(even) {
    background: #f8fbff !important;
  }

  .ag-theme-alpine-dark .ag-row:nth-child(odd) {
    background: #ffffff !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   FEE REPORTS UI ENHANCEMENTS — matching index page design system
   ═══════════════════════════════════════════════════════════════ */

/* ── Logo pulse ring ─────────────────────────────────────────── */
@keyframes frLogoPulse {
  0%   { opacity: 0.9; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.55); }
  100% { opacity: 0;   transform: scale(1.55); }
}

.fee-brand-logo {
  position: relative;
}

.fee-brand-logo::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 19px;
  border: 2px solid rgba(59, 130, 246, 0.55);
  opacity: 0;
  animation: frLogoPulse 2.6s ease-out 0.5s infinite;
  pointer-events: none;
}

/* ── Header end group (clock + back) ────────────────────────── */
.fr-header-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Clock chip ──────────────────────────────────────────────── */
.fr-clock {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* ── Back chip icon ──────────────────────────────────────────── */
.back-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.back-chip i {
  font-size: 1rem;
}

/* ── Fee module nav tabs ─────────────────────────────────────── */
.fr-module-nav {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
}

.fr-module-nav::-webkit-scrollbar {
  display: none;
}

.fr-module-nav-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  min-width: max-content;
}

.fr-nav-tab {
  position: relative;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.fr-nav-tab i {
  font-size: 1rem;
  opacity: 0.8;
}

.fr-nav-tab:hover {
  border-color: rgba(14, 165, 233, 0.28);
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
}

.fr-nav-tab.is-current {
  border-color: rgba(14, 165, 233, 0.36);
  background: rgba(14, 165, 233, 0.16);
  color: #38bdf8;
  font-weight: 800;
}

.fr-nav-tab.is-current::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: #38bdf8;
  opacity: 0.75;
}

/* ── Filter chips row ────────────────────────────────────────── */
.fr-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 0;
  transition: all 0.2s ease;
}

.fr-filter-chips:empty {
  display: none;
}

@keyframes frChipIn {
  from { opacity: 0; transform: scale(0.82) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.fr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: rgba(14, 165, 233, 0.12);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  animation: frChipIn 0.22s ease both;
}

.fr-chip-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fr-chip-clear-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.24);
  background: transparent;
  color: #f87171;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  transition: background 0.15s ease;
  animation: frChipIn 0.28s ease both;
}

.fr-chip-clear-all:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* ── Stat card top layout (kicker + icon row) ────────────────── */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-kicker {
  font-size: 0.71rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.stat-card h3 {
  display: none; /* replaced by stat-kicker */
}

/* ── 4th stat card – Collection Rate ─────────────────────────── */
.blue-rate-glow {
  box-shadow: 0 0 40px rgba(14, 165, 233, 0.22) inset;
}

.blue-rate-glow .stat-icon,
.blue-rate-glow .stat-value {
  color: #38bdf8;
}

.fr-rate-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin-top: 2px;
}

.fr-rate-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  width: 0%;
  transition: width 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Section kicker label ────────────────────────────────────── */
.fr-kicker {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
  opacity: 0.8;
}

.fr-grid-title {
  min-width: 0;
}

.fr-grid-summary {
  margin: 0.15rem 0 0;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 800;
}

.fr-grid-explain {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.45rem;
}

.fr-grid-explain:empty {
  display: none;
}

.fr-grid-explain span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.1);
  color: #dbeafe;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.fr-grid-intent {
  margin: 0.12rem 0 0;
  max-width: 780px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
}

.fr-intelligence-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 0.7rem;
  max-width: 980px;
}

.fr-intelligence-panel.hidden,
.fr-intel-card.hidden {
  display: none;
}

.fr-intel-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-left: 4px solid rgba(245, 158, 11, 0.86);
  border-radius: 12px;
  padding: 10px 12px;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.66)),
    rgba(15, 23, 42, 0.72);
}

.fr-intel-card-cashier {
  border-left-color: rgba(34, 197, 94, 0.9);
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(15, 23, 42, 0.66)),
    rgba(15, 23, 42, 0.72);
}

.fr-intel-card.is-clear {
  border-left-color: rgba(34, 197, 94, 0.9);
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(15, 23, 42, 0.66)),
    rgba(15, 23, 42, 0.72);
}

.fr-intel-kicker {
  display: block;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fr-intel-card strong {
  display: block;
  margin-top: 2px;
  color: var(--text-main);
  font-size: 0.9rem;
}

.fr-intel-card p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
}

/* ── Card entry animation ────────────────────────────────────── */
@keyframes frCardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.stats-row .stat-card:nth-child(1) { animation: frCardIn 0.36s ease 0.04s both; }
.stats-row .stat-card:nth-child(2) { animation: frCardIn 0.36s ease 0.09s both; }
.stats-row .stat-card:nth-child(3) { animation: frCardIn 0.36s ease 0.14s both; }
.stats-row .stat-card:nth-child(4) { animation: frCardIn 0.36s ease 0.19s both; }

.grid-section { animation: frCardIn 0.4s ease 0.22s both; }

/* ── Export / Notify dropdowns ───────────────────────────────── */
.fr-drop-wrap {
  position: relative;
}

.fr-drop-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fr-caret {
  font-size: 0.8rem;
  opacity: 0.65;
  transition: transform 0.18s ease;
}

.fr-drop-wrap.is-open .fr-caret {
  transform: rotate(180deg);
}

.fr-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.34);
  z-index: 50;
  flex-direction: column;
  gap: 4px;
}

.fr-drop-wrap.is-open .fr-drop-menu {
  display: flex;
}

.fr-drop-item {
  width: 100%;
  justify-content: flex-start;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.88rem;
  gap: 8px;
}

/* ── Generate button: icon + badge ──────────────────────────── */
#btnLoadDetails {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fr-filter-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.fr-filter-badge.is-visible {
  display: inline-flex;
}

/* ── Light-mode overrides for all new components ─────────────── */
@media screen {
  /* h1 gradient text (upgrade from solid blue) */
  .glass-header h1 {
    background: linear-gradient(90deg, #2563eb, #0891b2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
  }

  /* Logo pulse ring colour */
  .fee-brand-logo::after {
    border-color: rgba(37, 99, 235, 0.42);
  }

  /* Clock light */
  .fr-clock {
    background: rgba(255, 255, 255, 0.54);
    border-color: rgba(148, 163, 184, 0.22);
    color: var(--fee-index-muted);
  }

  /* Module nav light */
  .fr-module-nav {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(219, 227, 239, 0.92);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
    backdrop-filter: none;
  }

  .fr-nav-tab {
    color: var(--fee-index-muted);
  }

  .fr-nav-tab:hover {
    border-color: rgba(8, 145, 178, 0.24);
    background: rgba(8, 145, 178, 0.08);
    color: var(--fee-index-cyan);
  }

  .fr-nav-tab.is-current {
    border-color: rgba(8, 145, 178, 0.3);
    background: rgba(8, 145, 178, 0.1);
    color: var(--fee-index-cyan);
  }

  .fr-nav-tab.is-current::after {
    background: var(--fee-index-cyan);
  }

  .fr-module-nav {
    width: fit-content;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(236, 253, 245, 0.92));
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  }

  .fr-module-nav-inner {
    padding: 0.42rem;
  }

  .fr-nav-tab {
    min-height: 38px;
    padding: 0.55rem 1rem;
    border-radius: 11px;
    color: #475569;
    font-weight: 900;
  }

  .fr-nav-tab.is-current {
    color: #ffffff;
    border-color: rgba(14, 165, 233, 0.56);
    background: linear-gradient(135deg, #2563eb, #0891b2);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
  }

  .fr-nav-tab.is-current::after {
    left: 14px;
    right: 14px;
    bottom: 5px;
    background: rgba(255, 255, 255, 0.82);
  }

  .fr-nav-tab.is-current i {
    color: #ffffff;
    opacity: 1;
  }

  .fr-report-tabs {
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.88)),
      rgba(255, 255, 255, 0.94);
    border-color: rgba(37, 99, 235, 0.16);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.1);
  }

  .fr-report-tab.is-active {
    color: #ffffff;
    border-color: rgba(14, 165, 233, 0.72);
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 58%, #0f766e 100%);
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  }

  /* Filter chips light */
  .fr-chip {
    border-color: rgba(8, 145, 178, 0.22);
    background: rgba(8, 145, 178, 0.08);
    color: var(--fee-index-text);
  }

  .fr-chip-label {
    color: var(--fee-index-muted);
  }

  .fr-chip-clear-all {
    border-color: rgba(225, 29, 72, 0.2);
    color: var(--fee-index-rose);
  }

  .fr-chip-clear-all:hover {
    background: rgba(225, 29, 72, 0.07);
  }

  .fr-grid-explain span {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(239, 246, 255, 0.94);
    color: var(--fee-index-blue);
  }

  .fr-intel-card {
    border-color: rgba(217, 119, 6, 0.2);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.94), rgba(255, 255, 255, 0.9));
  }

  .fr-intel-card-cashier,
  .fr-intel-card.is-clear {
    border-color: rgba(15, 159, 110, 0.2);
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.94), rgba(255, 255, 255, 0.9));
  }

  /* Stat cards light: left-accent border tile style */
  .stat-card {
    border-left: 4px solid transparent;
  }

  .orange-glow {
    border-left-color: var(--fee-index-amber);
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.08), var(--fee-index-shadow);
  }

  .green-glow {
    border-left-color: var(--fee-index-green);
    box-shadow: inset 0 0 0 1px rgba(15, 159, 110, 0.08), var(--fee-index-shadow);
  }

  .red-glow {
    border-left-color: var(--fee-index-rose);
    box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.08), var(--fee-index-shadow);
  }

  .blue-rate-glow {
    border-left-color: var(--fee-index-cyan);
    box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.08), var(--fee-index-shadow);
  }

  .blue-rate-glow .stat-icon,
  .blue-rate-glow .stat-value {
    color: var(--fee-index-cyan);
  }

  .fr-rate-track {
    background: rgba(8, 145, 178, 0.1);
  }

  .fr-rate-fill {
    background: linear-gradient(90deg, var(--fee-index-cyan), #38bdf8);
  }

  /* Section kicker light */
  .fr-kicker {
    color: var(--fee-index-muted);
  }

  /* Export dropdown light */
  .fr-drop-menu {
    background: #ffffff;
    border-color: var(--fee-index-line);
    box-shadow: var(--fee-index-shadow);
    backdrop-filter: none;
  }

  .fr-drop-item {
    border-color: var(--fee-index-line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--fee-index-text);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
  }

  .fr-drop-item:hover {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(239, 246, 255, 0.94);
    color: var(--fee-index-blue);
  }

  .btn-remind.fr-drop-item:hover {
    border-color: rgba(34, 197, 94, 0.32);
    background: rgba(236, 253, 245, 0.94);
    color: var(--fee-index-green);
  }
}

/* ── Mobile adjustments for new components ───────────────────── */
@media (max-width: 768px) {
  .fr-clock {
    display: none;
  }

  .fr-report-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fr-report-tab {
    justify-content: center;
    padding-inline: 0.6rem;
    font-size: 0.82rem;
  }

  .receipt-lookup-panel {
    grid-template-columns: 1fr;
    padding: 0.85rem;
  }

  .collection-date-panel {
    grid-template-columns: 1fr;
    padding: 0.85rem;
  }

  .collection-date-controls.date-range-row {
    grid-template-columns: 1fr;
  }

  .fr-module-nav {
    border-radius: 10px;
  }

  .fr-module-nav-inner {
    padding: 5px 6px;
    gap: 3px;
  }

  .fr-nav-tab {
    font-size: 0.78rem;
    padding: 5px 9px;
    gap: 5px;
  }

  .fr-filter-chips {
    gap: 6px;
  }

  .fr-chip {
    font-size: 0.74rem;
    padding: 4px 8px;
  }

  .fr-grid-explain {
    gap: 5px;
  }

  .fr-grid-explain span {
    min-height: 26px;
    padding: 4px 8px;
    font-size: 0.68rem;
    white-space: normal;
  }

  .fr-intelligence-panel {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 0.55rem;
  }

  .fr-intel-card {
    border-radius: 10px;
    padding: 9px 10px;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .fr-drop-menu {
    min-width: 140px;
  }
}
