/* Panel App TV — estilo oscuro (azul noche + acento cian), cargado encima de Bootstrap 5 en modo oscuro */
:root {
  --accent: #22D3EE;
  --accent-ink: #04222B;          /* texto sobre el acento */
  --bg: #0A0F1C;
  --ink: #F1F5F9;
  --ink-2: #CBD5E1;
  --muted: #94A3B8;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.05);
  --card: rgba(255,255,255,.035);
  --card-2: rgba(255,255,255,.06);
  --field: rgba(255,255,255,.04);
  --side: rgba(7,11,20,.82);
  --ok-bg: rgba(34,197,94,.14);  --ok: #4ADE80;
  --warn-bg: rgba(245,158,11,.14); --warn: #FBBF24;
  --bad-bg: rgba(239,68,68,.14); --bad: #F87171;
  --neutral-bg: rgba(148,163,184,.14);
  --info-bg: rgba(34,211,238,.14); --info: #67E8F9;
  --radius: 16px;
  --bs-body-font-family: 'DM Sans', system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-emphasis-color: #fff;
  --bs-link-color-rgb: 103,232,249;
  --bs-link-hover-color-rgb: 165,243,252;
}
html { background: #0A0F1C; }
html, body { min-height: 100%; }
body {
  color: var(--ink); font-family: 'DM Sans', system-ui, sans-serif; font-size: 15px;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(900px 600px at 105% 0%, rgba(59,130,246,.10), transparent 60%),
    linear-gradient(180deg, #0B1626 0%, #0A0F1C 55%, #090D18 100%);
  background-attachment: fixed;
}
h1, h2, h3, h4, h5, h6, .page-title { font-family: 'Sora', 'DM Sans', sans-serif; letter-spacing: -0.01em; color: #fff; }
a { color: var(--info); }
a:hover { color: #A5F3FC; }
.text-secondary { color: var(--muted) !important; }
::selection { background: rgba(34,211,238,.35); }

/* ---- Estructura ---- */
.shell { display: flex; min-height: 100vh; }
.side { width: 252px; flex: 0 0 252px; background: var(--side); backdrop-filter: blur(10px); border-right: 1px solid var(--line);
        display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16px; line-height: 1.15; }
.brand small { display: block; font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 12px; color: var(--muted); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: #000; border: 1px solid var(--line); color: #fff; display: inline-flex;
              align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.brand-mark span { color: var(--accent); }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--line); color: #fff; width: 44px; height: 44px; border-radius: 12px; }
.side-body { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 18px; flex: 1; }
.side-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: #64748B; padding: 16px 12px 6px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2);
             text-decoration: none; font-weight: 500; }
.side-link .ico { color: var(--muted); }
.side-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-link.on { background: rgba(34,211,238,.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(34,211,238,.22); }
.side-link.on .ico { color: var(--accent); }
.side-link.muted { color: var(--muted); }
.side-fill { flex: 1; min-height: 20px; }
.pill-count { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.credit-box { background: linear-gradient(135deg, rgba(34,211,238,.16), rgba(59,130,246,.10)); border: 1px solid rgba(34,211,238,.22);
              border-radius: 14px; padding: 14px; margin: 0 0 14px; }
.credit-box .small { color: var(--ink-2); }
.credit-num { font-family: 'Sora', sans-serif; font-size: 28px; font-weight: 700; color: #fff; line-height: 1.2; }
.credit-box a { color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 32px clamp(16px, 3.2vw, 44px) 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-title { font-size: 30px; font-weight: 700; margin: 8px 0 0; }
.page-sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
           color: var(--accent); background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.35); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: 0 0 auto; height: auto; position: sticky; top: 0; z-index: 30; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-head { padding: 12px 16px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .side-body { display: none; }
  body.nav-open .side-body { display: flex; max-height: calc(100vh - 70px); overflow-y: auto; }
  .main { padding: 22px 16px 44px; }
  .page-title { font-size: 26px; }
}

/* ---- Componentes ---- */
.card, .box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.card { --bs-card-bg: transparent; --bs-card-border-color: var(--line); }
.box { padding: 22px; }
.box h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; }
.box-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.box-head h2 { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi .ico-tile { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
                 background: rgba(34,211,238,.12); color: var(--accent); margin-bottom: 12px; }
.kpi .lbl { color: var(--muted); font-size: 14px; }
.kpi .val { font-family: 'Sora', sans-serif; font-size: 30px; font-weight: 700; line-height: 1.25; color: #fff; }
.kpi .note { font-size: 13px; font-weight: 600; color: var(--muted); }
.note-ok { color: var(--ok) !important; } .note-warn { color: var(--warn) !important; } .note-bad { color: var(--bad) !important; }

.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .wide { flex: 3 1 480px; min-width: 0; }
.cols > .narrow { flex: 2 1 300px; min-width: 0; }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-neutral { background: var(--neutral-bg); color: var(--ink-2); }
.chip-info { background: var(--info-bg); color: var(--info); }

/* Pestañas tipo "Comprar | Renovar" */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.tab { height: 36px; padding: 0 16px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 14px;
       display: inline-flex; align-items: center; text-decoration: none; }
.tab:hover { color: #fff; background: rgba(255,255,255,.05); }
.tab.on { background: var(--accent); color: var(--accent-ink); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
          background: var(--field); flex: 0 1 300px; color: var(--muted); }
.search svg { stroke: var(--muted); }
.search input { border: 0; outline: none; font: inherit; width: 100%; background: transparent; color: var(--ink); }
.search:focus-within { border-color: rgba(34,211,238,.6); }

/* Tablas */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table-wrap .table { margin: 0; min-width: 680px; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line-2); --bs-table-hover-bg: rgba(255,255,255,.03); font-size: 14px; color: var(--ink); }
.table > thead th { color: var(--muted); font-weight: 600; background: rgba(255,255,255,.025); border-bottom: 1px solid var(--line); padding: 13px 16px; white-space: nowrap; font-size: 13px; }
.table > tbody td { padding: 13px 16px; border-color: var(--line-2); vertical-align: middle; }
.table > tbody tr:hover > td { background: rgba(255,255,255,.02); }
.box .table > thead th { background: transparent; padding: 10px 8px; }
.box .table > tbody td { padding: 11px 8px; }
table.bg-white { background: var(--card) !important; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.u-name { font-weight: 600; color: #fff; }
.row-off td { color: #64748B !important; }

/* Formularios y botones */
.form-control, .form-select { background-color: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; min-height: 44px; font-size: 15px; }
.form-control::placeholder { color: #64748B; }
.form-control:focus, .form-select:focus { background-color: rgba(255,255,255,.06); color: #fff; border-color: rgba(34,211,238,.7); box-shadow: 0 0 0 3px rgba(34,211,238,.18); }
.form-control[readonly] { background-color: rgba(255,255,255,.03); }
.form-select option { background: #0F172A; color: #fff; }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: 13px; border-radius: 9px; }
.form-control-color { padding: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form-text { color: var(--muted); }
.form-check-input, input[type=checkbox] { accent-color: var(--accent); }
code { color: var(--info); background: rgba(34,211,238,.08); padding: 1px 6px; border-radius: 6px; }

.btn { border-radius: 12px; font-weight: 700; background-image: none; box-shadow: none; text-shadow: none; }
.btn-primary, .btn-success {
  --bs-btn-color: var(--accent-ink); --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--accent-ink); --bs-btn-hover-bg: #67E8F9; --bs-btn-hover-border-color: #67E8F9;
  --bs-btn-active-color: var(--accent-ink); --bs-btn-active-bg: #06B6D4; --bs-btn-active-border-color: #06B6D4;
  --bs-btn-disabled-color: var(--accent-ink); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent);
  box-shadow: 0 6px 22px rgba(34,211,238,.22);
}
.btn-light-line, .btn-outline-secondary, .btn-outline-primary, .btn-outline-info {
  --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.18); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255,255,255,.06);
  --bs-btn-hover-border-color: rgba(255,255,255,.32); --bs-btn-active-bg: rgba(255,255,255,.1); --bs-btn-active-color: #fff;
  background: transparent; border: 1px solid rgba(255,255,255,.18); color: #fff;
}
.btn-light-line:hover { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.32); }
.btn-soft { background: rgba(34,211,238,.12); color: var(--info); border: 1px solid rgba(34,211,238,.25); }
.btn-soft:hover { background: rgba(34,211,238,.2); color: #A5F3FC; border-color: rgba(34,211,238,.45); }
.btn-outline-warning { --bs-btn-color: var(--warn); --bs-btn-border-color: rgba(251,191,36,.4); --bs-btn-hover-bg: rgba(251,191,36,.12); --bs-btn-hover-color: var(--warn); --bs-btn-hover-border-color: rgba(251,191,36,.6); }
.btn-outline-danger { --bs-btn-color: var(--bad); --bs-btn-border-color: rgba(248,113,113,.4); --bs-btn-hover-bg: rgba(248,113,113,.12); --bs-btn-hover-color: var(--bad); --bs-btn-hover-border-color: rgba(248,113,113,.6); }
.btn-lg { padding: 12px 26px; border-radius: 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.quick .f { display: flex; flex-direction: column; flex: 1 1 170px; min-width: 0; }
.quick .f.sm { flex: 0 1 120px; }
.quick .acts { display: flex; flex-wrap: wrap; gap: 10px; }
.progress { --bs-progress-bg: rgba(255,255,255,.08); --bs-progress-bar-bg: var(--accent); border-radius: 999px; }

/* Menú "Más" de cada fila */
details.more { position: relative; display: inline-block; }
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 270px; background: #0F1626; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.45); padding: 12px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
details.more .menu .row-inline { display: flex; gap: 6px; }
details.box > summary { list-style: none; }
details.box > summary::-webkit-details-marker { display: none; }

.alert { border-radius: 14px; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: rgba(74,222,128,.25); }
.alert-danger { background: var(--bad-bg); color: var(--bad); border-color: rgba(248,113,113,.25); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: rgba(251,191,36,.25); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(103,232,249,.25); }
.alert a { color: inherit; font-weight: 700; }

/* Datos del usuario recién creado */
.created { background: linear-gradient(135deg, rgba(34,211,238,.10), rgba(59,130,246,.06)); border: 1px solid rgba(34,211,238,.25); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.created pre { background: rgba(0,0,0,.28); color: var(--ink); border-radius: 12px; padding: 12px 14px; margin: 10px 0 12px; font-family: 'DM Sans', sans-serif; font-size: 15px; white-space: pre-wrap; }

/* Compra de créditos: tarjetas de plan */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pack { position: relative; display: block; cursor: pointer; margin: 0; }
.pack input { position: absolute; opacity: 0; }
.pack .in { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: rgba(255,255,255,.035); height: 100%; transition: border-color .15s, box-shadow .15s; }
.pack:hover .in { border-color: rgba(255,255,255,.18); }
.pack input:checked + .in { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px rgba(34,211,238,.18); }
.pack input:focus-visible + .in { outline: 3px solid var(--accent); outline-offset: 3px; }
.pack .best { position: absolute; top: -11px; left: 18px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .08em; border-radius: 999px; padding: 3px 10px; }
.pack .t { font-weight: 700; font-size: 16px; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pack .t .chip { font-weight: 600; }
.pack hr { border-color: var(--line); opacity: 1; margin: 14px 0; }
.pack .p { font-family: 'Sora', sans-serif; font-size: 34px; font-weight: 700; color: #fff; line-height: 1.1; }
.pack .p small { font-size: 18px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.pack .u { font-size: 13px; color: var(--muted); margin-top: 4px; }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.methods .btn { border-radius: 14px; padding: 14px 18px; }
.bank { background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; font-size: 15px; }
.empty { color: var(--muted); text-align: center; padding: 30px 12px; }
.delta-pos { color: var(--ok); font-weight: 700; } .delta-neg { color: var(--bad); font-weight: 700; }

/* Mi app */
.app-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.app-icon { width: 76px; height: 76px; border-radius: 20px; background: #000; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
            font-family: 'Sora', sans-serif; font-weight: 700; color: #fff; overflow: hidden; flex: 0 0 auto; }
.app-icon img { width: 100%; height: 100%; object-fit: contain; }
.qr-box { display: inline-flex; padding: 12px; background: #fff; border-radius: 14px; min-width: 204px; min-height: 204px; align-items: center; justify-content: center; color: #0A0F1C; }

/* En el celular, las tablas marcadas con .stack se muestran como tarjetas */
@media (max-width: 700px) {
  .table-wrap:has(.stack) { background: transparent; border: 0; overflow: visible; }
  .table.stack { min-width: 0 !important; }
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
  .table.stack td { border: 0 !important; padding: 4px 0 !important; text-align: left !important; display: flex; justify-content: space-between; gap: 12px; background: transparent !important; }
  .table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 500; }
  .table.stack td.u-name { font-size: 16px; }
  .table.stack td.acts { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding-top: 10px !important; white-space: normal !important; }
  .table.stack td.empty { justify-content: center; }
  details.more .menu { right: auto; left: 0; }
  .tabs { border-radius: 16px; }
}
