/* ==========================================================================
   Electric scooter savings calculator
   Clean, professional, green and white. Subtle motion only.
   ========================================================================== */

:root {
  --bg: #f3f7f5;
  --card: #ffffff;
  --ink: #0d1f18;
  --ink-2: #33483f;
  --muted: #667a71;
  --line: #e1ebe6;
  --line-2: #cfe0d8;
  --green: #0f8a5f;
  --green-700: #0a6e4b;
  --green-900: #064e3b;
  --mint: #ecf7f1;
  --mint-2: #d4eee1;
  --rose: #be123c;
  --shadow: 0 1px 2px rgba(6, 78, 59, .05), 0 10px 28px -14px rgba(6, 78, 59, .22);
  --radius: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select { font: inherit; color: inherit; }
p, h1, h2, h3 { margin: 0; }
:focus-visible { outline: 3px solid rgba(15, 138, 95, .35); outline-offset: 2px; border-radius: 8px; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.app-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #16b57a, var(--green-900));
  box-shadow: 0 6px 14px -8px rgba(15, 138, 95, .9);
}
.brand-mark svg { width: 18px; height: 18px; fill: #fff; }
.brand-name { font-weight: 800; letter-spacing: -.01em; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- Main navigation (Calculator / Stock) ---------- */
.app-nav { margin-left: auto; display: flex; gap: 4px; }
.app-nav a {
  padding: 8px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--ink-2); text-decoration: none;
  transition: background .2s, color .2s;
}
.app-nav a:hover { background: var(--mint); color: var(--green-700); }
.app-nav a[aria-current="page"] { background: var(--mint); color: var(--green-900); box-shadow: inset 0 0 0 1px var(--mint-2); }

/* ---------- Page title ---------- */
.page-title { padding: 40px 0 26px; }
.page-title h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -.025em; }
.page-title p { margin-top: 8px; color: var(--muted); font-size: 16px; max-width: 640px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
  animation: cardIn .6s var(--ease) both;
}
.card + .card { animation-delay: .12s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.card-head p { margin-top: 4px; color: var(--muted); font-size: 14px; max-width: 620px; }
.step {
  flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mint); color: var(--green-700);
  font-weight: 800; font-size: 15px;
}

.label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); }

/* ---------- Calculator 1: distance ---------- */
.distance-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }

