/* ============================================================
   Soporte TI · YT Grupo — tema oscuro con el degradado del logo
   (#4275E6 azul → #7E57C2 violeta → #CC1A7B magenta → #E20462 rojo)
   Mobile-first: menú off-canvas + barra inferior bajo 992px.
   ============================================================ */
:root {
    --bg: #09090b;
    --bg-2: #0f0f13;
    --sf: #141419;
    --sf-2: #1b1b22;
    --sf-3: #23232c;
    --bd: #26262f;
    --bd-2: #33333e;
    --tx: #ededf2;
    --tx-2: #b4b4c0;
    --mt: #8b8b9b;

    --azul: #4275e6;
    --violeta: #7e57c2;
    --magenta: #cc1a7b;
    --rojo: #e20462;
    --grad: linear-gradient(100deg, #4275e6 0%, #7e57c2 38%, #cc1a7b 72%, #e20462 100%);
    --grad-soft: linear-gradient(100deg, rgba(66,117,230,.16), rgba(126,87,194,.14) 40%, rgba(204,26,123,.14) 75%, rgba(226,4,98,.14));

    --ok: #2fbf71;
    --warn: #f0a429;
    --err: #ef4462;
    --info: var(--azul);

    --r: 14px;
    --r-sm: 10px;
    --sb-w: 252px;
    --sb-mini: 76px;
    --tb-h: 64px;
    --bn-h: 66px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --shadow: 0 10px 30px rgba(0,0,0,.45);
    --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--tx);
    background: var(--bg);
    background-image:
        radial-gradient(60rem 30rem at 100% -10%, rgba(126,87,194,.10), transparent 60%),
        radial-gradient(50rem 30rem at -10% 110%, rgba(66,117,230,.07), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: #8fa9ff; text-decoration: none; }
a:hover { color: #b7c7ff; }
img { max-width: 100%; }
::selection { background: rgba(204,26,123,.45); color: #fff; }
.material-symbols-outlined { font-size: 20px; line-height: 1; vertical-align: middle; user-select: none; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--mt); }
.grad-text { color: #ff8cc0; }
:focus-visible { outline: 2px solid #b79bff; outline-offset: 2px; border-radius: 6px; }
input, textarea { caret-color: #ff8cc0; }
.kpi-val, .mstat b, .bar-row .val, .ring b, .chip .n { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--bd-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bd-2); border-radius: 8px; }

/* ── Sidebar ─────────────────────────────────────────── */
.sb {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sb-w);
    display: flex; flex-direction: column;
    background: rgba(12,12,15,.96);
    border-right: 1px solid var(--bd);
    backdrop-filter: blur(12px);
    transition: width .22s ease, transform .25s ease;
}
.sb::after { /* filo de color */
    content: ''; position: absolute; top: 0; right: -1px; width: 1px; height: 100%;
    background: linear-gradient(180deg, transparent, rgba(126,87,194,.5) 30%, rgba(226,4,98,.4) 70%, transparent);
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; color: var(--tx); }
.sb-logo { width: 40px; height: 40px; flex: none; object-fit: contain; }
.sb-brand-txt { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.sb-app { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.sb-org { font-size: .74rem; color: var(--mt); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px; }
.sb-group { margin-bottom: 14px; }
.sb-group-title { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--mt); padding: 8px 10px 6px; white-space: nowrap; }
.sb-item {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin: 2px 0; border-radius: 10px;
    color: var(--tx-2); font-weight: 500; white-space: nowrap;
    transition: background .15s, color .15s;
}
.sb-item:hover { background: var(--sf-2); color: var(--tx); }
.sb-item.is-on { background: var(--grad-soft); color: #fff; }
.sb-item.is-on .material-symbols-outlined { color: #ff7ab5; font-variation-settings: 'FILL' 1; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--bd); }
.sb-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sb-username { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-role { font-size: .72rem; color: var(--mt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-exit { color: var(--mt); padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.sb-exit:hover { color: var(--rojo); background: var(--sf-2); }
.avatar {
    width: 36px; height: 36px; flex: none; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: #fff;
    background: var(--grad);
}
.avatar.sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.2rem; }
.sb-scrim { display: none; }

/* Sidebar compacto (escritorio) */
body.sb-mini .sb { width: var(--sb-mini); }
body.sb-mini .sb-brand-txt, body.sb-mini .sb-label, body.sb-mini .sb-group-title, body.sb-mini .sb-user-info { display: none; }
body.sb-mini .sb-item { justify-content: center; }
body.sb-mini .sb-brand { justify-content: center; padding-inline: 0; }
body.sb-mini .sb-user { flex-direction: column; padding-inline: 0; }
body.sb-mini .app { margin-left: var(--sb-mini); }

/* ── App / topbar ────────────────────────────────────── */
.app { margin-left: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .22s ease; }
.tb {
    position: sticky; top: 0; z-index: 30;
    height: var(--tb-h); display: flex; align-items: center; gap: 12px;
    padding: 0 24px;
    background: rgba(9,9,11,.78); backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid var(--bd);
}
.tb-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--bd); background: var(--sf);
    color: var(--tx-2); display: grid; place-items: center; cursor: pointer; flex: none;
}
.tb-btn:hover { color: var(--tx); border-color: var(--bd-2); }
.tb-logo { display: none; width: 30px; height: 30px; object-fit: contain; }
.tb-title { min-width: 0; line-height: 1.15; }
.tb-title h1 { margin: 0; font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-env { font-size: .66rem; font-weight: 800; letter-spacing: .1em; padding: 3px 8px; border-radius: 6px; background: rgba(240,164,41,.15); color: var(--warn); border: 1px solid rgba(240,164,41,.35); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px; }
.main-footer { margin-top: 40px; padding: 18px 0 6px; text-align: center; font-size: .76rem; color: var(--mt); }
.grad-line { display: block; height: 1px; margin-bottom: 14px; background: linear-gradient(90deg, transparent, rgba(126,87,194,.6), rgba(226,4,98,.5), transparent); }

/* ── Barra inferior (móvil) ─────────────────────────── */
.bn { display: none; }

/* ── Tarjetas / grillas ──────────────────────────────── */
.card {
    background: var(--sf); border: 1px solid var(--bd); border-radius: var(--r);
    padding: 20px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-h h2, .card-h h3 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-h h2 .material-symbols-outlined, .card-h h3 .material-symbols-outlined { color: var(--mt); }
.card-h .link { font-size: .82rem; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mb-0 { margin-bottom: 0; } .mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }

/* Hero */
.hero {
    position: relative; overflow: hidden;
    border-radius: 18px; padding: 26px 28px; margin-bottom: 20px;
    background: var(--sf); border: 1px solid var(--bd);
}
.hero::before { content: ''; position: absolute; inset: 0; background: var(--grad-soft); opacity: .9; }
.hero::after {
    content: ''; position: absolute; right: -60px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgba(226,4,98,.28), transparent 65%);
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { margin: 0 0 4px; font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--tx-2); }
.hero .row { margin-top: 18px; }

/* KPIs */
.kpi {
    position: relative; overflow: hidden;
    background: var(--sf); border: 1px solid var(--bd); border-radius: var(--r);
    padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; color: var(--tx);
    transition: border-color .15s, transform .15s;
}
a.kpi:hover { border-color: var(--bd-2); transform: translateY(-1px); color: var(--tx); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-lbl { font-size: .78rem; color: var(--tx-2); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--violeta)) 16%, transparent); color: var(--c, var(--violeta)); }
.kpi-val { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-sub { font-size: .76rem; color: var(--mt); }
.kpi::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--c, var(--grad)); opacity: .55; }

/* Botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px; border-radius: 10px;
    border: 1px solid var(--bd-2); background: var(--sf-2); color: var(--tx);
    font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--sf-3); color: var(--tx); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { border: 0; background: var(--grad); color: #fff; box-shadow: 0 4px 14px -4px rgba(204,26,123,.45); }
.btn-primary:hover { color: #fff; filter: brightness(1.08); box-shadow: 0 8px 20px -6px rgba(204,26,123,.55); background: var(--grad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--tx-2); }
.btn-ghost:hover { background: var(--sf-2); }
.btn-danger { border-color: rgba(239,68,98,.4); color: #ff8aa0; background: rgba(239,68,98,.08); }
.btn-ok { border-color: rgba(47,191,113,.4); color: #6ee3a3; background: rgba(47,191,113,.08); }
.btn-sm { height: 32px; padding: 0 12px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn .material-symbols-outlined { font-size: 19px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .lbl { font-size: .8rem; font-weight: 600; color: var(--tx-2); }
.field .hint { font-size: .74rem; color: var(--mt); }
.input, .select, .textarea {
    width: 100%; min-height: 42px; padding: 10px 12px;
    background: var(--bg-2); color: var(--tx);
    border: 1px solid var(--bd-2); border-radius: 10px;
    font: inherit; font-size: 16px; /* 16px: evita el zoom de iOS */
    outline: none; transition: border-color .15s, box-shadow .15s;
}
@media (min-width: 992px) { .input, .select, .textarea { font-size: .9rem; } }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--violeta); box-shadow: 0 0 0 3px rgba(126,87,194,.25); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%237d7d8c'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select option { background: var(--sf); }
.input-ico { position: relative; }
.input-ico .material-symbols-outlined { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mt); pointer-events: none; }
.input-ico .input { padding-left: 40px; }

/* Selector tipo "segmented" (equipo, prioridad) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
    display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
    min-height: 46px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--bd-2); background: var(--bg-2); color: var(--tx-2); font-weight: 600; font-size: .86rem;
    transition: all .15s;
}
.seg label:hover { border-color: var(--mt); color: var(--tx); }
.seg input:checked + label { border-color: transparent; color: #fff; background: var(--grad-soft); box-shadow: inset 0 0 0 1.5px var(--c, var(--violeta)); }
.seg input:focus-visible + label { outline: 2px solid var(--violeta); outline-offset: 2px; }
.seg.big label { min-height: 74px; flex-direction: column; gap: 4px; }
.seg.big label .material-symbols-outlined { font-size: 26px; color: var(--c, var(--violeta)); }
.seg.big label small { font-weight: 400; color: var(--mt); font-size: .72rem; }

/* Zona de archivos */
.drop {
    border: 1.5px dashed var(--bd-2); border-radius: 12px; padding: 18px; text-align: center;
    color: var(--mt); cursor: pointer; transition: all .15s; background: var(--bg-2);
}
.drop:hover, .drop.is-over { border-color: var(--magenta); color: var(--tx-2); background: rgba(204,26,123,.05); }
.drop .material-symbols-outlined { font-size: 28px; display: block; margin: 0 auto 6px; color: var(--violeta); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    padding: 6px 10px; border-radius: 8px; background: var(--sf-2); border: 1px solid var(--bd); font-size: .8rem; color: var(--tx-2);
}
.file-chip .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.file-chip button { background: none; border: 0; color: var(--mt); cursor: pointer; padding: 0; display: grid; }
.file-chip button:hover { color: var(--rojo); }
a.file-chip:hover { border-color: var(--bd-2); color: var(--tx); }

/* Badges */
.badge-st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--sf-3); color: var(--tx-2); }
.badge-st .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-abierto  { background: rgba(66,117,230,.14);  color: #7ea3ff; }
.st-proceso  { background: rgba(126,87,194,.18);  color: #b79bff; }
.st-proceso .dot { animation: pulso 1.6s infinite; }
.st-espera   { background: rgba(240,164,41,.13);  color: #f6bf63; }
.st-resuelto { background: rgba(47,191,113,.13);  color: #63dc9a; }
.st-cerrado  { background: rgba(125,125,140,.15); color: #a3a3b2; }
.st-anulado  { background: rgba(125,125,140,.10); color: #6f6f7e; text-decoration: line-through; }
@keyframes pulso { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
.badge-pr { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border: 1px solid; white-space: nowrap; }
.pr-baja    { color: #8f8f9e; border-color: #3a3a46; }
.pr-media   { color: #7ea3ff; border-color: rgba(66,117,230,.4); }
.pr-alta    { color: #f6bf63; border-color: rgba(240,164,41,.45); }
.pr-critica { color: #fff; border-color: transparent; background: #d40f6c; }
.badge-eq { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; color: var(--c); white-space: nowrap; }
.badge-eq .material-symbols-outlined { font-size: 16px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: .72rem; background: var(--sf-3); color: var(--tx-2); white-space: nowrap; }
.tag-venc { background: rgba(239,68,98,.14); color: #ff8aa0; font-weight: 600; }
.tag-venc .material-symbols-outlined { font-size: 14px; }

/* ── Lista de tickets (filas → tarjetas en móvil) ─────── */
.tk-list { display: flex; flex-direction: column; }
.tk {
    display: grid; align-items: center; gap: 14px;
    grid-template-columns: 4px minmax(0, 1fr) 120px 96px 170px 96px 24px;
    padding: 14px 16px; color: var(--tx);
    border-bottom: 1px solid var(--bd);
    transition: background .12s;
}
.tk:last-child { border-bottom: 0; }
.tk:hover { background: var(--sf-2); color: var(--tx); }
.tk-bar { width: 8px; height: 8px; border-radius: 50%; align-self: start; margin-top: 7px; background: transparent; }
.tk-bar.pr-critica { background: var(--rojo); }
.tk-bar.pr-alta { background: var(--warn); }
.tk-main { min-width: 0; }
.tk-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.tk-code { font-family: var(--mono); font-size: .76rem; color: var(--mt); }
.tk-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-meta { font-size: .78rem; color: var(--mt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-who { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--tx-2); min-width: 0; }
.tk-who span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-when { font-size: .78rem; color: var(--mt); text-align: right; }
.tk-go { color: var(--mt); }
.tk-head { display: grid; grid-template-columns: 4px minmax(0, 1fr) 120px 96px 170px 96px 24px; gap: 14px; padding: 10px 16px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mt); font-weight: 700; border-bottom: 1px solid var(--bd); }
.card.p0 { padding: 0; overflow: hidden; }
.empty { padding: 48px 20px; text-align: center; color: var(--mt); }
.empty .material-symbols-outlined { font-size: 44px; display: block; margin: 0 auto 10px; color: #b79bff; }

/* Filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input-ico { flex: 1 1 240px; }
.filters .select { width: auto; min-width: 140px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--bd-2); background: var(--sf); color: var(--tx-2); font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.chip:hover { color: var(--tx); border-color: var(--mt); }
.chip.is-on { background: var(--grad); border-color: transparent; color: #fff; }
.chip .n { font-size: .72rem; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.12); }
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 14px; }

/* ── Detalle de ticket ───────────────────────────────── */
.tkd-head { margin-bottom: 18px; }
.tkd-head h2 { margin: 6px 0 8px; font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; word-break: break-word; }
.tkd-desc { white-space: pre-wrap; word-break: break-word; color: var(--tx-2); line-height: 1.6; }
.props { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: .86rem; align-items: center; }
.props dt { color: var(--mt); font-weight: 500; }
.props dd { margin: 0; min-width: 0; text-align: right; display: flex; justify-content: flex-end; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 16px; }
.timeline::before { content: ''; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(180deg, var(--bd-2), transparent); }
.ev { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.ev-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sf-2); border: 1px solid var(--bd-2); color: var(--mt); z-index: 1; }
.ev-ico .material-symbols-outlined { font-size: 18px; }
.ev-sys { font-size: .84rem; color: var(--tx-2); padding-top: 8px; }
.ev-sys b { color: var(--tx); font-weight: 600; }
.ev-sys .when { color: var(--mt); font-size: .76rem; margin-left: 6px; }
.bubble { background: var(--sf-2); border: 1px solid var(--bd); border-radius: 4px 14px 14px 14px; padding: 12px 14px; }
.bubble.mine { background: linear-gradient(135deg, rgba(66,117,230,.10), rgba(126,87,194,.10)); border-color: rgba(126,87,194,.3); }
.bubble.interno { background: rgba(240,164,41,.06); border: 1px dashed rgba(240,164,41,.45); }
.bubble-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .8rem; flex-wrap: wrap; }
.bubble-h b { font-weight: 600; }
.bubble-h .when { color: var(--mt); margin-left: auto; font-size: .74rem; }
.bubble-t { white-space: pre-wrap; word-break: break-word; font-size: .9rem; line-height: 1.55; }
.composer { position: relative; }
.composer .textarea { min-height: 90px; padding-bottom: 50px; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--tx-2); cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--bd-2); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--warn); }
.switch input:checked::after { transform: translateX(16px); }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Barras horizontales (gráficos simples) */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: .82rem; }
.bar-row .lbl2 { color: var(--tx-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--sf-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--grad); transform-origin: left; animation: crecer .7s cubic-bezier(.2,.8,.2,1); }
@keyframes crecer { from { transform: scaleX(0) } }

/* Gráfico de columnas (últimos 14 días) */
.cols { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.col-stack { width: 100%; max-width: 26px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 3px 3px; overflow: hidden; background: var(--sf-3); min-height: 3px; animation: subir .7s cubic-bezier(.2,.8,.2,1); transform-origin: bottom; }
@keyframes subir { from { transform: scaleY(0) } }
.col-a { background: linear-gradient(180deg, #7e57c2, #4275e6); }
.col-b { background: linear-gradient(180deg, #e20462, #cc1a7b); }
.col-l { font-size: .64rem; color: var(--mt); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: .76rem; color: var(--tx-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Anillo (donut) */
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: conic-gradient(var(--azul) 0, var(--violeta) calc(var(--p) * .5%), var(--magenta) calc(var(--p) * 1%), var(--sf-3) 0); }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--sf); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring b { font-size: 1.5rem; font-weight: 800; }
.ring small { display: block; font-size: .68rem; color: var(--mt); }

/* ── Equipo ──────────────────────────────────────────── */
.member { display: flex; flex-direction: column; gap: 14px; }
.member-top { display: flex; align-items: center; gap: 12px; }
.member-name { font-weight: 700; line-height: 1.25; }
.member-sub { font-size: .76rem; color: var(--mt); }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mstat { background: var(--bg-2); border: 1px solid var(--bd); border-radius: 10px; padding: 10px; text-align: center; }
.mstat b { display: block; font-size: 1.25rem; font-weight: 800; }
.mstat span { font-size: .7rem; color: var(--mt); }

/* ── Estado de sistemas ──────────────────────────────── */
.svc { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--bd); }
.svc:last-child { border-bottom: 0; }
.svc-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--sf-2); color: var(--tx-2); flex: none; }
.svc-main { flex: 1; min-width: 0; }
.svc-name { font-weight: 600; }
.svc-det { font-size: .76rem; color: var(--mt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-ms { font-family: var(--mono); font-size: .78rem; color: var(--tx-2); min-width: 64px; text-align: right; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ok { color: #63dc9a; background: rgba(47,191,113,.12); }
.pill-ok::before { box-shadow: 0 0 0 0 rgba(47,191,113,.6); animation: latido 2s infinite; }
.pill-err { color: #ff8aa0; background: rgba(239,68,98,.12); }
.pill-warn { color: #f6bf63; background: rgba(240,164,41,.12); }
.pill-wait { color: var(--mt); background: var(--sf-3); }
.pill-wait::before { animation: pulso 1s infinite; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(47,191,113,.55) } 70% { box-shadow: 0 0 0 7px rgba(47,191,113,0) } 100% { box-shadow: 0 0 0 0 rgba(47,191,113,0) } }

/* Avisos */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: .86rem; margin-bottom: 16px; border: 1px solid; }
.alert-err  { background: rgba(239,68,98,.08); border-color: rgba(239,68,98,.35); color: #ffb3c1; }
.alert-ok   { background: rgba(47,191,113,.08); border-color: rgba(47,191,113,.35); color: #a6f0c8; }
.alert-warn { background: rgba(240,164,41,.08); border-color: rgba(240,164,41,.35); color: #f8d494; }
.alert-info { background: rgba(66,117,230,.08); border-color: rgba(66,117,230,.35); color: #b3c8ff; }

/* Toast */
.toast-x {
    position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); opacity: 0;
    display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
    padding: 12px 18px; border-radius: 12px; background: var(--sf-3); border: 1px solid var(--bd-2); color: var(--tx);
    box-shadow: var(--shadow); font-size: .88rem; font-weight: 500; transition: all .25s;
}
.toast-x.show { opacity: 1; transform: translate(-50%, 0); }
.toast-x.is-success .material-symbols-outlined { color: var(--ok); }
.toast-x.is-error .material-symbols-outlined { color: var(--err); }
.toast-x.is-info .material-symbols-outlined { color: var(--azul); }

/* Modal ligero */
.modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.modal.open { display: flex; }
.modal-box { width: 100%; max-width: 440px; background: var(--sf); border: 1px solid var(--bd-2); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); animation: entrar .2s ease; }
.modal-box h3 { margin: 0 0 14px; font-size: 1.05rem; }
@keyframes entrar { from { opacity: 0; transform: translateY(10px) scale(.98) } }

/* Skeleton */
.sk { background: linear-gradient(90deg, var(--sf-2), var(--sf-3), var(--sf-2)); background-size: 200% 100%; animation: brillo 1.2s infinite; border-radius: 8px; }
@keyframes brillo { to { background-position: -200% 0 } }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-main { grid-template-columns: minmax(0, 1fr); }
    .tk, .tk-head { grid-template-columns: 4px minmax(0, 1fr) 116px 92px 160px 24px; }
    .tk-when, .tk-head .h-when { display: none; }
}

@media (max-width: 991.98px) {
    body { padding-bottom: calc(var(--bn-h) + var(--safe-b)); }
    .sb { transform: translateX(-100%); width: min(84vw, 300px); box-shadow: var(--shadow); }
    body.sb-mini .sb { width: min(84vw, 300px); }
    body.sb-mini .sb-brand-txt, body.sb-mini .sb-label, body.sb-mini .sb-group-title, body.sb-mini .sb-user-info { display: initial; }
    body.sb-mini .sb-brand-txt, body.sb-mini .sb-user-info { display: flex; }
    body.sb-mini .sb-item { justify-content: flex-start; }
    body.sb-mini .sb-user { flex-direction: row; padding-inline: 16px; }
    body.sb-open .sb { transform: none; }
    body.sb-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
    .app, body.sb-mini .app { margin-left: 0; }
    .tb { padding: 0 14px; height: 58px; gap: 10px; }
    .tb-logo { display: block; }
    .tb-title h1 { font-size: 1rem; }
    .tb-right .btn-txt { display: none; }
    .main { padding: 16px 14px; }
    .main-footer { display: none; }
    .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
    .hero { padding: 20px; border-radius: 16px; }
    .hero h2 { font-size: 1.25rem; }
    .card { padding: 16px; }

    /* Barra inferior */
    .bn {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
        height: calc(var(--bn-h) + var(--safe-b)); padding: 6px 6px calc(6px + var(--safe-b));
        background: rgba(12,12,15,.94); backdrop-filter: blur(14px) saturate(1.3);
        border-top: 1px solid var(--bd);
    }
    .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--mt); font-size: .66rem; font-weight: 600; border-radius: 12px; min-width: 0; }
    .bn-item span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .bn-item .material-symbols-outlined { font-size: 23px; }
    .bn-item.is-on { color: #fff; }
    .bn-item.is-on .material-symbols-outlined { font-variation-settings: 'FILL' 1; color: #ff8cc0; }
    .bn-fab .material-symbols-outlined {
        width: 46px; height: 46px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center;
        background: var(--grad) !important; color: #fff !important;
        box-shadow: 0 6px 16px -4px rgba(204,26,123,.6), 0 0 0 4px var(--bg); font-size: 26px;
    }
    .toast-x { bottom: calc(var(--bn-h) + var(--safe-b) + 12px); }

    /* Ticket → tarjeta */
    .tk-head { display: none; }
    .tk {
        grid-template-columns: 4px minmax(0, 1fr) auto;
        grid-template-areas: "bar main st" "bar who pr";
        gap: 6px 12px; padding: 14px;
    }
    .tk-bar { grid-area: bar; }
    .tk-main { grid-area: main; }
    .tk-st { grid-area: st; justify-self: end; align-self: start; }
    .tk-who { grid-area: who; font-size: .76rem; }
    .tk-pr { grid-area: pr; justify-self: end; }
    .tk-go, .tk-when { display: none; }
    .tk-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

    .filters .select { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .props dd { text-align: right; }
    .modal { align-items: flex-end; padding: 0; }
    .modal-box { border-radius: 18px 18px 0 0; padding-bottom: calc(22px + var(--safe-b)); max-width: none; }
}

@media (max-width: 575.98px) {
    .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 12px 14px; }
    .kpi-val { font-size: 1.5rem; }
    .kpi-ico { width: 30px; height: 30px; }
    .seg:not(.big) { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
    .hero .row .btn { flex: 1; }
    .cols { gap: 3px; }
    .col-l { font-size: .58rem; }
    .member-stats { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── IA, acciones y detalles (v2) ────────────────────── */
.tag-warn { background: rgba(240,164,41,.13); color: #f6bf63; font-weight: 600; }
.tag-ia { background: linear-gradient(100deg, rgba(66,117,230,.18), rgba(204,26,123,.18)); color: #d9c8ff; }
.tag-ia .material-symbols-outlined, .tag-warn .material-symbols-outlined { font-size: 14px; }
.ia-card { position: relative; overflow: hidden; }
.ia-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--grad); opacity: .8; }
.grad-text.material-symbols-outlined { color: #ff8cc0; }
.acc-list { display: flex; flex-direction: column; gap: 10px; }
.acc { border: 1px solid var(--bd); border-radius: 12px; padding: 12px; background: var(--bg-2); }
.acc.is-pend { border-color: rgba(126,87,194,.45); background: linear-gradient(135deg, rgba(66,117,230,.06), rgba(204,26,123,.06)); }
.acc-res { margin-top: 8px; font-size: .8rem; color: var(--tx-2); background: var(--sf-2); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
.sel-mini { min-height: 34px !important; padding: 4px 30px 4px 10px !important; font-size: .84rem !important; width: auto !important; }
.cat-seg { grid-auto-flow: row !important; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 575.98px) { .cat-seg { grid-template-columns: 1fr 1fr; } }

/* ── Presencia en vivo ──────────────────────────────── */
.main { position: relative; }
.cursores { position: absolute; inset: 0; pointer-events: none; z-index: 25; overflow: hidden; }
.cursor-x {
    position: absolute; left: 0; top: 0; will-change: transform;
    transition: transform .9s cubic-bezier(.22,.8,.32,1), opacity .3s;
}
.cursor-x svg { display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.cursor-x .cx-name {
    position: absolute; left: 14px; top: 16px; white-space: nowrap;
    padding: 3px 8px; border-radius: 999px 999px 999px 4px; font-size: .7rem; font-weight: 700; color: #fff;
    background: var(--c); box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.cursor-x.idle { opacity: .45; }
.presentes { display: flex; align-items: center; }
  .presentes .avatar { width: 30px; height: 30px; font-size: .74rem; margin-left: -8px; background: var(--c, var(--grad)); outline: 2px solid var(--bg); cursor: default; position: relative; }
.presentes .avatar:first-child { margin-left: 0; }
.presentes .avatar::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--bg); }
.presentes .avatar.otra-pag { opacity: .45; }
.presentes .avatar.otra-pag::after { background: var(--mt); }
.presentes .mas { margin-left: 6px; font-size: .74rem; color: var(--mt); }
.watchers { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: #f6bf63; background: rgba(240,164,41,.08); border: 1px solid rgba(240,164,41,.3); border-radius: 10px; padding: 8px 10px; }
.watchers .material-symbols-outlined { font-size: 18px; }
@media (max-width: 991.98px) { .cursores { display: none; } .presentes .avatar { width: 26px; height: 26px; } }
