/* RESET */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Inter, Helvetica, Arial, sans-serif;
  color: #1f2933;
}

/* =========================
   AUTH (LOGIN)
========================= */
.auth-body { background: #f5f6f8; }
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.04);
}

.card h1 {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.2px;
}

label {
  display: block;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 500;
  color: #52606d;
}

input {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d9dde3;
  background: #fafbfc;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  outline: none;
  border-color: #1f7ae0;
  box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.15);
  background: #fff;
}

button {
  width: 100%;
  margin-top: 28px;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  background: #1f7ae0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
}

button:hover {
  background: #1767c7;
  box-shadow: 0 6px 18px rgba(31, 122, 224, 0.25);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(31, 122, 224, 0.2);
}

.alert {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff1f1;
  border: 1px solid #ffd6d6;
  color: #a12a2a;
  font-size: 13px;
  text-align: center;
}

/* LOGO LOGIN */
.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.login-logo img { max-width: 160px; height: auto; }

/* =========================
   APP SHELL (DASHBOARD/EMPRESAS)
========================= */
.app-body { background: #f6f7fb; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* SIDEBAR */
.sidebar {
  background: #0f172a;
  color: #cbd5e1;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
}

.brand-logo { width: 34px; height: auto; }
.brand-title { font-weight: 700; color: #fff; font-size: 14px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: rgba(203,213,225,0.85); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: rgba(203,213,225,0.95);
  font-weight: 600;
  font-size: 13px;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.active {
  background: rgba(31, 122, 224, 0.22);
  color: #fff;
}

.sidebar-footer { margin-top: auto; padding: 10px; }
.hint { font-size: 12px; color: rgba(203,213,225,0.7); }

/* MAIN */
.app-main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e6e8eb;
}

.page-title { font-weight: 800; color: #111827; font-size: 14px; letter-spacing: .2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-pill {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: #fff;
  border: 1px solid #e6e8eb;
}

.btn-ghost {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid #e6e8eb;
  background: #ffffff;
  color: #1f7ae0;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.btn-ghost:hover { box-shadow: 0 6px 16px rgba(0,0,0,.06); transform: translateY(-1px); }

.content {
  padding: 22px;
  max-width: 80vw;
  width: 100%;
}

/* TABLAS */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border: 1px solid #e6e8eb;
  border-radius: 14px;
  overflow: hidden;
}

.table th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #52606d;
  padding: 12px 12px;
  border-bottom: 1px solid #e6e8eb;
  background: #fafbfc;
}

.table td {
  padding: 12px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}

.table tr:hover td { background: #fcfdff; }

.btn-lite {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #d9dde3;
  background: #fff;
  color: #1f7ae0;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.btn-lite:hover { box-shadow: 0 6px 16px rgba(0,0,0,.06); transform: translateY(-1px); }

/* RESPONSIVE */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; flex-direction: row; align-items: center; }
  .nav { flex-direction: row; }
  .sidebar-footer { display:none; }
  .content { padding: 16px; }
}

/* FIX: asegurar centrado del login siempre */
body.auth-body {
  min-height: 100vh;
}

body.auth-body .auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Mejor responsive (sidebar arriba en móvil) */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px;
    height: 60px;
  }
  .brand-meta { display: none; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .topbar { padding: 0 12px; }
  .content { padding: 14px; }
}
