/* ============================================================
   Systema G · PDC 2027 — Sistema de diseño "Moderno Limpio"
   Paleta: azul oscuro + resaltado ámbar
   ============================================================ */
:root {
    --bg:        #0b1220;
    --bg-soft:   #0e1729;
    --panel:     #111a2e;
    --panel-2:   #16223c;
    --line:      #22304f;
    --line-soft: #1a2740;
    --txt:       #e7eefc;
    --muted:     #8fa3c8;
    --muted-2:   #64789c;
    --accent:    #f5a524;
    --accent-d:  #ef7a1a;
    --blue:      #3b82f6;
    --green:     #22c55e;
    --red:       #ef4444;
    --purple:    #a855f7;
    --cyan:      #06b6d4;
    --radius:    14px;
    --radius-sm: 10px;
    --shadow:    0 10px 30px rgba(0,0,0,.35);
    --shadow-lg: 0 24px 70px rgba(0,0,0,.5);
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--txt);
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--panel) 0%, var(--bg-soft) 100%);
    border-right: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex; align-items: center; gap: 11px;
    padding: 20px 20px 16px;
}
.brand .mark {
    width: 36px; height: 36px; border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #1b1200; font-size: 14px;
    box-shadow: 0 6px 18px rgba(245,165,36,.35);
}
.brand .name { font-weight: 700; letter-spacing: .2px; }
.brand .name small { display: block; font-weight: 400; color: var(--muted-2); font-size: 11px; }

.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav .group { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--muted); margin-bottom: 3px; transition: .15s;
}
.nav a:hover { background: var(--panel-2); color: var(--txt); }
.nav a.active { background: rgba(245,165,36,.12); color: var(--accent); font-weight: 600; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav a .badge { margin-left: auto; background: var(--accent); color: #1b1200; border-radius: 20px; padding: 1px 8px; font-size: 11px; font-weight: 700; }

.sidebar-license {
    margin: 0 12px 10px;
    padding: 12px 12px 10px;
    border-radius: var(--radius-sm);
    background: rgba(245,165,36,.08);
    border: 1px solid rgba(245,165,36,.22);
}
.sidebar-license-hello {
    font-size: 13px;
    color: var(--txt);
    margin-bottom: 10px;
    line-height: 1.35;
}
.sidebar-license-hello b { color: var(--accent); }
.sidebar-license-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.sidebar-license-lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-2);
}
.sidebar-license-val {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
}
.sidebar-license-val.is-empty { color: #e85d5d; }
.sidebar-license-val.is-inf { color: #6dcc8a; font-size: 13px; }
.sidebar-license-hint {
    font-size: 11px;
    color: var(--muted-2);
    margin-top: 4px;
    line-height: 1.35;
}
.sidebar-license-hint.is-warn { color: #e8a05d; }

.auth-blocked { text-align: center; padding: 8px 4px 4px; }
.auth-blocked-ico { font-size: 36px; margin-bottom: 10px; }
.auth-blocked h1 { margin: 0 0 12px; font-size: 22px; }
.auth-blocked p { margin: 0 0 10px; line-height: 1.45; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 64px; display: flex; align-items: center; gap: 16px;
    padding: 0 24px; border-bottom: 1px solid var(--line-soft);
    background: rgba(11,18,32,.75); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .tenant-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--panel-2); border: 1px solid var(--line);
    padding: 6px 12px; border-radius: 20px; color: var(--muted); font-size: 12px;
}
.topbar .tenant-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .avatar {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-chip .who { line-height: 1.2; }
.user-chip .who b { font-size: 13px; }
.user-chip .who span { display: block; color: var(--muted-2); font-size: 11px; }

.content { padding: 24px; flex: 1; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }

/* ---------------- Cards ---------------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 720px)  { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 18px;
}

/* ---------------- Servicios · tarjetas ---------------- */
.svc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.svc-card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}
.svc-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--accent);
    opacity: .85;
}
.svc-card.is-inactive::before { background: var(--muted-2); opacity: .5; }
.svc-card.is-inactive { opacity: .72; }
.svc-card:hover {
    border-color: var(--line);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.svc-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-left: 6px; }
.svc-card-title { min-width: 0; flex: 1; }
.svc-card-title h3 {
    margin: 0 0 6px; font-size: 15px; font-weight: 700; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.svc-card-price {
    font-size: 15px; font-weight: 700; color: var(--accent);
    white-space: nowrap; letter-spacing: .01em;
}
.svc-meta {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    padding: 10px; margin-left: 6px;
    background: var(--bg-soft); border-radius: var(--radius-sm);
    border: 1px solid var(--line-soft);
}
.svc-meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.svc-meta-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted-2); font-weight: 600;
}
.svc-meta-val { font-size: 13px; font-weight: 600; color: var(--txt); }
.svc-tags {
    display: flex; flex-wrap: wrap; gap: 6px; padding-left: 6px; min-height: 24px;
}
.svc-tag {
    display: inline-flex; align-items: center;
    padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.svc-tag.emp { background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.22); }
