/* UnitWise — compare tool. Builds on the tokens and components in styles.css. */

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.tool__main { padding: 40px 0 120px; min-height: 70vh; }

button { font: inherit; color: inherit; }
.button { border: 0; cursor: pointer; }
.button:disabled { background: #dfe1e3; color: #52585d; cursor: not-allowed; transform: none; }

.link-btn {
  padding: 8px 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line);
}
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn--strong { font-weight: 700; font-size: 16px; text-decoration: none; }
.link-btn--strong:hover { text-decoration: underline; }

/* ---------- Stepper ---------- */

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px;
  margin-bottom: 48px;
}
.stepper li { border-top: 1px solid var(--line); }
.stepper li.is-current { border-top: 3px solid var(--ink); }
.stepper li.is-current .stepper__btn { padding-top: 10px; }
.stepper__btn {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 12px 0 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.stepper__btn:disabled { cursor: default; }
.stepper__num { font-size: 32px; line-height: 1; color: #6b7075; }
.stepper__label { font-size: 15px; font-weight: 700; color: var(--muted-2); }
.stepper li.is-done .stepper__num,
.stepper li.is-current .stepper__num { color: var(--ink); }
.stepper li.is-current .stepper__label { color: var(--ink); }
.stepper li:not(.is-current) .stepper__btn:not(:disabled):hover .stepper__label { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.stepper li:not(.is-current):not(.is-done) .stepper__btn:disabled .stepper__label { color: #6b7075; }

/* ---------- Panel ---------- */

.panel__head { max-width: 760px; margin-bottom: 36px; }
.panel__head .lead { margin-top: 16px; }
.tool__title {
  margin-top: 16px;
  font-size: clamp(40px, 4.45vw, 64px);
  line-height: 1.2;
}
.tool__title:focus { outline: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 40px;
}
.actions__hint { font-size: 14px; color: var(--muted-2); }

/* ---------- Step 1: drop ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  padding: 32px 24px;
  border: 2px dashed var(--line);
  background: var(--surface-grey);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover,
.dropzone.is-over { border-color: var(--ink); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid #514bff; outline-offset: 3px; }
.dropzone.is-full { cursor: default; border-style: solid; }
.dropzone.is-full:hover { border-color: var(--line); background: var(--surface-grey); }
.dropzone__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  line-height: 1.2;
}
.dropzone__hint { font-size: 15px; color: var(--muted-2); max-width: 520px; }
.dropzone__pick { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.messages { display: grid; gap: 8px; margin-top: 16px; }

.lists { margin-top: 24px; border-top: 1px solid var(--line); }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px auto;
  align-items: end;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.list-row__file { display: flex; align-items: center; gap: 12px; min-width: 0; padding-bottom: 10px; }
.list-row__name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-block;
  flex: none;
  padding: 3px 8px;
  background: var(--surface-grey);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- Form fields ---------- */

.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted-2); }
.field__opt { font-weight: 400; text-transform: none; }

input[type="text"],
input[type="date"],
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111315' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  text-overflow: ellipsis;
}
input:hover, select:hover { border-color: #8b9094; }
input:focus-visible, select:focus-visible { outline: 2px solid #514bff; outline-offset: 0; border-color: var(--ink); }

/* ---------- Step 2: columns ---------- */

.map-cards { display: grid; gap: 28px; }

.map-card { padding: 24px; }
.map-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.map-card__title { font-size: 23px; font-weight: 700; line-height: 1.35; }
.map-card__file { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted-2); }

.map-card__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  margin-top: 20px;
}

.map-card__controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 16px;
}
.map-card__controls .field:has(select[data-field="header"]) { grid-column: 1 / -1; }

.map-table {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  background: var(--surface-grey);
}
.map-table th {
  padding: 12px 14px 6px;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  color: var(--muted-2);
}
.map-table td { padding: 6px 14px; vertical-align: middle; }
.map-table tr:last-child td { padding-bottom: 14px; }
.map-table td:first-child { width: 58%; }
.map-table__means { display: block; font-size: 14px; font-weight: 700; }
.map-table__hint { display: block; font-size: 12px; color: var(--muted-2); }

.readout__count { font-size: 15px; }
.readout .warning { margin-top: 12px; }
.readout__more { margin-top: 8px; font-size: 13px; color: var(--muted-2); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.mini-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.3;
}
.mini-table th {
  padding: 0 8px 8px 0;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  color: var(--muted-table);
  border-bottom: 1px solid var(--line-table);
  white-space: nowrap;
}
.mini-table td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line-row); }
.mini-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-right: 0; padding-left: 8px; }

.note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-grey);
  font-size: 13px;
  color: var(--muted-2);
}

