:root {
  --mf-primary: #00C8E8;
  --mf-primary-hover: #00b3d1;
  --mf-primary-glow: rgba(0, 200, 232, 0.35);
  --mf-primary-light: #e6f9fd;
  --mf-dark: #0B0F19;
  --mf-dark-card: #151C2C;
  --mf-slate: #1e293b;
  --mf-muted: #64748b;
  --mf-light-bg: #f8fafc;
  --mf-card-bg: #ffffff;
  --mf-border: rgba(226, 232, 240, 0.8);
  --mf-border-dark: rgba(255, 255, 255, 0.1);
  --mf-success: #10b981;
  --mf-warning: #f59e0b;
  --mf-danger: #ef4444;
  --mf-radius: 14px;
  --mf-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --mf-shadow-glow: 0 0 30px rgba(0, 200, 232, 0.2);
  --mf-font: 'Poppins', system-ui, -apple-system, sans-serif;
}

html, body {
  scroll-behavior: smooth;
  max-width: 100vw;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--mf-font);
}

body {
  background-color: var(--mf-light-bg);
  color: var(--mf-slate);
  font-size: 15px;
  line-height: 1.6;
}

/* Ensure Date inputs display full date on mobile */
input[type="date"] {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0.75rem 0.6rem !important;
  font-size: 0.85rem !important;
  box-sizing: border-box !important;
}

/* Custom In-App Toast System */
.mf-toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 380px;
  width: calc(100vw - 2.5rem);
  pointer-events: none;
}

.mf-toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-radius: 14px;
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.mf-toast-success { border-left: 4px solid var(--mf-success); }
.mf-toast-error { border-left: 4px solid var(--mf-danger); }
.mf-toast-info { border-left: 4px solid var(--mf-primary); }

@keyframes toastSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* App Shell Layout */
.mf-app-container {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.mf-sidebar {
  width: 260px;
  background: var(--mf-card-bg);
  border-right: 1px solid var(--mf-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: 100;
}

.mf-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mf-dark);
}

.mf-brand span {
  color: var(--mf-primary);
}

.mf-brand-light {
  color: #fff;
}

.mf-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
  margin-top: 2rem;
}

.mf-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--mf-radius);
  color: var(--mf-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.mf-nav-item:hover, .mf-nav-item.active {
  background: var(--mf-primary-light);
  color: var(--mf-primary);
}

.mf-main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
  max-width: calc(100vw - 260px);
  overflow-x: hidden;
}

/* Header Bar */
.mf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--mf-card-bg);
  padding: 1rem 1.5rem;
  border-radius: var(--mf-radius);
  border: 1px solid var(--mf-border);
  box-shadow: var(--mf-shadow);
}

.mf-user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mf-pro-pill {
  background: linear-gradient(135deg, #00C8E8, #3b82f6);
  color: #fff;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mf-free-pill {
  background: #e2e8f0;
  color: #475569;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Minimalist Mobile Balance Bar */
.mf-mobile-balance-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #0F172A, #1E293B);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mf-mob-bal-item {
  display: flex;
  flex-direction: column;
}

.mf-mob-bal-label {
  font-size: 0.7rem;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.mf-mob-bal-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* Cards & Grid */
.mf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.mf-2col-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.mf-card {
  background: var(--mf-card-bg);
  border-radius: var(--mf-radius);
  padding: 1.5rem;
  border: 1px solid var(--mf-border);
  box-shadow: var(--mf-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  word-break: break-word;
}

.mf-card-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mf-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.mf-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--mf-dark);
}

.mf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--mf-radius);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  font-size: 0.95rem;
}

.mf-btn-primary {
  background: linear-gradient(135deg, #00C8E8, #00a6c0);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 200, 232, 0.4);
}

.mf-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 200, 232, 0.6);
}

.mf-btn-outline {
  background: transparent;
  border: 1px solid var(--mf-border);
  color: var(--mf-slate);
}

.mf-btn-outline:hover {
  background: var(--mf-light-bg);
  border-color: var(--mf-primary);
  color: var(--mf-primary);
}

/* Mobile Menu Hub Grid — Force static 3-column grid without 1s flicker */
.mf-mobile-hub {
  display: none;
  margin-bottom: 1rem;
}

.mf-mobile-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 0.65rem !important;
}

.mf-mobile-card {
  background: #ffffff;
  border: 1px solid var(--mf-border);
  border-radius: 14px;
  padding: 0.85rem 0.4rem;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--mf-shadow);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--mf-dark);
}

.mf-mobile-card:hover, .mf-mobile-card.active {
  background: var(--mf-primary-light);
  border-color: var(--mf-primary);
  color: var(--mf-primary);
  transform: scale(1.02);
}

.mf-mobile-icon {
  font-size: 1.65rem;
}

.mf-mobile-label {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.mf-back-menu-btn {
  display: none;
  margin-bottom: 1rem;
}

/* Progress bar */
.mf-progress-bg {
  background: #e2e8f0;
  border-radius: 50px;
  height: 10px;
  width: 100%;
  overflow: hidden;
  margin: 0.75rem 0;
}

.mf-progress-fill {
  background: var(--mf-primary);
  height: 100%;
  border-radius: 50px;
  transition: width 0.3s ease;
}

.mf-bottom-nav {
  display: none !important;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .mf-sidebar {
    display: none;
  }
  .mf-main-content {
    margin-left: 0;
    padding: 1rem;
    max-width: 100vw;
    width: 100vw;
  }
  .mf-header {
    padding: 0.85rem 1rem;
  }
  .mf-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .mf-2col-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .mf-card {
    padding: 1rem !important;
  }
  .mf-card-title {
    font-size: 0.7rem !important;
  }
  .mf-card-value {
    font-size: 1.2rem !important;
  }
  .mf-mobile-hub {
    display: block;
  }
}

@media (max-width: 480px) {
  .mf-mobile-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
  }
  .mf-mobile-card {
    padding: 0.75rem 0.2rem;
  }
  .mf-mobile-icon {
    font-size: 1.4rem;
  }
  .mf-mobile-label {
    font-size: 0.68rem;
  }
}
