/* =============================================================
   GLOBALS.CSS  —  Design System Centralizado
   Grupon · "La ruta del mensaje" · Claro + oscuro · Onest
   ============================================================= */

/* ─── 1. TOKENS ─────────────────────────────────────────────── */
:root {
    color-scheme: light;

    /* Base: grises neutros casi blancos */
    --paper:   #F6F7F9;
    --surface: #FFFFFF;
    --sunken:  #F2F4F7;
    --mist:    #EAECF0;
    --mist-2:  #D0D5DD;
    --slate:   #475467;
    --faint:   #667085;
    --ink:     #101828;

    /* Verde */
    --leaf:       #15803D;
    --leaf-hover: #116632;
    --on-leaf:    #FFFFFF;
    --sprout:     #ECFDF3;
    --sprout-2:   #ABEFC6;
    --signal:     #22C55E;

    /* Estados */
    --amber:  #B54708;
    --danger: #D92D20;
    --info:   #1570EF;
    --violet: #6941C6;

    /* Radios: más grande = contenedor más grande */
    --r-sm:   6px;
    --r-md:   8px;
    --r-lg:   12px;
    --r-xl:   14px;
    --r-pill: 999px;

    /* Sombras sutiles */
    --shadow-sm:    0 1px 2px rgba(16,24,40,.05);
    --shadow-md:    0 4px 8px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.04);
    --shadow-modal: 0 20px 24px -4px rgba(16,24,40,.10), 0 8px 8px -4px rgba(16,24,40,.04);
    --shadow-card:  var(--shadow-sm);

    --ease-out: cubic-bezier(.2,.8,.2,1);
    --rail-w: 260px;
    --topbar-h: 64px;

    /* Alias heredados (las plantillas existentes los usan) */
    --bg-body:        var(--paper);
    --bg-card:        var(--surface);
    --bg-deep:        var(--sunken);
    --bg-input:       var(--surface);
    --bg-hover:       var(--sunken);
    --border:         var(--mist);
    --border-light:   var(--mist-2);
    --accent:         var(--leaf);
    --accent-hover:   var(--leaf-hover);
    --accent-dim:     var(--sprout);
    --accent-border:  var(--sprout-2);
    --accent-glow:    color-mix(in srgb, var(--leaf) 16%, transparent);
    --text-primary:   var(--ink);
    --text-secondary: var(--slate);
    --text-muted:     var(--faint);
    --text-white:     var(--ink);
    --c-pending:      var(--amber);
    --c-sending:      var(--info);
    --c-success:      var(--leaf);
    --c-failed:       var(--danger);
    --c-info:         var(--violet);
    --c-warning:      var(--amber);
    --card-bg:        var(--surface);
    --card-border:    var(--mist);
    --border-color:   var(--mist);
}


/* ─── 2. BASE ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    /* Bootstrap overrides */
    --bs-body-bg: var(--paper);
    --bs-body-color: var(--ink);
    --bs-body-font-family: 'Onest', system-ui, sans-serif;
    --bs-border-color: var(--mist);
    --bs-secondary-color: var(--slate);
    --bs-tertiary-bg: var(--sunken);
    --bs-emphasis-color: var(--ink);
    --bs-link-color-rgb: 11,122,69;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); line-height: 1.2; }

a { color: var(--leaf); text-decoration: none; }
a:hover { color: var(--leaf-hover); }

:focus-visible {
    outline: 2px solid var(--leaf);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* Bootstrap utility overrides */
.text-muted     { color: var(--faint) !important; }
.text-secondary { color: var(--slate) !important; }
.text-success   { color: var(--leaf) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--amber) !important; }
.text-white     { color: var(--ink) !important; }
.bg-dark, .bg-black { background: var(--sunken) !important; color: var(--ink) !important; }
.border         { border-color: var(--mist) !important; }

.tabular { font-variant-numeric: tabular-nums; }
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important; width: 1px !important; height: 1px !important;
    overflow: hidden !important; clip: rect(0,0,0,0) !important;
}

.skip-link {
    position: absolute; left: 1rem; top: -3rem; z-index: 2000;
    background: var(--leaf); color: var(--on-leaf);
    padding: .5rem .9rem; border-radius: var(--r-md); font-weight: 600;
}
.skip-link:focus { top: 1rem; color: var(--on-leaf); }


/* ─── 3. LAYOUT DE APLICACIÓN ────────────────────────────────── */
.app-shell {
    background: linear-gradient(to right, var(--surface) var(--rail-w), var(--paper) var(--rail-w));
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    min-height: 100vh;
}
.app-body { min-width: 0; display: flex; flex-direction: column; }
.app-main {
    padding: 1.75rem clamp(1rem, 2.5vw, 2rem) 3rem;
    min-width: 0;
    flex: 1;
}
.app-main__inner { max-width: 1320px; margin: 0 auto; }

@media (max-width: 991.98px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); background: var(--paper); }
    .app-main  { padding: 1.25rem 1rem 2rem; }
}


