/* Efficiency Agent demo.
   Tokens mirror ironsilk.com so the demo reads as part of the same site. */

:root {
  --bg:            #ffffff;
  --bg-alt:        #f7f8fa;
  --surface:       #f1f3f5;
  --border:        #e2e4e8;

  --text:          #1a1a2e;
  --text-muted:    #52525b;
  --text-dim:      #71717a;

  --primary:       #0a53a5;
  --primary-dark:  #073d7a;

  --cta:           #C2410C;
  --cta-hover:     #9A3412;

  --success:       #059669;
  --success-bg:    #ecfdf5;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --flag:          #b91c1c;
  --flag-bg:       #fef2f2;
  --flag-border:   #fecaca;

  --font-heading:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     ui-monospace, 'SF Mono', Menlo, monospace;

  --radius:        10px;
  --radius-lg:     14px;
  --shadow:        0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.25; margin: 0; }

.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

/* ── Header / footer ─────────────────────────────────────────────────────── */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: .85rem;
  padding: 1rem 0;
}
.brand {
  font-family: var(--font-heading); font-weight: 700; letter-spacing: .08em;
  color: var(--text); text-decoration: none; font-size: .95rem;
}
.brand-tag {
  font-size: .8rem; color: var(--text-muted);
  padding-left: .85rem; border-left: 1px solid var(--border);
}

.site-footer {
  margin-top: 4rem; padding: 2rem 0 3rem;
  border-top: 1px solid var(--border); background: var(--bg);
}
.site-footer p {
  margin: 0; font-size: .85rem; color: var(--text-dim); max-width: 62ch;
}
.site-footer a { color: var(--primary); }

/* ── States ──────────────────────────────────────────────────────────────── */

.state { display: none; padding: 2.5rem 0 1rem; }
.state.is-active { display: block; }

.intro { max-width: 40rem; margin-bottom: 2.25rem; }
.intro h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
.lede { font-size: 1.1rem; color: var(--text-muted); margin: .75rem 0 0; }

/* ── Sample cards ────────────────────────────────────────────────────────── */

.samples {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.sample-card {
  display: flex; flex-direction: column; text-align: left; gap: .6rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem; cursor: pointer;
  font: inherit; color: inherit; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.sample-card:hover, .sample-card:focus-visible {
  border-color: var(--primary); transform: translateY(-2px);
  outline: none; box-shadow: 0 4px 20px rgba(10,83,165,.12);
}

.sample-thumb {
  height: 132px; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); display: grid; place-items: center;
}
.sample-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.sample-thumb .pdf-badge {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em;
  color: var(--text-dim); border: 1px dashed var(--border);
  padding: .5rem .8rem; border-radius: 6px; background: var(--bg);
}

.sample-card h3 { font-size: .98rem; }
.sample-card p { margin: 0; font-size: .85rem; color: var(--text-muted); }

.run-all-line { margin: 1.1rem 0 2rem; }

.linklike {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--primary); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.linklike:hover { color: var(--primary-dark); }

/* ── Upload ──────────────────────────────────────────────────────────────── */

.upload-panel { max-width: 46rem; }

.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--bg); padding: 2rem 1.25rem; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over {
  border-color: var(--primary); background: #f8fbff; outline: none;
}
.dz-icon { width: 30px; height: 30px; color: var(--primary); }
.dz-main { margin: .5rem 0 .25rem; font-size: .98rem; }
.dz-sub { margin: 0; font-size: .82rem; color: var(--text-dim); }

.privacy {
  margin: .9rem 0 0; font-size: .85rem; color: var(--text-muted);
  background: var(--success-bg); border: 1px solid #a7f3d0;
  border-radius: var(--radius); padding: .7rem .85rem;
}
.privacy strong { color: #065f46; }

.turnstile-slot:not(:empty) { margin-top: 1rem; }

.upload-error {
  margin: .85rem 0 0; padding: .7rem .85rem; font-size: .88rem;
  background: var(--flag-bg); border: 1px solid var(--flag-border);
  border-radius: var(--radius); color: var(--flag);
}

/* ── Processing ──────────────────────────────────────────────────────────── */

.processing { padding: 5rem 0; text-align: center; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 1.1rem;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.processing-label { font-size: 1.05rem; margin: 0; }
.processing-doc { font-size: .85rem; color: var(--text-dim); margin: .35rem 0 0; }

/* ── Results ─────────────────────────────────────────────────────────────── */

.session-bar {
  display: flex; flex-wrap: wrap; gap: .75rem;
  align-items: center; justify-content: space-between; margin-bottom: 1.75rem;
}
.session-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.btn {
  font: inherit; font-size: .88rem; font-weight: 500;
  padding: .58rem 1.05rem; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--cta); border-color: var(--cta); color: #fff; }
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-outline { background: var(--bg); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: none; color: var(--text-muted); padding-left: 0; }
.btn-ghost:hover { color: var(--primary); }

.block-title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); margin-bottom: .7rem; font-weight: 600;
}

