/* ============================================================
   Intelli-Modular · Tema Premium (sin Velzon)
   Tokens pc-* + componentes (admin shell, auth, cards, tablas,
   formularios, botones, badges, module toggle).
   Una sola palanca de marca: --pc-accent.
   ============================================================ */

:root {
  /* Acento de marca — cambiable por giro/instancia desde settings */
  --pc-accent: #4f46e5;          /* índigo: confianza + premium (defecto) */
  --pc-accent-soft: #eef0ff;
  --pc-accent-rgb: 79, 70, 229;  /* para anillos de foco rgba() */

  /* Neutros */
  --pc-bg: #f3f4f8;
  --pc-surface: #ffffff;
  --pc-text: #1f2235;
  --pc-text-muted: #6b7280;
  --pc-border: #e5e7eb;

  /* Estados */
  --pc-success: #16a34a;
  --pc-warning: #d97706;
  --pc-danger:  #dc2626;
  --pc-info:    #0ea5e9;

  /* Geometría */
  --pc-radius-card: 18px;
  --pc-radius: 12px;
  --pc-shadow: 0 24px 60px -20px rgba(31,27,90,.35);
  --pc-shadow-sm: 0 8px 24px -14px rgba(31,27,90,.30);
  --pc-focus: 0 0 0 4px rgba(var(--pc-accent-rgb), .12);

  /* Layout */
  --pc-sidebar-w: 264px;
  --pc-topbar-h: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--pc-bg);
  color: var(--pc-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--pc-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   ADMIN SHELL (sidebar + topbar + main)
   ============================================================ */
.pc-shell { display: flex; min-height: 100vh; }

.pc-sidebar {
  width: var(--pc-sidebar-w);
  flex-shrink: 0;
  background: var(--pc-surface);
  border-right: 1px solid var(--pc-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1040;
  transition: transform .25s ease;
}
.pc-sidebar-brand {
  height: var(--pc-topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--pc-border);
  font-weight: 600; font-size: 16px; color: var(--pc-text);
}
.pc-sidebar-brand .pc-brand-chip {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--pc-accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  flex-shrink: 0;
}
.pc-sidebar-brand img { max-height: 34px; max-width: 150px; object-fit: contain; }

.pc-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.pc-nav-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--pc-text-muted); font-weight: 600;
  padding: 16px 12px 6px;
}
.pc-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--pc-radius);
  color: var(--pc-text); font-size: 14.5px; font-weight: 500;
  margin-bottom: 2px; transition: background .12s, color .12s;
}
.pc-nav-link:hover { background: var(--pc-bg); text-decoration: none; }
.pc-nav-link.active { background: var(--pc-accent-soft); color: var(--pc-accent); }
.pc-nav-link i { font-size: 19px; flex-shrink: 0; }
.pc-nav-link .pc-nav-badge {
  margin-left: auto; background: var(--pc-warning); color: #fff;
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px;
}

.pc-main {
  flex: 1; margin-left: var(--pc-sidebar-w);
  display: flex; flex-direction: column; min-width: 0;
}
.pc-topbar {
  height: var(--pc-topbar-h);
  background: var(--pc-surface);
  border-bottom: 1px solid var(--pc-border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 1030;
}
.pc-topbar .pc-burger {
  display: none; background: 0; border: 0; font-size: 22px; color: var(--pc-text); cursor: pointer;
}
.pc-topbar .pc-page-title { font-size: 17px; font-weight: 600; margin: 0; }
.pc-topbar .pc-spacer { flex: 1; }
.pc-user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--pc-radius);
  cursor: pointer; color: var(--pc-text);
}
.pc-user-chip:hover { background: var(--pc-bg); text-decoration: none; }
.pc-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--pc-accent-soft); color: var(--pc-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.pc-user-meta { line-height: 1.2; }
.pc-user-meta .pc-user-name { font-size: 14px; font-weight: 600; }
.pc-user-meta .pc-user-role { font-size: 12px; color: var(--pc-text-muted); }

.pc-content { padding: 28px 24px; flex: 1; }
.pc-content-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 22px;
}
.pc-content-head h1 { font-size: 22px; font-weight: 600; margin: 0; }
.pc-breadcrumb { font-size: 13px; color: var(--pc-text-muted); margin: 2px 0 0; }
.pc-breadcrumb a { color: var(--pc-text-muted); }

/* ============================================================
   TARJETAS
   ============================================================ */
.pc-card {
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-card);
  box-shadow: var(--pc-shadow-sm);
}
.pc-card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--pc-border);
  font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.pc-card-body { padding: 20px; }