/* ─── 4. TIPOGRAFÍA DE PÁGINA ────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 .25rem;
    letter-spacing: -.02em;
    display: flex;
    align-items: center;
    gap: .55rem;
}
.page-header h1 > i { color: var(--leaf); font-size: 1.25rem; }
.page-header p { color: var(--slate); margin: 0; font-size: .92rem; max-width: 68ch; }
.page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.step-eyebrow {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .8rem; font-weight: 600; color: var(--leaf);
    background: var(--sprout); border: 1px solid var(--sprout-2);
    padding: .15rem .6rem .15rem .2rem; border-radius: var(--r-pill);
    margin-bottom: .6rem;
}
.step-eyebrow__num {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--leaf); color: var(--on-leaf);
    font-size: .7rem; display: inline-flex; align-items: center; justify-content: center;
}


/* ─── 5. SIDEBAR + TOPBAR ────────────────────────────────────── */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--mist);
    display: flex;
    flex-direction: column;
    padding: 0 .85rem 1rem;
    overflow-y: auto;
}

.brand {
    display: flex; align-items: center; gap: .6rem;
    height: var(--topbar-h);
    padding: 0 .4rem;
    margin-bottom: .5rem;
    color: var(--ink); text-decoration: none;
    font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em;
}
.brand:hover { color: var(--ink); }
.brand__mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(145deg, #22C55E, #15803D);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem;
    box-shadow: 0 1px 2px rgba(16,24,40,.12), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand small { display: block; font-size: .72rem; font-weight: 500; color: var(--faint); letter-spacing: 0; }

.sidebar-title {
    font-size: .75rem;
    font-weight: 600;
    color: var(--faint);
    padding: 0 .65rem;
    margin: 1rem 0 .35rem;
}

.sidebar .nav-group { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-link {
    color: var(--slate);
    border-radius: var(--r-md);
    padding: .5rem .65rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    min-height: 40px;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; color: var(--faint); }
.sidebar .nav-link:hover { background: var(--sunken); color: var(--ink); }
.sidebar .nav-link.active { background: var(--sunken); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--leaf); }
.sidebar .nav-link.active i { color: var(--leaf); }
.nav-badge {
    margin-left: auto;
    font-size: .72rem; font-weight: 600;
    padding: .05rem .5rem; border-radius: var(--r-pill);
    background: var(--sunken); color: var(--slate);
    font-variant-numeric: tabular-nums;
}
.nav-badge--ok   { background: var(--sprout); color: var(--leaf); }
.nav-badge--warn { background: #FEF3F2; color: var(--danger); }

/* Tarjeta de configuración inicial (en el sidebar) */
.setup-card {
    margin-top: auto;
    border: 1px solid var(--mist);
    background: var(--paper);
    border-radius: var(--r-lg);
    padding: .9rem;
    margin-bottom: .75rem;
}
.setup-card__head { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; font-weight: 600; color: var(--ink); }
.setup-card__head span:last-child { font-size: .78rem; color: var(--faint); font-weight: 500; }
.setup-card .progress-mini { margin: .5rem 0 .6rem; }
.setup-card ol { list-style: none; padding: 0; margin: 0 0 .7rem; display: grid; gap: .3rem; }
.setup-card li { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--slate); }
.setup-card li a { color: inherit; }
.setup-card li.is-done { color: var(--faint); text-decoration: line-through; }
.setup-card li.is-current { color: var(--ink); font-weight: 600; }
.setup-dot {
    width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid var(--mist-2); background: var(--surface);
    display: inline-flex; align-items: center; justify-content: center; font-size: .6rem; color: #fff;
}
.is-done .setup-dot { background: var(--signal); border-color: var(--signal); }
.is-current .setup-dot { border-color: var(--leaf); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 8px var(--leaf); }
.setup-card .btn-accent { width: 100%; }

.sidebar-foot {
    border-top: 1px solid var(--mist);
    padding: .85rem .35rem 0;
    display: flex; align-items: center; gap: .6rem;
}
.sidebar .setup-card + .sidebar-foot { margin-top: 0; }
.sidebar-foot--auto { margin-top: auto; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(145deg, #DCFCE7, #BBF7D0); color: #14532D;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; text-transform: uppercase;
    flex-shrink: 0;
}
.sidebar-foot__who { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-foot__name { font-size: .88rem; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.sidebar-foot__role { font-size: .76rem; color: var(--faint); }
.sidebar-foot form { margin: 0; }

/* Barra superior */
.topbar {
    position: sticky; top: 0; z-index: 1020;
    height: var(--topbar-h);
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--mist);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 clamp(1rem, 2.5vw, 2rem);
}
.topbar .topbar__menu { display: none; }
.crumbs { display: flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--faint); min-width: 0; }
.crumbs a { color: var(--faint); }
.crumbs a:hover { color: var(--ink); }
.crumbs i { font-size: .7rem; }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.conn-pill {
    display: inline-flex; align-items: center; gap: .45rem;
    font-size: .82rem; font-weight: 500; color: var(--slate);
    border: 1px solid var(--mist); border-radius: var(--r-pill);
    padding: .3rem .75rem; background: var(--surface); text-decoration: none;
}
.conn-pill:hover { color: var(--ink); border-color: var(--mist-2); }
.conn-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mist-2); }
.conn-pill.is-on .dot { background: var(--signal); box-shadow: 0 0 0 3px #DCFCE7; }
.conn-pill.is-off .dot { background: var(--danger); box-shadow: 0 0 0 3px #FEE4E2; }

.sidebar-scrim[hidden] { display: none; }

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 1040;
        width: min(290px, 86vw);
        transform: translateX(-100%);
        transition: transform .25s var(--ease-out);
        box-shadow: var(--shadow-modal);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 1035; background: rgba(16,24,40,.4); }
    .topbar .topbar__menu { display: inline-flex; }
    .topbar .conn-pill span.label { display: none; }
}
@media (max-width: 575.98px) {
    .topbar .btn-accent span { display: none; }
}

