/* EMI lean layout — stacked inputs like SIP, mobile-friendly */

body.emi-page {
  font-family: var(--sans, "Source Sans 3", system-ui, sans-serif);
}

body.emi-page .page {
  padding-left: 16px !important;
  padding-right: 16px !important;
  padding-bottom: 40px !important;
}

body.emi-page .page-breadcrumb {
  padding: 8px 0 10px !important;
}

body.emi-page .calc-page-stack {
  margin-bottom: 20px !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
}

body.emi-page .calc-page-stack > .calc-shell {
  border-top: none !important;
  padding: 0 0 18px !important;
  background: transparent !important;
}

body.emi-page .hero-theme-emi--slim .hero-stage-inner.hero-page-layout {
  padding: 6px 0 4px !important;
  border-bottom: none !important;
}

body.emi-page .hero-theme-emi--slim .hero-title-main {
  font-family: var(--display, "Fraunces", Georgia, serif);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem) !important;
  font-weight: 650 !important;
  letter-spacing: -0.03em;
  line-height: 1.15;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
}

body.emi-page .emi-tool-context {
  margin-top: 4px !important;
  max-width: 36rem;
  font-size: 0.875rem !important;
  line-height: 1.45;
  color: #64748b !important;
}

body.emi-page .emi-calc-primary {
  margin: 0 !important;
  padding: 8px 0 4px !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  width: 100%;
}

body.emi-page .emi-calc-primary .zone-core .zone-label,
body.emi-page .emi-calc-primary .zone-first-result .zone-label {
  display: none !important;
}

/* Always stack loan inputs vertically (like SIP) */
body.emi-page .emi-calc-primary .ribbon-basic.emi-core-grid,
body.emi-page .emi-calc-primary .emi-core-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  max-width: 28rem;
}

body.emi-page .emi-calc-primary .emi-core-grid > .field-compact {
  margin: 0 !important;
  min-width: 0;
  grid-column: 1 !important;
}

body.emi-page .emi-calc-primary .field-compact label {
  margin-bottom: 5px !important;
  font-size: 0.625rem !important;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.25;
}

body.emi-page .emi-calc-primary .field-compact .field-hint,
body.emi-page .emi-calc-primary .emi-preset-row,
body.emi-page .emi-calc-primary .preset-row,
body.emi-page .emi-calc-primary .emi-tenure-bar,
body.emi-page .emi-calc-primary .emi-amount-readout:not(.visually-hidden) {
  display: none !important;
}

body.emi-page .emi-calc-primary .emi-input-stepper {
  border-radius: 12px;
  min-height: 42px;
}

body.emi-page .emi-calc-primary .emi-input-stepper input[type="number"] {
  padding: 8px 2px !important;
  font-size: 0.95rem !important;
  font-weight: 700;
  min-width: 0;
}

body.emi-page .emi-calc-primary .emi-input-stepper .emi-step-btn {
  flex: 0 0 34px;
  min-height: 40px;
  font-size: 1rem;
}

body.emi-page .emi-calc-primary .zone-first-result {
  margin-top: 10px !important;
  padding-top: 10px !important;
}

/* Desktop: stacked inputs left, EMI card right (saves vertical space) */
@media (min-width: 880px) {
  body.emi-page .emi-calc-primary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px) !important;
    gap: 16px 24px !important;
    align-items: start !important;
    padding: 8px 0 4px !important;
  }

  body.emi-page .emi-calc-primary .zone-core {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.emi-page .emi-calc-primary .zone-first-result {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
    align-self: stretch;
    display: flex;
    min-width: 0;
  }

  body.emi-page .emi-calc-primary .ribbon-basic.emi-core-grid,
  body.emi-page .emi-calc-primary .emi-core-grid {
    max-width: none !important;
    width: 100%;
    gap: 12px !important;
  }

  body.emi-page .emi-result-combo {
    flex: 1;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    gap: 14px;
    padding: 16px !important;
  }

  body.emi-page .emi-result-combo-emi,
  body.emi-page .emi-result-combo-interest {
    width: 100%;
  }

  body.emi-page .emi-result-combo-interest {
    padding-top: 12px;
    border-top: 1px solid rgba(194, 65, 12, 0.12);
  }
}

