:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #fffefa;
  --panel-strong: #ffffff;
  --ink: #17211f;
  --muted: #65706d;
  --line: #deded7;
  --field: #f4f5f6;
  --green: #16745f;
  --blue: #2864a6;
  --amber: #a35b18;
  --red: #b73535;
  --teal-soft: #dcefe8;
  --blue-soft: #e2edf8;
  --amber-soft: #f7ead9;
  --red-soft: #f8e3df;
  --shadow: 0 10px 28px rgba(37, 43, 39, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.7), rgba(246, 244, 239, 0.98)),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 2px 18px;
}

.eyebrow,
.kicker {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.65rem;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.topbar__status {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(37, 43, 39, 0.08);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}

.topbar__status span:first-child {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1;
  margin-bottom: 4px;
}

.topbar__status span:last-child {
  display: block;
  max-width: 100%;
  font-size: 0.72rem;
  line-height: 1;
}

.progress-strip {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -14px 12px;
  padding: 8px 14px 12px;
  background: rgba(246, 244, 239, 0.92);
  backdrop-filter: blur(14px);
}

.progress-strip__track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5e0d4;
}

.progress-strip__track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 260ms ease;
}

.section-pills {
  display: flex;
  gap: 7px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.section-pills::-webkit-scrollbar {
  display: none;
}

.section-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.section-pill.is-complete {
  border-color: rgba(22, 116, 95, 0.25);
  background: var(--teal-soft);
  color: #0d5848;
}

.workspace {
  display: grid;
  gap: 14px;
}

.task-panel,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-panel {
  min-height: 560px;
  overflow: visible;
}

.task-panel__header,
.profile-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.step-badge,
.status-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.step-badge {
  background: var(--blue-soft);
  color: #1e548d;
}

.task-content {
  padding: 18px;
}

.question-copy {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.upload-grid,
.field-grid,
.mini-grid {
  display: grid;
  gap: 10px;
}

.upload-grid {
  margin-top: 16px;
}

.upload-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 94px;
  border: 1px dashed #a7b1ad;
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel-strong);
}

.upload-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-zone__icon,
.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.upload-zone__icon {
  flex: 0 0 auto;
  background: var(--teal-soft);
  color: var(--green);
  font-size: 1.55rem;
  font-weight: 650;
}

.upload-zone strong,
.upload-zone small {
  display: block;
}

.upload-zone small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.document-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.document-row,
.review-row,
.profile-field {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.document-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 11px;
}

.document-row strong,
.profile-field strong {
  display: block;
  overflow-wrap: anywhere;
}

.document-row small,
.profile-field small,
.review-row small {
  color: var(--muted);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
}

.action-row__left,
.action-row__right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.action-row__left {
  justify-content: flex-start;
}

.action-row__right {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.radio-option,
.inline-detail-button,
.add-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 10px 13px;
  font-weight: 800;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.secondary-button {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--ink);
}

.add-button {
  justify-self: start;
  min-height: 34px;
  border-color: rgba(40, 100, 166, 0.28);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--blue-soft);
  color: #1e548d;
  font-size: 0.8rem;
}

.ghost-button {
  background: transparent;
  color: var(--green);
}

