/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px;
       color: #1a1a1a; background: #f4f4f0; line-height: 1.6; }

/* ── Layout principal ──────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 220px;
  background: #fff; border-right: 1px solid #e8e8e4;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 100;
}
.contenido {
  margin-left: 220px; padding: 1.5rem; min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar-header {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #e8e8e4;
  display: flex; align-items: center; gap: 10px;
}
.logo { height: 36px; border-radius: 4px; }
.logo-text {
  width: 36px; height: 36px; border-radius: 8px;
  background: #534AB7; color: #fff; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.empresa-nombre { font-size: 13px; font-weight: 500; color: #1a1a1a;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-menu { list-style: none; padding: 0.5rem 0; flex: 1; }
.nav-menu li a {
  display: block; padding: 7px 1rem; font-size: 13px; color: #444;
  text-decoration: none; border-radius: 6px; margin: 1px 6px;
  transition: background .12s;
}
.nav-menu li a:hover, .nav-menu li a.active {
  background: #EEEDFE; color: #534AB7;
}
.nav-group > span {
  display: block; padding: 8px 1rem 4px;
  font-size: 11px; font-weight: 600; color: #999; text-transform: uppercase; letter-spacing: .05em;
}
.nav-group ul { list-style: none; }

.sidebar-footer {
  padding: 0.75rem 1rem; border-top: 1px solid #e8e8e4;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #666;
}
.sidebar-footer a { color: #888; text-decoration: none; }
.sidebar-footer a:hover { color: #534AB7; }

/* ── Página ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-header h2 { font-size: 18px; font-weight: 500; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid #e8e8e4;
  border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem;
}

/* ── Formularios ───────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo.col-full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 500; color: #555; }
input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=date], input[type=number],
input[type=file], select, textarea {
  padding: 8px 10px; border: 1px solid #d8d8d4; border-radius: 7px;
  font-size: 13px; font-family: inherit; outline: none;
  transition: border .15s; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: #534AB7; }
.input-corto  { width: 60px !important; }
.input-numero { width: 100px !important; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px;
                  font-weight: 400; color: #333; cursor: pointer; }
.form-actions { margin-top: 1.25rem; display: flex; gap: 8px; }

/* ── Botones ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border: 1px solid #d8d8d4; border-radius: 7px;
  font-size: 13px; font-family: inherit; background: #fff;
  color: #333; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #f4f4f0; }
.btn-primary { background: #534AB7; border-color: #534AB7; color: #fff; }
.btn-primary:hover { background: #3C3489; border-color: #3C3489; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { background: #FCEBEB; border-color: #F09595; color: #A32D2D; }

/* ── Tablas ────────────────────────────────────────────── */
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th {
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
  color: #888; border-bottom: 1px solid #e8e8e4; background: #fafafa;
  text-transform: uppercase; letter-spacing: .04em;
}
.tabla td { padding: 10px 12px; border-bottom: 1px solid #f0f0ec; vertical-align: middle; }
.tabla tr:last-child td { border-bottom: none; }
.tabla tr:hover td { background: #fafafa; }
.text-right  { text-align: right !important; }
.text-center { text-align: center !important; }
.text-muted  { color: #888; }
.text-sm     { font-size: 12px; }

/* ── Badges ────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px;
         font-size: 11px; font-weight: 500; }
.badge-purple { background: #EEEDFE; color: #534AB7; }
.badge-green  { background: #EAF3DE; color: #27500A; }
.badge-red    { background: #FCEBEB; color: #A32D2D; }
.badge-amber  { background: #FAEEDA; color: #633806; }
.badge-gray   { background: #F1EFE8; color: #5F5E5A; }

/* ── Alertas ───────────────────────────────────────────── */
.alerta-exito   { background:#EAF3DE; color:#27500A; border:1px solid #C0DD97;
                  border-radius:8px; padding:10px 14px; font-size:13px; margin-bottom:14px; }
.alerta-error   { background:#FCEBEB; color:#A32D2D; border:1px solid #F09595;
                  border-radius:8px; padding:10px 14px; font-size:13px; margin-bottom:14px; }
.alerta-warning { background:#FAEEDA; color:#633806; border:1px solid #FAC775;
                  border-radius:8px; padding:10px 14px; font-size:13px; margin-bottom:14px; }
.alerta-error ul { padding-left: 1.2rem; margin: 0; }
.flash { background:#EAF3DE; color:#27500A; border:1px solid #C0DD97;
         border-radius:8px; padding:10px 14px; font-size:13px; margin-bottom:14px; }

/* ── Modal ─────────────────────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; z-index: 200;
         align-items: center; justify-content: center; }
.modal[style*="flex"] { display: flex !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.modal-box {
  position: relative; background: #fff; border-radius: 12px;
  width: 100%; max-width: 480px; padding: 1.5rem; z-index: 1;
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between;
                align-items: center; margin-bottom: 1rem; }
.modal-header h3 { font-size: 16px; font-weight: 500; }
.btn-cerrar { background: none; border: none; font-size: 20px;
              cursor: pointer; color: #888; line-height: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.25rem; }

/* ── Login ─────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center;
              min-height: 100vh; background: #f4f4f0; }
.login-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px;
              padding: 2rem; width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-icono { width: 52px; height: 52px; border-radius: 12px; background: #534AB7;
               color: #fff; font-size: 18px; font-weight: 700;
               display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.login-logo h1 { font-size: 20px; font-weight: 600; }
.login-logo p  { font-size: 13px; color: #888; margin-top: 4px; }
.login-link { text-align: center; margin-top: 14px; font-size: 13px; }
.login-link a { color: #534AB7; text-decoration: none; }
