/* ============ Base ============ */
:root {
  --bg: #e9eef4;
  --card: #ffffff;
  --border: #e4eaf1;
  --text: #1c2733;
  --text-2: #5b6b7c;
  --text-3: #8d9aa9;
  --primary: #0e8ee9;
  --primary-600: #0b76c4;
  --primary-soft: #e6f3fd;
  --gold: #f6a723;
  --gold-soft: #fdf3df;
  --green: #16a34a;
  --green-soft: #e8f7ee;
  --red: #dc2626;
  --red-soft: #fdeaea;
  --purple: #7c3aed;
  --purple-soft: #f1eafd;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 30px rgba(16, 24, 40, .14);
}

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

html { scrollbar-gutter: stable; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

svg { display: block; }

/* ============ Topbar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.brand-logo {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #23b0ff, #0b76c4);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }

.search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text-3);
}

.search input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  color: var(--text);
}
.search input::placeholder { color: var(--text-3); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.token-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--gold-soft);
  border: 1px solid #f5dfae;
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  font-size: 14px;
  transition: transform .15s;
}
.token-chip:hover { transform: translateY(-1px); }
.token-chip b { font-size: 15px; }
.token-chip-label { color: #a97913; font-size: 12px; }

.coin {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd978, #f6a723 60%, #d8880c);
  box-shadow: inset 0 -2px 3px rgba(140, 85, 5, .4), inset 0 2px 3px rgba(255, 255, 255, .5);
  display: inline-block;
  flex-shrink: 0;
}
.coin::after { content: ""; }
.coin-sm { width: 15px; height: 15px; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: #f1f5f9;
}
.icon-btn:hover { background: #e5ecf3; }

.badge {
  position: absolute;
  top: -3px; right: -3px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid var(--card);
}

.me { border-radius: 50%; }

/* Notifications */
.notif-panel {
  position: absolute;
  right: max(24px, calc((100% - 1400px) / 2 + 24px));
  top: 60px;
  width: 340px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.notif-head { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.notif-item time { color: var(--text-3); font-size: 11.5px; display: block; }

/* ============ Layout ============ */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.col-left, .col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: none;
}
.col-left::-webkit-scrollbar, .col-right::-webkit-scrollbar { display: none; }

.col-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ============ Profile card ============ */
.profile-card { padding: 0; overflow: hidden; }

.profile-cover {
  height: 86px;
  background:
    radial-gradient(120px 70px at 80% 10%, rgba(255,255,255,.35), transparent 60%),
    linear-gradient(120deg, #35b6ff 0%, #0e8ee9 45%, #0a5fa8 100%);
  position: relative;
}
.profile-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 34px;
  background: var(--card);
  border-radius: 100% 100% 0 0 / 60px 60px 0 0;
}

.profile-body { padding: 0 18px 18px; text-align: center; margin-top: -38px; position: relative; }

.avatar {
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  user-select: none;
  flex-shrink: 0;
}
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.avatar-lg { width: 76px; height: 76px; font-size: 26px; border: 4px solid var(--card); box-shadow: var(--shadow); }

.profile-name { font-size: 16.5px; font-weight: 800; margin-top: 8px; }
.profile-role { color: var(--text-2); font-size: 13px; }
.profile-team { color: var(--primary); font-size: 13px; font-weight: 600; }

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.profile-stats > div + div { border-left: 1px solid var(--border); }
.profile-stats b { display: block; font-size: 16px; }
.profile-stats span { color: var(--text-3); font-size: 11.5px; }

.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--primary-600);
  font-weight: 700;
  font-size: 11.5px;
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 8px;
}

/* ============ Nav ============ */
.nav-card { padding: 10px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
  font-size: 13.5px;
  position: relative;
  text-align: left;
}
.nav-item:hover { background: #f4f8fc; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-600); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px; top: 8px; bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: var(--primary);
}
.nav-item .nav-count {
  margin-left: auto;
  background: #eef2f6;
  color: var(--text-2);
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 8px;
  font-weight: 700;
}
.nav-item.active .nav-count { background: #d2eafc; color: var(--primary-600); }

/* ============ Communities ============ */
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 12px; }

.community-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.community-item + .community-item { border-top: 1px solid #f1f5f9; }
.community-item .c-name { font-weight: 700; font-size: 13px; }
.community-item .c-type { color: var(--primary); font-size: 11.5px; font-weight: 600; }
.community-item .c-members { margin-left: auto; color: var(--text-3); font-size: 11.5px; text-align: right; }

/* ============ Main: composer ============ */
.composer { display: flex; flex-direction: column; gap: 14px; }
.composer-top { display: flex; gap: 12px; align-items: center; }
.composer-input {
  flex: 1;
  background: #f1f5f9;
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  outline: none;
}
.composer-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background .15s;
}
.composer-send:hover { background: var(--primary-600); }