.svc-tag.prov { background: rgba(245,165,36,.12); color: #fcd34d; border: 1px solid rgba(245,165,36,.22); }
.svc-tag.muted { background: transparent; color: var(--muted-2); border: 1px dashed var(--line); font-weight: 500; }
.svc-card-actions {
    display: flex; gap: 8px; padding: 12px 0 0 6px;
    border-top: 1px solid var(--line-soft); margin-top: 2px;
}
.svc-card-actions .btn { flex: 1; justify-content: center; }
.card.pad-lg { padding: 24px; }
.card .card-title { font-size: 13px; color: var(--muted); margin: 0 0 4px; }

.stat { position: relative; overflow: hidden; }
.stat .value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .delta { font-size: 12px; color: var(--muted-2); }
.stat .glyph {
    position: absolute; right: 14px; top: 14px; width: 40px; height: 40px;
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; background: var(--panel-2); border: 1px solid var(--line);
}
.stat.amber .glyph { color: var(--accent); }
.stat.blue .glyph  { color: var(--blue); }
.stat.green .glyph { color: var(--green); }
.stat.red .glyph   { color: var(--red); }
.stat.purple .glyph{ color: var(--purple); }

.stat.amber::after, .stat.blue::after, .stat.green::after, .stat.red::after, .stat.purple::after {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.stat.amber::after  { background: var(--accent); }
.stat.blue::after   { background: var(--blue); }
.stat.green::after  { background: var(--green); }
.stat.red::after    { background: var(--red); }
.stat.purple::after { background: var(--purple); }

/* ---------------- Pantallas compartidas + Bonificados tab ---------------- */
.pantallas-card { display: flex; flex-direction: column; justify-content: center; min-height: 110px; transition: border-color .15s, transform .15s; }
.pantallas-card:hover { border-color: rgba(245,165,36,.45); transform: translateY(-1px); }
.pantallas-card .glyph { color: var(--accent); }
.pantallas-label {
    text-align: center; margin-top: 8px;
    font-size: 10px; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: rgba(245,165,36,.85);
}

.shared-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.shared-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
}
.shared-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.shared-card-eyebrow {
    font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em;
    color: rgba(245,165,36,.85);
}
.shared-card-title {
    margin: 3px 0 0; font-size: 14px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .02em; line-height: 1.2;
}
.shared-creds { display: grid; gap: 6px; }
.shared-cred {
    background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.shared-cred span {
    display: block; font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted-2); margin-bottom: 2px;
}
.shared-cred b { font-size: 13px; word-break: break-all; }
.shared-clients-label {
    font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
    color: var(--muted-2); border-top: 1px solid var(--line); padding-top: 8px;
}
.shared-clients { display: flex; flex-direction: column; gap: 6px; }
.shared-client {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: rgba(0,0,0,.16); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.shared-client .min-w-0 { min-width: 0; flex: 1; }
.shared-client.is-expired {
    background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3);
}
.shared-client-name { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shared-client-meta { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: ui-monospace, Consolas, monospace; }
.shared-client.is-expired .shared-client-meta { color: #fca5a5; }
.tpl-ico.wa { color: #25d366; }
.tpl-ico.wa:hover { background: #25d366; color: #fff; border-color: #25d366; }
.shared-risk { border-color: rgba(239,68,68,.3); }
.shared-risk-title {
    font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #fca5a5;
}
.shared-risk-title i { margin-right: 6px; }
.shared-risk-list { display: flex; flex-direction: column; gap: 6px; }
.shared-risk-item {
    display: block; text-decoration: none; color: inherit;
    background: rgba(0,0,0,.18); border: 1px solid rgba(239,68,68,.22);
    border-radius: 10px; padding: 10px 12px;
}
.shared-risk-item:hover { border-color: rgba(239,68,68,.45); }
.shared-risk-item > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.bonif-rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    font-size: 11px; font-weight: 800;
    background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-soft);
}
.bonif-rank.has-award {
    background: var(--accent); color: #1b1200; border-color: #fcd34d;
}
.bonif-bar {
    width: 100%; height: 6px; border-radius: 99px;
    background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.05);
    overflow: hidden;
}
.bonif-bar i {
    display: block; height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, #ef7a1a, #f5a524);
    box-shadow: 0 0 8px rgba(245,165,36,.4);
}
tr.bonif-ready td { background: rgba(245,165,36,.04); }
tr.bonif-cola td { opacity: .72; }
tr.bonif-cola:hover td { opacity: 1; }

.pager-wrap { display: flex; flex-direction: column; gap: 10px; }
.pager {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; padding: 4px 2px 0;
}
.pager-info { font-size: 12px; }
.pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-pages { display: inline-flex; gap: 4px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 15px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--panel-2); color: var(--txt);
    cursor: pointer; font-weight: 600; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--blue); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #1b1200; border: none; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary.outline {
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.35);
    color: #93c5fd;
}
.btn.primary.outline:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.blue { background: var(--blue); border: none; color: #fff; }
.btn.ghost { background: transparent; }
.btn.success { background: #059669; border: none; color: #fff; }
.btn.success:hover { filter: brightness(1.06); }
.btn.danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); color: #fecaca; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--panel-2); color: var(--txt); outline: none;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line-soft); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
table.data th { color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
table.data tr:hover td { background: rgba(59,130,246,.05); }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.actions .dash-wa { width: 28px; height: 28px; font-size: 14px; vertical-align: middle; }
table.data td.actions .btn { vertical-align: middle; }
table.data th.text-center, table.data td.text-center { text-align: center; }
.inline { display: inline; margin: 0; }

/* Dashboard client table · compacto / estilo panel */
.dash-table {
    table-layout: fixed;
    width: 100%;
}
.dash-table th,
.dash-table td {
    padding: 7px 8px;
    vertical-align: middle;
}
.dash-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.dash-table th:nth-child(1),
.dash-table td:nth-child(1) { width: 22%; }
.dash-table th:nth-child(2),
.dash-table td:nth-child(2) { width: 14%; }
.dash-table th:nth-child(3),
.dash-table td:nth-child(3) { width: 12%; }
.dash-table th:nth-child(4),
.dash-table td:nth-child(4) { width: 10%; }
.dash-table th:nth-child(5),
.dash-table td:nth-child(5) { width: 10%; }
.dash-table th:nth-child(6),
.dash-table td:nth-child(6) { width: 9%; }
.dash-table th:nth-child(7),
.dash-table td:nth-child(7) { width: 23%; }
.dash-table td.col-fit { white-space: nowrap; }
.dash-client {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
}
.dash-client .client-name {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 0 1 auto;
}
.dash-wa {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 20px; height: 20px; padding: 0; border: none; border-radius: 6px;
    background: rgba(34,197,94,.12); color: #4ade80; cursor: pointer; font-size: 11px;
}
.dash-wa:hover { background: rgba(34,197,94,.22); }
/* Ya se envió la plantilla “¿va a renovar?” (individual o masivo) */
.dash-wa.is-asked,
button.dash-wa.is-asked,
.ico-btn.tone-wa.is-asked,
table.data .dash-wa.is-asked {
    background: rgba(239,68,68,.18) !important;
    color: #f87171 !important;
    border-color: rgba(239,68,68,.4) !important;
}
.dash-wa.is-asked:hover,
button.dash-wa.is-asked:hover,
.ico-btn.tone-wa.is-asked:hover,
table.data .dash-wa.is-asked:hover {
    background: rgba(239,68,68,.28) !important;
    color: #fca5a5 !important;
}
.svc-bubble {
    display: inline-flex; align-items: center; flex-shrink: 1;
    padding: 2px 7px; border-radius: 6px; border: 1px solid;
    font-size: 10px; font-weight: 700; letter-spacing: .02em;
    white-space: nowrap; max-width: 90px;
    overflow: hidden; text-overflow: ellipsis;
}
.chip {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: Consolas, 'Courier New', monospace;
    background: var(--bg-soft);
    color: var(--txt);
    border: 1px solid var(--line-soft);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    box-sizing: border-box;
}
.chip-muted { color: var(--muted); }
.chip-cred {
    color: var(--accent);
    border-color: rgba(245,165,36,.28);
    background: rgba(245,165,36,.08);
    font-size: 11px;
}
.chip-cred.hot {
    background: rgba(245,165,36,.2);
    border-color: rgba(245,165,36,.45);
    color: #fcd34d;
}
.dash-cred { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dash-saldo-pos { font-size: 10px; font-weight: 600; color: var(--muted); }
.dash-saldo-neg { font-size: 10px; font-weight: 700; color: #fca5a5; }
.dash-date { font-size: 12px; font-weight: 600; color: var(--muted); }

.act-row { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.ico-btn {
    width: 28px; height: 28px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-soft);
    background: var(--panel-2);
    color: var(--muted);
    cursor: pointer; transition: .15s; font-size: 11px;
    text-decoration: none; flex-shrink: 0; padding: 0;
    position: relative;
}
.ico-btn:hover {
    color: var(--txt);
    border-color: var(--line);
    background: var(--bg-soft);
}
.ico-btn.accent { color: var(--accent); border-color: rgba(245,165,36,.3); background: rgba(245,165,36,.08); }
.ico-btn.accent:hover { background: rgba(245,165,36,.18); color: #fcd34d; }
.ico-btn.danger { color: #fca5a5; border-color: rgba(239,68,68,.28); background: rgba(239,68,68,.08); }
.ico-btn.danger:hover { background: rgba(239,68,68,.2); color: #fecaca; }
.ico-btn.pulse { animation: ico-pulse 1.4s ease-in-out infinite; }
.ico-btn.has-kin {
    color: #c4b5fd;
    border-color: rgba(167,139,250,.4);
    background: rgba(139,92,246,.12);
}
.ico-btn .ico-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 8px;
    background: #7c3aed;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
}
@keyframes ico-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.3); }
    50% { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

/* Dashboard split + últimos renovados */
.dash-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 14px;
    align-items: start;
}
.dash-split-main { min-width: 0; overflow-x: hidden; }
.dash-side-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow: auto;
}
.dash-renew-side {
    padding: 14px;
}
.dash-renew-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; margin-bottom: 12px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}
.dash-renew-list { display: flex; flex-direction: column; gap: 8px; }
.renew-card {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; text-align: left; cursor: pointer;
    padding: 8px 10px; border-radius: 10px;
    background: var(--bg-soft); border: 1px solid var(--line-soft);
    color: inherit; font: inherit; transition: .15s;
}
.renew-card:hover { border-color: var(--line); background: var(--panel-2); }
.renew-card-left { min-width: 0; flex: 1; }
.renew-name-row {
    display: flex; align-items: center; gap: 6px; min-width: 0;
}
.renew-name {
    font-size: 13px; font-weight: 700; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.renew-svc {
    font-size: 11px; color: var(--muted); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.renew-debt { font-size: 10px; font-weight: 700; color: #fca5a5; margin-top: 2px; }
.renew-cred {
    flex-shrink: 0;
    font-size: 9px; font-weight: 800; color: var(--accent);
    background: rgba(245,165,36,.12); border: 1px solid rgba(245,165,36,.28);
    padding: 1px 6px; border-radius: 999px; white-space: nowrap;
}
.dash-credit-side {
    border-color: rgba(245,165,36,.28);
    box-shadow: inset 0 0 0 1px rgba(245,165,36,.06);
}
.renew-card-right { text-align: right; flex-shrink: 0; }
.renew-date { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.renew-label {
    font-size: 9px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted-2); font-weight: 700; margin-top: 2px;
}
.renew-card.tone-amber { border-color: rgba(245,165,36,.35); }
.renew-card.tone-amber .renew-date { color: var(--accent); }
.renew-card.tone-blue { border-color: rgba(59,130,246,.35); }
.renew-card.tone-blue .renew-date { color: #93c5fd; }
.renew-card.tone-green { border-color: rgba(34,197,94,.35); }
.renew-card.tone-green .renew-date { color: #86efac; }
.renew-card.tone-red { border-color: rgba(239,68,68,.35); }
.renew-card.tone-red .renew-date { color: #fca5a5; }
.renew-card.tone-cyan { border-color: rgba(6,182,212,.35); }
.renew-card.tone-cyan .renew-date { color: #67e8f9; }
.renew-card.tone-muted { border-color: var(--line); }
.renew-card.tone-muted .renew-date { color: var(--muted); }

@media (max-width: 1100px) {
    .dash-split { grid-template-columns: 1fr; }
    .dash-side-stack { position: static; max-height: none; }
}

/* Modal saldo */
.saldo-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.saldo-mode-btn {
    padding: 9px 8px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel-2); color: var(--muted); cursor: pointer;
    font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
    transition: .15s;
}
.saldo-mode-btn:hover { color: var(--txt); border-color: var(--line); }
.saldo-mode-btn.active {
    color: var(--accent); border-color: rgba(245,165,36,.45);
    background: rgba(245,165,36,.1);
}
.saldo-mode-btn[data-saldo-mode="pago"].active {
    color: #86efac; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1);
}
.saldo-mode-btn[data-saldo-mode="deuda"].active {
    color: #fca5a5; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.1);
}
#ren-modes { grid-template-columns: 1fr 1fr; }
#ren-modes .saldo-mode-btn[data-ren-mode="credito"].active {
    color: var(--accent); border-color: rgba(245,165,36,.45); background: rgba(245,165,36,.12);
}
#ren-modes .saldo-mode-btn[data-ren-mode="pago"].active {
    color: #86efac; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1);
}
.saldo-box {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border-radius: 12px;
    background: var(--bg-soft); border: 1px solid var(--line);
}
.saldo-box .muted {
    font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.saldo-box .big { font-size: 22px; font-weight: 800; color: var(--txt); }
.saldo-monto-input {
    text-align: center; font-size: 20px; font-weight: 800; padding: 12px 14px;
}
.ren-pay-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ren-hint-warn { color: #f59e0b; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; }

/* ---------------- Badges / pills ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.green { background: rgba(34,197,94,.14); color: #86efac; }
.pill.red { background: rgba(239,68,68,.14); color: #fca5a5; }
.pill.amber { background: rgba(245,165,36,.14); color: #fcd34d; }
.pill.blue { background: rgba(59,130,246,.14); color: #93c5fd; }
.pill.gray { background: rgba(143,163,200,.14); color: var(--muted); }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
    background: transparent; border: none; color: var(--muted); padding: 10px 14px;
    cursor: pointer; font-weight: 600; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button.tab-hit {
    color: var(--txt);
    border-bottom-color: rgba(245,165,36,.55);
}
.tabs button.tab-hit-multi {
    background: rgba(245,165,36,.1);
    border-radius: 8px 8px 0 0;
    box-shadow: inset 0 -2px 0 var(--accent);
}
.tabs button.tab-hit-multi.active {
    background: rgba(245,165,36,.16);
}
.tab-hit-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 6px; margin-left: 4px;
    border-radius: 999px; font-size: 11px; font-weight: 800;
    background: var(--accent); color: #1b1200; vertical-align: middle;
}
.tabs.is-filtering button.tab-empty { opacity: .35; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------------- Alerts ---------------- */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert.success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.35); color: #bbf7d0; }
.alert.error   { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fecaca; }
.alert.info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.35); color: #bfdbfe; }
.alert.warning { background: rgba(245,165,36,.12); border: 1px solid rgba(245,165,36,.4); color: #fde68a; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(3,7,16,.7); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal .modal-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); gap: 12px; }
.modal .modal-head h3 { margin: 0; font-size: 16px; }
.modal .modal-head .x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal .modal-body { padding: 20px; }
.modal .modal-foot { padding: 16px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; }
.modal.modal-lg { max-width: 860px; }
.modal.modal-xl { max-width: 920px; }
.modal.modal-new-client { max-width: 640px; }
.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    align-items: start;
}
.form-row-3 .field { margin-bottom: 0; }
.form-row-acceso {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, .7fr) minmax(0, .55fr);
    gap: 8px 8px;
    align-items: start;
}
.form-row-acceso .field { margin-bottom: 0; }
.form-row-acceso .field-perfil,
.form-row-acceso .field-pin { max-width: 100%; }
.form-row-servicio {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}
.form-row-servicio .field {
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
}
.form-row-servicio .field-catalogo { flex: 1 1 130px; min-width: 110px; }
.form-row-servicio .field-dias { flex: 0 0 4.8rem; width: 4.8rem; }
.form-row-servicio .field-precio { flex: 0 0 7.2rem; width: 7.2rem; }
.form-row-servicio .field-vencimiento { flex: 0 0 8.6rem; width: 8.6rem; }
.form-row-servicio .field-dias input,
.form-row-servicio .field-precio input,
.form-row-servicio .field-vencimiento input {
    width: 100%;
    max-width: 100%;
}
@media (max-width: 640px) {
    .form-row-servicio .field-dias,
    .form-row-servicio .field-precio,
    .form-row-servicio .field-vencimiento { flex: 1 1 5rem; width: auto; }
}
.input-sm,
.modal.modal-compact .input.input-sm,
.modal.modal-compact select.input.input-sm {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 7px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 640px) {
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .form-row-acceso { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .form-row-3 { grid-template-columns: 1fr; }
    .form-row-acceso { grid-template-columns: 1fr; }
}
.modal.modal-compact {
    max-width: 720px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal.modal-compact.modal-xl { max-width: 920px; }
.modal.modal-compact.modal-new-client { max-width: 640px; }
.modal.modal-compact .modal-head { padding: 12px 16px; flex-shrink: 0; }
.modal.modal-compact .modal-head h3 { font-size: 15px; }
.modal.modal-compact .modal-body {
    padding: 12px 16px;
    overflow-y: auto;
    flex: 1;
}
.modal.modal-compact .modal-foot { padding: 10px 16px; flex-shrink: 0; }
.modal.modal-compact .field { margin-bottom: 8px; }
.modal.modal-compact .field label { font-size: 11px; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.modal.modal-compact .input,
.modal.modal-compact select.input {
    padding: 7px 10px; font-size: 13px; border-radius: 8px;
}
.modal.modal-compact .form-grid { gap: 8px 10px; }
.modal.modal-compact .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.modal.modal-compact .alert-box { padding: 8px 12px; margin-top: 8px !important; }
.modal.modal-compact .section-label { margin-bottom: 6px; font-size: 10px; }
.modal.modal-compact .btn.sm { padding: 4px 8px; font-size: 11px; }
.modal.modal-compact .mt-2 { margin-top: 8px !important; }
.modal.modal-compact .mt-3 { margin-top: 10px !important; }
.modal.modal-compact .mb-2 { margin-bottom: 8px !important; }
.modal.modal-compact .check-row {
    display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
    padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px;
    background: var(--bg-soft); margin-bottom: 6px;
}
.modal.modal-compact .check-row b { font-size: 12px; }
.modal.modal-compact .check-row .hint { font-size: 10px; color: var(--muted-2); margin-top: 2px; font-weight: 400; }
.modal.modal-compact .variant-row { margin-bottom: 6px !important; gap: 6px; }
.modal.modal-compact .variant-row .input { padding: 6px 8px; font-size: 12px; }
.modal.modal-compact .switch { width: 36px; height: 20px; }
.modal.modal-compact .switch .slider:before { height: 14px; width: 14px; left: 3px; bottom: 3px; }
.modal.modal-compact .switch input:checked + .slider:before { transform: translateX(16px); }
@media (max-width: 720px) {
    .modal.modal-compact .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
.modal-split { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; }
@media (max-width: 720px) { .modal-split { grid-template-columns: 1fr; } }
.ticket-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}
.ticket-stat {
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
}
.ticket-stat b { display: block; margin-top: 2px; font-size: 15px; color: var(--txt); }
.ticket-lista {
    max-height: 320px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ticket-card {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: rgba(255,255,255,.02);
}
.ticket-card.is-activo { border-color: rgba(34,197,94,.35); }
.ticket-card.is-proximo { border-color: rgba(245,165,36,.4); }
.ticket-card.is-vencido { border-color: rgba(239,68,68,.4); }
.ticket-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ticket-card-pay { margin-top: 8px; }
.ticket-card-pay .btn { width: 100%; justify-content: center; }
@media (max-width: 720px) {
    .ticket-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#kin-stats.ticket-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kin-hint { font-size: 12px; line-height: 1.4; margin: 0 0 12px; }
.kin-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}
.kin-card {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--panel-2);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.kin-card.is-esta { border-color: rgba(167,139,250,.45); }
.kin-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.kin-card-title { min-width: 0; }
.kin-card-top b { font-size: 14px; word-break: break-word; }
.kin-card-meta { font-size: 12px; color: var(--muted); }
.kin-card-pills { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; flex-shrink: 0; }
.kin-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.kin-card-saldo { font-size: 12px; font-weight: 700; color: var(--muted); }
.kin-card-saldo.is-debt { color: #fca5a5; }
.kin-card-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.kin-buscar-res {
    margin-top: 6px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: var(--panel);
    max-height: 220px;
    overflow: auto;
}
.kin-buscar-empty { padding: 8px 10px; }
.kin-buscar-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: transparent;
    color: var(--txt);
    text-align: left;
}
.kin-buscar-item:last-child { border-bottom: 0; }
.kin-buscar-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kin-buscar-info b { font-size: 13px; }
.kin-buscar-item small { color: var(--muted); }
.kin-buscar-item .btn { flex-shrink: 0; }

.preview-box {
    min-height: 220px; background: var(--bg-soft); border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm); padding: 14px; white-space: pre-wrap; line-height: 1.45;
}
.history-list { max-height: 160px; overflow: auto; font-size: 12px; }
.history-item { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.stat-box {
    text-align: center; padding: 16px; border-radius: var(--radius-sm);
    background: var(--bg-soft); border: 1px solid var(--line-soft);
}
.stat-box .big { font-size: 28px; font-weight: 800; margin-top: 4px; }
.stat-box.amber .big { color: var(--accent); }
.stat-box.blue .big { color: var(--cyan); }
.stat-box.purple .big { color: var(--purple); }
.stat-box.green .big { color: var(--green); }
.grid.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    margin-bottom: 14px; color: var(--muted);
}
.section-label.blue { color: var(--blue); }
.section-label.amber { color: var(--accent); }
.section-label.green { color: var(--green); }
.section-label.gray { color: var(--muted); }
.input-prefix { position: relative; }
.input-prefix > span {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--muted-2); font-weight: 700; font-size: 12px; pointer-events: none;
}
.input-prefix .input { padding-left: 28px; }
.alert-box {
    background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.25);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; inset: 0; background: #334155; border-radius: 999px; transition: .2s;
}
.switch .slider:before {
    content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.empresa-row { align-items: center; }
@media (max-width: 860px) {
    .grid.cols-2 { grid-template-columns: 1fr; }
}
.btn.danger { background: rgba(239,68,68,.15); color: #fecaca; border: 1px solid rgba(239,68,68,.35); }
.btn.active-mode { border-color: var(--accent); color: var(--accent); background: rgba(245,165,36,.12); }
a.client-name { color: var(--txt); font-weight: 700; }
a.client-name:hover { color: var(--accent); }
.btn.sm { padding: 6px 9px; font-size: 12px; }

/* ---------------- Auth ---------------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: radial-gradient(1200px 600px at 15% -10%, #16233d 0%, var(--bg) 60%);
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
    border-radius: 20px; padding: 34px; box-shadow: var(--shadow-lg);
}
.auth-card .brand { padding: 0 0 6px; }
.auth-card h1 { font-size: 20px; margin: 10px 0 4px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.mobile-credential-remember[hidden],
.mobile-credential-note[hidden] { display: none !important; }
.mobile-credential-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 5px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}
.mobile-credential-remember input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}
.mobile-credential-note {
    margin: 0 0 14px 24px;
    color: var(--muted-2);
    font-size: 11px;
    line-height: 1.4;
}
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.auth-skip { margin-top: 10px; }
.auth-card .btn.ghost { border: 1px solid var(--line); color: var(--muted); }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted-2); font-size: 13px; }
.auth-foot a { color: var(--blue); }

/* ---------------- Notificaciones ---------------- */
.notif-card { padding: 0; overflow: hidden; }
.notif-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.15);
}
.notif-title { margin: 0; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; }
.notif-sub { margin: 4px 0 0; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.notif-body { padding: 20px; }
.notif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .notif-grid { grid-template-columns: 1fr; } }
.notif-col { display: flex; flex-direction: column; gap: 12px; }
.notif-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.notif-section-head h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.notif-section-head p { margin: 3px 0 0; color: var(--muted-2); font-size: 10px; text-transform: uppercase; }
.notif-ico {
    width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    border: 1px solid transparent; flex-shrink: 0;
}
.notif-ico.purple { background: rgba(168,85,247,.12); color: #c084fc; border-color: rgba(168,85,247,.25); }
.notif-ico.green { background: rgba(16,185,129,.12); color: #34d399; border-color: rgba(16,185,129,.25); }
.notif-ico.blue { background: rgba(59,130,246,.12); color: #93c5fd; border-color: rgba(59,130,246,.25); }
.notif-divider { height: 1px; background: var(--line); margin: 10px 0 6px; opacity: .7; }
.token-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.token-badge {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    padding: 2px 8px; border-radius: 999px; border: 1px solid;
}
.token-badge.ok { color: #34d399; border-color: rgba(16,185,129,.3); background: rgba(16,185,129,.08); }
.token-badge.bad { color: #fca5a5; border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.08); }
.token-input-wrap { position: relative; }
.token-input { color: #34d399 !important; padding-right: 44px !important; font-size: 12px; }
.token-copy {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; padding: 0; color: #34d399;
}
.hint { color: var(--muted-2); font-size: 11px; margin-top: 4px; }

/* ---------------- Referidos ---------------- */
.ref-bonus-card { padding: 0; overflow: hidden; }
.ref-bonus-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
@media (max-width: 980px) {
    .ref-bonus-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .ref-bonus-grid { grid-template-columns: 1fr 1fr; }
}
.ref-bonus-item {
    background: rgba(0,0,0,.18);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}
.ref-bonus-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin-bottom: 8px;
}
.ref-bonus-label i { color: var(--blue); opacity: .9; }
.ref-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
@media (max-width: 1100px) { .ref-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .ref-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .ref-cards { grid-template-columns: 1fr; } }
.ref-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    display: flex; flex-direction: column; gap: 12px;
    min-height: 100%;
}
.ref-card:hover { border-color: rgba(59,130,246,.35); }
.ref-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ref-card-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.ref-avatar {
    width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.25);
}
.ref-name {
    font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px;
}
.ref-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ref-meta span {
    font-size: 9px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em;
    background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
}
.ref-credits { text-align: right; flex-shrink: 0; }
.ref-credits-val { font-size: 18px; font-weight: 800; color: #34d399; line-height: 1; }
.ref-credits-lbl { font-size: 9px; color: rgba(52,211,153,.55); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.ref-progress { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; }
.ref-pct.done, .ref-ready { color: #34d399; }
.ref-pct.mid { color: #93c5fd; }
.ref-pct.low { color: #fbbf24; }
.ref-bar {
    margin-top: 6px; height: 6px; border-radius: 999px; overflow: hidden;
    background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.04);
}
.ref-bar-fill { height: 100%; border-radius: 999px; }
.ref-bar-fill.done { background: linear-gradient(90deg, #34d399, #059669); }
.ref-bar-fill.mid { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.ref-bar-fill.low { background: linear-gradient(90deg, #fbbf24, #d97706); }
.ref-ready { margin-top: 6px; font-size: 10px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.ref-card-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    font-size: 11px; color: var(--muted);
}
.ref-card-foot i { color: #34d399; margin-right: 4px; }
.ref-red b {
    display: inline-block; min-width: 1.4em; text-align: center;
    background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.2);
    border-radius: 8px; padding: 1px 7px; color: #fff;
}
.ref-network {
    background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 10px;
    padding: 8px 10px; max-height: 96px; overflow: auto; display: flex; flex-direction: column; gap: 6px;
}
.ref-network-item {
    font-size: 11px; color: var(--muted); padding-left: 10px; position: relative;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ref-network-item::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; border-radius: 50%; background: rgba(59,130,246,.45);
}
.ref-wa-panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(0,0,0,.14);
    padding: 14px;
}
.ref-wa-number {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 360px;
    margin-bottom: 14px;
}
.ref-wa-number-ico {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; margin-top: 18px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(37,211,102,.12); color: #25d366; border: 1px solid rgba(37,211,102,.28);
    font-size: 18px;
}
.ref-msg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 320px));
    gap: 16px;
    justify-content: start;
}
@media (max-width: 760px) {
    .ref-msg-grid { grid-template-columns: minmax(0, 1fr); }
}
.wa-phone {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    overflow: hidden;
    background: #111b21;
    box-shadow: 0 10px 28px rgba(0,0,0,.28);
    max-width: 320px;
}
.wa-phone-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 12px;
    background: #202c33;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.wa-phone-title {
    font-size: 11px; font-weight: 700; color: #e9edef;
    text-transform: uppercase; letter-spacing: .05em;
}
.ref-msg-vars { display: flex; flex-wrap: wrap; gap: 4px; }
.ref-var {
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04);
    color: #8696a0;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 999px;
    padding: 3px 8px;
    cursor: pointer;
}
.ref-var:hover {
    border-color: rgba(37,211,102,.45);
    color: #25d366;
    background: rgba(37,211,102,.08);
}
.wa-phone-chat {
    padding: 12px;
    background:
        radial-gradient(circle at 20% 10%, rgba(37,211,102,.06), transparent 40%),
        #0b141a;
}
.wa-box {
    display: block;
    width: 100%;
    height: 240px;
    min-height: 240px;
    max-height: 360px;
    resize: vertical;
    margin: 0;
    border: none !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    background: #005c4b !important;
    color: #e9edef !important;
    font-family: 'Consolas', 'Courier New', ui-monospace, monospace !important;
    font-size: 11.5px !important;
    line-height: 1.45 !important;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(0,0,0,.2);
    outline: none;
}
.wa-box:focus {
    box-shadow: 0 0 0 2px rgba(37,211,102,.35), 0 1px 1px rgba(0,0,0,.2);
}

/* ---------------- Plantillas WhatsApp ---------------- */
.tpl-create { padding: 0; overflow: hidden; }
.tpl-create-body { padding: 16px 18px 18px; }
.tpl-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}
@media (max-width: 860px) {
    .tpl-create-grid { grid-template-columns: 1fr; }
}
.tpl-editor-phone { max-width: 320px; width: 100%; }
.tpl-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tpl-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.tpl-card {
    max-width: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.tpl-card .wa-phone-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 160px;
    max-height: 280px;
}
.tpl-card-who {
    display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
}
.tpl-card-who .wa-phone-title {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tpl-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    background: #25d366; box-shadow: 0 0 0 3px rgba(37,211,102,.15);
}
.pill.sm { font-size: 9px; padding: 2px 7px; }
.tpl-card-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.tpl-ico {
    width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04); color: #8696a0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.tpl-ico:hover { color: #25d366; border-color: rgba(37,211,102,.35); }
.tpl-ico.danger:hover { color: #f87171; border-color: rgba(248,113,113,.35); }
.tpl-card .wa-phone-chat { cursor: pointer; }
.tpl-vars-panel {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 10px; border-radius: 12px;
    background: rgba(0,0,0,.18); border: 1px solid var(--line);
}
.ref-var.accent {
    border-color: rgba(37,211,102,.35);
    color: #86efac;
    background: rgba(37,211,102,.08);
}
.tpl-modal-editor { display: flex; justify-content: center; margin-top: 4px; }
.tpl-modal-editor .tpl-editor-phone { width: 100%; max-width: 420px; }
.tpl-modal-editor .wa-box { height: 280px; min-height: 280px; }
.wa-bubble {
    background: #005c4b;
    color: #e9edef;
    border-radius: 10px 10px 4px 10px;
    padding: 10px 12px;
    font-family: 'Consolas', 'Courier New', ui-monospace, monospace;
    font-size: 11.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: auto;
    flex: 1;
    box-shadow: 0 1px 1px rgba(0,0,0,.2);
}
.wa-bubble-meta {
    display: flex; justify-content: flex-end; align-items: center; gap: 5px;
    margin-top: 4px; font-size: 10px; color: #8696a0;
}
.wa-bubble-meta i { color: #53bdeb; font-size: 11px; }

/* ---------------- Misc ---------------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted-2); }
.muted { color: var(--muted); }
.mono { font-family: 'Consolas', 'Courier New', monospace; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.text-right { text-align: right; }
.hide { display: none !important; }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--blue); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); min-width: 240px; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* ---------------- Paneles · rama ---------------- */
.panel-tree-cell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.panel-tree-branch,
.panel-tree-root,
.panel-tree-orphan {
    flex: 0 0 auto;
    width: 14px;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}
.panel-tree-root { color: var(--accent); }
.panel-tree-orphan { color: var(--amber, #f5a524); }
tr.panel-orphan td { background: rgba(245, 165, 36, .04); }

/* Paneles · tarjetas móvil */
.master-panels-mobile { display: none; }
.master-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.master-panel-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.master-panel-card.is-child {
    border-left: 3px solid rgba(245,165,36,.45);
}
.master-panel-card.is-orphan {
    border-color: rgba(245,165,36,.35);
    background: rgba(245,165,36,.04);
}
.master-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.master-panel-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.master-panel-title b {
    font-size: 15px;
    font-weight: 800;
    word-break: break-word;
}
.master-panel-meta {
    font-size: 11px;
    color: var(--muted);
}
.master-panel-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.master-panel-tile {
    background: var(--bg-soft);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 8px;
    min-width: 0;
}
.master-panel-tile .k {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted-2);
    font-weight: 700;
    margin-bottom: 2px;
}
.master-panel-tile .v {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--txt);
    word-break: break-word;
}
.master-panel-tile .v small {
    color: var(--muted);
    font-weight: 600;
}
.master-panel-parent {
    font-size: 12px;
    color: var(--muted);
}
.master-panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.master-panel-actions .ico-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}
.master-panel-actions .ico-btn.tone-wa {
    color: #4ade80;
    border-color: rgba(34,197,94,.35);
    background: rgba(34,197,94,.1);
}
.master-panel-actions form.inline { display: inline-flex; margin: 0; }
.master-panel-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid var(--line-soft);
}
.master-panel-extra[hidden] { display: none !important; }

@media (max-width: 860px) {
    .master-page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .master-page-head .spacer { display: none; }
    .master-head-actions { width: 100%; }
    .master-head-actions .btn { flex: 1 1 auto; justify-content: center; }
    .master-stats.grid.cols-4 {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .master-stats .card.stat { padding: 12px; }
    .master-stats .card.stat .value { font-size: 18px; }
    .master-stats .card.stat .label { font-size: 11px; }
    .master-panels-desktop { display: none !important; }
    .master-panels-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 4px;
    }
    .master-panels-section.card.pad-lg { padding: 14px !important; }
}

/* Módulos */
.master-modulos-hint {
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 12px;
}
.master-modulos-hint b { color: var(--txt); font-weight: 700; }
.master-modulos-mobile { display: none; }
.master-modulo-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.master-modulo-ico {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(59,130,246,.12);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,.22);
    font-size: 14px;
}
.master-modulo-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.master-modulo-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.master-modulo-card.is-off {
    opacity: .72;
}
.master-modulo-desc {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}
.master-modulo-card .master-panel-tile .v.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
}

@media (max-width: 860px) {
    .master-modulos-desktop { display: none !important; }
    .master-modulos-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 4px;
    }
    .master-modulos-section.card.pad-lg { padding: 14px !important; }
    .master-stats.grid.cols-3 {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }
    .master-stats.grid.cols-3 .card.stat { padding: 10px; }
    .master-stats.grid.cols-3 .card.stat .value { font-size: 16px; }
    .master-stats.grid.cols-3 .card.stat .label { font-size: 10px; }
}

/* ---------------- Mi perfil ---------------- */
.perfil-grid { align-items: start; }
.perfil-meta { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.perfil-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}
.perfil-meta-row:last-child { border-bottom: 0; }
.perfil-apk-download {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
}
.perfil-apk-download img {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 10px;
}
.perfil-apk-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    font-size: 13px;
}
.perfil-apk-copy .btn { margin-top: 4px; }

/* ---------------- Paneles/Venta (Elite Master) ---------------- */
.venta-svc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}
.venta-svc-card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.venta-svc-card.is-off { opacity: .55; }
.venta-svc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.venta-svc-name { margin: 0; font-size: 15px; font-weight: 700; }
.venta-svc-ciclo { font-size: 12px; }
.venta-svc-ciclo b { color: var(--accent); }
.venta-price-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.venta-price-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--line-soft);
}
.venta-price-list li:last-child { border-bottom: 0; }
.venta-svc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.venta-tiers-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0 10px;
}
.venta-tiers-head label { margin: 0; color: var(--muted); font-size: 13px; }
.venta-tiers { display: flex; flex-direction: column; gap: 10px; }
.venta-tier-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}
.venta-tier-del { height: 40px; min-width: 40px; }
.venta-cobrar-box {
    margin: 4px 0 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245, 165, 36, .35);
    background: rgba(245, 165, 36, .08);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 14px;
}
.venta-cobrar-label { color: var(--muted); font-size: 13px; }
.venta-cobrar-monto {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: .02em;
}
.venta-cobrar-monto.is-miss { color: var(--muted-2); font-size: 18px; }
.venta-pack-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.venta-pack-btn { border-color: rgba(245, 165, 36, .4); }
.venta-recharge-alert { margin-bottom: 16px; }
.venta-recharge-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
}
.venta-recharge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(245, 165, 36, .22);
}
.venta-recharge-item > span:first-child { color: #fef3c7; }
.venta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.venta-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.venta-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--muted-2);
}
.venta-card.tone-green::before { background: var(--green); }
.venta-card.tone-amber::before { background: var(--accent); }
.venta-card.tone-red::before { background: var(--red); }
.venta-card.tone-gray::before { background: var(--muted-2); }
.venta-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.venta-card-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.venta-card-name {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    cursor: pointer;
}
button.venta-card-name:hover { color: var(--accent); }
.venta-wa {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 197, 94, .14);
    color: #4ade80;
    font-size: 20px;
    flex: 0 0 auto;
    transition: .15s;
    border: 0;
    cursor: pointer;
    padding: 0;
}
button.venta-wa:hover,
a.venta-wa:hover { background: rgba(34, 197, 94, .28); color: #86efac; }
span.venta-wa { opacity: .35; cursor: default; }
.venta-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 12px;
}
.venta-meta-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    font-size: 12px;
}
.venta-k { color: var(--muted); font-size: 11px; }
.venta-v { max-width: 100%; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.venta-service-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.venta-cred { color: var(--accent); font-variant-numeric: tabular-nums; }
.venta-meta-date {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
}
.venta-meta-date .venta-v { text-align: right; }
.venta-notes {
    font-size: 12px;
    padding: 8px 10px;
    background: var(--panel-2);
    border-radius: 8px;
    border: 1px solid var(--line-soft);
}
.venta-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid var(--line-soft);
}
.pill.sm { font-size: 11px; padding: 2px 8px; }