.form-field {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 2px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.radio-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.inline-detail-button {
  justify-self: start;
  min-height: 34px;
  margin-top: 8px;
  border-color: transparent;
  border-radius: 999px;
  background: #eef5ff;
  color: #0a58ca;
  font-size: 0.84rem;
  box-shadow: inset 0 0 0 1px rgba(10, 88, 202, 0.12);
}

.form-field label,
.field-label {
  color: #303a37;
  font-size: 0.84rem;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfcac0;
  border-radius: var(--radius);
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.form-field input.is-invalid {
  border-color: var(--red);
  background: #fff7f5;
  box-shadow: 0 0 0 3px rgba(183, 53, 53, 0.1);
}

.field-error {
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 750;
}

.upload-errors {
  display: grid;
  gap: 6px;
}

.form-field textarea {
  min-height: 92px;
  resize: vertical;
}

.array-editor {
  margin-top: 14px;
}

.array-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: #303a37;
  font-weight: 800;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.review-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.review-row {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.review-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-row input {
  border: 1px solid #cfcac0;
  border-radius: var(--radius);
  padding: 10px;
}

.status-chip[data-status="confirmed"] {
  background: var(--teal-soft);
  color: #0d5848;
}

.status-chip[data-status="extracted"] {
  background: var(--blue-soft);
  color: #1e548d;
}

.status-chip[data-status="missing"],
.status-chip[data-status="low-confidence"] {
  background: var(--amber-soft);
  color: #7a3f0e;
}

.status-chip[data-status="sensitive"] {
  background: var(--red-soft);
  color: #842626;
}

.profile-panel {
  align-self: start;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(37, 43, 39, 0.08);
}

.profile-panel__header {
  align-items: center;
  padding: 10px 12px;
}

.profile-panel__header .kicker {
  margin-bottom: 2px;
  font-size: 0.68rem;
}

.profile-panel__header h2 {
  font-size: 0.98rem;
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  width: 34px;
  height: 34px;
}

.profile-body {
  display: block;
}

.profile-body.is-collapsed {
  display: none;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.summary-tile {
  border-radius: var(--radius);
  padding: 10px;
  background: var(--field);
}

.summary-tile strong {
  display: block;
  font-size: 1.2rem;
}

.summary-tile span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.profile-sections {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.profile-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  overflow: hidden;
}

.profile-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 12px;
  list-style: none;
  cursor: pointer;
  font-weight: 850;
}

.profile-section summary::-webkit-details-marker {
  display: none;
}

.profile-section__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.profile-fields {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.profile-field {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.inline-detail-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.inline-detail-card,
.modal-review-card {
  border: 1px solid rgba(222, 222, 215, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.inline-detail-card summary,
.modal-review-card summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
}

.inline-detail-card summary::-webkit-details-marker,
.modal-review-card summary::-webkit-details-marker {
  display: none;
}

.inline-detail-card summary span,
.modal-review-card summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.inline-detail-card summary strong,
.modal-review-card summary small {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.inline-detail-card__body,
.modal-review-card__body {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.inline-detail-card__body p,
.modal-review-card__body p {
  margin: 0;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 750;
}

.chip.is-selected {
  border-color: rgba(40, 100, 166, 0.35);
  background: var(--blue-soft);
  color: #1e548d;
}

.privacy-note {
  border-left: 3px solid var(--red);
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--red-soft);
  color: #6e2424;
  line-height: 1.4;
}

.success-note {
  border-left: 3px solid var(--green);
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--teal-soft);
  color: #0d5848;
  line-height: 1.4;
}

.review-hero,
.review-section-card {
  border: 1px solid rgba(222, 222, 215, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(37, 43, 39, 0.06);
}

.review-hero {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.review-hero__status {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--blue-soft);
  color: #1e548d;
  font-size: 0.76rem;
  font-weight: 850;
}

.review-hero strong {
  font-size: 1rem;
  line-height: 1.35;
}

.review-section-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.review-section-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.review-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
  line-height: 1.25;
}

.detail-dialog {
  width: min(620px, calc(100vw - 20px));
  max-height: min(780px, calc(100vh - 24px));
  border: 1px solid rgba(222, 222, 215, 0.9);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 254, 250, 0.98);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(23, 33, 31, 0.2);
  overflow: auto;
}

.detail-dialog::backdrop {
  background: rgba(23, 33, 31, 0.38);
}

.detail-dialog form {
  display: grid;
  gap: 12px;
}

.detail-dialog h3 {
  margin: 2px 2px 4px;
  font-size: 1.25rem;
}

.modal-review-list,
.modal-fields {
  display: grid;
  gap: 8px;
}

.modal-fields {
  border-radius: var(--radius);
  background: #f7f7f8;
  padding: 10px;
}

.dialog-actions {
  position: sticky;
  bottom: -14px;
  align-items: center;
  margin: 4px -14px -14px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 254, 250, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

@media (min-width: 660px) {
  h1 {
    font-size: 2.35rem;
  }

  .field-grid,
  .mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 920px) {
  h1 {
    font-size: 3.25rem;
  }

  .app-shell {
    padding: 24px 22px 34px;
  }

  .progress-strip {
    margin: 0 -22px 18px;
    padding-inline: 22px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
    align-items: start;
  }

  .task-panel,
  .profile-panel {
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 96px);
  }

  .task-panel {
    overflow: auto;
  }

  .profile-panel {
    overflow: auto;
  }

  .topbar__status {
    width: 98px;
    height: 98px;
  }
}

@media (max-width: 420px) {
  html,
  body {
    height: auto;
  }

  .app-shell {
    min-height: 120vh;
    padding-bottom: 84px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar__status {
    width: 76px;
    height: 76px;
  }

  .topbar__status span:first-child {
    font-size: 1.1rem;
  }

  .topbar__status span:last-child {
    font-size: 0.66rem;
  }

  .task-panel__header {
    padding: 15px;
  }

  .task-panel {
    min-height: auto;
  }

  .task-content {
    padding: 15px;
  }

  .profile-summary {
    grid-template-columns: 1fr;
  }

}
