/* Power Station Calculator — "Hellotime" monochrome editorial command center */

:root {
  --ink: #151619;
  --smoke: #7f8491;
  --fog: #c8cad0;
  --ash: #e1e2e5;
  --mist: #f3f3f5;
  --paper: #ffffff;
  --charcoal: #25272d;
  --graphite: #363940;
  --pewter: #b0b3bb;
  --green: #059669;

  --grad: linear-gradient(90deg, #0560fd 0%, #3a8dff 50%, #c3d9ff 100%);

  --r-nav: 8px;
  --r-btn: 8px;
  --r-input: 12px;
  --r-card: 16px;
  --r-bar: 4px;
  --r-pill: 9999px;

  --max: 1200px;
  --gutter: 24px;
  --gap: 24px;
  --card-pad: 32px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --z-nav: 100;
  --z-modal: 400;
  --z-toast: 500;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

.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;
}

/* ---------- Navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--paper);
  border-bottom: 1px solid var(--fog);
}

.nav__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  display: inline-flex;
}

.brand__name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.1px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--paper);
}

.btn--primary:hover {
  background: var(--ink);
  border-color: var(--ink);
}

.btn--ghost {
  background: transparent;
  border-color: var(--pewter);
  color: var(--ink);
  font-weight: 500;
}

.btn--ghost:hover {
  background: var(--mist);
  border-color: var(--graphite);
}

.btn--block {
  width: 100%;
}

/* Short mobile label variant; the long label is the default. */
.btn__label--short {
  display: none;
}

.btn--sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Layout ---------- */

.page {
  max-width: var(--max);
  margin: 0 auto;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: 72px 0;
}

.section--compare {
  border-top: 1px solid var(--ash);
}

.section-head {
  max-width: 760px;
  margin-bottom: 48px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin-bottom: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--r-pill);
}

.section-head h1 {
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -1.2px;
  color: var(--ink);
}

.section-head h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.8px;
  color: var(--ink);
}

.lede {
  margin-top: 16px;
  max-width: 620px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--smoke);
}

.grad {
  background: linear-gradient(90deg, #0560fd, #3a8dff, #c3d9ff, #3a8dff, #0560fd);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: 220% center;
  }
}

.card-stack {
  display: grid;
  /* minmax(0, 1fr) — a bare 1fr keeps the items' automatic minimum size
     (the device table's min-content width), which overflows narrow screens. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.stations {
  min-width: 0;
}

.stations__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

/* ---------- Cards ---------- */

.card,
.station-summary,
.empty-state,
.result-tile,
.compare-card {
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-card);
}

.card {
  padding: var(--card-pad);
}

.card__head {
  margin-bottom: 24px;
}

.card__head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.card__head p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--smoke);
}

/* ---------- Forms / fields ---------- */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--graphite);
}

.field input,
.field select {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-input);
  transition: background-color 160ms ease-out, border-color 160ms ease-out, box-shadow 160ms ease-out;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14' fill='none' stroke='%237f8491' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.field input[type="number"],
.device-table input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button,
.device-table input[type="number"]::-webkit-outer-spin-button,
.device-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field input::placeholder {
  color: var(--pewter);
}

.field input:focus,
.field select:focus {
  outline: none;
  background-color: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(21, 22, 25, 0.08);
}

.req {
  margin-left: 2px;
  font-weight: 700;
  color: var(--ink);
}

.field__hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--smoke);
}

.field__error {
  margin-top: 6px;
  min-height: 1.1em;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.field.is-invalid input,
.field.is-invalid select {
  background: var(--paper);
  border-color: var(--ink);
}

/* ---------- Device table ---------- */

.formula {
  margin-bottom: 18px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--smoke);
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-btn);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 8px;
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.device-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--smoke);
  border-bottom: 1px solid var(--fog);
}

.device-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--ash);
  vertical-align: middle;
}

.device-table tbody tr:hover td {
  background: var(--mist);
}

.device-table td:last-child {
  text-align: right;
}

.device-table td[data-wh] {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.device-table input {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ash);
  border-radius: var(--r-btn);
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.device-table input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
}

.device-table input.is-invalid {
  border-color: var(--ink);
  border-width: 2px;
  background: var(--paper);
}

.device-table__qty {
  width: 72px;
}

.device-remove {
  display: inline-flex;
  padding: 8px;
  background: none;
  border: none;
  border-radius: var(--r-btn);
  color: var(--smoke);
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

.device-remove:hover {
  color: var(--ink);
  background: var(--ash);
}

.device-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 32px;
  padding: 16px 2px 0;
  font-size: 14px;
  color: var(--smoke);
}