@media (max-width: 600px) {
    .venta-recharge-item { align-items: flex-start; flex-direction: column; }
    .venta-card { padding: 12px; }
    .venta-card-meta { gap: 8px 10px; }
}

/* Clientes: tabla desktop / tarjetas móvil */
.dash-clients-mobile { display: none; }
.dash-clients-desktop { display: block; }

.client-card {
    perspective: 1100px;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}
.client-card-inner {
    position: relative;
    width: 100%;
    transform-style: preserve-3d;
    transition: transform .55s cubic-bezier(.2,.8,.2,1);
}
.client-card.is-flipped .client-card-inner {
    transform: rotateY(180deg);
}
.client-card-face {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 22px rgba(0,0,0,.22);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.client-card-front { position: relative; }
.client-card-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    justify-content: flex-start;
}
.client-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.client-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.client-card-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--txt);
    line-height: 1.2;
    word-break: break-word;
}
.client-card-name:hover { color: var(--accent); }
.client-card-tag {
    display: inline-flex;
    align-items: center;
    max-width: 140px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.client-card-creds {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
}
.client-card-creds .mono {
    font-family: Consolas, 'Courier New', monospace;
    font-weight: 700;
    color: var(--txt);
    background: var(--bg-soft);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 4px 8px;
}
.client-card-creds .sep { color: var(--muted-2); }
.client-card-creds .muted { color: var(--muted); }

.client-card-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.client-tile {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
    min-width: 0;
}
.client-tile .k {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-2);
    font-weight: 700;
    margin-bottom: 4px;
}
.client-tile .v {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--txt);
    line-height: 1.2;
    word-break: break-word;
}
.client-tile .v.is-cred { color: var(--accent); }
.client-tile .v.is-debt { color: #fca5a5; font-size: 12px; }
.client-tile .v.is-ok { color: #86efac; }

.client-card-hint {
    font-size: 10px;
    color: var(--muted-2);
    text-align: center;
    letter-spacing: .02em;
}
.client-card-back-label {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.client-card-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 2px;
}
.client-card-actions .ico-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 15px;
    flex: 0 0 auto;
}
.client-card-actions-back {
    flex-wrap: wrap;
    gap: 10px;
}
.client-card-actions-back .ico-btn {
    width: auto;
    min-width: 72px;
    height: auto;
    min-height: 64px;
    padding: 10px 12px;
    flex-direction: column;
    gap: 6px;
    font-size: 16px;
}
.client-card-actions-back .ico-btn span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.client-card-actions .ico-btn.tone-purple {
    color: #c084fc; border-color: rgba(168,85,247,.35); background: rgba(168,85,247,.1);
}
.client-card-actions .ico-btn.tone-wa {
    color: #4ade80; border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.1);
}
.client-card-actions .ico-btn.tone-muted {
    color: var(--muted); border-color: var(--line); background: var(--bg-soft);
}
.client-card-actions .ico-btn.tone-blue {
    color: #93c5fd; border-color: rgba(59,130,246,.35); background: rgba(59,130,246,.1);
}
.client-card-actions .ico-btn.tone-amber {
    color: #fcd34d; border-color: rgba(245,165,36,.4); background: rgba(245,165,36,.12);
}
.client-card-actions .ico-btn.tone-teal {
    color: #5eead4; border-color: rgba(20,184,166,.35); background: rgba(20,184,166,.1);
}
.client-card-actions .ico-btn.tone-cyan {
    color: #67e8f9; border-color: rgba(6,182,212,.35); background: rgba(6,182,212,.1);
}
.client-card-actions .ico-btn.tone-kin {
    color: #c4b5fd; border-color: rgba(167,139,250,.4); background: rgba(139,92,246,.12);
}
.client-card-actions .ico-btn.tone-red {
    color: #fca5a5; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.1);
}
.client-card-actions .ico-btn.tone-flip {
    color: var(--accent); border-color: rgba(245,165,36,.35); background: rgba(245,165,36,.1);
    margin-left: auto;
}

/* Resaltado al encontrar cliente con el buscador */
.client-row.dash-search-flash,
.client-card.dash-search-flash .client-card-face {
    outline: 2px solid rgba(245, 165, 36, .85);
    box-shadow: 0 0 0 4px rgba(245, 165, 36, .2), 0 8px 22px rgba(0,0,0,.22);
    transition: outline .2s ease, box-shadow .2s ease;
}
tr.client-row.dash-search-flash td {
    background: rgba(245, 165, 36, .08);
}

/* Dashboard: acciones + buscador (base) */
.dash-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dash-search-bar {
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.dash-search-bar .input {
    width: 100%;
    max-width: 360px;
}
#dash-search-hint:not(.hide) {
    width: 100%;
    max-width: 360px;
    text-align: right;
}
.dash-tabs-scroller {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
.dash-tabs-compact {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 100%;
    width: max-content;
    max-width: none;
    margin-bottom: 0;
    border-bottom: 0;
    overflow: visible;
}
.dash-tabs-compact > button {
    flex: 1 0 auto;
    min-width: 6.5rem;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
    text-align: center;
}
.dash-tabs-compact.is-filtering > button:not([hidden]) {
    flex: 0 0 auto;
    min-width: 6.5rem;
    max-width: none;
    padding: 8px 12px;
}
.dash-tabs-compact > button b,
.dash-tabs-compact > button .tab-hit-badge {
    font-weight: 800;
    margin-left: 2px;
}
.dash-tabs-compact > button[hidden] { display: none !important; }

@media (max-width: 860px) {
    .sidebar { position: fixed; left: -100%; z-index: 60; transition: left .2s; width: min(280px, 86vw); flex: none; height: 100%; height: 100dvh; }
    .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
    .content { padding: 14px 12px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-x: visible; }
    .topbar { padding: 0 12px; padding-left: max(12px, env(safe-area-inset-left, 0px)); gap: 8px; }
    .topbar .title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
    .topbar .user-chip .who { display: none; }
    .topbar .tenant-chip { font-size: 11px; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .page-head { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 12px; }
    .page-head h1 { font-size: 18px; }
    .page-head .sub { font-size: 12px; }
    .dash-page-head .spacer { display: none; }
    .dash-page-head > div:first-child { display: none; }
    .dash-page-head { margin-bottom: 10px; gap: 0; }
    .dash-head-actions {
        display: flex;
        width: 100%;
        gap: 8px;
    }
    .dash-head-actions .btn.sm {
        flex: 1 1 0;
        justify-content: center;
        min-height: 34px;
        padding: 6px 10px;
        font-size: 12px;
    }
    .masivo-desktop-only { display: none !important; }
    .btn { min-height: 40px; }
    .btn.sm { min-height: 34px; }
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal, .modal.modal-lg, .modal.modal-xl, .modal.modal-new-client, .modal.modal-compact {
        max-width: 100%;
        width: 100%;
        max-height: min(94vh, 94dvh);
        border-radius: 16px 16px 0 0;
        margin: 0;
    }
    .table-wrap { -webkit-overflow-scrolling: touch; margin: 0 -4px; }
    .dash-table th, .dash-table td { font-size: 12px; padding: 8px 6px; }
    .saldo-modes { grid-template-columns: 1fr; }

    #modal-parientes .modal-body { padding: 12px 14px 18px; }
    #modal-parientes .kin-hint { font-size: 11px; margin-bottom: 8px; }
    #kin-stats.ticket-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 10px;
    }
    #kin-stats .ticket-stat { padding: 6px 4px; }
    #kin-stats .ticket-stat .muted { font-size: 9px; }
    #kin-stats .ticket-stat b { font-size: 13px; margin-top: 0; }
    .kin-lista { gap: 6px; max-height: min(42vh, 320px); }
    .kin-card {
        padding: 8px 10px;
        gap: 6px;
        border-radius: 10px;
    }
    .kin-card-top { gap: 6px; }
    .kin-card-top b { font-size: 13px; line-height: 1.2; }
    .kin-card-meta {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 62vw;
    }
    .kin-card-foot { gap: 6px; }
    .kin-card-actions .btn.sm {
        min-height: 32px;
        padding: 4px 8px;
        font-size: 11px;
    }
    .kin-buscar-item { padding: 8px; }
    .kin-buscar-item .btn.sm { min-height: 34px; }

    /* Stats: clientes + pantallas; sin ingresos */
    .dash-stats.grid.cols-3 {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .dash-stat-ingresos { display: none !important; }
    .dash-stats .card.stat {
        padding: 12px;
    }
    .dash-stats .card.stat .value { font-size: 20px; }
    .dash-stats .card.stat .label { font-size: 11px; }
    .dash-stats .pantallas-label { font-size: 10px; margin-top: 2px; }

    /* Buscador pegado bajo el topbar, sin hueco */
    .dash-search-bar {
        position: sticky;
        top: 64px;
        z-index: 25;
        margin: -14px -12px 10px;
        padding: 8px 12px;
        background: rgba(11, 18, 32, .94);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--line-soft);
        align-items: stretch;
        max-width: none;
        min-width: 0;
        width: auto;
    }
    .dash-search-bar .input {
        max-width: none;
        min-height: 40px;
        font-size: 15px;
    }
    #dash-search-hint:not(.hide) {
        max-width: none;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* Dashboard: renovados arriba, luego clientes */
    .dash-clients-desktop { display: none !important; }
    .dash-clients-mobile {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .dash-split {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 10px !important;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }
    .dash-side-stack {
        order: -1;
        margin-top: 0;
        position: static;
        max-height: none;
        width: 100%;
    }
    .dash-renew-side {
        width: 100%;
        padding: 12px;
    }
    /* 2 columnas × 2 filas = 4 renovados */
    .dash-renew-side .dash-renew-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .dash-renew-side .dash-renew-list > .renew-card:nth-child(n+5) {
        display: none;
    }
    .dash-renew-side .renew-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 8px;
        min-width: 0;
        width: 100%;
    }
    .dash-renew-side .renew-card-right {
        text-align: left;
        width: 100%;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 6px;
    }
    .dash-renew-side .renew-name {
        font-size: 12px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .dash-renew-side .renew-svc {
        font-size: 10px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .dash-renew-side .renew-date { font-size: 11px; }
    .dash-renew-side .renew-label { font-size: 8px; }

    .dash-split-main {
        order: 0;
        padding: 12px !important;
        overflow-x: hidden;
        max-width: 100%;
    }
    .dash-clients-head { margin-bottom: 8px; }
    .dash-clients-head h3 { font-size: 14px; }

    /* Tarjetas de cliente más compactas (vence / activos / etc.) */
    .client-card-face {
        padding: 10px;
        gap: 8px;
        border-radius: 12px;
        box-shadow: 0 4px 14px rgba(0,0,0,.18);
    }
    .client-card-name { font-size: 14px; }
    .client-card-tag {
        max-width: 110px;
        padding: 2px 7px;
        font-size: 10px;
    }
    .client-card-creds { gap: 6px; font-size: 11px; }
    .client-card-creds .mono {
        padding: 2px 6px;
        font-size: 11px;
        border-radius: 6px;
    }
    .client-card-tiles { gap: 6px; }
    .client-tile { padding: 6px 4px; border-radius: 8px; }
    .client-tile .k { font-size: 8px; margin-bottom: 2px; }
    .client-tile .v { font-size: 11px; }
    .client-tile .v.is-debt { font-size: 10px; }
    .client-card-actions { gap: 5px; }
    .client-card-actions .ico-btn {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 13px;
    }
    .client-card-hint { display: none; }
    .client-card-actions-back .ico-btn {
        min-width: 64px;
        min-height: 52px;
        padding: 8px;
        font-size: 14px;
    }
    .pill { font-size: 10px; padding: 2px 7px; }

    /* Solo las pestañas se deslizan; las tarjetas no cambian de ancho */
    .dash-tabs-scroller {
        margin: 0 0 10px;
        padding-bottom: 2px;
        border-bottom: 1px solid var(--line-soft);
        touch-action: pan-x;
    }
    .dash-tabs-compact {
        gap: 3px;
        margin: 0;
        padding: 0;
        border-bottom: 0;
    }
    .dash-tabs-compact > button {
        flex: 1 0 auto;
        min-width: 5.5rem;
        padding: 8px 8px;
        font-size: 11px;
        letter-spacing: -0.01em;
        border-radius: 0;
    }
    .dash-tabs-compact.is-filtering > button:not([hidden]) {
        flex: 0 0 auto;
        min-width: 6.5rem;
        max-width: none;
        padding: 8px 12px;
        font-size: 11px;
    }
    .dash-tabs-compact > button b {
        display: inline;
        font-size: 11px;
        opacity: .85;
    }

    /* Tarjetas: ancho estable (no se deforman al cambiar/deslizar pestañas) */
    .dash-clients-mobile,
    .dash-clients-mobile .client-card,
    .dash-clients-mobile .client-card-inner,
    .dash-clients-mobile .client-card-face {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    #dash-tabs,
    #dash-tabs .tab-panel,
    #dash-tabs .pager-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    .grid.cols-3:not(.dash-stats):not(.master-stats) { grid-template-columns: 1fr; gap: 10px; }
    .card.stat .value { font-size: 22px; }
}

/* Pendientes: desktop tabla / móvil tarjetas */
.pend-mobile { display: none; }
.pend-desktop { display: block; }
.pend-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.pend-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.pend-card-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.pend-card-title b {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
    word-break: break-word;
}
.pend-card-tag {
    display: inline-flex;
    align-self: flex-start;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    color: #93c5fd;
    background: rgba(59,130,246,.12);
    border: 1px solid rgba(59,130,246,.28);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pend-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.pend-meta-row {
    background: var(--bg-soft);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 8px;
    min-width: 0;
}
.pend-meta-row .k {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted-2);
    font-weight: 700;
    margin-bottom: 2px;
}
.pend-meta-row .v {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--txt);
    word-break: break-word;
}
.pend-card-notes {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pend-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pend-card-actions .ico-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex: 0 0 auto;
}
.pend-card-actions .pend-alta-btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
}
.pend-card-actions form.inline { display: inline-flex; margin: 0; }
.pend-card-actions .ico-btn.tone-wa {
    color: #4ade80; border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.1);
}
.pend-card-actions .ico-btn.tone-red {
    color: #fca5a5; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.1);
}

@media (max-width: 860px) {
    .pend-desktop { display: none !important; }
    .pend-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .pend-page-head {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    .pend-page-head .spacer { display: none; }
    .pend-page-head .btn {
        margin-left: auto;
        flex: 0 0 auto;
    }
}

/* Backdrop del menú móvil */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(3, 7, 16, .55);
    z-index: 55;
    backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 540px) {
    .auth-card { padding: 24px 18px; border-radius: 16px; }
    .grid.cols-2.perfil-grid { grid-template-columns: 1fr; }
}

/* Aviso WhatsApp (móvil / APK) — una sola vez */
.mobile-wa-hint {
    display: none;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(245,165,36,.1);
    border: 1px solid rgba(245,165,36,.35);
    color: #fcd34d;
    font-size: 12px;
    line-height: 1.4;
}
.mobile-wa-hint span { flex: 1; min-width: 0; }
.mobile-wa-hint-x {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #fcd34d;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: .8;
}
body.is-mobile-app .mobile-wa-hint:not([hidden]),
body.is-mobile-webview .mobile-wa-hint:not([hidden]) {
    display: flex;
}
.mobile-wa-hint[hidden] { display: none !important; }

/* Pull-to-refresh */
#ptr-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity .15s ease;
    color: #fcd34d;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(180deg, rgba(11,18,32,.92), rgba(11,18,32,.55) 70%, transparent);
    padding-top: env(safe-area-inset-top, 0px);
}
#ptr-indicator.show { opacity: 1; }
#ptr-indicator.ready .ptr-label { color: #f5a524; }
#ptr-indicator.loading .ptr-spinner {
    animation: ptr-spin .7s linear infinite;
}
.ptr-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(245,165,36,.25);
    border-top-color: #f5a524;
}
@keyframes ptr-spin {
    to { transform: rotate(360deg); }
}

