:root {
  --bg: #f6f2eb;
  --panel: #fffaf3;
  --ink: #2c261e;
  --muted: #756a5c;
  --line: #dfd3c1;
  --accent: #835f3f;
  --accent-2: #b98554;
  --good: #386641;
  --warn: #a15c1b;
  --bad: #9d2f2f;
  --shadow: 0 18px 45px rgba(52, 39, 26, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(185,133,84,.22), transparent 34rem),
    linear-gradient(180deg, #fbf6ef, var(--bg));
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 60px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 330px);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .76rem;
  font-weight: 800;
  margin: 0 0 8px;
}

h1, h2 {
  line-height: 1.05;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.8rem);
  max-width: 880px;
  letter-spacing: -.055em;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: -.025em;
}

.lead {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.05rem;
  margin: 18px 0 0;
}

.privacy-card, .panel, .metric {
  background: rgba(255, 250, 243, .86);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.privacy-card {
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.privacy-card span,
.hint,
.metric small,
.format-help,
.diagnostics {
  color: var(--muted);
}

.panel {
  padding: 22px;
  margin: 18px 0;
}

.hint {
  margin: 8px 0 16px;
}

.file-drop {
  display: grid;
  gap: 8px;
  border: 2px dashed #d0bda5;
  border-radius: 18px;
  background: rgba(255,255,255,.45);
  padding: 22px;
  cursor: pointer;
}

.file-drop:hover { border-color: var(--accent-2); }
.file-drop input { display: none; }
.file-drop span { font-weight: 800; color: var(--accent); }
.file-drop em { color: var(--muted); font-style: normal; overflow-wrap: anywhere; }

.format-help {
  margin-top: 14px;
}

.format-help pre {
  overflow: auto;
  padding: 14px;
  background: #2c261e;
  color: #fff8ee;
  border-radius: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

label small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.25;
}

input[type="date"], select {
  appearance: none;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin: 18px 0;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 850;
  cursor: pointer;
  font: inherit;
}

.primary {
  color: #fffaf3;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.secondary {
  color: var(--accent);
  background: #efe2d0;
}

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

.messages {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.message {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fffaf3;
}

.message.error {
  border-color: rgba(157,47,47,.35);
  color: var(--bad);
}

.message.warn {
  border-color: rgba(161,92,27,.35);
  color: var(--warn);
}

.hidden { display: none; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.metric {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.metric span {
  color: var(--muted);
  font-weight: 800;
  font-size: .88rem;
}

.metric strong {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -.045em;
}

.section-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

canvas {
  width: 100%;
  height: auto;
  max-height: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.diagnostics {
  display: grid;
  gap: 12px;
}

.diag-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.48);
}

.diag-block strong { color: var(--ink); }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid #eee2d0;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #fff8ef;
}

.num { text-align: right; font-variant-numeric: tabular-nums; }

tbody tr:hover { background: #fffaf3; }

@media (max-width: 880px) {
  .hero, .summary-grid, .grid {
    grid-template-columns: 1fr;
  }
  .section-head {
    display: grid;
    align-items: start;
  }
}