.km-field {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px; border-radius: 12px;
  background: var(--mint); border: 1px solid var(--mint-2);
  transition: border-color .2s, box-shadow .2s;
}
.km-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(15, 138, 95, .14); }
.km-field input {
  width: 74px; padding: 6px 8px; border: 0; background: #fff; border-radius: 9px;
  font-size: 20px; font-weight: 800; text-align: center; color: var(--green-900);
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.km-field input::-webkit-outer-spin-button, .km-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.km-field input:focus { outline: none; }
.km-field span { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.slider {
  --fill: 14.5%;
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background-image: linear-gradient(90deg, #16b57a, var(--green-700)), linear-gradient(#e3efe9, #e3efe9);
  background-size: var(--fill) 100%, 100% 100%;
  background-repeat: no-repeat;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  width: 26px; height: 26px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 3px solid var(--green);
  box-shadow: 0 2px 8px rgba(6, 78, 59, .25);
  transition: transform .2s var(--ease), box-shadow .25s;
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.06); }
.slider.dragging::-webkit-slider-thumb, .slider:active::-webkit-slider-thumb {
  transform: scale(1.12); box-shadow: 0 0 0 8px rgba(15, 138, 95, .14), 0 2px 8px rgba(6, 78, 59, .25);
}
.slider::-moz-range-track { height: 8px; border-radius: 999px; background: #e3efe9; }
.slider::-moz-range-progress { height: 8px; border-radius: 999px; background: linear-gradient(90deg, #16b57a, var(--green-700)); }
.slider::-moz-range-thumb {
  box-sizing: border-box; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 3px solid var(--green); box-shadow: 0 2px 8px rgba(6, 78, 59, .25);
}

.scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Calculator 1: result tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 26px; }
@media (min-width: 820px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

.tile {
  border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px;
  background: #fff; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -16px rgba(6, 78, 59, .45); border-color: var(--line-2); }
.tile-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tile-value {
  margin-top: 8px; font-size: clamp(1.45rem, 2.6vw, 1.85rem); font-weight: 800; letter-spacing: -.02em;
  color: var(--green-900); font-variant-numeric: tabular-nums; line-height: 1.15;
}
.tile-sub { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.tile-accent { background: linear-gradient(140deg, #0f8a5f 0%, var(--green-900) 100%); border-color: transparent; }
.tile-accent .tile-label { color: rgba(255, 255, 255, .8); }
.tile-accent .tile-value { color: #fff; }
.tile-accent:hover { border-color: transparent; }

/* ---------- Calculator 1: comparison table ---------- */
.table-wrap { margin-top: 22px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.compare { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.compare th, .compare td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.compare thead th { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 0; }
.compare tbody th { font-weight: 700; color: var(--ink-2); }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }
.compare .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.compare .save { font-weight: 800; color: var(--green-700); }
.compare tbody tr { transition: background .2s; }
.compare tbody tr:hover { background: #f7fbf9; }

.note { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* ---------- Rates panel ---------- */
.rates { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.rates summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--green-700); font-size: 14px;
}
.rates summary::-webkit-details-marker { display: none; }
.rates summary::after {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .3s var(--ease);
}
.rates[open] summary::after { transform: rotate(225deg) translateY(-2px); }

.rates-grid { display: grid; gap: 14px; margin-top: 16px; }
@media (min-width: 760px) { .rates-grid { grid-template-columns: repeat(3, 1fr); } }
.rates-grid fieldset { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 6px; }
.rates-grid legend { padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--green-900); }
.field { display: grid; grid-template-columns: 1fr 96px; align-items: center; gap: 10px; margin: 8px 0 10px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field input {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-2);
  background: #fbfdfc; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 138, 95, .15); }
.rates-actions { margin-top: 16px; }
.fine { margin: 4px 2px 8px; font-size: 12px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 700;
  transition: background .2s, box-shadow .2s, transform .15s;
}
.btn:active { transform: scale(.98); }
.btn-ghost { background: #fff; color: var(--green-700); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: var(--mint); }

/* ---------- Calculator 2: payback ---------- */
.payback { display: grid; gap: 26px; grid-template-columns: minmax(0, 1fr); }
.payback > * { min-width: 0; }
@media (min-width: 820px) { .payback { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: stretch; gap: 32px; } }

.payback-inputs { display: flex; flex-direction: column; }
.price-field {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: #fbfdfc;
  transition: border-color .2s, box-shadow .2s;
}
.price-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(15, 138, 95, .14); }
.price-field span { font-size: 22px; font-weight: 700; color: var(--muted); }
.price-field input {
  flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 26px; font-weight: 800; letter-spacing: -.01em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hint { margin-top: 10px; font-size: 13px; color: var(--muted); }

.linked {
  margin-top: 22px; padding: 16px 18px; border-radius: 14px;
  background: var(--mint); border: 1px solid var(--mint-2);
}
.linked-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green-700); }
.linked-value { margin-top: 6px; font-size: 15px; color: var(--ink-2); }
.linked-value strong { font-size: 19px; font-weight: 800; color: var(--green-900); font-variant-numeric: tabular-nums; }

.result {
  position: relative; overflow: hidden;
  border-radius: 16px; padding: 26px 26px 24px;
  background: linear-gradient(150deg, #10956a 0%, var(--green-700) 45%, var(--green-900) 100%);
  color: #fff;
  display: flex; flex-direction: column; justify-content: center;
}
.result::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 66%); pointer-events: none;
}
.result-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .8); }
.result-days {
  margin-top: 6px; font-size: clamp(2.6rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-days small { font-size: 1.1rem; font-weight: 700; letter-spacing: 0; color: rgba(255, 255, 255, .85); }
.result-sub { margin-top: 10px; font-size: 15px; color: rgba(255, 255, 255, .92); min-height: 1.5em; }

.timeline { margin-top: 24px; }
.track { position: relative; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .2); }
.fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #ffffff, #bbf7d9);
  transition: width .9s var(--ease);
}
.marker {
  position: absolute; top: 50%; left: 0; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 5px rgba(255, 255, 255, .25);
  transform: translate(-50%, -50%);
  transition: left .9s var(--ease);
}
.scale-labels { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: rgba(255, 255, 255, .75); font-weight: 600; }

.stats { display: grid; gap: 12px; margin-top: 24px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { margin-top: 6px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; color: var(--green-900); font-variant-numeric: tabular-nums; }
.stat-value.negative { color: var(--rose); }

.footer-note { padding: 4px 0 40px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Phone ---------- */
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .page-title { padding: 28px 0 20px; }
  .card { padding: 22px 18px; }
  .card-head { gap: 12px; }
  .compare { font-size: 13px; }
  .compare th, .compare td { padding: 10px 7px; }
  .compare thead th { font-size: 11px; letter-spacing: .04em; }
  .result { padding: 22px 20px; }
  .scale-labels span:nth-child(even) { display: none; }
  .header-inner { height: auto; flex-wrap: wrap; gap: 10px 12px; padding-top: 12px; padding-bottom: 12px; }
  .brand-sub { display: none; }
  .app-nav { margin-left: 0; flex-wrap: wrap; }
  .app-nav a { white-space: nowrap; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
