/* ==========================================================
   PLAN MONEY ONLINE ₹ — BULLETPROOF MOBILE-FIRST RESPONSIVE CSS
   Zero-overflow guaranteed. Every element contained.
   ========================================================== */

/* ==========================================================
   DESIGN TOKENS
   ========================================================== */
:root {
  --bg-primary: #0b1120;
  --bg-secondary: #151d2e;
  --bg-card: rgba(21, 29, 46, 0.85);
  --bg-input: rgba(11, 17, 32, 0.8);
  --bg-input-hover: rgba(20, 27, 45, 0.9);
  --border-color: rgba(255, 255, 255, 0.07);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-soft: rgba(99, 102, 241, 0.12);
  --accent-success: #10b981;
  --accent-success-soft: rgba(16, 185, 129, 0.12);
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.2);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* LIGHT THEME */
[data-theme="light"] {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-input: #e8edf4;
  --bg-input-hover: #dfe5ee;
  --border-color: rgba(0, 0, 0, 0.07);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.1);
}

/* ==========================================================
   HARD RESET — Prevent ALL overflows
   ========================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* This is the key — prevent any child from expanding beyond parent */
  min-width: 0;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  /* clip (unlike hidden) doesn't make body a scroll container, so the sticky header keeps working */
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ==========================================================
   HEADER
   ========================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  transition: background-color var(--transition-normal);
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.85);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Header logo — trimmed wordmark asset (no baked-in transparent padding).
   The dark-mode art is taller/narrower than the light-mode art at the same
   source resolution, so it needs a larger height to read as the same size. */
.header-logo {
  height: 31px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
}

/* Light theme uses the dark-ink lockup; the default art is white-on-dark
   and would all but vanish against the light header. */
[data-theme="light"] .header-logo,
[data-theme="light"] .brand-logo-img,
[data-theme="light"] .footer-logo {
  content: url("assets/logo-nav-light.png");
}

[data-theme="light"] .header-logo {
  height: 26px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-icon-sm {
  width: auto;
  height: 26px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

/* Logo image inside brand containers */
.brand-logo-img {
  width: auto;
  height: 100%;
  max-width: 150px;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-full);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 0.15rem;
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Hamburger — default VISIBLE on mobile, hidden on desktop via media query */
.mobile-menu-btn {
  display: flex;
}

/* Search — hidden by default on small screens */
.search-wrapper {
  display: none;
}

.search-input {
  width: 100%;
  padding: 0.45rem 0.7rem 0.45rem 2rem;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Icon Buttons */
.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.btn-icon svg { width: 16px; height: 16px; }

.btn-icon:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-soft);
}

.btn-icon-sm {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-sm:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ==========================================================
   LAYOUT — Mobile first: single column, no sidebar visible
   ========================================================== */
.main-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* Sidebar — off-canvas drawer by default on mobile */
.sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 270px;
  max-width: 80vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1050;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-lg);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header-mobile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-color);
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 0.6rem;
  margin-bottom: 0.4rem;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  list-style: none;
}

.nav-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.nav-item-btn:hover {
  background: var(--accent-primary-soft);
  color: var(--text-primary);
}

[data-theme="light"] .nav-item-btn:hover {
  background: rgba(99, 102, 241, 0.08);
}

.nav-item-btn.active {
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ==========================================================
   HORIZONTAL MOBILE CATEGORY BAR — visible on mobile
   ========================================================== */
.mobile-category-bar {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 -1rem 0.4rem;
  padding: 0.15rem 1rem 0.65rem;
  scroll-padding-inline: 1rem;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.mobile-category-bar::-webkit-scrollbar { display: none; }

.mobile-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}

.mobile-category-pill .pill-icon {
  width: 13px;
  height: 13px;
}

.mobile-category-pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.mobile-category-pill.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* ==========================================================
   MAIN CONTENT AREA
   ========================================================== */
.content-area {
  padding: 0.75rem 1rem 1.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ==========================================================
   CALCULATOR CARD
   ========================================================== */
.calculator-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 0.9rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.calc-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.6rem;
}

.calc-title-group {
  width: 100%;
  overflow: hidden;
}

.calc-title-group h1 {
  font-size: 1.15rem;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.calc-title-group h1 svg {
  color: var(--accent-primary);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 0.1em;
}

.calc-subtitle {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

/* Preset Pills — horizontal scroll on mobile */
.preset-pills {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  flex-wrap: wrap;
}

.preset-pills::-webkit-scrollbar { display: none; }

.preset-pill {
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.preset-pill:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-soft);
}

/* ==========================================================
   CALCULATOR GRID — stacked on mobile, 2-col on desktop
   ========================================================== */
.calc-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
}

/* ==========================================================
   INPUT PANEL
   ========================================================== */
.inputs-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.input-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 1;
}

