/* Jofer RRHH - sistema de diseno */
:root {
  /* Identidad de marca Jofer: azul principal #0A192F + amarillo secundario #ffef2a */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --border: #e3e8ef;
  --text: #0A192F;
  --muted: #5e6b80;
  --primary: #0A192F;            /* azul principal */
  --primary-ink: #ffffff;
  --primary-soft: #e4e8ef;
  --primary-dark: #050f1f;
  --primary-2: #14294a;          /* azul intermedio para degradados */
  --accent: #ffef2a;             /* amarillo secundario */
  --accent-dark: #e6d500;
  --accent-ink: #0A192F;
  --sidebar: #0A192F;            /* azul principal */
  --sidebar-ink: #9fb0c9;
  --sidebar-active: #ffef2a;     /* barra activa amarilla */
  --ok: #16a34a; --ok-soft:#dcfce7;
  --warn: #b7860b; --warn-soft:#fdf3d7;
  --bad: #dc2626; --bad-soft:#fee2e2;
  --info: #14294a; --info-soft:#e4e8ef;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.05);
  --sidebar-w: 256px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 .5rem; font-weight: 650; color: var(--text); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 1rem; }
small { color: var(--muted); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: var(--sidebar-ink);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform .2s ease;
}
.sidebar__brand {
  display:flex; align-items:center; gap:.6rem;
  padding: 1.1rem 1.25rem; color:#fff; font-weight:700; font-size:1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  display:grid; place-items:center; color:#fff; font-weight:800; font-size:.85rem;
}
.sidebar__nav { flex:1; overflow-y:auto; padding: .4rem 0 2rem; }
.sidebar__logo-mini { display:none; width:30px; height:30px; border-radius:8px; background:linear-gradient(135deg,#ffef2a,#e6d500); color:#0A192F; font-weight:800; font-size:.8rem; align-items:center; justify-content:center; }
.sidebar__collapse { margin-left:auto; background:none; border:none; color:var(--sidebar-ink); cursor:pointer; padding:.25rem; border-radius:6px; display:flex; }
.sidebar__collapse:hover { background:rgba(255,255,255,.08); color:#fff; }

/* Grupos colapsables (acordeon) */
.nav-group-wrap { border-bottom:1px solid rgba(255,255,255,.04); }
.nav-group-toggle {
  width:100%; display:flex; align-items:center; gap:.5rem; cursor:pointer;
  background:none; border:none; text-align:left;
  padding:.6rem 1.25rem .5rem; color:#7c8aa5;
  font-size:.68rem; text-transform:uppercase; letter-spacing:.08em; font-weight:700; font-family:inherit;
}
.nav-group-toggle:hover { color:#aab6cf; }
.nav-group-toggle .nav-chev { width:14px; height:14px; margin-left:auto; transition:transform .18s ease; opacity:.7; }
.nav-group-wrap:not(.closed) .nav-group-toggle .nav-chev { transform:rotate(90deg); }
.nav-group-items { overflow:hidden; }
.nav-group-wrap.closed .nav-group-items { display:none; }

.nav-item {
  display:flex; align-items:center; gap:.7rem;
  padding: .5rem 1.25rem; color: var(--sidebar-ink);
  font-size:.9rem; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.05); color:#fff; text-decoration:none; }
.nav-item.active { background: rgba(255,239,42,.12); color:#fff; border-left-color: var(--sidebar-active); }
.nav-item .ico { width:18px; height:18px; flex:none; opacity:.9; }

/* Barra lateral contraida a rail de iconos (desktop) */
@media (min-width: 761px) {
  body.sidebar-collapsed { --sidebar-w: 68px; }
  body.sidebar-collapsed .sidebar__brand { flex-direction:column; gap:.5rem; justify-content:center; padding:.9rem .4rem; }
  body.sidebar-collapsed .sidebar__logo,
  body.sidebar-collapsed .sidebar__brand-text,
  body.sidebar-collapsed .nav-group-label,
  body.sidebar-collapsed .nav-chev,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .app-switch__name,
  body.sidebar-collapsed .app-switch__hint { display:none; }
  body.sidebar-collapsed .sidebar__logo-mini { display:flex; }
  /* El boton de expandir sigue visible y centrado */
  body.sidebar-collapsed .sidebar__collapse { margin:0 auto; }
  body.sidebar-collapsed .app-switch { padding:.5rem; }
  body.sidebar-collapsed .app-switch a { justify-content:center; padding:.45rem 0; }
  body.sidebar-collapsed .nav-group-toggle { padding:.3rem 0; justify-content:center; }
  body.sidebar-collapsed .nav-group-wrap.closed .nav-group-items { display:block; } /* en rail se muestran todos los iconos */
  body.sidebar-collapsed .nav-item { justify-content:center; padding:.6rem 0; gap:0; }
  body.sidebar-collapsed .nav-item .ico { opacity:1; }

  /* Tooltip con el nombre del apartado al pasar el raton (solo en rail) */
  body.sidebar-collapsed .nav-item { position:relative; }
  body.sidebar-collapsed .nav-item:hover::after {
    content: attr(data-label);
    position:absolute; left:calc(100% + 6px); top:50%; transform:translateY(-50%);
    background:#0f1b33; color:#fff; padding:.35rem .6rem; border-radius:7px;
    white-space:nowrap; font-size:.82rem; z-index:120; box-shadow:0 4px 14px rgba(0,0,0,.35); pointer-events:none;
  }
  body.sidebar-collapsed .nav-item:hover::before {
    content:''; position:absolute; left:calc(100% + 1px); top:50%; transform:translateY(-50%);
    border:5px solid transparent; border-right-color:#0f1b33; z-index:120; pointer-events:none;
  }
  body.sidebar-collapsed .app-switch a { position:relative; }
  body.sidebar-collapsed .app-switch a:hover::after {
    content: attr(data-label); position:absolute; left:calc(100% + 6px); top:50%; transform:translateY(-50%);
    background:#0f1b33; color:#fff; padding:.35rem .6rem; border-radius:7px; white-space:nowrap; font-size:.82rem; z-index:120; box-shadow:0 4px 14px rgba(0,0,0,.35);
  }
}

.main { flex:1; margin-left: var(--sidebar-w); min-width:0; display:flex; flex-direction:column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:1rem; padding: 0 1.5rem; position:sticky; top:0; z-index:30;
}
.topbar__title { font-weight:650; font-size:1.05rem; }
.topbar__spacer { flex:1; }
.topbar__icon { display:flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:10px; color:var(--muted); }
.topbar__icon:hover { background:var(--surface-2); color:var(--text); }
.topbar__user { display:flex; align-items:center; gap:.6rem; position:relative; }
.user-trigger { display:flex; align-items:center; gap:.6rem; background:none; border:1px solid transparent; border-radius:10px; padding:.3rem .5rem; cursor:pointer; font-family:inherit; color:var(--text); }
.user-trigger:hover { background:var(--surface-2); border-color:var(--border); }
.user-trigger__info { line-height:1.1; text-align:left; }
.user-trigger__name { font-weight:600; font-size:.88rem; }
.user-trigger__info small { color:var(--muted); }
.user-caret { width:15px; height:15px; opacity:.6; transition:transform .15s ease; }
.topbar__user.open .user-caret { transform:rotate(90deg); }
.user-dropdown {
  position:absolute; top:calc(100% + 8px); right:0; min-width:220px;
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow); padding:.35rem; display:none; z-index:50;
}
.topbar__user.open .user-dropdown { display:block; animation:modalPop .12s ease; }
.user-dropdown__head { padding:.55rem .65rem; border-bottom:1px solid var(--border); margin-bottom:.3rem; }
.user-dropdown__item { display:flex; align-items:center; gap:.6rem; padding:.55rem .65rem; border-radius:8px; color:var(--text); font-size:.9rem; }
.user-dropdown__item:hover { background:var(--surface-2); text-decoration:none; }
.user-dropdown__item .ico { width:17px; height:17px; opacity:.75; }
.user-dropdown__item--danger { color:var(--bad); }
.user-dropdown__item--danger .ico { opacity:1; }
@media (max-width:760px){ .user-trigger__info { display:none; } }
.hamburger { display:none; background:none; border:none; cursor:pointer; padding:.3rem; }
.content { padding: 1.5rem; max-width: 1200px; width:100%; }

.avatar {
  width:34px; height:34px; border-radius:50%; background:var(--primary-soft);
  color:var(--primary); display:grid; place-items:center; font-weight:700; font-size:.8rem; flex:none;
}
.avatar--lg { width:64px; height:64px; font-size:1.3rem; }

/* ---------- Cards / grid ---------- */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.card__body { padding: 1.1rem 1.25rem; }
.card__head { padding: .9rem 1.25rem; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:.75rem; }
.card__head h3 { margin:0; }
.grid { display:grid; gap:1rem; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }
.page-head { display:flex; align-items:flex-start; gap:1rem; margin-bottom:1.25rem; flex-wrap:wrap; }
.page-head h1 { margin:0; }
.page-head .sub { color:var(--muted); font-size:.9rem; }
.page-head__actions { margin-left:auto; display:flex; gap:.5rem; flex-wrap:wrap; }

/* ---------- Stats ---------- */
.stat { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1.1rem 1.25rem; box-shadow:var(--shadow); }
.stat__label { color:var(--muted); font-size:.82rem; font-weight:600; }
.stat__value { font-size:1.9rem; font-weight:720; line-height:1.1; margin-top:.25rem; }
.stat__hint { font-size:.8rem; color:var(--muted); margin-top:.2rem; }
.stat__icon { float:right; width:40px; height:40px; border-radius:10px; background:var(--primary-soft); color:var(--primary); display:grid; place-items:center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x:auto; }
table.data { width:100%; border-collapse:collapse; font-size:.9rem; }
table.data th, table.data td { padding:.7rem .85rem; text-align:left; border-bottom:1px solid var(--border); vertical-align:middle; }
table.data th { font-size:.72rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); font-weight:700; background:var(--surface-2); position:sticky; top:0; }
table.data tbody tr:hover { background:var(--surface-2); }
table.data td.num, table.data th.num { text-align:right; font-variant-numeric:tabular-nums; }

/* ---------- Badges ---------- */
.badge { display:inline-flex; align-items:center; gap:.3rem; padding:.18rem .55rem; border-radius:999px; font-size:.75rem; font-weight:650; }
.badge.ok{ background:var(--ok-soft); color:var(--ok);} .badge.warn{background:var(--warn-soft);color:var(--warn);}
.badge.bad{ background:var(--bad-soft); color:var(--bad);} .badge.info{background:var(--info-soft);color:var(--info);}
.badge.muted{ background:#f1f5f9; color:var(--muted);}

/* ---------- Buttons ---------- */
.btn { display:inline-flex; align-items:center; gap:.45rem; padding:.5rem .9rem; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface); color:var(--text); font-weight:600; font-size:.9rem; cursor:pointer; transition:.12s; text-decoration:none; }
.btn:hover { background:var(--surface-2); text-decoration:none; }
.btn .ico { width:16px; height:16px; }
.btn--primary { background:var(--primary); border-color:var(--primary); color:var(--primary-ink); }
.btn--primary:hover { background:var(--primary-dark); }
.btn--accent { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:700; }
.btn--accent:hover { background:var(--accent-dark); }
.btn--danger { background:var(--bad); border-color:var(--bad); color:#fff; }
.btn--ghost { background:transparent; border-color:transparent; }
.btn--sm { padding:.32rem .6rem; font-size:.82rem; }
.btn--block { width:100%; justify-content:center; }
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

/* ---------- Forms ---------- */
.form-row { margin-bottom:1rem; }
.form-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:1rem; }
label.lbl { display:block; font-size:.82rem; font-weight:650; margin-bottom:.3rem; color:#334155; }
.input, select.input, textarea.input {
  width:100%; padding:.55rem .7rem; border:1px solid var(--border); border-radius:var(--radius-sm);
  font:inherit; background:var(--surface); color:var(--text);
}
.input:focus, select.input:focus, textarea.input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
textarea.input { min-height:90px; resize:vertical; }
.field-error { color:var(--bad); font-size:.8rem; margin-top:.25rem; }
.hint { color:var(--muted); font-size:.82rem; }

/* ---------- Flash / toast ---------- */
.flash { padding:.75rem 1rem; border-radius:var(--radius-sm); margin-bottom:1rem; font-size:.9rem; border:1px solid transparent; }
.flash.ok { background:var(--ok-soft); color:#14532d; border-color:#bbf7d0; }
.flash.bad { background:var(--bad-soft); color:#7f1d1d; border-color:#fecaca; }
#toasts { position:fixed; right:1rem; bottom:1rem; z-index:100; display:flex; flex-direction:column; gap:.5rem; }
.toast { background:var(--text); color:#fff; padding:.7rem 1rem; border-radius:var(--radius-sm); box-shadow:var(--shadow); font-size:.9rem; animation:slidein .2s; }
.toast.ok{ background:var(--ok);} .toast.bad{ background:var(--bad);}
@keyframes slidein { from{ transform:translateY(8px); opacity:0;} to{opacity:1;} }

/* ---------- Modal propio (confirmaciones / dialogos) ---------- */
.modal-overlay {
  position:fixed; inset:0; background:rgba(10,25,47,.55);
  display:flex; align-items:center; justify-content:center; z-index:200; padding:1rem;
  animation:modalFade .12s ease;
}
@keyframes modalFade { from{opacity:0} to{opacity:1} }
.modal {
  background:var(--surface); border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.35);
  width:100%; max-width:420px; overflow:hidden; border-top:4px solid var(--accent);
  animation:modalPop .14s ease;
}
@keyframes modalPop { from{transform:translateY(8px);opacity:.6} to{transform:none;opacity:1} }
.modal__title { padding:1rem 1.25rem .25rem; font-weight:700; font-size:1.05rem; }
.modal__body { padding:1.25rem 1.25rem 1rem; color:var(--text); font-size:.95rem; line-height:1.5; }
.modal__actions { display:flex; justify-content:flex-end; gap:.5rem; padding:0 1.25rem 1.25rem; }

/* ---------- Auth ---------- */
.auth { min-height:100vh; display:grid; place-items:center; background:linear-gradient(140deg,#050f1f 0%,#0A192F 55%,#14294a 100%); padding:1rem; }
.auth__card { background:var(--surface); border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.35); width:100%; max-width:410px; padding:2rem; border-top:4px solid var(--accent); }
.auth__brand { display:flex; align-items:center; justify-content:center; margin-bottom:1.5rem; }
.auth__brand img { max-width:230px; height:auto; }

/* ---------- Misc ---------- */
.muted { color:var(--muted); }
.row { display:flex; align-items:center; gap:.75rem; }
.gap-sm{ gap:.4rem;} .mt{ margin-top:1rem;} .mb{ margin-bottom:1rem;} .tright{ text-align:right;}
.chip { display:inline-block; padding:.15rem .5rem; background:var(--surface-2); border:1px solid var(--border); border-radius:6px; font-size:.78rem; }
.empty { text-align:center; padding:2.5rem 1rem; color:var(--muted); }
.empty .ico { width:40px; height:40px; opacity:.4; margin-bottom:.5rem; }
.divider { height:1px; background:var(--border); margin:1rem 0; }
.list-reset { list-style:none; margin:0; padding:0; }
.tabs { display:flex; gap:.25rem; border-bottom:1px solid var(--border); margin-bottom:1.25rem; flex-wrap:wrap; }
.tab { padding:.55rem .9rem; font-weight:600; font-size:.9rem; color:var(--muted); border-bottom:2px solid transparent; }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }
.tab:hover { text-decoration:none; color:var(--text); }
.progress { height:8px; background:var(--surface-2); border-radius:999px; overflow:hidden; }
.progress > span { display:block; height:100%; background:var(--primary); }

/* Organigrama */
.org-tree, .org-tree ul { list-style:none; margin:0; padding:0; }
.org-node { padding:.6rem .8rem; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); display:inline-flex; align-items:center; gap:.5rem; box-shadow:var(--shadow); }
.org-tree ul { margin-left:1.5rem; border-left:2px solid var(--border); padding-left:1rem; }
.org-tree li { margin:.5rem 0; }

/* Calendario simple */
.cal { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal__dow { text-align:center; font-size:.72rem; color:var(--muted); font-weight:700; text-transform:uppercase; padding:.3rem 0; }
.cal__day { min-height:64px; border:1px solid var(--border); border-radius:8px; padding:.3rem; font-size:.8rem; background:var(--surface); }
.cal__day.out { background:var(--surface-2); color:var(--muted); }
.cal__day .n { font-weight:650; }
.cal__ev { font-size:.68rem; padding:.05rem .3rem; border-radius:4px; margin-top:.15rem; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }

/* ---------- Portal (landing multi-app) ---------- */
.portal-body { background:var(--bg); min-height:100vh; }
.portal-topbar { height:64px; background:var(--surface); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:1rem; padding:0 1.5rem; position:sticky; top:0; z-index:30; }
.portal-brand { display:flex; align-items:center; gap:.7rem; }
.portal-brand:hover { text-decoration:none; }
.portal-brand__sep { width:1px; height:26px; background:var(--border); }
.portal-brand__name { font-weight:700; color:var(--text); font-size:1.05rem; }
.portal-main { max-width:1100px; margin:0 auto; padding:2.5rem 1.5rem; }
.portal-footer { text-align:center; color:var(--muted); font-size:.78rem; margin-top:3rem; padding-top:1.5rem; border-top:1px solid var(--border); }
.portal-hero { margin-bottom:1.75rem; }
.portal-hero h1 { font-size:1.7rem; margin:0 0 .25rem; }
.app-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px,1fr)); gap:1.1rem; }
.app-card {
  display:flex; align-items:center; gap:1rem; padding:1.25rem; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  color:var(--text); transition:.14s; position:relative;
}
.app-card:hover { text-decoration:none; transform:translateY(-2px); box-shadow:0 8px 24px rgba(10,25,47,.1); border-color:#cdd6e4; }
.app-card--disabled { opacity:.7; cursor:not-allowed; }
.app-card--disabled:hover { transform:none; box-shadow:var(--shadow); border-color:var(--border); }
.app-card__icon { width:52px; height:52px; border-radius:14px; display:grid; place-items:center; flex:none; }
.app-card__icon .ico { width:26px; height:26px; }
.app-card__body { flex:1; min-width:0; }
.app-card__name { font-weight:700; font-size:1.05rem; }
.app-card__desc { font-size:.85rem; margin-top:.15rem; }
.app-card__go { color:var(--muted); }
.app-card__badge { position:absolute; top:.75rem; right:.75rem; }

/* Selector de app en el sidebar */
.app-switch { padding:.6rem 1rem; border-bottom:1px solid rgba(255,255,255,.08); }
.app-switch a { display:flex; align-items:center; gap:.55rem; color:#fff; padding:.4rem .5rem; border-radius:8px; background:rgba(255,255,255,.05); font-size:.85rem; }
.app-switch a:hover { background:rgba(255,255,255,.12); text-decoration:none; }
.app-switch .ico { width:16px; height:16px; opacity:.85; }
.app-switch__name { font-weight:600; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-switch__hint { font-size:.62rem; text-transform:uppercase; letter-spacing:.06em; opacity:.6; }
body.sidebar-collapsed .app-switch__name, body.sidebar-collapsed .app-switch__hint { display:none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns:repeat(2,1fr);} .grid-3{grid-template-columns:1fr 1fr;}
  .form-grid { grid-template-columns:1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { margin-left:0; }
  .hamburger { display:block; }
  .grid-2,.grid-3,.grid-4 { grid-template-columns:1fr; }
  .content { padding:1rem; }
  body.nav-open::after { content:""; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:35; }
}

/* === CRM === */
/* Tablero kanban del embudo de ventas. Usa las variables de marca. */
.crm-board { display:flex; gap:1rem; overflow-x:auto; padding-bottom:.75rem; align-items:flex-start; }
.crm-col {
  flex:0 0 280px; width:280px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:var(--radius); display:flex; flex-direction:column;
}
.crm-col__head {
  display:flex; align-items:center; gap:.45rem; padding:.7rem .85rem;
  border-bottom:1px solid var(--border); font-size:.85rem;
}
.crm-col__dot { width:10px; height:10px; border-radius:999px; flex:none; }
.crm-col__name { font-weight:700; color:var(--text); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.crm-col__count { background:var(--primary-soft); color:var(--primary); border-radius:999px; padding:.05rem .5rem; font-weight:700; font-size:.75rem; }
.crm-col__sum { width:100%; color:var(--muted); font-size:.78rem; font-weight:600; order:3; flex-basis:100%; margin-top:.2rem; }
.crm-col__body { padding:.6rem; display:flex; flex-direction:column; gap:.6rem; min-height:80px; flex:1; }
.crm-col__body.dropover { background:var(--primary-soft); border-radius:var(--radius); outline:2px dashed var(--primary); outline-offset:-4px; }
.crm-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:.65rem .7rem; box-shadow:var(--shadow); cursor:grab;
}
.crm-card:active { cursor:grabbing; }
.crm-card.dragging { opacity:.5; }
.crm-card__title { display:block; font-weight:650; color:var(--text); margin-bottom:.3rem; }
.crm-card__title:hover { text-decoration:none; color:var(--primary); }
.crm-card__sub { display:flex; align-items:center; gap:.3rem; font-size:.78rem; color:var(--muted); margin-top:.1rem; }
.crm-card__sub .ico { width:14px; height:14px; flex:none; }
.crm-card__foot { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-top:.5rem; }
.crm-card__valor { font-weight:720; color:var(--primary); font-size:.85rem; }
.crm-card__fecha { display:inline-flex; align-items:center; gap:.25rem; font-size:.72rem; color:var(--muted); }
.crm-card__fecha .ico { width:13px; height:13px; }
@media (max-width: 760px) {
  .crm-col { flex-basis:85vw; width:85vw; }
}

/* === CUADRO DE MANDOS === */
/* Cabecera de KPIs globales sobre el azul de marca */
.cuadro-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-2) 100%);
  border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
}
.cuadro-hero__grid { display:grid; grid-template-columns:repeat(4,1fr); gap:1.25rem; }
.cuadro-hero__item { color:#fff; position:relative; padding-right:.5rem; }
.cuadro-hero__item + .cuadro-hero__item { border-left:1px solid rgba(255,255,255,.12); padding-left:1.25rem; }
.cuadro-hero__ico { width:34px; height:34px; border-radius:9px; background:rgba(255,239,42,.15); color:var(--accent); display:grid; place-items:center; margin-bottom:.5rem; }
.cuadro-hero__ico .ico { width:19px; height:19px; }
.cuadro-hero__value { font-size:1.9rem; font-weight:720; line-height:1.05; color:#fff; }
.cuadro-hero__value--sm { font-size:1.25rem; }
.cuadro-hero__label { font-size:.82rem; color:rgba(255,255,255,.72); margin-top:.25rem; }

/* Secciones del cuadro */
.cuadro-sec { margin-bottom:1.75rem; }
.cuadro-sec__head { display:flex; align-items:center; gap:.6rem; margin-bottom:.9rem; }
.cuadro-sec__head h2 { display:flex; align-items:center; gap:.5rem; margin:0; font-size:1.15rem; }
.cuadro-sec__head h2 .ico { width:20px; height:20px; color:var(--primary); }
.cuadro-sec__head .badge { margin-left:.25rem; }
.cuadro-sec__link { margin-left:auto; display:inline-flex; align-items:center; gap:.2rem; font-size:.85rem; font-weight:600; color:var(--muted); }
.cuadro-sec__link .ico { width:15px; height:15px; }
.cuadro-sec__link:hover { color:var(--primary); text-decoration:none; }

.stat__value--sm { font-size:1.3rem; }

/* Mini-grafica de barras verticales (HTML/CSS) */
.mini-bars { display:flex; align-items:flex-end; gap:.6rem; height:140px; padding-top:.5rem; }
.mini-bars__col { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; min-width:0; }
.mini-bars__val { font-size:.75rem; font-weight:700; color:var(--muted); margin-bottom:.2rem; }
.mini-bars__bar { width:100%; max-width:38px; background:var(--primary); border-radius:6px 6px 0 0; transition:height .2s ease; }
.mini-bars__bar--accent { background:var(--accent); }
.mini-bars__lbl { font-size:.72rem; color:var(--muted); margin-top:.35rem; text-transform:uppercase; letter-spacing:.03em; }

/* Mini-grafica SVG (sparkline / linea) generada en PHP */
.cuadro-spark { width:100%; height:110px; display:block; }
.cuadro-spark__labels { display:flex; justify-content:space-between; margin-top:.35rem; }
.cuadro-spark__labels span { font-size:.72rem; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }

/* Barras horizontales (pipeline por etapa, plantilla por departamento) */
.hbar { display:grid; grid-template-columns:140px 1fr auto; align-items:center; gap:.75rem; margin-bottom:.7rem; }
.hbar:last-child { margin-bottom:0; }
.hbar__label { font-size:.85rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hbar__track { height:14px; background:var(--surface-2); border-radius:999px; overflow:hidden; }
.hbar__track > span { display:block; height:100%; background:var(--primary); border-radius:999px; transition:width .2s ease; }
.hbar__value { font-size:.85rem; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
@media (max-width:560px){ .hbar { grid-template-columns:100px 1fr auto; gap:.5rem; } }

/* Tarjetas de bloque "proximamente" */
.cuadro-soon { border-style:dashed; }
.cuadro-soon .card__head { border-bottom-style:dashed; }
.cuadro-soon__badge { margin-left:auto; }
.cuadro-soon__list { list-style:none; margin:0; padding:0; }
.cuadro-soon__list li { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.5rem 0; border-bottom:1px solid var(--border); font-size:.9rem; }
.cuadro-soon__list li:last-child { border-bottom:none; }
.cuadro-soon__list li strong { color:var(--muted); }

/* Mini contadores */
.cuadro-mini { background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:.6rem .5rem; text-align:center; }
.cuadro-mini__v { font-size:1.4rem; font-weight:720; line-height:1; }
.cuadro-mini__l { font-size:.72rem; color:var(--muted); margin-top:.25rem; }

@media (max-width: 900px) {
  .cuadro-hero__grid { grid-template-columns:repeat(2,1fr); gap:1rem; }
  .cuadro-hero__item + .cuadro-hero__item { border-left:none; padding-left:.5rem; }
}
@media (max-width: 560px) {
  .cuadro-hero__grid { grid-template-columns:1fr 1fr; }
}
