:root {
  --coral: #fb7185;
  --rose: #f43f5e;
  --lavender: #ede9fe;
  --violet: #8b5cf6;
  --plum: #2d1436;
  --plum-soft: #4c1d4f;
  --text: #231225;
  --muted: #6b5b70;
  --line: rgba(76, 29, 79, 0.14);
  --surface: rgba(255, 255, 255, 0.86);
  --danger: #be123c;
  --success: #047857;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(251, 113, 133, 0.18), rgba(237, 233, 254, 0.72) 42%, rgba(255, 255, 255, 0.96)),
    #fff7fb;
  line-height: 1.5;
}

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

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 50px rgba(76, 29, 79, 0.12);
}

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

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

h1 {
  margin-bottom: 8px;
  color: var(--plum);
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  color: var(--plum);
  font-size: 24px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  color: var(--plum);
}

.subtitle,
.panel-header p,
.form-note,
.status,
.profile-card p,
.match-card p {
  color: var(--muted);
}

.subtitle {
  margin-bottom: 0;
}

.user-pill {
  flex: 0 0 auto;
  max-width: 190px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--lavender);
  color: var(--plum-soft);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.tab.is-active {
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--violet));
  box-shadow: 0 10px 24px rgba(244, 63, 94, 0.22);
}

.panel {
  display: none;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(76, 29, 79, 0.1);
}

.panel.is-active {
  display: block;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header p {
  margin-bottom: 0;
}

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

.form-card[hidden],
#profile-view[hidden],
.success-banner[hidden] {
  display: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--plum);
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 13px;
}

select {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  min-height: 118px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(244, 63, 94, 0.62);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button {
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
}

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

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--violet));
  box-shadow: 0 12px 28px rgba(244, 63, 94, 0.24);
}

.button-secondary {
  color: var(--plum);
  background: white;
  border-color: var(--line);
}

.form-note {
  margin: -2px 0 0;
  font-size: 14px;
}

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

.photo-preview {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.primary-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  color: white;
  background: rgba(45, 20, 54, 0.82);
  font-size: 12px;
  font-weight: 850;
}

.remove-photo {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: white;
  background: rgba(190, 18, 60, 0.9);
  padding: 0;
  font-size: 0;
  font-weight: 850;
  cursor: pointer;
}

.remove-photo::before {
  content: "×";
  display: block;
  font-size: 21px;
  line-height: 1;
  transform: translateY(-1px);
}

.success-banner {
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(4, 120, 87, 0.22);
  border-radius: var(--radius);
  color: var(--success);
  background: rgba(209, 250, 229, 0.9);
  font-weight: 850;
}

.status {
  min-height: 22px;
  margin-top: 14px;
  font-weight: 700;
}

.status.is-error {
  color: var(--danger);
}

.status.is-success {
  color: var(--success);
}

.profile-card,
.match-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.saved-profile-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 14px 34px rgba(76, 29, 79, 0.1);
}

.saved-profile-main-photo-wrap {
  margin: 10px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--lavender);
}

.saved-profile-main-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--lavender);
}

.saved-photo-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 10px 0;
}

.saved-photo-strip img {
  width: 100%;
  aspect-ratio: 1.4;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--lavender);
}

.saved-profile-body {
  padding: 16px;
}

.saved-profile-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.saved-profile-title-row h3 {
  margin-bottom: 8px;
}

.status-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--success);
  background: rgba(209, 250, 229, 0.95);
  font-size: 12px;
  font-weight: 850;
}

.profile-view-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.profile-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--lavender);
  object-fit: cover;
}

.profile-card p,
.match-card p {
  margin-bottom: 0;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.chip {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--plum-soft);
  background: var(--lavender);
  font-size: 13px;
  font-weight: 800;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.actions[hidden] {
  display: none;
}

.empty-state {
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  text-align: center;
  box-shadow: 0 14px 34px rgba(76, 29, 79, 0.08);
}

.empty-state[hidden] {
  display: none;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 999px;
  color: var(--rose);
  background: rgba(251, 113, 133, 0.12);
  font-size: 30px;
  font-weight: 850;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 460px;
  margin: 0 auto 16px;
  color: var(--muted);
}

.empty-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

@media (max-width: 520px) {
  .app-shell {
    padding: 12px 10px 24px;
  }

  .app-header {
    flex-direction: column;
    padding: 18px;
  }

  h1 {
    font-size: 30px;
  }

  .user-pill {
    max-width: 100%;
  }

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

  .panel {
    padding: 16px;
  }

  .field-grid,
  .actions,
  .profile-view-actions,
  .empty-actions {
    grid-template-columns: 1fr;
  }

  .photo-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saved-profile-title-row {
    flex-direction: column;
  }
}
