:root {
  --blue: #006eec;
  --blue-dark: #073b79;
  --blue-050: #f4f9ff;
  --blue-100: #e9f3ff;
  --blue-200: #d5e8ff;
  --text: #142235;
  --muted: #667386;
  --line: #dce4ee;
  --surface: #ffffff;
  --bg: #f6f8fb;
  --danger: #b42318;
  --success: #067647;
  --radius: 18px;
  --shadow: 0 16px 45px rgba(20, 54, 90, .09);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(1040px, 100%); margin: 0 auto; padding: 0 20px 60px; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0; margin-bottom: 26px;
  background: rgba(255,255,255,.93); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(220,228,238,.7);
}
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 14px; padding: 0; color: inherit; text-align: left; }
.brand-logo-badge {
  width: 82px;
  height: 52px;
  flex: 0 0 82px;
  display: grid;
  place-items: center;
  padding: 6px 8px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(20, 54, 90, .08);
  border: 1px solid var(--blue-200);
}
.brand-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: none;
}
.brand-divider { width: 1px; height: 38px; background: var(--line); }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { color: var(--blue-dark); letter-spacing: .02em; font-size: 18px; }
.brand-copy small { color: var(--muted); }
.nav-action, .back-link {
  border: 1px solid var(--line); background: #fff; color: var(--blue-dark);
  border-radius: 12px; padding: 10px 14px; display: inline-flex; gap: 8px; align-items: center;
}
.nav-action:hover, .back-link:hover { border-color: var(--blue-200); background: var(--blue-050); }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.hero-copy, .settings-heading { margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.05; margin: 0 0 10px; color: #101a28; letter-spacing: -.03em; }
.hero-copy > p:last-child, .settings-heading > p:last-child { color: var(--muted); margin: 0; font-size: 17px; }
.panel, .settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-panel { padding: 24px; }
.field-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field, .time-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .time-field legend { font-weight: 700; color: #334155; font-size: 14px; }
.field em, .time-field em { color: var(--muted); font-style: normal; font-weight: 500; }
.field small { color: var(--muted); line-height: 1.35; }
input, select {
  width: 100%; min-height: 48px; border: 1px solid #cfd8e4; border-radius: 12px;
  background: #fbfcfe; padding: 11px 13px; color: var(--text); outline: none;
  transition: border .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,110,236,.12); background: #fff; }
.input-suffix, .input-prefix { position: relative; display: flex; align-items: center; }
.input-suffix input { padding-right: 54px; }
.input-prefix input { padding-left: 48px; }
.input-suffix > b, .input-prefix > b { position: absolute; color: #607084; font-size: 13px; pointer-events: none; }
.input-suffix > b { right: 14px; }
.input-prefix > b { left: 14px; }
.time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-btn, .secondary-btn {
  width: 100%; border-radius: 13px; min-height: 52px; font-weight: 800; letter-spacing: .025em;
  display: inline-flex; justify-content: center; align-items: center; gap: 10px;
}
.primary-btn { border: 1px solid var(--blue); background: var(--blue); color: #fff; box-shadow: 0 10px 22px rgba(0,110,236,.2); }
.primary-btn:hover { filter: brightness(.96); }
.secondary-btn { border: 1px solid var(--line); background: #fff; color: var(--blue); margin-top: 12px; }
.secondary-btn:hover { background: var(--blue-050); border-color: var(--blue-200); }
.form-message { min-height: 0; margin: 0; color: var(--danger); font-size: 14px; font-weight: 650; }
.form-message:not(:empty) { margin: 0 0 14px; padding: 10px 12px; background: #fff1f0; border-radius: 10px; }
.results { margin-top: 22px; }
.hidden { display: none !important; }
.result-main {
  background: linear-gradient(135deg, var(--blue-050), #fff); border: 1px solid var(--blue-200);
  border-radius: var(--radius); padding: 26px; text-align: center; box-shadow: var(--shadow);
}
.result-label { color: var(--blue); font-size: 13px; font-weight: 850; letter-spacing: .08em; }
.result-main > strong { display: block; color: var(--blue); font-size: clamp(34px, 7vw, 58px); line-height: 1; margin: 10px 0 18px; letter-spacing: -.03em; }
.result-total { border-top: 1px solid var(--blue-200); padding-top: 15px; color: var(--muted); }
.result-total b { color: var(--text); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0; }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 18px; }
.metric-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.metric-card strong { display: block; color: #15243a; font-size: 20px; margin-bottom: 5px; }
.metric-card small { color: var(--muted); }
.breakdown { padding: 0; margin: 14px 0; box-shadow: none; }
.breakdown summary, .advanced-settings summary { padding: 16px 18px; cursor: pointer; color: var(--blue-dark); font-weight: 750; }
.breakdown-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; padding: 0 18px 16px; }
.breakdown-item { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 7px; color: var(--muted); }
.breakdown-item b { color: var(--text); white-space: nowrap; }
.helper-note, .result-footnote { color: var(--muted); font-size: 12px; line-height: 1.5; }
.helper-note { margin: 0; padding: 0 18px 18px; }
.result-footnote { text-align: center; }
.settings-heading .back-link { margin-bottom: 28px; }
.info-callout { display: flex; gap: 12px; align-items: flex-start; background: var(--blue-050); border: 1px solid var(--blue-200); color: #284966; border-radius: 15px; padding: 15px 17px; margin-bottom: 16px; line-height: 1.45; }
.info-callout > span { color: var(--blue); font-size: 19px; }
.settings-stack { display: grid; gap: 16px; }
.settings-card { padding: 20px; box-shadow: 0 10px 28px rgba(20,54,90,.06); }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title > span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-100); color: var(--blue); font-weight: 900; }
.card-title h2 { margin: 0; font-size: 18px; color: var(--blue-dark); }
.card-help { color: var(--muted); margin: -4px 0 14px; font-size: 13px; }
.compact-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; }
.compact-field { display: grid; grid-template-columns: 1fr; gap: 6px; color: #334155; font-weight: 700; font-size: 13px; }
.compact-field small { color: var(--muted); font-weight: 500; }
.max-field { max-width: 360px; }
.helper-link { border: 0; background: transparent; color: var(--blue); padding: 10px 0 0; }
.tip { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid var(--blue-200); background: var(--blue-050); color: var(--blue); font-size: 12px; font-weight: 800; }
.advanced-settings { border-top: 1px solid var(--line); margin-top: 15px; }
.advanced-settings summary { padding: 14px 0 8px; font-size: 13px; }
.modal { border: 0; padding: 0; background: transparent; max-width: 520px; width: calc(100% - 30px); }
.modal::backdrop { background: rgba(6, 20, 38, .48); backdrop-filter: blur(3px); }
.modal-card { position: relative; background: #fff; border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.25); display: grid; gap: 14px; }
.modal-card h2 { margin: -5px 0 0; color: var(--blue-dark); }
.modal-card p { margin: 0; color: var(--muted); }
.modal-close { position: absolute; right: 14px; top: 12px; border: 0; background: transparent; font-size: 30px; color: var(--muted); }
.helper-result { background: var(--blue-050); border-radius: 12px; padding: 14px; color: var(--muted); }
.helper-result strong { color: var(--blue-dark); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; background: #13243a; color: #fff; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 780px) {
  .app-shell { padding: 0 14px 40px; }
  .topbar { padding: 12px 0; margin-bottom: 22px; }
  .brand-logo-badge { width: 60px; height: 40px; flex-basis: 60px; padding: 5px 6px; border-radius: 11px; }
  .brand-divider { height: 30px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy small { font-size: 11px; }
  .nav-action span:last-child { display: none; }
  .nav-action { padding: 10px 12px; }
  h1 { font-size: 32px; }
  .hero-copy > p:last-child, .settings-heading > p:last-child { font-size: 15px; }
  .form-panel, .settings-card { padding: 17px; }
  .two-col, .three-col, .result-grid, .breakdown-grid { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: 1fr 1fr; }
  .field-grid { gap: 14px; margin-bottom: 14px; }
  .result-main { padding: 22px 16px; }
  .result-main > strong { font-size: 40px; }
  .metric-card { padding: 15px; }
}
@media (max-width: 420px) {
  .brand-copy small { display: none; }
  .compact-grid { grid-template-columns: 1fr; }
  .time-inputs { grid-template-columns: 1fr 1fr; }
}