.input-display-val {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  text-align: right;
  overflow-wrap: break-word;
  word-break: break-all;
}

.val-subtext {
  font-size: 0.65rem;
  color: var(--accent-success);
  font-weight: 600;
  background: var(--accent-success-soft);
  padding: 0.08rem 0.35rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.input-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-prefix, .input-suffix {
  position: absolute;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 1;
}

.input-prefix { left: 0.75rem; }
.input-suffix { right: 0.75rem; }

.number-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

/* Hide number spinners */
.number-input::-webkit-inner-spin-button,
.number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-input.has-prefix { padding-left: 1.75rem; }
.number-input.has-suffix { padding-right: 2rem; }

.number-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Range Slider — fat thumb for touch */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  outline: none;
  cursor: pointer;
  margin-top: 0.3rem;
  touch-action: manipulation;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2.5px solid white;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2.5px solid white;
  cursor: pointer;
}

.select-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

/* ==========================================================
   RESULTS PANEL — Summary Cards + Chart
   ========================================================== */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.summary-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.summary-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.7rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.3rem;
  min-width: 0;
  overflow: hidden;
  transition: transform var(--transition-fast);
}

[data-theme="light"] .summary-card {
  background: rgba(241, 245, 249, 0.8);
}

.summary-card.highlight {
  background: var(--gradient-primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-glow);
}

.summary-card.highlight .summary-title { color: rgba(255, 255, 255, 0.8); }
.summary-card.highlight .summary-value { color: white; }

.summary-title {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.summary-value {
  font-size: 1rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  line-height: 1.25;
}

/* Chart */
.chart-container {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  position: relative;
  width: 100%;
  height: 240px;
  max-width: 100%;
  overflow: hidden;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}

[data-theme="light"] .chart-container {
  background: rgba(241, 245, 249, 0.6);
}

/* ==========================================================
   SCHEDULE / BREAKDOWN TABLE
   ========================================================== */
.schedule-section {
  margin-top: 1rem;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.schedule-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.6rem;
}

.schedule-header h3 {
  font-size: 1rem;
  margin-bottom: 0.1rem;
}

.schedule-header > div:last-child {
  width: 100%;
  display: flex;
  gap: 0.4rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.75rem;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
  font-size: 0.75rem;
}

.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-secondary);
  box-shadow: inset -1px 0 0 var(--border-color);
}

.data-table th:first-child { z-index: 2; }

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

[data-theme="light"] .data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.018);
}

.data-table tbody tr:hover {
  background: var(--accent-primary-soft);
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex: 1;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 28px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-primary);
}

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

/* ==========================================================
   TOASTS
   ========================================================== */
.toast-container {
  position: fixed;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-success);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
}

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

/* ==========================================================
   INFO TOOLTIPS
   ========================================================== */
.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  margin-left: 0.25rem;
}

.info-icon {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  opacity: 0.7;
  transition: all 0.15s ease;
}

.info-tooltip:hover .info-icon {
  color: var(--accent-primary);
  opacity: 1;
}

.tooltip-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.45;
  width: max-content;
  max-width: 260px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  pointer-events: none;
  white-space: normal;
}

.tooltip-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border-color);
}

.info-tooltip:hover .tooltip-popup {
  display: block;
}

/* On mobile, show tooltip on tap via focus */
@media (max-width: 1024px) {
  .info-tooltip:focus-within .tooltip-popup,
  .info-tooltip:active .tooltip-popup {
    display: block;
  }
  
  .tooltip-popup {
    left: 0;
    transform: none;
    max-width: 220px;
  }
  
  .tooltip-popup::after {
    left: 12px;
    transform: none;
  }
}

/* ==========================================================
   HOW IT WORKS ACCORDION
   ========================================================== */