.device-total__figures {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.device-total strong {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Empty state ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 32px;
  text-align: center;
  border-style: dashed;
  color: var(--smoke);
}

.empty-state svg {
  color: var(--pewter);
}

.empty-state p {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Station tabs ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.tab:hover {
  background: var(--mist);
  border-color: var(--pewter);
}

.tab--add {
  font-weight: 600;
  color: var(--graphite);
  border-style: dashed;
  border-color: var(--pewter);
}

.tab--add:hover {
  color: var(--ink);
  border-color: var(--graphite);
}

.tab.is-active {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--paper);
}

.tab__count {
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--smoke);
  background: var(--mist);
  border-radius: var(--r-pill);
}

.tab.is-active .tab__count {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.16);
}

.tab__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: var(--r-pill);
  background: var(--mist);
  color: var(--smoke);
  cursor: pointer;
  line-height: 1;
  transition: background-color 160ms ease-out, color 160ms ease-out;
}

.tab__remove:hover {
  background: var(--ash);
  color: var(--ink);
}

.tab.is-active .tab__remove {
  background: rgba(255, 255, 255, 0.16);
  color: var(--paper);
}

/* ---------- Station summary ---------- */

.station-summary {
  padding: 24px;
  margin-bottom: 16px;
}

.station-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-input);
}

.metric__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--smoke);
}

.metric__value {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  height: 6px;
  margin-top: 16px;
  background: var(--ash);
  border-radius: var(--r-bar);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--charcoal);
  border-radius: var(--r-bar);
  transition: width 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Station results ---------- */

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.result-tile {
  display: flex;
  flex-direction: column;
  padding: 24px;
  animation: rise 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-tile:nth-child(2) {
  animation-delay: 70ms;
}

.result-tile:nth-child(3) {
  animation-delay: 140ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.result-tile__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--smoke);
}

.result-tile__value {
  margin-top: 8px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.result-tile__unit {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--smoke);
}

.result-tile__meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--smoke);
}

.result-tile__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: 14px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1px solid var(--ash);
}

.result-tile__status--ok {
  color: var(--graphite);
  background: var(--mist);
}

.result-tile__status--warn {
  color: var(--paper);
  background: var(--charcoal);
  border-color: var(--charcoal);
}

/* ---------- Comparison ---------- */

.compare-card {
  padding: 24px;
}

.compare-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.compare-card__head h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.compare-note {
  margin-top: 4px;
  font-size: 13px;
  color: var(--smoke);
}

/* Daily need is the same for every station, so it is stated once above the table. */
.compare-daily {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-input);
}

.compare-daily__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--smoke);
}

.compare-daily__values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  font-size: 14px;
  color: var(--smoke);
}

.compare-daily__values strong {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.compare-locked {
  padding: 40px 24px;
  font-size: 15px;
  text-align: center;
  color: var(--smoke);
  background: var(--mist);
  border: 1px dashed var(--fog);
  border-radius: var(--r-card);
}

.compare-table-wrap {
  /* Own scroll area: the sticky header then needs no viewport/nav offset, and a
     long list keeps its column names without scrolling the whole page. */
  max-height: min(70vh, 620px);
  overflow: auto;
  border-radius: var(--r-input);
}

.compare-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 14px;
}

.compare-table th,
.compare-table td {
  padding: 14px 16px;
  text-align: right;
  white-space: nowrap;
}

.compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--charcoal);
}

.compare-table thead th:first-child,
.compare-table thead th:nth-child(2) {
  text-align: left;
}

.compare-table td {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--ash);
}

.compare-table td:first-child,
.compare-table td:nth-child(2) {
  text-align: left;
}

.compare-table th:nth-child(n + 5),
.compare-table td:nth-child(n + 5) {
  text-align: center;
}

.compare-table td:first-child {
  font-weight: 600;
}

.compare-table td:nth-child(2) {
  color: var(--smoke);
  font-weight: 400;
}

.compare-table tbody tr:nth-child(even) td {
  background: var(--mist);
}

.compare-table tbody tr:hover td {
  background: var(--ash);
}

.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.compare-table td.is-best {
  font-weight: 700;
}

/* The single sanctioned accent moment: Signal Green is spent here and nowhere
   else in the app, per the design-system note in DESIGN.md. */
.best-badge {
  display: inline-block;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--paper);
  background: var(--green);
  border-radius: var(--r-pill);
}

/* ---------- Comparison: sorting, bars, checklist, ranked view ---------- */

.compare-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* The dark header inverts the global focus ring, so it gets its own. */
.compare-sort:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
  border-radius: 2px;
}

