* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface-2: #f1f0f3;
  --border: #dedce1;
  --border-soft: #e9e7ea;
  --text: #454149;
  --text-strong: #39363d;
  --muted: #77737b;
  --lavender: #aeb8df;
  --lavender-strong: #9da8d4;
  --orange: #ffb43f;
  --orange-strong: #f1a62f;
  --danger: #c96b6b;
  --success: #6f9a7a;
  --radius: 22px;
}

html, body { min-height: 100%; margin: 0; }
html { background: var(--bg); }

body {
  background:
    radial-gradient(circle at 50% -20%, rgba(174,184,223,.18), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.app-shell { width: 100%; min-height: 100vh; padding: 28px 24px 70px; }
.screen { display: none; }
.screen.active { display: block; animation: screen-in .2s ease both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-mark {
  color: var(--text-strong);
  font-size: .86rem;
  font-weight: 900;
  letter-spacing: .18em;
}
.brand-mark span { color: var(--orange-strong); }
.brand-mark.compact { margin-bottom: 5px; }

.eyebrow {
  display: inline-block;
  color: var(--text);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

/* Auth */

.auth-layout {
  width: min(100%, 520px);
  min-height: calc(100vh - 98px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-layout > .brand-mark {
  margin-bottom: 22px;
  text-align: center;
}

.auth-card,
.detail-card,
.panel-state,
.table-wrap {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.84);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(69,65,73,.07);
}

.auth-card { padding: clamp(28px, 6vw, 46px); }
.auth-card h1 {
  margin: 15px 0 12px;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.05em;
}
.lead { color: var(--muted); line-height: 1.7; }
.auth-card > .lead { margin-bottom: 28px; }
.auth-footnote {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: .76rem;
}

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 8px; }
.field label { color: var(--text-strong); font-weight: 750; }

input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  padding: 14px 15px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus {
  border-color: var(--lavender);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(174,184,223,.18);
}
input::placeholder { color: #a19da5; }
.button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 13px 22px;
  font-weight: 800;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary {
  color: #3d3428;
  background: var(--orange);
  box-shadow: 0 8px 22px rgba(255,180,63,.18);
}
.button.primary:hover:not(:disabled) { background: var(--orange-strong); }
.button.ghost { color: var(--text); background: transparent; border-color: var(--border); }
.button.ghost:hover:not(:disabled) { background: var(--surface); border-color: #c9c6cc; }
.button.small { padding: 9px 15px; font-size: .84rem; }
.button.wide { width: 100%; }
.form-error { min-height: 20px; margin: 2px 0 0; color: var(--danger); font-size: .84rem; line-height: 1.45; }

.mfa-card { text-align: left; }
.qr-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
  margin: 24px 0 18px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: #fff;
}
#mfa-qr { width: 220px; height: 220px; image-rendering: auto; }
.qr-fallback { color: var(--muted); text-align: center; }
.secret-details {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: .84rem;
}
.secret-details summary { cursor: pointer; color: var(--text-strong); font-weight: 700; }
.secret-details p { margin: 12px 0 7px; }
.secret-details code {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-strong);
}


.account-page {
  width: min(100%, 900px);
  margin: 0 auto;
}

.account-heading {
  margin-bottom: 24px;
}

.account-heading h1 {
  margin: 13px 0 7px;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.05em;
}

.account-card {
  max-width: 700px;
}

.account-email {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 14px 0;
}

.account-email span {
  color: var(--muted);
}

.account-email strong {
  color: var(--text-strong);
  overflow-wrap: anywhere;
  text-align: right;
}

.account-divider {
  height: 1px;
  margin: 8px 0 24px;
  background: var(--border-soft);
}

.account-help {
  margin: 8px 0 0;
}

/* Dashboard */

.topbar {
  width: min(100%, 1320px);
  margin: 0 auto 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.admin-email { color: var(--muted); font-size: .82rem; }

.dashboard, .detail { width: min(100%, 1320px); margin: 0 auto; }

.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 0 0 25px;
}
.dashboard-heading h1 {
  margin: 13px 0 0;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.05em;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.search-box { display: block; }

.panel-state {
  min-height: 260px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.panel-state[hidden] {
  display: none !important;
}
.panel-state h2 {
  margin: 13px 0 7px;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 400;
}
.panel-state p { color: var(--muted); line-height: 1.55; }

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--lavender);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 16px 18px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th {
  color: var(--muted);
  background: rgba(241,240,243,.6);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(174,184,223,.055); }
.primary-cell { color: var(--text-strong); font-weight: 750; }
.secondary-cell { margin-top: 4px; color: var(--muted); font-size: .76rem; }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: .72rem;
  font-weight: 850;
}
.status-completed { border-color: rgba(111,154,122,.3); background: rgba(111,154,122,.10); }
.status-processing { border-color: rgba(255,180,63,.35); background: rgba(255,180,63,.12); }
.status-in_progress { border-color: rgba(174,184,223,.45); background: rgba(174,184,223,.16); }

/* Detail */

.detail-heading {
  margin-bottom: 24px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.78);
}
.detail-heading h1 {
  margin: 12px 0 7px;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.045em;
}
.muted { color: var(--muted); line-height: 1.6; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}
.detail-card { padding: 26px; box-shadow: 0 12px 35px rgba(69,65,73,.05); }
.data-list { margin-top: 18px; }
.data-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}
.data-row:first-child { border-top: 0; }
.data-row span { color: var(--muted); }
.data-row strong { max-width: 65%; color: var(--text-strong); text-align: right; overflow-wrap: anywhere; }

.result-json {
  margin-top: 18px;
  max-height: 560px;
  overflow: auto;
}
pre {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.responses-card { margin-bottom: 14px; }
.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.card-heading h2 {
  margin: 9px 0 0;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 400;
}
.responses-list { display: grid; gap: 10px; }
.response-item {
  padding: 17px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
}
.response-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 11px;
}
.response-head strong { color: var(--text-strong); line-height: 1.4; }
.response-head span { flex: 0 0 auto; color: var(--muted); font-size: .76rem; }
.response-item pre { max-height: 300px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  max-width: min(90vw, 520px);
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--text-strong);
  color: #fff;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 20;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (max-width: 800px) {
  .app-shell { padding: 18px 14px 50px; }
  .topbar { align-items: flex-start; }
  .admin-email { display: none; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-heading, .detail-card { padding: 22px; }
}

@media (max-width: 520px) {
  .auth-layout { min-height: calc(100vh - 70px); }
  .auth-card { padding: 25px 20px; }
  .topbar { flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .data-row { flex-direction: column; gap: 5px; }
  .data-row strong { max-width: 100%; text-align: left; }
  .response-head { flex-direction: column; gap: 5px; }
  .account-email { flex-direction: column; gap: 5px; }
  .account-email strong { text-align: left; }
}

.blueprint-card {
  margin-bottom: 14px;
}

.admin-blueprint {
  width: min(100%, 920px);
  margin: 0 auto;
}

.admin-blueprint .result-hero {
  padding-bottom: 10px;
}

.admin-blueprint .result-headline {
  max-width: 780px;
  margin: 14px 0 30px;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.045em;
}

.admin-blueprint .result-subtitle {
  margin: 0 0 14px;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.8vw, 2.2rem);
  font-weight: 400;
  line-height: 1.08;
}

.admin-blueprint .result-balance,
.admin-blueprint .result-priorities,
.admin-blueprint .result-profile,
.admin-blueprint .result-lgt,
.admin-blueprint .result-narrative,
.admin-blueprint .result-confidence,
.admin-blueprint .result-handoff,
.admin-blueprint .result-next-step {
  margin-top: 38px;
}

.admin-blueprint .balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-blueprint .balance-item {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.admin-blueprint .balance-label,
.admin-blueprint .profile-group-title,
.admin-blueprint .narrative-label {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.admin-blueprint .balance-value {
  margin-top: 8px;
  color: var(--text-strong);
  font-size: 1.08rem;
  font-weight: 800;
}

.admin-blueprint .priority-list {
  display: grid;
  gap: 10px;
}

.admin-blueprint .priority-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.admin-blueprint .priority-number,
.admin-blueprint .narrative-number {
  color: var(--lavender-strong);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.admin-blueprint .priority-title,
.admin-blueprint .narrative-label,
.admin-blueprint .result-block-title,
.admin-blueprint .result-next-title {
  color: var(--text-strong);
}

.admin-blueprint .priority-title {
  font-weight: 800;
}

.admin-blueprint .priority-status {
  margin-top: 4px;
  color: var(--muted);
  font-size: .86rem;
}

.admin-blueprint .priority-description {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-blueprint .profile-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.admin-blueprint .profile-group:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.admin-blueprint .profile-group-title {
  margin-bottom: 9px;
}

.admin-blueprint .profile-items {
  display: grid;
  gap: 8px;
}

.admin-blueprint .profile-item {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-2);
}

.admin-blueprint .profile-item-name {
  color: var(--text);
}

.admin-blueprint .profile-item-status {
  color: var(--text-strong);
  font-weight: 800;
  text-align: right;
}

.admin-blueprint .result-block {
  margin-top: 22px;
}

.admin-blueprint .result-block-title {
  margin-bottom: 8px;
  font-size: 1rem;
}

.admin-blueprint .result-block-text,
.admin-blueprint .result-list-item,
.admin-blueprint .narrative-text {
  color: var(--muted);
  line-height: 1.65;
}

.admin-blueprint .result-list {
  margin: 0;
  padding-left: 20px;
}

.admin-blueprint .narrative-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid var(--border-soft);
}

.admin-blueprint .narrative-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.admin-blueprint .narrative-label {
  margin-top: 8px;
  font-size: .73rem;
}

.admin-blueprint .narrative-text {
  margin: 4px 0 0;
}

.admin-blueprint .confidence-level {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  background: rgba(174, 184, 223, .18);
  color: var(--text-strong);
  font-weight: 900;
}

.admin-blueprint .handoff-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.admin-blueprint .handoff-row:first-of-type {
  border-top: 0;
}

.admin-blueprint .handoff-online,
.admin-blueprint .handoff-physical {
  color: var(--text-strong);
  font-weight: 700;
}

.admin-blueprint .handoff-physical {
  text-align: right;
}

.admin-blueprint .handoff-arrow {
  color: var(--muted);
}

.admin-blueprint .result-next-title {
  margin: 0 0 8px;
}

.admin-response-item {
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface);
}

.admin-response-head {
  margin-bottom: 18px;
}

.admin-response-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.admin-response-number {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}

.admin-response-question {
  margin: 0;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  font-weight: 400;
  line-height: 1.12;
}

.admin-answer-field {
  margin-top: 4px;
}

.admin-answer-text,
.admin-answer-value {
  min-height: 50px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-answer-text {
  min-height: 70px;
  font-size: 1rem;
}

.admin-readonly-choices {
  display: grid;
  gap: 0;
}

.admin-readonly-choice {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.admin-readonly-choice + .admin-readonly-choice {
  margin-top: 7px;
}

.admin-readonly-choice.selected {
  border-color: var(--lavender);
  background: rgba(174, 184, 223, .14);
  box-shadow: 0 0 0 1px var(--lavender) inset;
}

.admin-choice-label {
  line-height: 1.45;
}

.admin-readonly-scale {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-scale-button {
  display: inline-flex;
  width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.admin-scale-button.selected {
  border-color: var(--lavender);
  background: var(--lavender);
  color: #39363d;
}

@media (max-width: 700px) {
  .admin-blueprint .balance-grid {
    grid-template-columns: 1fr;
  }

  .admin-blueprint .priority-card,
  .admin-blueprint .narrative-card {
    grid-template-columns: 46px 1fr;
  }

  .admin-blueprint .profile-item {
    flex-direction: column;
  }

  .admin-blueprint .profile-item-status,
  .admin-blueprint .handoff-physical {
    text-align: left;
  }

  .admin-blueprint .handoff-row {
    grid-template-columns: 1fr;
  }

  .admin-blueprint .handoff-arrow {
    display: none;
  }
}


.single-detail-grid {
  grid-template-columns: 1fr;
}

.admin-response-section {
  margin: 28px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.admin-response-section:first-child { margin-top: 0; border-top: 0; }
.admin-answer-not-asked {
  color: var(--muted);
  background: var(--surface-2);
  font-style: italic;
}
