:root {
  --ink: #0b1b2b;
  --ink2: #16283b;
  --paper: #f2f5f7;
  --line: #dde3e8;
  --muted: #5b6b78;
  --accent: #0070cc;
  --accent2: #005a9e;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; color: var(--ink); background: var(--paper); line-height: 1.5; -webkit-font-smoothing: antialiased; }
.workspace { max-width: 1180px; margin: 0 auto; padding: 16px 16px 60px; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #334; }
label.full { grid-column: 1 / -1; margin-top: 12px; }
input, select, textarea { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
.button { font: inherit; font-weight: 700; border-radius: 8px; padding: 10px 18px; border: 1px solid transparent; cursor: pointer; background: #eef2f5; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent2); }
.button.ghost { background: transparent; border-color: var(--line); }
.button.small { padding: 6px 12px; font-size: 13px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 16px 0; }

.auth-card { max-width: 420px; margin: 60px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.back-link { font-size: 13px; text-decoration: none; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar input { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }

.job-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.job-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.job-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.row-link { cursor: pointer; }
.row-link:hover { background: var(--paper); }
.status-pill { background: var(--paper); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.confidence { font-size: 11px; border-radius: 999px; padding: 2px 8px; margin-left: 4px; }
.confidence-high { background: #dcfce7; color: var(--ok); }
.confidence-moderate { background: #fef3c7; color: var(--warn); }
.confidence-low { background: #f1f5f9; color: var(--muted); }

.classification-banner { background: #eaf4fc; border: 1px solid #b8dbf5; border-radius: 10px; padding: 16px; margin: 16px 0; }
.classification-banner p { margin: 6px 0 0; color: #0d3a5c; }
.classification-banner .confidence-tag { font-size: 12px; font-weight: 700; margin-left: 8px; text-transform: uppercase; }
.contradiction-banner { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 16px; margin: 10px 0; color: #7c2d12; }
.contradiction-banner ul { margin: 8px 0 0; padding-left: 20px; }

.stage-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.stage-tab { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.stage-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.stage-tab .dot { opacity: 0.65; font-size: 11px; margin-left: 4px; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 14px 0 0; }
fieldset legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.checkbox { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; display: inline-flex; margin: 4px 10px 4px 0; }
.checkbox input { width: auto; }

.safety-notice { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; border-radius: 10px; padding: 14px; margin-bottom: 16px; font-size: 14px; }

.tests-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tests-table th { text-align: left; padding: 6px; font-size: 11px; color: var(--muted); }
.tests-table td { padding: 4px; vertical-align: top; }
.tests-table input, .tests-table select { padding: 6px; font-size: 13px; }

.quick-note form { display: flex; gap: 10px; }
.quick-note input { flex: 1; }
.timeline { list-style: none; padding: 0; margin: 14px 0 0; font-size: 13px; }
.timeline li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); margin-right: 8px; font-size: 12px; }

.attachment-list { list-style: none; padding: 0; }
.attachment-list li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }

.save-indicator { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--paper); }
.save-saving { color: var(--warn); }
.save-saved { color: var(--ok); }
.save-error, .save-offline { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px; z-index: 999; }
.toast-error { background: var(--danger); }

@media (max-width: 640px) {
  .workspace { padding: 10px 12px 60px; }
  .topbar h1 { font-size: 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .tests-table { display: block; overflow-x: auto; }
}
