/* ============================================================
   Sabea MyFinancials — Portal Styles
   Refined editorial aesthetic. Navy + gold + cream.
   ============================================================ */

:root {
  --navy: #12153D;
  --navy-80: #1a1d4c;
  --navy-60: #3a3d6b;
  --navy-40: #6e709a;
  --navy-20: #c2c3d2;
  --gold: #C9A84C;
  --gold-dark: #a88a35;
  --gold-light: #e8d79a;
  --cream: #F8F4EC;
  --cream-warm: #F1EBDD;
  --paper: #FFFFFF;
  --ink: #1a1a1f;
  --ink-60: #5a5a66;
  --ink-40: #9a9aa6;
  --line: #e5e0d4;
  --line-soft: #efeadd;
  --error: #b5362e;
  --success: #2d6a4f;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(18, 21, 61, 0.06);
  --shadow-md: 0 4px 16px rgba(18, 21, 61, 0.08);
  --shadow-lg: 0 12px 40px rgba(18, 21, 61, 0.12);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--gold-dark); }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-nav { display: flex; align-items: center; gap: 20px; }
.user-greeting { font-size: 14px; color: var(--ink-60); }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-lg .brand-mark { width: 56px; height: 56px; font-size: 28px; }
.brand-lg .brand-name { font-size: 28px; }
.brand-lg .brand-sub { font-size: 14px; }
.brand-mark {
  width: 38px; height: 38px;
  background: var(--navy);
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  letter-spacing: -0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-dark);
  font-weight: 500;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary, .btn-ghost, .btn-secondary {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 14px 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--navy);
  color: var(--cream);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-80);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-primary::after {
  content: '';
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--gold);
  border-top: 1.5px solid var(--gold);
  transform: rotate(45deg);
  margin-left: 6px;
  transition: transform 0.2s;
}
.btn-primary:hover:not(:disabled)::after { transform: rotate(45deg) translateX(2px) translateY(-2px); }
.btn-primary.btn-block { width: 100%; }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  padding: 8px 16px;
  font-size: 14px;
}
.btn-ghost:hover { background: var(--cream-warm); }

.btn-secondary {
  background: var(--paper);
  color: var(--navy);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--navy); }

/* ============================================================
   FORMS
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-60);
  letter-spacing: 0.01em;
}
.input {
  font-family: var(--font-body);
  font-size: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(18, 21, 61, 0.08);
}
.input-signature {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
}

/* ============================================================
   SCREEN BASE
   ============================================================ */
.screen { flex: 1; display: block; }
.container, .container-narrow {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 32px 80px;
}
.container-narrow { max-width: 720px; }

.screen-intro { margin-bottom: 32px; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold-dark);
  margin-bottom: 12px;
}
.screen-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  line-height: 1.1;
}
.screen-lede {
  font-size: 17px;
  color: var(--ink-60);
  max-width: 620px;
  margin: 0;
  line-height: 1.6;
}
.screen-lede em { color: var(--navy); font-style: italic; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  background: var(--navy);
  color: var(--cream);
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-hero::before {
  content: '';
  position: absolute;
  top: -20%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-hero::after {
  content: '';
  position: absolute;
  bottom: 40px; left: 64px;
  width: 64px; height: 2px;
  background: var(--gold);
}
.login-hero .brand-name { color: var(--cream); }
.login-hero .brand-sub { color: var(--gold); }
.login-hero .brand-mark { background: var(--cream); color: var(--navy); }
.hero-inner { max-width: 480px; position: relative; z-index: 1; }
.hero-headline {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 500;
  line-height: 1.05;
  margin: 56px 0 24px;
  letter-spacing: -0.025em;
}
.hero-blurb {
  font-size: 17px;
  color: rgba(248, 244, 236, 0.75);
  margin: 0 0 40px;
  line-height: 1.6;
}
.hero-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hero-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(248, 244, 236, 0.85);
}
.dot {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
}

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px;
  background: var(--cream);
}
.login-card {
  width: 100%;
  max-width: 420px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  color: var(--navy);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.card-sub {
  font-size: 15px;
  color: var(--ink-60);
  margin: 0 0 32px;
  line-height: 1.55;
}
.login-status {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
.login-status.success {
  background: #e8f2ec;
  color: var(--success);
  border: 1px solid #b5d9c2;
}
.login-status.error {
  background: #fbeceb;
  color: var(--error);
  border: 1px solid #e6bdba;
}
.fine-print {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-40);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-hero { padding: 40px 28px; min-height: 40vh; }
  .hero-headline { font-size: 36px; margin-top: 32px; }
  .login-form-wrap { padding: 48px 24px; }
}

/* ============================================================
   CONSENT SCREEN
   ============================================================ */
.consent-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.doc-block {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
.doc-block:first-child { padding-top: 0; }
.doc-icon {
  font-size: 28px;
  width: 48px; height: 48px;
  background: var(--cream-warm);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
}
.doc-body { min-width: 0; }
.doc-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.doc-meta {
  font-size: 13px;
  color: var(--ink-40);
  margin-bottom: 10px;
}
.doc-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.doc-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
}
.doc-link:hover { color: var(--gold-dark); }
.doc-note {
  font-size: 13px;
  color: var(--ink-40);
  font-style: italic;
}
.doc-check { min-width: 240px; }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}
.checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.checkbox-mark {
  width: 22px; height: 22px;
  border: 1.5px solid var(--navy-40);
  border-radius: 5px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
  background: var(--paper);
}
.checkbox input:checked + .checkbox-mark {
  background: var(--navy);
  border-color: var(--navy);
}
.checkbox input:checked + .checkbox-mark::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 11px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
}
.checkbox-label { padding-top: 1px; }

