/* Additions for the working dev portal, on top of the prototype's styles.css. */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 30px 28px; box-shadow: var(--float-shadow); display: grid; gap: 18px; }
.login-card .brand { pointer-events: none; }
.login-card .err { color: var(--lv-red); font-size: var(--fs-sm); }
body.signed-out .app { display: none; }

.dev-badge { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 7px; margin-left: auto; }
.nav a .dev-badge { margin-left: auto; }

.thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--line); flex: none; }
.thumb.lg { width: 64px; height: 64px; border-radius: 14px; }
.recent-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recent-row:last-child { border-bottom: 0; }
.recent-row .t { font-weight: 600; font-size: var(--fs-sm); }
.recent-row .s { color: var(--fg-3); font-size: var(--fs-xs); }
.recent-row .r { margin-left: auto; text-align: right; }

.source-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.source-tabs label { border: 1.5px solid var(--line-2); border-radius: 16px; padding: 14px 16px; cursor: pointer; display: grid; gap: 4px; background: var(--panel); }
.source-tabs label.on { border-color: var(--accent); background: var(--accent-soft); }
.source-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.source-tabs .n { font-weight: 600; }
.source-tabs .s { color: var(--fg-3); font-size: var(--fs-xs); }

.cond-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.cond-check label { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); padding: 4px 0; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.upload-progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.upload-progress i { display: block; height: 100%; background: var(--accent); transition: width 0.2s; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: sp 0.8s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
.try-photo { width: 100%; max-width: 280px; aspect-ratio: 1; object-fit: cover; border-radius: 18px; border: 1px solid var(--line); }
.match { font-weight: 600; }
.match.same { color: var(--lv-green); }
.match.diff { color: var(--lv-orange); }
.model-pick .n svg, .chip svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
table.data tr.is-sel td { background: var(--accent-soft); }
.hbar.big { height: 12px; }
table.data tr.is-late td { background: color-mix(in srgb, var(--lv-red) 7%, transparent); }
.hosp-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--panel); }
.hosp-card.is-off { opacity: 0.5; }
.live-strip .slot-select { min-width: 170px; }

/* Test as patient */
.test-frame-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 6px; }
.test-frame-label { font-size: var(--fs-sm); color: var(--ink-2, inherit); display: flex; gap: 8px; align-items: center; }
.test-frame { width: 400px; max-width: 100%; height: min(820px, 78vh); border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 28px; background: #fff; box-shadow: 0 20px 50px rgba(28,35,64,.14); }

/* ---------- Pipeline tree (dashboard and Models page) ---------- */
.pipe-tree, .pipe-tree-kids { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pipe-tree-kids { margin: 8px 0 0 14px; padding-left: 16px; border-left: 1.5px dashed var(--line-2); }
.pipe-tree-kids > .pipe-tree-item { position: relative; }
.pipe-tree-kids > .pipe-tree-item::before { content: ""; position: absolute; left: -16px; top: 22px; width: 13px; border-top: 1.5px dashed var(--line-2); }

/* Models page: the editor */
.pipeline.editor { align-items: flex-start; }
.pipeline.editor .pipe-col { justify-content: flex-start; padding-top: 2px; }
.pipeline.editor .pipe-link { align-self: center; }
.pipeline.editor .pipe-col.screener { flex: 0 1 240px; max-width: 260px; min-width: 200px; }
.pipeline.editor .pipe-col.models { min-width: 280px; }
.pipe-node.spec { justify-content: flex-start; align-items: flex-start; gap: 8px; padding: 10px 12px; position: relative; }
.pipe-node.spec[draggable="true"] { cursor: grab; }
.pipe-node.spec[draggable="true"]:hover { border-color: var(--line-2); }
.pipe-node.spec .grip { flex: none; color: var(--fg-3); display: grid; place-items: center; padding-top: 1px; }
.pipe-node.spec .grip svg { width: 16px; height: 16px; stroke-width: 3; }
.spec-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.spec-body a.n { color: var(--fg); }
.spec-body a.n:hover { color: var(--accent); }
.spec-body .sh { color: var(--fg-2); }
.spec-body .slot-select { margin-top: 4px; max-width: none; }
.pipe-node.spec.off { opacity: 1; border-style: dashed; }
.pipe-node.spec.off .spec-body > a.n, .pipe-node.spec.off .spec-body > .sh { opacity: 0.6; }
.warn-text { color: var(--lv-orange); }
.pipe-node.spec .drop-hint { display: none; }
.pipe-node.spec.is-dragging { opacity: 0.35; }
.pipe-gap { height: 0; margin: -4px 0; position: relative; z-index: 1; transition: height 0.12s, margin 0.12s; }
.pipe-gap span { display: none; }
body.spec-dragging .pipe-gap { height: 26px; margin: 0; border: 1.5px dashed var(--line-2); border-radius: 10px; display: grid; place-items: center; }
body.spec-dragging .pipe-gap span { display: block; font-size: var(--fs-xs); color: var(--fg-3); pointer-events: none; }
body.spec-dragging .pipe-gap.drop-on { border-color: var(--accent); background: var(--accent-soft); }
body.spec-dragging .pipe-gap.drop-on span { color: var(--accent); font-weight: 600; }
body.spec-dragging .pipe-node.spec[data-onto].drop-on { border-color: var(--accent); background: var(--accent-soft); }
body.spec-dragging .pipe-node.spec[data-onto].drop-on .drop-hint { display: block; position: absolute; right: 10px; top: -9px; font-size: 0.6875rem; font-weight: 600; color: var(--on-accent); background: var(--accent); padding: 1px 8px; border-radius: 999px; }
body.spec-dragging .pipe-node.spec * { pointer-events: none; }

/* Sidebar: open the patient app */
.patient-app-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: -6px 4px 8px;
  padding: 9px 12px; border-radius: 12px; font-size: var(--fs-sm); font-weight: 600;
  color: var(--accent); background: var(--accent-soft); border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.patient-app-btn svg { width: 17px; height: 17px; flex: none; }
.patient-app-btn:hover { background: var(--accent-softer); border-color: var(--accent); }
.patient-app-btn.active { background: var(--accent); color: var(--on-accent); }

/* Version page: three stages */
.stage-track.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stage-track.three::before { left: 16.67%; right: 16.67%; }
.stage-track.three .fill { left: 16.67%; }
