:root {
  color-scheme: light;
  --ink: #17211e;
  --muted: #607069;
  --paper: #f3f1e9;
  --white: #fffefa;
  --green: #173f35;
  --green-light: #dce9e3;
  --line: #d7ddd9;
  --danger: #9a342b;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
a { color: var(--green); text-underline-offset: 3px; }
button, input, select { font: inherit; }

.hero { color: #f6f4ec; background: var(--green); padding: 64px 24px 54px; }
.hero__inner, main { width: min(1080px, 100%); margin: 0 auto; }
.eyebrow, .step { margin: 0 0 12px; color: #9fc8b8; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { max-width: 820px; margin: 0; font-family: Georgia, serif; font-size: clamp(40px, 7vw, 74px); font-weight: 500; line-height: .98; }
.lead { max-width: 720px; margin: 28px 0; color: #d8e4df; font-size: 20px; line-height: 1.5; }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: #d8e4df; font-size: 14px; }
.flow span { padding: 7px 11px; border: 1px solid #66887c; border-radius: 99px; }

main { padding: 34px 24px 80px; }
.panel, .history { padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 10px 30px rgba(23, 63, 53, .05); }
.history { margin-top: 24px; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.section-heading .step { color: #618476; }
.auth-panel { margin-bottom: 24px; padding: 18px; border: 1px solid #b9cec5; border-radius: 13px; background: #edf4f0; }
.auth-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.auth-title { margin: 0; font-weight: 750; }
.auth-copy { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.auth-actions { display: flex; flex: 0 0 auto; gap: 9px; align-items: center; }
.button-link { display: inline-flex; min-height: 44px; padding: 10px 18px; align-items: center; border-radius: 9px; color: white; background: var(--green); font-weight: 700; text-decoration: none; }
.button-link[aria-disabled="true"] { cursor: not-allowed; opacity: .45; }
.quota-panel { margin-top: 16px; }
.quota-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 10px; }
.quota-stats div { padding: 10px 12px; border-radius: 9px; background: rgba(255, 255, 255, .72); }
.quota-stats dt { color: var(--muted); font-size: 12px; }
.quota-stats dd { margin: 3px 0 0; color: var(--green); font-size: 20px; font-weight: 750; }
.quota-track { height: 7px; overflow: hidden; border-radius: 99px; background: #d5ded9; }
.quota-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #2d8065; transition: width .25s ease; }
.auth-panel.exhausted { border-color: #dfb1ab; background: #faece9; }
.auth-panel.exhausted .quota-track span { background: var(--danger); }
.auth-panel.exhausted .quota-stats dd { color: var(--danger); }
.collaboration { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.collaboration a { font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; font-weight: 650; }
.field--wide { grid-column: 1 / -1; }
.field small { color: var(--muted); font-size: 13px; font-weight: 400; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #bdc7c2; border-radius: 9px; background: white; color: var(--ink); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9fc8b8; outline-offset: 2px; }
.toggle { display: flex; grid-column: 1 / -1; align-items: center; gap: 10px; font-weight: 650; }
.toggle input { width: 19px; min-height: 19px; }
.actions { display: flex; gap: 16px; align-items: center; margin-top: 24px; }
button { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 9px; color: white; background: var(--green); cursor: pointer; font-weight: 700; }
button:disabled { cursor: not-allowed; opacity: .42; }
.button-secondary { color: var(--green); border: 1px solid #9bb3aa; background: transparent; }
.form-status { margin: 0; color: var(--muted); }
.form-status.error-text { color: var(--danger); }

.empty { padding: 34px; border: 1px dashed #b9c4bf; border-radius: 12px; color: var(--muted); text-align: center; }
.jobs { display: grid; gap: 18px; }
.job-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.job-card__header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.job-card__name { margin: 0; font-weight: 750; overflow-wrap: anywhere; }
.job-card__meta { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.badge { flex: 0 0 auto; padding: 6px 9px; border-radius: 99px; background: var(--green-light); color: var(--green); font-size: 12px; font-weight: 750; }
.progress { height: 8px; margin-top: 18px; overflow: hidden; border-radius: 99px; background: #e4e8e5; }
.progress__bar { width: 0; height: 100%; background: #2d8065; transition: width .3s ease; }
.progress-label { margin: 7px 0 14px; color: var(--muted); font-size: 13px; }
.stages { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.stages li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 7px; background: #f5f6f3; font-size: 14px; }
.stage-status { color: var(--muted); }
.error { margin-top: 14px; padding: 12px; border-radius: 8px; background: #fbe9e7; color: var(--danger); }
.result { display: grid; grid-template-columns: minmax(220px, 420px) 1fr; gap: 20px; margin-top: 20px; }
.result__image { width: 100%; max-height: 430px; border-radius: 10px; background: #edf0ed; object-fit: contain; }
.result__summary { line-height: 1.6; }
.result[hidden] { display: none; }
.result > * { min-width: 0; }
.result__confidence { grid-column: 1 / -1; padding: 18px; border-radius: 10px; background: #f5f6f3; }
.result__confidence h3 { margin: 0 0 14px; font-size: 18px; }
.confidence-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
.confidence-metrics dt, .confidence-metrics small, .confidence-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.confidence-metrics dd { margin: 4px 0; color: var(--green); font-size: 30px; font-weight: 750; }
.confidence-note { margin: 16px 0; }
.result__confidence summary { cursor: pointer; font-weight: 650; }
.result__confidence summary:focus-visible, .confidence-table-scroll:focus-visible { outline: 3px solid #9fc8b8; outline-offset: 2px; }
.confidence-table-scroll { max-height: 360px; overflow: auto; margin-top: 12px; }
.confidence-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.confidence-table th, .confidence-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.confidence-table th { position: sticky; top: 0; background: #f5f6f3; }
.confidence-table td:nth-child(n+3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.artifact-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.artifact-links a { padding: 7px 10px; border: 1px solid #b8c7c1; border-radius: 7px; text-decoration: none; }

@media (max-width: 700px) {
  .hero { padding-top: 44px; }
  .panel, .history { padding: 20px; border-radius: 13px; }
  .form-grid, .result { grid-template-columns: 1fr; }
  .confidence-metrics { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .auth-row { align-items: flex-start; flex-direction: column; }
  .auth-actions { width: 100%; flex-wrap: wrap; }
  .button-link { justify-content: center; }
  .quota-stats { grid-template-columns: 1fr; }
  .actions { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
