:root {
  --ink: #172026;
  --muted: #5e6872;
  --paper: #f4f0e8;
  --panel: #ffffff;
  --line: #d9dedf;
  --green: #0f766e;
  --green-dark: #083f3b;
  --coral: #d86f4d;
  --gold: #d69b35;
  --blue: #2f5f7c;
  --shadow: 0 24px 70px rgba(22, 32, 38, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 63, 59, 0.08) 0%, rgba(244, 240, 232, 0) 360px),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(30px, 4vw, 54px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--green-dark);
  color: #fff;
}

.top-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 32, 38, 0.1);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 450px);
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
  min-height: 500px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3.6vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 650px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.workflow-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 32, 38, 0.12);
  color: var(--green-dark);
  font-weight: 900;
}

.capture-panel,
.preview-card,
.metrics article,
.table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.capture-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.panel-header h2 {
  font-size: 1.35rem;
}

.panel-header > span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  background: #edf4f3;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 280px;
  border: 1px dashed #8ea5a2;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(216, 111, 77, 0.08)),
    #f6fbfa;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: #e0f2ef;
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone label {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  background: var(--green-dark);
  color: #fff;
  font-size: 2rem;
  font-weight: 600;
  box-shadow: 0 12px 34px rgba(8, 63, 59, 0.22);
}

.drop-zone span:last-child,
.status {
  color: var(--muted);
}

.preview-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  box-shadow: none;
}

.preview-card img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #111;
  border-radius: 6px;
}

#extract-button,
.secondary-button {
  min-height: 44px;
  border: 0;
  padding: 10px 14px;
  font-weight: 900;
}

#extract-button {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

#extract-button:hover {
  box-shadow: 0 12px 28px rgba(8, 63, 59, 0.18);
  transform: translateY(-1px);
}

#extract-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.status {
  min-height: 24px;
  margin: 0;
  font-weight: 800;
}

.status.error {
  color: #9c2c2c;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: clamp(26px, 4vw, 42px) 0;
}

.metrics article {
  display: grid;
  gap: 8px;
  min-height: 144px;
  padding: 22px;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.metrics article::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 54px;
  height: 4px;
  background: var(--gold);
}

.metrics span {
  color: var(--muted);
  font-weight: 800;
}

.metrics .metric-kicker {
  color: var(--coral);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metrics strong {
  align-self: end;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
}

.table-section {
  padding: clamp(18px, 3vw, 28px);
  box-shadow: none;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.table-actions span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.secondary-button {
  background: #e8ecec;
  color: var(--ink);
  border: 1px solid var(--line);
  transition: background 160ms ease;
}

.secondary-button:hover {
  background: #dfe7e6;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f7faf9;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:not(.empty-row):hover {
  background: #fbfdfc;
}

.amount-cell {
  text-align: right;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  background: #edf4f3;
  color: var(--green-dark);
  font-weight: 900;
}

.confidence-meter {
  display: grid;
  gap: 6px;
  min-width: 90px;
}

.confidence-meter span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.confidence-track {
  height: 6px;
  background: #e7ecec;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

@media (max-width: 860px) {
  .hero,
  .metrics {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .table-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  h1 {
    font-size: clamp(2.8rem, 17vw, 4.2rem);
  }

  .capture-panel,
  .table-section {
    padding: 12px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workflow-strip span,
  .top-badge {
    width: 100%;
    justify-content: center;
  }
}
