/* Assessment shell and screen layout. Mobile first. */

body { background: var(--white); }

/* ---- Sticky top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--midnight); color: var(--white);
}
.topbar-inner {
  display: flex; align-items: center; gap: var(--s4);
  min-height: 3.5rem; padding-block: var(--s2);
}
.topbar-title { font-weight: 700; font-size: 0.95rem; color: var(--white); white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.account-chip {
  display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer;
  background: rgba(255,255,255,0.1); color: var(--white); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px; padding: 0.2rem 0.6rem 0.2rem 0.25rem; font-size: 0.85rem; white-space: nowrap;
}
.account-chip:hover { background: rgba(255,255,255,0.18); }
.account-avatar { width: 1.6rem; height: 1.6rem; border-radius: 999px; object-fit: cover; flex: none; }
.account-avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cobalt); color: var(--white); font-weight: 700; font-size: 0.8rem;
}
.account-name { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; }
.account-caret { font-size: 0.85rem; line-height: 1; opacity: 0.8; }
@media (max-width: 640px) { .account-name { display: none; } }

/* ---- Module indicator (four segments) ---- */
.module-indicator { display: none; gap: var(--s2); flex: 1; }
.module-seg {
  display: flex; align-items: center; gap: var(--s2);
  padding: 0.2rem 0.5rem; border-radius: 999px;
  font-size: 0.78rem; color: rgba(245, 241, 232, 0.7);
  border: 1px solid transparent;
}
.module-seg .seg-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; border-radius: 999px; flex: none;
  background: rgba(255,255,255,0.15); color: var(--white); font-weight: 700;
}
.module-seg.is-active { color: var(--white); }
.module-seg.is-active .seg-num { background: var(--cobalt); }
.module-seg.is-done .seg-num { background: var(--ok-rule); }
.module-seg.is-current { border-color: rgba(255,255,255,0.4); }
.module-seg.is-clickable { cursor: pointer; }
.module-seg.is-clickable:hover { color: var(--white); border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.08); }
.module-seg.is-clickable:focus-visible { outline: 2px solid var(--white); outline-offset: 1px; }

/* ---- Thin progress bar ---- */
.progressbar { height: 4px; background: var(--line); position: sticky; top: 3.5rem; z-index: 19; }
.progressbar-fill { height: 100%; width: 0; background: var(--cobalt); transition: width 0.2s ease; }

/* ---- Screen ---- */
.screen-wrap { padding-block: var(--s6); min-height: 60vh; }
.screen-inner { }
.screen-inner h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
.screen-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

/* Module cards on the welcome screen reuse .module-grid / .module-card from sales.css,
   but sales.css is not loaded here, so restate the essentials. */
.module-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; margin-block: var(--s5); }
/* Welcome intro and footer sit narrow and centered; the card row spans the wider container. */
.welcome-narrow { max-width: var(--maxw-narrow); margin-inline: auto; }
.module-card .card-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 999px;
  background: var(--midnight); color: var(--white); font-weight: 700; margin-bottom: var(--s3);
}
.module-card .card-meta { color: var(--muted); font-weight: 600; font-size: 0.9rem; margin-bottom: var(--s3); }
.module-card-title { font-size: 1.2rem; margin-bottom: var(--s2); }

/* ---- Resume progress list ---- */
.progress-list { list-style: none; padding: 0; margin: var(--s4) 0; display: grid; gap: var(--s2); }
.progress-chip {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--soft); font-weight: 500;
}
.progress-chip .chip-state { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.progress-chip.is-active .chip-state { color: var(--cobalt); }
.progress-chip.is-done .chip-state { color: var(--ok-text); }
.btn.is-armed { border-color: var(--bad-rule); color: var(--bad-text); }

/* ---- Question screens ---- */
.step-eyebrow {
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem;
  font-weight: 700; color: var(--muted); margin-bottom: var(--s3);
}
.radio-card-group { margin-bottom: var(--s5); }
.seats-detail { margin: 0 0 var(--s5); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--soft); }
.seats-detail summary { cursor: pointer; padding: var(--s3) var(--s4); font-weight: 600; }
.seats-list { columns: 2; column-gap: var(--s5); margin: 0; padding: 0 var(--s4) var(--s4) 2rem; }
.seats-list li { break-inside: avoid; }

/* ---- Nav footer ---- */
.screen-nav { margin-top: var(--s6); }
.screen-nav-buttons { display: flex; flex-wrap: wrap; gap: var(--s3); }
.screen-nav .btn[aria-disabled="true"] { opacity: 0.5; }
.screen-nav .field-error { margin-top: var(--s3); }

