:root {
  --bg: #FEEEEB;
  --card: rgba(255, 255, 255, 0.9);
  --text: #4F0433;
  --muted: #7a5a6c;
  --line: rgba(79, 4, 51, 0.08);

  --blue: #870052;
  --blue-dark: #4F0433;
  --blue-soft: #EDF4F4;

  --success: #EDF4F4;
  --success-text: #4F0433;

  --shadow: 0 20px 50px rgba(79, 4, 51, 0.12);
  --radius: 28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(92, 45, 145, 0.13), transparent 28%),
    linear-gradient(180deg, #fcfaff, var(--bg));
  color: var(--text);
}

.shell { max-width: 1280px; margin: 0 auto; padding: 28px; }

.topbar, .section-head, .search-row, .pager, .grid-two, .grid-three { display: flex; gap: 16px; }
.topbar, .section-head, .pager { align-items: center; justify-content: space-between; }

.grid { display: grid; grid-template-columns: 420px 1fr; gap: 24px; }
.single-panel { display: grid; place-items: center; min-height: 70vh; }

.stack { display: flex; flex-direction: column; }
.gap-md { gap: 14px; }
.gap-lg { gap: 24px; }

.card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero-card { width: min(460px, 100%); }

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
}

.topbar h1,
.section-head h2,
.hero-card h2,
.app-link-card h3 {
  color: var(--blue-dark);
}

.subtle {
  color: var(--muted);
  margin-top: 6px;
}

.banner {
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: 18px;
}

.banner.success {
  background: var(--success);
  color: var(--success-text);
}

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.ios-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(250, 247, 253, 0.96);
  color: var(--text);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
}

.ios-input:focus {
  border-color: rgba(92, 45, 145, 0.40);
  box-shadow: 0 0 0 4px rgba(92, 45, 145, 0.10);
}

textarea.ios-input {
  resize: vertical;
  min-height: 110px;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 18px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.18s ease;
}

.primary-button {
  background: linear-gradient(180deg, #7340af, var(--blue));
  color: white;
}

.primary-button:hover {
  background: linear-gradient(180deg, #65379b, var(--blue-dark));
}

.ghost-button {
  background: var(--blue-soft);
  color: var(--blue);
}

.ghost-button:hover {
  background: #e7ddf5;
  color: var(--blue-dark);
}

.ghost-button.disabled {
  pointer-events: none;
  opacity: .4;
}

.error-text {
  color: #b42318;
  min-height: 20px;
  margin: 0;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.list-head {
  align-items: flex-start;
}

.search-row {
  width: min(380px, 100%);
}

.search-row .ios-input {
  flex: 1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(247, 242, 251, 0.95);
  position: sticky;
  top: 0;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 800;
}

.pill-link {
  text-decoration: none;
}

.pill-link:hover {
  filter: brightness(.98);
}

.empty {
  text-align: center;
  color: var(--muted);
}

.shell-narrow { max-width: 1480px; }

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

.detail-topbar {
  margin-bottom: 18px;
}

.info-card {
  padding-bottom: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.meta-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.meta-value {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.notes-box {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.notes-text {
  margin: 0;
  line-height: 1.5;
}

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

.tiny {
  font-size: 12px;
  color: var(--muted);
}

.notes-column {
  min-width: 260px;
  line-height: 1.45;
}

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

.inline-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.inline-link:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.app-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.app-link-card {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(92, 45, 145, 0.15);
  background: linear-gradient(180deg, #ffffff 0%, #f7f2fc 100%);
}

.app-link-card p {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
}

.participant-intro {
  padding: 1rem 0;
}

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .topbar, .section-head, .search-row, .pager { flex-direction: column; align-items: stretch; }
  .grid-two, .grid-three { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .header-actions { flex-direction: column; align-items: stretch; }
  .shell { padding: 18px; }
}

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

.grid-two-analysis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.stat-box {
  border: 1px solid var(--line);
  background: rgba(247, 242, 251, 0.75);
  border-radius: 20px;
  padding: 14px 16px;
}

.map-box {
  width: 100%;
  height: 460px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-top: 10px;
}

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