/* ── Reset básico ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f0f2f5;
  color: #222;
}

/* ── Login ─────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  text-align: center;
}

.login-card h1 { font-size: 1.8rem; color: #1a237e; margin-bottom: .3rem; }
.login-card .subtitle { color: #888; font-size: .85rem; margin-bottom: 1.5rem; }

.login-card label {
  display: block;
  text-align: left;
  font-size: .85rem;
  font-weight: 600;
  margin: .8rem 0 .3rem;
  color: #444;
}

.login-card input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color .2s;
}
.login-card input:focus { outline: none; border-color: #1a237e; }

.login-card button[type=submit] {
  margin-top: 1.4rem;
  width: 100%;
  padding: .75rem;
  background: #1a237e;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
}
.login-card button[type=submit]:hover { background: #283593; }

.alert-error {
  background: #fdecea;
  color: #c62828;
  border: 1px solid #ef9a9a;
  border-radius: 8px;
  padding: .6rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a237e;
  color: #fff;
  padding: .7rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand { font-size: 1.2rem; font-weight: 700; }
.topbar .user-info { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }

.btn-logout {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 6px;
  padding: .3rem .8rem;
  cursor: pointer;
  font-size: .85rem;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.35); }

/* ── Contenido principal ────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.container h2 { color: #1a237e; margin-bottom: .5rem; }
.container p  { color: #666; margin-bottom: 1.5rem; }

/* ── Menú de tarjetas ───────────────────────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.menu-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: transform .15s, box-shadow .15s;
  font-weight: 600;
  color: #1a237e;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.menu-card .icon { font-size: 2rem; }

/* ── Responsive (celular y tablets) ─────────────────────── */
@media (max-width: 600px) {
  .topbar { flex-direction: column; gap: .5rem; text-align: center; padding: .8rem; }
  .topbar .user-info { flex-direction: column; gap: .4rem; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }

  .container { padding: 0 .6rem; margin: 1rem auto; }
  .container h2 { font-size: 1.2rem; }

  .modulo-card { padding: .9rem 1rem; }

  /* Los formularios pasan de una fila a una sola columna */
  .form-fila { flex-direction: column; align-items: stretch; }
  .form-fila .campo { min-width: 0; width: 100%; }

  /* Botones más grandes y fáciles de tocar con el dedo */
  .btn-primario, .btn-verde, .btn-rojo {
    width: 100%;
    padding: .75rem 1rem;
    font-size: 1rem;
    margin-bottom: .3rem;
  }
  /* Cuando varios botones quedan uno al lado del otro en una celda de tabla,
     que se apilen en vez de aplastarse */
  td .btn-primario, td .btn-verde, td .btn-rojo {
    display: block;
    width: 100%;
    margin: 3px 0;
  }

  .resumen-grid { grid-template-columns: 1fr 1fr; }
  .resumen-item { padding: .7rem; }
  .resumen-item .valor { font-size: 1.15rem; }

  .tabla-simple { font-size: .8rem; }
  .tabla-simple th, .tabla-simple td { padding: .4rem; }

  .franja-empresa { flex-wrap: wrap; justify-content: center; text-align: center; }

  input, select, textarea { font-size: 16px; } /* evita el zoom automático de iPhone al escribir */
}

@media (max-width: 380px) {
  .menu-grid { grid-template-columns: 1fr; }
  .resumen-grid { grid-template-columns: 1fr; }
}

/* ── Tarjetas de módulo (Parqueo, Bodegas, Baños, Caja, Config) ───── */
.modulo-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.modulo-card h3 { color: #1a237e; margin-bottom: .8rem; font-size: 1.05rem; }

.form-fila {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  align-items: flex-end;
}
.form-fila .campo { flex: 1; min-width: 140px; }
.form-fila label { display: block; font-size: .8rem; color: #555; margin-bottom: .25rem; }
.form-fila input, .form-fila select {
  width: 100%;
  padding: .55rem .7rem;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: .95rem;
}

.btn-primario, .btn-verde, .btn-rojo {
  border: none;
  border-radius: 8px;
  padding: .6rem 1.1rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}
.btn-primario { background: #1a237e; }
.btn-primario:hover { background: #283593; }
.btn-verde { background: #2a9d5c; }
.btn-verde:hover { background: #237a48; }
.btn-rojo { background: #c62828; }
.btn-rojo:hover { background: #a51f1f; }

.tabla-simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla-simple th, .tabla-simple td {
  padding: .55rem .6rem;
  border-bottom: 1px solid #e3e3e3;
  text-align: left;
}
.tabla-simple th { background: #f5f6f8; color: #444; }
.tabla-scroll { overflow-x: auto; }

.resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.resumen-item {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.resumen-item .valor { font-size: 1.4rem; font-weight: 700; }
.resumen-item .valor.positivo { color: #2a9d5c; }
.resumen-item .valor.negativo { color: #c62828; }

.mensaje-info { color: #666; font-size: .9rem; padding: .5rem 0; }

/* ── Impresión (recibo) ─────────────────────────────────── */
@media print {
  .topbar, .menu-grid, .btn-logout { display: none; }
  body { background: #fff; }
}

/* ── Franja de logo/nombre de la empresa (debajo de la barra azul) ─── */
.franja-empresa {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #f0f4ff;
  border-bottom: 1px solid #d5deff;
}
.franja-empresa.visible { display: flex; }
.franja-empresa img { max-height: 32px; max-width: 120px; }
.franja-empresa span { font-weight: 600; color: #1a237e; }
