:root {
  --ink: #101315;
  --muted: #6f7779;
  --line: #dfe4e3;
  --surface: #ffffff;
  --canvas: #f1f4f2;
  --green: #0d754d;
  --green-soft: #e6f2ec;
  --amber: #a86200;
  --red: #aa2d2d;
  --shadow: 0 18px 50px rgba(20, 32, 27, .08);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
header { height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 64px); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand span:last-child { display: grid; line-height: 1.15; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--ink); color: #fff; font: 700 25px Georgia, serif; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 19px; }
.header-status { display: flex; align-items: center; gap: 10px; }
.status-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: #b0b7b5; box-shadow: 0 0 0 4px #edf0ef; }
.status-pill.ready i { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
main { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 64px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding: 34px 8px 48px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .14em; margin: 0 0 10px; }
.hero h1 { font: 600 clamp(36px, 5vw, 66px)/1.02 Georgia, serif; letter-spacing: -.035em; margin: 0; }
.hero h1 em { color: var(--green); font-weight: 400; }
.hero p:last-child { color: var(--muted); max-width: 700px; font-size: 16px; margin: 20px 0 0; }
.hero-metric { min-width: 200px; border-left: 1px solid #bdc9c4; padding-left: 30px; display: flex; align-items: flex-end; gap: 14px; }
.hero-metric span { font: 600 66px/1 Georgia, serif; }
.hero-metric small { color: var(--muted); padding-bottom: 7px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-bottom: 22px; }
.stats-grid article { background: var(--surface); padding: 22px 24px; display: grid; min-height: 112px; }
.stats-grid small { color: var(--muted); }
.stats-grid strong { font: 600 24px/1.2 Georgia, serif; margin: 8px 0; }
.stats-grid span { font-size: 12px; color: var(--green); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); margin-bottom: 22px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
h2 { font: 600 27px/1.2 Georgia, serif; margin: 0; }
.safe-badge { padding: 7px 11px; background: var(--green-soft); color: var(--green); border-radius: 999px; font-size: 11px; font-weight: 700; }
.lanes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.lane { border: 1px solid var(--line); border-radius: 16px; padding: 18px; position: relative; transition: .2s ease; }
.lane.active { border-color: #85b8a1; background: #fbfdfc; }
.lane header { height: auto; position: static; padding: 0; border: 0; background: transparent; margin-bottom: 14px; }
.lane-number { display: inline-grid; place-items: center; width: 29px; height: 29px; background: var(--ink); color: #fff; border-radius: 9px; font-weight: 700; }
.lane-state { color: var(--muted); font-size: 11px; }
.lane select, .field select, .field input, .access-card input { width: 100%; border: 1px solid #cfd7d4; border-radius: 11px; background: #fff; padding: 11px 12px; color: var(--ink); outline: none; }
.lane select:focus, .field select:focus, .field input:focus, .access-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,117,77,.1); }
.lane-progress { margin-top: 14px; height: 5px; background: #e9edeb; border-radius: 99px; overflow: hidden; }
.lane-progress span { display: block; width: 0; height: 100%; background: var(--green); transition: width .3s ease; }
.split { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(400px, 1.15fr); gap: 22px; }
.split .panel { margin-bottom: 22px; }
.field { display: grid; gap: 7px; color: #3b4240; margin-bottom: 16px; font-weight: 600; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 16px 0; }
.toggle-row span { display: grid; }
.toggle-row small { color: var(--muted); margin-top: 3px; }
.toggle-row input { width: 42px; height: 23px; accent-color: var(--green); }
.action-panel > p:not(.eyebrow,.action-message) { color: var(--muted); max-width: 650px; }
.rule-note { margin: 24px 0; padding: 16px; border-left: 3px solid var(--green); background: var(--green-soft); display: grid; }
.rule-note span { color: #496057; margin-top: 3px; }
.action-buttons { display: flex; gap: 10px; }
button { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 750; transition: transform .15s, opacity .15s; }
button:hover { transform: translateY(-1px); }
button:disabled { cursor: wait; opacity: .55; transform: none; }
.primary { background: var(--ink); color: #fff; }
.secondary { background: var(--green); color: #fff; }
.danger { background: #f7e9e7; color: var(--red); border: 1px solid #edcfcb; }
.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.compact { padding: 7px 11px; font-size: 12px; }
.full { width: 100%; margin-top: 8px; }
.action-message { color: var(--green); min-height: 21px; margin: 16px 0 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 940px; }
th { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid #edf0ef; vertical-align: top; }
td small { color: var(--muted); display: block; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; color: var(--muted); padding: 35px; }
.result { display: inline-flex; border-radius: 99px; padding: 4px 8px; font-size: 10px; font-weight: 800; background: #eef1f0; }
.result.linked, .result.ready { background: var(--green-soft); color: var(--green); }
.result.review, .result.skipped { background: #fff1dc; color: var(--amber); }
.result.error { background: #f8e9e7; color: var(--red); }
footer { display: flex; justify-content: space-between; padding: 25px clamp(20px, 4vw, 64px); color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.access-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: #eaf0ec; }
.access-screen.hidden { display: none; }
.access-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 36px; box-shadow: var(--shadow); }
.access-card h1 { font: 600 34px/1.1 Georgia, serif; margin: 15px 0 8px; }
.access-card > p:not(.eyebrow,.form-error) { color: var(--muted); }
.access-card label { display: grid; gap: 7px; margin: 25px 0 14px; font-weight: 650; }
.access-card button { width: 100%; }
.form-error { color: var(--red); min-height: 20px; }
@media (max-width: 1040px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .lanes-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  header { height: auto; padding: 13px 16px; align-items: flex-start; }
  .header-status { flex-wrap: wrap; justify-content: flex-end; }
  .status-pill { width: 100%; justify-content: flex-end; }
  main { width: min(100% - 24px, 1400px); padding-top: 20px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-metric { border-left: 0; border-top: 1px solid #bdc9c4; padding: 18px 0 0; }
  .stats-grid, .lanes-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .action-buttons { flex-direction: column; }
  footer { flex-direction: column; gap: 5px; }
  #testConnection { display: none; }
}
