/* ============================================================
   StreamAdmin — Estilos (CSS puro, responsive, sin frameworks)
   ============================================================ */

:root {
    --indigo:   #4f46e5;
    --indigo-d: #4338ca;
    --green:    #16a34a;
    --amber:    #d97706;
    --rose:     #e11d48;
    --red:      #dc2626;
    --blue:     #2563eb;

    --bg:        #0b0d17;
    --surface:   #151829;
    --surface-2: #1c2036;
    --input-bg:  #10131f;
    --text:      #e7e9f3;
    --muted:     #9098b4;
    --border:    #262b42;

    --sidebar-w: 260px;
    --radius:    14px;
    --radius-sm: 10px;
    --shadow:    0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-lg: 0 18px 40px rgba(0,0,0,.5);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    background-image:
        radial-gradient(900px 500px at 100% -5%, rgba(79,70,229,.14), transparent 60%),
        radial-gradient(700px 500px at -5% 110%, rgba(124,58,237,.10), transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ===================== LAYOUT ===================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #0d0f1c;
    border-right: 1px solid var(--border);
    color: #cdd2e5;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 22px;
    font-weight: 800; font-size: 1.15rem; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo {
    display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--indigo), #7c3aed);
    color: #fff; font-size: 1.05rem;
}
.brand-logo--lg { width: 60px; height: 60px; font-size: 1.6rem; margin: 0 auto; }

.sidebar__nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    color: #aab1cc; font-weight: 500; font-size: .95rem;
    transition: background .15s, color .15s;
}
.nav-item i { width: 20px; text-align: center; font-size: 1rem; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
    background: linear-gradient(135deg, var(--indigo), #6d28d9);
    color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
/* Contador de avisos (vencimientos pendientes) */
.nav-badge {
    margin-left: auto; min-width: 22px; text-align: center;
    background: rgba(255,255,255,.14); color: #fff;
    border-radius: 999px; padding: 2px 8px; font-size: .75rem; font-weight: 700;
}
.nav-badge--danger { background: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,.22); }

.sidebar__footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.07); }
.user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: .9rem; }
.user-mini i { font-size: 1.5rem; color: #6d28d9; }
.user-mini--link { text-decoration: none; color: inherit; padding: 8px 10px; border-radius: 10px; transition: background .15s; }
.user-mini--link:hover { background: rgba(109,40,217,.08); }
.user-mini__cog { margin-left: auto; font-size: .95rem !important; color: var(--muted) !important; }
.btn-logout {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 10px; border-radius: var(--radius-sm);
    background: rgba(225,29,72,.12); color: #fb7185; font-weight: 600; font-size: .9rem;
    transition: background .15s;
}
.btn-logout:hover { background: rgba(225,29,72,.22); }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,17,32,.5); z-index: 39;
}

/* ===================== MAIN ===================== */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 28px; background: rgba(21,24,41,.85);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.hamburger {
    display: none; background: none; border: none;
    font-size: 1.3rem; color: var(--text);
}

.global-search { position: relative; margin-left: auto; width: min(380px, 45vw); }
.global-search > i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted);
}
.global-search input {
    width: 100%; padding: 11px 14px 11px 40px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--bg); font-size: .92rem; outline: none;
    transition: border .15s, box-shadow .15s;
}
.global-search input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.25); background: var(--input-bg); }

