/* Base styles */
:root {
  color-scheme: light;
  --color-background: #f5f7f1;
  --color-surface: #ffffff;
  --color-border: #dfe4d7;
  --color-text: #1f2a23;
  --color-muted: #5f6a63;
  --color-accent: #20b96a;
  --color-accent-strong: #ffe066;
  --color-accent-muted: #e1f7ec;
  --color-positive: #15803d;
  --color-negative: #b91c1c;
  --color-neutral: #eab308;
  --radius: 16px;
  --shadow: 0 14px 32px rgba(23, 42, 28, 0.08);
  --max-width: 1100px;
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.6;
}

img,
svg {
  max-width: 100%;
}

.container {
  width: min(100% - 2.5rem, var(--max-width));
  margin: 0 auto;
}

.site-header {
  padding: 3rem 0 2rem;
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.75rem auto 1.5rem;
  max-width: 42rem;
  color: var(--color-muted);
  font-size: 1rem;
}

.highlight {
  display: inline-block;
  padding: 0.75rem 1rem;
  background: var(--color-accent-strong);
  border-radius: 999px;
  color: #1a1c12;
  font-weight: 600;
}

.card {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.inputs-section form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  gap: 0.5rem;
  color: var(--color-text);
}

input,
select,
button {
  font: inherit;
}

select,
input[type='number'] {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
}

select:focus,
input[type='number']:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
}

.slider-label {
  position: relative;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

input[type='range'] {
  flex: 1 1 220px;
  accent-color: var(--color-accent);
}

.slider-value {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.slider-value input {
  width: 6rem;
  text-align: right;
}

.input-prefix {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  align-items: center;
  background-color: #fff;
}

.input-prefix span {
  padding: 0.75rem;
  background-color: rgba(32, 185, 106, 0.12);
  color: var(--color-accent);
  font-weight: 600;
}

.input-prefix input {
  border: 0;
  padding: 0.75rem 0.85rem;
  border-left: 1px solid var(--color-border);
}

.field-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.field-hint.error {
  color: var(--color-negative);
  font-weight: 600;
}

.rate-selector {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.5rem;
  background-color: #f2f9f4;
}

.rate-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.rate-options label {
  flex: 1;
  min-width: 140px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.rate-options input {
  margin-right: 0.5rem;
}

.rate-options label:has(input:checked) {
  border-color: var(--color-accent);
  background-color: rgba(32, 185, 106, 0.08);
  box-shadow: 0 0 0 3px rgba(32, 185, 106, 0.2);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.view-toggle {
  display: inline-flex;
  padding: 0.3rem;
  background-color: rgba(32, 185, 106, 0.12);
  border-radius: 999px;
  gap: 0.3rem;
}

.view-button {
  border: 0;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.view-button.active {
  background-color: #fff;
  color: var(--color-accent);
  box-shadow: 0 1px 6px rgba(32, 185, 106, 0.3);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.comparison-card {
  background-color: #f7faf5;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comparison-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.cost-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.cost-list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.cost-list dt {
  font-weight: 500;
  color: var(--color-muted);
}

.cost-list dd {
  margin: 0;
  font-weight: 600;
}

.cost-list .total {
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.highlight-card {
  background: #20b96a;
  border: none;
  color: #fff;
}

.highlight-card .headline {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.highlight-card.negative {
  background: #b91c1c;
}

.highlight-card.positive {
  background: #16a34a;
}

.highlight-card.neutral {
  background: #eab308;
}

.card-sub {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: #ffe066;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.card-sub h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.card-sub p {
  margin: 0.35rem 0;
}

.chart-area {
  margin-top: 2rem;
}

.chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
}

.chart-bar {
  position: relative;
  padding: 1.5rem 1rem;
  background-color: #f7faf5;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.chart-bar span {
  font-weight: 600;
  color: var(--color-muted);
}

.chart-bar .bar {
  position: relative;
  height: 170px;
  border-radius: 12px;
  background-color: rgba(32, 185, 106, 0.12);
  overflow: hidden;
}

.chart-bar .bar::after {
  content: '';
  position: absolute;
  inset: 0;
  height: var(--bar-height, 0%);
  width: 100%;
  margin-top: auto;
  background: #20b96a;
  border-radius: 12px 12px 0 0;
  transition: height 0.35s ease;
}

.chart-bar strong {
  font-size: 1.1rem;
  text-align: center;
}

.chart-bar[data-id='chart-proposed'] .bar {
  background-color: rgba(32, 185, 106, 0.05);
  border: 2px dashed rgba(32, 185, 106, 0.4);
}

.chart-bar[data-id='chart-proposed'] .bar::after {
  background: #20b96a;
}

.monthly-breakdown {
  margin-top: 2rem;
  border-top: 1px dashed var(--color-border);
  padding-top: 1.5rem;
}

.monthly-breakdown h3 {
  margin-top: 0;
}

.cost-list.small dt {
  font-weight: 600;
  color: var(--color-text);
}

.cost-list.small dd {
  font-size: 1.1rem;
}

.info-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.info-grid h3 {
  margin-top: 0;
}

.info-grid ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--color-muted);
}

.info-grid li + li {
  margin-top: 0.5rem;
}

.disclaimer-list {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background-color: #f7faf5;
}

.disclaimer-list ul {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--color-muted);
}

.ghost-button,
.icon-button {
  border: 1px solid rgba(32, 185, 106, 0.35);
  color: var(--color-text);
  background-color: transparent;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ghost-button:hover,
.icon-button:hover {
  background-color: rgba(32, 185, 106, 0.12);
  color: var(--color-accent);
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.4rem;
  line-height: 1;
}

.preset-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(12, 21, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  z-index: 20;
}

.preset-modal[aria-hidden='false'] {
  opacity: 1;
  visibility: visible;
}

.preset-modal__dialog {
  background-color: #fff;
  border-radius: 20px;
  width: min(480px, 100%);
  padding: 1.5rem;
  box-shadow: 0 25px 60px rgba(23, 42, 28, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preset-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.preset-modal__body {
  max-height: 340px;
  overflow-y: auto;
}

.preset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.preset-list button {
  width: 100%;
  text-align: left;
  background-color: #f7faf5;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 1rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.preset-list button:hover,
.preset-list button:focus-visible {
  border-color: var(--color-accent);
  background-color: rgba(32, 185, 106, 0.08);
  box-shadow: 0 0 0 3px rgba(32, 185, 106, 0.18);
  outline: none;
}

.preset-modal__footer {
  display: flex;
  justify-content: flex-end;
}

.no-js-notice {
  margin: 2rem auto;
  padding: 1.5rem;
  background-color: #fff4e6;
  border-radius: var(--radius);
  border: 1px solid #fed7aa;
  width: min(100% - 2.5rem, var(--max-width));
}

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

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background-color: #ede9fe;
  color: #5b21b6;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .card {
    padding: 1.5rem;
  }

  .site-header {
    padding: 2.5rem 0 1.5rem;
  }
}

@media (max-width: 540px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    align-items: stretch;
  }

  .toggle-row {
    flex-direction: column;
    align-items: stretch;
  }

  .view-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .view-button {
    flex: 1;
    text-align: center;
  }

  .chart {
    grid-template-columns: 1fr;
  }
}

