.dlsc-calculator,
.dlsc-calculator * {
  box-sizing: border-box;
}

.dlsc-calculator {
  --dlsc-accent: #f36f21;
  --dlsc-accent-dark: #a63d00;
  --dlsc-ink: #191919;
  --dlsc-muted: #5c5c5c;
  --dlsc-line: #d8d8d8;
  --dlsc-soft: #f3f3f3;
  --dlsc-positive: #176b3a;
  --dlsc-negative: #a62c22;
  width: 100%;
  max-width: 1080px;
  margin: 28px auto;
  color: var(--dlsc-ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.dlsc-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 30px;
  background: var(--dlsc-ink);
  color: #fff;
}

.dlsc-header h2 {
  margin: 0;
  color: inherit;
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-wrap: balance;
}

.dlsc-header p {
  max-width: 62ch;
  margin: 8px 0 0;
  color: #d7d7d7;
  text-wrap: pretty;
}

.dlsc-ratio-badge {
  flex: 0 0 auto;
  min-width: 120px;
  text-align: right;
}

.dlsc-ratio-badge span,
.dlsc-summary span {
  display: block;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.dlsc-ratio-badge strong {
  display: block;
  color: var(--dlsc-accent);
  font-size: 2rem;
  line-height: 1.1;
}

.dlsc-form {
  margin: 0;
  padding: 30px;
  background: #fff;
  border: 1px solid var(--dlsc-line);
  border-top: 0;
}

.dlsc-setups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.dlsc-setup {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.dlsc-setup legend {
  width: 100%;
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 2px solid var(--dlsc-ink);
  color: var(--dlsc-ink);
  font-size: 1rem;
  font-weight: 800;
}

.dlsc-setup-new legend {
  border-color: var(--dlsc-accent);
}

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

.dlsc-fields label,
.dlsc-output-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 8px;
  min-width: 0;
  margin: 0;
  color: var(--dlsc-ink);
  font: inherit;
}

.dlsc-fields label > span,
.dlsc-output-field > span {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 700;
}

.dlsc-fields select,
.dlsc-output-field output {
  width: 100%;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #a9a9a9;
  border-radius: 6px;
  background: #fff;
  color: var(--dlsc-ink);
  font: inherit;
  font-weight: 750;
}

.dlsc-fields select:hover {
  border-color: var(--dlsc-ink);
}

.dlsc-fields select:focus-visible,
.dlsc-table-wrap:focus-visible {
  outline: 3px solid var(--dlsc-accent);
  outline-offset: 2px;
}

.dlsc-output-field output {
  display: flex;
  align-items: center;
  border-color: var(--dlsc-accent);
  background: #fff5ee;
}

.dlsc-fields small,
.dlsc-output-field small {
  color: var(--dlsc-muted);
  font-size: 0.75rem;
}

.dlsc-summary {
  display: grid;
  grid-template-columns: 150px 150px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 20px 30px;
  background: var(--dlsc-soft);
}

.dlsc-summary strong {
  display: block;
  margin-top: 1px;
  color: var(--dlsc-ink);
  font-size: 1.35rem;
  line-height: 1.15;
}

.dlsc-summary p {
  margin: 0;
  color: #3f3f3f;
  text-wrap: pretty;
}

.dlsc-calculator .is-positive {
  color: var(--dlsc-positive);
}

.dlsc-calculator .is-negative {
  color: var(--dlsc-negative);
}

.dlsc-table-wrap {
  max-height: 540px;
  overflow: auto;
  border: 1px solid var(--dlsc-line);
  border-top: 0;
  background: #fff;
}

.dlsc-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  background: #fff;
  color: var(--dlsc-ink);
  font-variant-numeric: tabular-nums;
}

.dlsc-table caption {
  padding: 20px 30px 12px;
  color: var(--dlsc-ink);
  font-size: 1rem;
  font-weight: 800;
  text-align: left;
}

.dlsc-table th,
.dlsc-table td {
  padding: 11px 18px;
  border: 0;
  border-bottom: 1px solid #e6e6e6;
  text-align: right;
}

.dlsc-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--dlsc-ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.dlsc-table th:first-child,
.dlsc-table td:first-child {
  padding-left: 30px;
  text-align: left;
}

.dlsc-table th:last-child,
.dlsc-table td:last-child {
  padding-right: 30px;
}

.dlsc-table tbody tr.is-current {
  background: #eeeeee;
  font-weight: 750;
}

.dlsc-table tbody tr.is-current td:first-child::after {
  content: "Current";
  display: inline-block;
  margin-left: 9px;
  color: var(--dlsc-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.dlsc-table tbody tr.is-selected {
  background: #fff1e8;
  font-weight: 800;
}

.dlsc-table tbody tr.is-selected td:first-child::after {
  content: "Selected";
  display: inline-block;
  margin-left: 9px;
  color: var(--dlsc-accent-dark);
  font-size: 0.7rem;
  font-weight: 800;
}

.dlsc-chain-note {
  padding: 18px 30px;
  background: #fff8f2;
  color: #3d2b20;
}

.dlsc-chain-note strong {
  display: block;
  margin-bottom: 3px;
}

.dlsc-chain-note p {
  max-width: 75ch;
  margin: 0;
}

@media (max-width: 820px) {
  .dlsc-setups {
    grid-template-columns: 1fr;
  }

  .dlsc-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dlsc-summary p {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .dlsc-calculator {
    margin-block: 18px;
    font-size: 15px;
  }

  .dlsc-header {
    align-items: flex-start;
    padding: 22px 18px;
  }

  .dlsc-header h2 {
    font-size: 1.6rem;
  }

  .dlsc-ratio-badge {
    min-width: 74px;
  }

  .dlsc-ratio-badge strong {
    font-size: 1.55rem;
  }

  .dlsc-form {
    padding: 22px 18px;
  }

  .dlsc-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dlsc-fields label:last-child,
  .dlsc-output-field {
    grid-column: 1 / -1;
  }

  .dlsc-summary {
    gap: 16px;
    padding: 18px;
  }

  .dlsc-table caption {
    padding-inline: 18px;
  }

  .dlsc-table th,
  .dlsc-table td {
    min-width: 70px;
    padding-inline: 12px;
  }

  .dlsc-table th:first-child,
  .dlsc-table td:first-child {
    padding-left: 18px;
  }

  .dlsc-table th:last-child,
  .dlsc-table td:last-child {
    padding-right: 18px;
  }

  .dlsc-table tbody tr.is-current td:first-child::after,
  .dlsc-table tbody tr.is-selected td:first-child::after {
    display: block;
    margin: 2px 0 0;
  }

  .dlsc-chain-note {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dlsc-calculator *,
  .dlsc-calculator *::before,
  .dlsc-calculator *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