.how-it-works-section {
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.how-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.how-toggle span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.how-icon {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.how-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.how-toggle.open .how-chevron {
  transform: rotate(180deg);
}

.how-toggle:hover {
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
}

.how-toggle.open {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom-color: transparent;
}

.how-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.how-content.open {
  max-height: 800px;
}

.how-content > * {
  padding-left: 1rem;
  padding-right: 1rem;
}

.how-formula-box {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.how-formula-label,
.how-example-label,
.how-tips-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.how-formula-label svg,
.how-example-label svg,
.how-tips-label svg {
  width: 14px;
  height: 14px;
}

.how-formula {
  font-family: 'Outfit', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  overflow-wrap: anywhere;
}

.how-formula-explain {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.how-example-box {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.how-example-box p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.how-tips-box {
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

.how-tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.how-tips-list li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 1.25rem;
  position: relative;
}

.how-tips-list li::before {
  content: '💡';
  position: absolute;
  left: 0;
  top: 0;
}

/* ==========================================================
   SITE FOOTER
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-top: 2rem;
  padding: 2rem 1rem 1.25rem;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.footer-logo {
  height: 28px;
  width: auto;
  display: block;
  margin-bottom: 0.6rem;
}

[data-theme="light"] .footer-logo { height: 24px; }

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  max-width: 34ch;
}

.footer-col h2 {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-col a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
}

.footer-col a:hover { color: var(--accent-primary); }

.footer-legal {
  max-width: 1180px;
  margin: 1.75rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ==========================================================
   RESPONSIVE — TABLETS (min-width: 600px)
   ========================================================== */
@media (min-width: 600px) {
  .app-header {
    padding: 0.65rem 1rem;
  }

  .brand-badge {
    display: inline-block;
  }

  .search-wrapper {
    display: block;
    position: relative;
    width: 170px;
  }

  .content-area {
    padding: 1rem;
  }

  .calculator-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
  }

  .calc-title-group h1 {
    font-size: 1.3rem;
  }

  .calc-subtitle {
    font-size: 0.85rem;
  }

  .summary-value {
    font-size: 1.15rem;
  }

  .summary-title {
    font-size: 0.65rem;
  }

  .summary-card {
    padding: 0.85rem 0.7rem;
  }

  .chart-container {
    height: 270px;
    padding: 1rem;
  }

  .schedule-section {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
  }

  .schedule-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .schedule-header > div:last-child {
    width: auto;
  }

  .btn {
    flex: none;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
  }

  .toast-container {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    max-width: 380px;
  }

  .data-table th {
    padding: 0.65rem 0.85rem;
    font-size: 0.65rem;
  }

  .data-table td {
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
  }

  .preset-pill {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }
}

/* ==========================================================
   RESPONSIVE — DESKTOP (min-width: 1025px)
   ========================================================== */
@media (min-width: 1025px) {
  .mobile-category-bar {
    display: none !important;
  }

  /* Calculator pages: permanent sidebar beside the content.
     Wide pages (home, guide, about…) keep the slide-out drawer. */
  .layout-app .mobile-menu-btn {
    display: none !important;
  }

  .layout-app .sidebar-header-mobile {
    display: none;
  }

  .layout-app .sidebar-overlay {
    display: none !important;
  }

  .layout-app .main-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 60px);
  }

  .layout-app .sidebar {
    position: static;
    transform: none;
    width: auto;
    max-width: none;
    height: auto;
    box-shadow: none;
    border-right: 1px solid var(--border-color);
  }

  .layout-wide .content-area {
    max-width: 1140px;
  }

  .app-header {
    padding: 0.65rem 1.5rem;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
  }

  .brand-title { font-size: 1.2rem; }
  .brand-badge { display: inline-block; }

  .search-wrapper {
    width: 220px;
  }

  .btn-icon {
    width: 38px;
    height: 38px;
  }

  .btn-icon svg { width: 18px; height: 18px; }

  .content-area {
    padding: 1.75rem 2rem;
    max-width: 1350px;
    margin: 0 auto;
  }

  /* 2-column calculator layout on desktop */
  .calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .calculator-card {
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
  }

  .calc-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .calc-title-group h1 {
    font-size: 1.5rem;
  }

  .calc-subtitle {
    font-size: 0.88rem;
  }

  .preset-pills {
    flex-wrap: wrap;
    overflow: visible;
    max-width: 380px;
  }

  .summary-value {
    font-size: 1.3rem;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .summary-card {
    padding: 1rem 0.85rem;
  }

  .summary-title {
    font-size: 0.7rem;
    white-space: normal;
  }

  .chart-container {
    height: 300px;
    padding: 1.25rem;
  }

  .schedule-section {
    padding: 1.75rem;
    margin-top: 1.5rem;
  }

  .schedule-header h3 {
    font-size: 1.15rem;
  }

  .number-input {
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
  }

  .number-input.has-prefix { padding-left: 1.9rem; }
  .number-input.has-suffix { padding-right: 2.2rem; }

  .input-label { font-size: 0.82rem; }
  .input-display-val { font-size: 0.85rem; }

  .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
  }

  .btn-primary:hover {
    transform: translateY(-1px);
  }

  .nav-item-btn {
    padding: 0.65rem 0.85rem;
    font-size: 0.87rem;
  }
}

/* ==========================================================
   RESPONSIVE — WIDE DESKTOP (min-width: 1400px)
   ========================================================== */
@media (min-width: 1400px) {
  .layout-app .main-layout {
    grid-template-columns: 280px 1fr;
  }

  .content-area {
    padding: 2rem 2.5rem;
  }

  .calc-grid {
    gap: 2.5rem;
  }

  .summary-cards-grid {
    gap: 0.75rem;
  }
}

a.nav-item-btn { text-decoration: none; }

/* ==========================================================
   CONTENT PAGES (guide, about, privacy) & CALCULATOR GUIDES
   ========================================================== */
.page-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-hero {
  position: relative;
  overflow: hidden;
  padding: 1.6rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(139, 92, 246, 0.22) 0%, transparent 55%),
    radial-gradient(100% 120% at 0% 100%, rgba(16, 185, 129, 0.12) 0%, transparent 55%),
    var(--bg-card);
  box-shadow: var(--shadow-md);
}

.guide-eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  background: var(--accent-primary-soft);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.85rem;
}