/* Modal mensaje WhatsApp: compacto en móvil */
@media (max-width: 860px) {
    #modal-mensaje .modal.modal-msg-wa {
        max-height: min(92vh, 92dvh);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    #modal-mensaje .modal-msg-wa .modal-head {
        padding: 12px 14px;
        flex-shrink: 0;
    }
    #modal-mensaje .modal-msg-wa .modal-head h3 { font-size: 15px; }
    #modal-mensaje .modal-msg-wa .modal-msg-body.modal-split {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        min-height: 0;
    }
    #modal-mensaje .modal-msg-wa .split-left,
    #modal-mensaje .modal-msg-wa .split-right {
        min-width: 0;
    }
    #modal-mensaje .modal-msg-wa .field { margin-bottom: 8px; }
    #modal-mensaje .modal-msg-wa .field label {
        font-size: 11px;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: .04em;
    }
    #modal-mensaje .modal-msg-wa .input,
    #modal-mensaje .modal-msg-wa select.input {
        min-height: 42px;
        font-size: 15px;
    }
    #modal-mensaje .modal-msg-wa .preview-box {
        max-height: min(38vh, 280px);
        overflow-y: auto;
        font-size: 13px;
        line-height: 1.45;
        padding: 12px;
        white-space: pre-wrap;
        word-break: break-word;
    }
    #modal-mensaje .modal-msg-wa .msg-historial-field { display: none; }
    #modal-mensaje .modal-msg-wa #msg-enviar {
        min-height: 48px;
        font-size: 15px;
        font-weight: 700;
        margin-top: 4px;
        position: sticky;
        bottom: 0;
    }
}

