/* OFC Client Portal — bank aesthetic (professional, minimal, blue) */

:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --card-2: #f8fafc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-2: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;

  --brand: #1e40af;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-border: #bfdbfe;

  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;

  --shadow-card:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 4px 12px rgba(15, 23, 42, 0.05),
    0 12px 32px rgba(15, 23, 42, 0.04);
  --shadow-card-hover:
    0 2px 6px rgba(15, 23, 42, 0.06),
    0 8px 20px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

header.top-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.top-bar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--brand); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
}
.brand-text h1 {
  margin: 0; font-size: 16px; font-weight: 700;
  color: var(--text); letter-spacing: -0.01em;
}
.brand-text p {
  margin: 0; font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.top-bar-user { display: flex; align-items: center; gap: 16px; }
.user-info { text-align: right; }
.user-info .name { font-size: 14px; font-weight: 600; color: var(--text); }
.user-info .role {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.btn-signout {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all 0.15s ease;
}
.btn-signout:hover { border-color: var(--danger); color: var(--danger); }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px;
  box-shadow: var(--shadow-card);
}
.auth-card .brand {
  justify-content: center; flex-direction: column; text-align: center;
  margin-bottom: 32px;
}
.auth-card h2 {
  margin: 0 0 8px 0; font-size: 24px; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em; text-align: center;
}
.auth-card .subtitle {
  color: var(--muted); text-align: center; margin: 0 0 28px 0;
  font-size: 15px;
}

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card-title {
  margin: 0 0 16px 0; font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand);
}

main { padding: 32px 0 60px; }
main h1 {
  margin: 0 0 4px 0; font-size: 26px; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text);
}
main .page-subtitle { color: var(--muted); margin: 0 0 32px 0; font-size: 15px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 8px;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], textarea, select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--text); background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}
input::placeholder { color: var(--muted-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: 8px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease; text-decoration: none;
}
.btn-primary {
  background: var(--brand); color: white;
  box-shadow: 0 1px 3px rgba(30, 64, 175, 0.2);
}
.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}
.btn-primary:disabled { background: var(--muted-2); cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: var(--card); color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 14px;
  margin-bottom: 16px; border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(220, 38, 38, 0.2); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(5, 150, 105, 0.2); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgba(3, 105, 161, 0.2); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(217, 119, 6, 0.2); }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.small { font-size: 13px; }

.pill {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
}
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: #f3f4f6; color: var(--muted); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 24px; }
  main h1 { font-size: 22px; }
}

.detail-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); flex-shrink: 0;
}
.detail-row .value {
  font-size: 15px; font-weight: 600; color: var(--text);
  text-align: right; word-break: break-word;
}

/* Phase tracker — mirrors the pipeline's progression, with a dark blue
   line filling in behind the steps the loan has already passed.
   Seven phases overflow a phone screen, so the row scrolls horizontally and
   the current step is scrolled into view by the renderer. */
.phase-tracker {
  display: flex; align-items: flex-start; gap: 0; margin: 16px 0 8px;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  padding-bottom: 4px;
}
.phase-tracker::-webkit-scrollbar { display: none; }
.phase-step {
  flex: 1 0 84px; display: flex; flex-direction: column;
  align-items: center; position: relative;
}
.phase-step .dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: #e5e7eb; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; z-index: 2;
  border: 3px solid var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}
/* Completed and current both use the brand dark blue, so the filled line
   reads as one continuous run of progress rather than changing colour. */
.phase-step.completed .dot { background: var(--brand); color: #fff; }
.phase-step.current .dot {
  background: var(--brand); color: #fff;
  box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.18);
}
.phase-step .label {
  margin-top: 8px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.03em; color: var(--muted); text-align: center;
  line-height: 1.3; padding: 0 2px;
}
.phase-step.current .label { color: var(--brand); font-weight: 700; }
.phase-step.completed .label { color: var(--brand); }
.phase-connector {
  position: absolute; top: 15px; left: 50%; right: -50%;
  height: 3px; background: #e5e7eb; z-index: 1;
  transition: background-color 0.2s ease;
}
/* The dark blue progress line: a completed step fills the connector running
   to the NEXT step, so the line stops at the step the loan is currently on. */
