:root{
  --brand:#0b6b63;     /* Verde ERP serio */
  --brand2:#084d48;    /* Verde oscuro ERP */
  --bg:#f4f6f9;
  --card:#fff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --shadow:0 10px 24px rgba(17,24,39,.10);
  --r:12px;
  --focus:0 0 0 4px rgba(11,107,99,.18);

  /* Sidebar ERP */
  --sb-bg:#0b6b63;
  --sb-bg2:#084d48;
  --sb-item:rgba(255,255,255,.08);
  --sb-item-hover:rgba(255,255,255,.14);
  --sb-item-active:rgba(255,255,255,.18);
  --sb-border:rgba(255,255,255,.14);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background:var(--bg);
  color:var(--text);
  overflow-x:hidden;
}

/* ===============================
   LAYOUT DESKTOP/TABLET (ERP)
   =============================== */
.layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height:100vh;
}

/* ===============================
   SIDEBAR (DESKTOP/TABLET)
   =============================== */
.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
  background:linear-gradient(180deg, var(--sb-bg2), var(--sb-bg));
  color:#fff;
  padding:14px 14px 12px;
  display:flex;
  flex-direction:column;
  z-index:10;
}

/* Main */
.main{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.content{ padding:16px; flex:1; }

/* ===============================
   OVERLAY MÓVIL
   =============================== */
.sb-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  z-index:55;
  display:none;
}
.sb-overlay.show{ display:block; }
body.sb-open{ overflow:hidden; }

/* ===============================
   SIDEBAR HEADER
   =============================== */
.sb-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  margin-bottom:10px;
}

.brand{
  display:flex;
  gap:10px;
  align-items:center;
  margin:0;
}
.brand-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  background:#fff;
  opacity:.95;
  flex:0 0 auto;
}
.brand-name{
  font-weight:900;
  letter-spacing:.2px;
  font-size:15px;
  line-height:1.1;
}
.brand-sub{
  opacity:.88;
  font-size:12px;
  margin-top:2px;
}

/* X (solo móvil) */
.sb-close{
  display:none; /* desktop: oculto */
  border:none;
  background:rgba(255,255,255,.12);
  color:#fff;
  width:38px;
  height:38px;
  border-radius:12px;
  cursor:pointer;
  font-size:18px;
  line-height:38px;
  text-align:center;
}
.sb-close:hover{ background:rgba(255,255,255,.20); }

/* ===============================
   NAV (ERP)
   =============================== */
.nav{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:10px;
}

.nav-title{
  font-size:11px;
  letter-spacing:.12em;
  text-transform:uppercase;
  opacity:.75;
  margin:8px 6px 4px;
}

.nav-item{
  text-decoration:none;
  color:#fff;
  padding:11px 12px;
  border-radius:12px;
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid var(--sb-border);
  background:var(--sb-item);
  transition: background .15s ease, transform .05s ease;
}
.nav-item:hover{ background:var(--sb-item-hover); }
.nav-item:active{ transform:translateY(1px); }

.nav-item.active{
  background:var(--sb-item-active);
  border-color:rgba(255,255,255,.22);
}

.nav-item.disabled{
  opacity:.55;
  cursor:not-allowed;
  pointer-events:none;
}

.nav-ico{
  width:22px;
  text-align:center;
  opacity:.95;
  font-size:15px;
}
.nav-txt{ flex:1; }

.nav-sep{
  height:1px;
  background:rgba(255,255,255,.18);
  margin:12px 2px;
}

.pill{
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  background:rgba(0,0,0,.18);
}

/* Footer sidebar */
.sidebar-foot{
  margin-top:auto;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,.18);
}

/* ===============================
   TOPBAR
   =============================== */
.topbar{
  background:var(--card);
  border-bottom:1px solid var(--border);
  padding:12px 16px;
  display:flex;
  align-items:center;
  gap:10px;
}
.topbar-title{ font-weight:900; }
.topbar-right{
  margin-left:auto;
  display:flex;
  gap:10px;
  align-items:center;
}

.chip{
  border:1px solid var(--border);
  background:#fff;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
}

/* ===============================
   BUTTONS
   =============================== */
.btn{
  border:1px solid var(--border);
  background:#fff;
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  text-decoration:none;
  color:inherit;
}
.btn:hover{ box-shadow:0 6px 16px rgba(17,24,39,.08); }

.btn.primary{
  background:var(--brand);
  border-color:var(--brand);
  color:#fff;
}

.btn.icon{
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
}

/* ===============================
   FOOTER
   =============================== */
.footer{
  background:var(--card);
  border-top:1px solid var(--border);
  padding:10px 16px;
  display:flex;
  justify-content:space-between;
}
.muted{ color:var(--muted); }
.small{ font-size:12px; }
.ok{ color:var(--brand); }

/* ===============================
   CARDS
   =============================== */
.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
}

.card{
  grid-column: span 6;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px;
}

.card-title{ font-weight:900; margin-bottom:8px; }
.big{ font-size:22px; font-weight:900; margin:6px 0; }
.list{ margin:0; padding-left:16px; }

/* Cards a 1 columna en móvil */
@media (max-width: 900px){
  .card{ grid-column: span 12; }
}

/* ===============================
   LOGIN
   =============================== */
.login-body{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.login-card{
  width:min(420px, 92vw);
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:16px;
}
.login-brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:12px;
}
.form{ display:flex; flex-direction:column; gap:8px; }

.lbl{
  font-size:12px;
  color:var(--muted);
  margin-top:6px;
}

.inp{
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px 12px;
  outline:none;
}
.inp:focus{
  box-shadow:var(--focus);
  border-color:var(--brand);
}

.w100{ width:100%; }
.center{ text-align:center; }

/* ===============================
   ALERT PRO CENTRO
   =============================== */
.alert-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.40);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:80;
}
.alert-backdrop.show{ display:flex; }

.alert{
  width:min(520px, 92vw);
  background:#fff;
  border-radius:16px;
  box-shadow:0 18px 50px rgba(0,0,0,.25);
  border:1px solid var(--border);
  padding:14px;
}
.alert-head{ display:flex; gap:10px; align-items:center; }
.alert-ico{ font-size:22px; }
.alert-title{ font-weight:900; }
.alert-msg{ margin:10px 0; color:#111827; }
.alert-actions{ display:flex; justify-content:flex-end; gap:8px; }

/* ===============================
   TABLET COMPACTA
   =============================== */
@media (max-width: 1024px){
  .layout{ grid-template-columns: 240px 1fr; }
}

/* =====================================================
   ☰ HAMBURGUESA — REGLA DE ORO (NUNCA EN DESKTOP)
   ===================================================== */
.sb-toggle{ display:none !important; } /* desktop/tablet: oculto SIEMPRE */

/* ===============================
   MÓVIL: OFF-CANVAS + ☰
   =============================== */
@media (max-width: 900px){
  .layout{ grid-template-columns: 1fr; }

  /* ☰ visible solo móvil */
  .sb-toggle{ display:inline-flex !important; }

  /* sidebar off-canvas */
  .sidebar{
    position:fixed;
    left:0;
    top:0;
    height:100vh;
    width:280px;
    max-width:86vw;
    z-index:60;
    transform:translateX(-110%);
    transition:transform .22s ease;
    box-shadow:0 18px 50px rgba(0,0,0,.25);
  }
  .sidebar.is-open{ transform:translateX(0); }

  /* X visible en móvil */
  .sb-close{ display:inline-flex; }
}