.composer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-2);
  background: #fff;
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary-600); background: var(--primary-soft); }
.chip-btn .coin { width: 14px; height: 14px; }
.chip-cost { color: var(--gold); font-weight: 800; font-size: 11.5px; }

/* ============ Section heads / filters ============ */
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.view-sub { color: var(--text-2); font-size: 13px; width: 100%; }

.filters { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ Feed ============ */
.feed-item .feed-head { display: flex; gap: 11px; align-items: center; }
.feed-author { font-weight: 700; font-size: 14px; }
.feed-meta { color: var(--text-3); font-size: 12px; }
.feed-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
}
.tag-evento { background: var(--purple-soft); color: var(--purple); }
.tag-reto { background: var(--primary-soft); color: var(--primary-600); }
.tag-post { background: #eef2f6; color: var(--text-2); }
.tag-curso { background: var(--purple-soft); color: var(--purple); }
.tag-tarea { background: var(--green-soft); color: var(--green); }

.feed-body { margin-top: 10px; font-size: 13.5px; color: #33414f; }
.feed-body b { color: var(--text); }

.feed-embed {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  background: #fafcfe;
}
.feed-embed .embed-info { flex: 1; min-width: 0; }
.feed-embed .embed-title { font-weight: 700; font-size: 13.5px; }
.feed-embed .embed-meta { color: var(--text-3); font-size: 12px; margin-top: 2px; }

.feed-foot {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}
.feed-action { display: inline-flex; gap: 6px; align-items: center; }
.feed-action:hover { color: var(--primary-600); }
.feed-action.liked { color: var(--primary-600); }

/* ============ Event / challenge cards ============ */
.event-card, .challenge-card { display: flex; gap: 16px; }

.date-badge {
  width: 58px; height: 62px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-600);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.date-badge b { font-size: 21px; line-height: 1; }
.date-badge span { font-size: 11px; font-weight: 700; text-transform: uppercase; }

.ec-body { flex: 1; min-width: 0; }
.ec-title { font-size: 15px; font-weight: 800; }
.ec-desc { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.ec-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--text-3); font-size: 12px; }
.ec-meta span { display: inline-flex; align-items: center; gap: 5px; }

.ec-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; flex-shrink: 0; }