.search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); max-height: 70vh; overflow-y: auto; z-index: 50; padding: 6px;
}
.search-item { display: block; text-decoration: none; color: inherit; padding: 12px 14px; border-radius: var(--radius-sm); transition: background .12s; }
.search-item:hover { background: var(--bg); }
.search-item__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-item__name { font-weight: 600; }
.search-item__meta { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.search-item__reemp {
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
    font-size: .8rem; color: var(--muted);
}
.search-item__reemp b { color: var(--amber); }
.search-empty, .search-loading { padding: 18px; text-align: center; color: var(--muted); font-size: .9rem; }

.content { padding: 28px; flex: 1; }

/* ===================== FLASH ===================== */
.flash {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 28px 0; padding: 14px 18px;
    border-radius: var(--radius); font-size: .92rem; font-weight: 500;
    box-shadow: var(--shadow);
}
.flash i { font-size: 1.1rem; }
.flash__close { margin-left: auto; background: none; border: none; font-size: 1.3rem; line-height: 1; color: inherit; opacity: .6; }
.flash--success { background: rgba(22,163,74,.16); color: #6ee7a8; border: 1px solid rgba(22,163,74,.35); }
.flash--error   { background: rgba(220,38,38,.16); color: #fca5a5; border: 1px solid rgba(220,38,38,.35); }
.flash--info    { background: rgba(37,99,235,.16); color: #93c5fd; border: 1px solid rgba(37,99,235,.35); }

/* ===================== CARDS (dashboard) ===================== */
.cards-grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-card {
    display: flex; align-items: center; gap: 18px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; right: -20px; top: -20px;
    width: 90px; height: 90px; border-radius: 50%; opacity: .08; background: currentColor;
}
.stat-card__icon {
    display: grid; place-items: center; width: 56px; height: 56px;
    border-radius: 14px; font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.stat-card__value { font-size: 2rem; font-weight: 800; line-height: 1; display: block; }
.stat-card__label { color: var(--muted); font-size: .9rem; font-weight: 500; }
.stat-card--indigo { color: var(--indigo); } .stat-card--indigo .stat-card__icon { background: var(--indigo); }
.stat-card--green  { color: var(--green); }  .stat-card--green  .stat-card__icon { background: var(--green); }
.stat-card--amber  { color: var(--amber); }  .stat-card--amber  .stat-card__icon { background: var(--amber); }
.stat-card--rose   { color: var(--rose); }   .stat-card--rose   .stat-card__icon { background: var(--rose); }

.section-title { font-size: 1.05rem; font-weight: 700; margin: 32px 0 16px; }
.quick-actions__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.quick-action {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 26px 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    font-weight: 600; color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.quick-action i { font-size: 1.6rem; color: var(--indigo); }
.quick-action:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--indigo); }

/* ===================== TABLES ===================== */
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-card__head { padding: 16px 20px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.table-card__head strong { color: var(--text); }
.table-scroll { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table thead th {
    text-align: left; padding: 14px 18px; background: var(--surface-2);
    color: var(--muted); font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.cell-strong { font-weight: 600; }
.col-actions { width: 1%; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px !important; }

.pill {
    display: inline-block; padding: 4px 11px; border-radius: 999px;
    background: rgba(99,102,241,.18); color: #b3b9ff; font-size: .8rem; font-weight: 600;
}

.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-success { background: rgba(22,163,74,.18); color: #6ee7a8; }
.badge-danger  { background: rgba(220,38,38,.18); color: #fca5a5; }
.badge-warning { background: rgba(217,119,6,.18); color: #fcd34d; }
.badge-muted   { background: rgba(148,163,184,.15); color: #b8c0d4; }

/* botones de acción de fila */
.actions { display: flex; align-items: center; gap: 8px; }
.inline-form { display: inline; }
.btn-icon {
    display: grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
    color: var(--muted); font-size: .95rem; transition: all .15s;
}
.btn-icon:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-icon--green { color: var(--green); } .btn-icon--green:hover { background: var(--green); color:#fff; border-color: var(--green); }
.btn-icon--amber { color: var(--amber); } .btn-icon--amber:hover { background: var(--amber); color:#fff; border-color: var(--amber); }
.btn-icon--blue  { color: var(--blue); }  .btn-icon--blue:hover  { background: var(--blue);  color:#fff; border-color: var(--blue); }
.btn-icon--red   { color: var(--red, #dc2626); } .btn-icon--red:hover { background: var(--red, #dc2626); color:#fff; border-color: var(--red, #dc2626); }

.btn-mini { border: none; background: none; color: var(--muted); font-size: .85rem; }
.hint-inline { display: inline-grid; place-items: center; width: 36px; height: 36px; color: var(--muted); opacity: .55; }
.pw { font-family: monospace; letter-spacing: 1px; }

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-weight: 600; font-size: .92rem; transition: all .15s; white-space: nowrap;
}
.btn-sm { padding: 7px 13px; font-size: .85rem; }
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-d); box-shadow: 0 6px 16px rgba(79,70,229,.3); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; box-shadow: 0 6px 16px rgba(22,163,74,.3); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); border-color: var(--indigo); }
.btn-danger { background: var(--red, #dc2626); color: #fff; }
.btn-danger:hover { background: #b91c1c; box-shadow: 0 6px 16px rgba(220,38,38,.3); }
.btn-block { width: 100%; justify-content: center; }

/* ===================== FORMS ===================== */
.form-card {
    max-width: 560px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.form-card--narrow { max-width: 440px; }
.form-card--wide { max-width: 100%; margin-bottom: 20px; }
.rename-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.add-cuenta-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.add-cuenta-row .field { flex: 1; min-width: 150px; }
.add-cuenta-row .dur { min-width: 160px; }
.row-link { cursor: pointer; }
.row-link:hover { background: var(--bg); }
.form-card__title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.form-card__title i { color: var(--indigo); }
.form-card__desc { font-size: .88rem; color: var(--muted); margin-bottom: 22px; }
.field { display: block; margin-bottom: 20px; }
.field > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 8px; }
.field input, .field textarea, .field select {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .95rem; font-family: inherit;
    outline: none; transition: border .15s, box-shadow .15s; background: var(--input-bg); color: var(--text);
}
.field input::placeholder, .field textarea::placeholder { color: #5a6178; }
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.25);
}
.field textarea { resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.dur { display: flex; gap: 10px; }
.dur input { flex: 1; }
.dur select { flex: 0 0 130px; width: auto; }
.current-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: .88rem; margin-bottom: 18px;
}
.current-box i { color: var(--indigo); }
.hint { font-size: .85rem; color: var(--muted); margin: -8px 0 20px; line-height: 1.5; overflow-wrap: anywhere; }
.hint i { color: var(--indigo); margin-right: 7px; }
/* El código en línea (correo:password, etc.) debe poder cortarse en pantallas angostas. */
code { overflow-wrap: anywhere; word-break: break-word; }

/* ===================== MODAL ===================== */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15,17,32,.5); }
.modal__box {
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 26px; width: min(460px, 92vw);
}
.modal__title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin-bottom: 8px; }
.modal__title i { color: var(--amber); }
.modal__desc { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ===================== LOGIN ===================== */
.login-body {
    display: grid; place-items: center; min-height: 100vh; padding: 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0f1120 100%);
}
.login-card {
    width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow-lg); padding: 40px 34px;
}
.login-card__brand { text-align: center; margin-bottom: 26px; }
.login-card__brand h1 { font-size: 1.5rem; font-weight: 800; margin: 14px 0 4px; }
.login-card__brand p { color: var(--muted); font-size: .88rem; }
.login-form .field__input { position: relative; }
.login-form .field__input i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.login-form .field__input input { padding-left: 42px; }
.login-hint { text-align: center; margin-top: 20px; font-size: .82rem; color: var(--muted); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar.open ~ .sidebar-overlay { display: block; }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .global-search { width: auto; flex: 1; }
}

@media (max-width: 640px) {
    .content { padding: 18px; }
    .topbar { padding: 14px 18px; }
    .topbar__title { display: none; }
    .flash { margin: 16px 18px 0; }

    /* Tablas -> tarjetas apiladas en móvil */
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; padding: 6px; }
    .data-table tbody td { border: none; padding: 9px 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .data-table tbody td::before {
        content: attr(data-label); font-weight: 600; color: var(--muted);
        font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
    }
    .col-actions { width: auto; }
    .actions { justify-content: flex-end; }
}

/* ===================== TABS (form de cuentas) ===================== */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tabs .tab {
    padding: 10px 16px; border: none; background: none; cursor: pointer;
    font-weight: 600; font-size: .9rem; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--indigo); border-bottom-color: var(--indigo); }
.field small { font-weight: 500; color: var(--muted); }

/* ===================== REPORTE DE IMPORTACIÓN ===================== */
.import-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 18px; }
.import-grid--5 { grid-template-columns: repeat(5, 1fr); }
.import-stat {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 14px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg);
}
.import-stat b { font-size: 1.5rem; line-height: 1; }
.import-stat span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.import-stat--ok  { background: rgba(22,163,74,.15); border-color: rgba(22,163,74,.35); } .import-stat--ok  b { color: #6ee7a8; }
.import-stat--dup { background: rgba(217,119,6,.15); border-color: rgba(217,119,6,.35); } .import-stat--dup b { color: #fcd34d; }
.import-stat--rep { background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.28); } .import-stat--rep b { color: #c4cce0; }
.import-stat--bad { background: rgba(220,38,38,.15); border-color: rgba(220,38,38,.35); } .import-stat--bad b { color: #fca5a5; }

.import-detail { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; }
.import-detail summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.import-detail summary i { margin-right: 6px; color: var(--amber); }
.import-detail ul { margin: 10px 0 2px; padding-left: 20px; display: grid; gap: 5px; }
.import-detail li { font-size: .86rem; color: var(--text); }
.import-detail code { background: var(--bg); padding: 1px 6px; border-radius: 5px; font-size: .85em; }
.reemp-copy-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reemp-copy-bar .btn { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.reemp-copy-bar .btn:hover { background: rgba(99,102,241,.18); border-color: var(--indigo); box-shadow: 0 6px 16px rgba(79,70,229,.25); }
.reemp-copy-bar .btn i { color: #a5b4fc; }
.reemp-copy-bar .hist-count { color: var(--muted); font-size: .84rem; align-self: center; margin-left: 4px; }
.hist-select {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: .9rem;
}

@media (max-width: 560px) { .import-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===================== VENCIMIENTOS: secciones por urgencia ===================== */
/* Aviso del dashboard cuando hay cuentas vencidas sin renovar */
.alerta-venc {
    display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
    padding: 16px 20px; border-radius: var(--radius);
    background: rgba(220,38,38,.14); border: 1px solid rgba(220,38,38,.4);
    color: #fecaca; font-size: .93rem; text-decoration: none;
    transition: background .15s, transform .12s;
}
.alerta-venc:hover { background: rgba(220,38,38,.22); transform: translateY(-2px); }
.alerta-venc strong { color: #fff; }
.alerta-venc > i:first-child { font-size: 1.2rem; }
.alerta-venc > i:last-child { margin-left: auto; }

.cards-grid--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 24px; }
.venc-sec { margin-bottom: 30px; }
.venc-sec__title {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 1rem; font-weight: 700; margin: 0 0 6px; padding-left: 12px;
    border-left: 4px solid var(--border);
}
.venc-sec__count {
    background: var(--surface-2); color: var(--text); border-radius: 999px;
    padding: 2px 10px; font-size: .8rem; font-weight: 700;
}
.venc-sec__hint { color: var(--muted); font-size: .86rem; margin: 0 0 14px; padding-left: 16px; }
.venc-sec--danger .venc-sec__title { border-left-color: var(--red); color: #fca5a5; }
.venc-sec--danger .venc-sec__count { background: rgba(220,38,38,.2); color: #fca5a5; }
.venc-sec--warn   .venc-sec__title { border-left-color: var(--amber); color: #fcd34d; }
.venc-sec--warn   .venc-sec__count { background: rgba(217,119,6,.2); color: #fcd34d; }
.venc-sec--info   .venc-sec__title { border-left-color: var(--indigo); }
.venc-sec .plat-blocks { margin-top: 12px; }
.venc-fecha { display: block; color: var(--muted); font-size: .76rem; margin-top: 4px; }

/* ===================== BLOQUES POR PLATAFORMA ===================== */
/* Resumen de totales por plataforma */
.plat-summary {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px; margin-bottom: 24px;
}
.plat-summary__card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
}
.plat-summary__name { font-size: .9rem; font-weight: 600; color: var(--text); }
.plat-summary__total { font-size: 1.7rem; font-weight: 700; line-height: 1; color: var(--indigo); }
.plat-summary__meta { font-size: .78rem; color: var(--muted); }
.plat-summary__card--link { text-decoration: none; color: inherit; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.plat-summary__card--link:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--indigo); }
.plat-summary__cta { margin-top: 6px; font-size: .8rem; font-weight: 600; color: var(--indigo); display: inline-flex; align-items: center; gap: 6px; }
.plat-summary__card--link:hover .plat-summary__cta { color: var(--indigo-d); }

/* Barra de herramientas: buscador + expandir/contraer */
.plat-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.plat-search { position: relative; flex: 1; min-width: 220px; }
.plat-search input {
    width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .92rem; background: var(--surface); color: var(--text);
}
.plat-search input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.plat-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* Cada plataforma es un bloque plegable (details/summary) */
.plat-blocks { display: grid; gap: 16px; }
.plat-block > summary { list-style: none; cursor: pointer; }
.plat-block > summary::-webkit-details-marker { display: none; }
.plat-block__head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px;
}
.plat-block[open] .plat-block__head { border-bottom: 1px solid var(--border); }
.plat-block__head:hover { background: var(--surface-2); }
.plat-block__head .pill { font-size: .9rem; }
.plat-block__count { color: var(--muted); font-size: .85rem; }
.plat-block__count strong { color: var(--text); }
.plat-block__filtered { color: var(--indigo); font-size: .82rem; font-weight: 600; }
.plat-block__chevron { margin-left: auto; color: var(--muted); transition: transform .2s; }
.plat-block[open] .plat-block__chevron { transform: rotate(180deg); }

/* Scroll interno cuando la lista es larga; cabecera de columnas fija */
.plat-block__scroll { max-height: 60vh; overflow-y: auto; }
.plat-block__scroll thead th { position: sticky; top: 0; z-index: 1; }
.plat-empty { text-align: center; color: var(--muted); padding: 30px; }

/* Renombrado en línea (catálogo de plataformas) */
.inline-rename { display: flex; align-items: center; gap: 8px; margin: 0; }
.inline-rename input {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .9rem; min-width: 160px; background: var(--surface); color: var(--text);
}
.inline-rename input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* Editar vencimiento / eliminar cuenta desde la ficha del cliente */
.cuenta-fecha { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.cuenta-fecha input[type="date"] {
    padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--input-bg); color: var(--text); font-family: inherit; font-size: .85rem;
    color-scheme: dark;
}
.cuenta-fecha input[type="date"]:focus {
    outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.25);
}

/* ===================== ASIGNAR / REEMPLAZO ===================== */
.btn-secondary { background: rgba(99,102,241,.18); color: #b3b9ff; border-color: rgba(99,102,241,.35); }
.btn-secondary:hover { background: rgba(99,102,241,.28); }

/* Cabecera de la ficha del cliente (solo lectura) */
.ficha-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ficha-head__name { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; }
.ficha-head__name i { color: var(--indigo); }

/* Panel de asignación (modal ancho con lista de checkboxes) */
.modal__box--wide { width: min(560px, 94vw); }
.check-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
.check-count { font-size: .82rem; color: var(--muted); font-weight: 600; }
.check-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.check-row:hover { background: var(--bg); }
.check-row input { width: 16px; height: 16px; accent-color: var(--indigo); }
.check-row--all { font-weight: 600; }

/* Reemplazo automático: dos columnas (caídos / disponibles) */
.reemp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.reemp-stock { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.reemp-stock__head {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .85rem;
}
.reemp-stock__head i { color: var(--indigo); }
.reemp-stock__head .pill { margin-left: auto; }
.reemp-stock__list { max-height: 260px; overflow-y: auto; padding: 8px; }
.reemp-stock__item {
    padding: 7px 10px; border-radius: 8px; font-size: .85rem;
    font-family: ui-monospace, monospace; overflow-wrap: anywhere;
}
.reemp-stock__item:nth-child(odd) { background: var(--bg); }
@media (max-width: 640px) { .reemp-cols { grid-template-columns: 1fr; } }



/* ===================== ACCIONES MASIVAS POR CLIENTE ===================== */
/* Barra de acciones masivas por plataforma */


.bulk-actions {
    padding: 10px 15px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Etiqueta para acciones de plataforma */
.bulk-actions__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    margin-right: 5px;
}

.bulk-actions__label i {
    color: var(--indigo);
}

/* Hacer los botones de cliente más prominentes */
.cliente-block__acciones .btn {
    font-size: .9rem;
    padding: 10px 16px;
}

.cliente-block__acciones .btn i {
    font-size: 1rem;
}

/* Bloque individual de cliente dentro de una plataforma */
.cliente-block {
    margin: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}

.cliente-block__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.cliente-block__info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cliente-block__info i {
    color: var(--indigo);
    font-size: 1rem;
}

.cliente-block__nombre {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    font-size: .95rem;
    transition: color .15s;
}

.cliente-block__nombre:hover {
    color: var(--indigo);
}

.cliente-block__acciones {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Celda de correo con botón de copiar */
.correo-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.correo-text {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Botón icono para copiar correo */
.btn-icon--copiar {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
    flex-shrink: 0;
}

.btn-icon--copiar:hover {
    color: var(--indigo);
    background: rgba(99,102,241,.15);
}

/* Lista de clientes en el resumen de plataformas */
.clientes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cliente-tag {
    background: rgba(99,102,241,.15);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    text-decoration: none;
    color: #b3b9ff;
    transition: all 0.2s;
    font-weight: 500;
}

.cliente-tag:hover {
    background: var(--indigo);
    color: #fff;
}

/* Badge informativo */
.badge-info {
    background: rgba(37,99,235,.18);
    color: #93c5fd;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* Selector de plataforma en toolbar */
.plat-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: .92rem;
    font-family: inherit;
    min-width: 200px;
    cursor: pointer;
    transition: border .15s, box-shadow .15s;
}

.plat-select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(79,70,229,.25);
}

.plat-select option {
    background: var(--surface);
    color: var(--text);
}

/* Hint inline para valores vacíos */
.hint-inline {
    color: var(--muted);
    font-size: 14px;
    opacity: .6;
}

/* Animaciones para toast notifications */
@keyframes slideIn {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

@keyframes slideOut {
    from { 
        transform: translateX(0); 
        opacity: 1; 
    }
    to { 
        transform: translateX(100%); 
        opacity: 0; 
    }
}

/* Responsive para bloques de cliente */
@media (max-width: 640px) {
    .cliente-block {
        margin: 8px;
    }
    
    .cliente-block__head {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cliente-block__acciones {
        width: 100%;
        justify-content: flex-start;
    }
    
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bulk-actions .btn {
        justify-content: center;
    }
    
    .plat-select {
        width: 100%;
        min-width: auto;
    }
}