/* Patient files and Appointment files: the lists, Upload and the review. */

/* Lists */
.intake-files { min-width: 820px; font-size: var(--text-base); }
.intake-files th, .intake-files td { padding-inline: 7px; }
.intake-files td { padding-block: 14px; }
.intake-files th:first-child, .intake-files td:first-child { padding-left: 18px; }
.intake-files th:last-child, .intake-files td:last-child { padding-right: 18px; }
/* The design's 1.8fr 1fr 1fr 70px 1.8fr grid. */
.intake-col-file, .intake-col-status { width: 30.1%; }
.intake-col-when, .intake-col-by { width: 16.7%; }
.intake-col-rows { width: 84px; }
.intake-file-name { display: block; color: var(--text-primary); font-weight: 500; }
.intake-file-name:hover { color: var(--accent); }
.intake-file-raw { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
.intake-quiet { color: var(--text-secondary); }
.intake-status { display: flex; align-items: center; gap: 10px; font-size: var(--text-meta); }
.intake-status-label { font-weight: 500; color: var(--text-body); }
.intake-status-review { color: var(--caution-fg); }
.intake-status-verified { color: oklch(0.45 0.1 155); }
.intake-status-failed { color: var(--danger-fg); }
.intake-status-pending { color: var(--text-muted); }
.intake-status-detail { margin-top: 2px; color: var(--text-tertiary); line-height: 1.4; }

/* Upload */
.intake-upload-body { display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.intake-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); color: var(--text-muted); }
.intake-steps li + li::before { content: "→" / ""; margin-right: 6px; }
.intake-steps [aria-current] { color: var(--text-primary); font-weight: 600; }
.intake-upload-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: var(--tracking-tight); }
.intake-upload-form { margin: 0; }
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 220px;
  border: 1.5px dashed var(--border-disabled);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  cursor: pointer;
}
.dropzone[hidden] { display: none; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); }
.dropzone:focus-within { box-shadow: 0 0 0 3px oklch(0.92 0.04 195); }
.dropzone-title { font-size: 15px; font-weight: 500; }
.dropzone-or { font-size: var(--text-base); color: var(--text-muted); }
/* The real file input covers the zone, so a click or a dropped file lands on it. */
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-checking { gap: 12px; border: 1px solid var(--border-card); cursor: default; }
.dropzone-file { font-size: var(--text-base); color: var(--text-secondary); }
.dropzone-bar { position: relative; width: 200px; height: 4px; border-radius: 2px; background: var(--border-card); overflow: hidden; }
.dropzone-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: 2px; background: var(--accent); animation: dropzone-bar 1.4s ease-in-out infinite; }
@keyframes dropzone-bar { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .dropzone-bar::after { left: 0; width: 65%; animation: none; } }
.intake-note { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-tile); background: var(--bg-muted); font-size: var(--text-base); line-height: 1.5; color: var(--text-body); }
.intake-note-lead { flex: none; font-weight: 600; }
.intake-upload-body > .muted { margin: 0; line-height: 1.5; }

/* Review: the header, then the four steps */
.intake-meta { font-size: var(--text-sm); color: var(--text-muted); }
.intake-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.intake-file-status { font-size: var(--text-meta); }
.intake-review > #flash:not(:has(*)) { display: none; }
.intake-review p.muted, .intake-review p.banner { margin: 0; }
.intake-review-body { gap: 18px; }
.intake-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); color: var(--text-muted); }
.intake-progress li { display: flex; flex-direction: column; gap: 6px; }
.intake-progress-bar { display: block; height: 3px; border-radius: 2px; background: var(--border-input); overflow: hidden; }
.intake-progress-bar > span { display: block; height: 100%; background: var(--text-primary); }
.intake-progress-done { color: var(--text-secondary); }
.intake-progress-done .intake-progress-bar { background: var(--text-primary); }
.intake-progress-current { color: var(--text-primary); font-weight: 600; }

