/*
 * Yevo Design System — yevo.css
 * Paleta y componentes SGT adaptados a HTML/CSS puro (sin Tailwind build step).
 * Usar con: <link rel="stylesheet" href="/static/shared/yevo.css">
 */

/* ── Paleta de color ──────────────────────────────────────────────────────── */
:root {
  --yevo-50:  #faf5ff;
  --yevo-100: #f3e8ff;
  --yevo-200: #e9d5ff;
  --yevo-300: #d8b4fe;
  --yevo-400: #c084fc;
  --yevo-500: #a855f7;
  --yevo-600: #9333ea;
  --yevo-700: #7e22ce;
  --yevo-800: #6b21a8;
  --yevo-900: #581c87;
  --yevo-950: #3b0764;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-600: #16a34a;
  --green-800: #166534;

  --red-50:   #fef2f2;
  --red-100:  #fee2e2;
  --red-600:  #dc2626;
  --red-700:  #b91c1c;

  --yellow-50:  #fefce8;
  --yellow-100: #fef9c3;
  --yellow-700: #a16207;

  --blue-100: #dbeafe;
  --blue-700: #1d4ed8;

  /* Sidebar */
  --sb-bg:           var(--yevo-950);
  --sb-border:       rgba(88,28,135,.5);
  --sb-section-lbl:  rgba(196,148,255,.4);
  --sb-item:         var(--yevo-300);
  --sb-item-hover-bg:rgba(126,34,206,.25);
  --sb-item-hover:   #fff;
  --sb-item-active-bg:rgba(126,34,206,.4);
  --sb-item-active:  #fff;
  --sb-footer-border:rgba(88,28,135,.4);
}

/* ── Reset mínimo ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
}

/* ── Botones ──────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: var(--yevo-700);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--yevo-800); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: var(--yevo-100);
  color: var(--yevo-800);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--yevo-200); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: var(--red-600);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-danger:hover { background: var(--red-700); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--gray-50); }

.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

/* ── Tarjetas ─────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
}

/* ── Formularios ──────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-900);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--yevo-500);
  box-shadow: 0 0 0 3px rgba(168,85,247,.1);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-group { margin-bottom: 14px; }

/* ── Tablas ───────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-header {
  background: var(--yevo-800);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}
.table-header.text-center { text-align: center; }
.table-header.text-right  { text-align: right; }
tbody tr { border-bottom: 1px solid var(--gray-50); transition: background .1s; }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: 11px 16px; color: var(--gray-600); vertical-align: middle; }
.td-name { color: var(--gray-900); font-weight: 600; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success { background: var(--green-50);  color: var(--green-600); border: 1px solid var(--green-100); }
.badge-danger  { background: var(--red-50);    color: var(--red-600);   border: 1px solid var(--red-100);   }
.badge-warning { background: var(--yellow-50); color: var(--yellow-700);border: 1px solid var(--yellow-100);}
.badge-info    { background: var(--yevo-100);  color: var(--yevo-800);  border: 1px solid var(--yevo-200);  }
.badge-blue    { background: var(--blue-100);  color: var(--blue-700);  border: 1px solid #bfdbfe;          }

/* ── Hero banner ──────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--yevo-800) 0%, var(--yevo-700) 40%, var(--yevo-900) 100%);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  left: -20px; bottom: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  pointer-events: none;
}
.hero-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 4px;
  position: relative;
}
.hero-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  position: relative;
}
.hero-desc {
  font-size: 13px;
  color: rgba(255,255,255,.75);
  line-height: 1.5;
  position: relative;
}

/* ── Stats grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
@media(max-width:900px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:500px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}
.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}
.stat-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
}
.overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px; border: none;
  background: var(--gray-100);
  cursor: pointer;
  font-size: 16px;
  color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--red-100); color: var(--red-600); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Alertas inline ───────────────────────────────────────────────────────── */