@media (min-width: 1100px) {
  body.emi-page .emi-calc-primary {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 400px) !important;
    gap: 20px 28px !important;
  }
}

/* Mobile: keep stacked — inputs then card */
@media (max-width: 879px) {
  body.emi-page .emi-calc-primary {
    display: flex !important;
    flex-direction: column !important;
  }

  body.emi-page .emi-calc-primary .zone-first-result {
    margin-top: 10px !important;
    padding-top: 10px !important;
  }
}

body.emi-page .calc-page-stack,
body.emi-page .content-bridge,
body.emi-page .below-fold-panel,
body.emi-page .emi-guide,
body.emi-page .emi-faq-section {
  max-width: none !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

body.emi-page .emi-guide {
  margin-top: 20px !important;
}

body.emi-page .emi-guide-lead {
  max-width: none !important;
}

body.emi-page .content-bridge,
body.emi-page .below-fold-panel,
body.emi-page .emi-faq-section {
  margin-top: 18px !important;
}

/* Deep tools + folds: aligned width/padding on all viewports */
body.emi-page .emi-deep-tools {
  margin: 16px 0 8px !important;
  padding: 0 !important;
  gap: 10px !important;
  max-width: none !important;
  width: 100% !important;
}

body.emi-page .emi-deep-panel {
  border-radius: 12px !important;
  box-shadow: none !important;
  overflow: hidden;
}

body.emi-page .emi-deep-summary {
  padding: 14px 16px !important;
  gap: 6px 12px;
  align-items: flex-start;
}

body.emi-page .emi-deep-summary-title {
  font-size: 0.95rem !important;
  font-weight: 700;
  line-height: 1.3;
}

body.emi-page .emi-deep-summary-hint {
  font-size: 0.75rem !important;
  color: #64748b !important;
  line-height: 1.35;
}

body.emi-page .emi-deep-body {
  padding: 4px 16px 16px !important;
}

body.emi-page .emi-fold {
  margin: 12px 0 0 !important;
  border-radius: 12px;
  overflow: hidden;
}

body.emi-page .emi-fold-summary {
  padding: 14px 16px !important;
}

body.emi-page .emi-fold-body {
  padding: 0 0 8px !important;
}

body.emi-page .emi-deep-tools--primary,
body.emi-page #optimization-block.emi-escape {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.emi-page .content-bridge {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.emi-page .emi-compare-panel,
body.emi-page .emi-guide {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.emi-page .kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body.emi-page .milestones-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body.emi-page .compact-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

body.emi-page .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

@media (min-width: 860px) {
  body.emi-page .page {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  body.emi-page .emi-deep-summary {
    padding: 16px 18px !important;
  }

  body.emi-page .emi-deep-body {
    padding: 4px 18px 18px !important;
  }
}

@media (max-width: 720px) {
  body.emi-page .page {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 28px !important;
  }

  body.emi-page .emi-deep-tools {
    margin-top: 12px !important;
    gap: 8px !important;
  }

  body.emi-page .emi-deep-summary {
    padding: 12px 14px !important;
  }

  body.emi-page .emi-deep-body {
    padding: 2px 14px 14px !important;
  }

  body.emi-page .emi-deep-summary-hint {
    display: block !important;
  }

  body.emi-page .kpi-strip,
  body.emi-page .compact-controls {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body.emi-page .milestones-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.emi-page .emi-fold-summary {
    padding: 12px 14px !important;
  }
}

body.emi-page .emi-exit,
body.emi-page #emi-chart-zone,
body.emi-page .emi-fold {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

@media (min-width: 860px) {
  body.emi-page .page {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}

@media (max-width: 720px) {
  body.emi-page .page {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 28px !important;
  }

  body.emi-page .hero-theme-emi--slim .hero-title-main {
    font-size: 1.2rem !important;
  }

  body.emi-page .emi-tool-context {
    font-size: 0.8125rem !important;
  }

  body.emi-page .emi-calc-primary .ribbon-basic.emi-core-grid,
  body.emi-page .emi-calc-primary .emi-core-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    max-width: none;
  }

  body.emi-page .emi-calc-primary .emi-input-stepper .emi-step-btn {
    flex: 0 0 32px;
    min-height: 40px;
  }

  body.emi-page .emi-calc-primary .emi-input-stepper input[type="number"] {
    font-size: 0.9rem !important;
  }
}
