:root {
  --bg: #0f1729;
  --bg-card: #1b2540;
  --bg-card2: #233056;
  --accent: #4f8cff;
  --accent2: #38d39f;
  --danger: #ff5d6c;
  --warn: #ffb547;
  --text: #eef2fb;
  --muted: #8a98bd;
  --border: #2c3a63;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, #1b2540, #0f1729);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 30px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.brand small { color: var(--muted); font-size: 12px; }
#logout { margin-left: auto; background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--muted); font-size: 18px; width: 38px; height: 38px; border-radius: 10px;
  cursor: pointer; }

main { padding: 16px; max-width: 760px; margin: 0 auto; }

/* tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; background: none; border: none; color: var(--muted);
  font-size: 11px; padding: 10px 4px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; cursor: pointer; font-weight: 600;
}
.tabbar button span { font-size: 20px; }
.tabbar button.active { color: var(--accent); }

/* cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.section-title { display:flex; justify-content: space-between; align-items:center; margin: 4px 0 14px; }
.section-title h2 { margin: 0; font-size: 18px; }

/* botones */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 12px;
  padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
}
.btn:active { transform: scale(.97); }
.btn.green { background: var(--accent2); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }

/* listado jóvenes / asistencia */
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; margin-bottom: 9px;
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: var(--bg-card2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--accent); font-size: 17px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; }
.row-main .name { font-weight: 700; font-size: 15px; }
.row-main .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* toggle presente */
.check {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border);
  background: transparent; color: var(--muted); font-size: 20px; cursor: pointer;
  display:flex; align-items:center; justify-content:center; flex-shrink: 0;
  transition: all .12s;
}
.check.on { background: var(--accent2); border-color: var(--accent2); color: #06231a; }

/* inputs */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 11px; padding: 11px 12px; font-size: 15px;
  font-family: inherit;
}
.field textarea { min-height: 64px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* badges / pills */
.pill { display:inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill.good { background: rgba(56,211,159,.16); color: var(--accent2); }
.pill.warn { background: rgba(255,181,71,.16); color: var(--warn); }
.pill.bad { background: rgba(255,93,108,.16); color: var(--danger); }
.pill.muted { background: var(--bg-card2); color: var(--muted); }

.search {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 15px;
  margin-bottom: 12px;
}

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

/* stat */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--bg-card); border:1px solid var(--border); border-radius: 14px; padding: 12px; text-align:center; }
.stat .num { font-size: 22px; font-weight: 800; }
.stat .lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* barra progreso */
.bar { height: 7px; background: var(--bg-card2); border-radius: 8px; overflow: hidden; margin-top: 6px; }
.bar > i { display:block; height: 100%; background: var(--accent2); border-radius: 8px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(5,9,20,.72); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; }
.modal.hidden { display: none; }
.modal-card { background: var(--bg); width: 100%; max-width: 600px; max-height: 92vh;
  overflow-y: auto; border-radius: 22px 22px 0 0; padding: 20px 18px 30px;
  border: 1px solid var(--border); }
.modal-head { display:flex; justify-content: space-between; align-items:center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head .x { background:none;border:none;color:var(--muted);font-size:26px;cursor:pointer;line-height:1; }

/* toast */
.toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card2); color: var(--text); padding: 11px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; z-index: 60; border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.hidden { display: none; }

.foto-preview { width: 90px; height: 90px; border-radius: 50%; object-fit: cover;
  background: var(--bg-card2); display:flex; align-items:center; justify-content:center;
  margin: 0 auto 10px; overflow: hidden; border: 2px solid var(--border); font-size: 34px; }
.foto-preview img { width:100%; height:100%; object-fit: cover; }

.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { height: 8px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