.cost-pill, .reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}
.cost-pill { background: var(--gold-soft); color: #a97913; }
.cost-pill.free { background: var(--green-soft); color: var(--green); }
.reward-pill { background: var(--green-soft); color: var(--green); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-outline { border: 1.5px solid var(--primary); color: var(--primary-600); background: #fff; }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { color: var(--text-2); border: 1.5px solid var(--border); background: #fff; }
.btn-ghost:hover { color: var(--red); border-color: #f3c8c8; background: var(--red-soft); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #128a3f; }
.btn-done { background: var(--green-soft); color: var(--green); cursor: default; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* Challenge specifics */
.challenge-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ci-curso { background: var(--purple-soft); color: var(--purple); }
.ci-tarea { background: var(--green-soft); color: var(--green); }

.progress-wrap { margin-top: 12px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-bottom: 5px; }
.progress-bar { height: 8px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #35b6ff, var(--primary)); border-radius: 999px; transition: width .4s; }

.difficulty { display: inline-flex; gap: 3px; }
.difficulty i { width: 7px; height: 7px; border-radius: 50%; background: #dde5ec; }
.difficulty i.on { background: var(--gold); }

.proposed-by { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.proposed-by b { color: var(--primary-600); }

/* ============ Wallet ============ */
.wallet-balance { display: flex; align-items: center; gap: 12px; }
.wallet-coin { width: 44px; height: 44px; }
.wallet-amount { font-size: 26px; font-weight: 800; line-height: 1.1; }
.wallet-label { color: var(--text-3); font-size: 12px; }

.wallet-next {
  margin-top: 12px;
  background: #f7fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  gap: 8px;
  align-items: center;
}
.wallet-next b { color: var(--text); }

/* Wallet view (full page) */
.wallet-hero {
  background:
    radial-gradient(180px 100px at 85% 15%, rgba(255,255,255,.25), transparent 60%),
    linear-gradient(120deg, #35b6ff, #0a5fa8);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
}
.wallet-hero .wallet-amount { font-size: 38px; color: #fff; }
.wallet-hero .wallet-label { color: #cfe9ff; }
.wallet-hero .wallet-coin { width: 58px; height: 58px; }
.wallet-hero-right { margin-left: auto; text-align: right; font-size: 13px; color: #dcefff; }
.wallet-hero-right b { display: block; color: #fff; font-size: 15px; }

.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.rule-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.rule-box .rule-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; }
.rule-box b { font-size: 13px; display: block; }
.rule-box span { font-size: 12px; color: var(--text-2); }

.tx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tx-table th { text-align: left; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.tx-table td { padding: 10px 6px; border-bottom: 1px solid #f1f5f9; }
.tx-table tr:last-child td { border-bottom: none; }
.tx-amount { font-weight: 800; white-space: nowrap; }
.tx-amount.pos { color: var(--green); }
.tx-amount.neg { color: var(--red); }

.reset-link { color: var(--text-3); font-size: 12px; text-decoration: underline; cursor: pointer; background: none; }
.reset-link:hover { color: var(--red); }

/* ============ Leaderboard ============ */
.lb-item { display: flex; align-items: center; gap: 11px; padding: 9px 0; }
.lb-item + .lb-item { border-top: 1px solid #f1f5f9; }
.lb-rank { width: 26px; text-align: center; font-weight: 800; color: var(--text-3); flex-shrink: 0; }
.lb-rank .medal { font-size: 19px; }
.lb-name { font-weight: 700; font-size: 13px; }
.lb-points { color: var(--text-3); font-size: 11.5px; }
.lb-item.is-me { background: var(--primary-soft); margin: 0 -10px; padding: 9px 10px; border-radius: var(--radius-sm); border-top: none; }
.lb-item.is-me .lb-name { color: var(--primary-600); }
.lb-delta { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--green); background: var(--green-soft); border-radius: 999px; padding: 2px 9px; }

/* Ranking full view rows reuse lb-item */
.ranking-list .lb-item { padding: 12px 0; }

/* ============ Upcoming mini ============ */
.up-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.up-item + .up-item { border-top: 1px solid #f1f5f9; }
.up-date {
  width: 42px; height: 44px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-600);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.up-date b { font-size: 15px; line-height: 1; }
.up-date span { font-size: 9.5px; font-weight: 700; text-transform: uppercase; }
.up-title { font-weight: 700; font-size: 12.5px; }
.up-meta { color: var(--text-3); font-size: 11px; }

.see-more {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  border: 1.5px solid var(--primary);
  color: var(--primary-600);
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
}
.see-more:hover { background: var(--primary-soft); }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 45, .45);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn .15s;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-close { color: var(--text-3); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.modal-close:hover { background: #f1f5f9; color: var(--text); }

.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }

.field label { display: block; font-weight: 700; font-size: 12.5px; margin-bottom: 5px; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  outline: none;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  cursor: pointer;
}
.type-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.type-option b { display: block; font-size: 13px; }
.type-option span { font-size: 11.5px; color: var(--text-2); }

.modal-cost {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gold-soft);
  border: 1px solid #f5dfae;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
}
.modal-cost b { color: #a97913; }
.modal-cost.insufficient { background: var(--red-soft); border-color: #f3c8c8; }
.modal-cost.insufficient b { color: var(--red); }

.modal-foot { padding: 0 22px 22px; display: flex; gap: 10px; justify-content: flex-end; }

/* ============ Toasts ============ */
.toast-root {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #1c2733;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn .25s;
  max-width: 340px;
}
.toast.success { background: #14532d; }
.toast.error { background: #7f1d1d; }
.toast .coin { width: 16px; height: 16px; }

/* ============ Empty state ============ */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
}
.empty .empty-icon { font-size: 34px; margin-bottom: 8px; }

/* ============ Animations ============ */
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .col-right { display: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px 12px 60px; }
  .col-left { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .col-left > * { flex: 1 1 240px; }
  .search { display: none; }
  .notif-panel { right: 12px; }
}

/* ============ Pantalla de acceso ============ */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(53,182,255,.25), transparent 60%),
    radial-gradient(500px 300px at 10% 110%, rgba(14,142,233,.18), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-brand .brand-logo { width: 44px; height: 44px; font-size: 24px; border-radius: 14px; }
.auth-brand h1 { font-size: 20px; letter-spacing: -.02em; }
.auth-sub { color: var(--text-2); font-size: 13px; margin-bottom: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.auth-switch button { color: var(--primary-600); font-weight: 700; }
.auth-error { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 9px 13px; font-size: 12.5px; font-weight: 600; }

/* ============ Comunidades (vista) ============ */
.communities-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.community-card { display: flex; flex-direction: column; gap: 10px; }
.community-card .cc-head { display: flex; align-items: center; gap: 12px; }
.community-card .cc-desc { color: var(--text-2); font-size: 12.5px; flex: 1; }
.community-card .cc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.joined-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--green-soft); color: var(--green); font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.admin-badge { background: var(--purple-soft); color: var(--purple); font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .04em; }

/* ============ Detalle de curso (módulos) ============ */
.module-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; }
.module-item.done { background: var(--green-soft); border-color: #c9ecd7; }
.module-item.locked { opacity: .55; }
.module-head { display: flex; align-items: center; gap: 10px; }
.module-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-600);
  font-weight: 800; font-size: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.module-item.done .module-num { background: var(--green); color: #fff; }
.module-title { font-weight: 700; font-size: 13.5px; flex: 1; }
.module-content { margin-top: 8px; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.module-actions { margin-top: 10px; }
.modal-wide { max-width: 600px; }

/* Editor de módulos en el modal de proponer curso */
.module-editor { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.module-editor .me-row { display: flex; gap: 8px; align-items: center; }
.module-editor input { flex: 1; }
.remove-module { color: var(--text-3); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.remove-module:hover { background: var(--red-soft); color: var(--red); }
.add-module { width: 100%; }

/* Selector de comunidad en composer/modales */
.community-select {
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  outline: none;
  max-width: 220px;
}
.community-select:focus { border-color: var(--primary); }

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

/* ============ Cursos: catálogo ============ */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }

.course-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.course-cover {
  height: 110px;
  background:
    radial-gradient(140px 80px at 80% 0%, rgba(255,255,255,.28), transparent 60%),
    linear-gradient(120deg, #35b6ff, #0a5fa8);
  color: #fff;
  display: grid;
  place-items: center;
  position: relative;
}
.course-cover svg { width: 38px; height: 38px; opacity: .9; }
.course-done-pill {
  position: absolute; top: 10px; right: 10px;
  background: #fff; color: var(--green);
  font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 3px 10px;
  display: inline-flex; align-items: center; gap: 4px;
}
.course-done-pill svg { width: 12px; height: 12px; }
.course-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }

/* ============ Cursos: reproductor ============ */
.player-card { padding: 0; overflow: hidden; }
.video-frame { aspect-ratio: 16 / 9; background: #0b1620; position: relative; }
.video-frame iframe, .video-frame video { width: 100%; height: 100%; border: none; display: block; }
.video-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: #9fb3c4;
  font-size: 14px;
  font-weight: 600;
  padding: 20px;
  text-align: center;
}
.video-empty a { color: #6cc4ff; text-decoration: underline; }
.video-locked { display: grid; place-items: center; }
.lock-box { text-align: center; color: #d7e5f0; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 20px; }
.lock-box p { font-size: 14px; max-width: 320px; }

.lesson-info { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.lesson-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.lesson-nav .btn-success { margin: 0 auto; }

.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.lesson-row[role="button"] { cursor: pointer; }
.lesson-row[role="button"]:hover { background: #f4f8fc; }
.lesson-row.current { background: var(--primary-soft); border-color: #cde8fb; }
.lesson-row.done .module-title { color: var(--text-2); }
.lesson-row.done .module-num { background: var(--green); color: #fff; }
.lesson-row.locked { opacity: .5; }
.lesson-row .module-num { font-size: 11px; }

/* ============ Selector de idioma ============ */
.lang-switch { display: flex; gap: 4px; justify-content: flex-end; margin-bottom: 8px; }
.lang-switch button {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-3);
  border: 1px solid transparent;
}
.lang-switch button:hover { background: #f1f5f9; }
.lang-switch button.active { background: var(--primary-soft); color: var(--primary-600); border-color: #cde8fb; }

.lang-select { max-width: 64px; padding: 6px 8px; font-weight: 800; }

/* ============ Gestión: zona peligrosa y miembros ============ */
.danger-zone {
  border: 1px solid #f3c8c8;
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.danger-zone b { color: var(--red); font-size: 12.5px; }
.danger-zone .btn { border-color: #f3c8c8; color: var(--red); }
.danger-zone .btn:hover { background: #f8d7d7; }

.member-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #f1f5f9; }
.member-row:last-child { border-bottom: none; }