.compare-sort__arrow {
  font-size: 10px;
  opacity: 0.5;
}

.compare-sort.is-active .compare-sort__arrow {
  opacity: 1;
}

.compare-sort:hover .compare-sort__arrow {
  opacity: 1;
}

.compare-station {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compare-station__name {
  font-weight: 600;
}

.compare-station__brand {
  font-size: 12px;
  font-weight: 400;
  color: var(--smoke);
}

/* Magnitude, not status: a longer bar always means "more", and bars are only
   used on the columns where more is better. */
.compare-bar {
  display: block;
  height: 4px;
  margin-top: 7px;
  background: var(--ash);
  border-radius: var(--r-bar);
  overflow: hidden;
}

.compare-bar__fill {
  display: block;
  height: 100%;
  background: var(--grad);
  border-radius: var(--r-bar);
  transform-origin: left center;
  animation: bar-grow 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes bar-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.compare-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--fog);
  border-radius: var(--r-input);
}

.compare-empty {
  padding: 32px;
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-card);
}

.compare-empty h3 {
  margin-bottom: 12px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.compare-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--graphite);
}

.compare-check__lead {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--graphite);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-input);
}

.check__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
}

.check__what {
  font-size: 14px;
  font-weight: 600;
}

.check__why {
  font-size: 13px;
  color: var(--smoke);
}

/* The ranked view is offered at every width. It is hidden by default and the
   card's is-rank / is-specs class decides which of the two views is showing. */
.compare-rank {
  display: none;
}

.compare-card.is-rank .compare-rank {
  display: block;
}

.compare-card.is-rank .compare-table-wrap {
  display: none;
}

/* The metric picker only drives the ranked list, so it is pointless in table view. */
.compare-card.is-specs .rank-picks {
  display: none;
}

.seg--view {
  flex-shrink: 1;
  margin-bottom: 10px;
}

.rank-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.rank-pick {
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--graphite);
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.rank-pick:hover {
  background: var(--mist);
  border-color: var(--pewter);
}

.rank-pick.is-active {
  color: var(--paper);
  background: var(--charcoal);
  border-color: var(--charcoal);
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank {
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-input);
}

.rank__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.rank__pos {
  min-width: 20px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--smoke);
}

.rank__name {
  margin-right: auto;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.rank__value {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rank__value.is-best {
  padding: 2px 10px;
  font-size: 13px;
  color: var(--paper);
  background: var(--green);
  border-radius: var(--r-pill);
}

.rank__brand {
  margin-top: 2px;
  font-size: 12px;
  color: var(--smoke);
}

/* Station summary actions: shortlist on the left, edit on the right. */
.station-summary__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.shortlist {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--graphite);
  cursor: pointer;
}

.compare-rank__controls {
  margin-bottom: 16px;
}

.rank-picks:last-child {
  margin-bottom: 0;
}

.shortlist input {
  width: 16px;
  height: 16px;
  accent-color: var(--charcoal);
  cursor: pointer;
}

/* An incomplete station gets a bordered count instead of a filled one, so the
   tabs read as "needs attention" without introducing a status colour. */
.tab__count--todo {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--pewter);
}

.tab.is-active .tab__count--todo {
  color: var(--paper);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .compare-bar__fill {
    animation: none;
  }
}

/* ---------- Station modal ---------- */

body.is-modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(21, 22, 25, 0.55);
  animation: fade-in 200ms ease-out both;
}

.modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  padding: 28px 32px;
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-card);
  animation: rise 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal__dialog form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -10px;
  padding: 0 10px;
}

.modal__head {
  flex-shrink: 0;
  margin-bottom: 20px;
}

.modal__head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.modal__head p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--smoke);
}

.modal__actions {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ash);
}

.modal__actions .btn {
  flex: 1;
}

.modal--guideline .modal__dialog {
  display: block;
  max-width: 640px;
  overflow-y: auto;
}

.modal__close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 12px;
  padding: 0;
  color: var(--smoke);
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

.modal__close:hover {
  color: var(--ink);
  background: var(--ash);
}

/* ---------- Station source picker ---------- */

.seg {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-input);
}

.seg__btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--smoke);
  background: transparent;
  border: 0;
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

.seg__btn:hover {
  color: var(--ink);
}

.seg__btn.is-active {
  color: var(--paper);
  background: var(--charcoal);
}

.catalog {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ash);
}

.catalog__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--graphite);
}

.catalog__count {
  font-weight: 400;
  color: var(--smoke);
}

.catalog__note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--smoke);
}

.search {
  position: relative;
}