.alert {
  display: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.alert.show { display: block; }
.alert-error   { background: var(--red-50);   border: 1px solid var(--red-100);   color: var(--red-600);  }
.alert-success { background: var(--green-50); border: 1px solid var(--green-100); color: var(--green-600);}
/* Default (backward compat) — error */
.alert:not(.ok):not(.alert-success) { background: var(--red-50); border: 1px solid var(--red-100); color: var(--red-600); }
.alert.ok, .alert.show.ok { display: block; background: var(--green-50); border: 1px solid var(--green-100); color: var(--green-600); }

/* ── Sidebar (para páginas standalone) ───────────────────────────────────── */
.sidebar {
  width: 230px;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sb-brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--yevo-500), var(--yevo-700));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sb-brand-icon svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sb-brand-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.sb-brand-sub  { font-size: 10px; color: var(--yevo-400); line-height: 1; }
.sb-nav { flex: 1; padding: 12px 10px; overflow-y: auto; overflow-x: hidden; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--sb-border); border-radius: 4px; }
.sb-section { margin-bottom: 4px; }
.sb-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--sb-section-lbl);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 10px 4px;
}
.sb-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  font-size: 13px; color: var(--sb-item);
  text-decoration: none;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  white-space: nowrap; overflow: hidden;
}
.sb-item:hover  { background: var(--sb-item-hover-bg);  color: var(--sb-item-hover);  }
.sb-item.active { background: var(--sb-item-active-bg); color: var(--sb-item-active); font-weight: 600; }
.sb-icon { flex-shrink: 0; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.sb-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sb-footer { padding: 14px 14px 16px; border-top: 1px solid var(--sb-footer-border); flex-shrink: 0; }
.sb-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sb-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--yevo-500), var(--yevo-700));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 11px; color: var(--yevo-400); }
.sb-logout {
  width: 100%; padding: 7px 10px; border-radius: 7px;
  background: rgba(255,255,255,.05); border: 1px solid var(--sb-border);
  color: var(--yevo-400); font-size: 12px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-align: left; display: flex; align-items: center; gap: 8px;
}
.sb-logout svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sb-logout:hover { background: rgba(248,113,113,.1); color: #f87171; border-color: rgba(248,113,113,.2); }

/* ── Topbar (para páginas standalone) ────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 230px; right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.breadcrumb a { color: var(--gray-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--yevo-700); }
.bc-sep { color: var(--gray-300); font-size: 11px; }
.bc-current { color: var(--gray-900); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-date  { font-size: 12px; color: var(--gray-400); white-space: nowrap; }
.topbar-uname { font-size: 13px; color: var(--gray-500); font-weight: 500; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.topbar-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--yevo-500), var(--yevo-700));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--gray-500); font-size: 20px; flex-shrink: 0; line-height: 1; }

/* ── Layout page-wrap ─────────────────────────────────────────────────────── */
.page-wrap { margin-left: 230px; padding-top: 56px; min-height: 100vh; }
.main { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }

/* ── In-frame overrides ───────────────────────────────────────────────────── */
html.in-frame .sidebar,
html.in-frame .sb-overlay,
html.in-frame .topbar { display: none !important; }
html.in-frame .page-wrap { margin-left: 0 !important; padding-top: 0 !important; width: 100% !important; }
html.in-frame body { overflow: auto; }

/* ── Sidebar overlay (mobile) ─────────────────────────────────────────────── */
.sb-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150; display: none; }
.sb-overlay.show { display: block; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; align-items: center; }
  .page-wrap { margin-left: 0; }
  .topbar { left: 0; }
}
@media(max-width:900px) { .topbar-date, .topbar-uname { display: none; } }

/* ── Utility misc ─────────────────────────────────────────────────────────── */
.text-muted { color: var(--gray-400); }
.overflow-x-auto { overflow-x: auto; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.p-0 { padding: 0 !important; }
.text-sm { font-size: 13px; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }

/* ── Confirm modal global ─────────────────────────────────────────────────── */
.confirm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(17,24,39,.55);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.confirm-backdrop.show { display: flex; }
.confirm-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 48px rgba(0,0,0,.18);
  overflow: hidden;
}
.confirm-stripe { height: 4px; }
.confirm-body { padding: 24px; }
.confirm-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.confirm-icon svg { width: 20px; height: 20px; }
.confirm-title { font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.confirm-msg   { font-size: 13px; color: var(--gray-500); line-height: 1.5; }
.confirm-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-end; }