/* ─── 6. AVISOS DEL FLUJO ────────────────────────────────────── */
/* "Siguiente paso" — aparece cuando el paso actual ya está completo */
.next-step {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    background: var(--sprout);
    border: 1px solid var(--sprout-2);
    border-radius: var(--r-lg);
    padding: .9rem 1.1rem;
    margin-bottom: 1.5rem;
}
.next-step__icon { color: var(--leaf); font-size: 1.3rem; }
.next-step__text { flex: 1; min-width: 200px; }
.next-step__text strong { display: block; color: var(--ink); }
.next-step__text span   { color: var(--slate); font-size: .9rem; }

/* Bloqueo suave: falta un paso anterior */
.step-locked {
    background: var(--surface);
    border: 1px dashed var(--mist-2);
    border-radius: var(--r-xl);
    padding: 3rem 1.5rem;
    text-align: center;
    max-width: 640px;
    margin: 1rem auto;
}
.step-locked__mark {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--sunken); color: var(--slate);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin-bottom: 1rem;
}
.step-locked h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 .5rem; }
.step-locked p  { color: var(--slate); margin: 0 auto 1.25rem; max-width: 46ch; }

/* Avisos en línea */
.notice {
    display: flex; gap: .6rem; align-items: flex-start;
    border-radius: var(--r-md);
    padding: .7rem .95rem;
    font-size: .9rem;
    margin-bottom: 1rem;
    border: 1px solid var(--mist);
    background: var(--surface);
    color: var(--ink);
}
.notice > i { margin-top: .1rem; flex-shrink: 0; }
.notice--danger  { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice--danger > i  { color: var(--danger); }
.notice--warning { background: color-mix(in srgb, var(--amber) 9%, var(--surface));  border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.notice--warning > i { color: var(--amber); }
.notice--info    { background: color-mix(in srgb, var(--info) 8%, var(--surface));   border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.notice--info > i    { color: var(--info); }
.notice__detail { color: var(--slate); }


/* ─── 7. TARJETAS ────────────────────────────────────────────── */
.card-base {
    background: var(--surface) !important;
    border: 1px solid var(--mist) !important;
    border-radius: var(--r-lg);
    color: var(--ink);
}

.card {
    background: var(--surface) !important;
    border: 1px solid var(--mist) !important;
    color: var(--ink) !important;
    --bs-card-cap-bg: var(--sunken);
}

/* Tabla-card (listados) */
.table-card {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.table-card-header {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--mist);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.table-card-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.table-scroll { overflow-x: auto; }

/* Info-card (detalle) */
.info-card {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-lg);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}
.info-card-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.info-card-title i { color: var(--leaf); }
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--mist);
    font-size: .9rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--slate); }
.info-value { color: var(--ink); font-weight: 500; text-align: right; }

/* Form-card (formularios) */
.form-card {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-xl);
    overflow: hidden;
}
.form-card-header {
    padding: 1rem 1.35rem;
    border-bottom: 1px solid var(--mist);
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-card-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
    font-size: 1rem;
}
.form-card-header i { color: var(--leaf); }
.form-card-body { padding: 1.35rem; }

/* Tarjeta de número conectado (paso 1) */
.number-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}
.number-card {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-xl);
    padding: 1.15rem 1.25rem;
    display: flex; flex-direction: column; gap: .9rem;
}
.number-card__head { display: flex; align-items: flex-start; gap: .8rem; }
.number-card__text { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; }
.number-card__text .badge-status { margin-top: .35rem; }
.number-card__icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--sunken); color: var(--slate);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.25rem; position: relative; flex-shrink: 0;
}
.number-card__icon .dot {
    position: absolute; right: -2px; bottom: -2px;
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--mist-2);
}
.number-card.is-working .number-card__icon { background: var(--sprout); color: var(--leaf); }
.number-card.is-working .dot { background: var(--signal); }
.number-card.is-problem .dot { background: var(--danger); }
.number-card.is-waiting .dot { background: var(--info); }
.number-card__title { font-weight: 700; font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.number-card__sub   { font-size: .82rem; color: var(--faint); }
.number-card__actions { display: flex; gap: .4rem; flex-wrap: wrap; border-top: 1px solid var(--mist); padding-top: .85rem; }

/* Instrucciones numeradas (QR) */
.qr-steps { list-style: none; counter-reset: qr; padding: 0; margin: 0 0 1rem; display: grid; gap: .55rem; }
.qr-steps li { counter-increment: qr; display: flex; gap: .65rem; align-items: baseline; font-size: .92rem; color: var(--ink); }
.qr-steps li::before {
    content: counter(qr);
    flex-shrink: 0;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--sprout); color: var(--leaf);
    font-size: .75rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}


