/* HubAuto advanced auction and import calculator */
.calculator-v2 .ha-main {
  width: 100%;
  max-width: none;
  padding: 0;
}

.calc-app {
  min-height: 100vh;
  background: var(--ha-bg);
  color: var(--ha-ink);
}

.calc-header-band {
  border-bottom: 1px solid #30363a;
  background: var(--ha-graphite);
  color: #fff;
}

.calc-page-header {
  min-height: 230px;
  padding-top: 42px;
  padding-bottom: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.calc-page-header > div:first-child {
  max-width: 760px;
}

.calc-page-header h1 {
  margin: 0;
  color: #fff;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: 0;
}

.calc-page-header p {
  max-width: 680px;
  margin: 14px 0 0;
  color: #c4ccd1;
  font-size: 16px;
  line-height: 1.6;
}

.calc-header-actions,
.calc-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calc-header-actions {
  justify-content: flex-end;
}

.calc-toolbar-band {
  border-bottom: 1px solid var(--ha-line);
  background: var(--ha-surface);
}

.calc-toolbar {
  min-height: 84px;
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto 1fr;
  align-items: center;
  gap: 18px;
}

.calc-saved-select,
.calc-app .calc-form-grid label,
.calc-cost-row > label {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.calc-saved-select > span,
.calc-app .calc-form-grid label > span,
.calc-cost-row > label > span {
  color: var(--ha-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.calc-app input,
.calc-app select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--ha-line);
  border-radius: 5px;
  padding: 9px 11px;
  background: var(--ha-surface);
  color: var(--ha-ink);
}

.calc-app input::placeholder {
  color: var(--ha-muted);
}

.calc-app input:hover,
.calc-app select:hover {
  border-color: color-mix(in srgb, var(--ha-ink) 30%, var(--ha-line));
}

.calc-app input:focus,
.calc-app select:focus {
  border-color: var(--ha-blue);
  outline: 3px solid color-mix(in srgb, var(--ha-blue) 18%, transparent);
}

.calc-button-secondary {
  border-color: var(--ha-line);
  background: var(--ha-surface);
  color: var(--ha-ink);
}

.calc-button-secondary:hover {
  border-color: color-mix(in srgb, var(--ha-blue) 45%, var(--ha-line));
  background: var(--ha-blue-soft);
  color: var(--ha-blue-dark);
}

.dark .calc-button-secondary:hover {
  color: #cfe0ff;
}

.calc-toolbar button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  transform: none;
}

.calc-local-note {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
  color: var(--ha-muted);
  font-size: 12px;
}

.calc-kpi-band {
  border-bottom: 1px solid #2f363a;
  background: #101518;
  color: #fff;
}

.calc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-kpi-grid > div {
  min-height: 112px;
  padding: 25px 28px;
  border-left: 1px solid #2d3438;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.calc-kpi-grid > div:last-child {
  border-right: 1px solid #2d3438;
}

.calc-kpi-grid span {
  color: #aeb8bd;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.calc-kpi-grid strong {
  margin-top: 8px;
  color: #fff;
  font-size: 24px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.calc-kpi-grid > div:first-child strong,
.calc-kpi-grid > div:last-child strong {
  color: #78aaff;
}

.calc-kpi-grid #headlineProfit.calc-positive {
  color: #5bd5ad !important;
}

.calc-kpi-grid #headlineProfit.calc-negative {
  color: #ff8d86 !important;
}

.calc-workbench {
  padding-top: 38px;
  padding-bottom: 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
  gap: 24px;
}

.calc-editor {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.calc-panel,
.calc-summary {
  border: 1px solid var(--ha-line);
  border-radius: 8px;
  background: var(--ha-surface);
}

.calc-panel {
  padding: 26px;
}

.calc-panel-heading {
  min-height: 54px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ha-line);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
}

