/* ==========================================================================
   miscuentas · panel
   ========================================================================== */
:root {
  --bg: #080a0e;
  --bg-soft: #0d1117;
  --surface: #11161e;
  --surface-2: #161d27;
  --surface-3: #1c2430;
  --line: #232c39;
  --line-soft: #1a222d;
  --txt: #e8eef6;
  --txt-dim: #9aa8ba;
  --txt-faint: #6b7a8d;
  --brand: #e50914;
  --brand-2: #ff2d3a;
  --blue: #2b62ff;
  --green: #22c55e;
  --amber: #f5a524;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: #7ba2ff; text-decoration: none; }
a:hover { color: #a5c0ff; }
h1, h2, h3 { letter-spacing: -.022em; margin: 0; font-weight: 650; }
h1 { font-size: 25px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .93em; }
::selection { background: rgba(229,9,20,.35); }

/* ---------------------------------------------------------------- layout */
body.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px;
  background: linear-gradient(180deg, #0c1118 0%, #080a0e 100%);
  border-right: 1px solid var(--line-soft);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px; font-size: 16px; font-weight: 750; color: #fff;
  letter-spacing: -.03em;
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
  box-shadow: 0 4px 14px -4px rgba(229,9,20,.7);
}
.brand em { font-style: normal; color: var(--txt-dim); font-weight: 500; }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--txt-faint); padding: 10px 10px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 11px; border-radius: 10px;
  color: var(--txt-dim); font-size: 14.5px; font-weight: 550;
  transition: background .14s ease, color .14s ease;
}
.nav-item svg { width: 18px; height: 18px; opacity: .85; flex: 0 0 auto; }
.nav-item:hover { background: var(--surface-2); color: var(--txt); }
.nav-item.active { background: var(--surface-3); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.nav-item.active svg { opacity: 1; color: var(--brand-2); }
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-top: 1px solid var(--line-soft);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: var(--surface-3); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--txt-dim);
  text-transform: uppercase;
}
.who { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.role { font-size: 11.5px; color: var(--txt-faint); }
.icon-btn {
  margin-left: auto; width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--txt-faint);
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--txt); border-color: var(--line); }
.icon-btn svg { width: 17px; height: 17px; }

.main { min-width: 0; padding: 0 0 90px; }
.topbar {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 26px 30px 18px; max-width: 1180px;
}
.topbar .sub { color: var(--txt-dim); font-size: 13.5px; margin-top: 4px; }
.topbar-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }
.content { padding: 0 30px 40px; max-width: 1180px; }

.tabbar { display: none; }