.phase-step.completed .phase-connector { background: var(--brand); }
.phase-step:last-child .phase-connector { display: none; }

.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-item {
  padding: 16px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card);
  display: flex; gap: 16px; align-items: flex-start;
  transition: border-color 0.15s ease;
}
.task-item:hover { border-color: var(--brand-border); }
.task-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px; font-weight: 700;
}
.task-icon.completed { background: var(--success-soft); color: var(--success); }
.task-icon.review { background: var(--warning-soft); color: var(--warning); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 4px 0; }
.task-description { font-size: 13px; color: var(--muted); margin: 0 0 8px 0; }
.task-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.task-actions { flex-shrink: 0; display: flex; gap: 8px; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.page-footer { padding: 24px 0; text-align: center; color: var(--muted); font-size: 12px; }

/* Task completion progress — mirrors the pipeline's per-loan progress bars.
   Sits under the phase tracker so the borrower sees both how far the LOAN has
   travelled and how far THEIR OWN outstanding items have got. */
.task-progress {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.task-progress-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px; gap: 12px;
}
.task-progress-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.task-progress-count {
  font-size: 13px; font-weight: 700; color: var(--brand);
}
.task-progress-track {
  height: 8px; border-radius: 999px;
  background: #e5e7eb; overflow: hidden;
}
.task-progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--brand);
  transition: width 0.4s ease;
}
/* Everything done — green reads as "finished" rather than "in progress". */
.task-progress.is-complete .task-progress-count { color: var(--success); }
.task-progress.is-complete .task-progress-fill { background: var(--success); }

/* Admin preview banner — a preview must never be mistaken for a live borrower
   session. Amber rather than red: this is a caution, not an error. Fixed to the
   top so it stays visible while scrolling, with body padding to match. */
.preview-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: #b45309; color: #fff;
  font-size: 13px; line-height: 1.4;
  text-align: center; padding: 10px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.preview-banner strong { font-weight: 700; letter-spacing: 0.02em; }
body.has-preview-banner { padding-top: 42px; }
@media (max-width: 600px) {
  .preview-banner { font-size: 12px; padding: 8px 12px; }
  body.has-preview-banner { padding-top: 52px; }
}

/* Brand logo. Sized by HEIGHT to match the old 42px badge, with width
   following the logo's own proportions and capped so a wide wordmark can't
   dominate the header. If the image fails to load, the "OFC" badge reappears. */
.brand-logo-img {
  height: 95px; width: auto; max-width: 450px;   /* 2.25x the original 42px / 200px */
  object-fit: contain; display: block;
}
/* On a phone the header is narrow, so cap the width to the screen rather than
   a fixed size — the height stays 50% larger, but a wide logo can't push the
   name and sign-out button off the edge. */
@media (max-width: 600px) {
  .brand-logo-img { max-width: 55vw; }
}

