:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #1f2937;
  background: #f5f5f5;
  line-height: 1.4;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: #174ea6; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted, small { color: #667085; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 12px; }

.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: white;
}

.login-card h1 { margin: 0 0 4px; }
.login-card > p { margin: 0 0 22px; color: #667085; }
.role-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.role-tab { flex: 1; padding: 9px; border: 1px solid #d0d5dd; background: #f9fafb; }
.role-tab.active { border-color: #175cd3; color: #175cd3; background: #eff4ff; }
.login-form, .form-field { display: grid; gap: 7px; }
.login-form input { margin-bottom: 10px; }

label { font-size: 13px; font-weight: bold; }
input, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #bfc5ce;
  border-radius: 4px;
  background: white;
}
textarea { min-height: 65px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid #b2ccff; border-color: #175cd3; }

.button {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #98a2b3;
  border-radius: 4px;
  background: white;
  color: #344054;
  text-decoration: none;
  font-size: 13px;
  font-weight: bold;
}
.button.primary { border-color: #175cd3; color: white; background: #175cd3; }
.button.secondary { background: white; }
.button.danger { border-color: #d92d20; color: #b42318; background: #fff; }
.button.quiet { border-color: transparent; background: transparent; }
.button.small { padding: 5px 8px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .55; }

.form-error, .alert {
  padding: 10px 12px;
  border: 1px solid #fda29b;
  border-radius: 4px;
  color: #b42318;
  background: #fef3f2;
  font-size: 13px;
}

.app-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid #d0d5dd;
  background: white;
}
.app-header a { color: #1f2937; text-decoration: none; }
.header-context { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.header-context small { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.role-pill { padding: 3px 7px; border-radius: 4px; color: #175cd3; background: #eff4ff; font-size: 11px; font-weight: bold; text-transform: uppercase; }

.app-body { display: grid; min-height: calc(100vh - 59px); grid-template-columns: 190px minmax(0, 1fr); }
.sidebar { padding: 18px 12px; border-right: 1px solid #d0d5dd; background: white; }
.sidebar nav { display: grid; gap: 6px; }
.nav-button { width: 100%; padding: 9px; border: 0; border-radius: 4px; background: transparent; text-align: left; }
.nav-button.active { color: #175cd3; background: #eff4ff; font-weight: bold; }
.sidebar-note { margin-top: 28px; padding: 10px; border: 1px solid #e4e7ec; color: #667085; font-size: 11px; }
.content { min-width: 0; padding: 28px; }

.page-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { margin: 5px 0 0; }
.eyebrow { margin: 0 0 5px !important; color: #175cd3; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.page-actions, .toolbar, .toolbar-group, .review-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar { justify-content: space-between; margin-bottom: 14px; }
.toolbar.flush { margin: 0; }
.toolbar.after-card { margin: 12px 0 0; }
.grow { flex: 1; }
.self-end { align-self: end; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.card { overflow: hidden; margin-bottom: 14px; border: 1px solid #d0d5dd; border-radius: 5px; background: white; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #e4e7ec; }
.card-head h2, .card-head h3 { margin: 0; font-size: 17px; }
.card-head p { margin: 3px 0 0; color: #667085; font-size: 12px; }
.card-body { padding: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 11px; border-bottom: 1px solid #e4e7ec; text-align: left; vertical-align: top; font-size: 12px; }
th { background: #f9fafb; color: #475467; font-size: 11px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f9fafb; }
.primary-cell { font-weight: bold; }
.secondary-cell { display: block; margin-top: 3px; color: #667085; font-size: 11px; }

.badge { display: inline-block; padding: 3px 6px; border-radius: 4px; background: #f2f4f7; font-size: 11px; text-transform: capitalize; white-space: nowrap; }
.badge.approved, .badge.active, .badge.verified, .badge.completed, .badge.ready { color: #067647; background: #ecfdf3; }
.badge.bio_verification, .badge.staff_review, .badge.client_review, .badge.submitted { color: #b54708; background: #fffaeb; }
.badge.blocked, .badge.disabled, .badge.rejected, .badge.failed, .badge.error { color: #b42318; background: #fef3f2; }
.badge.queued, .badge.scanning, .badge.importing, .badge.reverting, .badge.reverting_media, .badge.pending { color: #175cd3; background: #eff4ff; }
.badge.reverted { color: #475467; background: #f2f4f7; }
.badge.revert_failed { color: #b42318; background: #fef3f2; }

.alert { margin: 12px 0; }
.alert.info { border-color: #84adff; color: #1849a9; background: #eff4ff; }
.alert.warning { border-color: #fec84b; color: #93370d; background: #fffaeb; }
.alert.success { border-color: #6ce9a6; color: #067647; background: #ecfdf3; }
.alert.danger { border-color: #fda29b; color: #b42318; background: #fef3f2; }
.empty { padding: 35px 16px; color: #667085; text-align: center; }
.empty strong { display: block; color: #344054; }
.profile-links { display: grid; width: 110px; gap: 5px; }
.profile-link { display: flex; width: 110px; min-height: 30px; align-items: center; justify-content: center; padding: 5px 8px; border: 1px solid #bfc5ce; border-radius: 4px; background: white; text-decoration: none; font-size: 12px; }
.profile-link:hover { border-color: #175cd3; background: #eff4ff; }
.profile-link.unavailable { color: #667085; border-color: #e4e7ec; background: #f9fafb; }
.profile-link.unavailable:hover { border-color: #e4e7ec; background: #f9fafb; }
.clearance { display: inline-block; max-width: 190px; padding: 4px 7px; border-radius: 4px; font-size: 12px; }
.clearance.pass { color: #067647; background: #ecfdf3; }
.clearance.bio { color: #b54708; background: #fffaeb; }
.clearance.review { color: #5925dc; background: #f4f3ff; }
.clearance.fail { color: #b42318; background: #fef3f2; }
.clearance.waiting { color: #175cd3; background: #eff4ff; }
.verification-box, .review-controls { display: grid; min-width: 190px; gap: 6px; }
.verification-code { width: fit-content; padding: 5px 7px; color: white; background: #344054; font-family: Consolas, Monaco, monospace; }
.attestation { display: flex; align-items: start; gap: 8px; margin: 14px 0; }
.attestation input { width: auto; margin-top: 3px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field.full { grid-column: 1 / -1; }
.search-results { display: grid; gap: 7px; margin-top: 10px; }
.entity-option { display: flex; align-items: center; justify-content: space-between; padding: 10px; border: 1px solid #d0d5dd; background: white; text-align: left; }
.entity-option.selected { border-color: #175cd3; background: #eff4ff; }
.entity-option strong, .entity-option small { display: block; }

.toast-region { position: fixed; top: 12px; right: 12px; z-index: 50; width: min(360px, calc(100% - 24px)); }
.toast { margin-bottom: 7px; padding: 10px 12px; border: 1px solid #98a2b3; border-radius: 4px; background: white; box-shadow: 0 3px 10px #0002; font-size: 13px; }
.toast.error { border-color: #d92d20; }
.toast.success { border-color: #12b76a; }
.loading { display: inline-flex; align-items: center; gap: 7px; }
.spinner { width: 13px; height: 13px; border: 2px solid #d0d5dd; border-top-color: #175cd3; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 850px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid #d0d5dd; }
  .sidebar nav { display: flex; }
  .nav-button { width: auto; }
  .sidebar-note { display: none; }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .app-header { align-items: start; }
  .header-context { flex-wrap: wrap; justify-content: end; }
  .header-context small, .role-pill { display: none; }
  .content { padding: 18px 12px; }
  .page-head { display: block; }
  .page-actions { margin-top: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
}