/* ─── 8. TABLA ───────────────────────────────────────────────── */
.table {
    margin: 0;
    color: var(--ink);
    font-size: .9rem;
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--mist);
    --bs-table-striped-bg: var(--sunken);
    --bs-table-hover-bg: var(--bg-hover);
    --bs-table-hover-color: var(--ink);
}
.table td,
.table th {
    background: var(--surface) !important;
    border-color: var(--mist) !important;
}
.table thead th {
    background: var(--sunken) !important;
    color: var(--slate);
    font-size: .8rem;
    font-weight: 600;
    padding: .7rem 1.1rem;
    white-space: nowrap;
}
.table tbody tr { border-color: var(--mist); }
.table tbody tr:hover td { background: color-mix(in srgb, var(--leaf) 4%, var(--surface)) !important; }
.table tbody td {
    padding: .8rem 1.1rem;
    vertical-align: middle;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}


/* ─── 9. FORMULARIOS ─────────────────────────────────────────── */
label {
    color: var(--ink);
    font-size: .88rem;
    font-weight: 500;
    margin-bottom: .35rem;
    display: block;
}

.form-control,
.form-select {
    background-color: var(--surface) !important;
    border: 1px solid var(--mist-2) !important;
    color: var(--ink) !important;
    font-size: .92rem;
    border-radius: var(--r-md);
    transition: border-color .15s, box-shadow .15s;
    padding: .55rem .8rem;
    min-height: 42px;
}
.form-control-sm, .form-select-sm { min-height: 34px; padding: .3rem .6rem; font-size: .85rem; }

.form-control:focus,
.form-select:focus {
    border-color: var(--leaf) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    outline: none;
}
.form-control:disabled, .form-select:disabled { background-color: var(--sunken) !important; color: var(--faint) !important; }
.form-control::placeholder { color: var(--faint); }
.form-select option { background: var(--surface); color: var(--ink); }

.form-check-input {
    background-color: var(--surface) !important;
    border: 1.5px solid var(--mist-2) !important;
    width: 1.1em; height: 1.1em;
}
.form-check-input:checked {
    background-color: var(--leaf) !important;
    border-color: var(--leaf) !important;
}
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-glow) !important; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .88rem;
    color: var(--slate);
    text-decoration: none;
    margin-bottom: 1rem;
    min-height: 32px;
}
.back-link:hover { color: var(--ink); }

.field-hint { color: var(--faint); font-size: .8rem; margin-top: .3rem; }
.error-msg  { color: var(--danger); font-size: .82rem; margin-top: .3rem; }

.section-label {
    font-size: .92rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: .65rem;
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.section-label i { color: var(--leaf); }

.char-counter {
    text-align: right;
    font-size: .8rem;
    color: var(--faint);
    margin-top: .25rem;
    font-variant-numeric: tabular-nums;
}

.alert-form-error {
    background: color-mix(in srgb, var(--danger) 8%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    color: var(--danger);
    border-radius: var(--r-md);
    padding: .7rem 1rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}


/* ─── 10. BOTONES ────────────────────────────────────────────── */
.btn-accent,
.btn-outline-wha,
.btn-ghost,
.btn-danger-soft {
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    padding: .55rem 1.05rem;
    min-height: 40px;
    border-radius: var(--r-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn-accent:active,
.btn-outline-wha:active,
.btn-danger-soft:active { transform: translateY(1px); }
.btn-accent:disabled,
.btn-outline-wha:disabled { opacity: .55; cursor: not-allowed; }

/* Primario */
.btn-accent { background: var(--leaf); border: 1px solid var(--leaf); color: var(--on-leaf); }
.btn-accent:hover { background: var(--leaf-hover); border-color: var(--leaf-hover); color: var(--on-leaf); }
.btn-accent--lg { font-size: 1rem; padding: .75rem 1.4rem; min-height: 48px; border-radius: var(--r-lg); }

/* Secundario */
.btn-outline-wha { background: var(--surface); border: 1px solid var(--mist-2); color: var(--ink); }
.btn-outline-wha:hover { border-color: var(--leaf); color: var(--leaf); }

/* Terciario */
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--slate); padding-inline: .7rem; }
.btn-ghost:hover { background: var(--sunken); color: var(--ink); }

/* Destructivo suave */
.btn-danger-soft { background: var(--surface); border: 1px solid var(--mist-2); color: var(--danger); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.btn-sm-x { min-height: 34px; padding: .35rem .75rem; font-size: .84rem; }

/* Icono cuadrado (con aria-label siempre) */
.btn-icon {
    background: var(--surface);
    border: 1px solid var(--mist);
    color: var(--slate);
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    font-size: .92rem;
    transition: border-color .15s, color .15s, background .15s;
    flex-shrink: 0;
}
.btn-icon:hover        { border-color: var(--leaf); color: var(--leaf); background: var(--sprout); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }

/* Bootstrap overrides */
.btn { font-family: inherit; font-weight: 600; border-radius: var(--r-md); }
.btn.btn-sm, .btn-sm {
    font-size: .84rem;
    padding: .35rem .75rem;
    border-radius: var(--r-md);
}
.btn-primary, .btn-success {
    --bs-btn-bg: var(--leaf); --bs-btn-border-color: var(--leaf); --bs-btn-color: var(--on-leaf);
    --bs-btn-hover-bg: var(--leaf-hover); --bs-btn-hover-border-color: var(--leaf-hover); --bs-btn-hover-color: var(--on-leaf);
    --bs-btn-active-bg: var(--leaf-hover); --bs-btn-active-border-color: var(--leaf-hover);
}
.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--leaf); --bs-btn-border-color: var(--leaf);
    --bs-btn-hover-bg: var(--leaf); --bs-btn-hover-border-color: var(--leaf); --bs-btn-hover-color: var(--on-leaf);
}
.btn-outline-secondary, .btn-secondary, .btn-light {
    --bs-btn-bg: var(--surface); --bs-btn-color: var(--ink); --bs-btn-border-color: var(--mist-2);
    --bs-btn-hover-bg: var(--sunken); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--mist-2);
}
.btn-close { filter: none; }


