:root {
  color-scheme: light;
  --bg: #f4f8fd;
  --ink: #071a3a;
  --muted: #627086;
  --surface: #ffffff;
  --line: #d9e5f2;
  --soft: #eef6ff;
  --primary: #0878ff;
  --primary-ink: #ffffff;
  --accent: #18cfe4;
  --navy: #05265e;
  --danger: #d24b63;
  --shadow: 0 18px 50px rgba(7, 26, 58, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fbfdff 0, var(--bg) 46%, #eef6fc 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--primary-ink);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(8, 120, 255, 0.22);
}

.ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

button:hover,
.button:hover {
  transform: translateY(-1px);
}

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

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

.admin-shell {
  width: min(1520px, 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 92px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 6px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.04;
}

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

h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.balance {
  display: grid;
  min-width: 92px;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.balance span {
  color: var(--primary);
  font-size: 26px;
  font-weight: 800;
}

.balance small,
.metric small,
.item small {
  color: var(--muted);
}

.not-registered .balance,
.not-registered .tabs,
.not-registered:not(.can-edit-profile) #profileBadge,
.not-registered .form-note,
.not-registered .topbar .eyebrow {
  display: none;
}

.not-registered .topbar {
  min-height: auto;
  padding: 10px 0 18px;
}

.not-registered .brand-lockup {
  align-items: center;
}

.not-registered .form {
  margin-top: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 16px;
}

.tab {
  flex: 0 0 auto;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.registration-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 20px;
  align-items: center;
  margin: 4px 0 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #ffffff 0%, #eff8ff 54%, #e9fbff 100%);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.is-registered .registration-intro {
  display: none;
}

.can-edit-profile .registration-intro {
  display: none;
}

.registration-copy h2 {
  max-width: 680px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.04;
}

.registration-copy p {
  max-width: 640px;
}

.registration-intro img {
  width: 100%;
  max-width: 320px;
  justify-self: center;
  border-radius: 8px;
  object-fit: contain;
}

.not-registered .tabs,
.not-registered .balance {
  display: none;
}

.not-registered .registration-intro {
  margin-top: 12px;
}

.public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.steps {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.steps li,
.check-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
}

.steps span,
.check-row span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--primary);
  font-weight: 800;
}

.steps p,
.check-row p {
  margin: 4px 0 0;
}

.checklist {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.check-row.done span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.full {
  width: 100%;
}

.form-note {
  margin: -6px 0 2px;
}

.action-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 10px 0 18px;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #ffffff 0%, #edf7ff 100%);
  box-shadow: var(--shadow);
}

.action-band p {
  max-width: 640px;
  margin-bottom: 0;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.next-step {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid #b9dcff;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef8ff 0%, #ffffff 100%);
  box-shadow: 0 12px 34px rgba(7, 26, 58, 0.06);
}

.next-step h2,
.next-step p {
  margin-bottom: 0;
}

.next-step .primary {
  width: fit-content;
}

.quick-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.quick-link {
  display: grid;
  justify-items: start;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 34px rgba(7, 26, 58, 0.06);
}

.quick-link strong {
  color: var(--navy);
  font-size: 17px;
}

.quick-link span {
  color: var(--muted);
  line-height: 1.35;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(7, 26, 58, 0.06);
}

.metric span {
  color: var(--primary);
  font-size: 28px;
  font-weight: 800;
}

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

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

.panel,
.form,
.profile-card,
.profile-ready {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.profile-ready {
  margin-bottom: 14px;
  background: linear-gradient(135deg, #eef8ff 0%, #ffffff 100%);
}

.profile-ready .section-head {
  margin-bottom: 0;
}

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

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

.profile-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.profile-block.is-empty {
  border-style: dashed;
  background: #fbfdff;
}

.profile-block-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-block h3,
.profile-block p,
.profile-block small {
  margin-bottom: 0;
}

.profile-block p {
  white-space: normal;
  overflow-wrap: anywhere;
}

.required-mark,
.optional-mark {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.required-mark {
  background: #e8f4ff;
  color: var(--primary);
}

.optional-mark {
  background: #f0f4f8;
  color: var(--muted);
}

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

.wide {
  grid-column: 1 / -1;
}

.admin-summary .metric-grid {
  margin-bottom: 0;
}

.admin-summary .metric {
  min-height: 86px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #e9f7ff;
  color: var(--navy);
  font-weight: 700;
}

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

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.person {
  grid-template-columns: 64px 1fr auto;
}

.item p {
  margin-bottom: 8px;
}

.item em {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-style: normal;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.avatar,
.photo-slot {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
  color: var(--primary);
  font-weight: 800;
}

.avatar.large {
  width: 124px;
  height: 124px;
  margin-bottom: 16px;
}

.avatar img,
.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.after-phone {
  display: grid;
  gap: 14px;
}

.no-phone .after-phone {
  opacity: 0.42;
  pointer-events: none;
  user-select: none;
}

.phone-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #b9dcff;
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(135deg, #eef8ff 0%, #ffffff 100%);
}

.phone-step.done {
  border-color: #b9f0dc;
  background: #f1fff9;
}

.phone-step h3,
.phone-step p {
  margin-bottom: 0;
}

.phone-step p {
  max-width: 560px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.compact-select {
  min-width: min(340px, 100%);
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 120, 255, 0.12);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

legend {
  color: var(--muted);
  font-weight: 800;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.check,
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check input,
.switch input {
  width: auto;
}

.photo-explain {
  display: grid;
  gap: 6px;
  border: 1px solid #cfe8fb;
  border-radius: 8px;
  padding: 14px;
  background: #eef8ff;
}

.photo-explain h3,
.photo-explain p {
  margin-bottom: 0;
}

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

.photo-slot {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 8px;
  border-style: dashed;
  background: linear-gradient(180deg, #f5fbff 0%, #eaf6ff 100%);
  cursor: pointer;
}

.photo-slot.has-photo {
  border-style: solid;
}

.photo-placeholder {
  display: grid;
  gap: 6px;
  max-width: 100%;
  padding: 12px;
  text-align: center;
}

.photo-placeholder strong {
  color: var(--primary);
  font-size: clamp(16px, 4.5vw, 20px);
  line-height: 1.05;
}

.photo-placeholder small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}

.photo-upload-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(7, 26, 58, 0.12);
  overflow: hidden;
  cursor: pointer;
}

.photo-upload-button span {
  pointer-events: none;
}

.photo-upload-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.empty {
  min-height: 78px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(560px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(23, 26, 31, 0.45);
}

dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 24px);
  max-width: min(460px, calc(100% - 32px));
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--navy);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.public-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.public-hero {
  min-height: 54vh;
  display: grid;
  align-content: end;
  padding: 28px 0;
}

.public-hero h1 {
  max-width: 720px;
}

.public-details {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0 0 10px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

.admin-photos {
  display: flex;
  gap: 6px;
}

.admin-photos img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

@media (max-width: 780px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .action-band,
  .phone-step,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .balance {
    width: 100%;
  }

  .columns,
  .admin-grid,
  .registration-intro,
  .form-grid,
  .metric-grid,
  .metric-grid.compact,
  .quick-sections,
  .check-grid {
    grid-template-columns: 1fr;
  }

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

  .photo-slot {
    aspect-ratio: 2.6 / 1;
  }

  .item,
  .person,
  .profile-block {
    grid-template-columns: 1fr;
  }

  .item-actions {
    justify-content: flex-start;
  }

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

  .action-buttons button,
  .next-step .primary {
    width: 100%;
  }
}
