:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-soft: #eef2ec;
  --text: #17211d;
  --muted: #65706b;
  --border: #dce2dc;
  --accent: #0f766e;
  --accent-strong: #0a5d56;
  --accent-soft: #dff3ee;
  --danger: #a23622;
  --danger-soft: #fff0ea;
  --warning: #85620c;
  --warning-soft: #fff6d8;
  --shadow: 0 22px 60px rgba(23, 33, 29, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 28px 0 34px;
}

.home-link {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 28px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.home-link:focus-visible,
.primary-button:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 3px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.25rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p {
  max-width: 720px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.instructions,
.converter {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.instructions {
  padding: 24px;
}

.instructions h2 {
  font-size: 1.08rem;
}

.instructions ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
  counter-reset: steps;
}

.instructions li {
  position: relative;
  min-height: 96px;
  padding: 42px 16px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.45;
  counter-increment: steps;
}

.instructions li::before {
  position: absolute;
  top: 14px;
  left: 16px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
  content: counter(steps, decimal-leading-zero);
}

.converter {
  margin-top: 20px;
  overflow: hidden;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 236px;
  padding: 28px;
  border: 2px dashed #b9c8c3;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbf9);
  cursor: pointer;
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-zone__icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.drop-zone__icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-zone__title {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
}

.drop-zone__text {
  margin-top: 8px;
  color: var(--muted);
}

.warning-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.warning-list p {
  padding: 14px 15px;
  border: 1px solid #eadc9a;
  border-radius: 8px;
  background: var(--warning-soft);
  color: var(--warning);
  line-height: 1.45;
}

.warning-list .strong-warning {
  border-color: #e3b6a7;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

.action-bar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfb;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 230px;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  transition:
    background 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.primary-button:not(:disabled):hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.primary-button.is-busy {
  opacity: 0.82;
}

.primary-button.is-busy:disabled {
  opacity: 0.82;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.progress {
  flex: 1;
  min-width: 180px;
}

.output-estimate {
  display: grid;
  gap: 3px;
  min-width: 190px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.output-estimate[hidden],
.summary[hidden] {
  display: none;
}

.output-estimate strong {
  color: var(--text);
  font-size: 0.98rem;
}

.progress__label {
  color: var(--muted);
  font-size: 0.92rem;
}

.progress__track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7e2;
}

.progress__bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.45;
}

.summary__item {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.summary__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary__item strong {
  color: var(--text);
  font-size: 1.08rem;
}

.summary__hint {
  color: var(--muted);
  font-size: 0.86rem;
}

.file-grid {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.file-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.file-card__header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfb;
}

.file-card__status {
  width: fit-content;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.file-card.is-valid .file-card__status {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.file-card.has-error .file-card__status {
  background: var(--danger-soft);
  color: var(--danger);
}

.file-card.has-warning .file-card__status {
  background: var(--warning-soft);
  color: var(--warning);
}

.file-card__name {
  overflow-wrap: anywhere;
  font-size: 1.1rem;
}

.file-card__size {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.file-card__messages {
  display: grid;
  gap: 8px;
  padding: 16px 18px 0;
}

.message {
  padding: 12px 13px;
  border-radius: 8px;
  line-height: 1.45;
}

.message--error {
  border: 1px solid #e3b6a7;
  background: var(--danger-soft);
  color: var(--danger);
}

.message--warning {
  border: 1px solid #eadc9a;
  background: var(--warning-soft);
  color: var(--warning);
}

.stats-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
}

.stats-list div {
  min-height: 86px;
  padding: 13px;
  background: var(--surface);
}

.stats-list div:nth-child(5) {
  grid-column: 1 / -1;
}

.stats-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stats-list dd {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 800;
}

.chart-heading {
  margin: 22px 18px 8px;
  color: var(--text);
  font-size: 1.04rem;
  line-height: 1.35;
}

.chart {
  position: relative;
  min-height: 248px;
  margin: 0 18px 18px;
  padding: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfb;
}

.chart svg {
  display: block;
  width: max(100%, var(--chart-width, 720px));
  height: 244px;
}

.chart__grid {
  stroke: rgba(23, 33, 29, 0.09);
  stroke-width: 1;
}

.chart__axis {
  stroke: rgba(23, 33, 29, 0.22);
  stroke-width: 1;
}

.chart__area {
  fill: rgba(15, 118, 110, 0.14);
}

.chart__line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart__point {
  fill: var(--accent);
  stroke: #fbfcfb;
  stroke-width: 2;
}

.chart__hit-area {
  fill: transparent;
  cursor: crosshair;
}

.chart__hit-area:focus {
  outline: none;
}

.chart__hit-area:focus-visible {
  stroke: var(--accent);
  stroke-width: 2;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 8px;
  background: #17211d;
  box-shadow: 0 12px 28px rgba(23, 33, 29, 0.22);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%);
  transition: opacity 80ms ease;
  white-space: nowrap;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart__month-label {
  color: var(--muted);
  fill: currentColor;
  font-size: 10px;
  font-weight: 800;
}

.chart__year-label {
  color: var(--text);
  fill: currentColor;
  font-size: 14px;
  font-weight: 900;
}

.chart__year-axis {
  stroke: rgba(15, 118, 110, 0.18);
  stroke-width: 1;
}

.chart__year-marker {
  stroke: rgba(15, 118, 110, 0.28);
  stroke-width: 1;
}

.chart__label {
  color: var(--muted);
  fill: currentColor;
  font-size: 11px;
  font-weight: 700;
}

.chart__value {
  color: var(--muted);
  fill: currentColor;
  font-size: 10px;
  font-weight: 700;
}

.chart__empty {
  display: grid;
  min-height: 218px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 28px, 1120px);
    padding-top: 22px;
  }

  .hero,
  .upload-panel {
    grid-template-columns: 1fr;
  }

  .instructions ol,
  .summary,
  .stats-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .output-estimate {
    width: 100%;
  }

  .primary-button {
    width: 100%;
  }

}

@media (max-width: 560px) {
  .instructions,
  .upload-panel,
  .file-grid {
    padding: 16px;
  }

  .instructions ol,
  .summary,
  .stats-list {
    grid-template-columns: 1fr;
  }

  .file-card__header {
    flex-direction: column;
  }

  .file-card__size {
    white-space: normal;
  }

  .chart svg {
    height: 230px;
  }
}