.calc-panel-heading > span:first-child {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: var(--ha-blue-soft);
  color: var(--ha-blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.dark .calc-panel-heading > span:first-child {
  color: #c9dcff;
}

.calc-panel-heading h2 {
  margin: 0;
  color: var(--ha-ink);
  font-size: 20px;
  line-height: 1.2;
}

.calc-panel-heading p {
  margin: 5px 0 0;
  color: var(--ha-muted);
  font-size: 12px;
  line-height: 1.45;
}

.calc-panel-heading > .ha-icon {
  width: 22px;
  height: 22px;
  color: var(--ha-blue);
}

.calc-panel-heading-action {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.calc-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.calc-span-2 {
  grid-column: span 2;
}

.calc-form-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.calc-form-grid-sale {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-choice-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
}

.calc-app fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.calc-app legend {
  margin-bottom: 8px;
  color: var(--ha-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.calc-segmented {
  min-height: 46px;
  padding: 4px;
  border: 1px solid var(--ha-line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--ha-surface-2);
}

.calc-segmented-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calc-segmented label {
  min-width: 0;
  display: block;
  cursor: pointer;
}

.calc-segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}

.calc-segmented span {
  min-height: 36px;
  padding: 7px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--ha-muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calc-segmented input:checked + span {
  background: var(--ha-surface);
  color: var(--ha-blue);
  box-shadow: 0 1px 5px rgba(18, 22, 25, 0.12);
}

.calc-segmented input:focus-visible + span {
  outline: 3px solid var(--ha-focus);
  outline-offset: 1px;
}

.calc-sale-mode {
  margin-top: 20px !important;
}

.calc-cost-head,
.calc-cost-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 155px 105px 42px;
  align-items: center;
  gap: 9px;
}

.calc-cost-head {
  min-height: 30px;
  padding: 0 2px;
  color: var(--ha-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.calc-cost-table {
  display: grid;
  gap: 8px;
}

.calc-cost-row {
  padding: 9px;
  border: 1px solid var(--ha-line);
  border-radius: 6px;
  background: var(--ha-bg);
}

.calc-cost-row > label > span {
  display: none;
}

.calc-cost-row input,
.calc-cost-row select {
  min-height: 40px;
  background: var(--ha-surface);
}

.calc-cost-check {
  min-height: 40px;
  display: flex !important;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 7px !important;
  color: var(--ha-ink-soft);
  cursor: pointer;
}

.calc-cost-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--ha-action);
}

.calc-cost-check span {
  display: inline !important;
  color: inherit !important;
  font-size: 11px !important;
  text-transform: none !important;
}

.calc-cost-check input:disabled + span {
  opacity: 0.48;
}

.calc-cost-row .ha-icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  color: var(--ha-red);
}

.calc-summary {
  position: sticky;
  top: calc(var(--ha-header-height) + 18px);
  overflow: hidden;
}

.calc-summary-primary {
  min-height: 160px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--ha-graphite);
  color: #fff;
}

.calc-summary-primary > span {
  color: #b3bdc2;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.calc-summary-primary strong {
  margin-top: 10px;
  color: #fff;
  font-size: 38px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.calc-summary-primary small {
  min-height: 18px;
  margin-top: 10px;
  color: #9ec0f5;
  font-size: 11px;
}

.calc-summary-list {
  margin: 0;
  padding: 12px 22px;
}

.calc-summary-list > div {
  min-height: 44px;
  border-bottom: 1px solid var(--ha-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.calc-summary-list dt {
  color: var(--ha-muted);
  font-size: 11px;
  line-height: 1.35;
}

.calc-summary-list dd {
  margin: 0;
  color: var(--ha-ink);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.calc-summary-list .calc-summary-emphasis {
  min-height: 52px;
}

.calc-summary-list .calc-summary-emphasis dt,
.calc-summary-list .calc-summary-emphasis dd {
  color: var(--ha-ink);
  font-size: 13px;
  font-weight: 900;
}

.calc-positive {
  color: var(--ha-green) !important;
}

.calc-negative {
  color: var(--ha-red) !important;
}

.calc-ratio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--ha-line);
}

.calc-ratio-grid > div {
  min-height: 82px;
  padding: 17px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.calc-ratio-grid > div + div {
  border-left: 1px solid var(--ha-line);
}

.calc-ratio-grid span {
  color: var(--ha-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.calc-ratio-grid strong {
  margin-top: 6px;
  color: var(--ha-ink);
  font-size: 22px;
}

.calc-breakdown-wrap {
  padding: 21px 22px;
  border-bottom: 1px solid var(--ha-line);
}

.calc-checks {
  padding: 19px 22px;
  border-bottom: 1px solid var(--ha-line);
  background: color-mix(in srgb, #b77900 8%, var(--ha-surface));
}

.calc-checks[hidden] {
  display: none;
}

.calc-checks h3 {
  margin: 0 0 10px;
  color: var(--ha-ink);
  font-size: 11px;
  text-transform: uppercase;
}

.calc-checks ul {
  margin: 0;
  padding-left: 17px;
  color: var(--ha-ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.calc-checks li + li {
  margin-top: 7px;
}

.calc-breakdown-wrap h3 {
  margin: 0 0 12px;
  color: var(--ha-ink);
  font-size: 12px;
  text-transform: uppercase;
}

.calc-breakdown {
  height: 12px;
  border-radius: 3px;
  display: flex;
  overflow: hidden;
  background: var(--ha-surface-2);
}

.calc-breakdown span {
  min-width: 2px;
  height: 100%;
}

.calc-breakdown-legend {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
}

.calc-breakdown-legend span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ha-muted);
  font-size: 10px;
}

.calc-breakdown-legend i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 2px;
}

.calc-formula-note {
  margin: 0;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  color: var(--ha-muted);
  font-size: 11px;
  line-height: 1.55;
}

.calc-formula-note .ha-icon {
  margin-top: 1px;
  color: var(--ha-blue);
}

.calc-scenario-band {
  padding: 72px 0 78px;
  border-top: 1px solid var(--ha-line);
  background: var(--ha-surface);
}

.calc-scenario-section header {
  margin-bottom: 24px;
}

.calc-scenario-section h2 {
  max-width: 760px;
  margin: 0;
  color: var(--ha-ink);
  font-size: 32px;
  line-height: 1.2;
}

.calc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ha-line);
  border-radius: 7px;
}

.calc-table-wrap:focus-visible {
  outline: 3px solid var(--ha-focus);
  outline-offset: 3px;
}

.calc-scenario-section table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: var(--ha-surface);
}

.calc-scenario-section th,
.calc-scenario-section td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--ha-line);
  color: var(--ha-ink-soft);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.calc-scenario-section th {
  background: var(--ha-bg);
  color: var(--ha-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.calc-scenario-section th:first-child,
.calc-scenario-section td:first-child {
  text-align: left;
}

.calc-scenario-section tbody tr:last-child td {
  border-bottom: 0;
}

.calc-scenario-section td strong {
  color: var(--ha-ink);
}

.calc-disclaimer {
  padding-top: 42px;
  padding-bottom: 72px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.calc-disclaimer > div {
  min-height: 110px;
  padding: 24px 28px;
  border-top: 1px solid var(--ha-line);
  border-bottom: 1px solid var(--ha-line);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.calc-disclaimer > div + div {
  border-left: 1px solid var(--ha-line);
}

.calc-disclaimer .ha-icon {
  width: 21px;
  height: 21px;
  color: var(--ha-blue);
}

.calc-disclaimer p {
  margin: 0;
  color: var(--ha-muted);
  font-size: 12px;
  line-height: 1.65;
}

.calc-disclaimer strong {
  color: var(--ha-ink);
}

.calc-mobile-result {
  display: none;
}

@media (max-width: 1180px) {
  .calc-toolbar {
    grid-template-columns: minmax(220px, 300px) 1fr;
  }

  .calc-local-note {
    display: none;
  }

  .calc-workbench {
    grid-template-columns: minmax(0, 1fr) 350px;
  }

  .calc-form-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calc-cost-head,
  .calc-cost-row {
    grid-template-columns: minmax(160px, 1fr) 115px 140px 95px 42px;
  }
}

@media (max-width: 980px) {
  .calc-page-header {
    min-height: 210px;
  }

  .calc-page-header h1 {
    font-size: 40px;
  }

  .calc-workbench {
    grid-template-columns: 1fr;
  }

  .calc-summary {
    position: static;
  }

  .calc-form-grid,
  .calc-form-grid-sale {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calc-form-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .calc-page-header {
    min-height: 0;
    padding-top: 34px;
    padding-bottom: 34px;
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
  }

  .calc-page-header h1 {
    font-size: 36px;
  }

  .calc-page-header p {
    font-size: 14px;
  }

  .calc-toolbar {
    padding-top: 14px;
    padding-bottom: 14px;
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .calc-toolbar-actions {
    justify-content: flex-start;
  }

  .calc-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calc-kpi-grid > div {
    min-height: 96px;
    padding: 20px;
    border-bottom: 1px solid #2d3438;
  }

  .calc-kpi-grid strong {
    font-size: 20px;
  }

  .calc-workbench {
    padding-top: 24px;
  }

  .calc-choice-grid {
    grid-template-columns: 1fr;
  }

  .calc-cost-head {
    display: none;
  }

  .calc-cost-row {
    grid-template-columns: minmax(0, 1fr) 120px 42px;
    align-items: end;
  }

  .calc-cost-row > label:first-child {
    grid-column: 1 / -1;
  }

  .calc-cost-row > label:nth-child(3) {
    grid-column: 1 / 2;
  }

  .calc-cost-row > label > span {
    display: inline;
  }

  .calc-cost-check {
    grid-column: 2 / 3;
  }

  .calc-cost-row .remove-cost {
    grid-column: 3;
    grid-row: 2;
  }

  .calc-disclaimer {
    grid-template-columns: 1fr;
  }

  .calc-disclaimer > div + div {
    border-top: 0;
    border-left: 0;
  }
}

@media (max-width: 560px) {
  body.calculator-v2 {
    padding-bottom: 74px;
  }

  .calc-page-header h1 {
    font-size: 32px;
  }

  .calc-header-actions {
    width: 100%;
  }

  .calc-header-actions .ha-button {
    flex: 1;
  }

  .calc-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 42px;
  }

  .calc-toolbar-actions .ha-button:last-child {
    grid-column: 1 / -1;
  }

  .calc-toolbar-actions .ha-icon-button {
    width: 42px;
    min-width: 42px;
    height: 44px;
  }

  .calc-kpi-grid span {
    font-size: 9px;
  }

  .calc-kpi-grid strong {
    font-size: 18px;
  }

  .calc-panel {
    padding: 17px;
  }

  .calc-panel-heading {
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    margin-bottom: 19px;
  }

  .calc-panel-heading > span:first-child {
    width: 34px;
    height: 34px;
  }

  .calc-panel-heading h2 {
    font-size: 17px;
  }

  .calc-panel-heading-action {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .calc-panel-heading-action .ha-button {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 5px;
  }

  .calc-form-grid,
  .calc-form-grid-5,
  .calc-form-grid-sale {
    grid-template-columns: 1fr;
  }

  .calc-span-2 {
    grid-column: auto;
  }

  .calc-segmented span {
    padding-inline: 4px;
    font-size: 10px;
  }

  .calc-cost-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
  }

  .calc-cost-row > label:nth-child(2) {
    grid-column: 1;
  }

  .calc-cost-row > label:nth-child(3) {
    grid-column: 2;
  }

  .calc-cost-check {
    grid-column: 1 / 3;
  }

  .calc-cost-row .remove-cost {
    grid-row: 2;
  }

  .calc-summary-primary {
    min-height: 145px;
    padding: 22px;
  }

  .calc-summary-primary strong {
    font-size: 32px;
  }

  .calc-summary-list {
    padding-inline: 17px;
  }

  .calc-breakdown-legend {
    grid-template-columns: 1fr;
  }

  .calc-scenario-band {
    padding: 54px 0;
  }

  .calc-scenario-section h2 {
    font-size: 26px;
  }

  .calc-disclaimer {
    padding-top: 24px;
    padding-bottom: 54px;
  }

  .calc-disclaimer > div {
    padding: 20px 4px;
  }

  .calc-mobile-result {
    min-height: 66px;
    padding: 9px 12px max(9px, env(safe-area-inset-bottom));
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    border-top: 1px solid var(--ha-line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    background: var(--ha-surface);
    box-shadow: 0 -8px 26px rgba(18, 22, 25, 0.12);
  }

  .calc-mobile-result > span {
    grid-column: 1;
    color: var(--ha-muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .calc-mobile-result > strong {
    grid-column: 1;
    color: var(--ha-ink);
    font-size: 18px;
  }

  .calc-mobile-result .ha-button {
    grid-column: 2;
    grid-row: 1 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calc-app *,
  .calc-app *::before,
  .calc-app *::after {
    scroll-behavior: auto !important;
  }
}

@media print {
  .calculator-v2 .ha-site-header,
  .calculator-v2 .ha-site-footer,
  .calc-header-actions,
  .calc-toolbar-band,
  .calc-editor,
  .calc-mobile-result,
  .calc-disclaimer {
    display: none !important;
  }

  .calculator-v2,
  .calc-app,
  .calc-header-band,
  .calc-scenario-band {
    padding: 0;
    background: #fff !important;
    color: #111 !important;
  }

  .calc-page-header {
    min-height: 0;
    padding: 20px 0;
  }

  .calc-page-header h1,
  .calc-page-header p,
  .calc-page-header .ha-eyebrow {
    color: #111 !important;
  }

  .calc-workbench {
    display: block;
    padding: 20px 0;
  }

  .calc-summary {
    position: static;
    break-inside: avoid;
  }

  .calc-scenario-band {
    border: 0;
  }

  .calc-table-wrap {
    overflow: visible;
  }
}
