@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --navy: #1D3461;
  --navy-deep: #14264A;
  --amber: #F2A541;
  --paper: #EEF1F6;
  --surface: #FFFFFF;
  --ink: #16202B;
  --slate: #5B6B82;
  --hairline: #D8DFEA;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.meta, time, .mono {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--slate);
  font-size: 0.8rem;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

/* Top bar */
.topbar {
  background: var(--navy);
  color: var(--paper);
  padding: 20px 20px 24px;
  position: relative;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242,165,65,0.18), transparent 70%);
}
.topbar .school {
  font-size: 0.78rem;
  color: #AEC0DE;
  margin-bottom: 2px;
}
.topbar h1 {
  font-size: 1.5rem;
  color: #fff;
}

/* Content */
main {
  flex: 1;
  padding: 18px 16px 90px;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-label {
  font-size: 0.95rem;
  color: var(--slate);
  margin: 4px 0 14px;
}

.empty-state {
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  color: var(--slate);
}
.empty-state strong { display: block; color: var(--ink); margin-bottom: 4px; font-family: 'Space Grotesk', sans-serif; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card.unseen { border-left: 3px solid var(--amber); }
.card h3 { font-size: 1.02rem; margin-bottom: 6px; }
.card p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: #33404F; }
.card .meta { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.dot-new {
  width: 6px; height: 6px; border-radius: 50%; background: var(--amber);
  display: inline-block;
}

/* Event date block */
.event-row { display: flex; gap: 12px; }
.event-date {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.event-date .d { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 700; }
.event-date .m { font-family: 'IBM Plex Mono', monospace; font-size: 0.62rem; color: var(--amber); }
.event-body { flex: 1; min-width: 0; }
.event-body h3 { margin-bottom: 3px; }
.event-loc { color: var(--slate); font-size: 0.85rem; margin-top: 4px; }

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--hairline);
}

/* Autenticación */
.auth-screen { padding-top: 8px; }
.auth-screen h2 { margin-bottom: 4px; }
.auth-screen .sub { color: var(--slate); font-size: 0.88rem; margin: 0 0 20px; }
.auth-field { margin-bottom: 12px; }
.auth-field label { display: block; font-size: 0.8rem; color: var(--slate); margin-bottom: 4px; }
.auth-field input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--hairline);
  border-radius: 10px; font-family: 'IBM Plex Sans', sans-serif; font-size: 0.95rem;
  background: #fff; color: var(--ink);
}
.auth-btn {
  width: 100%; background: var(--navy); color: #fff; border: none;
  padding: 13px; border-radius: 10px; font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem; cursor: pointer; margin-top: 6px;
}
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.88rem; color: var(--slate); }
.auth-switch a { color: var(--navy); cursor: pointer; }
.auth-error { color: #B3432F; font-size: 0.85rem; margin-top: 10px; min-height: 1em; }
.auth-hint { color: var(--slate); font-size: 0.85rem; margin-top: 10px; min-height: 1em; }
.user-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; font-size: 0.85rem; color: var(--slate);
}
.user-bar button {
  background: none; border: none; color: var(--navy); font-size: 0.82rem;
  cursor: pointer; font-family: 'IBM Plex Sans', sans-serif;
}

/* Menú principal en cuadrícula */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 4px;
}
.menu-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}
.menu-tile .menu-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.menu-tile .menu-icon svg { width: 20px; height: 20px; }
.menu-tile .badge { position: static; margin-top: -2px; }

/* Botón volver */
.back-btn {
  background: none; border: none; padding: 0 0 14px;
  color: var(--navy); font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.88rem; cursor: pointer;
}

/* Documentos */
.doc-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.doc-item .doc-icon {
  width: 38px; height: 38px; border-radius: 8px;
  background: #EDE7DA; color: var(--navy);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-item .doc-body { flex: 1; min-width: 0; }
.doc-item .doc-body strong { display: block; font-size: 0.92rem; }
.doc-item a.doc-download { color: var(--navy); flex-shrink: 0; }

/* Botón guardar en tarjeta de anuncio */
.save-btn {
  background: none; border: none; padding: 0; margin-left: auto;
  color: var(--slate); cursor: pointer;
}
.save-btn svg { width: 18px; height: 18px; }
.save-btn.saved { color: var(--amber); }

/* Institucional */
#institucional-content p { white-space: pre-wrap; line-height: 1.6; }
#institucional-content .inst-row { display: flex; gap: 8px; margin-top: 10px; font-size: 0.9rem; }
#institucional-content .inst-row svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--slate); }

/* Bottom nav */
nav.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
  display: flex;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
nav.tabbar button {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 2px;
  color: var(--slate);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
}
nav.tabbar button.active { color: var(--navy); }
nav.tabbar svg { width: 22px; height: 22px; }
.badge {
  position: absolute;
  top: 2px; right: 22%;
  background: var(--amber);
  color: #2A1900;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* Install hint */
.install-hint {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #FFF6E8;
  border: 1px solid #F3D9A6;
  border-radius: 10px;
  font-size: 0.85rem;
  color: #6B4E17;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.install-hint button {
  background: var(--navy); color: #fff; border: none;
  padding: 6px 12px; border-radius: 20px; font-size: 0.78rem;
  font-family: 'IBM Plex Sans', sans-serif; flex-shrink: 0;
}

a.admin-link {
  display: block;
  text-align: center;
  color: var(--slate);
  font-size: 0.75rem;
  margin-top: 24px;
}

/* Lightbox */
#lightbox {
  position: fixed; inset: 0; background: rgba(10,16,28,0.92);
  display: none; align-items: center; justify-content: center; z-index: 50;
  padding: 24px;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 100%; max-height: 80vh; border-radius: 10px; }
