:root {
  --bg: #f5f2f6;
  --surface: #ffffff;
  --surface-alt: #fbf9fc;
  --line: #e6dfe9;
  --line-strong: #d8cedd;
  --text: #241929;
  --muted: #7e7384;
  --brand: #7f467b;
  --brand-strong: #6b3968;
  --brand-soft: #f0e6ef;
  --shadow: 0 24px 60px rgba(61, 32, 61, 0.12);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Aptos", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(127, 70, 123, 0.15), transparent 28%),
    linear-gradient(180deg, #f8f4f8 0%, #f4f0f5 100%);
  color: var(--text);
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 22px 0;
  background: linear-gradient(180deg, #6e3f6d 0%, #845181 100%);
  color: white;
}

.rail__logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.rail__icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font-size: 20px;
}

.rail__icon--active,
.rail__icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

.workspace {
  padding: 20px;
}

.self-test-banner {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
}

.self-test-banner--ok {
  background: #dcf5e4;
  color: #1f6c3d;
  border: 1px solid #b7e6c5;
}

.self-test-banner--ko {
  background: #ffe3e7;
  color: #a23952;
  border: 1px solid #f5c1cd;
}

.topbar {
  display: grid;
  grid-template-columns: 300px 1fr 64px;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-xl);
  background: linear-gradient(90deg, var(--brand) 0%, #8d4d85 100%);
  color: white;
  box-shadow: var(--shadow);
}

.topbar__brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: #6c5f73;
}

.searchbox input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: 0;
}

.topbar__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
}

.avatar,
.ghost-btn,
.primary-btn,
.danger-btn,
.select,
.input {
  min-height: 42px;
  border-radius: 12px;
}

.avatar {
  width: 42px;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  font-weight: 700;
}

.profile-menu {
  position: relative;
}

.profile-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 20;
  width: min(340px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.profile-popover__head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.profile-popover__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.profile-popover__head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.profile-popover__section {
  display: grid;
  gap: 6px;
  padding: 12px 0;
}

.profile-popover__label {
  padding: 0 10px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-detail,
.profile-reset {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.profile-detail {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
  background: var(--surface-alt);
  border: 1px solid transparent;
}

.profile-detail span {
  color: var(--muted);
  font-size: 13px;
}

.profile-detail strong {
  text-align: right;
}

.profile-detail--stacked {
  display: grid;
  justify-content: stretch;
}

.profile-detail--stacked strong {
  text-align: left;
}

.profile-permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-permissions small {
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
}

.profile-reset {
  background: transparent;
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  color: #9c3b54;
  font-weight: 700;
}

.ghost-btn,
.danger-btn {
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-btn--small {
  min-height: 38px;
}

.primary-btn {
  padding: 0 18px;
  background: var(--brand);
  color: white;
  font-weight: 700;
}

.danger-btn {
  color: #9c3b54;
  background: #fff5f7;
  border-color: #f2ccd7;
}

.ghost-btn:disabled,
.primary-btn:disabled,
.danger-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.toolbar,
.filters,
.content-grid {
  margin-top: 18px;
}

.toolbar,
.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.toolbar {
  padding: 8px 4px;
}

.toolbar h1 {
  margin: 4px 0 0;
  font-size: 32px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbar__right,
.filters__group,
.filters__stats {
  display: flex;
  gap: 12px;
  align-items: center;
}

.select,
.input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 14px;
  color: var(--text);
}

.select--role {
  min-width: 180px;
}

.metric-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric-pill span {
  color: var(--muted);
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.95fr);
  gap: 18px;
}

.table-card,
.detail-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(230, 223, 233, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.table-card {
  overflow: hidden;
}

.table-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.muted {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 270px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 18px;
  background: #fcfbfd;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
  color: var(--muted);
}

tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid #efe8f1;
  font-size: 14px;
  vertical-align: top;
}

tbody tr {
  background: rgba(255, 255, 255, 0.85);
  transition: background 140ms ease;
}

tbody tr:nth-child(2n) {
  background: rgba(247, 244, 248, 0.82);
}

tbody tr:hover,
tbody tr.is-selected {
  background: #f0ebf3;
}

.avatar-column,
.avatar-cell {
  width: 72px;
  text-align: center;
}

.avatar-cell {
  vertical-align: middle;
}

.candidate-character {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 242, 248, 0.7));
  box-shadow: inset 0 0 0 1px rgba(230, 223, 233, 0.95), 0 8px 18px rgba(36, 25, 41, 0.1);
}

.candidate-character svg {
  width: 36px;
  height: 48px;
  overflow: visible;
}

.candidate-character--small {
  width: 38px;
  height: 44px;
}

.candidate-character--small svg {
  width: 32px;
  height: 42px;
}

.candidate-character--large {
  width: 64px;
  height: 76px;
  flex: 0 0 auto;
}

.candidate-character--large svg {
  width: 54px;
  height: 70px;
}

.character-face,
.character-arm,
.character-hand {
  fill: var(--skin-color);
}

.character-hair {
  fill: var(--hair-color);
}

.character-shirt {
  fill: var(--shirt-color);
}

.character-leg {
  fill: #3e4754;
}

.character-shoe {
  fill: #262b33;
}

.character-eye {
  fill: #201720;
}

.character-smile {
  fill: none;
  stroke: #7f4d45;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f4edf4;
  color: #5f4a65;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge--neutral {
  background: #7a726d;
  color: white;
}

.status-badge--blue {
  background: #d9edff;
  color: #2467a1;
}

.status-badge--mint {
  background: #d8f3ec;
  color: #18756c;
}

.status-badge--rose {
  background: #ffd9df;
  color: #a53f57;
}

.status-badge--amber {
  background: #ffe7b5;
  color: #9a6510;
}

.status-badge--green {
  background: #d6f3d8;
  color: #257443;
}

.detail-panel {
  padding: 24px;
  max-height: calc(100vh - 214px);
  overflow: auto;
}

.detail-panel__head,
.detail-panel__actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.candidate-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.detail-panel__head h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

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

.detail-block,
.detail-section {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid #eee5ef;
}

.detail-block span,
.detail-section h3 {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
}

.detail-section {
  margin-top: 14px;
}

.detail-section h3 {
  font-size: 15px;
}

.detail-section p {
  margin: 0;
  line-height: 1.65;
  font-size: 14px;
}

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

.tag {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline__item {
  padding-left: 14px;
  border-left: 3px solid #dfd3e2;
}

.timeline__item strong,
.timeline__item span,
.timeline__item p {
  display: block;
}

.timeline__item span {
  margin: 6px 0;
  color: var(--muted);
  font-size: 13px;
}

.timeline__item p {
  margin: 0;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 20, 31, 0.45);
}

.modal {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: white;
  box-shadow: 0 40px 90px rgba(25, 12, 26, 0.24);
}

.modal__head,
.modal__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal__head h2 {
  margin: 4px 0 0;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.field--full {
  grid-column: 1 / -1;
}

.input {
  padding: 0 14px;
}

.input--area {
  min-height: 140px;
  padding: 14px;
  resize: vertical;
}

.input--color {
  width: 68px;
  min-height: 42px;
  padding: 6px;
}

.modal__footer {
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 8px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  text-align: center;
}

@media (max-width: 1180px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    display: none;
  }

  .detail-panel--open {
    display: block;
  }
}

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

  .rail {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

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

  .toolbar,
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar__right,
  .filters__group,
  .filters__stats {
    flex-wrap: wrap;
  }

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