:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f9fafb; --border: #e3e6ea; --border-strong: #cfd4da;
  --text: #1c2430; --muted: #5d6877; --faint: #8a94a3;
  --brand: #1f4f8f; --brand-2: #2e6ac0; --brand-soft: #e8f0fb;
  --green: #1a7f4b; --green-soft: #e3f4ea; --amber: #9a5b00; --amber-soft: #fdf1dc;
  --red: #b42318; --red-soft: #fde8e6; --purple: #6941c6; --purple-soft: #efeafc;
  --gray-soft: #eef0f3; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 8px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --panel: #161d26; --panel-2: #1b2430; --border: #283241; --border-strong: #37445a;
    --text: #e6eaf0; --muted: #a3adbb; --faint: #7a8596;
    --brand: #6aa3ff; --brand-2: #8db8ff; --brand-soft: #1a2a44;
    --green: #4cc38a; --green-soft: #143024; --amber: #f0b44c; --amber-soft: #33270f;
    --red: #ff7b6e; --red-soft: #3a1714; --purple: #b69cff; --purple-soft: #2a2145;
    --gray-soft: #222b37; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { overflow-y: scroll; scrollbar-gutter: stable; }  /* keep the scrollbar space: no sideways jump when a page is shorter or still loading */
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 12px 12px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 10px; font-weight: 650; }
.brand-mark { width: 32px; height: 32px; flex: none; object-fit: contain; }
.brand small { display: block; font-weight: 450; color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 6px; color: var(--text); margin-bottom: 0; font-size: 13.5px; }
.nav a:hover { background: var(--gray-soft); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 7px 10px 2px; }
.nav .section:first-child { padding-top: 2px; }
.nav svg { width: 16px; height: 16px; flex: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 10px 8px 0; font-size: 12.5px; }
.sf-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; margin-top: 6px; }
.sf-links a { font-size: 12.5px; }
.main { padding: 14px 28px 40px; max-width: 1360px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 14px; flex-wrap: wrap; min-height: 40px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel, .panel + .grid, .grid + .panel { margin-top: 16px; }
.grid > .panel { margin-top: 0; }
.panel-body { padding: 16px 18px; }
.panel-head { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .shell { grid-template-columns: minmax(0, 1fr); } .sidebar { position: static; height: auto; padding: 10px; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; } .nav .section { display: none; } .nav a { padding: 6px 9px; margin: 0; }
  .sidebar .brand { padding-bottom: 8px; } .sidebar-foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 8px; padding-top: 8px; }
  .sidebar-foot > div { margin: 0 !important; } .form-grid, .form-grid.three { grid-template-columns: 1fr; } .form-grid .submit-cell { grid-column: auto; } .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); } .main { padding: 16px; } }
.stat { padding: 14px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 2px; }
.stat .hint { color: var(--faint); font-size: 12px; }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-word; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.clickable { cursor: pointer; }
tbody tr.dim td { opacity: .55; }
td.actions-cell { white-space: nowrap; text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); padding: 7px 12px; border-radius: 6px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--gray-soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 3px 8px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
input, select, textarea { max-width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; color: var(--text) !important; font-size: 13.5px !important; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; margin: 0 4px 4px 0; background: var(--panel-2); }
.chip button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }
.chip button:hover { color: var(--red); }
.chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chain .sep { color: var(--faint); }
.chain .current { font-weight: 650; }