/* ---- Audit result ---- */
.result-score { font-size: 1.1rem; color: var(--muted); margin-bottom: var(--s3); }
.result-score strong { color: var(--midnight); font-size: 1.25rem; }
.score-bar { position: relative; margin: var(--s5) 0 var(--s6); padding-top: var(--s5); }
.score-bands { display: flex; gap: 3px; height: 2.9rem; border-radius: var(--radius-sm); overflow: hidden; }
.band { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0 2px; text-align: center; }
.band-1 { background: #E8ECF3; }
.band-2 { background: #CBD6EC; }
.band-3 { background: #A9BEEC; }
.band-label { font-size: 0.72rem; font-weight: 700; color: var(--midnight); opacity: 0.8; line-height: 1; }
.band-sub { font-size: 0.6rem; font-weight: 600; color: var(--midnight); opacity: 0.6; line-height: 1; }
.score-dot {
  position: absolute; top: calc(var(--s5) - 6px); width: 1.1rem; height: 1.1rem; margin-left: -0.55rem;
  background: var(--cobalt); border: 3px solid var(--white); border-radius: 999px;
  box-shadow: var(--shadow); transition: left 0.2s ease;
}

/* ---- Researching interstitial ---- */
.research-status { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0 var(--s4); }
.research-status p { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--midnight); }
.spinner {
  flex: none; width: 1.5rem; height: 1.5rem; border-radius: 999px;
  border: 3px solid var(--line); border-top-color: var(--cobalt);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.research-steps { list-style: none; padding: 0; margin: 0 0 var(--s4); display: grid; gap: var(--s2); }
.research-steps li {
  position: relative; padding-left: 1.5rem; font-size: 0.92rem; color: var(--muted);
  animation: pulseFade 1.4s ease-in-out infinite;
}
.research-steps li::before {
  content: ''; position: absolute; left: 0; top: 0.35rem; width: 0.6rem; height: 0.6rem;
  border-radius: 999px; background: var(--cobalt); opacity: 0.55;
}
.research-steps li:nth-child(2) { animation-delay: 0.2s; }
.research-steps li:nth-child(3) { animation-delay: 0.4s; }
.research-steps li:nth-child(4) { animation-delay: 0.6s; }
.research-steps li:nth-child(5) { animation-delay: 0.8s; }
@keyframes pulseFade { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .research-steps li { animation: none; opacity: 0.85; } }

/* ---- Moves checklist ---- */
.moves-heading { font-size: 1.2rem; margin-top: var(--s6); }
.moves-list { list-style: none; padding: 0; margin: 0 0 var(--s5); display: grid; gap: var(--s2); }
.move-row {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
}
.move-row input { margin-top: 0.25rem; width: 1.15rem; height: 1.15rem; accent-color: var(--cobalt); flex: none; }
.move-row label { font-weight: 500; }
.move-row:has(input:checked) { background: var(--soft); }
.move-row:has(input:checked) label { color: var(--muted); text-decoration: line-through; }

/* ---- Buy box forms ---- */
.field-row { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
.checkbox-group { border: 0; padding: 0; margin: 0 0 var(--s4); }
.checkbox-group .field-label { margin-bottom: var(--s2); }
.disq-list { display: grid; gap: var(--s2); margin-bottom: var(--s5); }
.disq-list .checkbox-row, .checkbox-group .checkbox-row {
  padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); margin: 0;
}
.disq-list .checkbox-row:has(input:checked) { background: var(--amber-bg); border-color: var(--amber-rule); }

/* ---- Buy box summary ---- */
.paragraph-card { border: 2px solid var(--line); border-radius: var(--radius); padding: var(--s2); background: var(--soft); margin-bottom: var(--s3); }
.paragraph-area { border: 0; background: transparent; font-size: 1.05rem; line-height: 1.7; min-height: 9rem; }
.paragraph-area:focus { box-shadow: none; }

.recap-list { list-style: none; padding: 0; margin: var(--s4) 0 var(--s6); display: grid; gap: var(--s2); }
.recap-list li {
  display: grid; gap: var(--s1); padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--soft); margin: 0;
}
.recap-key { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cobalt); }
.recap-val { color: var(--midnight); }

.tune-detail { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: var(--s4); background: var(--white); }
.tune-detail > summary { cursor: pointer; padding: var(--s3) var(--s4); font-weight: 600; }
.tune-body { padding: 0 var(--s4) var(--s4); }
.tune-body h3 { font-size: 1rem; margin: var(--s4) 0 var(--s3); }

/* ---- Market module ---- */
.source-hint { margin-block: var(--s4); }
.source-hint p { margin: 0; font-size: 0.92rem; }
.source-steps { margin: var(--s3) 0 0; padding-left: 1.2rem; font-size: 0.92rem; display: grid; gap: var(--s2); }
.weak-list, .strong-list { list-style: none; padding: 0; margin: 0 0 var(--s5); display: grid; gap: var(--s2); }
.weak-list li {
  padding: var(--s3) var(--s4); border-left: 4px solid var(--amber-rule);
  background: var(--amber-bg); color: var(--amber-text); border-radius: var(--radius-sm); font-weight: 600;
}
.strong-list li {
  padding: var(--s3) var(--s4); border-left: 4px solid var(--ok-rule);
  background: var(--ok-bg); color: var(--ok-text); border-radius: var(--radius-sm); font-weight: 600;
}

/* ---- First screen math table ---- */
.math-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--s5); }
.math-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line);
}
.math-row:last-child { border-bottom: 0; }
.math-row.has-badge { background: var(--soft); }
.line-key { flex: none; width: 1.25rem; font-weight: 700; color: var(--muted); font-size: 0.8rem; }
.line-main { flex: 1 1 11rem; min-width: 0; display: flex; flex-direction: column; }
.line-name { font-weight: 600; }
.line-formula { font-size: 0.76rem; color: var(--muted); }
.line-control { flex: none; display: inline-flex; align-items: center; gap: var(--s2); }
.line-input { width: 5.5rem; padding: 0.35rem 0.5rem; }
.line-unit { font-size: 0.76rem; color: var(--muted); }
.line-right { margin-left: auto; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; text-align: right; }
.line-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.line-badge { font-size: 0.72rem; }
.badge-none { background: #EEF1F5; color: var(--muted); border-color: var(--line); }
.terms-result { font-weight: 700; margin-top: var(--s3); }

/* ---- Save and exit modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 26, 47, 0.55); padding: var(--s4);
}
.modal {
  background: var(--white); border-radius: var(--radius); padding: var(--s6);
  max-width: 30rem; width: 100%; box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 1.3rem; }
.modal .screen-nav-buttons { margin-top: var(--s5); }
.modal-settings { max-height: 85vh; overflow-y: auto; }
.settings-group-label {
  text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; font-weight: 700;
  color: var(--muted); margin: var(--s4) 0 var(--s2);
}
.settings-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4); font-size: 0.95rem; color: var(--midnight); margin-bottom: var(--s2);
}
.settings-item:hover:not([disabled]) { border-color: var(--cobalt); background: #F7F9FF; }
.settings-item[disabled] { opacity: 0.5; cursor: default; }
.settings-market-list { display: grid; gap: var(--s2); margin-bottom: var(--s2); }
.settings-market {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3); cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4); text-align: left; font-size: 0.95rem; color: var(--midnight);
}
.settings-market:hover { border-color: var(--cobalt); background: #F7F9FF; }
.settings-market.is-active { border-color: var(--cobalt); border-left-width: 4px; }
.settings-market-name { font-weight: 600; }
.settings-market-tag { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* ---- Report dashboard ---- */
.report-header { margin-bottom: var(--s6); }
.report-card { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s5); background: var(--white); }
.report-card-title { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cobalt); margin-bottom: var(--s4); }
.path-head { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: baseline; }
.path-head h3 { margin: 0; }
.sub-h { font-size: 1rem; margin: var(--s4) 0 var(--s3); }

.market-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
.market-mini { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s4); background: var(--soft); }
.market-mini h3 { margin-bottom: var(--s2); font-size: 1.05rem; }
.mini-weak, .mini-strong { list-style: none; padding: 0; margin: var(--s2) 0 0; display: grid; gap: var(--s1); }
.mini-weak li { font-size: 0.88rem; color: var(--amber-text); }
.mini-strong li { font-size: 0.88rem; color: var(--ok-text); }

.table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.report-table th, .report-table td { text-align: left; padding: var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.report-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.gap-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.gap-list li { padding: var(--s3) var(--s4); border-left: 4px solid var(--cobalt); background: var(--soft); border-radius: var(--radius-sm); }

.review-links { display: flex; flex-wrap: wrap; gap: var(--s3); }
.report-disclaimer { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin-top: var(--s5); }

@media (min-width: 40rem) {
  .recap-list li { grid-template-columns: 12rem 1fr; align-items: baseline; }
  .market-grid { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
}

@media (min-width: 40rem) {
  .module-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 52rem) {
  .module-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 52rem) {
  .module-indicator { display: flex; }
  .topbar-title { font-size: 1rem; }
}