@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 18px 16px 12px; }
  h1 { font-size: 21px; }
  .content { padding: 0 16px 30px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: rgba(10,13,18,.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border-radius: 10px; color: var(--txt-faint); font-size: 10.5px; font-weight: 600;
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: #fff; background: var(--surface-2); }
  .tabbar a.active svg { color: var(--brand-2); }
}

/* ---------------------------------------------------------------- banners */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 12px; padding: 11px 14px; margin-bottom: 16px;
  font-size: 13.5px; border: 1px solid var(--line); background: var(--surface);
  color: var(--txt-dim);
}
.banner svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.banner.demo { border-color: #4a3a10; background: #1d1705; color: #f2cd7a; }
.banner.error { border-color: #5d1f21; background: #200e10; color: #ff9ea3; }
.banner.ok { border-color: #1c4a2d; background: #0a1c12; color: #86e0a8; }

/* ---------------------------------------------------------------- stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px;
}
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 14px 15px; position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
}
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--txt-faint); font-weight: 700; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--txt-faint); font-weight: 500; letter-spacing: 0; }
.stat.warn .v { color: var(--amber); }
.stat.bad .v { color: #ff7b81; }

/* ---------------------------------------------------------------- toolbar */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px;
}
.search { position: relative; flex: 1; min-width: 210px; }
.search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--txt-faint); pointer-events: none;
}
.search input { padding-left: 38px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); color: var(--txt-dim); background: transparent;
}
.filter:hover { background: var(--surface-2); color: var(--txt); }
.filter.on { background: var(--surface-3); color: #fff; border-color: #2f3a49; }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px;
}
a.card { display: block; color: inherit; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
a.card:hover { transform: translateY(-2px); border-color: #33404f; background: var(--surface-2); }
.card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.card-title { font-weight: 650; font-size: 15px; line-height: 1.25; }
.card-meta { font-size: 12.5px; color: var(--txt-dim); }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

.svc {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff;
  letter-spacing: -.02em;
}
.svc.netflix { background: linear-gradient(150deg, #ff2d3a, #b00710); box-shadow: 0 5px 16px -6px rgba(229,9,20,.9); }
.svc.disney { background: linear-gradient(150deg, #3a70ff, #1030b0); box-shadow: 0 5px 16px -6px rgba(43,98,255,.85); }
.svc.otro { background: linear-gradient(150deg, #55637a, #333d4d); }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 15px; }
label.lbl {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--txt-dim);
  margin-bottom: 6px; letter-spacing: .01em;
}
label.lbl span { font-weight: 500; color: var(--txt-faint); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 15.5px; color: var(--txt);
  background: #0b0f15; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; outline: none;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
input::placeholder, textarea::placeholder { color: #55616f; }
input:focus, select:focus, textarea:focus {
  border-color: #3a5bd9; box-shadow: 0 0 0 3px rgba(58,91,217,.16); background: #0c1118;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--txt-faint) 50%), linear-gradient(135deg, var(--txt-faint) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 82px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--txt-faint); margin-top: 6px; line-height: 1.5; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .two { grid-template-columns: 1fr; } }
.form-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14.5px; font-weight: 600; white-space: nowrap;
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--txt);
  transition: filter .14s ease, transform .06s ease, background .14s ease, border-color .14s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.14); color: var(--txt); }
.btn:active { transform: scale(.985); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(160deg, var(--brand-2), #c00510);
  border-color: #b90712; color: #fff;
  box-shadow: 0 8px 22px -12px rgba(229,9,20,.95);
}
.btn.blue { background: linear-gradient(160deg, #3a70ff, #1f4bd8); border-color: #2450d6; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: #1b0d10; border-color: #5b1a1f; color: #ff9ba1; }
.btn.small { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.big { width: 100%; padding: 17px 20px; font-size: 16.5px; border-radius: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; padding: 3.5px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--txt-dim); background: var(--surface-2);
  white-space: nowrap;
}
.pill.good { border-color: #1d4a30; background: #0a1d13; color: #7fdfa4; }
.pill.warn { border-color: #4f3d10; background: #1d1705; color: #f0c76a; }
.pill.bad  { border-color: #572025; background: #1e0f11; color: #ff9ea3; }
.pill.mono { font-family: var(--mono); }

/* ---------------------------------------------------------------- code panel */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(229,9,20,.16), transparent 55%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 18px; }
@media (max-width: 620px) { .steps { grid-template-columns: 1fr; } }
.step {
  display: flex; gap: 9px; align-items: flex-start;
  background: rgba(255,255,255,.028); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 10px 11px;
}
.step .n {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  background: var(--surface-3); color: var(--txt-dim);
  font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}
.step .t { font-size: 12.5px; color: var(--txt-dim); line-height: 1.45; }
.step .t b { color: var(--txt); font-weight: 600; }

.codebox {
  margin-top: 16px; border-radius: 14px; padding: 22px 18px; text-align: center;
  border: 1px solid var(--line); background: #080c11;
}
.codebox.ok {
  border-color: #1f5b39;
  background: radial-gradient(90% 120% at 50% 0%, rgba(34,197,94,.13), transparent 70%), #080f0c;
  box-shadow: 0 0 0 1px rgba(34,197,94,.1), 0 20px 50px -30px rgba(34,197,94,.5);
}
.codebox.error { border-color: #5b2126; background: #150c0e; }
.code-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--txt-faint); font-weight: 700; }
.code {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(38px, 13vw, 58px); font-weight: 700; letter-spacing: .14em;
  line-height: 1.05; margin: 8px 0 14px; color: #fff; user-select: all; word-break: break-all;
  text-shadow: 0 0 38px rgba(255,255,255,.16);
}
.codeMeta { font-size: 12.5px; color: var(--txt-faint); margin-top: 14px; line-height: 1.6; }
.spinner {
  width: 17px; height: 17px; border-radius: 50%; flex: 0 0 auto;
  border: 2.4px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .75s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- list rows */
.rows { display: flex; flex-direction: column; gap: 9px; }
.row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 12px 14px;
}
.row .grow { flex: 1; min-width: 150px; }
.row .t { font-weight: 600; font-size: 14.5px; }
.row .s { font-size: 12.5px; color: var(--txt-dim); }

.section-head {
  display: flex; align-items: center; gap: 10px; margin: 28px 0 12px;
}
.section-head h2 { font-size: 16px; }
.section-head .actions { margin-left: auto; display: flex; gap: 8px; }

details.acc { border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); }
details.acc > summary {
  cursor: pointer; padding: 12px 14px; font-size: 13.5px; color: var(--txt-dim);
  font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before { content: "▸"; color: var(--txt-faint); font-size: 11px; }
details.acc[open] > summary::before { content: "▾"; }
details.acc > summary:hover { color: var(--txt); }
details.acc .body { padding: 4px 14px 16px; border-top: 1px solid var(--line-soft); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--txt-faint); font-weight: 700; }
tbody tr:hover { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); }

/* ---------------------------------------------------------------- login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 22px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 30px 26px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }
.login-title { text-align: center; font-size: 20px; margin-top: 14px; }
.login-sub { text-align: center; color: var(--txt-dim); font-size: 13.5px; margin: 5px 0 24px; }

.empty {
  text-align: center; padding: 46px 20px; border: 1px dashed var(--line);
  border-radius: var(--radius); background: var(--surface);
}
.empty .ico { font-size: 34px; opacity: .9; }
.empty h2 { margin: 12px 0 6px; }
.empty p { color: var(--txt-dim); font-size: 13.5px; max-width: 420px; margin: 0 auto 18px; }

.footer-note { text-align: center; color: var(--txt-faint); font-size: 11.5px; margin-top: 34px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fade { animation: fadein .28s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- ajustes finos */
.search input[type=text] { padding-left: 38px; }

/* barra inferior móvil: todos los items iguales, incluido el botón de salir */
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border-radius: 10px; color: var(--txt-faint);
  font: inherit; font-size: 10.5px; font-weight: 600; background: none; border: none;
  cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.tabbar .tab svg { width: 20px; height: 20px; }
.tabbar .tab.active { color: #fff; background: var(--surface-2); }
.tabbar .tab.active svg { color: var(--brand-2); }

/* perfiles: la edición se despliega debajo, nunca por encima */
.profile {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 12px; overflow: hidden;
}
.profile .row { border: none; border-radius: 0; background: transparent; }
.profile-edit { border-top: 1px solid var(--line-soft); padding: 14px; background: var(--surface-2); }
.profile-edit .two { gap: 12px; }

/* ==========================================================================
   Portal del cliente
   ========================================================================== */
body.portal { display: block; background: var(--bg); }
.portal-top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8,10,14,.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.portal-top-in {
  max-width: 840px; margin: 0 auto; padding: 11px 18px;
  display: flex; align-items: center; gap: 12px;
}
.portal-top .brand { padding: 0; }
.portal-user { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.portal-main { max-width: 840px; margin: 0 auto; padding: 24px 18px 70px; }
@media (max-width: 560px) {
  .portal-main { padding: 18px 14px 60px; }
  .portal-top-in { padding: 10px 14px; }
}