.signature-block {
  margin-top: 24px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
}
.sig-meta {
  display: flex;
  gap: 40px;
  margin-top: 16px;
  padding: 16px;
  background: var(--cream-warm);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.sig-meta-label {
  display: block;
  font-size: 11px;
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

#consentSubmit { margin-top: 32px; }

.consent-status {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
.consent-status.error {
  background: #fbeceb;
  color: var(--error);
  border: 1px solid #e6bdba;
}

@media (max-width: 720px) {
  .consent-card { padding: 28px 20px; }
  .doc-block {
    grid-template-columns: 40px 1fr;
  }
  .doc-check { grid-column: 1 / -1; margin-top: 8px; }
  .doc-icon { width: 40px; height: 40px; font-size: 20px; }
  .screen-title { font-size: 32px; }
}

/* ============================================================
   HUB SCREEN
   ============================================================ */
.hub-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: 48px;
}

.progress-ring {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.progress-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.progress-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 5;
}
.progress-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 326.7; /* 2πr where r=52 */
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.6s ease;
}
.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.progress-pct {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--navy);
  font-weight: 600;
  line-height: 1;
}
.progress-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-40);
  margin-top: 4px;
}

.stages {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stage {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  gap: 20px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
  cursor: pointer;
  position: relative;
}
.stage:last-child { border-bottom: none; }
.stage:hover { background: var(--cream-warm); }

.stage-number {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-40);
  background: var(--paper);
  transition: all 0.2s;
}
.stage.complete .stage-number {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--navy);
}
.stage.complete .stage-number::before {
  content: '✓';
  font-size: 18px;
  font-family: var(--font-body);
  color: var(--gold);
}
.stage.complete .stage-number-text { display: none; }

.stage-body { min-width: 0; }
.stage-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
  letter-spacing: -0.005em;
}
.stage-desc {
  font-size: 14px;
  color: var(--ink-60);
  margin: 0;
}

.stage-status {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-40);
  font-weight: 500;
}
.stage.complete .stage-status {
  color: var(--gold-dark);
}
.stage.current .stage-status {
  color: var(--navy);
  font-weight: 600;
}

.stage-chevron {
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--navy-40);
  border-top: 1.5px solid var(--navy-40);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.stage:hover .stage-chevron {
  border-color: var(--navy);
  transform: rotate(45deg) translateX(2px) translateY(-2px);
}

.submit-panel {
  margin-top: 40px;
  padding: 32px 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-80) 100%);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  overflow: hidden;
}
.submit-panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.submit-copy h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 6px;
  font-weight: 500;
}
.submit-copy p {
  font-size: 14px;
  color: rgba(248, 244, 236, 0.75);
  margin: 0;
  max-width: 480px;
}
#submitForReviewBtn {
  background: var(--gold);
  color: var(--navy);
  flex-shrink: 0;
  font-weight: 600;
}
#submitForReviewBtn:hover:not(:disabled) {
  background: var(--gold-light);
}
#submitForReviewBtn::after {
  border-color: var(--navy);
}

@media (max-width: 720px) {
  .hub-head { flex-direction: column-reverse; align-items: center; text-align: center; }
  .hub-head .screen-title { font-size: 32px; }
  .stage { grid-template-columns: 40px 1fr auto; padding: 18px 20px; }
  .stage-chevron { display: none; }
  .submit-panel { flex-direction: column; align-items: stretch; text-align: center; padding: 24px; }
}

/* ============================================================
   MODAL (stage placeholder)
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 21, 61, 0.5);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 48px 40px 40px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--ink-40);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
}
.modal-close:hover { background: var(--cream-warm); color: var(--navy); }
.modal-body h2 {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--navy);
  margin: 0 0 12px;
  font-weight: 500;
}
.modal-body p {
  font-size: 15px;
  color: var(--ink-60);
  margin: 0;
  line-height: 1.6;
}

/* ============================================================
   UTILITY
   ============================================================ */
[hidden] { display: none !important; }