.skipped { margin-top: 12px; font-size: 13px; }
.skipped summary { cursor: pointer; font-weight: 700; }
.skipped ul { margin-top: 8px; display: grid; gap: 4px; color: var(--muted-2); }

/* ---------- Step 3: results ---------- */

.results-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.saving--tool { min-height: 0; padding-bottom: 24px; }
.saving--tool .saving__rows div { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.saving--tool .saving__rows dd { font-size: 17px; font-weight: 700; }
.saving__note { margin-top: 20px; font-size: 13px; line-height: 1.35; max-width: 460px; }

.inline-select {
  display: inline-block;
  width: auto;
  min-height: 34px;
  margin-left: 6px;
  padding: 4px 30px 4px 8px;
  border-color: rgba(17, 19, 21, .35);
  background-color: rgba(255, 255, 255, .55);
  font-weight: 700;
}

.checks-col { display: grid; gap: 16px; }
.check--tool { min-height: 0; padding-bottom: 20px; }
.check--tool .check__title { font-size: 20px; }
.check--tool .check__meta { margin-top: 8px; }
.check--tool .warning { margin-top: 14px; }
.check--tool .check__prices + .warning { margin-top: 12px; }
.check--quiet .check__desc { margin-top: 10px; }

.compare--tool { margin-top: 36px; padding: 24px 24px 18px; }
.compare__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.compare__summary { margin-top: 6px; font-size: 13px; color: var(--muted-table); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }

.compare__table--tool { width: 100%; margin-top: 24px; min-width: 520px; }
.compare__table--tool col.num { width: 150px; }
.compare__table--tool thead th { white-space: normal; }
.compare__table--tool tbody th:first-child { white-space: normal; padding-right: 16px; }
.compare__table--tool .prod { display: block; }
.compare__table--tool .sub {
  display: none;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-table);
  white-space: normal;
}
.compare__table--tool.show-packs .sub { display: block; }
.compare__table--tool tbody th .sub { display: block; }
.compare__table--tool td { vertical-align: top; }
.compare__table--tool .none { color: var(--muted-table); }

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

@media (max-width: 1100px) {
  .map-card__body,
  .results-top { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .tool__main { padding: 24px 0 72px; }
  .stepper { gap: 12px; margin-bottom: 32px; }
  .stepper__btn { flex-direction: column; gap: 4px; }
  .stepper__num { font-size: 24px; }
  .stepper__label { font-size: 13px; }
  .tool__title { font-size: 40px; }
  .dropzone { min-height: 180px; }
  .dropzone__title { font-size: 28px; }
  .list-row { grid-template-columns: 1fr auto; gap: 12px 16px; }
  .list-row__file { grid-column: 1 / -1; padding-bottom: 0; }
  .map-card { padding: 18px 16px; }
  .map-table td:first-child { width: 55%; }
  .map-table th, .map-table td { padding-left: 10px; padding-right: 10px; }
  .compare--tool { padding: 18px 14px 14px; }
  .compare__table--tool { min-width: 0; }
  .compare__table--tool col.num { width: 76px; }
  .actions .button { width: 100%; }
}

/* ---------- Fix matches / set quantities ---------- */

.mode-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.45;
}
.mode-hint p { max-width: 760px; }
.mode-hint .link-btn { padding: 0; font-size: 14px; }

.match-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
}
.mini-btn {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--ink); }
.tag {
  padding: 2px 8px;
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.compare__table--tool select.pair-select {
  width: auto;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 28px 4px 8px;
  font-size: 13px;
  font-weight: 400;
}

.compare__table--tool col.qty { width: 150px; }
.compare__table--tool td.qty,
.compare__table--tool th.qty { text-align: left; padding-right: 16px; }
.qty-field { display: inline-flex; align-items: center; gap: 6px; }
.qty-field input {
  width: 84px;
  min-height: 34px;
  padding: 4px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.qty-field input.is-custom { border-color: var(--ink); font-weight: 700; }
.qty-unit { font-size: 13px; color: var(--muted-table); }
.compare__table--tool.with-qty { min-width: 760px; }
.saving-cell { font-weight: 700; }

@media (max-width: 720px) {
  .compare__table--tool.with-qty { min-width: 620px; }
  .compare__table--tool.with-qty col.num { width: 76px; }
  .compare__table--tool col.qty { width: 124px; }
  .qty-field input { width: 68px; }
}

/* ---------- Currency notes ---------- */

.currency-notes { display: grid; gap: 8px; margin: -12px 0 28px; }
.currency-notes .note { margin-top: 0; }
.currency-notes .link-btn { padding: 0; margin-left: 4px; font-size: 13px; }
.map-cards + .currency-notes { margin: 24px 0 0; }