/* ─── 11. BADGES DE ESTADO (siempre texto + color) ───────────── */
.badge-status {
    --tone: var(--slate);
    padding: .3em .7em;
    border-radius: var(--r-pill);
    font-size: .8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    line-height: 1.1;
    white-space: nowrap;
    color: var(--tone);
    background: color-mix(in srgb, var(--tone) 11%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--tone) 26%, transparent);
}
.badge-status::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge-status:has(> i)::before { display: none; }

.status-pending, .status-queued, .status-paused        { --tone: var(--amber); }
.status-sending, .status-retrying, .status-starting,
.status-scan_qr_code                                  { --tone: var(--info); }
.status-sent, .status-done, .status-delivered,
.status-working                                       { --tone: var(--leaf); }
.status-read                                          { --tone: var(--violet); }
.status-failed, .status-not_found,
.status-number_already_linked                         { --tone: var(--danger); }
.status-stopped, .status-disconnected                 { --tone: var(--slate); }


/* ─── 12. TAGS / PILLS ───────────────────────────────────────── */
.tag-badge,
.tag-pill {
    background: var(--sunken);
    color: var(--ink);
    border: 1px solid var(--mist);
    border-radius: var(--r-pill);
    padding: .22em .65em;
    font-size: .8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 2px;
    white-space: nowrap;
}
.tag-badge-empty { color: var(--faint); font-size: .85rem; }

.chip-count {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .75rem;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--mist);
    color: var(--slate);
    font-size: .85rem; font-weight: 500;
    text-decoration: none;
    min-height: 34px;
}
.chip-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.chip-count:hover { border-color: var(--mist-2); color: var(--ink); }
.chip-count.is-active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip-count.is-active b { color: var(--surface); }
.chip-row { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1rem; }


/* ─── 13. MODAL ──────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18,23,21,.45);
    backdrop-filter: blur(3px);
    z-index: 1050;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    animation: modalIn .2s var(--ease-out);
}
.modal-box.modal-wide { max-width: 640px; }
.modal-box.modal-lg   { max-width: 860px; }

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -.01em;
}
.modal-title i { color: var(--leaf); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.modal-result { margin-top: .75rem; font-size: .9rem; display: none; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Bootstrap .modal */
.modal-content { background: var(--surface); color: var(--ink); border: 1px solid var(--mist); border-radius: var(--r-xl); }
.modal-header, .modal-footer { border-color: var(--mist); }

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.qr-container img {
    width: 100%;
    max-width: 300px;
    height: auto;
    image-rendering: pixelated;
    object-fit: contain;
    border-radius: var(--r-lg);
    background: #fff;
    padding: 10px;
    border: 1px solid var(--mist);
}


/* ─── 14. STATS ──────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-lg);
    padding: .9rem 1rem;
    position: relative;
    overflow: hidden;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}
.stat-label {
    font-size: .85rem;
    color: var(--slate);
    margin-top: .25rem;
    font-weight: 500;
}
.stat-sent .stat-value    { color: var(--leaf); }
.stat-read .stat-value    { color: var(--violet); }
.stat-failed .stat-value  { color: var(--danger); }
.stat-pending .stat-value { color: var(--amber); }


/* ─── 15. PROGRESS BARS ──────────────────────────────────────── */
.progress-mini     { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress-mini-bar { height: 100%; background: var(--leaf); border-radius: 3px; transition: width .4s var(--ease-out); }
.progress-bar-full { height: 8px; background: var(--sunken); border-radius: 4px; overflow: hidden; margin-top: .5rem; }
.progress-bar-fill { height: 100%; background: var(--leaf); border-radius: 4px; transition: width .5s var(--ease-out); }
.progress { --bs-progress-bg: var(--sunken); --bs-progress-bar-bg: var(--leaf); }


/* ─── 16. FILTER BAR / TOOLBAR ───────────────────────────────── */
.filter-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--mist);
    padding: .9rem 1.25rem;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-bar label { margin-bottom: .25rem; font-size: .82rem; color: var(--slate); }