.search input {
  width: 100%;
  padding: 11px 38px 11px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-input);
  transition: background-color 160ms ease-out, border-color 160ms ease-out, box-shadow 160ms ease-out;
}

.search input::placeholder {
  color: var(--pewter);
}

.search input:focus {
  outline: none;
  background-color: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(21, 22, 25, 0.08);
}

.search__clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--smoke);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

.search__clear:hover {
  color: var(--ink);
  background: var(--ash);
}

.plist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 216px;
  /* The side padding keeps the selected card's focus ring from being clipped. */
  margin: 8px -2px -2px;
  padding: 2px;
  overflow-y: auto;
}

.plist__empty {
  padding: 12px 2px;
  font-size: 13px;
  color: var(--smoke);
}

.pcard {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--ash);
  border-radius: var(--r-input);
  cursor: pointer;
  transition: border-color 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
}

.pcard:hover {
  background: var(--paper);
  border-color: var(--fog);
}

.pcard.is-selected {
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(21, 22, 25, 0.08);
}

.pcard__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pcard__model {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.pcard__price {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--graphite);
}

.pcard__meta {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--smoke);
}

.pcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.pcard__tag {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--graphite);
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: var(--r-pill);
}

/* Monochrome by policy: DESIGN.md reserves colour for one accent moment per
   screen, and that budget is spent on the "Best" marker. */
.pcard__tag--added {
  color: var(--paper);
  background: var(--charcoal);
  border-color: var(--charcoal);
}

.guideline h3 {
  margin: 20px 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.guideline h3:first-child {
  margin-top: 0;
}

.guideline p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--graphite);
}

.guideline .formula {
  margin: 10px 0;
  font-weight: 500;
}

.guideline__note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ash);
  color: var(--smoke);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Print report (screen-hidden) ---------- */

.print-report {
  display: none;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--ash);
  padding: 32px 0;
}

.footer p {
  font-size: 14px;
  text-align: center;
  color: var(--smoke);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: var(--z-toast);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--paper);
  background: var(--charcoal);
  border-radius: var(--r-pill);
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .section {
    padding: 48px 0;
  }

  .container {
    padding: 0 20px;
  }

  .card {
    padding: 24px;
  }

  .section-head {
    margin-bottom: 32px;
  }

  .results-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .nav__inner {
    flex-wrap: wrap;
    padding: 12px 20px;
  }

  .brand {
    margin-right: auto;
  }

  .nav__actions {
    width: 100%;
    gap: 8px;
  }

  /* Equal-width action buttons: shorter labels plus a zero flex basis so the
     three buttons always split the row evenly. Icons are dropped here so the
     longer labels ("Comparison") still fit without truncating. */
  .nav__actions .btn {
    flex: 1 1 0;
    min-width: 0;
    gap: 6px;
    padding: 8px 10px;
  }

  .nav__actions .btn svg {
    display: none;
  }

  .nav__actions .btn__label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .btn__label--long {
    display: none;
  }

  .btn__label--short {
    display: inline;
  }
}

/* ---------- Mobile layouts (screen only — print keeps the real tables) ---------- */

/* Comparison table becomes one card per station, so nothing needs side scrolling. */
@media screen and (max-width: 768px) {
  .compare-card {
    padding: 16px;
  }

  .compare-table-wrap {
    overflow: visible;
    max-height: none;
  }

  .compare-rank__controls {
    margin-bottom: 4px;
  }

  .check {
    align-items: flex-start;
  }

  .compare-table {
    display: block;
    min-width: 0;
  }

  .compare-table thead {
    display: none;
  }

  .compare-table tbody {
    display: block;
  }

  .compare-table tbody tr {
    display: block;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--paper);
    border: 1px solid var(--fog);
    border-radius: var(--r-input);
  }

  .compare-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .compare-table tbody tr:nth-child(even) td,
  .compare-table tbody tr:hover td {
    background: transparent;
  }

  .compare-table td,
  .compare-table td:nth-child(n + 5) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    text-align: right;
    white-space: normal;
    border-bottom: 1px solid var(--ash);
  }

  .compare-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    color: var(--smoke);
  }

  /* Station name heads the card. */
  .compare-table td:first-child {
    display: block;
    padding: 0 0 12px;
    font-size: 17px;
    letter-spacing: -0.2px;
    text-align: left;
    border-bottom: 1px solid var(--fog);
  }

  .compare-table td:first-child::before {
    display: none;
  }

  .compare-table td:last-child {
    padding-bottom: 0;
    border-bottom: none;
  }
}

