:root {
  --pink: #ff4d6d;
  --pink-dark: #c9184a;
  --bg: #fff5f7;
  --card: #ffffff;
  --text: #2b2035;
  --muted: #8a7f92;
  --border: #f0dbe1;
  --success: #2a9d8f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
}
body { padding-bottom: env(safe-area-inset-bottom); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  color: white;
}
.brand { font-weight: 700; font-size: 18px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav.hidden { display: none; }
.navbtn {
  border: none; background: rgba(255,255,255,0.18); color: white;
  padding: 7px 10px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.navbtn.active { background: white; color: var(--pink-dark); }
.navbtn.logout { background: rgba(0,0,0,0.2); }
.adminOnly.hidden { display: none; }

main { max-width: 640px; margin: 0 auto; padding: 16px; padding-bottom: 60px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(200,20,70,0.05);
}
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 18px; margin: 0 0 10px; }
p.sub { color: var(--muted); font-size: 14px; margin-top: -8px; margin-bottom: 16px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: #5a4b60; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; background: #fffafb; color: var(--text); font-family: inherit;
}
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pink); border-color: var(--pink); }

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

.btn {
  display: inline-block; width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark)); color: white;
  font-size: 16px; font-weight: 700; margin-top: 16px;
}
.btn:disabled { opacity: 0.5; }
.btn.secondary { background: #efe3e7; color: var(--pink-dark); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; margin-top: 0; }
.linkbtn { background: none; border: none; color: var(--pink-dark); font-weight: 600; font-size: 14px; padding: 0; }

.error { background: #fde2e4; color: #9d0208; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 12px; }
.success { background: #d8f3dc; color: #1b4332; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 12px; }
.notice { background: #fff3cd; color: #7a5b00; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.photo-picker {
  display: flex; align-items: center; gap: 14px; margin-top: 8px;
}
.photo-preview {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  background: #f3e6ea; border: 2px solid var(--border); flex-shrink: 0;
}
.photo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.photo-actions .btn { margin-top: 0; }

.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }

.profile-card { padding: 0; overflow: hidden; position: relative; }
.profile-photo { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f3e6ea; display: block; }
.profile-body { padding: 12px; }
.profile-name { font-weight: 700; font-size: 16px; }
.profile-age { color: var(--muted); font-weight: 500; }
.profile-line { font-size: 13px; color: #6b5c70; margin-top: 4px; }
.profile-line b { color: var(--text); }
.select-row {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.select-row input[type=checkbox] { width: 20px; height: 20px; }
.select-row label { margin: 0; font-size: 14px; font-weight: 600; color: var(--pink-dark); }

.match-card { display: flex; align-items: center; gap: 12px; }
.match-card img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.match-card .info { flex: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #2b2035; color: white; padding: 10px 18px; border-radius: 30px;
  font-size: 14px; z-index: 50; box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.toast.hidden { display: none; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge.admin { background: #ffe8d6; color: #bc6c25; }
.badge.match { background: #d8f3dc; color: #1b4332; }
.codebox { background: #2b2035; color: #f3e6ea; padding: 12px; border-radius: 10px; font-family: monospace; font-size: 14px; letter-spacing: 1px; text-align: center; }

.submit-bar {
  position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 4px;
  margin-top: -4px;
}
.count-pill {
  display: inline-block; background: var(--pink); color: white; border-radius: 20px;
  padding: 2px 9px; font-size: 12px; margin-left: 6px;
}
