:root {
  --ink: #17211b;
  --muted: #66736b;
  --paper: #f4f5ef;
  --panel: #ffffff;
  --line: #dfe4db;
  --green: #1f6d4d;
  --green-dark: #14513a;
  --green-soft: #e6f2eb;
  --amber: #9a6412;
  --red: #a33b31;
  --blue: #2f5d87;
  --shadow: 0 16px 42px rgba(29, 48, 37, .08);
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.7rem); line-height: 1; letter-spacing: -.045em; margin-bottom: 1rem; }
h2 { letter-spacing: -.02em; }
code { background: #edf0e9; border-radius: 5px; padding: .15rem .35rem; }
.site-header { height: 72px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: rgba(244,245,239,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--green); color: white; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.site-nav { display: flex; align-items: center; gap: 1.1rem; font-size: .92rem; }
.site-nav form { margin: 0; }
.link-button { border: 0; background: transparent; color: var(--green); cursor: pointer; padding: 0; font: inherit; }
.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 90px; }
.narrow-page { width: min(860px, 100%); margin: 0 auto; }
.workflow-tabs { display: inline-flex; gap: 4px; margin-bottom: 34px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: #e9ede6; }
.workflow-tab { min-width: 120px; padding: .68rem 1rem; border-radius: 9px; color: var(--muted); font-weight: 800; text-align: center; }
.workflow-tab:hover { color: var(--green-dark); }
.workflow-tab.active { background: white; color: var(--green-dark); box-shadow: 0 5px 14px rgba(29, 48, 37, .1); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 38px; }
.hero-row > div:first-child { max-width: 760px; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin-bottom: .8rem; color: var(--green); font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.lead { color: var(--muted); font-size: 1.08rem; line-height: 1.65; max-width: 720px; }
.muted { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .7rem 1rem; border: 1px solid #cdd5cb; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.button:hover { border-color: var(--green); color: var(--green-dark); }
.button-primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 8px 20px rgba(31,109,77,.18); }
.button-primary:hover { background: var(--green-dark); color: #fff; }
.button-small { min-height: 34px; padding: .45rem .7rem; }
.button-wide { width: 100%; min-height: 52px; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.panel-heading { display: flex; align-items: center; gap: .8rem; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.count-pill { background: var(--green-soft); color: var(--green); border-radius: 999px; padding: .2rem .55rem; font-weight: 700; font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; text-align: left; padding: .75rem; border-bottom: 1px solid var(--line); }
td { padding: 1rem .75rem; border-bottom: 1px solid #edf0ea; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.table-action { text-align: right; white-space: nowrap; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: .34rem .62rem; font-size: .78rem; font-weight: 800; background: #edf0eb; color: #546057; white-space: nowrap; }
.status-large { font-size: .92rem; padding: .55rem .85rem; }
.status-success, .status-ready { background: #dcf2e5; color: #176342; }
.status-running, .status-processing { background: #e0ebf5; color: var(--blue); }
.status-queued, .status-draft { background: #f5edda; color: var(--amber); }
.status-failed, .status-rejected { background: #f7e2df; color: var(--red); }
.status-partial { background: #f4ead5; color: #895b18; }
.empty-state { text-align: center; color: var(--muted); padding: 34px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.compact-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 260px)); }
.summary-card { display: flex; flex-direction: column; gap: .65rem; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fafbf8; color: var(--ink); }
.stack-form { display: grid; gap: 18px; }
.stack-form label { display: grid; gap: .5rem; font-weight: 700; }
input[type=text], input[type=password], input[type=file], textarea, select { width: 100%; border: 1px solid #cbd3c9; border-radius: 9px; padding: .76rem .8rem; background: white; color: var(--ink); font: inherit; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(31,109,77,.14); border-color: var(--green); }
.form-error, .errorlist { background: #f8e5e2; color: var(--red); padding: .8rem 1rem; border-radius: 9px; list-style: none; margin: 0; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.upload-card { position: relative; min-height: 230px; padding: 22px; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.upload-number { position: absolute; top: 18px; right: 18px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; }
.upload-card h2 { font-size: 1.1rem; padding-right: 35px; }
.upload-card p { min-height: 48px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.file-picker { display: block !important; }
.file-picker span { display: block; margin-bottom: 6px; color: var(--green); }
.upload-status { margin-top: 12px; padding: .7rem .8rem; border-radius: 8px; background: #f1f3ef; color: var(--muted); font-size: .84rem; }
.upload-status.checking { background: #e8eef4; color: var(--blue); }
.upload-status.accepted { background: #e1f2e7; color: var(--green-dark); }
.upload-status.rejected { background: #f8e4e1; color: var(--red); }
.messages { display: grid; gap: 8px; margin-bottom: 24px; }
.message { padding: .85rem 1rem; border-radius: 10px; background: #e4efe8; color: var(--green-dark); }
.message.error { background: #f8e4e1; color: var(--red); }
.message.warning { background: #f7eedc; color: var(--amber); }
.error-panel { border-color: #e9bbb5; }
.warning-panel { border-color: #ead5a6; }
.issue-list { display: grid; gap: .65rem; margin: 0; padding-left: 1.3rem; }
.processing-card { display: flex; align-items: center; gap: 20px; background: white; border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.processing-card h2, .processing-card p { margin-bottom: .35rem; }
.spinner { width: 38px; height: 38px; border: 4px solid #dce5dd; border-top-color: var(--green); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.results-grid { display: grid; gap: 26px; }
.result-card { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr); overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.result-image { min-height: 320px; background: #e8ebe5; display: grid; place-items: center; }
.result-image img { display: block; width: 100%; height: 100%; max-height: 720px; object-fit: contain; }
.result-body { padding: 26px; }
.metrics { display: grid; gap: .5rem; margin: 0 0 24px; }
.metrics div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: .5rem; border-bottom: 1px solid #edf0ea; }
.metrics dt { color: var(--muted); font-size: .8rem; word-break: break-word; }
.metrics dd { margin: 0; font-weight: 800; }
.auth-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #dfeee5, transparent 38%), var(--paper); }
.auth-card { width: min(430px, 100%); padding: 38px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 90px rgba(24,52,35,.14); }
.auth-brand { margin-bottom: 38px; }
.auth-card h1 { font-size: 2.6rem; }
.error-page { min-height: 55vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.error-code { color: var(--green); font-size: 6rem; line-height: 1; font-weight: 900; opacity: .18; }
@media (max-width: 800px) {
  .site-header { height: auto; min-height: 68px; padding: 14px 20px; align-items: flex-start; }
  .site-nav { justify-content: flex-end; flex-wrap: wrap; gap: .65rem 1rem; }
  .site-nav .button { display: none; }
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .workflow-tabs { display: flex; width: 100%; }
  .workflow-tab { flex: 1; min-width: 0; }
  .upload-grid, .result-card { grid-template-columns: 1fr; }
  .upload-card p { min-height: 0; }
  .result-image { min-height: 220px; }
}
