:root {
  color-scheme: light;
  --ink: #15201c;
  --muted: #68736d;
  --line: #dce3df;
  --paper: #f4f7f5;
  --surface: #ffffff;
  --green: #176b4d;
  --green-dark: #0d5038;
  --green-soft: #e0f3e9;
  --amber: #8a5a0a;
  --amber-soft: #fff2d7;
  --red: #9c2f2f;
  --red-soft: #fce7e5;
  --shadow: 0 18px 60px rgb(23 49 39 / 10%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, #ddefe5 0, transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgb(21 32 28 / 8%);
  background: rgb(255 255 255 / 72%);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: white;
}

.environment {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 64px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}

h1, h2, h3 { margin: 0; letter-spacing: -.035em; }
h1 { max-width: 680px; font-size: clamp(42px, 5.2vw, 68px); line-height: 1.02; }
h2 { font-size: 28px; }
h3 { font-size: 16px; }

.lede {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.upload-card {
  padding: 18px;
  border: 1px solid rgb(23 107 77 / 20%);
  border-radius: 24px;
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow);
}

.dropzone {
  display: flex;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1.5px dashed #9db7aa;
  border-radius: 17px;
  background: #f8fbf9;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dropzone:hover { border-color: var(--green); background: #f0f8f4; }
.dropzone strong { margin-top: 15px; font-size: 17px; }
.dropzone span:last-of-type { margin-top: 6px; color: var(--muted); font-size: 13px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.upload-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 24px;
}

.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 16px;
}

#selected-file {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary, .secondary, .button-link, .icon-button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .12s, background .12s;
}

.primary {
  padding: 11px 17px;
  background: var(--green);
  color: white;
}
.primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.primary:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.secondary, .button-link {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}
.secondary:hover, .button-link:hover { background: #f5f8f6; }
.secondary:disabled { cursor: not-allowed; opacity: .5; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }

.form-status { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.form-status.error { color: var(--red); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 68px;
}

.metrics article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 78%);
}
.metrics span { color: var(--muted); font-size: 13px; }
.metrics strong { display: block; margin-top: 7px; font-size: 30px; }

.reports {
  margin-top: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgb(23 49 39 / 6%);
}

.reports-heading { margin-bottom: 20px; }
.export-actions { display: flex; gap: 9px; }
.report-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf9;
}
.report-filters label { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.report-filters input, .report-filters select {
  width: 100%;
  height: 40px;
  margin-top: 7px;
  padding: 0 10px;
  border: 1px solid #cfd8d3;
  border-radius: 9px;
  background: white;
  color: var(--ink);
}
.filter-actions { display: flex; gap: 7px; }
.filter-actions .primary, .filter-actions .secondary { height: 40px; padding: 0 13px; }

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.report-kpis article { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.report-kpis span { color: var(--muted); font-size: 12px; }
.report-kpis strong { display: block; margin-top: 5px; font-size: 24px; }

.currency-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.currency-cards article { padding: 18px; border-radius: 15px; background: var(--green); color: white; }
.currency-cards article > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.currency-cards article > div span { font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.currency-cards article > div strong { font-size: 25px; }
.currency-cards dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; }
.currency-cards dl div { padding-top: 9px; border-top: 1px solid rgb(255 255 255 / 25%); }
.currency-cards dt { color: rgb(255 255 255 / 70%); font-size: 11px; }
.currency-cards dd { margin: 4px 0 0; font-size: 13px; font-weight: 700; }

.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.report-panel { min-height: 330px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-heading span { color: var(--muted); font-size: 11px; }
.bar-chart { display: grid; gap: 15px; margin-top: 22px; }
.bar-row { display: grid; gap: 6px; }
.bar-label { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.bar-label strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bar-label span { flex: none; font-size: 12px; font-weight: 750; }
.bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e8eeea; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.bar-row small { color: var(--muted); font-size: 10px; }
.chart-empty { margin: 30px 0; color: var(--muted); font-size: 13px; text-align: center; }

.queue {
  margin-top: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgb(23 49 39 / 6%);
}

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 14px; color: var(--muted); font-size: 12px; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
td { padding: 16px 14px; border-top: 1px solid #edf0ee; font-size: 14px; }
td:first-child { max-width: 220px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td:last-child { text-align: right; }

.status-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef1ef;
  color: #4d5b54;
  font-size: 12px;
  font-weight: 750;
  text-transform: capitalize;
}
.status-pill.review { background: var(--amber-soft); color: var(--amber); }
.status-pill.ready, .status-pill.approved { background: var(--green-soft); color: var(--green); }
.status-pill.duplicate { background: var(--red-soft); color: var(--red); }

.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.empty-state span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.empty-state strong { margin-top: 14px; color: var(--ink); }
.empty-state p { margin: 7px 0 0; font-size: 13px; }

dialog {
  width: min(1120px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 28px 100px rgb(0 0 0 / 25%);
}
dialog::backdrop { background: rgb(10 20 15 / 55%); backdrop-filter: blur(5px); }
.dialog-shell { padding: 0; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.icon-button { width: 38px; height: 38px; background: #f0f3f1; color: var(--ink); font-size: 24px; }
.banner { margin: 20px 28px 0; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.banner.warning { background: var(--amber-soft); color: var(--amber); }
.banner.danger { background: var(--red-soft); color: var(--red); }

.review-grid { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 560px; }
.field-panel { padding: 28px; }
.evidence-panel { padding: 28px; border-left: 1px solid var(--line); background: #f8faf9; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-grid label { color: var(--muted); font-size: 12px; font-weight: 700; }
.field-grid input { width: 100%; margin-top: 7px; padding: 11px 12px; border: 1px solid #cfd8d3; border-radius: 9px; color: var(--ink); outline: none; }
.field-grid input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(23 107 77 / 10%); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.processing-summary { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-title span { color: var(--muted); font-size: 12px; }
pre { max-height: 460px; margin: 18px 0 0; overflow: auto; color: #425049; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 850px) {
  main { width: min(100% - 28px, 680px); padding-top: 42px; }
  .hero, .review-grid { grid-template-columns: 1fr; }
  .hero { gap: 34px; }
  .metrics { grid-template-columns: 1fr 1fr; margin-top: 38px; }
  .report-filters { grid-template-columns: 1fr 1fr; }
  .report-kpis, .report-grid { grid-template-columns: 1fr 1fr; }
  .evidence-panel { border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 16px; }
  main { width: calc(100% - 22px); }
  .upload-row, .section-heading { align-items: stretch; flex-direction: column; }
  .primary { width: 100%; }
  .metrics { grid-template-columns: 1fr; }
  .reports { padding: 18px; }
  .reports-heading, .export-actions { align-items: stretch; flex-direction: column; }
  .report-filters, .report-kpis, .report-grid { grid-template-columns: 1fr; }
  .filter-actions .primary, .filter-actions .secondary { width: 100%; }
  .queue { padding: 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .dialog-header, .field-panel, .evidence-panel { padding: 20px; }
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.language-toggle { border: 1px solid var(--border, #cbd2dc); background: transparent; border-radius: 999px; color: inherit; cursor: pointer; font: inherit; font-size: .82rem; padding: .38rem .65rem; }
.language-toggle:hover { border-color: currentColor; }