/* Rows: every template column, scrolling sideways, with the actions kept in view on the right. */
.intake-rows .table { font-size: var(--text-base); }
.intake-rows .table th { padding: 10px 8px; }
.intake-rows .table td { padding: 10px 8px 4px; border-bottom: 0; vertical-align: middle; white-space: nowrap; }
.intake-rows .table th:first-child, .intake-rows .table td:first-child { padding-left: 16px; width: 40px; }
.row-number { font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); }
.cell-value { display: inline-block; max-width: 220px; padding: 4px 6px; margin: 0 -6px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.cell-value:empty { display: none; }
.cell-problem .cell-value { background: oklch(0.965 0.025 27); color: var(--danger-fg); }
.cell-problem:has(.cell-value:empty)::after { content: "missing" / ""; padding: 4px 6px; border-radius: 5px; background: oklch(0.965 0.025 27); color: var(--danger-fg); font-size: var(--text-sm); }
.intake-rows .table .row-actions-cell {
  position: sticky;
  right: 0;
  width: 1%;
  padding-right: 16px;
  background: var(--bg-surface);
  box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.15);
  text-align: right;
}
.intake-rows .table th.row-actions-cell { background: var(--bg-subtle); }
.intake-row { background: var(--bg-surface); }
.intake-row + .intake-row tr:first-child td { border-top: 1px solid var(--border-row); }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.row-actions form { margin: 0; }
.btn-text-danger { background: transparent; color: var(--danger-fg); }
.btn-text-danger:hover { color: var(--danger-fg); background: var(--danger-bg); }

/* The line under each row: what's wrong, or what verifying it does. */
.row-note td { padding-top: 0; padding-bottom: 10px; white-space: normal; }
.row-note-text { position: sticky; left: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: min(900px, calc(100vw - 160px)); font-size: var(--text-meta); line-height: 1.4; }
.row-note-error { color: var(--danger-fg); }
.row-note-warning, .row-note-text .same-as { color: var(--caution-fg); }
.row-note-ready .row-outcome::before, .row-note-verified .row-outcome::before { content: "✓ " / ""; }
.row-note-warning .same-as + .row-outcome::before { content: "· " / ""; }
.row-note-ready { color: oklch(0.45 0.1 155); }
.row-note-verified { color: var(--text-tertiary); }
.problems { display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 0; padding: 0; list-style: none; }
.problems li + li::before { content: "·" / ""; margin-right: 6px; }

/* Editing a row in place */
.editing-row, .intake-rows .table .editing-row .row-actions-cell { background: var(--bg-subtle); }
.cell-input {
  width: 100%;
  min-width: 7rem;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-control-sm);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-input);
  font-size: var(--text-base);
}
select.cell-input { min-width: 17rem; padding: 0 6px; }
.cell-input:focus { outline: none; box-shadow: var(--focus-ring); }
.cell-problem .cell-input { box-shadow: inset 0 0 0 1.5px var(--status-failed); }
.just-saved tr td { animation: just-saved 2.5s ease-out; }
@keyframes just-saved { from { background: oklch(0.97 0.05 95); } to { background: transparent; } }

/* Ready and verified rows fold away under a line. */
.intake-group > summary { margin-bottom: 12px; font-size: var(--text-base); font-weight: 500; color: var(--text-secondary); cursor: pointer; }

/* Verify stays in view at the bottom while the rows scroll. */
.verify-file {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -36px -48px;
  padding: 14px 36px;
  border-top: 1px solid var(--border-card);
  background: var(--bg-surface);
}
.verify-file-note { margin: 0; font-size: var(--text-base); color: var(--text-secondary); }
.verify-file-note b { color: var(--text-primary); font-weight: 600; }
@media (max-width: 48rem) {
  .verify-file { margin: 0 -16px -40px; padding: 12px 16px; }
  .row-note-text { max-width: calc(100vw - 110px); }
}
