:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1b2528;
  --muted: #657173;
  --line: #d8ddd9;
  --accent: #0f766e;
  --accent-strong: #0a514c;
  --accent-soft: #d9efec;
  --warning: #af5d16;
  --danger: #9b1c1c;
  --good: #276749;
  --shadow: 0 16px 45px rgba(36, 45, 45, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, Arial, sans-serif;
}

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

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  color: #f8fbfa;
  background: #102426;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #102426;
  background: #f4c95d;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #a8b7b8;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: #dbe7e5;
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  color: #102426;
  background: #f4c95d;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #c5d2d3;
  line-height: 1.5;
  font-size: 14px;
}

.sidebar-note span {
  display: block;
  margin-bottom: 6px;
  color: #f4c95d;
  font-weight: 800;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.topbar-actions,
.share-row,
.panel-actions {
  display: flex;
  gap: 10px;
}

.panel-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button.small {
  min-height: 36px;
}

.ghost-button.small,
.danger-button.small {
  min-height: 34px;
  padding: 0 12px;
}

.ghost-button,
.icon-button,
.danger-button {
  padding: 0 14px;
  color: var(--accent-strong);
  background: var(--surface);
  border-color: var(--line);
}

.danger-button {
  border: 1px solid #e5b7b7;
  color: var(--danger);
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.client-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.dashboard-grid,
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

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

.request-list,
.profile-list,
.selectable-list,
.shortlist-output,
.client-profile-grid,
.deleted-list {
  display: grid;
  gap: 12px;
}

.request-card,
.profile-card,
.client-card,
.deleted-card,
.table-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.request-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.request-card h3,
.profile-card h3,
.deleted-card h3,
.client-card h3 {
  margin-bottom: 5px;
  font-size: 16px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.live {
  color: var(--good);
  background: #dff2e6;
}

.share-box label,
.profile-form label,
.builder-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.share-box p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-summary {
  display: grid;
  gap: 10px;
}

.status-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.status-summary-row strong {
  font-size: 14px;
}

.status-summary-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.7fr 0.7fr;
  gap: 14px;
  align-items: center;
}

.profile-form,
.builder-controls {
  display: grid;
  gap: 12px;
}

.profile-card {
  display: grid;
  gap: 10px;
}

.profile-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.profile-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  color: #314447;
  background: #eef1ec;
  font-size: 12px;
  font-weight: 700;
}

.flag-list,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-actions {
  padding-top: 2px;
}

.profile-actions.compact {
  padding-top: 0;
  justify-content: flex-end;
}

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

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

.flag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.flag.intent {
  color: #6f3f05;
  background: #fff0cf;
}

.flag.cv {
  color: #264653;
  background: #e3f0f2;
}

.flag.duplicate {
  color: var(--danger);
  background: #fde2e2;
}

.flag.pending {
  color: #535861;
  background: #edf0f2;
}

.flag.processing {
  color: #0f5b70;
  background: #dff4fa;
}

.flag.parsed {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.flag.failed {
  color: var(--danger);
  background: #fde2e2;
}

.profile-summary {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.profile-summary h3 {
  margin-bottom: 5px;
}

.profile-summary p {
  color: var(--muted);
  line-height: 1.6;
}

.summary-grid {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.summary-grid strong {
  font-size: 13px;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.parsed-profile-detail {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.parsed-profile-detail section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.parsed-profile-detail h4 {
  margin-bottom: 6px;
  font-size: 13px;
}

.parser-error {
  padding: 10px 12px;
  border: 1px solid #f2b4b4;
  border-radius: 8px;
  color: var(--danger) !important;
  background: #fff4f4;
  font-weight: 700;
}

.private-line {
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  color: var(--warning);
  font-size: 13px;
  font-weight: 700;
}

.select-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.select-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.deleted-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.deleted-controls label {
  min-width: min(320px, 100%);
}

.deleted-controls span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.deleted-select-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.deleted-select-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.deleted-select-row strong,
.deleted-select-row .meta {
  display: block;
}

.deleted-card.selected {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(190, 18, 60, 0.12);
}

.client-preview {
  overflow: hidden;
}

.client-hero {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  color: #fff;
  background: #102426;
}

.client-hero .eyebrow,
.client-hero p {
  color: #c6d8d7;
}

.client-link-id {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.client-hero h2 {
  margin-bottom: 8px;
  font-size: 26px;
}

.client-profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.client-card {
  display: grid;
  gap: 12px;
}

.client-card.selected {
  border-color: var(--accent);
  background: #f4fbf9;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.client-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.client-select-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.client-select-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.client-select-row strong,
.client-select-row .meta {
  display: block;
}

.client-profile-detail {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.client-profile-detail summary {
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

.client-card[data-client-card-id] {
  cursor: pointer;
}

.client-profile-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(19, 31, 38, 0.28);
}

.client-profile-modal::backdrop {
  background: rgba(14, 22, 28, 0.46);
}

.client-profile-modal-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: #ffffff;
}

.client-profile-modal-close {
  justify-self: end;
}

.client-profile-modal-body h2 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.client-profile-modal-sections {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.client-profile-modal-sections section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.client-profile-modal-sections h3 {
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.client-profile-modal-sections p {
  color: var(--text);
  line-height: 1.65;
}

.redacted-note {
  color: var(--warning) !important;
  font-weight: 700;
}

.client-billing {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.client-billing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.client-billing-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.client-billing-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.client-billing-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.client-payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.client-payment-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

body.public-client-view {
  background: #f8faf7;
}

body.public-client-view .app-shell {
  display: block;
}

body.public-client-view .sidebar,
body.public-client-view .topbar {
  display: none;
}

body.public-client-view .main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

body.public-client-view .section {
  display: none;
}

body.public-client-view #preview {
  display: block;
}

body.public-client-view .client-preview {
  min-height: calc(100vh - 48px);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(24px);
  opacity: 0;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #102426;
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.auth-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 36, 38, 0.72);
}

.auth-panel[hidden] {
  display: none;
}

.auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .nav-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .metric-grid,
  .dashboard-grid,
  .split-layout,
  .client-profile-grid,
  .client-billing-grid,
  .client-payment-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .client-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .share-row,
  .nav-list {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 28px;
  }
}
