/* ====== Tema ====== */
:root{
  --bg-grad-1:#74ABE2; --bg-grad-2:#5563DE;
  --brand:#3949AB; --brand-2:#5563DE;
  --text:#1f2430; --muted:#6b7280; --line:#edf0f7;
  --white:#fff; --danger:#ef4444; --warn:#f59e0b; --success:#10b981;
  --shadow:0 10px 25px rgba(0,0,0,.12);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:linear-gradient(135deg,var(--bg-grad-1),var(--bg-grad-2));
  color:var(--text);
}
h1,h2,h3,h4,h5{word-wrap:break-word;}
img{max-width:100%; height:auto;}

/* ===== Auth (login / register) ===== */
.auth-wrap{
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  justify-items: stretch;
  background: linear-gradient(135deg, #74ABE2, #5563DE);
}
.brand-side{
  display: grid; place-items: center;
  padding: clamp(20px, 4vw, 48px);
  color:#fff;
}
.brand-box{ max-width: 520px; width: 100%; text-align: center; }
.brand-logo {
  width: clamp(50px, 8vw, 80px);
  height: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  padding: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  margin: 0 auto 12px;
}
.brand-title{ font-size: clamp(1.2rem, 2.4vw, 2rem); margin: 0 0 6px; text-align: center; }
.brand-sub{ font-size: clamp(.9rem, 1.6vw, 1rem); line-height: 1.55; opacity: .92; text-align: center; max-width: 38ch; margin: 0 auto; }

.form-side{
  display: grid; place-items: center;
  padding: clamp(16px, 4vw, 40px);
  background: #f5f7ff;
}
.auth-card{
  width: min(92vw, 420px);
  margin: 0 auto;
  background: #fff; border-radius: 16px; padding: 22px;
  box-shadow: 0 12px 28px rgba(0,0,0,.15);
}
.auth-card h2{ margin: 0 0 14px; color: #3949AB; }
.auth-card .sub{ color:#6b7280; margin: -6px 0 14px; }

.input{
  width: 100%; padding: 14px 12px;
  border: 1px solid #e5e7eb; border-radius: 10px;
  outline: none; transition: .15s; font-size: 16px;
}
.input:focus{ border-color:#5563DE; box-shadow: 0 0 0 3px rgba(85,99,222,.15); }

.auth-btn{
  width: 100%;
  border: 0; cursor: pointer;
  background: #5563DE; color: #fff; font-weight: 800;
  padding: 14px; border-radius: 10px; transition:.15s; font-size: 16px;
}
.auth-btn:hover{ background:#3949AB; }

.link{ color:#5563DE; text-decoration:none; font-weight:700; }
.link:hover{ text-decoration:underline; }

.error{
  background: #fee2e2; color:#991b1b;
  border:1px solid #fecaca; padding:10px 12px; border-radius: 10px;
  margin: 8px 0 4px; font-size: 14px;
}

/* Responsive login */
@media (max-width: 900px){
  .auth-wrap{ grid-template-columns: 1fr; }
  .brand-side{ display: none; }
  .form-side{ padding: 20px; }
}
@media (max-width: 480px){
  body { background: #f5f7ff; }
  .auth-card {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ===== Main Container (contenido interno) ===== */
.main {
  max-width: 1000px;
  margin: 40px auto;
  background: var(--white);
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-height: calc(100vh - 80px);
  overflow-x: auto;
}
@media (max-width: 768px){
  .main {
    margin: 20px auto;
    padding: 20px 15px;
    border-radius: 0;
  }
}

/* ===== KPIs y Cards ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px,1fr));
  gap: 20px;
}
.kpi {
  background:#fff; padding:20px; border-radius:12px;
  box-shadow: var(--shadow); text-align:center;
}
@media (max-width: 400px){
  .kpis { grid-template-columns:1fr; }
}
.card {
  background:#fff; padding:20px; border-radius:12px;
  box-shadow: var(--shadow); margin-bottom:20px;
}

/* ===== Formularios ===== */
form {
  display:flex; flex-wrap:wrap; gap:10px;
}
form input, form select, form button, form textarea {
  flex:1; min-width:140px; max-width:100%;
}
@media(max-width:480px){
  form { flex-direction:column; }
  form input, form button, form select, form textarea { width:100%; }
}

/* ===== Tablas ===== */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:14px; }
table th, table td { padding:10px; border:1px solid var(--line); text-align:left; }

/* ===== Menú ===== */
nav ul {
  display:flex; flex-wrap:wrap; list-style:none;
  padding:0; margin:0; gap:15px;
}
@media (max-width:768px){
  nav ul { flex-direction:column; gap:10px; }
}

/* Evitar que el contenido se desborde horizontalmente */
html, body {
  overflow-x: hidden;
}

/* Main centrado y flexible */
.main {
  max-width: 1000px;
  margin: 40px auto;
  background: var(--white);
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-height: calc(100vh - 80px);
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* 👈 evita scroll lateral */
}

/* Formularios y inputs nunca más grandes que el contenedor */
form input, form select, form textarea, form button {
  max-width: 100%;
  box-sizing: border-box;
}

/* Tablas responsive */
.table-wrap { 
  width: 100%; 
  overflow-x: auto; 
}
table {
  width: 100%; 
  max-width: 100%; 
  border-collapse: collapse;
}
