:root {
  --bg: #0a111e;
  --panel: #0f1a2c;
  --panel2: #142136;
  --elev: #1a2a44;
  --line: rgba(148,163,184,.14);
  --line2: rgba(148,163,184,.28);
  --txt: #e7eef8;
  --muted: #93a4bd;
  --dim: #647189;
  --brand: #0091ce;
  --brand-deep: #02719f;
  --tec: #1ba6e0;
  --com: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 14px;
  --radius-s: 10px;
  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #eef1f7; --panel: #ffffff; --panel2: #f2f5fa; --elev: #e7edf6;
  --line: rgba(20,40,70,.12); --line2: rgba(20,40,70,.20);
  --txt: #17243a; --muted: #54627a; --dim: #8492a8;
  --tec: #0e80b8; --com: #7b5bd6; --ok: #15a34a; --warn: #c77a06; --danger: #e23a57;
}
[data-theme="light"] body { background: radial-gradient(1200px 600px at 80% -10%, #dde8f6 0%, var(--bg) 55%) fixed; }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: #ffffff; }
[data-theme="light"] .sidebar { background: linear-gradient(180deg, #ffffff, #f3f6fb); }
[data-theme="light"] .topbar { background: rgba(255,255,255,.85); }
[data-theme="light"] .t0, [data-theme="light"] .c0 { background: #e8edf5; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c4d0e2; }
[data-theme="light"] .modal { box-shadow: 0 30px 80px rgba(20,40,70,.25); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 80% -10%, #11223c 0%, var(--bg) 55%) fixed;
  color: var(--txt);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
.boot { padding: 4rem; text-align: center; color: var(--muted); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #20324f; border-radius: 8px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 20px; padding: 2.2rem; box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.login-card .logo { display: block; margin: 0 auto 1.6rem; }
.login-card h1 { font-size: 1.15rem; text-align: center; margin: 0 0 .3rem; font-weight: 600; }
.login-card .sub { text-align: center; color: var(--muted); margin: 0 0 1.6rem; font-size: .85rem; }
.login-hint { margin-top: 1.2rem; font-size: .72rem; color: var(--dim); text-align: center; line-height: 1.7; }

/* ---------- Form controls ---------- */
label { display: block; font-size: .76rem; color: var(--muted); margin: 0 0 .35rem; font-weight: 500; letter-spacing: .2px; }
input, select, textarea {
  width: 100%; background: #0c1626; border: 1px solid var(--line2); color: var(--txt);
  border-radius: var(--radius-s); padding: .6rem .7rem; font-family: inherit; font-size: .9rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(52,227,245,.14); }
.field { margin-bottom: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--txt);
  padding: .55rem .9rem; border-radius: var(--radius-s); font-size: .85rem; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--line2); background: var(--elev); }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(180deg, var(--brand), var(--brand-deep)); color: #fff; border: none; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-danger { color: var(--danger); border-color: rgba(251,113,133,.35); background: rgba(251,113,133,.08); }
.btn-danger:hover { background: rgba(251,113,133,.16); }
.btn-sm { padding: .35rem .6rem; font-size: .78rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .4rem .5rem; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0d1727, #0a111e); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1.2rem .9rem; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: .2rem .4rem 1.3rem; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }
.nav::-webkit-scrollbar-thumb:hover { background: var(--dim); }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: var(--radius-s);
  color: var(--muted); font-size: .88rem; font-weight: 500; transition: .12s;
}
.nav a:hover { background: var(--panel2); color: var(--txt); }
.nav a.active { background: linear-gradient(90deg, rgba(52,227,245,.16), rgba(52,227,245,.03)); color: var(--brand); box-shadow: inset 2px 0 0 var(--brand); }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.nav .sep { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--dim); padding: 1rem .7rem .3rem; }
.nav-row { display: flex; align-items: center; gap: 1px; border-radius: 8px; }
.nav-row > a, .nav-row > .sep { flex: 1; min-width: 0; }
.nav-handle { cursor: grab; color: var(--dim); opacity: 0; padding: .2rem .15rem; font-size: .8rem; line-height: 1; user-select: none; flex-shrink: 0; transition: opacity .12s; }
.nav-row:hover .nav-handle { opacity: .5; }
.nav-handle:hover { opacity: 1; color: var(--brand); }
.nav-handle:active { cursor: grabbing; }
.nav-row.dragging { opacity: .4; }
.nav-row.nav-drop { box-shadow: inset 0 2px 0 0 var(--brand); }
.userbox { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .6rem; display: flex; align-items: center; gap: .4rem; }
.userlink { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; padding: .35rem .4rem; margin: -.2rem 0; border-radius: 9px; text-decoration: none; color: inherit; transition: background .15s; }
.userlink:hover { background: var(--panel2); }
.userlink.active { background: var(--panel2); box-shadow: inset 2px 0 0 var(--brand); }
.minibars { display: flex; flex-direction: column; gap: .5rem; }
.mb-row { display: flex; align-items: center; gap: .7rem; }
.mb-label { width: 150px; flex-shrink: 0; font-size: .78rem; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-track { flex: 1; height: 18px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.mb-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--com)); border-radius: 6px; min-width: 2px; transition: width .4s ease; }
.mb-val { width: 96px; flex-shrink: 0; font-size: .78rem; font-weight: 600; text-align: right; }
.op-clip { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: .72rem; font-weight: 700; line-height: 1; padding: .2rem .4rem; border-radius: 6px; display: inline-flex; align-items: center; gap: 2px; transition: all .15s; }
.op-clip:hover { color: var(--text); border-color: var(--brand); }
.op-clip.has { color: var(--brand); border-color: var(--brand); background: rgba(0,145,206,.12); }
.att-box { display: flex; flex-direction: column; gap: .35rem; }
.att-row { display: flex; align-items: center; gap: .6rem; padding: .4rem .55rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; }
.att-ic { font-size: 1.1rem; flex-shrink: 0; }
.att-name { flex: 1; min-width: 0; }
.att-nm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .82rem; }
.att-nm a { color: var(--text); text-decoration: none; }
.att-nm a:hover { color: var(--brand); }
.att-sz { font-size: .7rem; color: var(--dim); }
.att-new { font-size: .62rem; background: var(--brand); color: #06131f; padding: .05rem .3rem; border-radius: 4px; font-weight: 700; }
th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-sort:hover { color: var(--brand); }
th.th-sort .sort-ar { color: var(--brand); font-size: .72em; }
.ac-wrap { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: var(--panel, #0f1726); border: 1px solid var(--line); border-radius: 9px; margin-top: 3px; max-height: 240px; overflow-y: auto; display: none; box-shadow: 0 10px 28px rgba(0,0,0,.45); }
.ac-item { padding: .5rem .75rem; cursor: pointer; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover { background: var(--panel2); color: var(--brand); }
.ac-empty { padding: .55rem .75rem; color: var(--dim); font-size: .8rem; }
.hist-add { display: flex; gap: .5rem; margin-bottom: 1rem; align-items: flex-start; }
.hist-add textarea { flex: 1; font-size: .85rem; padding: .5rem .7rem; }
.hist-list { display: flex; flex-direction: column; gap: .1rem; position: relative; }
.hist-item { display: flex; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.hist-item:last-child { border-bottom: 0; }
.hist-ico { font-size: 1.3rem; line-height: 1; flex-shrink: 0; width: 32px; height: 32px; background: var(--panel2); border-radius: 50%; display: grid; place-items: center; margin-top: .1rem; }
.hist-body { flex: 1; min-width: 0; }
.hist-head { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; font-size: .78rem; }
.hist-tipo { font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .3px; font-size: .68rem; }
.hist-campo { color: var(--muted); font-weight: 600; }
.hist-fecha { margin-left: auto; color: var(--dim); font-size: .72rem; font-family: monospace; }
.hist-cambio { margin-top: .3rem; font-size: .87rem; }
.hist-detalle { margin-top: .25rem; font-size: .82rem; color: var(--muted); font-style: italic; line-height: 1.4; }
.hist-user { margin-top: .35rem; font-size: .7rem; color: var(--dim); }
/* Editor rich text */
.rt-wrap { border: 1px solid var(--line2); border-radius: var(--radius-s); background: var(--panel); overflow: hidden; }
.rt-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: .35rem; background: var(--panel2); border-bottom: 1px solid var(--line); }
.rt-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: .3rem .5rem; font-size: .82rem; border-radius: 5px; min-width: 28px; transition: .12s; }
.rt-btn:hover { background: var(--elev); color: var(--txt); }
.rt-btn:active { background: var(--brand); color: #fff; }
.rt-sep { width: 1px; background: var(--line); margin: 2px 4px; }
.rt-editor { padding: .7rem .85rem; min-height: 120px; max-height: 320px; overflow-y: auto; outline: none; font-family: inherit; font-size: .9rem; line-height: 1.55; color: var(--txt); }
.rt-editor:empty:before { content: attr(data-placeholder); color: var(--dim); pointer-events: none; }
.rt-editor:focus { background: rgba(0,145,206,.03); }
.rt-editor h3 { margin: .4rem 0 .2rem; font-size: 1rem; }
.rt-editor blockquote { border-left: 3px solid var(--brand); margin: .3rem 0; padding: .1rem .8rem; color: var(--muted); font-style: italic; }
.rt-editor ul, .rt-editor ol { margin: .3rem 0; padding-left: 1.5rem; }
.rt-editor a { color: var(--brand); text-decoration: underline; }
/* Panel de seguimiento de actividades */
.seg-list { display: flex; flex-direction: column; gap: .55rem; }
.seg-item { display: flex; gap: .8rem; padding: .8rem 1rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; transition: .12s; }
.seg-item:hover { border-color: var(--brand); background: var(--elev); }
.seg-item.completada { opacity: .65; }
.seg-item.completada .seg-title { text-decoration: line-through; }
.seg-item.vencida { border-left: 3px solid var(--danger); }
.seg-ico { font-size: 1.6rem; line-height: 1; width: 38px; text-align: center; flex-shrink: 0; }
.seg-content { flex: 1; min-width: 0; }
.seg-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .25rem; }
.seg-tipo { font-size: .62rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--brand); padding: .1rem .4rem; background: rgba(0,145,206,.13); border-radius: 4px; }
.seg-title { font-weight: 600; font-size: .92rem; color: var(--txt); }
.seg-fecha { margin-left: auto; font-size: .72rem; color: var(--muted); font-family: monospace; }
.seg-nota { margin-top: .35rem; font-size: .82rem; color: var(--muted); line-height: 1.5; padding: .4rem .55rem; background: var(--panel); border-radius: 6px; border-left: 2px solid var(--brand); }
.seg-nota img { max-width: 100%; }
.seg-meta { margin-top: .35rem; display: flex; gap: .8rem; flex-wrap: wrap; font-size: .72rem; color: var(--dim); }
.seg-actions { display: flex; gap: .3rem; flex-shrink: 0; align-items: flex-start; }
/* ---- Vista Oportunidades (acordeón) ---- */
.op-acc-list { display: flex; flex-direction: column; gap: .5rem; }
.op-acc { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; transition: .12s; }
.op-acc:hover { border-color: var(--brand); }
.op-acc.open { background: var(--panel); border-color: var(--brand); }
.op-acc-head { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; cursor: pointer; user-select: none; }
.op-acc-lhs { flex: 1; min-width: 0; }
.op-acc-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.op-acc-title b { font-size: .95rem; color: var(--txt); }
.op-acc-meta { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.op-acc-monto { font-weight: 700; color: var(--brand); }
.op-acc-arrow { background: transparent; border: 0; color: var(--dim); cursor: pointer; padding: .3rem .5rem; font-size: .8rem; transition: transform .15s; }
.op-acc-body { padding: 1rem 1.2rem 1.2rem; border-top: 1px solid var(--line); background: var(--panel); }
.op-detail-loading { padding: 1rem; color: var(--dim); font-size: .82rem; text-align: center; }
.op-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .op-detail-grid { grid-template-columns: 1fr; } }
.op-detail-title { font-size: .78rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .6rem; }
.op-detail-row { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .85rem; }
.op-detail-row span { color: var(--dim); }
.op-detail-row b { color: var(--txt); text-align: right; }
.op-etapa-timeline { display: flex; flex-direction: column; gap: .5rem; }
.op-etapa-t { padding: .5rem .7rem; background: var(--panel2); border-radius: 6px; font-size: .82rem; border-left: 3px solid var(--brand); }
.op-etapa-when { color: var(--dim); font-family: monospace; margin-right: .5rem; font-size: .75rem; }
/* Barra de progreso por etapas */
.op-steps-wrap { padding: .6rem 0 1rem; overflow-x: auto; }
.op-steps { display: flex; gap: 4px; min-width: 500px; }
.op-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.op-step:not(:last-child):after { content: ''; position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.op-step.done:not(:last-child):after { background: var(--brand); }
.op-step-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--panel2); border: 2px solid var(--line); display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--muted); position: relative; z-index: 1; }
.op-step.done .op-step-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.op-step.active .op-step-dot { box-shadow: 0 0 0 4px rgba(0,145,206,.15); transform: scale(1.15); }
.op-step.won .op-step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.op-step.lost .op-step-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.op-step-lbl { font-size: .65rem; color: var(--muted); margin-top: .3rem; text-align: center; }
.op-step.active .op-step-lbl, .op-step.won .op-step-lbl, .op-step.lost .op-step-lbl { color: var(--txt); font-weight: 700; }
/* ============ Dashboard Pipeline moderno ============ */
.dash-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.dash-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; background: linear-gradient(135deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 14px; transition: transform .18s, box-shadow .18s; position: relative; overflow: hidden; }
.dash-card:before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--brand); }
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.28); }
.dash-primary:before { background: linear-gradient(180deg, #0091ce, #02719f); }
.dash-accent:before { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.dash-success:before { background: linear-gradient(180deg, #22c55e, #15803d); }
.dash-danger:before { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.dash-ic { font-size: 2rem; line-height: 1; width: 48px; height: 48px; display: grid; place-items: center; background: rgba(255,255,255,.06); border-radius: 12px; flex-shrink: 0; }
.dash-primary .dash-ic { background: rgba(0,145,206,.14); }
.dash-accent .dash-ic { background: rgba(167,139,250,.14); }
.dash-success .dash-ic { background: rgba(34,197,94,.14); }
.dash-danger .dash-ic { background: rgba(239,68,68,.14); }
.dash-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); font-weight: 700; margin-bottom: .15rem; }
.dash-val { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: var(--txt); }
.dash-val small { font-size: .8rem; font-weight: 500; }
.dash-sub { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.dash-mini { flex: 1; min-width: 130px; padding: .8rem 1rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; }
.dash-mini-lbl { font-size: .66rem; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); font-weight: 700; margin-bottom: .3rem; }
.dash-mini-val { font-size: 1.2rem; font-weight: 700; color: var(--txt); }
.dash-mini-val small { font-size: .75rem; color: var(--dim); }
/* Embudo */
.dash-embudo { padding: 1.2rem 1.4rem; margin-bottom: 1.1rem; }
.dash-embudo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.dash-embudo-title { font-size: .82rem; font-weight: 800; letter-spacing: .8px; color: var(--brand); }
.dash-embudo-sub { font-size: .74rem; color: var(--muted); margin-top: .2rem; }
.dash-embudo-legend { display: flex; gap: .35rem; flex-wrap: wrap; }
.dash-leg { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; padding: .3rem .55rem; border-radius: 8px; font-weight: 500; }
.dash-leg b { font-weight: 800; }
.dash-leg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dash-leg-open { background: rgba(148,163,184,.12); color: var(--muted); border: 1px solid rgba(148,163,184,.22); }
.dash-leg-win  { background: rgba(34,197,94,.12); color: #22c55e; border: 1px solid rgba(34,197,94,.28); }
.dash-leg-loss { background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.28); }

.dash-embudo-groups { display: flex; flex-direction: column; gap: .85rem; }
.dash-embudo-group { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem .55rem; background: linear-gradient(180deg, rgba(255,255,255,.015), transparent); }
.dash-embudo-group-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .1rem .15rem .5rem; border-bottom: 1px dashed var(--line); margin-bottom: .5rem; }
.dash-embudo-group-lbl { display: flex; align-items: center; gap: .55rem; font-size: .78rem; color: var(--dim); }
.dash-embudo-group-lbl b { font-size: .78rem; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--gcol, var(--txt)); }
.dash-embudo-group-bar { width: 4px; height: 16px; background: var(--gcol, var(--dim)); border-radius: 2px; }
.dash-embudo-group-stats { display: flex; gap: .45rem; align-items: center; font-size: .74rem; color: var(--muted); }
.dash-embudo-group-stats .sep { color: var(--line2); }

.dash-embudo-bars { display: flex; flex-direction: column; gap: .3rem; }
.dash-embudo-row { display: grid; grid-template-columns: 210px 1fr 130px; gap: .8rem; align-items: center; padding: .3rem .35rem; border-radius: 7px; transition: background .12s; }
@media (max-width: 700px) { .dash-embudo-row { grid-template-columns: 150px 1fr 95px; gap: .5rem; } }
.dash-embudo-lbl { display: flex; align-items: center; gap: .45rem; font-size: .82rem; min-width: 0; }
.dash-embudo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dash-embudo-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dash-embudo-count { margin-left: auto; font-size: .7rem; color: var(--dim); background: var(--panel2); padding: .1rem .5rem; border-radius: 999px; font-weight: 800; min-width: 24px; text-align: center; flex-shrink: 0; }
.dash-embudo-track { height: 22px; background: var(--panel2); border-radius: 6px; overflow: hidden; position: relative; }
.dash-embudo-fill { height: 100%; border-radius: 6px; min-width: 4px; transition: width .5s cubic-bezier(.4,0,.2,1); box-shadow: inset 0 1px 0 rgba(255,255,255,.15), inset 0 -1px 0 rgba(0,0,0,.1); position: relative; }
.dash-embudo-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); pointer-events: none; }
.dash-embudo-avg { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); font-size: .68rem; color: var(--dim); font-family: monospace; letter-spacing: -.2px; pointer-events: none; }
.dash-embudo-monto { text-align: right; font-weight: 700; font-size: .88rem; color: var(--txt); font-family: monospace; letter-spacing: -.3px; }
.dash-embudo-row.clickable { cursor: pointer; }
.dash-embudo-row.clickable:hover { background: rgba(0, 145, 206, .06); }
.dash-embudo-row.active { background: rgba(0, 145, 206, .12); box-shadow: inset 3px 0 0 var(--brand); }
.dash-embudo-row.empty { opacity: .42; padding-top: .18rem; padding-bottom: .18rem; }
.dash-embudo-row.empty .dash-embudo-track { height: 12px; }
.dash-embudo-row.empty .dash-embudo-lbl { font-size: .74rem; }
.embudo-detalle { margin-top: .5rem; }
.embudo-detalle-inner { background: var(--panel2); border-radius: 10px; margin-top: .6rem; overflow: hidden; animation: fadeIn .18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.embudo-detalle-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-left: 4px solid var(--brand); background: var(--panel); }
.embudo-detalle-list { display: flex; flex-direction: column; padding: .3rem .5rem .5rem; gap: .3rem; max-height: 480px; overflow-y: auto; }
.embudo-op { display: flex; gap: .8rem; padding: .7rem .85rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: .12s; align-items: center; }
.embudo-op:hover { border-color: var(--brand); background: var(--elev); transform: translateX(2px); }
/* Ranking de capacitaciones */
.rank-row { display: grid; grid-template-columns: 36px 40px 1fr 2fr 100px; gap: .7rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-medal { font-size: 1.2rem; font-weight: 800; color: var(--dim); text-align: center; }
.rank-avatar { display: grid; place-items: center; }
.rank-nombre { min-width: 0; }
.rank-bar-wrap { height: 20px; background: var(--panel2); border-radius: 5px; overflow: hidden; }
.rank-bar { height: 100%; border-radius: 5px; min-width: 4px; transition: width .5s ease; }
.rank-count { text-align: right; font-size: .9rem; }
/* Calendario anual de capacitaciones */
.cal-anual { width: 100%; border-collapse: collapse; font-size: .82rem; }
.cal-anual th, .cal-anual td { padding: .35rem .3rem; text-align: center; border-bottom: 1px solid var(--line); }
.cal-anual th { font-weight: 700; color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.cal-anual th:first-child, .cal-anual td:first-child { text-align: left; }
.cal-cell { padding: .2rem !important; }
.cal-dot { width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center; margin: 0 auto; font-size: .72rem; font-weight: 700; color: #fff; }
.cal-dot.n0 { background: var(--panel2); border: 1px dashed var(--line); }
.cal-dot.n1 { background: rgba(0,145,206,.4); }
.cal-dot.n2 { background: rgba(0,145,206,.6); }
.cal-dot.n3 { background: rgba(0,145,206,.8); }
.cal-dot.n4 { background: rgba(167,139,250,.85); }
.cal-dot.n5 { background: linear-gradient(135deg, #a78bfa, #0091ce); box-shadow: 0 0 6px rgba(0,145,206,.5); }
.vend-row { cursor: pointer; transition: background .12s; }
.vend-row:hover { background: var(--panel2); }
.vend-row.vend-active { background: rgba(0,145,206,.14); box-shadow: inset 3px 0 0 var(--brand); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--com)); color: #06131f; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.userbox .meta { overflow: hidden; flex: 1; }
.userbox .meta b { font-size: .82rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .meta span { font-size: .7rem; color: var(--dim); }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.6rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(10,17,30,.82); backdrop-filter: blur(10px); z-index: 20; }
.topbar h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.topbar .desc { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.content { padding: 1.6rem; max-width: 1280px; }
.content.content-full { max-width: none; }   /* vistas anchas: Pipeline usa todo el ancho disponible */
.toggle-nav { display: inline-flex; }
.shell { transition: grid-template-columns .2s ease; }
@media (min-width: 921px) {
  .shell.nav-hidden { grid-template-columns: 1fr; }
  .shell.nav-hidden .sidebar { display: none; }
}

.badge { font-size: .68rem; padding: .2rem .55rem; border-radius: 20px; font-weight: 600; letter-spacing: .3px; }
.badge.admin { background: rgba(52,227,245,.15); color: var(--brand); }
.badge.lider { background: rgba(167,139,250,.16); color: var(--com); }
.badge.consulta { background: rgba(148,163,184,.16); color: var(--muted); }
.badge.empleado { background: rgba(52,211,153,.16); color: var(--ok); }
.badge-ok { background: rgba(52,211,153,.16); color: var(--ok); }
.badge-err { background: rgba(239,68,68,.16); color: #ef4444; }
.badge-info { background: rgba(59,130,246,.16); color: #3b82f6; }
.badge-dim { background: rgba(148,163,184,.12); color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(4,9,18,.66); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal-backdrop .modal { max-height: 90vh; overflow-y: auto; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
.btn-xs { font-size: .72rem; padding: .18rem .5rem; }
.btn-danger { background: rgba(239,68,68,.15); color: #ef4444; border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 1rem; }
.card { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card h3 { margin: 0 0 .2rem; font-size: .95rem; font-weight: 600; }
.card .hint { color: var(--muted); font-size: .78rem; margin: 0 0 1rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 1.8rem 0 .9rem; }
.section-title h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.section-title:first-child { margin-top: 0; }

.kpis { grid-template-columns: repeat(5, 1fr); }
.kpi { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.kpi .label { color: var(--muted); font-size: .74rem; font-weight: 500; }
.kpi .value { font-size: 1.9rem; font-weight: 700; margin-top: .25rem; letter-spacing: -.5px; }
.kpi .value small { font-size: .9rem; color: var(--dim); font-weight: 500; }
.kpi.accent .value { color: var(--brand); }
.kpi.warn .value { color: var(--warn); }

/* ---------- Heatmap ---------- */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; min-width: 720px; }
.heat th { font-weight: 600; font-size: .72rem; color: var(--muted); padding: 0 2px 6px; text-align: center; vertical-align: bottom; }
.heat th .cat { display: block; font-size: .62rem; color: var(--dim); font-weight: 500; }
.heat th .bname { display: block; margin-top: 3px; }
.blogo { display: inline-block; background: #fff; border-radius: 4px; padding: 2px 3px; line-height: 0; }
.blogo img { height: 13px; display: block; max-width: 72px; }
.blogo.lg img { height: 18px; max-width: 120px; }
.logo-edit { display: flex; align-items: center; gap: 8px; }
.logo-edit input { flex: 1; }
.logo-edit .blogo { flex-shrink: 0; min-width: 40px; min-height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.emp-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--panel2); }
.emp-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.emp-avatar.initials { background: linear-gradient(135deg, var(--brand), var(--com)); color: #06131f; font-size: .72rem; font-weight: 700; }
.emp-avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.heat td.name .np { display: flex; align-items: center; gap: 8px; }
.heat td.name { text-align: left; padding-right: 10px; white-space: nowrap; }
.heat td.name b { font-size: .82rem; font-weight: 500; }
.heat td.name span { display: block; font-size: .66rem; color: var(--dim); }
.cell { display: flex; gap: 1px; height: 32px; border-radius: 6px; overflow: hidden; min-width: 46px; }
.half { flex: 1; display: grid; place-items: center; font-size: .72rem; font-weight: 600; cursor: default; user-select: none; }
.half.editable { cursor: pointer; }
.half.editable:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.t0, .c0 { background: #0c1626; color: var(--dim); }
.t1 { background: #0e3450; color: #7fc0e8; } .t2 { background: #114a70; color: #aedcf4; } .t3 { background: #0f6d9e; color: #eaf6fd; } .t4 { background: #0e8ac4; color: #042230; } .t5 { background: #1ba6e0; color: #042230; }
.c1 { background: #2c2350; color: #c4b5fd; } .c2 { background: #3b2d75; color: #ddd6fe; } .c3 { background: #5b46b0; color: #f1edff; } .c4 { background: #7c5fe0; color: #0f0a26; } .c5 { background: #a78bfa; color: #0f0a26; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: .74rem; color: var(--muted); align-items: center; }
.legend .sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: 5px; }

/* ---------- Coverage cards ---------- */
.cov-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cov { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem .8rem; background: var(--panel); }
.cov .top { display: flex; align-items: center; gap: .45rem; }
.cov .top b { font-size: .85rem; }
.cov .top .dot { margin-left: auto; }
.cov-logo { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 4px; padding: 2px 4px; line-height: 0; flex-shrink: 0; min-width: 32px; height: 22px; }
.cov-logo img { max-height: 18px; max-width: 60px; display: block; }
.cov .cat { font-size: .68rem; color: var(--dim); }
.cov .pill { display: inline-block; margin-top: .5rem; font-size: .7rem; padding: .15rem .5rem; border-radius: 6px; font-weight: 600; }
.pill.ok { background: rgba(52,211,153,.14); color: var(--ok); }
.pill.riesgo { background: rgba(251,191,36,.14); color: var(--warn); }
.pill.sin_expertos { background: rgba(251,113,133,.14); color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.riesgo { background: var(--warn); } .dot.sin_expertos { background: var(--danger); }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--dim); padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
table.data td { padding: .65rem .7rem; border-bottom: 1px solid var(--line); font-size: .86rem; }
table.data tr:hover td { background: rgba(148,163,184,.04); }
.tag { font-size: .68rem; padding: .15rem .5rem; border-radius: 6px; font-weight: 600; }
.tag.tecnico { background: rgba(45,212,191,.14); color: var(--tec); }
.tag.comercial { background: rgba(167,139,250,.16); color: var(--com); }
.tag.vigente { background: rgba(52,211,153,.14); color: var(--ok); }
.tag.por_vencer { background: rgba(251,191,36,.14); color: var(--warn); }
.tag.vencida { background: rgba(251,113,133,.14); color: var(--danger); }
.tag.sin_vencimiento { background: rgba(148,163,184,.14); color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.gap-neg { color: var(--danger); font-weight: 600; }
.gap-ok { color: var(--ok); font-weight: 600; }
.actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* ---------- Chart ---------- */
.chart-box { width: 100%; }
.chart-legend { display: flex; gap: 18px; font-size: .78rem; color: var(--muted); margin-bottom: .4rem; }
.chart-legend b { color: var(--txt); font-weight: 500; }

/* ---------- Modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,9,18,.66); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { width: 100%; max-width: 460px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 18px; padding: 1.4rem; box-shadow: 0 30px 80px rgba(0,0,0,.5); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 1.1rem; font-size: 1rem; }
.modal-foot { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.3rem; }
.toast { position: fixed; bottom: 1.4rem; right: 1.4rem; background: var(--elev); border: 1px solid var(--line2); border-left: 3px solid var(--brand); padding: .8rem 1.1rem; border-radius: var(--radius-s); font-size: .85rem; z-index: 200; box-shadow: 0 16px 40px rgba(0,0,0,.4); animation: slideup .25s; }
.toast.err { border-left-color: var(--danger); }
@keyframes slideup { from { opacity: 0; transform: translateY(10px); } }
.empty { text-align: center; color: var(--dim); padding: 2.5rem; font-size: .88rem; }

/* ---------- CRM Kanban ---------- */
.kanban-wrap { overflow-x: auto; padding-bottom: 6px; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 10px; }
.kanban-col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; }
.kanban-col.col-won { border-color: rgba(52,211,153,.35); }
.kanban-col.col-lost { border-color: rgba(251,113,133,.35); }
.kanban-head { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; font-weight: 600; padding: 2px 4px; }
.kanban-count { background: var(--panel2); border-radius: 20px; font-size: .7rem; padding: 1px 8px; color: var(--muted); }
.kanban-total { font-size: .72rem; color: var(--dim); padding: 0 4px 6px; }
.kanban-body { flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; border-radius: 8px; padding: 2px; transition: background .12s; }
.kanban-body.drop-hover { background: rgba(52,227,245,.08); outline: 1px dashed var(--brand); }
.op-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: border-color .12s, transform .05s; }
.op-card:hover { border-color: var(--line2); }
.op-card:active { transform: scale(.99); }
.op-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.op-top b { font-size: .82rem; font-weight: 500; }
.op-monto { font-size: .78rem; font-weight: 600; color: var(--brand); white-space: nowrap; }
.op-cuenta { font-size: .72rem; color: var(--muted); margin: 3px 0; }
.op-meta { display: flex; justify-content: space-between; font-size: .68rem; color: var(--dim); margin-top: 4px; gap: 6px; }

.logo-plate { background: #fff; border-radius: 12px; padding: 11px 15px; display: inline-block; line-height: 0; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.logo-plate img { display: block; }
.login-card .logo-plate { display: block; width: max-content; max-width: 100%; margin: 0 auto 1.5rem; }
.sidebar .brand .logo-plate { padding: 9px 12px; }

@media print {
  body { background: #fff !important; color: #000; }
  .sidebar, .topbar, .btn, .toggle-nav { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .main { min-width: 0; }
  .content { padding: 0; max-width: none; }
  .card, .kpi, .cov { border: 1px solid #ccc !important; background: #fff !important; color: #000 !important; break-inside: avoid; }
  .kpi .label, .card .hint, .heat th, .heat td.name span, table.data th { color: #333 !important; }
  .kpi .value { color: #000 !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Search dropdown */
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius-s); box-shadow: 0 12px 32px rgba(0,0,0,.35); max-height: 320px; overflow-y: auto; z-index: 120; margin-top: 4px; }
.sr-item { display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; cursor: pointer; transition: background .12s; }
.sr-item:hover { background: var(--elev); }
.sr-icon { font-size: 1.1rem; flex-shrink: 0; }
.sr-text { min-width: 0; }
.sr-text b { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: .72rem; color: var(--dim); }
.sr-empty { padding: .8rem; text-align: center; color: var(--dim); font-size: .82rem; }

/* Filter row */
.filter-row td { padding: 2px 4px !important; background: var(--panel2); }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 248px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .toggle-nav { display: inline-flex; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .search-global-wrap { display: none; }
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:220px"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:220px"] > :first-child { position: static !important; }
}
.manual-body { font-size: .9rem; line-height: 1.65; color: var(--fg); }
.manual-body h4 { color: var(--accent); margin: 1rem 0 .4rem; font-size: .95rem; }
.manual-body p { margin: .4rem 0; }
.manual-body ul, .manual-body ol { margin: .3rem 0 .6rem 1.2rem; }
.manual-body li { margin: .2rem 0; }
.manual-body table { margin: .5rem 0; }
.pip-tab { opacity: .6; }
.pip-tab-active { opacity: 1; background: var(--accent); color: #fff; }

/* ========================
   AGENDA — Calendario responsive
   ======================== */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-s); overflow: hidden; }
.cal-hdr { background: var(--panel2); text-align: center; padding: .4rem .2rem; font-size: .72rem; font-weight: 600; color: var(--dim); text-transform: uppercase; }
.cal-cell { background: var(--panel); min-height: 90px; padding: .3rem .35rem; cursor: pointer; transition: background .15s; position: relative; overflow: hidden; }
.cal-cell:hover { background: var(--panel2); }
.cal-cell.cal-other { opacity: .35; }
.cal-cell.cal-today { background: var(--panel2); box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day { font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }
.cal-today .cal-day { color: var(--brand); }
.cal-item { font-size: .65rem; line-height: 1.25; padding: .15rem .25rem; margin-bottom: .15rem; border-radius: 4px; background: var(--panel2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: background .15s; display: flex; align-items: center; gap: .2rem; }
.cal-item:hover { background: var(--elev); }
.cal-item.cal-done { opacity: .45; text-decoration: line-through; }
.cal-item .cal-ic { flex-shrink: 0; }
.cal-more { font-size: .6rem; color: var(--brand); cursor: pointer; padding: .1rem .2rem; }
.cal-nav { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.cal-nav button { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; color: var(--txt); cursor: pointer; padding: .3rem .6rem; font-size: .8rem; transition: background .15s; min-width: 34px; }
.cal-nav button:hover { background: var(--elev); }
.cal-nav .cal-month-label { font-size: 1rem; font-weight: 600; min-width: 160px; text-align: center; text-transform: capitalize; }

/* Vista "Lista por día" — se activa en móvil */
.cal-mobile { display: none; flex-direction: column; gap: .4rem; }
.cal-day-row { display: flex; gap: .7rem; padding: .55rem .7rem; background: var(--panel); border-left: 3px solid var(--line); border-radius: 8px; cursor: pointer; transition: background .15s; }
.cal-day-row:hover { background: var(--panel2); }
.cal-day-row.cal-today-row { border-left-color: var(--brand); background: rgba(0,145,206,.06); }
.cal-day-row.cal-other-row { opacity: .45; }
.cal-day-num { flex-shrink: 0; width: 44px; text-align: center; }
.cal-day-num .n { font-size: 1.4rem; font-weight: 800; line-height: 1; color: var(--txt); display: block; }
.cal-day-num .dow { font-size: .58rem; text-transform: uppercase; color: var(--dim); font-weight: 700; letter-spacing: .5px; margin-top: 3px; display: block; }
.cal-today-row .cal-day-num .n, .cal-today-row .cal-day-num .dow { color: var(--brand); }
.cal-day-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.cal-day-items .cal-item { font-size: .78rem; padding: .35rem .55rem; white-space: normal; }
.cal-day-empty { font-size: .72rem; color: var(--dim); font-style: italic; align-self: center; }

/* Header y filtros agenda */
.ag-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.ag-filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; }

/* Tablet ≤900 */
@media (max-width: 900px) {
  .cal-cell { min-height: 74px; padding: .2rem .25rem; }
  .cal-item { font-size: .6rem; padding: .1rem .2rem; }
  .cal-day { font-size: .68rem; }
  .cal-nav .cal-month-label { font-size: .92rem; min-width: 130px; }
}

/* Mobile ≤640 — reemplaza grilla por lista vertical */
@media (max-width: 640px) {
  .cal-grid, .cal-hdr { display: none !important; }
  .cal-mobile { display: flex; }
  .cal-nav { gap: .4rem; width: 100%; justify-content: space-between; }
  .cal-nav .cal-month-label { flex: 1; font-size: .95rem; min-width: 0; }
  .cal-nav button { padding: .45rem .7rem; }
  .ag-filters { flex-direction: column; align-items: stretch; }
  .ag-filters select, .ag-filters input { width: 100%; }
  .pip-tab { flex: 1; text-align: center; }
}

/* Muy compacto ≤380 */
@media (max-width: 380px) {
  .cal-day-num { width: 36px; }
  .cal-day-num .n { font-size: 1.15rem; }
  .cal-day-items .cal-item { font-size: .72rem; padding: .3rem .45rem; }
}
