*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  background-color: #FFFFFF;
  color: #09090B;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #FFFFFF;
  color: #09090B;
}

code, pre, .font-mono, .val-numeric {
  font-family: 'JetBrains Mono', monospace;
}

/* Base Top Navigation */
.site-nav {
  width: 100%;
  border-bottom: 1px solid #E4E4E7;
  background-color: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-nav-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #09090B;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #09090B;
  color: #FFFFFF;
  padding: 3px 6px;
  border-radius: 4px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #71717A;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: #09090B;
}

.btn-primary-sm {
  background-color: #000000;
  color: #FFFFFF;
  border: 1px solid #000000;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.btn-primary-sm:hover {
  background-color: #27272A;
}

/* Ad Placement Containment */
.ad-slot-boundary {
  width: 100%;
  max-width: 1140px;
  margin: 24px auto 0 auto;
  padding: 0 20px;
}

.ad-card-banner {
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 16px;
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ad-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #71717A;
}

.ad-placeholder-text {
  font-size: 12px;
  color: #71717A;
}

/* Main Wrapper */
.main-wrapper {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px;
  flex: 1 0 auto;
}

.hero-section {
  margin-bottom: 32px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #09090B;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 15px;
  line-height: 1.5;
  color: #71717A;
  max-width: 780px;
}

/* Presets Bar */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 12px;
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
}

.presets-label {
  font-size: 12px;
  font-weight: 600;
  color: #71717A;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.preset-chip {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  color: #09090B;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background-color: #09090B;
  color: #FFFFFF;
  border-color: #09090B;
}

/* Main Grid */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.app-grid > * {
  min-width: 0;
}

/* Panel Card */
.panel-card {
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 6px;
  padding: 24px;
  min-width: 0;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #09090B;
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 13px;
  color: #71717A;
  margin-bottom: 20px;
  line-height: 1.4;
}

.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #09090B;
}

.form-hint {
  font-size: 12px;
  color: #71717A;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #71717A;
  pointer-events: none;
}

.input-suffix {
  position: absolute;
  right: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #71717A;
  pointer-events: none;
}

.input-control {
  width: 100%;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
  color: #09090B;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-control.has-prefix {
  padding-left: 28px;
}

.input-control.has-suffix {
  padding-right: 38px;
}

.input-control:focus {
  border-color: #09090B;
}

/* Range Sliders */
.range-slider-wrapper {
  margin-top: 6px;
}

.range-input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #E4E4E7;
  border-radius: 3px;
  outline: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #000000;
  cursor: pointer;
  border: 1px solid #000000;
}

.range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #000000;
  cursor: pointer;
  border: 1px solid #000000;
}

.range-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #71717A;
  margin-top: 4px;
}

/* Overhead Expander */
.overhead-summary-box {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 12px;
  margin-top: 8px;
}

.overhead-toggle-btn {
  background: none;
  border: none;
  color: #09090B;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  text-align: left;
}

.overhead-breakdown-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
}

.overhead-breakdown-table th, .overhead-breakdown-table td {
  padding: 6px 0;
  font-size: 12px;
  text-align: left;
}

.overhead-breakdown-table td:last-child {
  text-align: right;
}

/* Results Panel Details */
.primary-rate-hero {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}

.rate-kpi-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #71717A;
  margin-bottom: 4px;
}

.rate-kpi-val {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #09090B;
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
}

.rate-kpi-caption {
  font-size: 12px;
  color: #71717A;
  margin-top: 6px;
}

.derived-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.metric-mini-card {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 12px;
  min-width: 0;
}

.metric-mini-title {
  font-size: 11px;
  font-weight: 600;
  color: #71717A;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.metric-mini-val {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #09090B;
}

.financial-flow-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  overflow: hidden;
}

.financial-flow-table tr {
  border-bottom: 1px solid #E4E4E7;
}

.financial-flow-table tr:last-child {
  border-bottom: none;
}

.financial-flow-table td {
  padding: 10px 14px;
  font-size: 13px;
}

.financial-flow-table td.col-flow-val {
  text-align: right;
  font-weight: 600;
}