.filter-bar--flush { border: 1px solid var(--mist); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.filter-bar + .table-card,
.filter-bar--flush + .table-card { border-top-left-radius: 0; border-top-right-radius: 0; }

.toolbar       { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.toolbar-left  { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.search-field { position: relative; flex: 1; min-width: 200px; }
.search-field > i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-field .form-control { padding-left: 2.2rem; }


/* ─── 17. PAGINATION ─────────────────────────────────────────── */
.pagination { padding: .75rem 1.25rem; margin: 0; justify-content: flex-end; border-top: 1px solid var(--mist); gap: .25rem; flex-wrap: wrap; }
.page-link  {
    background: var(--surface); border-color: var(--mist); color: var(--slate);
    font-size: .85rem; border-radius: var(--r-sm) !important; padding: .35rem .7rem;
    min-width: 34px; text-align: center; font-variant-numeric: tabular-nums;
}
.page-item.active .page-link { background: var(--leaf); border-color: var(--leaf); color: var(--on-leaf); font-weight: 700; }
.page-item.disabled .page-link { background: var(--surface); color: var(--faint); border-color: var(--mist); }
.page-link:hover { background: var(--sprout); color: var(--leaf); border-color: var(--sprout-2); }


/* ─── 18. PARTICIPANTS ───────────────────────────────────────── */
.participants-count {
    background: var(--sunken);
    border-radius: var(--r-pill);
    padding: .2em .7em;
    font-size: .82rem;
    color: var(--slate);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}
.participant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .6rem 0;
    border-bottom: 1px solid var(--mist);
    color: var(--ink);
    font-size: .9rem;
}
.participant-item:last-child { border-bottom: none; }
.participant-list-wrapper    { max-height: 320px; overflow-y: auto; }
.participant-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--sprout);
    display: flex; align-items: center; justify-content: center;
    color: var(--leaf); font-size: .78rem; font-weight: 700;
    flex-shrink: 0;
}


/* ─── 19. TABS / SEGMENTED ───────────────────────────────────── */
.action-tabs {
    display: inline-flex; gap: 2px; margin-bottom: 1.1rem; flex-wrap: wrap;
    background: var(--sunken); padding: 3px; border-radius: var(--r-md);
}
.action-tab {
    background: transparent;
    border: 0;
    color: var(--slate);
    padding: .45rem .85rem;
    border-radius: var(--r-sm);
    font-size: .86rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 34px;
    transition: background .15s, color .15s;
}
.action-tab:hover  { color: var(--ink); }
.action-tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }


/* ─── 20. TAG CHECKBOXES (selector de etiquetas) ─────────────── */
.tag-check-grid  { display: flex; flex-wrap: wrap; gap: .45rem; max-height: 250px; overflow-y: auto; }
.tag-check-item input { position: absolute; opacity: 0; pointer-events: none; }
.tag-check-item label {
    background: var(--surface);
    border: 1px solid var(--mist-2);
    border-radius: var(--r-pill);
    padding: .35em .85em;
    font-size: .85rem;
    color: var(--slate);
    cursor: pointer;
    user-select: none;
    margin: 0;
    font-weight: 500;
    transition: background .15s, border-color .15s, color .15s;
}
.tag-check-item input:checked + label { background: var(--sprout); border-color: var(--leaf); color: var(--ink); font-weight: 600; }
.tag-check-item input:focus-visible + label { outline: 2px solid var(--leaf); outline-offset: 2px; }


/* ─── 21. MISC ───────────────────────────────────────────────── */
.msg-preview {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--slate);
    font-size: .88rem;
}

.message-body {
    background: var(--sunken);
    border-radius: var(--r-md);
    padding: .9rem 1rem;
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.empty-state    { text-align: center; padding: 3rem 1rem; color: var(--slate); }
.empty-state i  { font-size: 2.25rem; margin-bottom: .75rem; display: block; color: var(--faint); }
.empty-state h4 { color: var(--ink); margin-bottom: .4rem; font-size: 1.1rem; font-weight: 700; }
.empty-state p  { font-size: .92rem; max-width: 46ch; margin: 0 auto 1rem; }

.muted   { color: var(--slate); }
.small-x { font-size: .82rem; }
.stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.row-gap  { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.spinning { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ─── 22. MEDIA MESSAGE ──────────────────────────────────────── */
.media-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--slate);
    background: var(--sunken);
    border-radius: var(--r-pill);
    padding: .15rem .55rem;
    white-space: nowrap;
}

.media-type-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--slate);
    background: var(--sunken);
    border-radius: var(--r-md);
    padding: .35rem .75rem;
}