/* ---------- forms / modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,15,25,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border-radius: 10px; width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); border: 1px solid var(--border); }
.modal.wide { width: min(980px, 100%); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .submit-cell { justify-content: flex-end; align-items: flex-end; grid-column: -2 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .help { font-size: 12px; color: var(--faint); }
.field .req { color: var(--red); }
.form-error { background: var(--red-soft); color: var(--red); border-radius: 6px; padding: 8px 10px; margin-bottom: 12px; font-size: 13px; white-space: pre-wrap; }
.notice { background: var(--amber-soft); color: var(--amber); border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.notice.info { background: var(--brand-soft); color: var(--brand); }
.secret { font-family: var(--mono); background: var(--panel-2); border: 1px dashed var(--border-strong); padding: 10px; border-radius: 6px; word-break: break-all; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; font-size: 13.5px; }
.toast.error { background: var(--red); color: #fff; }

/* ---------- login ---------- */
/* sign-in: brand panel + card */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
.login-hero { position: relative; display: flex; flex-direction: column; padding: 36px 48px; color: #e8eef8; overflow: hidden;
  background: radial-gradient(1200px 500px at 110% -10%, rgba(76,140,230,.35), transparent 60%),
              linear-gradient(160deg, #0f2747 0%, #16386a 55%, #1f4f8f 100%); }
.login-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 36px 36px; mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.login-hero > * { position: relative; }
.login-hero .brand { padding: 0; color: #fff; }
.login-hero .brand small { color: #b9c8de; }
.login-hero .brand-mark { width: 44px; height: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.lh-body { margin: auto 0; max-width: 470px; padding: 40px 0; }
.lh-body h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 12px; color: #fff; }
.lh-body > p { color: #c6d3e6; font-size: 15px; margin: 0 0 28px; }
.login-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.login-features li { display: flex; gap: 12px; align-items: flex-start; color: #c6d3e6; font-size: 13.5px; }
.login-features b { display: block; color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 1px; }
.lf-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.lf-icon svg { width: 16px; height: 16px; }
.lh-powered { display: inline-flex; flex-direction: column; gap: 1px; align-self: flex-start; color: #dfe8f5; font-size: 13px;
  padding: 10px 14px; border-radius: 8px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.lh-powered:hover { text-decoration: none; background: rgba(255,255,255,.12); }
.lh-powered b { color: #fff; }
.lh-powered span:not(.lh-by) { color: #9fb2cd; font-size: 12px; }
.login-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px 20px; }
.login-card { width: min(400px, 100%); margin: auto 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.08), var(--shadow); padding: 32px; }
.login-logo { display: block; width: 200px; height: auto; margin: -6px 0 18px -6px; }
.login-card h2 { margin: 0 0 4px; font-size: 22px; }
.powered-by { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.powered-by img { width: 16px; height: 16px; }
.powered-by:hover { color: var(--muted); text-decoration: none; }
.powered-by b { color: var(--muted); font-weight: 600; }
.login-sub { margin: 0 0 22px; }
.login-foot { margin-top: 24px; }
html.login-page { overflow-y: auto; scrollbar-gutter: auto; }
.login { height: 100vh; height: 100dvh; }
.login-hero, .login-main { overflow-y: auto; }
@media (max-height: 720px) and (min-width: 861px) {   /* short laptop screens: fit without scrolling */
  .login-hero { padding: 24px 40px; }
  .lh-body { padding: 18px 0; }
  .lh-body h1 { font-size: 26px; margin-bottom: 8px; }
  .lh-body > p { margin-bottom: 18px; }
  .login-features { gap: 10px; }
  .login-features li { font-size: 13px; }
  .lh-powered { padding: 8px 12px; }
  .login-card { padding: 26px; }
  .login-logo { width: 170px; margin-bottom: 12px; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
  .login-hero, .login-main { overflow: visible; }
  .login-hero { padding: 22px 22px 20px; }
  .lh-body { padding: 18px 0 16px; }
  .lh-body h1 { font-size: 22px; }
  .login-features, .lh-body > p { display: none; }
}

/* ---------- assessment ---------- */
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.verdict .big { font-size: 20px; font-weight: 700; padding: 10px 16px; border-radius: 8px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.fact { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.fact .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-weight: 650; margin-top: 2px; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr 1fr; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; }
.tabs a.active { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.tick { color: var(--green); font-weight: 700; } .cross { color: var(--faint); }

/* ---------- timeline ---------- */
.year { display: grid; grid-template-columns: 80px 1fr; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.year:last-child { border-bottom: 0; }
.year .y { font-size: 20px; font-weight: 700; color: var(--brand); }
.event { display: grid; grid-template-columns: 96px 150px 1fr; gap: 10px; padding: 5px 0; align-items: baseline; }
.event + .event { border-top: 1px dashed var(--border); }
@media (max-width: 760px) { .event { grid-template-columns: 1fr; gap: 2px; } }

.diff { font-family: var(--mono); font-size: 12px; }
.diff .del { color: var(--red); text-decoration: line-through; }
.diff .add { color: var(--green); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; color: var(--muted); font-size: 12.5px; }

/* ---------- small screens (kept last so it overrides the rules above) ---------- */
@media (max-width: 760px) {
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .form-grid .submit-cell { grid-column: auto; }
  .verdict { grid-template-columns: 1fr; gap: 10px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 8px; }
}

/* ---------- review workflow ---------- */
.nav-count { margin-left: auto; background: var(--amber); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.spacer { flex: 1; }
.review-indicator .panel-body { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.review-indicator .ri-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.review-indicator .ri-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--green); }
.review-indicator.attention { border-color: var(--amber); }
.review-indicator.attention .ri-dot { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.review-indicator .ri-title { font-weight: 650; font-size: 15px; }
#review-indicator .panel { margin-bottom: 16px; }
.wf-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.wf-banner.target { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.steps span { padding: 5px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.steps span.done { background: var(--green-soft); color: var(--green); border-color: transparent; }
.steps span.now { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); font-weight: 600; }
.doc-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: stretch; }
.doc-pair .arrow { align-self: center; font-size: 20px; color: var(--faint); }
.doc-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--panel-2); min-width: 0; word-break: break-word; }
.doc-card.empty-card { border-style: dashed; }
.review-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.flags, .items { display: flex; flex-direction: column; }
.flag, .item { padding: 10px 16px; border-top: 1px solid var(--border); }
.flag.important:not(.resolved) { border-left: 3px solid var(--amber); }
.flag.resolved { border-left: 3px solid var(--green); background: color-mix(in srgb, var(--green-soft) 35%, transparent); }
.flag.resolved .flag-text { opacity: .75; }
.flag-progress { height: 6px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; margin: 6px 0 4px; max-width: 360px; }
.flag-progress span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.flag-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flag-text { margin: 8px 0 6px; font-size: 13px; line-height: 1.5; }
.flag-text .old { background: var(--red-soft); color: var(--text); padding: 6px 9px; border-radius: 6px; text-decoration: line-through; text-decoration-color: rgba(200,0,0,.45); margin-bottom: 4px; }
.flag-text .new { background: var(--green-soft); color: var(--text); padding: 6px 9px; border-radius: 6px; }
.flag-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 16px; background: var(--panel-2); border-top: 1px solid var(--border); }
.add-bar { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pick { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-bottom: 10px; }
table.mini { width: auto; margin: 6px 0; } table.mini td { padding: 2px 10px 2px 0; border: 0; vertical-align: top; }
.del { color: var(--red); text-decoration: line-through; } .add { color: var(--green); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
select.sm { padding: 4px 8px; font-size: 12.5px; }
@media (max-width: 1100px) { .review-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .doc-pair { grid-template-columns: minmax(0, 1fr); } .doc-pair .arrow { display: none; } }

/* ---------- background run progress ---------- */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
.spinner.sm { width: 11px; height: 11px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.run-panel { margin-bottom: 16px; }
.run-panel.running { border-color: var(--brand); }
.run-panel.error { border-color: var(--red); }
.run-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.run-steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.run-step { display: grid; grid-template-columns: 20px minmax(180px, 320px) minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px; padding: 4px 0; border-top: 1px dashed var(--border); }
.run-step:first-child { border-top: 0; }
.run-step .ri { text-align: center; font-weight: 700; }
.run-step.ok .ri { color: var(--green); } .run-step.warn .ri { color: var(--amber); } .run-step.error .ri { color: var(--red); }
.run-step.error .rd { color: var(--red); }
.run-step .rd { color: var(--muted); word-break: break-word; }
@media (max-width: 760px) { .run-step { grid-template-columns: 20px minmax(0, 1fr); } .run-step .rd { grid-column: 2; } }
.run-steps[hidden] { display: none; }
tr.src-off td:not(.actions-cell) { opacity: .55; }

/* ---------- smooth page changes ---------- */
#view { position: relative; min-height: 240px; }
/* page switch: the old page stays as it is; a thin bar at the top shows that the next one is loading */
.route-loading { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; overflow: hidden;
  pointer-events: none; opacity: 0; animation: route-loading-in .1s linear .25s forwards; }
.route-loading::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; left: -35%;
  background: var(--brand-2); animation: route-loading-bar 1.1s ease-in-out infinite; }
.route-loading .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes route-loading-in { to { opacity: 1; } }
@keyframes route-loading-bar { 0% { left: -35%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .route-loading::before { animation: none; left: 0; width: 100%; opacity: .6; } }

/* Google sign-in */
.google-btn { width: 100%; justify-content: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
.login-alt > summary { cursor: pointer; list-style: revert; }
.login-alt[open] > summary { margin-bottom: 10px; }
.google-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* account menu (top right) */
/* account menu shares the row with the page title (floats right; the page header flows beside it) */
.topbar { float: right; display: flex; margin: 0 0 6px 16px; position: relative; z-index: 6; }
#wf-banner:not(:empty) { clear: right; }
.account { position: relative; }
.account-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; max-width: 360px; }
.account-btn:hover { border-color: var(--border-strong); }
.account-btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.account-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; font-weight: 550; }
.account-btn .chev { color: var(--muted); flex: none; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex: none; }
.avatar.lg { width: 38px; height: 38px; font-size: 14px; }
.account-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 320px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16,24,40,.14); padding: 14px; }
.am-head { display: flex; gap: 10px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.am-name { font-weight: 600; }
.am-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0; font-size: 12.5px; }
.am-facts dt { color: var(--muted); } .am-facts dd { margin: 0; }
.am-links { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.am-signout { width: 100%; justify-content: center; margin-top: 4px; }
.btn.danger-outline { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn.danger-outline:hover { background: var(--red-soft); }
/* keep the sidebar's bottom (account, sign out) reachable on short screens */
.sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 760px) { .topbar { margin: 0 0 8px 10px; } .account-name { max-width: 120px; } .account-menu { width: min(320px, calc(100vw - 32px)); } }
.dep-list { margin: 6px 0 10px; padding-left: 20px; max-height: 220px; overflow-y: auto; font-size: 13px; }
.confirm-msg > p:first-child { margin-top: 0; }


/* help */
.help { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.help-toc a { padding: 7px 10px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.help-toc a:hover { background: var(--gray-soft); text-decoration: none; }
.help-toc a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.help-body .panel-body { padding: 22px 26px; max-width: 860px; }
.help-body h2 { font-size: 19px; }
.help-body h3 { font-size: 14.5px; margin: 22px 0 8px; }
.help-body p, .help-body li { line-height: 1.6; }
.help-body .lead { font-size: 15px; color: var(--text); }
.help-body ul, .help-body ol { padding-left: 22px; }
.help-steps li { margin-bottom: 8px; }
.help-table { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-size: 13.5px; }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-top: 1px solid var(--border); }
.help-table th { width: 30%; font-weight: 600; white-space: nowrap; }
.help-table.decide th { width: 140px; }
.help-table td p:first-child { margin-top: 0; } .help-table td ul { margin: 4px 0; }
.help-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.help-flow span { padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 13px; }
.help-flow i { color: var(--faint); font-style: normal; }
.help-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); }
@media (max-width: 900px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; flex-direction: row; flex-wrap: wrap; } .help-table th { white-space: normal; width: 38%; } }

a.brand { color: inherit; } a.brand:hover { text-decoration: none; }

/* empty repository: choose how to start */
.setup-choice { display: block !important; }
.setup-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.setup-option { border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.setup-option .btn { align-self: flex-start; }
.so-title { font-weight: 650; }
.so-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.help-body h4 { font-size: 13.5px; margin: 16px 0 6px; color: var(--muted); }

.starter-contents { border-top: 1px solid var(--border); padding-top: 8px; }
.starter-contents > summary { cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 600; }
.starter-contents[open] > summary { margin-bottom: 8px; }
.starter-contents .table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.starter-contents table { font-size: 12.5px; }
.starter-contents td, .starter-contents th { padding: 5px 8px; }
.starter-algs { margin: 10px 0 6px; } .starter-algs .badge { margin: 2px 2px 0 0; }
.starter-contents .num { text-align: right; }
.setup-option:has(details[open]) { grid-column: 1 / -1; }

/* Assess button on a release with no rules: disabled, with a tag saying why */
.no-rules-wrap { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
#dash-release .badge { font-size: 12px; vertical-align: middle; }
#nav-release .badge { font-size: 11px; padding: 0 6px; }

/* First review: the document read next to the rules */
.reader-rules { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px 16px; max-height: 260px; overflow: auto; }
.reader-rules summary { cursor: pointer; padding: 2px 0 6px; }
.reader-rules .rr { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 6px 0; border-top: 1px dashed var(--border); }
.reader-rules .rr-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 45%; }
.reader-rules .rr-links a { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--brand-soft); text-decoration: none; }
.reader-body { max-height: 72vh; overflow: auto; padding: 4px 18px 16px; font-size: 14px; line-height: 1.65; position: relative; }
.reader-body p { margin: 0 0 10px; }
.reader-page { position: sticky; top: 0; background: var(--panel, #fff); color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 8px; z-index: 1; }
.psg.hl { background: var(--amber-soft); box-shadow: 0 0 0 2px var(--amber-soft); border-radius: 3px; }
.psg.boiler { color: var(--faint, #9aa3af); }
.psg.flash { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.reader-hit { padding: 8px 0; border-bottom: 1px dashed var(--border); }

.tabs .tab-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center; }
.tabs a.active .tab-count { background: var(--brand-soft); color: var(--brand); }
.disc-search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.disc-search input[type=search] { flex: 1 1 260px; max-width: 420px; }
.tabs a { white-space: nowrap; } .tabs { overflow-x: auto; }

.steps.stopped span:not(.done):not(.rejected) { opacity: .55; text-decoration: line-through; text-decoration-color: var(--border-strong); }
.steps span.rejected { background: var(--red-soft); color: var(--red); border-color: transparent; font-weight: 600; }

.btn.busy { pointer-events: none; opacity: .85; }
.upload-progress { margin-top: 8px; display: flex; align-items: center; gap: 6px; }

/* ---------- header row alignment: brand, page title, page actions and account menu share one 40px line ---------- */
.main { padding-top: 12px; }
.sidebar .brand { min-height: 40px; padding-top: 0; }
.page-head { align-items: flex-start; }
.page-head h1 { line-height: 1.25; padding-block: calc((40px - 1.25em) / 2); }
.page-head .actions { min-height: 40px; display: flex; align-items: center; align-self: flex-start; }
.topbar { min-height: 40px; align-items: center; }
.account-btn { height: 40px; box-sizing: border-box; }

/* Dashboard indicator when nothing is waiting: one slim line */
.review-indicator.slim .panel-body { display: flex; align-items: center; gap: 10px; padding: 7px 14px; flex-wrap: wrap; }
.review-indicator.slim .ri-dot { flex: none; margin: 0; }
.review-indicator.slim .ri-slim-text { flex: 1 1 420px; font-size: 13px; line-height: 1.45; }
.review-indicator.slim .ri-slim-text .faint { font-size: 12px; margin-left: 6px; white-space: normal; }
