:root {
  --bg: #f4efe7;
  --panel: rgba(255, 252, 246, 0.86);
  --panel-strong: #fffaf1;
  --ink: #17211d;
  --muted: #58635e;
  --line: rgba(23, 33, 29, 0.1);
  --teal: #0f7c73;
  --teal-soft: rgba(15, 124, 115, 0.12);
  --amber: #d67b2f;
  --amber-soft: rgba(214, 123, 47, 0.14);
  --rose: #b34d4d;
  --shadow: 0 24px 60px rgba(39, 34, 24, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 124, 115, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(214, 123, 47, 0.18), transparent 28%),
    linear-gradient(180deg, #f8f2e8 0%, #f4efe7 100%);
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
}

.hero-card {
  padding: 28px;
  background: linear-gradient(160deg, rgba(15, 124, 115, 0.16), rgba(255, 250, 241, 0.92));
}

.eyebrow,
.section-kicker,
.hero-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 0.92;
  max-width: 12ch;
}

h2 {
  font-size: 2rem;
}

.lead {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 18px 0 0;
}

.hero-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: var(--ink);
}

.app-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
}

.panel {
  padding: 28px;
}

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

.stack {
  display: grid;
  gap: 18px;
}

.dropzone {
  display: grid;
  gap: 10px;
  padding: 26px;
  background: linear-gradient(180deg, var(--panel-strong), rgba(255, 252, 246, 0.74));
  border: 1px dashed rgba(15, 124, 115, 0.34);
  border-radius: 22px;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.dropzone-copy {
  color: var(--muted);
  line-height: 1.5;
}

input[type="file"] {
  width: 100%;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.operator-panel {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(15, 124, 115, 0.18);
  background: linear-gradient(180deg, rgba(15, 124, 115, 0.08), rgba(255, 250, 241, 0.88));
}

.field-label {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.token-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.text-input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 16px;
  padding: 13px 16px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
}

.text-input:focus {
  outline: 2px solid rgba(15, 124, 115, 0.22);
  outline-offset: 1px;
  border-color: rgba(15, 124, 115, 0.42);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ops-shell {
  padding-bottom: 56px;
}

.hero-ops .hero-card {
  display: grid;
  gap: 14px;
}

.hero-operator {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.ops-grid,
.ops-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.ops-dashboard-grid {
  grid-template-columns: 360px minmax(0, 1fr);
}

.ops-steps {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.copy-command {
  border-radius: 22px;
  border: 1px dashed rgba(15, 124, 115, 0.32);
  padding: 18px;
  background: linear-gradient(180deg, rgba(23, 33, 29, 0.96), rgba(35, 44, 40, 0.94));
  color: #f6f3ec;
  cursor: pointer;
}

.copy-command pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.copy-hint {
  margin: 14px 0 0;
  color: rgba(246, 243, 236, 0.78);
}

.ops-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}

.ops-checkbox input {
  width: 18px;
  height: 18px;
}

.ops-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ops-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.panel-inset {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 250, 241, 0.76));
}

.panel-inset h3 {
  margin: 0 0 10px;
}

.ops-inline-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ops-section + .ops-section {
  margin-top: 24px;
}

.ops-job-card {
  gap: 12px;
}

.ops-result-list {
  display: grid;
  gap: 10px;
}

.ops-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.button-primary {
  background: var(--teal);
  color: white;
}

.button-secondary {
  background: var(--amber-soft);
  color: var(--ink);
}

.status-panel {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-label {
  color: var(--muted);
}

.activity {
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.pill-muted {
  background: rgba(23, 33, 29, 0.07);
  color: var(--muted);
}

.pill-ok {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill-review {
  background: var(--amber-soft);
  color: #8f4b17;
}

.pill-error {
  background: rgba(179, 77, 77, 0.12);
  color: var(--rose);
}

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

.bookkeeping-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 16px;
  background: var(--panel-strong);
}

.metric-card-alt {
  background: linear-gradient(180deg, rgba(15, 124, 115, 0.08), rgba(255, 250, 241, 0.9));
}

.metric-card-alert {
  background: linear-gradient(180deg, rgba(179, 77, 77, 0.08), rgba(255, 250, 241, 0.9));
}

.metric-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 2rem;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 24px;
}

.empty-state-compact {
  padding: 18px;
  margin-bottom: 18px;
}

.results-list {
  display: grid;
  gap: 14px;
}

.reconciliation-panel {
  margin-top: 28px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.reconciliation-table-shell {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 241, 0.88));
}

.reconciliation-table-head,
.reconciliation-row {
  display: grid;
  grid-template-columns: 0.9fr 0.9fr 1.2fr 2fr 0.9fr;
  gap: 14px;
  align-items: center;
}

.reconciliation-table-head {
  padding: 14px 18px;
  background: rgba(23, 33, 29, 0.04);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reconciliation-table {
  display: grid;
}

.reconciliation-entry + .reconciliation-entry {
  border-top: 1px solid var(--line);
}

.reconciliation-row {
  padding: 16px 18px;
  background: transparent;
}

.reconciliation-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.reconciliation-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.reconciliation-amount {
  font-weight: 700;
}

.amount-negative {
  color: var(--rose);
}

.amount-positive {
  color: var(--teal);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-good {
  background: rgba(15, 124, 115, 0.12);
  color: var(--teal);
}

.status-medium {
  background: rgba(214, 123, 47, 0.15);
  color: #8f4b17;
}

.status-bad {
  background: rgba(179, 77, 77, 0.12);
  color: var(--rose);
}

.status-muted-chip {
  background: rgba(23, 33, 29, 0.08);
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.dot-good {
  background: var(--teal);
}

.dot-medium {
  background: var(--amber);
}

.dot-bad {
  background: var(--rose);
}

.dot-muted {
  background: rgba(23, 33, 29, 0.42);
}

.entry-action {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.entry-action-primary {
  background: var(--teal);
  color: white;
}

.entry-action-secondary {
  background: rgba(23, 33, 29, 0.08);
  color: var(--ink);
}

.entry-action-danger {
  background: rgba(179, 77, 77, 0.12);
  color: var(--rose);
}

.entry-action:hover {
  transform: translateY(-1px);
}

.reconciliation-detail {
  padding: 0 18px 18px;
  background: rgba(23, 33, 29, 0.02);
}

.detail-state {
  margin: 0;
  padding-top: 4px;
  color: var(--muted);
}

.detail-error {
  color: var(--rose);
}

.candidate-list {
  display: grid;
  gap: 12px;
}

.candidate-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.candidate-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.candidate-title {
  margin: 0;
  font-size: 1rem;
}

.candidate-meta {
  margin: 4px 0 0;
  color: var(--muted);
}

.candidate-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}

.candidate-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

.candidate-reasons {
  color: var(--ink);
}

.result-card {
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 250, 241, 0.84));
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.result-title {
  margin: 0;
  font-size: 1.15rem;
}

.result-meta {
  color: var(--muted);
  margin-top: 6px;
}

.tag-row,
.link-row,
.evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.84rem;
  font-weight: 700;
  background: rgba(23, 33, 29, 0.07);
}

.tag-family {
  background: rgba(15, 124, 115, 0.12);
  color: var(--teal);
}

.tag-direction {
  background: rgba(214, 123, 47, 0.15);
  color: #945116;
}

.tag-metadata {
  background: rgba(15, 124, 115, 0.08);
  color: #18544e;
}

.tag-llm {
  background: rgba(69, 93, 214, 0.14);
  color: #3044a4;
}

.tag-llm-detail {
  background: rgba(69, 93, 214, 0.08);
  color: #3044a4;
}

.result-section {
  margin-top: 14px;
}

.section-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.link-row a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 700;
}

.link-row a:hover {
  text-decoration: underline;
}

.llm-section {
  margin-top: 16px;
  border: 1px solid rgba(69, 93, 214, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(69, 93, 214, 0.05), rgba(255, 250, 241, 0.78));
  overflow: hidden;
}

.llm-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 700;
}

.llm-summary::-webkit-details-marker {
  display: none;
}

.llm-summary-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.llm-body {
  padding: 0 16px 16px;
}

.llm-error {
  margin: 0;
  color: var(--rose);
  font-weight: 700;
}

@media (max-width: 980px) {
  .hero,
  .app-grid,
  .ops-grid,
  .ops-dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .bookkeeping-grid {
    grid-template-columns: 1fr;
  }

  .ops-summary-grid,
  .ops-status-grid {
    grid-template-columns: 1fr;
  }

  .reconciliation-table-head,
  .reconciliation-row {
    grid-template-columns: 1fr;
  }

  .reconciliation-table-head {
    display: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 22px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .ops-result-row {
    flex-direction: column;
  }

  .token-row {
    flex-direction: column;
    align-items: stretch;
  }
}