/* ─── 23. ALERTS / TOASTS ────────────────────────────────────── */
.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(380px, calc(100vw - 2rem));
}
.alert {
    border-radius: var(--r-md);
    border: 1px solid var(--mist);
    background: var(--surface);
    color: var(--ink);
    font-size: .9rem;
    padding: .7rem 1rem;
}
.toast-stack .alert {
    display: flex; align-items: flex-start; gap: .6rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    animation: toastIn .22s var(--ease-out);
    margin: 0;
    border-left-width: 4px;
}
.toast-stack .alert > i { flex-shrink: 0; margin-top: .12rem; }
.alert-success { border-left-color: var(--leaf); }
.alert-success > i { color: var(--leaf); }
.alert-danger, .alert-error { border-left-color: var(--danger); }
.alert-danger > i, .alert-error > i { color: var(--danger); }
.alert-warning { border-left-color: var(--amber); }
.alert-warning > i { color: var(--amber); }
.alert-info { border-left-color: var(--info); }
.alert-info > i { color: var(--info); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ─── 24. DROPDOWN (Bootstrap override) ─────────────────────── */
.dropdown-menu,
.dropdown-menu-dark {
    background: var(--surface) !important;
    border: 1px solid var(--mist) !important;
    border-radius: var(--r-lg) !important;
    padding: .35rem !important;
    box-shadow: var(--shadow-md) !important;
    font-size: .9rem !important;
    min-width: 200px;
}
.dropdown-item {
    color: var(--ink) !important;
    border-radius: var(--r-md) !important;
    padding: .5rem .8rem !important;
    display: flex !important;
    align-items: center !important;
    gap: .55rem !important;
    min-height: 38px;
}
.dropdown-item i { color: var(--slate); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--sunken) !important; color: var(--ink) !important; }
.dropdown-item.text-danger, .dropdown-item.text-danger i { color: var(--danger) !important; }
.dropdown-divider { border-color: var(--mist) !important; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: .4rem; }


/* ─── 25. ACTION BUTTONS (Bootstrap pequeños) ────────────────── */
.action-btns { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }

.btn-sm.btn-info, .btn-sm.btn-warning, .btn-sm.btn-danger, .btn-sm.btn-secondary {
    background: var(--surface); border: 1px solid var(--mist-2);
}
.btn-sm.btn-info      { color: var(--info); }
.btn-sm.btn-warning   { color: var(--amber); }
.btn-sm.btn-danger    { color: var(--danger); }
.btn-sm.btn-secondary { color: var(--slate); }
.btn-sm.btn-info:hover, .btn-sm.btn-warning:hover, .btn-sm.btn-danger:hover, .btn-sm.btn-secondary:hover {
    background: var(--sunken); border-color: currentColor;
}
.btn-sm.btn-info:hover    { color: var(--info); }
.btn-sm.btn-warning:hover { color: var(--amber); }
.btn-sm.btn-danger:hover  { color: var(--danger); }
.btn-sm.btn-secondary:hover { color: var(--ink); }


/* ─── 26. AUTENTICACIÓN ──────────────────────────────────────── */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}
.auth-form-side {
    display: flex; flex-direction: column; justify-content: center;
    padding: 3rem clamp(1.25rem, 6vw, 5rem);
    background: var(--surface);
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; margin: 2.5rem 0 .4rem; }
.auth-form > p { color: var(--slate); margin-bottom: 1.75rem; }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form .btn-accent { width: 100%; }

.auth-route-side {
    background: var(--paper);
    border-left: 1px solid var(--mist);
    display: flex; flex-direction: column; justify-content: center;
    padding: 3rem clamp(1.5rem, 6vw, 5rem);
}
.auth-route-side h2 { font-size: 1.05rem; font-weight: 600; color: var(--slate); margin: 0 0 1.75rem; }

/* El riel en grande: el elemento memorable de la entrada */
.route-big { list-style: none; margin: 0; padding: 0; }
.route-big li { display: grid; grid-template-columns: 56px 1fr; column-gap: 1.1rem; position: relative; padding-bottom: 2.25rem; }
.route-big li:last-child { padding-bottom: 0; }
.route-big li:not(:last-child)::after {
    content: ""; position: absolute; left: 27px; top: 60px; bottom: 4px;
    width: 2px; background: var(--mist-2); border-radius: 2px;
}
.route-big__mark {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--mist-2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; font-weight: 700; color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.route-big li:first-child .route-big__mark { border-color: var(--leaf); color: var(--leaf); }
.route-big__title { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: .55rem; color: var(--ink); }
.route-big__desc  { color: var(--slate); margin-top: .35rem; max-width: 40ch; }
.route-big__ticks { color: var(--signal); display: inline-flex; margin-left: .35rem; vertical-align: middle; }

@media (max-width: 899.98px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-route-side { display: none; }
}


/* ─── 27. MOVIMIENTO REDUCIDO ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ─── 28. NÚMERO DE SECCIÓN EN FORMULARIOS ───────────────────── */
.step-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--sprout); color: var(--leaf);
    font-size: .78rem; font-weight: 700; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-variant-numeric: tabular-nums;
}
.auth-form .brand { padding: 0; }


