:root {
  --red: #b4233a;
  --red-dark: #8b1538;
  --red-soft: #fdecee;
  --ink: #1f1a1c;
  --muted: #6b5f63;
  --line: #eadfe3;
  --bg: #fff7f8;
  --card: #ffffff;
  --ok: #157a4b;
  --radius: 18px;
  --tap: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 400px at 50% -80px, #f7c9d2 0%, transparent 70%),
    var(--bg);
}

.shell {
  padding: 18px 18px calc(28px + env(safe-area-inset-bottom));
}

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

.drop {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--red-dark);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(139, 21, 56, 0.06);
}

label.field {
  display: block;
}

.field {
  margin-bottom: 16px;
}

.field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="search"] {
  width: 100%;
  height: var(--tap);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  width: 100%;
  min-height: 88px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: vertical;
}

textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(180, 35, 58, 0.12);
}

.optional {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
}

.phone-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.phone-wrap:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(180, 35, 58, 0.12);
}

.prefix {
  padding: 0 12px;
  height: var(--tap);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--red-dark);
  background: var(--red-soft);
  border-right: 1.5px solid var(--line);
}

.phone-wrap input {
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.seg, .gender {
  display: grid;
  gap: 8px;
}

.seg { grid-template-columns: 1fr 1fr; }
.gender { grid-template-columns: 1fr 1fr 1fr; }

.choice {
  height: var(--tap);
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.choice.active {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red-dark);
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: -8px;
  margin-bottom: 14px;
}

.save {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--red-dark);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  margin-top: 6px;
}

.save:disabled { opacity: 0.65; }

.error {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff1f2;
  color: #9f1239;
  font-size: 14px;
}

.error.show { display: block; }

.success {
  text-align: center;
  padding: 28px 8px 8px;
}

.success .mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #e8f8ef;
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 34px;
}

.success h2 { font-size: 22px; margin-bottom: 6px; }
.success p { color: var(--muted); margin-bottom: 22px; }

.ghost {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 650;
}

.photo-box {
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  min-height: 180px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.photo-placeholder {
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

.photo-box img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-actions .ghost {
  height: 48px;
  font-size: 14px;
  padding: 0 8px;
}

.donor-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: start;
}

.thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--red-soft);
}

.count {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

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

.row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.row strong { display: block; font-size: 15px; }
.row small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

.wa {
  display: inline-block;
  margin-top: 8px;
  color: var(--red-dark);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}

.empty { color: var(--muted); text-align: center; padding: 24px 8px; }

.admin-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: #b9a8ad;
  font-size: 12px;
  text-decoration: none;
}

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

.camera {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
}

.camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 22px calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
}

.camera-text {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
}

.camera-text:last-child { justify-self: end; }

.camera-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.25);
}

.hidden { display: none !important; }

.donor-row { cursor: pointer; }

.detail-photo {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 16px;
  background: var(--red-soft);
  margin-bottom: 12px;
}

.ok-msg {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e8f8ef;
  color: var(--ok);
  font-size: 14px;
}

.ok-msg.show { display: block; }
