:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
  --accent: #4b47a8;
  --accent-dark: #373484;
  --line: #dce3ef;
  --muted: #5d697d;
  --paper: #ffffff;
  --danger: #9f1239;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, input, select, .table-shell { outline-offset: 3px; }
button:focus-visible, input:focus-visible, select:focus-visible, .table-shell:focus-visible, .error:focus-visible { outline: 3px solid #3730a3; }
[hidden] { display: none !important; }

.tool { width: min(1040px, 100%); margin: 0 auto; padding: 24px; }
.tool__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 8px 4px 24px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h2 { max-width: 760px; margin: 0 0 10px; font-size: clamp(1.65rem, 4vw, 2.45rem); line-height: 1.08; }
.lead { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.6; }
.privacy { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; background: #e8edff; color: #3730a3; font-size: .8rem; font-weight: 750; }

.panel { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 12px 30px rgb(30 41 59 / 6%); }
.section-heading, .result-heading, .plan-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading > div:first-child, .result-heading > div:first-child { display: flex; align-items: center; gap: 10px; }
h3, h4 { margin: 0; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eeedff; color: var(--accent-dark); font-size: .8rem; font-weight: 850; }
.hint, .plan-heading p { max-width: 520px; margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }

label { display: grid; gap: 7px; color: #3c485d; font-size: .82rem; font-weight: 750; }
input, select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #c8d1df; border-radius: 11px; background: #fff; color: #172033; }
.file-picker { display: grid; max-width: 560px; padding: 15px; border: 1px dashed #aeb9cc; border-radius: 14px; background: #fafbfe; }
.file-picker input { padding: 7px; background: #fff; }
.field-help, .boundary { margin: 9px 2px 0; color: #68758a; font-size: .8rem; line-height: 1.55; }
.boundary { padding: 10px 12px; border-radius: 11px; background: #f8fafc; }
.busy { margin: 14px 0 0; color: var(--accent-dark); font-weight: 700; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 14px; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
.summary div, .plan-totals div { min-width: 0; padding: 11px 12px; border-radius: 11px; background: #f7f9fc; }
.summary dt, .plan-totals dt { color: #67748a; font-size: .73rem; font-weight: 700; }
.summary dd, .plan-totals dd { margin: 4px 0 0; font-weight: 780; overflow-wrap: anywhere; }

.plan { margin-top: 18px; padding-top: 18px; border-top: 1px solid #e7ebf2; }
.plan-heading > div:first-child { display: grid; gap: 5px; }
.plan-totals { display: flex; gap: 8px; margin: 0; }
.plan-totals div { min-width: 118px; }
.table-shell { max-width: 100%; border: 1px solid #e1e6ef; border-radius: 12px; overflow: auto; }
table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e9edf4; text-align: left; }
th { position: sticky; top: 0; background: #f6f8fc; color: #526078; font-size: .75rem; }
tbody tr:last-child td { border-bottom: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button { min-height: 44px; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 11px; background: var(--accent); color: #fff; font-weight: 780; cursor: pointer; }
button:hover { background: var(--accent-dark); }
button:disabled { cursor: not-allowed; opacity: .48; }
button.quiet { border-color: #ccd4e0; background: #f8fafc; color: #344258; }
button.quiet:hover { background: #eef1f7; }
.error { margin: 0 0 18px; padding: 13px 16px; border: 1px solid #fecaca; border-radius: 12px; background: #fff1f2; color: var(--danger); font-weight: 650; }
.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; }

progress { width: 100%; height: 14px; accent-color: var(--accent); }
#progress-label { margin: 10px 0 0; color: var(--muted); font-size: .84rem; }
.result-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.result-note { margin: 14px 2px 0; color: #64748b; font-size: .8rem; line-height: 1.55; }

@media (max-width: 800px) {
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .result-summary { grid-template-columns: 1fr 1fr; }
  .result-summary div:last-child { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .tool { padding: 14px; }
  .tool__header, .section-heading, .result-heading, .plan-heading { flex-direction: column; }
  .tool__header { gap: 14px; }
  .privacy { align-self: flex-start; }
  .panel { padding: 16px; border-radius: 16px; }
  .settings-grid, .summary, .result-summary { grid-template-columns: 1fr; }
  .result-summary div:last-child { grid-column: auto; }
  .plan-totals { width: 100%; }
  .plan-totals div { flex: 1; min-width: 0; }
  .actions button, .result-heading button { width: 100%; }
  table { min-width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
