*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #059669;
  --brand-dark: #047857;
  --brand-light: #D1FAE5;
  --text: #064E3B;
  --text-muted: #64748b;
  --border: #0f172a;
  --bg: #F9FAFB;
  --white: #FFFFFF;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.6;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; font-weight: 800; color: var(--brand);
}
.header-badges { display: flex; gap: 6px; }
.badge {
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
}

/* ===== LAYOUT ===== */
.app-main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 0; }
.app-grid {
  display: grid; grid-template-columns: 420px 1fr; gap: 24px; align-items: start;
}
@media (max-width: 900px) { .app-grid { grid-template-columns: 1fr; } }

/* ===== INPUTS PANEL ===== */
.inputs-panel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.panel-header h2 { font-size: 16px; font-weight: 700; }
.btn-reset {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; font-family: inherit;
}
.btn-reset:hover { border-color: #EF4444; color: #EF4444; }

.input-group { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.input-group:last-child { border-bottom: none; }

.group-label {
  display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px;
  color: var(--text);
}
.label-icon { margin-right: 4px; }
.label-hint {
  display: block; font-size: 11px; color: var(--text-muted);
  font-weight: 400; margin-top: 1px;
}

.input-row {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--white); margin-bottom: 8px;
  transition: border-color .12s;
}
.input-row:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(5,150,105,.1); }
.input-prefix, .input-suffix {
  padding: 0 12px; background: var(--bg); color: var(--text-muted);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border-right: 1px solid var(--border);
}
.input-suffix { border-right: none; border-left: 1px solid var(--border); }

.calc-input {
  flex: 1; border: none; outline: none; padding: 10px 12px;
  font-size: 16px; font-weight: 700; color: var(--text);
  font-family: inherit; background: var(--white); min-width: 0;
}
.calc-input::-webkit-inner-spin-button { opacity: 0; }

.range-slider {
  width: 100%; accent-color: var(--brand); cursor: pointer;
  height: 4px; appearance: none; background: var(--brand-light);
  border-radius: 2px; outline: none;
}
.range-slider::-webkit-slider-thumb {
  appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--brand); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.range-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-muted); margin-top: 3px;
}

.calc-select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  color: var(--text); cursor: pointer; background: var(--white);
  outline: none;
}
.calc-select:focus { border-color: var(--brand); }

/* ===== RESULTS PANEL ===== */
.results-panel { display: flex; flex-direction: column; gap: 16px; }

/* Rate hero */
.rate-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius); padding: 28px 28px 24px;
  color: white; box-shadow: var(--shadow-md);
  text-align: center;
}
.rate-label { font-size: 13px; opacity: .8; font-weight: 500; margin-bottom: 8px; }
.rate-amount {
  font-size: 72px; font-weight: 900; line-height: 1;
  letter-spacing: -.04em; margin-bottom: 8px;
}
.rate-note { font-size: 13px; opacity: .75; }

/* Rate grid */
.rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rate-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  text-align: center;
}
.rate-card-val { font-size: 24px; font-weight: 800; color: var(--brand); }
.rate-card-lbl { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* Breakdown */
.breakdown-card, .market-card, .tips-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.breakdown-title, .market-title, .tips-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px;
}
.breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row.total {
  font-weight: 800; font-size: 15px; color: var(--brand);
  border-top: 2px solid var(--border); padding-top: 12px; margin-top: 4px;
}
.bd-label { color: var(--text-muted); }
.bd-val { font-weight: 600; color: var(--text); }

/* Market comparison */
.market-row {
  display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0;
}
.market-bar-track {
  flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden;
}
.market-bar-fill { height: 100%; border-radius: 3px; }
.market-label { min-width: 100px; color: var(--text-muted); }
.market-val { min-width: 60px; text-align: right; font-weight: 600; }
.your-marker {
  padding: 8px 12px; background: var(--brand-light); border-radius: 6px;
  font-size: 13px; margin-top: 8px; color: var(--brand-dark); font-weight: 500;
}

/* Tips */
.tip-item { font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.tip-item:last-child { border-bottom: none; }
.tip-item strong { color: var(--text); }

/* ===== GUIDE ===== */
.guide-section { border-top: 1px solid var(--border); margin-top: 32px; padding: 36px 20px; background: var(--white); }
.guide-inner { max-width: 1200px; margin: 0 auto; }
.guide-inner h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.guide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .guide-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.guide-card h3 { font-size: 14px; font-weight: 700; color: var(--brand-dark); margin-bottom: 8px; }
.guide-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ===== FOOTER ===== */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px; line-height: 1.8; margin-top: 20px; background: var(--white); }
.footer-small { font-size: 11px; color: #5b6878; }