/* Daily consumption becomes one card per device, so the inputs stay usable. */
@media screen and (max-width: 640px) {
  .table-wrap {
    overflow: visible;
    margin-bottom: 0;
  }

  .device-table,
  .device-table tbody {
    display: block;
  }

  .device-table thead {
    display: none;
  }

  .device-table tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--paper);
    border: 1px solid var(--fog);
    border-radius: var(--r-input);
  }

  .device-table td,
  .device-table td:last-child {
    display: block;
    padding: 0;
    border-bottom: none;
    text-align: left;
  }

  .device-table tbody tr:hover td {
    background: transparent;
  }

  .device-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--smoke);
  }

  /* Specificity of `.device-table td` above is higher, so match it. */
  .device-table td.device-cell--name {
    grid-column: 1 / -1;
    padding-right: 44px;
  }

  .device-cell--name::before,
  .device-cell--remove::before {
    display: none;
  }

  .device-cell--remove {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .device-table input {
    min-width: 0;
    padding: 10px 12px;
    font-size: 15px;
  }

  .device-table__qty {
    width: auto;
  }

  .device-table td[data-wh] {
    padding: 10px 12px;
    text-align: right;
    background: var(--mist);
    border-radius: var(--r-btn);
  }

  /* Keep the catalog list short so the station fields stay reachable. */
  .plist {
    max-height: 168px;
  }
}

/* ---------- Print (Save as PDF) ---------- */

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #ffffff;
    color: #151619;
    min-height: 0;
  }

  .nav,
  .footer,
  .toast,
  .modal,
  #calculator,
  .eyebrow,
  .compare-card__head .btn {
    display: none !important;
  }

  .page,
  .container {
    max-width: none;
    padding: 0;
  }

  .section--compare {
    padding: 0;
    border: none;
  }

  .section--compare .section-head {
    margin-bottom: 12px;
    break-before: page;
  }

  .section-head p,
  .compare-note {
    display: none;
  }

  /* Report (screen-hidden, print-only) */

  .print-report {
    display: block;
  }

  .print-report__title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
  }

  .print-report__date {
    margin: 2px 0 12px;
    font-size: 11px;
    color: #7f8491;
  }

  .print-report__h2 {
    margin: 14px 0 6px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    break-after: avoid;
  }

  .print-report__note {
    margin: -4px 0 4px;
    font-size: 10px;
    color: #7f8491;
  }

  .report-table {
    width: 100%;
    margin-bottom: 8px;
    border-collapse: collapse;
    font-size: 11px;
    break-inside: avoid;
  }

  .report-table th {
    padding: 5px 8px;
    text-align: left;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffffff;
    background: #25272d;
  }

  .report-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #e1e2e5;
    font-variant-numeric: tabular-nums;
  }

  .report-table tbody tr:nth-child(even) td {
    background: #f3f3f5;
  }

  .report-table__total td {
    font-weight: 700;
    background: #ffffff !important;
    border-top: 1px solid #c8cad0;
  }

  .report-station {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #c8cad0;
    border-radius: 12px;
    break-inside: avoid;
  }

  .report-station h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
  }

  .report-station h3 span {
    font-weight: 500;
    color: #7f8491;
  }

  .report-station__status {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: #7f8491;
  }

  .report-station__status--warn {
    color: #151619;
  }

  .compare-card {
    padding: 0;
    border: none;
  }

  /* The PDF is a document, not a control surface: no ranked view, no metric
     picker, no view switch, and the long table breaks across pages instead of
     scrolling inside a box. */
  .compare-table-wrap {
    max-height: none;
    overflow: visible;
  }

  .compare-rank,
  .compare-rank__controls {
    display: none !important;
  }

  /* Whatever view the screen is showing, the PDF always gets the table. */
  .compare-card.is-rank .compare-table-wrap {
    display: block !important;
  }

  .compare-sort__arrow {
    display: none;
  }

  .compare-bar {
    display: none;
  }

  /* Daily need stays above the table in the PDF too, in place of the old column. */
  .compare-daily {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #f3f3f5 !important;
    border-color: #e1e2e5 !important;
    break-inside: avoid;
  }

  .compare-table {
    min-width: 0;
    font-size: 12px;
  }

  .compare-table tbody tr {
    break-inside: avoid;
  }

  .compare-table thead th {
    white-space: normal;
    background: #25272d !important;
    color: #ffffff !important;
  }

  .compare-table tbody tr:nth-child(even) td {
    background: #f3f3f5 !important;
  }

  .compare-table th,
  .compare-table td {
    padding: 6px 8px;
  }

  .best-badge {
    background: #059669 !important;
    color: #ffffff !important;
  }

  @page {
    margin: 16mm;
  }
}