/* Session table */
.session-table-wrap { margin-bottom: 2rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); }
.session-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.session-table th, .session-table td {
  text-align: left; padding: .68rem .85rem; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.session-table th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-dim); background: var(--bg-alt);
}
.session-table tr:last-child td { border-bottom: none; }
.session-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.session-table tr.is-current { background: #f8fbff; }
.session-note { font-size: .8rem; color: var(--text-dim); margin: .6rem 0 0; }

.pill {
  display: inline-block; font-size: .74rem; font-weight: 600;
  padding: .12rem .5rem; border-radius: 999px;
}
.pill-clear { background: var(--success-bg); color: #065f46; }
.pill-flag  { background: var(--flag-bg); color: var(--flag); }

/* Two-panel layout */
.results-grid {
  display: grid; gap: 1.5rem; align-items: start;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}
/* The data panel is usually far taller than the document image, which would
   otherwise leave a long dead column on the left. Pinning the preview keeps
   the document in view while the extracted values are read against it —
   which is the comparison the whole layout exists to support. */
.doc-panel { position: sticky; top: 1.25rem; }
.doc-preview img { max-height: 74vh; width: 100%; object-fit: contain; background: var(--surface); }

@media (max-width: 860px) {
  .results-grid { grid-template-columns: 1fr; }
  .doc-panel { position: static; }
  .doc-preview img { max-height: none; }
}

.doc-preview {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); overflow: hidden; box-shadow: var(--shadow);
}
.doc-preview img { display: block; width: 100%; }
.doc-preview iframe { display: block; width: 100%; height: 560px; border: 0; }

/* Extracted data */
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem 1.2rem;
  margin-bottom: 1.1rem; box-shadow: var(--shadow);
}

/* The verdict line — first thing in the right panel. */
.summary {
  display: flex; align-items: center; gap: .55rem;
  padding: .7rem .95rem; margin-bottom: 1.1rem;
  border: 1px solid; border-radius: var(--radius-lg);
  font-size: .95rem; font-weight: 600;
}
.summary-icon { font-weight: 700; flex: none; }
.summary-link { margin-left: auto; font-size: .82rem; font-weight: 500; flex: none; }

.summary-flag  { background: var(--flag-bg);    border-color: var(--flag-border); color: var(--flag); }
.summary-note  { background: var(--warning-bg); border-color: #fde68a;            color: var(--warning); }
.summary-clear { background: var(--success-bg); border-color: #a7f3d0;            color: #065f46; }

.summary-flag .summary-link  { color: var(--flag); }
.summary-note .summary-link  { color: var(--warning); }

.field-grid {
  display: grid; gap: .1rem .9rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.field { padding: .4rem 0; border-bottom: 1px solid var(--surface); }
.field-label {
  display: block; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim);
}
.field-value { font-size: .93rem; }
.field-value.empty { color: var(--text-dim); font-style: italic; }

.items { width: 100%; border-collapse: collapse; font-size: .87rem; margin-top: .4rem; }
.items th, .items td { padding: .45rem .3rem; border-bottom: 1px solid var(--surface); text-align: left; }
.items th {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim);
}
.items .num { text-align: right; font-variant-numeric: tabular-nums; }

.totals { margin-top: .8rem; border-top: 2px solid var(--border); padding-top: .6rem; }
.total-row { display: flex; justify-content: space-between; font-size: .9rem; padding: .16rem 0; }
.total-row.grand { font-weight: 700; font-size: 1.05rem; padding-top: .4rem; }
.total-row .amt { font-variant-numeric: tabular-nums; }

.category-badge {
  display: inline-block; background: #eff6ff; color: var(--primary);
  border: 1px solid #bfdbfe; border-radius: 999px;
  padding: .2rem .7rem; font-size: .86rem; font-weight: 600;
}
.category-why { margin: .5rem 0 0; font-size: .85rem; color: var(--text-muted); }

/* Checks */
.check {
  display: flex; gap: .7rem; padding: .7rem .8rem;
  border-radius: var(--radius); margin-bottom: .5rem; align-items: flex-start;
}
.check:last-child { margin-bottom: 0; }
.check-icon { flex: none; width: 1.05rem; text-align: center; font-weight: 700; line-height: 1.5; }
.check-title { font-weight: 600; font-size: .92rem; }
.check-msg { font-size: .86rem; color: var(--text-muted); margin: .12rem 0 0; }

.check-flag { background: var(--flag-bg); border: 1px solid var(--flag-border); }
.check-flag .check-icon, .check-flag .check-title { color: var(--flag); }

.check-note { background: var(--warning-bg); border: 1px solid #fde68a; }
.check-note .check-icon, .check-note .check-title { color: var(--warning); }

.check-pass { background: transparent; padding: .3rem .8rem; }
.check-pass .check-icon { color: var(--success); }
.check-pass .check-title { font-weight: 500; color: var(--text-muted); font-size: .87rem; }
.check-pass .check-msg { display: none; }

.checks-passed-head {
  font-size: .78rem; color: var(--text-dim); margin: .9rem 0 .3rem;
}

/* CTA */
.cta {
  margin-top: 2.25rem; padding: 1.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-wrap: wrap;
  gap: 1rem; align-items: center; justify-content: space-between;
}
.cta-body { margin: 0; max-width: 46ch; font-size: .95rem; color: var(--text-muted); }

.preview-note {
  margin: 1.25rem 0 0; font-size: .84rem; color: var(--text-dim); max-width: 62ch;
}

.footnote { font-size: .8rem; color: var(--text-dim); margin: .6rem 0 0; }