.flow-highlight {
  background-color: #FAFAFA;
  font-weight: 700;
}

/* Micro-Affiliate Section */
.affiliate-endorsement-box {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.affiliate-badge {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #71717A;
}

.affiliate-title {
  font-size: 13px;
  font-weight: 600;
  color: #09090B;
}

.affiliate-copy {
  font-size: 12px;
  color: #71717A;
  line-height: 1.4;
}

.affiliate-link-btn {
  display: inline-block;
  align-self: flex-start;
  margin-top: 6px;
  background-color: #09090B;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
}

.affiliate-link-btn:hover {
  background-color: #27272A;
}

/* Technical Algorithmic Methodology Section */
.methodology-container {
  margin-top: 48px;
  border-top: 1px solid #E4E4E7;
  padding-top: 36px;
}

.section-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717A;
  margin-bottom: 6px;
}

.methodology-heading {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #09090B;
  margin-bottom: 12px;
}

.methodology-lead {
  font-size: 14px;
  color: #71717A;
  line-height: 1.6;
  max-width: 820px;
  margin-bottom: 24px;
}

.formulas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.formula-card {
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 16px;
  min-width: 0;
}

.formula-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #09090B;
  margin-bottom: 6px;
}

.formula-code {
  display: block;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #09090B;
  overflow-x: auto;
  margin-bottom: 8px;
}

.formula-card-desc {
  font-size: 12px;
  color: #71717A;
  line-height: 1.5;
}

/* Work With Us Consultation Unit (Before Footer) */
.consultation-unit {
  max-width: 1140px;
  margin: 32px auto 0 auto;
  padding: 0 20px;
  width: 100%;
}

.consultation-card {
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 6px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.consultation-content {
  max-width: 600px;
}

.consultation-heading {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: #09090B;
}

.consultation-text {
  font-size: 13px;
  color: #71717A;
  line-height: 1.5;
}

.consultation-ctas {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-cta-black {
  background-color: #000000;
  color: #FFFFFF;
  border: 1px solid #000000;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.btn-cta-black:hover {
  background-color: #27272A;
}

.link-secondary-portfolio {
  font-size: 13px;
  font-weight: 600;
  color: #09090B;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Site Footer */
.site-footer {
  margin-top: 48px;
  background-color: #FAFAFA;
  border-top: 1px solid #E4E4E7;
  color: #71717A;
  font-size: 12px;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-brand {
  font-weight: 700;
  color: #09090B;
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-link {
  color: #71717A;
  text-decoration: none;
}

.footer-link:hover {
  color: #09090B;
  text-decoration: underline;
}

.footer-disclaimer {
  line-height: 1.6;
  border-top: 1px solid #E4E4E7;
  padding-top: 16px;
}

/* Native Modal Overlay */
.modal-scrim {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-scrim.hidden {
  display: none !important;
}

.modal-panel {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 6px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #09090B;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #71717A;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #09090B;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 3px;
  margin-bottom: 20px;
}

.segment-btn {
  background: none;
  border: none;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #71717A;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}

.segment-btn.active {
  background-color: #FFFFFF;
  color: #09090B;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.form-group-modal {
  margin-bottom: 14px;
}

.form-status-banner {
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 14px;
  display: none;
}

.form-status-banner.success {
  display: block;
  background-color: #FAFAFA;
  border: 1px solid #09090B;
  color: #09090B;
}

.form-status-banner.error {
  display: block;
  background-color: #FAFAFA;
  border: 1px solid #DC2626;
  color: #DC2626;
}

/* Floating Coffee Support */
.support-widget-float {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #09090B;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 30;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.support-widget-float:hover {
  transform: translateY(-2px);
  background-color: #27272A;
}

/* Responsive Breakpoints */
@media (max-width: 820px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .main-wrapper {
    padding: 18px 14px;
  }
  .panel-card {
    padding: 16px;
  }
  .hero-title {
    font-size: 26px;
  }
  .consultation-card {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
  }
  .segmented-control {
    grid-template-columns: 1fr;
  }
}