:root {
  --azul: #0D4F3D;      /* verde institucional real del liceo (se mantiene el nombre de variable para no romper el resto del CSS) */
  --azul-claro: #166650;
  --naranja: #c9a84a;    /* dorado, acento sobre el verde */
  --fondo: #f4f6f9;
  --texto: #222;
  --gris: #6b7280;
  --borde: #e2e6ea;
  --blanco: #ffffff;
  --radio: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  -webkit-tap-highlight-color: transparent;
}

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

header.topbar {
  background: var(--azul);
  color: white;
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

header.topbar .brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--naranja);
}

header.topbar .sub {
  font-size: 0.72rem;
  opacity: 0.8;
  font-weight: 400;
  margin-top: 2px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

main {
  flex: 1;
  padding: 14px 16px 90px;
}

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  border-top: 1px solid var(--borde);
  display: flex;
  z-index: 10;
}

.tab-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 4px 12px;
  font-size: 0.72rem;
  color: var(--gris);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.tab-btn .ic {
  font-size: 1.2rem;
}

.tab-btn.active {
  color: var(--azul);
  font-weight: 700;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadein 0.15s ease-in;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: white;
  border-radius: var(--radio);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--borde);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--azul);
}

.card .meta {
  font-size: 0.72rem;
  color: var(--gris);
  margin-bottom: 8px;
}

.card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--azul);
  margin: 4px 0 12px;
}

.evento-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: white;
  border-radius: var(--radio);
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--borde);
}

.evento-fecha {
  background: var(--azul);
  color: white;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 56px;
  line-height: 1.2;
}

.evento-info h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.evento-info p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--gris);
}

.evento-info .hora {
  color: var(--naranja);
  font-weight: 600;
}

.rsvp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.rsvp-btn {
  border: 1px solid var(--borde);
  background: white;
  color: var(--gris);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 99px;
  cursor: pointer;
}

.rsvp-btn.on-yes {
  background: #e7f6ec;
  border-color: #2f9e52;
  color: #1e7a3c;
}

.rsvp-btn.on-no {
  background: #fdeceb;
  border-color: #d9534f;
  color: #b3352f;
}

.rsvp-hint {
  font-size: 0.74rem;
  color: var(--gris);
}

.rsvp-summary {
  font-size: 0.74rem !important;
  font-weight: 600;
  margin-top: 6px !important;
  color: var(--texto) !important;
}

.btn {
  background: var(--azul);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn.secondary {
  background: white;
  color: var(--azul);
  border: 1px solid var(--azul);
}

.btn.danger {
  background: #fff0ee;
  color: #c0392b;
  border: 1px solid #f3c8c2;
}

.btn.small {
  width: auto;
  padding: 8px 12px;
  font-size: 0.78rem;
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--borde);
  font-size: 0.88rem;
  margin-bottom: 10px;
  font-family: inherit;
}

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gris);
  display: block;
  margin-bottom: 4px;
}

.empty {
  text-align: center;
  color: var(--gris);
  font-size: 0.85rem;
  padding: 40px 10px;
}

.login-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 28px;
  text-align: center;
  background: var(--azul);
  color: white;
}

.login-screen .logo-img {
  width: 168px;
  height: 168px;
  margin: 0 auto 18px;
  display: block;
}

.login-screen h1 {
  font-size: 1.3rem;
  color: white;
  margin-bottom: 4px;
  font-weight: 700;
}

.login-screen p.lead {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.login-screen label {
  color: rgba(255, 255, 255, 0.85);
  text-align: left;
}

.login-screen .btn {
  background: var(--naranja);
  color: var(--azul);
  font-weight: 700;
}

.chat-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 10px;
}

.msg {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.msg.padre {
  background: var(--azul);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.msg.admin {
  background: white;
  border: 1px solid var(--borde);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.msg .hora {
  display: block;
  font-size: 0.65rem;
  opacity: 0.7;
  margin-top: 4px;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--borde);
}

.chat-input input {
  margin-bottom: 0;
}

.chat-input button {
  width: auto;
  padding: 0 18px;
}

.hilo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.hilo-row .nombre {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--azul);
}

.hilo-row .preview {
  font-size: 0.76rem;
  color: var(--gris);
  margin-top: 2px;
}

.badge {
  background: var(--naranja);
  color: var(--azul);
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 8px;
}

.fab {
  position: fixed;
  bottom: 80px;
  right: calc(50% - 240px + 20px);
  background: var(--naranja);
  color: var(--azul);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 1.6rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9;
}

@media (max-width: 520px) {
  .fab {
    right: 20px;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 18px 18px 0 0;
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h3 {
  margin-top: 0;
  color: var(--azul);
}

.top-banner {
  background: #eaf1fb;
  color: var(--azul);
  font-size: 0.78rem;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.top-banner button {
  background: var(--azul);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}

.admin-flag {
  background: var(--naranja);
  color: var(--azul);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 6px;
}

.card.urgente {
  border: 2px solid #d9534f;
  background: #fff8f7;
}

.urgente-flag {
  display: inline-block;
  background: #d9534f;
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.anuncio-img {
  width: 100%;
  border-radius: 10px;
  margin-top: 10px;
  cursor: zoom-in;
  display: block;
}

#codigosWrap input {
  margin-bottom: 6px;
}

.evento-row.examen {
  border-left: 4px solid var(--naranja);
  background: #fffaf0;
}

.examen-badge {
  background: var(--naranja);
  color: #5a3d00;
}