/* Paneles disponibles: tarjetas compactas y adaptables. */
.page-tienda .svc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    align-items: stretch;
    gap: 14px;
}
.page-tienda .svc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    transition: border-color .18s, transform .18s, box-shadow .18s;
}
.page-tienda .svc-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-d));
    content: '';
}
.page-tienda .svc-card-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    padding-left: 0;
}
.page-tienda .svc-card-icon {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--accent);
    background: rgba(245, 165, 36, .12);
    border: 1px solid rgba(245, 165, 36, .18);
    border-radius: 10px;
    font-size: 16px;
}
.page-tienda .svc-card-title { min-width: 0; }
.page-tienda .svc-card-title h3 {
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.page-tienda .svc-description {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.page-tienda .svc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .025);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
}
.page-tienda .svc-meta-label,
.page-tienda .svc-section-label {
    color: var(--muted-2);
    font-size: 10px;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.page-tienda .svc-meta-val { font-size: 13px; font-weight: 700; white-space: nowrap; }
.page-tienda .svc-precios { min-width: 0; }
.page-tienda .svc-section-label { margin-bottom: 6px; }
.page-tienda .price-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
    gap: 6px;
}
.page-tienda .price-tier {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 8px 9px;
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
}
.page-tienda .price-tier-credits { display: flex; align-items: baseline; gap: 5px; }
.page-tienda .price-tier-credits b { color: var(--accent); font-size: 13px; }
.page-tienda .price-tier-credits span { color: var(--muted); font-size: 11px; }
.page-tienda .price-tier-amount {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.page-tienda .svc-card-footer {
    margin-top: auto;
    padding-top: 9px;
    border-top: 1px solid var(--line-soft);
}
.page-tienda .svc-card-footer .btn {
    width: 100%;
    min-height: 36px;
    justify-content: center;
    gap: 7px;
}
@media (hover: hover) {
    .page-tienda .svc-card:hover {
        transform: translateY(-2px);
        border-color: var(--accent);
        box-shadow: var(--shadow);
    }
}
@media (max-width: 420px) {
    .page-tienda .svc-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .page-tienda .svc-card { padding: 12px; }
}
