@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;600;700&family=Source+Sans+3:wght@300;400;600&display=swap');

:root {
  --red: #9C1E09;
  --red-dark: #7a1607;
  --red-light: #c22610;
  --white: #FFFFFF;
  --off-white: #f7f4f2;
  --gray-light: #ede9e7;
  --gray: #a09890;
  --text: #1a1210;
  --shadow: 0 2px 12px rgba(156,30,9,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--off-white);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

header {
  background: var(--red);
  color: var(--white);
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.logo-circle {
  width: 44px;
  height: 44px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-circle img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 50%;
}

.header-text { flex: 1; }
.header-text h1 {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.1;
}
.header-text p {
  font-size: 11px;
  opacity: 0.85;
  letter-spacing: 0.3px;
  margin-top: 1px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 4px 8px 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.search-container { padding: 16px; }

.stats-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.stat-pill {
  background: var(--red);
  color: var(--white);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

.search-box { position: relative; margin-bottom: 12px; }
.search-box input {
  width: 100%;
  padding: 13px 44px 13px 16px;
  border: 2px solid var(--gray-light);
  border-radius: 12px;
  font-size: 16px;
  font-family: 'Source Sans 3', sans-serif;
  background: var(--white);
  transition: border-color 0.2s;
  color: var(--text);
}
.search-box input:focus { outline: none; border-color: var(--red); }
.search-box .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 18px;
  pointer-events: none;
}

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-light);
  background: var(--white);
  font-size: 12px;
  font-family: 'Source Sans 3', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  font-weight: 600;
}
.filter-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.results-count {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-list { display: flex; flex-direction: column; gap: 8px; }

.child-card {
  background: var(--white);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s;
  border-left: 4px solid transparent;
}
.child-card:active { transform: scale(0.98); }
.child-card.has-allergy { border-left-color: #e65c00; }

.child-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.child-avatar.female { background: #8b1a6b; }

.child-info { flex: 1; min-width: 0; }
.child-name {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.child-meta {
  font-size: 12px;
  color: var(--gray);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-grest { background: #e8f4e8; color: #2d6b2d; }
.badge-estate { background: #fef3e2; color: #b05e00; }
.badge-mini { background: #e8eef8; color: #2d4b8b; }
.badge-sport { background: #e8f0f8; color: #1a5080; }
.badge-campo { background: #f0e8f4; color: #6b2d8b; }

.child-id { font-size: 11px; color: var(--gray); font-weight: 700; flex-shrink: 0; }

.profile-header {
  background: var(--red);
  color: var(--white);
  padding: 20px 16px 24px;
  position: relative;
}
.profile-avatar-big {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
}
.profile-name {
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.profile-sub { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.profile-id-badge {
  position: absolute;
  top: 20px; right: 16px;
  background: rgba(255,255,255,0.2);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.allergy-banner {
  background: #fff3e0;
  border-left: 4px solid #e65c00;
  padding: 10px 14px;
  margin: 12px 16px 0;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.allergy-banner .allergy-icon { font-size: 18px; flex-shrink: 0; }
.allergy-banner .allergy-title {
  font-size: 11px;
  font-weight: 700;
  color: #b05e00;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.allergy-banner .allergy-text {
  font-size: 13px;
  color: #7a3d00;
  font-weight: 600;
  line-height: 1.3;
}

.profile-sections { padding: 12px 16px 32px; }
.section-card {
  background: var(--white);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.section-title {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--gray-light);
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 5px 0;
  border-bottom: 1px solid var(--gray-light);
  gap: 10px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 12px;
  color: var(--gray);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 100px;
}
.info-value {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--red);
  color: var(--white);
  border-radius: 10px;
  padding: 12px;
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 10px;
  transition: background 0.15s;
}
.call-btn:active { background: var(--red-dark); }

.no-results { text-align: center; padding: 40px 20px; color: var(--gray); }
.no-results .no-results-icon { font-size: 40px; margin-bottom: 10px; }
.no-results p { font-size: 15px; }

.loading { text-align: center; padding: 40px; color: var(--gray); }

/* Actions, forms, menu sheet */
.action-row { display: flex; gap: 8px; margin-bottom: 12px; }
.action-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--gray-light);
  background: var(--white);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.action-btn.primary {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}
.header-action {
  background: none;
  border: none;
  color: var(--white);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}
.header-action.primary {
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
}

#screen-edit form { padding: 16px; }
.form-section {
  background: var(--white);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.form-section h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.form-row label {
  font-size: 12px;
  color: var(--gray);
  font-weight: 600;
}
.form-row input,
.form-row select,
.form-row textarea {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 15px;
  padding: 10px;
  border: 1px solid var(--gray-light);
  border-radius: 8px;
  background: var(--off-white);
  color: var(--text);
}
.form-row textarea { min-height: 60px; resize: vertical; }
.form-row.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.form-row.checkbox input { flex-shrink: 0; }

.danger-text { color: var(--red); font-weight: 700; }

.enrollment-block {
  border: 1px solid var(--gray-light);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.enrollment-block .remove {
  float: right;
  background: none;
  border: none;
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
}

.menu-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  z-index: 200;
}
.menu-sheet button {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  background: none;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  font-family: 'Source Sans 3', sans-serif;
}
.menu-sheet button.danger { color: var(--red); font-weight: 700; }
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--white);
  border-radius: 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.team-row .count { color: var(--gray); font-size: 14px; }
.team-row .actions { display: flex; gap: 6px; }
.team-row .actions .action-btn { flex: none; padding: 6px 10px; }
