:root {
  --primary: #7b247d;
  --primary-dark: #5f1764;
  --primary-light: #efe4f2;
  --text: #25212a;
  --muted: #6d6570;
  --border: #e3dce6;
  --danger: #b42318;
  --success: #137333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background: #f7f4f8;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.mobile-shell {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

.assist-banner {
  margin: -8px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--primary-light);
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  line-height: 1.4;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
}

input[readonly],
.readonly-field {
  background: #f1eef3;
  color: var(--muted);
  cursor: not-allowed;
}

.sample-block {
  overflow-x: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7f4f8;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.employee-batch-list {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.employee-row-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.employee-row-card.has-error {
  border-color: #e07d74;
  background: #fff8f7;
}

.employee-row-card .remove-row {
  margin-top: 10px;
}

.field-error {
  border-color: #b42318;
  background: #fff7f6;
}

.row-error {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fce8e6;
  color: #8c1d18;
  font-size: 13px;
  line-height: 1.45;
}

.row-error:not(:empty) {
  display: grid;
  gap: 6px;
}

.row-error a {
  color: #5f1764;
  font-weight: 700;
}

.validation-summary {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e07d74;
  border-radius: 6px;
  background: #fce8e6;
  color: #8c1d18;
  font-size: 13px;
  line-height: 1.45;
}

.validation-summary a {
  color: #5f1764;
  font-weight: 700;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.audit-payload {
  max-width: 360px;
  max-height: 160px;
  overflow: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7f4f8;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.reset-grid,
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.reset-grid form,
.history-grid > div {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.reset-grid form {
  display: grid;
  gap: 8px;
}

.history-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.history-grid p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.journey-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.journey-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #d8d2dc;
  border-radius: 999px;
  background: #f1eef3;
  color: #5f5863;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.journey-pill.complete {
  border-color: #81c995;
  background: #e6f4ea;
  color: #0b5728;
}

.journey-pill.blocked {
  border-color: #e07d74;
  background: #fce8e6;
  color: #8c1d18;
}

.journey-pill.pending {
  border-color: #d8d2dc;
  background: #f1eef3;
  color: #5f5863;
}

.compact-action-form {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.provider-override-form {
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) minmax(220px, 1fr) auto;
}

.override-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.override-card {
  display: grid;
  gap: 3px;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid var(--primary-light);
  border-radius: 6px;
  background: #fbf8fc;
}

.override-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.override-card strong {
  color: var(--primary-dark);
  font-size: 15px;
}

.override-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.button.danger {
  background: var(--danger);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.muted-action {
  color: var(--muted);
  font-size: 14px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.camera-box {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 520px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #1f1b24;
}

.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-preview[hidden] {
  display: none !important;
}

.file-action {
  cursor: pointer;
}

.lookup-status {
  min-height: 18px;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.combo-search {
  position: relative;
}

.combo-search input[type="search"] {
  padding-right: 34px;
}

.combo-search::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 39px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.combo-results {
  position: absolute;
  z-index: 20;
  top: calc(100% - 18px);
  left: 0;
  right: 0;
  display: none;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(37, 33, 42, 0.12);
}

.combo-search.open .combo-results {
  display: block;
}

.combo-option {
  width: 100%;
  display: block;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.combo-option:last-child {
  border-bottom: 0;
}

.combo-option:hover,
.combo-option:focus {
  background: #fbf8fc;
  outline: none;
}

.combo-option span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.alert {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  background: var(--primary-light);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 14px 0 18px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f4f8;
}

.tab {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.tab.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(37, 33, 42, 0.08);
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.employee-cards {
  display: none;
}

.employee-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.employee-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.employee-card-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.employee-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  font-size: 14px;
}

.employee-card-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  list-style: none;
}

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

.filter-summary::after {
  content: "+";
  color: var(--primary-dark);
  font-size: 22px;
  line-height: 1;
}

.dashboard-filters[open] .filter-summary::after {
  content: "-";
}

.dashboard-filters form {
  margin-top: 16px;
}

.profile-details .history-grid,
.profile-details .table-scroll,
.profile-details .actions {
  margin-top: 16px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filter-chips span {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.step-list {
  display: grid;
  gap: 10px;
}

.step {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.journey-steps {
  margin-top: 18px;
}

.journey-step {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 12px;
  background: #f5f3f6;
  border-color: #ddd6e1;
}

.step-marker {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #a9a1ad;
}

.step-title {
  font-weight: 700;
}

.step-state {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.journey-step.complete {
  border-color: #81c995;
  background: #e6f4ea;
  color: #0b5728;
}

.journey-step.complete .step-marker {
  background: var(--success);
}

.journey-step.blocked {
  border-color: #e07d74;
  background: #fce8e6;
  color: #8c1d18;
}

.journey-step.blocked .step-marker {
  background: var(--danger);
}

.journey-step.pending {
  border-color: #d8d2dc;
  background: #f1eef3;
  color: #5f5863;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.review-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.review-card label {
  margin-top: 12px;
}

textarea {
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

.document-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.document-preview img,
.review-photo {
  max-width: 180px;
  max-height: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
  background: #f7f3f8;
}

.review-decision {
  margin-top: 16px;
}

.manual-review-shell {
  padding: 0;
  overflow: hidden;
}

.manual-review-wide {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: stretch;
}

.review-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  background: #fbf8fc;
}

.manual-review-wide .review-hero {
  grid-column: 1 / -1;
}

.review-hero h1 {
  margin: 4px 0 4px;
}

.review-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.review-eyebrow {
  display: inline-block;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.review-summary,
.manual-review-form {
  padding: 18px;
}

.review-summary {
  border-bottom: 1px solid var(--border);
}

.manual-review-wide .review-summary {
  border-right: 1px solid var(--border);
  border-bottom: 0;
  background: #fbf8fc;
}

.manual-review-wide > .alert,
.manual-review-wide > .error {
  grid-column: 1 / -1;
  margin: 16px 18px 0;
}

.review-summary h2,
.form-section h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.review-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.review-field {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.review-field span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.review-field strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.manual-review-form {
  display: grid;
  gap: 18px;
}

.manual-review-wide .manual-review-form {
  align-content: start;
}

.form-section {
  min-width: 0;
}

.form-section label + textarea,
.form-section label + input {
  margin-bottom: 12px;
}

.upload-section {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .manual-review-wide {
    display: block;
  }

  .manual-review-wide .review-summary {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px;
  }

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

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

  .dashboard-filters {
    padding: 16px;
  }

  .journey-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-pill {
    justify-content: flex-start;
    white-space: normal;
  }

  .compact-action-form {
    grid-template-columns: 1fr;
  }

  .provider-override-form {
    grid-template-columns: 1fr;
  }

  .comparison-grid,
  .document-preview {
    grid-template-columns: 1fr;
  }

  .review-hero,
  .review-actions {
    flex-direction: column;
  }

  .review-field-grid {
    grid-template-columns: 1fr;
  }

  .review-summary,
  .manual-review-form {
    padding: 16px;
  }

  .review-hero h1 {
    font-size: 28px;
    line-height: 1.15;
  }

  .review-summary h2,
  .form-section h2 {
    font-size: 18px;
    line-height: 1.25;
  }

  .review-actions .button {
    width: 100%;
  }

  .override-cards {
    display: grid;
    grid-template-columns: 1fr;
  }

  .employee-table {
    display: none;
  }

  .employee-cards {
    display: block;
  }

  .actions .button,
  .actions .file-action {
    flex: 1 1 auto;
  }
}