.guide-hero h1 {
  font-size: clamp(1.55rem, 5vw, 2.4rem);
  line-height: 1.15;
  margin-bottom: 0.75rem;
  max-width: 22ch;
}

.guide-lead {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  max-width: 62ch;
}

.guide-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.1rem;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.7rem;
}

.guide-chip svg { width: 13px; height: 13px; color: var(--accent-success); }

.guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-md);
  scroll-margin-top: 76px;
}

.guide-section-plain {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.5rem 0 0;
}

.guide-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.guide-badge {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.guide-badge svg { width: 22px; height: 22px; }

.guide-step {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.guide-h2 {
  font-size: 1.3rem;
  margin: 0.1rem 0 0.25rem;
}

.guide-answers {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.guide-answers em {
  color: var(--text-primary);
  font-style: normal;
  font-weight: 500;
}

.guide-p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.75;
  max-width: 72ch;
}

.guide-note {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.65;
  border-radius: var(--radius-sm);
  background: var(--accent-success-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.guide-note svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 0.2rem;
  color: var(--accent-success);
}

.guide-reviewed {
  margin-top: 0.9rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.guide-p strong,
.guide-note strong,
.guide-list strong,
.guide-example strong { color: var(--text-primary); font-weight: 600; }

.guide-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-primary);
  margin: 1.4rem 0 0.6rem;
}

.guide-label svg { width: 15px; height: 15px; }

.guide-label-warn { color: var(--accent-warning); }

.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 72ch;
}

.guide-list li {
  position: relative;
  padding-left: 1.2rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.65;
}

.guide-list li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.guide-list-warn li::before { background: var(--accent-warning); }

.term-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.term {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.term dt {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.term dd {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.guide-example {
  margin-top: 1.4rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--accent-primary-soft);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-left: 3px solid var(--accent-primary);
}

.guide-example .guide-label { margin-top: 0; }

.guide-example p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.75;
}

.guide-example p + p { margin-top: 0.6rem; }

.guide-table {
  max-width: 560px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.guide-table .data-table { min-width: 0; }

.guide-table .guide-table-total td {
  white-space: normal;
  background: var(--accent-success-soft);
  color: var(--accent-success);
  font-weight: 700;
}

.guide-cta {
  display: flex;
  margin-top: 1.5rem;
}

a.btn { text-decoration: none; }

.guide-cta .btn { flex: 1; padding: 0.7rem 1rem; font-size: 0.85rem; }

/* Finder cards */
.finder-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.finder-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.15rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.finder-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.finder-icon {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}

.finder-icon svg { width: 18px; height: 18px; }

.finder-q {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.finder-tool {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

/* Journey */
.journey {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 1rem;
}

.journey-step {
  position: relative;
  display: flex;
  gap: 0.9rem;
  padding-bottom: 1.1rem;
}

.journey-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 2px;
  width: 2px;
  background: var(--border-color);
}

.journey-num {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: var(--gradient-primary);
}

.journey-step h3 {
  font-size: 1rem;
  margin: 0.2rem 0 0.2rem;
}

.journey-step p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.6;
}

.journey-step a,
.faq a {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
}

.journey-step a:hover { text-decoration: underline; }

/* Principles */
.principle-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.principle {
  padding: 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.principle svg {
  width: 20px;
  height: 20px;
  color: var(--accent-success);
  margin-bottom: 0.5rem;
}

.principle h4 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.principle p {
  color: var(--text-secondary);
  font-size: 0.83rem;
  line-height: 1.6;
}

/* FAQ */
.faq {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  margin-top: 0.6rem;
}

.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.faq[open] summary svg { transform: rotate(180deg); }

.faq p {
  padding: 0 0.95rem 0.95rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.65;
}

.guide-final-cta {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background:
    radial-gradient(90% 120% at 50% 0%, rgba(99, 102, 241, 0.2) 0%, transparent 65%),
    var(--bg-card);
}

.guide-final-cta h2 { font-size: 1.35rem; margin-bottom: 0.3rem; }

.guide-final-cta p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
}

.guide-final-cta .btn { flex: none; padding: 0.7rem 1.2rem; font-size: 0.88rem; }

@media (min-width: 600px) {
  .guide-hero { padding: 2.25rem 2rem; }
  .guide-section { padding: 1.6rem 1.5rem; }
  .guide-section-plain { padding: 0.5rem 0 0; }
  .finder-grid { grid-template-columns: repeat(2, 1fr); }
  .term-grid { grid-template-columns: repeat(2, 1fr); }
  .principle-grid { grid-template-columns: repeat(2, 1fr); }
  .guide-cta .btn { flex: none; }
  .guide-h2 { font-size: 1.45rem; }
}

@media (min-width: 1025px) {
  .guide-hero { padding: 2.75rem 2.5rem; }
  .guide-section { padding: 2rem 2.25rem; }
  .guide-section-plain { padding: 0.5rem 0 0; }
  .finder-grid { grid-template-columns: repeat(3, 1fr); }
  .principle-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================
   SHARED CHROME: skip link, drawer visibility, links
   ========================================================== */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 2000;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus { top: 0.6rem; }

.brand-link { display: block; line-height: 0; }

a.brand-icon-sm { text-decoration: none; }

/* Keep the closed drawer's links out of the keyboard tab order */
.sidebar {
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s;
}

.sidebar.open { visibility: visible; }

.sidebar nav + nav { margin-top: 0.25rem; }

a.mobile-category-pill { text-decoration: none; }

@media (min-width: 1025px) {
  .layout-app .sidebar { visibility: visible; }
}

/* Search results dropdown */
.search-wrapper { position: relative; }

.search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  z-index: 200;
  list-style: none;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
}

.search-results a,
.search-empty {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  color: var(--text-primary);
  text-decoration: none;
}

.search-results a:hover,
.search-results a:focus { background: var(--accent-primary-soft); color: var(--accent-primary); }

.search-empty { color: var(--text-muted); }

/* Breadcrumb */
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb li + li::before {
  content: '›';
  margin-right: 0.35rem;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent-primary); }

/* Calculator pages */
.schedule-actions { display: flex; gap: 0.5rem; }

.calc-learn { margin-top: 1.25rem; }

.input-group-heading {
  margin-top: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-primary);
}

.guide-p a,
.guide-list a,
.home-section-head a,
.faq a {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
}

.guide-p a:hover,
.guide-list a:hover,
.faq a:hover { text-decoration: underline; }

.guide-small { font-size: 0.82rem; margin-top: 0.6rem; }

.guide-h2-spaced { margin-top: 1.5rem; }

.guide-table-wide { max-width: 760px; }

.guide-table-wide td { white-space: normal; }

.guide-table + .guide-label,
.guide-table + .guide-example { margin-top: 1.4rem; }

.related-section { margin-top: 1.75rem; }

.related-section h2 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

/* ==========================================================
   HOMEPAGE
   ========================================================== */
/* The hero sits open on the page rather than in a card: a faint dot grid and a
   soft glow in the top-right corner, copy on the left, and the illustration on
   a stacked white card on the right. */
.home-hero {
  --hero-dot: rgba(255, 255, 255, 0.07);
  --hero-card-border: rgba(255, 255, 255, 0.12);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 1.25rem 0 2.5rem;
}

[data-theme="light"] .home-hero {
  --hero-dot: rgba(15, 23, 42, 0.09);
  --hero-card-border: rgba(15, 23, 42, 0.08);
}

.home-hero::before {
  content: '';
  position: absolute;
  inset: -2rem -2rem 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(50% 75% at 100% 0%, rgba(139, 92, 246, 0.16) 0%, transparent 70%),
    radial-gradient(40% 60% at 0% 100%, rgba(16, 185, 129, 0.07) 0%, transparent 70%),
    radial-gradient(circle, var(--hero-dot) 1px, transparent 1.5px) 0 0 / 22px 22px;
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 8%, #000 92%, transparent),
    linear-gradient(to bottom, #000 65%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 8%, #000 92%, transparent),
    linear-gradient(to bottom, #000 65%, transparent);
  mask-composite: intersect;
}

.home-hero h1 {
  font-size: clamp(2.2rem, 8vw, 3.75rem);
  line-height: 1.05;
  max-width: 14ch;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary) 40%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Illustration card with two cards fanned out behind it */
.hero-visual {
  position: relative;
  isolation: isolate;
  justify-self: start;
  width: calc(100% - 1.5rem);
  max-width: 440px;
}

.hero-visual::before,
.hero-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1px solid var(--hero-card-border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.hero-visual::before {
  z-index: -1;
  transform: translate(9px, 9px) rotate(1.5deg);
}

.hero-visual::after {
  z-index: -2;
  transform: translate(17px, 18px) rotate(3deg);
}


.hero-visual img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--hero-card-border);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

/* Dark theme: swap in the dark illustration and make the card stack dark to match */
[data-theme="dark"] .hero-visual img {
  content: url("/assets/homeSectionImg-dark.webp");
  background: #0b1120;
}

[data-theme="dark"] .hero-visual::before { background: #131b2c; }
[data-theme="dark"] .hero-visual::after { background: #0f1625; }

.home-lead {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 60ch;
}

.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.home-cta-row .btn {
  flex: none;
  padding: 0.75rem 1.15rem;
  font-size: 0.88rem;
}

.home-trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin-top: 1.4rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

.home-trust li { display: inline-flex; align-items: center; gap: 0.35rem; }

.home-trust svg { width: 15px; height: 15px; color: var(--accent-success); }

.home-section { padding-top: 1.5rem; scroll-margin-top: 76px; }

.home-section-head { margin-bottom: 1rem; }

.home-section-head h2 { font-size: 1.45rem; margin-bottom: 0.3rem; }

.home-section-head p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  max-width: 70ch;
}

.home-calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.home-calc-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.home-calc-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.home-calc-card .finder-icon { margin-bottom: 0.35rem; }

.home-calc-card h3 {
  font-size: 1.02rem;
  color: var(--text-primary);
}

.home-calc-card p {
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.55;
}

.home-calc-card .home-calc-q {
  color: var(--text-primary);
  font-weight: 500;
}

.home-calc-link {
  margin-top: auto;
  padding-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent-primary);
  font-size: 0.82rem;
  font-weight: 600;
}

.home-calc-link svg { width: 15px; height: 15px; }

.value-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.value-card {
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.value-card svg {
  width: 22px;
  height: 22px;
  color: var(--accent-success);
  margin-bottom: 0.5rem;
}

.value-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }

.value-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.home-text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.home-text-link svg { width: 16px; height: 16px; }

.home-steps {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.home-steps li {
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.home-steps .journey-num { margin-bottom: 0.6rem; }

.home-steps h3 { font-size: 1rem; margin-bottom: 0.25rem; }

.home-steps p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.page-stack > .guide-final-cta { margin-top: 1rem; }

@media (min-width: 600px) {
  .home-hero { padding: 2rem 0 3rem; }
  .home-calc-grid { grid-template-columns: repeat(2, 1fr); }
  .value-grid { grid-template-columns: repeat(2, 1fr); }
  .home-steps { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: 1.4fr 1fr 1fr; }
}

/* Tablet and up: copy and illustration side by side. Phones stay stacked. */
@media (min-width: 768px) {
  .home-hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 2rem;
  }
  .hero-visual {
    justify-self: end;
    width: 100%;
    margin-right: 1.25rem;
  }
}

/* Tablet: the left column is narrower, so scale the headline to the viewport */
@media (min-width: 768px) and (max-width: 1024px) {
  .home-hero h1 { font-size: clamp(2.2rem, 5vw, 3.75rem); }
}

@media (min-width: 1025px) {
  .home-hero {
    padding: 2.75rem 0 4.5rem;
    gap: 4rem;
  }
  .home-calc-grid { grid-template-columns: repeat(3, 1fr); }
  .home-calc-grid-compact { grid-template-columns: repeat(3, 1fr); }
  .value-grid { grid-template-columns: repeat(4, 1fr); }
  .home-section { padding-top: 2.25rem; }
  .home-section-head h2 { font-size: 1.7rem; }
}

/* Phones: centre the hero, give the buttons one equal width, and centre the
   illustration card (nudged left by half the fanned stack so the whole
   group reads as centred). */
@media (max-width: 767px) {
  .home-hero {
    gap: 2.25rem;
    text-align: center;
  }

  .home-hero h1 {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .home-lead {
    margin-left: auto;
    margin-right: auto;
  }

  .home-cta-row {
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
  }

  .home-cta-row .btn {
    width: 100%;
    max-width: 340px;
    min-height: 48px;
  }

  .home-trust {
    justify-content: center;
  }

  .hero-visual {
    justify-self: center;
    left: -9px;
    width: calc(100% - 2.5rem);
  }
}

/* ==========================================================
   DESKTOP HEADER NAVIGATION
   Phones/tablets: hamburger + drawer. 900px and up: inline menu.
   ========================================================== */
.header-nav { display: none; }

.header-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-nav-link:hover,
.header-dropdown.open > .header-nav-link {
  color: var(--text-primary);
  background: var(--accent-primary-soft);
}

.header-nav-link.active { color: var(--accent-primary); }

.header-nav-chevron {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

.header-dropdown { position: relative; }

.header-dropdown:hover .header-nav-chevron,
.header-dropdown.open .header-nav-chevron { transform: rotate(180deg); }

.header-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: -1rem;
  width: min(660px, calc(100vw - 2rem));
  padding-top: 0.6rem;
  z-index: 300;
}

.header-dropdown:hover .header-dropdown-panel,
.header-dropdown.open .header-dropdown-panel { display: block; }

.header-dropdown-inner {
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
}

.header-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
}

.header-menu-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.65rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.header-menu-item:hover,
.header-menu-item:focus-visible,
.header-menu-item.active { background: var(--accent-primary-soft); }

.header-menu-item .finder-icon { width: 34px; height: 34px; flex-shrink: 0; }

.header-menu-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
}

.header-menu-item small {
  display: block;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
}

.header-menu-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  padding: 0.6rem;
  border-top: 1px solid var(--border-color);
  color: var(--accent-primary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.header-menu-all svg { width: 15px; height: 15px; }

.header-center {
  display: flex;
  align-items: center;
  min-width: 0;
}

@media (min-width: 900px) {
  /* Logo left · menu centred · search + theme right */
  .app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
  }

  .brand-container { justify-self: start; }
  .header-center { justify-self: center; }
  .header-actions { justify-self: end; }

  .header-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
  }

  .search-wrapper { width: 180px; }

  .mobile-menu-btn,
  .header-guide-btn { display: none !important; }
}

@media (min-width: 1000px) {
  .search-wrapper { width: 210px; }
}

@media (min-width: 1100px) {
  .search-wrapper { width: 240px; }
}
