/* Caporales San Simón La Paz - Barcelona — community app (dark: black / dark blue / red / minimal white) */
:root {
  --bg: #0A0E15;
  --surface: #121B2B;
  --ink: #F2F5FA;
  --ink-soft: #8593A9;
  --green: #C41E2A;      /* primary red */
  --green-2: #E23B45;    /* bright red */
  --gold: #E23B45;       /* CTA red */
  --gold-2: #A3121E;     /* deep red */
  --blue: #35507E;       /* dark blue accent */
  --blue-2: #4A6BA5;     /* brighter blue */
  --terra: #FF5A5F;      /* event dots */
  --line: #223049;
  --danger: #E23B45;
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
  max-width: 520px; margin: 0 auto;
  min-height: 100dvh;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); margin: 22px 4px 10px; }

/* ---------- join ---------- */
.join { position: fixed; inset: 0; z-index: 50;
  background: linear-gradient(165deg, #101A2E 0%, #07090F 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.join-inner { width: 100%; max-width: 340px; text-align: center; color: #F2F5FA; }
.join-logo { width: 96px; height: 96px; border-radius: 24px;
  box-shadow: 0 8px 30px rgba(226, 59, 69, .35); margin-bottom: 18px; }
.join h1 { font-size: 26px; margin-bottom: 6px; }
.join .tagline { color: #8FA3C8; font-size: 14px; margin-bottom: 26px; }
.join-sub { font-size: 14px; color: #B9C6DE; margin-bottom: 14px; }
.join input { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2);
  color: #fff; text-align: center; font-size: 17px; padding: 13px; margin-bottom: 12px; }
.join input::placeholder { color: rgba(255,255,255,.45); }
.join input:focus { border-color: var(--gold); }

/* ---------- topbar ---------- */
#topbar {
  background: #0C1220; color: #F2F5FA;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 12px; line-height: 1.2; white-space: normal; overflow: hidden; }
.top-right { display: flex; align-items: center; gap: 9px; }
.lang-btn { background: rgba(255,255,255,.1); border: none; color: #fff;
  border-radius: 8px; padding: 5px 9px; font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.lang-btn:active { background: rgba(255,255,255,.22); }

/* ---------- avatars ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--blue);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex: none; user-select: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xs { width: 26px; height: 26px; font-size: 10px; margin-left: -7px;
  border: 2px solid var(--surface); }
.avatar:first-child { margin-left: 0; }

/* ---------- main / tabs ---------- */
#main { flex: 1; padding: 16px 14px 110px; overflow-y: auto; }
.tab { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

/* ---------- clock ---------- */
.clock-card {
  background: var(--surface); border-radius: 20px; padding: 26px 16px 24px;
  text-align: center; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.clock-label { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
#timer-display { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: .02em; margin-bottom: 16px; color: var(--ink); }
.clock-btn {
  border: none; border-radius: 999px; padding: 16px 40px; font-size: 17px; font-weight: 800;
  color: #fff; background: linear-gradient(180deg, var(--gold), var(--gold-2));
  box-shadow: 0 6px 18px rgba(226, 59, 69, .35);
}
.clock-btn:active { transform: scale(.97); }
.clock-btn.active {
  color: #fff; background: linear-gradient(180deg, var(--blue-2), var(--blue));
  box-shadow: 0 0 0 0 rgba(74, 107, 165, .5);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 107, 165, .45); }
  70% { box-shadow: 0 0 0 14px rgba(74, 107, 165, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 107, 165, 0); }
}
.stats-row { display: flex; gap: 8px; margin-top: 12px; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 6px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }

.sess { display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  box-shadow: var(--shadow); }
.sess .t { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.sess .d { color: var(--ink-soft); font-size: 13px; margin-left: auto; }
.sess.live { border-color: var(--blue-2); }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: var(--blue-2);
  animation: blink 1.2s infinite; flex: none; }
@keyframes blink { 50% { opacity: .3; } }
.empty { color: var(--ink-soft); font-size: 14px; padding: 6px 4px; }

/* ---------- ranking ---------- */
.seg { display: flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: none; background: none; padding: 8px; border-radius: 9px;
  font-weight: 700; color: var(--ink-soft); }
.seg button.on { background: var(--green); color: #fff; }
.rank-card { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px;
  box-shadow: var(--shadow); }
.rank-card.top1 { border-color: var(--gold); background: linear-gradient(135deg, var(--surface), #201318); }
.rank-card.top2 { border-color: #9FB0C6; }
.rank-card.top3 { border-color: #9C7A4C; }
.rank-pos { width: 26px; text-align: center; font-weight: 800; font-size: 16px; color: var(--ink-soft); flex: none; }
.rank-card.top1 .rank-pos { color: var(--gold); font-size: 20px; }
.rank-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { font-size: 12px; color: var(--ink-soft); }
.rank-hours { margin-left: auto; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
  white-space: nowrap; }

/* ---------- forum ---------- */
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 10px 12px; box-shadow: var(--shadow); margin-bottom: 16px; }
.composer-row { display: flex; gap: 10px; }
.composer textarea { resize: none; margin-top: 2px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.announce-toggle { font-size: 13px; font-weight: 600; color: var(--ink-soft);
  display: flex; gap: 6px; align-items: center; cursor: pointer; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.post.announcement { border-left: 4px solid var(--gold); background: linear-gradient(135deg, var(--surface) 60%, #201318); }
.post-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.post-name { font-weight: 700; font-size: 14px; }
.post-role { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  background: var(--green); color: #fff; border-radius: 6px; padding: 2px 6px; }
.post-role.trusted { background: var(--blue); }
.post-badge { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--terra); }
.post-body { font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.post-time { font-size: 11.5px; color: var(--ink-soft); margin-top: 8px; }
.comments { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }
.comment { display: flex; gap: 8px; margin-bottom: 8px; }
.comment .c-body { font-size: 13px; line-height: 1.4; background: var(--bg); border-radius: 10px;
  padding: 6px 10px; flex: 1; }
.comment .c-name { font-weight: 700; font-size: 12px; margin-right: 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 6px; }
.comment-form input { flex: 1; padding: 8px 10px; font-size: 13px; }
.comment-form button { border: none; background: var(--green); color: #fff; border-radius: 10px;
  padding: 8px 12px; font-weight: 700; font-size: 13px; flex: none; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-label { font-weight: 800; font-size: 16px; text-transform: capitalize; }
.cal-nav { border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  width: 34px; height: 34px; font-size: 20px; color: var(--ink); line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 800; color: var(--ink-soft);
  text-transform: uppercase; padding: 4px 0; }
.cal-day { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 13px; color: var(--ink-soft);
  position: relative; border: 1.5px solid transparent; }
.cal-day.other { opacity: .35; }
.cal-day.today { border-color: var(--gold); font-weight: 800; color: var(--ink); }
.cal-day .ev-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--terra); position: absolute; bottom: 5px; }
.cal-day.has-ev { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font-weight: 600; }
#ev-new-btn { width: 100%; margin-bottom: 6px; padding: 12px; border: none; border-radius: 12px;
  font-weight: 800; color: #fff; background: linear-gradient(180deg, var(--gold), var(--gold-2)); }
.ev { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.ev.past { opacity: .55; }
.ev-top { display: flex; gap: 12px; align-items: flex-start; }
.ev-date { width: 48px; flex: none; text-align: center; background: var(--green); color: #fff;
  border-radius: 12px; padding: 6px 4px; }
.ev-date b { display: block; font-size: 19px; line-height: 1.1; }
.ev-date span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.ev-title { font-weight: 800; font-size: 15px; }
.ev-meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.ev-notes { font-size: 13px; margin-top: 6px; line-height: 1.4; }
.ev-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.ev-who { display: flex; align-items: center; }
.ev-who span { font-size: 11.5px; color: var(--ink-soft); margin-left: 7px; }
.rsvp-btns { display: flex; gap: 6px; flex: none; }
.rsvp { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 11px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.rsvp.on-in { background: var(--green); border-color: var(--green); color: #fff; }
.rsvp.on-out { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- team ---------- */
#me-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
#me-card .m-name { flex: 1; }
#me-card input { margin-bottom: 6px; font-weight: 700; }
#me-card .m-hours { font-size: 12.5px; color: var(--ink-soft); }
.member { display: flex; align-items: center; gap: 11px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.member .m-name { font-weight: 700; font-size: 14px; }
.member .m-sub { font-size: 12px; color: var(--ink-soft); }
.member .m-right { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.member .m-hours { font-size: 12.5px; font-weight: 700; }
.role-badge { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 6px; padding: 1px 6px; }
.role-badge.caporal { background: var(--gold); border-color: var(--gold); color: #fff; }
.role-badge.trusted { background: var(--blue); border-color: var(--blue); color: #fff; }
.role-badge.owner { background: #C41E2A; border-color: #C41E2A; color: #fff; }
.role-select { font-size: 11px; font-weight: 700; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 8px; padding: 3px 6px; }
.star-btn { border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px;
  font-size: 13px; padding: 3px 8px; color: var(--ink-soft); }
.star-btn.on { border-color: var(--gold); background: #2A1519; }

/* ---------- bottom nav ---------- */
#bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 20;
  background: #0C1220; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
#bottomnav button { border: none; background: none; display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 6px 10px; border-radius: 12px;
  color: var(--ink-soft); font-size: 10.5px; font-weight: 700; min-width: 56px; }
#bottomnav svg { width: 23px; height: 23px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#bottomnav button.on { color: var(--gold); }
#bottomnav button.on svg { stroke: var(--gold); }
#bottomnav button:active { background: var(--surface); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(4, 8, 14, .65);
  display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px 16px;
  width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 10px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.modal-card h3 { font-size: 17px; margin-bottom: 2px; }
.ev-times { display: flex; gap: 10px; }
.ev-times input { flex: 1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- buttons / toast ---------- */
.btn-gold { border: none; border-radius: 12px; padding: 12px 20px; font-weight: 800; font-size: 15px;
  color: #fff; background: linear-gradient(180deg, var(--gold), var(--gold-2)); }
.btn-gold:active { transform: scale(.98); }
.btn-gold.sm { padding: 8px 16px; font-size: 13.5px; border-radius: 10px; }
.btn-ghost { border: 1.5px solid var(--line); background: none; border-radius: 12px;
  padding: 12px 18px; font-weight: 700; color: var(--ink-soft); }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 10px 18px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); max-width: 88vw; text-align: center; }
