: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%; }
}
