:root{
  --verde-oscuro:#2F6A1F;
  --verde:#5AA929;
  --verde-claro:#8DC63F;
  --azul:#1CA3C9;
  --azul-marino:#0B2A4A;
  --fondo:#F5F7F5;
  --tinta:#1A2620;
  --borde:#E1E8E1;
  --rojo:#C0392B;
  --radio:12px;
}
*{box-sizing:border-box; margin:0; padding:0;}
body{font-family:'Nunito Sans', sans-serif; color:var(--tinta); background:var(--fondo);}
h1,h2,h3,.marca{font-family:'Fredoka', sans-serif;}
button{font-family:inherit; cursor:pointer;}
a{text-decoration:none; color:inherit;}

/* ---------- LOGIN ---------- */
.pantalla-login{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(1000px 500px at 50% -10%, #eaf7e2 0%, var(--fondo) 60%);
}
.login-card{
  background:#fff; padding:40px; border-radius:20px; box-shadow:0 20px 50px rgba(11,42,74,.12);
  width:100%; max-width:380px; text-align:center;
}
.login-card h1{color:var(--verde-oscuro); font-size:28px; margin-bottom:4px;}
.login-card .subtitulo{color:#6a7a6e; margin-bottom:24px; font-size:14px;}
.login-card form{text-align:left;}
.login-card label{display:block; font-weight:700; font-size:14px; margin:14px 0 6px; color:var(--verde-oscuro);}
.login-card input{width:100%; padding:12px 14px; border-radius:10px; border:2px solid var(--borde); font-size:15px;}
.login-card input:focus{outline:none; border-color:var(--verde);}
.btn-block{width:100%; margin-top:20px;}
.aviso-error{margin-top:14px; background:#fdeaea; color:var(--rojo); padding:10px 12px; border-radius:8px; font-size:14px; font-weight:700;}

/* ---------- BOTONES ---------- */
.btn{
  display:inline-flex; align-items:center; gap:8px; padding:11px 20px; border-radius:999px;
  font-weight:700; border:none; font-size:14px; transition:transform .1s ease;
}
.btn:hover{transform:translateY(-1px);}
.btn-primario{background:var(--verde); color:#fff;}
.btn-outline{background:transparent; color:var(--verde-oscuro); border:2px solid var(--verde);}
.btn-peligro{background:#fdeaea; color:var(--rojo);}
.btn-chico{padding:7px 14px; font-size:13px;}

/* ---------- LAYOUT APP ---------- */
.app-layout{display:flex; min-height:100vh;}
.sidebar{
  width:250px; background:var(--azul-marino); color:#fff; flex-shrink:0;
  display:flex; flex-direction:column; padding:20px 0;
}
.sidebar-marca{font-size:20px; font-weight:700; padding:0 20px 20px; border-bottom:1px solid rgba(255,255,255,.12); margin-bottom:10px;}
#menu-nav a{
  display:block; padding:12px 20px; font-size:14px; font-weight:700; color:rgba(255,255,255,.75);
  border-left:3px solid transparent;
}
#menu-nav a:hover{background:rgba(255,255,255,.06); color:#fff;}
#menu-nav a.activo{background:rgba(255,255,255,.1); color:#fff; border-left-color:var(--verde-claro);}

.area-principal{flex:1; display:flex; flex-direction:column; min-width:0;}
.topbar{
  height:64px; background:#fff; border-bottom:1px solid var(--borde);
  display:flex; align-items:center; justify-content:space-between; padding:0 28px;
}
#topbar-titulo{font-family:'Fredoka',sans-serif; font-size:20px; color:var(--verde-oscuro); font-weight:600;}
.topbar-usuario{display:flex; align-items:center; gap:14px; font-weight:700; font-size:14px;}

.contenido{padding:28px; overflow-y:auto;}

/* ---------- SECCIONES / TARJETAS ---------- */
.seccion-header{display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; flex-wrap:wrap; gap:12px;}
.seccion-header h2{color:var(--verde-oscuro); font-size:22px;}
.tarjeta{background:#fff; border-radius:var(--radio); border:1px solid var(--borde); padding:20px;}
.filtros{display:flex; gap:12px; margin-bottom:16px; flex-wrap:wrap; align-items:end;}
.filtros label{display:block; font-size:12px; font-weight:700; color:#6a7a6e; margin-bottom:4px;}
.filtros input, .filtros select{padding:9px 12px; border-radius:8px; border:2px solid var(--borde); font-size:14px;}

/* ---------- TABLAS ---------- */
table{width:100%; border-collapse:collapse; font-size:14px;}
th{text-align:left; padding:10px 12px; background:#f0f5ef; color:var(--verde-oscuro); font-weight:800; font-size:12px; text-transform:uppercase; letter-spacing:.03em;}
td{padding:10px 12px; border-bottom:1px solid var(--borde);}
tr:last-child td{border-bottom:none;}
tr:hover td{background:#fafdf9;}
.badge{padding:4px 10px; border-radius:999px; font-size:12px; font-weight:800; display:inline-block;}
.badge-verde{background:#e9f7e3; color:var(--verde-oscuro);}
.badge-amarillo{background:#fff6e0; color:#8a6d1f;}
.badge-rojo{background:#fdeaea; color:var(--rojo);}
.badge-azul{background:#e3f6fb; color:var(--azul);}
.badge-gris{background:#eef0ee; color:#6a7a6e;}
.acciones-fila{display:flex; gap:6px;}
.vacio{text-align:center; padding:40px; color:#8a988e;}

/* ---------- FORMULARIOS (dentro de modal) ---------- */
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:14px;}
.form-grid .full{grid-column:1/-1;}
.form-grid label{display:block; font-size:13px; font-weight:700; margin-bottom:5px; color:var(--verde-oscuro);}
.form-grid input, .form-grid select, .form-grid textarea{
  width:100%; padding:10px 12px; border-radius:8px; border:2px solid var(--borde); font-size:14px; font-family:inherit;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus{outline:none; border-color:var(--verde);}
.form-grid textarea{resize:vertical; min-height:70px;}
.checkbox-linea{display:flex; align-items:center; gap:8px; font-weight:600; font-size:14px;}
.checkbox-linea input{width:auto;}
.form-acciones{display:flex; justify-content:flex-end; gap:10px; margin-top:22px;}
.subbloque{border:1px dashed var(--borde); border-radius:10px; padding:16px; margin-top:16px;}
.subbloque h4{color:var(--verde-oscuro); font-size:14px; margin-bottom:12px;}
.lista-items-dinamica .item-dinamico{display:flex; gap:8px; margin-bottom:8px; align-items:center;}
.link-agregar{color:var(--azul); font-weight:700; font-size:13px; display:inline-block; margin-top:6px;}

/* ---------- MODAL ---------- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(11,42,74,.45); z-index:100;
  display:flex; align-items:flex-start; justify-content:center; padding:40px 20px; overflow-y:auto;
}
.modal-caja{background:#fff; border-radius:16px; width:100%; max-width:640px; box-shadow:0 20px 60px rgba(0,0,0,.25);}
.modal-header{display:flex; justify-content:space-between; align-items:center; padding:20px 24px; border-bottom:1px solid var(--borde);}
.modal-header h3{color:var(--verde-oscuro); font-size:18px;}
.modal-cerrar{background:none; border:none; font-size:18px; color:#8a988e;}
.modal-cuerpo{padding:24px;}

/* ---------- TOASTS ---------- */
.toast-contenedor{position:fixed; bottom:24px; right:24px; z-index:200; display:flex; flex-direction:column; gap:10px;}
.toast{padding:14px 18px; border-radius:10px; font-weight:700; font-size:14px; box-shadow:0 8px 20px rgba(0,0,0,.15); min-width:260px;}
.toast-ok{background:var(--verde-oscuro); color:#fff;}
.toast-err{background:var(--rojo); color:#fff;}

/* ---------- STATS INICIO ---------- */
.grid-stats{display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px;}
.stat-card{background:#fff; border-radius:var(--radio); border:1px solid var(--borde); padding:20px;}
.stat-card .valor{font-size:30px; font-weight:800; color:var(--verde-oscuro); font-family:'Fredoka',sans-serif;}
.stat-card .etiqueta{color:#6a7a6e; font-size:13px; font-weight:700;}

@media (max-width:900px){
  .sidebar{width:70px;}
  .sidebar-marca{font-size:0;}
  #menu-nav a{text-align:center; font-size:20px; padding:14px 0;}
  #menu-nav a::after{content:none;}
  .grid-stats{grid-template-columns:1fr 1fr;}
  .form-grid{grid-template-columns:1fr;}
}
