/* EVCharge — dark "instrument cluster" theme.
   Deep night-slate surfaces with emerald charge-green and amber bolt accents:
   an EV dashboard look, distinct from the light utility-paper and developer
   palettes of sibling nxtolerance sites. All colors flow through base vars. */

:root {
  --bg: #0b1119;
  --surface: #121b28;
  --surface-2: #182335;
  --text: #e6edf6;
  --text-dim: #93a1b8;
  --border: #26364e;
  --ev-good: #34d399;
  --ev-warn: #f59e0b;
  --ev-tick: rgba(52, 211, 153, 0.06);
}
html {
  color-scheme: dark;
}

/* ---------- calculator shell ---------- */
.ev {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1.4rem 0 1.8rem;
  box-shadow: 0 14px 44px -30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
@media (min-width: 54rem) {
  .prose .ev {
    width: min(62rem, calc(100vw - 2.5rem));
  }
}

/* ---------- input grid ---------- */
.ev-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.6rem, 1fr));
  gap: 0.7rem 0.8rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background:
    repeating-linear-gradient(90deg, transparent 0 2.2rem, var(--ev-tick) 2.2rem calc(2.2rem + 1px)),
    var(--surface-2);
}
.ev-f {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.ev-f-wide {
  grid-column: span 2;
}
.ev-f > span,
.ev-kind > span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ev-f small {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.ev input[type="text"],
.ev select {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.38rem 0.5rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem; /* 44px tap target */
}
.ev select {
  font-family: var(--font);
  font-size: 0.86rem;
}
.ev input:focus,
.ev select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

/* chips (target % + price presets) */
.ev-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.ev-chip {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--primary);
  cursor: pointer;
  min-height: 2.75rem;
}
.ev-chip:hover {
  border-color: var(--primary);
}

/* AC/DC segmented control */
.ev-kind {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.ev-kind-opts {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  min-height: 2.75rem;
}
.ev-kind-opts label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg);
  cursor: pointer;
}
.ev-kind-opts label + label {
  border-inline-start: 1px solid var(--border);
}
.ev-kind-opts input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ev-kind-opts label:has(input:checked) {
  background: color-mix(in srgb, var(--primary) 18%, var(--bg));
  color: var(--primary);
}
.ev-kind-opts label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* ---------- hero ---------- */
.ev-hero {
  display: block;
  padding: 1.1rem 1rem 0.9rem;
  font-size: 1.02rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.ev-hero strong {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.ev-herosub {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.ev-hint {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ---------- result cards ---------- */
.ev-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ev-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.55rem 0.7rem;
}
.ev-card.is-key {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}
.ev-card .k {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ev-card strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  margin: 0.1rem 0;
}
.ev-card.is-key strong {
  color: var(--primary);
}
.ev-card small {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* ---------- chart ---------- */
.ev-chartwrap {
  padding: 0.9rem 1rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
.ev-chart {
  width: 100%;
  display: block;
}
.ev-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  font-size: 0.76rem;
  color: var(--text-dim);
  padding: 0.3rem 0 0.6rem;
}
.ev-legend i {
  display: inline-block;
  width: 0.9rem;
  height: 0.22rem;
  border-radius: 2px;
  margin-inline-end: 0.35rem;
  vertical-align: middle;
}
.ev-legend i.dash {
  background: none !important;
  border-top: 2px dashed;
  height: 0;
}

/* ---------- slice table ---------- */
.ev-slices-wrap {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ev-slices-wrap:not([hidden]) {
  display: block;
}
.ev-slices-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 0.55rem;
}
.ev-slices {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.ev-slices th {
  text-align: start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0.4rem;
}
.ev-slices td {
  border-bottom: 1px dashed var(--border);
  padding: 0.32rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.ev-slices tr:last-child td {
  border-bottom: none;
}
.ev-slices td:first-child {
  font-family: var(--font);
  font-weight: 650;
}

/* ---------- notes ---------- */
.ev-notes {
  margin: 0;
  padding: 0.8rem 1rem 1rem 1.9rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.ev-notes li {
  margin: 0.28rem 0;
  line-height: 1.45;
}
.ev-notes li::marker {
  color: var(--accent);
}

/* ---------- article polish ---------- */
.prose table {
  font-variant-numeric: tabular-nums;
}
.prose table code {
  white-space: nowrap;
}
.formula {
  display: block;
  font-family: var(--mono);
  font-size: 0.92rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin: 0.8rem 0;
  overflow-x: auto;
}

/* ---------- mobile ---------- */
@media (max-width: 40rem) {
  .ev-f-wide {
    grid-column: 1 / -1;
  }
  .ev-hero strong {
    font-size: 1.3rem;
  }
}
@media (max-width: 53.99rem) {
  .prose .ev {
    display: flex;
    flex-direction: column;
  }
  .ev-hero {
    order: -2;
    border-top: 1px solid var(--border);
  }
  .ev-cards {
    order: -1;
    border-bottom: 0;
  }
}
