:root {
  --ink: #090B0D; --brand: #9BFB02; --brand-ink: #3D6B00;
  --text: #16181C; --muted: #6B7079; --soft: #F6F6F4; --line: #E6E6E3; --line-strong: #CFCFCB;
  --bg: #FFFFFF; --page: #FAFAF8;
  --ok-bg: #ECF8E6; --ok: #2F6B12; --warn-bg: #FFF5E0; --warn: #8A5A00; --bad-bg: #FEF0EF; --bad: #B42318;
  --r: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--text);
  font: 15px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; color: var(--ink); line-height: 1.2; }
h2 { font-size: 15px; margin: 0; color: var(--ink); }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--ink); }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .block { display: block; }
.nowrap { white-space: nowrap; } .spacer { flex: 1; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 600; margin: 0 0 6px; }

.boot { min-height: 100vh; display: grid; place-items: center; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: border-color .15s, opacity .15s; }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding: 13px; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: default; }
.link { font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 600; }
.link:hover { color: var(--ink); }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { height: 40px; margin-bottom: 36px; }
.auth h1 { margin-bottom: 8px; }
.auth .muted { margin: 0 0 24px; }

/* Formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea, .filters select {
  font: inherit; font-weight: 400; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, .filters select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.field input[readonly] { background: var(--soft); color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0 10px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }

/* Cabecera */
.demo-bar { background: var(--ink); color: #fff; font-size: 12px; text-align: center; padding: 7px 12px; }
.demo-bar button { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0 4px; }
.demo-bar button.on { color: #fff; text-decoration: none; }
.top { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 28px; }
.brand img { height: 30px; display: block; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a:hover { color: var(--ink); background: var(--soft); }
.tabs a.on { color: var(--ink); background: var(--soft); }
.user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-name small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }

/* Página */
.page { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; }
.month { font-weight: 600; min-width: 140px; text-align: center; }
.loading, .empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty.sm { padding: 24px 12px; font-size: 14px; }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; }

/* Tarjeta de enlace */
.linkcard { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px;
  background: var(--ink); color: #fff; border-radius: var(--r); margin-bottom: 16px; flex-wrap: wrap; }
.linkcard .eyebrow { color: var(--brand); }
.linkcard .muted { color: #A3A8B0; margin: 4px 0 0; }
.link-url { font-size: 18px; font-weight: 700; margin: 0; word-break: break-all; }
.link-actions { display: flex; gap: 8px; }
.linkcard .btn.primary { background: var(--brand); color: var(--ink); border-color: var(--brand); }
.linkcard .btn:not(.primary) { background: transparent; color: #fff; border-color: #3A3D44; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 4px; }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi-v { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.kpi-s { font-size: 12px; color: var(--muted); }

.goal { margin-top: 16px; }
.goal-top { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; box-shadow: inset 0 0 0 1px rgba(9,11,13,.08); }
.goal .muted { margin: 10px 0 0; }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li > div:first-child { display: grid; min-width: 0; }
.list .right { display: flex; align-items: center; gap: 10px; text-align: right; }
.board .who { display: flex !important; align-items: center; gap: 10px; }
.board li.me { background: linear-gradient(90deg, rgba(155,251,2,.14), transparent); margin: 0 -20px; padding: 12px 20px; }
.medal { width: 26px; text-align: center; font-size: 18px; }
.pos { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--soft); font-size: 12px; font-weight: 700; color: var(--muted); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.mute { background: var(--soft); color: var(--muted); }

/* Ventas */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { width: auto; font-size: 14px; padding: 8px 10px; }
.sum { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.sum strong { color: var(--ink); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tr.off td { opacity: .5; }

/* Recursos */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.seg button span { font-weight: 500; opacity: .6; margin-left: 2px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.res { display: flex; flex-direction: column; }
.res-body { color: var(--text); font-size: 14px; flex: 1; }
.res-foot { display: flex; gap: 6px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Ranking */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 8px 0 20px; }
.pod { width: 170px; display: grid; justify-items: center; gap: 2px; text-align: center; }
.pod strong { font-size: 14px; color: var(--ink); } .pod > span:not(.pod-medal) { font-size: 13px; color: var(--muted); }
.pod-medal { font-size: 28px; }
.pod-step { width: 100%; margin-top: 8px; border-radius: 10px 10px 0 0; background: var(--soft); border: 1px solid var(--line); border-bottom: 0;
  display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--muted); }
.pod.p1 .pod-step { height: 110px; background: var(--ink); color: var(--brand); border-color: var(--ink); }
.pod.p2 .pod-step { height: 80px; } .pod.p3 .pod-step { height: 60px; }

/* Modal y toast */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100% - 24px)); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal::backdrop { background: rgba(9,11,13,.45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px 22px 6px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); }

@media (max-width: 860px) {
  .top-in { gap: 12px; height: auto; padding: 12px 16px; flex-wrap: wrap; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .user-name { display: none; }
  .user { margin-left: auto; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .page { padding: 24px 16px 48px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .linkcard { padding: 18px; }
  .link-url { font-size: 15px; }
  .pod { width: 31%; }
}

/* Login + 2FA */
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13px; flex-wrap: wrap; }
.auth-links a { color: var(--muted); text-decoration: none; }
.auth-links a:hover { color: var(--ink); text-decoration: underline; }
.steps { padding-left: 18px; margin: 0 0 12px; font-size: 14px; color: var(--text); }
.steps li { margin-bottom: 6px; }
.qr { display: grid; place-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 12px; background: #fff; }
.secret { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.secret code { display: block; margin-top: 6px; padding: 8px 10px; background: var(--soft); border-radius: 8px; word-break: break-all; color: var(--ink); }
input.code { width: 100%; font: inherit; font-size: 26px; letter-spacing: .4em; text-align: center; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 12px; }
input.code:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* ===================== DIOS: layout con barra lateral ===================== */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #C9CDD2; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; text-decoration: none; }
.side-brand img { height: 34px; background: #fff; padding: 6px 10px; border-radius: 10px; }
.side-brand b { font-size: 11px; letter-spacing: .18em; color: var(--brand); border: 1px solid #2A2E33; padding: 2px 7px; border-radius: 6px; }
.side nav { display: grid; gap: 2px; }
.side .sec { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #6E747B; padding: 16px 12px 6px; font-weight: 700; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #C9CDD2; text-decoration: none; font-size: 14px; font-weight: 600; }
.side nav a:hover { background: #15181C; color: #fff; }
.side nav a.on { background: #1B1F24; color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.side nav a .ic { width: 18px; text-align: center; opacity: .9; }
.side nav a .badge { margin-left: auto; background: var(--brand); color: var(--ink); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.side nav a .badge.bad { background: #F04438; color: #fff; }
.side-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid #1E2227; display: flex; align-items: center; gap: 10px; }
.side-foot .avatar { background: var(--brand); color: var(--ink); }
.side-foot small { display: block; color: #6E747B; font-size: 11px; }
.side-foot .btn { margin-left: auto; color: #C9CDD2; }
.side-foot .btn:hover { background: #15181C; }
.main { min-width: 0; }
.main .page { max-width: 1180px; }
.mtop { display: none; }

.page-head h1 { font-size: 28px; }
.page-head p { margin: 6px 0 0; }
.kpis.k6 { grid-template-columns: repeat(3, 1fr); }
.kpi.dark { background: var(--ink); border-color: var(--ink); }
.kpi.dark .kpi-l, .kpi.dark .kpi-s { color: #A3A8B0; } .kpi.dark .kpi-v { color: var(--brand); }
.kpi a { color: inherit; }
.alerts { display: grid; gap: 8px; margin: 16px 0; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 14px; border: 1px solid var(--line); background: var(--bg); }
.alert.bad { background: var(--bad-bg); border-color: #F8D3CF; color: var(--bad); }
.alert.warn { background: var(--warn-bg); border-color: #F5DFB0; color: var(--warn); }
.alert.ok { background: var(--ok-bg); border-color: #CDEBBE; color: var(--ok); }
.alert a { margin-left: auto; font-weight: 700; color: inherit; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.chart div { flex: 1; background: var(--ink); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart div:hover { background: var(--brand); }
.chart div:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; font: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.toolbar input[type=search]:focus { outline: none; border-color: var(--ink); }
.toolbar select { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: #FBFBF9; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.sub { display: block; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot.ok { background: #32D583; box-shadow: 0 0 0 3px rgba(50,213,131,.18); } .dot.bad { background: #F04438; box-shadow: 0 0 0 3px rgba(240,68,56,.18); }
.dot.mute { background: var(--line-strong); }
.dom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.dom h3 { display: flex; align-items: center; margin: 0 0 10px; font-size: 15px; }
.dom dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.dom dt { color: var(--muted); } .dom dd { margin: 0; word-break: break-all; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.lnk { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); text-decoration: none; transition: border-color .15s, transform .15s; }
.lnk:hover { border-color: var(--ink); transform: translateY(-1px); }
.lnk .fav { width: 32px; height: 32px; border-radius: 8px; background: var(--soft); display: grid; place-items: center; overflow: hidden; flex: none; }
.lnk .fav img { width: 18px; height: 18px; }
.lnk strong { display: block; font-size: 14px; color: var(--ink); } .lnk span { font-size: 12px; color: var(--muted); word-break: break-all; }
.group-t { margin: 22px 0 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
textarea.json { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; min-height: 220px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 500; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(9,11,13,.45); }
  .mtop { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--ink); position: sticky; top: 0; z-index: 30; }
  .mtop img { height: 28px; background: #fff; padding: 4px 8px; border-radius: 8px; }
  .mtop button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 0 4px; }
  .kpis.k6 { grid-template-columns: 1fr 1fr; }
  .set-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
}

.page-head select { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.kpi.dark .kpi-v { color: var(--brand); }
