*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
}

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

.mcd-sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 1.25rem 0.75rem;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.mcd-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.75rem;
}

.mcd-sidebar-brand a {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: #0f172a;
}
.mcd-sidebar-brand .acc { color: #f59e0b; }
.mcd-sidebar-brand .pill {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  letter-spacing: 0.04em;
}

.mcd-sidebar-section {
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0.5rem 0.75rem 0.25rem;
}

.mcd-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: background 0.1s ease, color 0.1s ease;
}
.mcd-sidebar nav a:hover { background: #f1f5f9; color: #0f172a; }
.mcd-sidebar nav a.active { background: #eff6ff; color: #1d4ed8; }
.mcd-sidebar nav a .ic { width: 16px; text-align: center; }

.mcd-sidebar-user {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: #64748b;
}
.mcd-sidebar-user b { color: #0f172a; display: block; font-size: 0.8125rem; }
.mcd-sidebar-user a {
  font-size: 0.75rem;
  color: #ef4444;
  text-decoration: none;
  font-weight: 600;
}
.mcd-sidebar-user a:hover { text-decoration: underline; }

.mcd-main { padding: 1.5rem 2rem; max-width: 1280px; }

.mcd-header { display: flex; justify-content: space-between; align-items: end; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.mcd-header h1 { font-size: 1.5rem; font-weight: 900; color: #0f172a; margin: 0; letter-spacing: -0.02em; }
.mcd-header .sub { font-size: 0.875rem; color: #64748b; margin-top: 0.25rem; }

.mcd-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  overflow: hidden;
}
.mcd-card-toolbar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.mcd-input {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  min-width: 260px;
}
.mcd-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

.mcd-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.mcd-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  text-align: left;
  font-weight: 700;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid #e2e8f0;
}
.mcd-table tbody td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.mcd-table tbody tr:hover { background: #fafbfc; }
.mcd-table tbody tr:last-child td { border-bottom: 0; }
.mcd-table .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mcd-table .muted { color: #94a3b8; font-size: 0.75rem; }

.mcd-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}

.mcd-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: mcd-shimmer 1.4s infinite;
  border-radius: 0.375rem;
  height: 14px;
}
@keyframes mcd-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.mcd-pill {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}
.mcd-pill-mensual { background: #e0e7ff; color: #4338ca; }
.mcd-pill-anual   { background: #fef3c7; color: #92400e; }

.mcd-tag-ds {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 1px 6px;
  margin: 1px 2px 1px 0;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
}

.mcd-plan {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: capitalize;
}
.mcd-plan-registrado { background: #f1f5f9; color: #475569; }
.mcd-plan-basico     { background: #dbeafe; color: #1e40af; }
.mcd-plan-suscriptor { background: #fef3c7; color: #92400e; }
.mcd-plan-admin      { background: #ede9fe; color: #5b21b6; }

.mcd-rol {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f1f5f9;
  color: #475569;
}
.mcd-rol-admin       { background: #ede9fe; color: #5b21b6; }
.mcd-rol-soporte     { background: #d1fae5; color: #065f46; }
.mcd-rol-ventas      { background: #fef3c7; color: #92400e; }
.mcd-rol-contabilidad { background: #e0e7ff; color: #3730a3; }

.mcd-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.mcd-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.mcd-status-activo     { background: #d1fae5; color: #065f46; }
.mcd-status-suspendido { background: #fee2e2; color: #991b1b; }

.mcd-verif { font-size: 0.875rem; }
.mcd-verif-ok   { color: #16a34a; }
.mcd-verif-no   { color: #d97706; }

.mcd-badge-pend {
  display: inline-block;
  margin-left: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  text-decoration: none;
  border: 1px solid #fde68a;
  vertical-align: middle;
}
.mcd-badge-pend:hover { background: #fde68a; }

.mcd-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.8125rem;
  color: #64748b;
}
.mcd-pager-info b { color: #0f172a; font-variant-numeric: tabular-nums; }
.mcd-pager-controls { display: flex; align-items: center; gap: 0.5rem; }
.mcd-pager-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 0.375rem;
  padding: 0.3rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.mcd-pager-btn:hover:not(:disabled) { background: #f1f5f9; }
.mcd-pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.mcd-select {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  cursor: pointer;
}
.mcd-select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

.mcd-card-toolbar.wrap { flex-wrap: wrap; }
.mcd-card-toolbar label.inline {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-right: 4px;
}

.mcd-actions { display: flex; gap: 0.375rem; justify-content: flex-end; }

.mcd-btn-primary,
.mcd-btn-danger,
.mcd-btn-ghost {
  border: 0;
  border-radius: 0.5rem;
  padding: 0.4rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s ease;
}
.mcd-btn-primary { background: #2563eb; color: #ffffff; }
.mcd-btn-primary:hover { background: #1d4ed8; }
.mcd-btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.mcd-btn-danger  { background: #ffffff; color: #b91c1c; border: 1px solid #fecaca; }
.mcd-btn-danger:hover { background: #fef2f2; }
.mcd-btn-ghost   { background: #ffffff; color: #475569; border: 1px solid #cbd5e1; }
.mcd-btn-ghost:hover { background: #f1f5f9; }

.mcd-modal-back {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.mcd-modal {
  background: #ffffff;
  border-radius: 0.875rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}
.mcd-modal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid #f1f5f9;
}
.mcd-modal h3 { font-size: 0.9375rem; font-weight: 800; margin: 0; color: #0f172a; }
.mcd-modal-x { background: transparent; border: 0; font-size: 1.5rem; line-height: 1; color: #94a3b8; cursor: pointer; }
.mcd-modal-x:hover { color: #0f172a; }
.mcd-modal-body { padding: 1.125rem; font-size: 0.875rem; color: #334155; }
.mcd-modal-body textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-family: inherit;
  resize: vertical;
  margin-top: 0.5rem;
}
.mcd-modal-body textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.mcd-modal footer {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  padding: 0.875rem 1.125rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}

.mcd-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.125rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1100;
  max-width: 380px;
}
.mcd-toast.visible { opacity: 1; transform: translateY(0); }
.mcd-toast[data-type="success"] { background: #15803d; }
.mcd-toast[data-type="error"]   { background: #b91c1c; }

@media (max-width: 768px) {
  .mcd-shell { grid-template-columns: 1fr; }
  .mcd-sidebar { position: static; height: auto; }
  .mcd-main { padding: 1rem; }
  .mcd-input { min-width: 0; width: 100%; }
}