/* Metric cards (dashboard) */
.pc-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.pc-metric {
  background: var(--pc-surface); border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-card); padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.pc-metric-ico {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--pc-accent-soft); color: var(--pc-accent);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.pc-metric-val { font-size: 26px; font-weight: 700; line-height: 1; }
.pc-metric-label { font-size: 13px; color: var(--pc-text-muted); margin-top: 4px; }

/* ============================================================
   TABLAS
   ============================================================ */
.pc-table-wrap { overflow-x: auto; }
table.pc-table { width: 100%; border-collapse: collapse; }
table.pc-table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--pc-text-muted); font-weight: 600;
  padding: 12px 16px; border-bottom: 1px solid var(--pc-border); background: var(--pc-bg);
}
table.pc-table td { padding: 13px 16px; border-bottom: 1px solid var(--pc-border); font-size: 14.5px; }
table.pc-table tr:last-child td { border-bottom: 0; }
table.pc-table tbody tr:hover { background: #fafbfd; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.pc-field { margin-bottom: 18px; }
.pc-field label, .pc-label { font-size: 13px; color: #4b5563; font-weight: 600; margin: 0 0 6px; display: block; }
.pc-input {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--pc-border); border-radius: var(--pc-radius);
  padding: 0 14px; height: 48px; background: var(--pc-surface);
  transition: border-color .15s, box-shadow .15s;
}
.pc-input:focus-within { border-color: var(--pc-accent); box-shadow: var(--pc-focus); }
.pc-input i.lead-ico { font-size: 18px; color: #9ca3af; }
.pc-input:focus-within i.lead-ico { color: var(--pc-accent); }
.pc-input input, .pc-input select, .pc-input textarea {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 15px; color: var(--pc-text); height: 100%; font-family: inherit;
}
.pc-input textarea { height: auto; padding: 12px 0; resize: vertical; }
.pc-input input:-webkit-autofill,
.pc-input input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset; box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--pc-text); transition: background-color 9999s ease-in-out 0s;
}
.pc-eye { background: 0; border: 0; color: #9ca3af; cursor: pointer; font-size: 18px; display: flex; padding: 4px; }
.pc-eye:hover { color: var(--pc-accent); }
.pc-field-error { color: var(--pc-danger); font-size: 12.5px; margin-top: 5px; }

/* ============================================================
   BOTONES
   ============================================================ */
.pc-btn {
  height: 46px; padding: 0 22px; border: 0; border-radius: var(--pc-radius);
  background: var(--pc-accent); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .15s, transform .05s; text-decoration: none;
}
.pc-btn:hover { filter: brightness(1.07); color: #fff; text-decoration: none; }
.pc-btn:active { transform: scale(.99); }
.pc-btn-block { width: 100%; height: 50px; }
.pc-btn-ghost { background: transparent; color: var(--pc-text); border: 1px solid var(--pc-border); }
.pc-btn-ghost:hover { background: var(--pc-bg); color: var(--pc-text); }
.pc-btn-danger { background: var(--pc-danger); }
.pc-btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.pc-btn-icon { height: 36px; width: 36px; padding: 0; }

/* ============================================================
   BADGES
   ============================================================ */
.pc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px;
  background: var(--pc-accent-soft); color: var(--pc-accent);
}
.pc-badge-success { background: #dcfce7; color: var(--pc-success); }
.pc-badge-warning { background: #fef3c7; color: var(--pc-warning); }
.pc-badge-danger  { background: #fee2e2; color: var(--pc-danger); }
.pc-badge-muted   { background: #f1f3f7; color: var(--pc-text-muted); }

/* ============================================================
   FLASH / ALERTAS
   ============================================================ */
.pc-alert {
  border-radius: var(--pc-radius); padding: 13px 16px; margin-bottom: 18px;
  font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.pc-alert i { font-size: 18px; }
.pc-alert-success { background: #dcfce7; color: #166534; }
.pc-alert-danger  { background: #fee2e2; color: #991b1b; }
.pc-alert-info    { background: #e0f2fe; color: #075985; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.pc-empty { text-align: center; padding: 48px 20px; color: var(--pc-text-muted); }
.pc-empty i { font-size: 44px; opacity: .5; }
.pc-empty p { margin: 12px 0 0; }

/* ============================================================
   MODULE TOGGLE CARDS (activar/desactivar módulos)
   ============================================================ */
.pc-modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pc-module-card {
  background: var(--pc-surface); border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-card); padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  transition: box-shadow .15s, border-color .15s;
}
.pc-module-card.is-active { border-color: var(--pc-accent); box-shadow: var(--pc-shadow-sm); }
.pc-module-card .pc-module-top { display: flex; align-items: flex-start; gap: 12px; }
.pc-module-ico {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--pc-accent-soft); color: var(--pc-accent);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.pc-module-card h3 { font-size: 15.5px; font-weight: 600; margin: 0; }
.pc-module-card .pc-module-code { font-size: 12px; color: var(--pc-text-muted); font-family: monospace; }
.pc-module-card .pc-module-desc { font-size: 13.5px; color: var(--pc-text-muted); flex: 1; }
.pc-module-card .pc-module-deps { font-size: 12px; color: var(--pc-text-muted); }
.pc-module-foot { display: flex; align-items: center; justify-content: space-between; }

/* Switch */
.pc-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.pc-switch input { opacity: 0; width: 0; height: 0; }
.pc-switch .pc-slider {
  position: absolute; cursor: pointer; inset: 0; background: #cbd0da;
  border-radius: 999px; transition: background .2s;
}
.pc-switch .pc-slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
}
.pc-switch input:checked + .pc-slider { background: var(--pc-accent); }
.pc-switch input:checked + .pc-slider::before { transform: translateX(20px); }
.pc-switch input:disabled + .pc-slider { opacity: .5; cursor: not-allowed; }

/* ============================================================
   LOGIN SPLIT-SCREEN (auth)
   ============================================================ */
.pc-login-body {
  margin: 0; min-height: 100vh; background: var(--pc-bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pc-login-card {
  width: 100%; max-width: 920px; background: var(--pc-surface);
  border-radius: var(--pc-radius-card); overflow: hidden;
  display: flex; box-shadow: var(--pc-shadow); min-height: 540px;
}
.pc-login-brand {
  flex: 0 0 42%; background: var(--pc-accent); color: #fff;
  padding: 40px 36px; display: flex; flex-direction: column; justify-content: space-between;
}
.pc-login-brand .pc-brand-top { display: flex; align-items: center; gap: 12px; }
.pc-login-brand .pc-brand-chip {
  width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.pc-login-brand .pc-brand-name { font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.pc-login-brand h1 { color: #fff; font-size: 27px; line-height: 1.25; font-weight: 600; margin: 0 0 12px; }
.pc-login-brand p.lead { color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.6; margin: 0 0 24px; }
.pc-login-brand .pc-points { display: flex; flex-direction: column; gap: 14px; }
.pc-login-brand .pc-points span { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,.92); }
.pc-login-brand .pc-points i { font-size: 19px; opacity: .95; }
.pc-login-brand .pc-foot { font-size: 12.5px; color: rgba(255,255,255,.65); }
.pc-login-form { flex: 1; padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.pc-login-form h2 { font-size: 22px; font-weight: 600; margin: 0 0 4px; color: var(--pc-text); }
.pc-login-form .sub { font-size: 14px; color: var(--pc-text-muted); margin: 0 0 26px; }
.pc-links { text-align: center; margin-top: 18px; }
.pc-links a { font-size: 13.5px; color: var(--pc-accent); }
.pc-links .muted { color: #9ca3af; }

/* ============================================================
   UTILIDADES
   ============================================================ */
.pc-mt-0{margin-top:0}.pc-mb-0{margin-bottom:0}.pc-mb-2{margin-bottom:8px}.pc-mb-3{margin-bottom:16px}.pc-mb-4{margin-bottom:24px}
.pc-flex{display:flex}.pc-items-center{align-items:center}.pc-justify-between{justify-content:space-between}.pc-gap-2{gap:8px}.pc-gap-3{gap:16px}.pc-flex-wrap{flex-wrap:wrap}
.pc-text-muted{color:var(--pc-text-muted)}.pc-text-right{text-align:right}.pc-fw-600{font-weight:600}
.pc-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.pc-w-full{width:100%}
.no-print{}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 992px) {
  .pc-sidebar { transform: translateX(-100%); }
  .pc-sidebar.is-open { transform: translateX(0); box-shadow: var(--pc-shadow); }
  .pc-main { margin-left: 0; }
  .pc-topbar .pc-burger { display: block; }
  .pc-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }
  .pc-backdrop.is-open { display: block; }
}
@media (max-width: 760px) {
  .pc-login-card { flex-direction: column; min-height: 0; max-width: 460px; }
  .pc-login-brand { flex: none; padding: 26px 24px; }
  .pc-login-brand .pc-points, .pc-login-brand .pc-foot { display: none; }
  .pc-login-brand h1 { font-size: 21px; margin: 16px 0 6px; }
  .pc-login-brand p.lead { margin: 0; font-size: 13.5px; }
  .pc-login-form { padding: 30px 26px 36px; }
  .pc-grid-2 { grid-template-columns: 1fr; }
}
@media print {
  .pc-sidebar, .pc-topbar, .no-print { display: none !important; }
  .pc-main { margin-left: 0; }
  body { background: #fff; }
}
