:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --border: #e2e4e8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

/* body es flex y .page/.top-bar son items suyos: por defecto un flex item
   no encoge por debajo del ancho mínimo de su contenido (min-width:auto),
   así que cualquier fila con flex-wrap dentro (como los checkboxes de
   grupos) podía forzar a toda la página a desbordarse en móvil en vez de
   dejar que sus propias filas envolvieran. Con min-width:0 aquí, el que
   tiene que encoger/envolver es el contenido de dentro, no la página. */
.page, .top-bar { min-width: 0; }

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  margin-top: 8vh;
  text-align: center;
}

.logo-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 24px;
}

.google-btn-container {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.error-box {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-top: 16px;
  display: none;
}

.error-box.visible { display: block; }

.top-bar {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 20px;
}

.top-bar .quien {
  font-size: 0.85rem;
  color: var(--muted);
}

.top-bar a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.page {
  width: 100%;
  max-width: 640px;
}

h1 {
  font-size: 1.2rem;
  margin: 0 0 4px;
}

.dept-list, .app-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  list-style: none;
  padding: 0;
}

.dept-item, .app-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}

.dept-item:active, .app-item:active { background: #f0f1f3; }

.dept-item .nombre, .app-item .nombre {
  font-weight: 500;
}

.dept-item .rol {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}

.muted { color: var(--muted); font-size: 0.9rem; }

/* En iOS Safari, un <input type="checkbox"> sin tamaño explícito dentro de
   un contenedor flex se puede renderizar gigante (bug conocido de WebKit).
   Fijamos un tamaño y evitamos que encoja/crezca como item flex. */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--accent);
}

.placeholder {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  margin-top: 20px;
}