/* ─── 29. DASHBOARD ──────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--mist);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.panel__head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--mist);
}
.panel__head h2 { font-size: 1rem; font-weight: 600; margin: 0; color: var(--ink); }
.panel__head p  { font-size: .82rem; color: var(--faint); margin: .1rem 0 0; }
.panel__link { font-size: .85rem; font-weight: 600; color: var(--leaf); white-space: nowrap; }
.panel__body { padding: 1.1rem 1.25rem; }
.panel__body--flush { padding: 0; }

.dash-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.dash-grid--kpi  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1199.98px) { .dash-grid--kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991.98px)  { .dash-grid--main { grid-template-columns: minmax(0, 1fr); } }


.kpi { padding: 1.15rem 1.25rem; display: flex; flex-direction: column; gap: .2rem; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .55rem; }
.kpi__label { font-size: .86rem; font-weight: 500; color: var(--slate); }
.kpi__icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
    border: 1px solid var(--mist); background: var(--surface); color: var(--slate);
    box-shadow: var(--shadow-sm);
}
.kpi__icon--green  { color: var(--leaf);  background: var(--sprout); border-color: var(--sprout-2); }
.kpi__icon--blue   { color: var(--info);  background: #EFF8FF; border-color: #B2DDFF; }
.kpi__icon--violet { color: var(--violet); background: #F4F3FF; border-color: #D9D6FE; }
.kpi__icon--amber  { color: var(--amber); background: #FFFAEB; border-color: #FEDF89; }
.kpi__value { font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi__foot { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--faint); margin-top: .25rem; flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: .15rem; font-weight: 600; padding: .05rem .45rem; border-radius: var(--r-pill); font-size: .78rem; }
.trend--up   { color: #067647; background: var(--sprout); }
.trend--down { color: #B42318; background: #FEF3F2; }
.trend--flat { color: var(--slate); background: var(--sunken); }

/* Gráfica de barras */
.bars { position: relative; padding: 1rem 1.25rem .5rem; }
.bars svg { display: block; width: 100%; height: 240px; overflow: visible; }
.bars .gridline { stroke: var(--mist); stroke-width: 1; }
.bars .axis { fill: var(--faint); font-size: 11px; font-family: inherit; }
.bars .b-ok   { fill: var(--signal); }
.bars .b-fail { fill: #FDA29B; }
.bars .col:hover rect { opacity: .8; }
.bars-legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--slate); }
.bars-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.bars-tip {
    position: absolute; pointer-events: none; transform: translate(-50%, -100%);
    background: var(--ink); color: #fff; font-size: .78rem; padding: .4rem .6rem; border-radius: var(--r-md);
    white-space: nowrap; box-shadow: var(--shadow-md); display: none;
}
.bars-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: .9rem; }

/* Listas dentro de paneles */
.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows > li { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--mist); }
.list-rows > li:last-child { border-bottom: 0; }
.list-rows .grow { flex: 1; min-width: 0; }
.list-rows .title { font-weight: 600; color: var(--ink); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-rows .sub { font-size: .8rem; color: var(--faint); }
.icon-chip {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--sunken); color: var(--slate); position: relative;
}
.icon-chip .dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); background: var(--mist-2); }
.icon-chip .dot.on  { background: var(--signal); }
.icon-chip .dot.off { background: var(--danger); }
.icon-chip .dot.wait { background: var(--info); }

/* Horas */
.hour-row { display: grid; grid-template-columns: 64px 1fr 48px; align-items: center; gap: .75rem; padding: .45rem 0; font-size: .86rem; }
.hour-row .h { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.hour-row .n { text-align: right; color: var(--slate); font-variant-numeric: tabular-nums; }

/* Configuración inicial en grande */
.setup-hero {
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 1.5rem; align-items: center;
    padding: 1.4rem 1.5rem; margin-bottom: 1rem;
    background: linear-gradient(120deg, #F0FDF4 0%, #FFFFFF 60%);
}
.setup-hero h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 .3rem; }
.setup-hero p  { color: var(--slate); font-size: .9rem; margin: 0 0 .9rem; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.setup-steps li {
    border: 1px solid var(--mist); border-radius: var(--r-lg); background: var(--surface);
    padding: .85rem 1rem; display: flex; flex-direction: column; gap: .35rem;
}
.setup-steps li.is-current { border-color: var(--leaf); box-shadow: 0 0 0 3px #DCFCE7; }
.setup-steps .num { font-size: .78rem; font-weight: 600; color: var(--faint); display: flex; align-items: center; gap: .4rem; }
.setup-steps .is-done .num { color: var(--leaf); }
.setup-steps strong { font-size: .92rem; color: var(--ink); font-weight: 600; }
.setup-steps a { font-size: .84rem; font-weight: 600; }
@media (max-width: 991.98px) {
    .setup-hero { grid-template-columns: minmax(0, 1fr); }
    .setup-steps { grid-template-columns: minmax(0, 1fr); }
}

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.quick-action {
    display: flex; align-items: center; gap: .65rem; padding: .75rem .85rem;
    border: 1px solid var(--mist); border-radius: var(--r-lg); color: var(--ink);
    font-size: .88rem; font-weight: 500; background: var(--surface);
    transition: border-color .12s, background .12s;
}
.quick-action:hover { border-color: var(--mist-2); background: var(--paper); color: var(--ink); }
.quick-action i { color: var(--leaf); font-size: 1.05rem; }

@media (max-width: 575.98px) {
    .dash-grid--kpi { gap: .6rem; }
    .kpi { padding: .9rem; }
    .kpi__icon { display: none; }
    .kpi__value { font-size: 1.45rem; }
    .kpi__top { margin-bottom: .25rem; }
    .panel__head { flex-wrap: wrap; padding: .9rem 1rem; }
    .bars { padding: .75rem .5rem .25rem; }
    .bars svg { height: 200px; }
}