/* ---- Task card: description, controls, documents ------------------------ */
.task-desc {
  margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--muted);
  white-space: pre-line;
}
.task-primary { margin-top: 10px; }
.task-controls { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.upload-limits { margin-top: 6px; font-size: 11px; color: var(--muted-2, var(--muted)); }
.task-docs { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.task-doc-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }
.badge-unread {
  display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
}

/* ---- Message thread ------------------------------------------------------ */
.task-thread {
  margin-top: 12px; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--brand-soft, #f8fafc);
}
.task-thread[hidden] { display: none; }
.thread-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.thread-msg { padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.thread-borrower { border-left: 3px solid var(--brand); }
.thread-team { border-left: 3px solid var(--success, #15803d); }
.thread-system { background: transparent; border-style: dashed; font-style: italic; }
.thread-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.thread-body { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.thread-input {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--border-strong, var(--border)); border-radius: 8px; resize: vertical;
}
.thread-send { margin-top: 8px; display: flex; justify-content: flex-end; }

/* ---- Blank form + documents shared by the loan team ---------------------- */
.task-form { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.task-shared { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.shared-doc {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  padding: 6px 8px; margin: 2px 0; background: none; border: 1px solid transparent;
  border-radius: 6px; font: inherit; font-size: 13px; color: var(--brand); cursor: pointer;
}
.shared-doc:hover { border-color: var(--border); background: var(--brand-soft, #f8fafc); }
.shared-doc:disabled { opacity: 0.6; cursor: wait; }

/* ---- Reopening your uploads + acknowledging receipt ---------------------- */
.doc-link {
  background: none; border: none; padding: 0; font: inherit; font-size: 13px;
  color: var(--brand); cursor: pointer; text-align: left;
}
.doc-link:hover { text-decoration: underline; }
.doc-link:disabled { opacity: 0.6; cursor: wait; }
.doc-note {
  margin: 2px 0 8px; padding: 6px 10px; font-size: 12px; line-height: 1.45;
  border-left: 3px solid var(--warning, #d97706); background: #fffbeb; border-radius: 4px;
}
.shared-item { margin: 2px 0 6px; }
.ack-needed {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 0 8px; padding: 8px 10px; border: 1px solid var(--warning, #d97706);
  border-radius: 8px; background: #fffbeb;
}
.ack-done { margin: 2px 0 0 8px; font-size: 12px; color: var(--success, #15803d); font-weight: 600; }

/* ---- Loan team card ------------------------------------------------------ */
.team-member { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.team-member-sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.team-avatar {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.team-avatar-sm { width: 38px; height: 38px; font-size: 14px; }
.team-name { font-size: 15px; font-weight: 600; color: var(--text); }

/* ---- Action Items strip: replaces the task list on the dashboard --------- */
.action-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 24px; padding: 14px 20px;
  background: var(--card, #fff); border: 1px solid var(--border);
  border-left: 4px solid var(--brand); border-radius: 12px;
  text-decoration: none; color: var(--text); transition: box-shadow 0.15s ease;
}
.action-strip:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.action-strip-label { font-weight: 700; font-size: 15px; }
.action-strip-link { font-weight: 600; font-size: 14px; color: var(--brand); }

/* ---- Loan Details wider than the team card; stacked on narrow screens ---- */
.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---- Loan Details grouped into sections, two columns when there's room --- */
.details-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; }
@media (max-width: 1100px) { .details-sections { grid-template-columns: 1fr; } }
.details-section { margin-bottom: 14px; }
.details-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brand); padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
}
.details-section .detail-row .value { text-align: right; word-break: break-word; }

/* ---- Loan Details full width, team contact sheet below ------------------- */
.dash-stack { display: flex; flex-direction: column; gap: 24px; }
/* With the full width, sections sit three across on a computer. */
.details-sections { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .details-sections { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .details-sections { grid-template-columns: 1fr; } }
/* Team: one block per person, side by side. */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 28px; }
.team-person { padding-top: 4px; }
.team-person .team-member { margin: 0 0 8px; }

/* ---- Loan Details: data first (Oct 8, 2026 — client feedback) -----------
   Labels stay word-for-word but step back; filled-in values sit on a soft
   blue chip so the eye lands on the data; blank values ("—") fade out.
   Scoped to .details-section so the loan-team contact rows are unchanged. */
.details-section-title { border-bottom: 2px solid var(--brand-border); }
.details-section .detail-row {
  align-items: center; padding: 9px 6px; border-radius: 6px;
  transition: background 0.12s ease;
}
.details-section .detail-row:hover { background: var(--card-2); }
.details-section .detail-row .label {
  font-size: 11px; font-weight: 500; color: var(--muted);
}
.details-section .detail-row .value {
  font-size: 15px; font-weight: 700; color: #0b1f4d;
  background: var(--brand-soft); border: 1px solid var(--brand-border);
  padding: 3px 10px; border-radius: 6px; line-height: 1.4;
}
.details-section .detail-row .value.is-empty {
  background: none; border-color: transparent;
  font-weight: 400; color: var(--muted-2);
}
