/* Panel Reseller · negro, blanco y escala de grises. Color solo para estados.
   Fondo gris suave para separar las tarjetas blancas; texto con contraste alto; menú lateral negro. */
:root {
  --bg: #f3f3f2; --card: #ffffff; --soft: #f7f7f6; --hover: #f0f0ef;
  --ink: #111111; --ink-2: #3d3d3b; --muted: #61615e; --faint: #8a8a86;
  --line: #e2e2df; --line-2: #cfcfcb;
  --side: #0f0f0f; --side-2: #1c1c1b; --side-ink: #f2f2f0; --side-muted: #a3a3a0;
  --ok: #146c3a; --ok-bg: #e4f3ea; --bad: #b42318; --bad-bg: #fde8e6; --warn: #8a5a00; --warn-bg: #fdf1d6; --info: #1f4f8f; --info-bg: #e7eefa; --neutral: #4a4a47; --neutral-bg: #ececea;
  --radius: 10px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 1px 3px rgb(0 0 0 / .04);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; text-wrap: balance; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.txt-bad { color: var(--bad) !important; }
small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }

/* ---------- Marca ---------- */
.wordmark { display: inline-grid; line-height: 1; }
.wordmark b { font-size: 17px; font-weight: 800; letter-spacing: .04em; }
.wordmark span { font-size: 9px; font-weight: 600; letter-spacing: .5em; margin-top: 4px; opacity: .75; }
.wordmark.big b { font-size: clamp(46px, 6vw, 72px); letter-spacing: -.02em; }
.wordmark.big span { font-size: clamp(13px, 1.6vw, 18px); letter-spacing: .6em; margin-top: 10px; }

/* ---------- Acceso ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand { background: var(--side); color: var(--side-ink); display: grid; align-content: center; gap: 26px; padding: 56px clamp(28px, 6vw, 88px); }
.auth-brand p { color: var(--side-muted); font-size: 17px; max-width: 34ch; }
.auth-points { list-style: none; padding: 0; display: grid; gap: 10px; color: var(--side-ink); }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--side-ink); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 23px; }
.switch { color: var(--muted); font-size: 14px; }
.link { background: none; border: 0; padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; position: relative; }
.field label, .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field label small { display: inline; font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea, .search, .mini-in, select.mini {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); padding: 0 12px; height: 42px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
.field input[type=file] { height: auto; padding: 9px 12px; background: var(--soft); }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus, .mini-in:focus, select.mini:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(17 17 17 / .1); }
.mini-in, select.mini { height: 34px; width: auto; min-width: 0; padding: 0 10px; }
.mini-in.num { width: 110px; text-align: right; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.checks { display: grid; gap: 6px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--soft); }
.checks .check b { margin-left: auto; }
.hint { color: var(--muted); font-size: 12.5px; }
.err { color: var(--bad); font-size: 13.5px; font-weight: 500; }
details.more { border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; background: var(--soft); }
details.more summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 13.5px; }
details.more[open] { padding-bottom: 14px; }
.suggest { position: absolute; z-index: 5; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 12px 28px rgb(0 0 0 / .12); }
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest li:hover { background: var(--hover); }

/* ---------- Botones ---------- */
.btn { height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { background: #2b2b2a; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--hover); border-color: var(--faint); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.ok:hover { background: #0f5a30; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #961d13; }
.btn.wa { background: #128c4b; border-color: #128c4b; letter-spacing: .02em; }
.btn.wa:hover { background: #0e7a40; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-sm { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.link-sm:hover { color: var(--ink); }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 18px; border-bottom: 1px solid var(--side-2); }
.side-x { display: none; background: none; border: 0; color: var(--side-ink); font-size: 26px; line-height: 1; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: grid; align-content: start; gap: 2px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; color: var(--side-muted); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.side-nav a:hover { background: var(--side-2); color: var(--side-ink); }
.side-nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.side-nav .badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-user { font-size: 13px; }
.side-user b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.side-user small { color: var(--side-muted); margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.side-bg { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgb(243 243 242 / .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; margin-left: -6px; }
.menu-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.bell { margin-left: auto; position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: var(--ink); }
.bell:hover { background: var(--hover); }
.bell .ico { width: 19px; height: 19px; }
.bell .dot { position: absolute; top: 3px; right: 2px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 5px; line-height: 1.4; }
.view { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 28px 72px; display: grid; gap: 20px; align-content: start; }

/* ---------- Encabezados y tarjetas ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; line-height: 1.2; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.panel.narrow { max-width: 680px; width: 100%; }
.panel > h2 { font-size: 16px; margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; }
.panel-extra { color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2.start { align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.sub-h { font-size: 12px; color: var(--muted); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; margin: 18px 0 8px; }
.empty { color: var(--muted); padding: 18px 0; }
.foot { margin-top: 18px; }
.notice { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: 8px; padding: 11px 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notice.warn { border-left-color: #d29a14; background: #fffaf0; }
.notice.bad { border-left-color: var(--bad); background: #fff6f5; }
.notice.ok { border-left-color: var(--ok); background: #f4fbf7; }
.alerts { display: grid; gap: 8px; }
.sync-line { color: var(--muted); font-size: 13px; margin-top: -8px; }
.big-n { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; box-shadow: var(--shadow); text-decoration: none; min-width: 0; position: relative; }
a.kpi:hover { border-color: var(--line-2); background: var(--soft); }
.kpi-l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-v { font-size: 25px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.kpi-v .pill { font-size: 13px; }
.kpi-s { color: var(--muted); font-size: 12.5px; }
.kpi.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.dark .kpi-l, .kpi.dark .kpi-s { color: #c9c9c6; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.kpi.ok::before { background: var(--ok); } .kpi.bad::before { background: var(--bad); } .kpi.warn::before { background: #d29a14; } .kpi.info::before { background: var(--info); }

/* ---------- Estados ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.sm { font-size: 11px; padding: 1px 7px; }
.pill.ok { color: var(--ok); background: var(--ok-bg); } .pill.bad { color: var(--bad); background: var(--bad-bg); } .pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.info { color: var(--info); background: var(--info-bg); } .pill.neutral { color: var(--neutral); background: var(--neutral-bg); }

/* ---------- Tablas ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.tbl th:first-child { border-radius: 6px 0 0 0; } .tbl th:last-child { border-radius: 0 6px 0 0; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--soft); }
.tbl .r { text-align: right; }
.tbl td.num, .tbl td.r { white-space: nowrap; }
.tbl b { font-weight: 600; }
.tbl .ck-col { width: 32px; }
.tbl .ck { width: 16px; height: 16px; accent-color: var(--ink); }
.search { max-width: 340px; height: 36px; }
.panel > .search { margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.filters a { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 99px; color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 500; background: var(--card); }
.filters a:hover { background: var(--hover); }
.filters a[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters .num { opacity: .7; }
.filters .search { margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; justify-self: start; }
.seg a { padding: 7px 14px; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg a[aria-selected="true"] { background: var(--ink); color: #fff; }
.bulk { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }
.bulk .mini-in { flex: 1; min-width: 180px; }
.exports { margin-top: -6px; }

/* ---------- Listas ---------- */
.rows div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-top: 1px solid var(--line); }
.rows div:first-child { border-top: 0; }
.rows dt { color: var(--muted); flex: none; }
.rows dd { text-align: right; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.rows div.block { display: grid; gap: 4px; }
.rows div.block dd { text-align: left; font-weight: 400; }
.plain { list-style: none; padding: 0; }
.plain li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.plain li:first-child { border-top: 0; }
.plain li > span:first-child { flex: 1; min-width: 0; }
.plain li.off { opacity: .55; }
.feed { list-style: none; padding: 0; }
.feed li { border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed a, .feed li > span { display: block; padding: 11px 0; text-decoration: none; }
.feed li.new a { font-weight: 600; }
.feed li.new a::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-right: 8px; vertical-align: middle; }
.timeline { list-style: none; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); }
.timeline b { font-weight: 600; font-size: 13.5px; }
.timeline code { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.steps { display: grid; gap: 10px; padding-left: 20px; color: var(--ink-2); }
.steps b { color: var(--ink); }
.alert-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.alert-list li { display: flex; gap: 10px; align-items: baseline; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.alert-list li.alerta { border-left: 4px solid var(--bad); }
.alert-list li.pendiente { border-left: 4px solid #d29a14; }
.alert-list a { flex: 1; text-decoration: none; font-weight: 500; min-width: 200px; }
.alert-list a:hover { text-decoration: underline; }
.claims { list-style: none; padding: 0; display: grid; gap: 14px; }
.claims li { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 6px; }
.claim-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.note { background: var(--soft); border-left: 3px solid var(--ink); padding: 8px 10px; font-size: 13.5px; border-radius: 0 6px 6px 0; }
.add-ev { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.add-ev input { font-size: 12.5px; max-width: 100%; }

/* ---------- Evidencias ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: 72px; height: 72px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--soft); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs.big .thumb { width: 150px; height: auto; aspect-ratio: auto; display: grid; grid-template-rows: 150px auto; }
.thumbs.big .thumb img, .thumbs.big .thumb span { height: 150px; display: grid; place-items: center; }
.thumbs.big .thumb small { padding: 4px; margin: 0; }
.thumb:hover { border-color: var(--ink); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgb(10 10 10 / .55); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--card); border-radius: 14px; padding: 26px; width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow: auto; display: grid; gap: 14px; position: relative; box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
.modal.wide { width: min(1100px, 100%); padding: 16px; }
.modal h2 { font-size: 19px; padding-right: 30px; }
.modal .btns { justify-content: flex-end; }
.modal-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); }
.zoom { max-width: 100%; max-height: calc(100dvh - 90px); margin: 0 auto; display: block; border-radius: 6px; }
.viewer { width: 100%; height: calc(100dvh - 100px); border: 0; }

/* ---------- Gráficos y progreso ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font: 500 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .base { stroke: var(--line-2); }
.chart .bar { fill: var(--ink); }
.chart .col:hover .bar { fill: #4a4a47; }
.chart .hit { fill: transparent; }
.chart .line { fill: none; stroke: #d29a14; stroke-width: 2.2; stroke-linejoin: round; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.bar { background: var(--ink); } .sw.line { height: 3px; background: #d29a14; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 6px; padding: 6px 10px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 3; }
.progress { width: 100%; height: 8px; display: block; }
.progress .bg { fill: var(--neutral-bg); } .progress .fg { fill: var(--ink); } .progress .fg.done { fill: var(--ok); }
.goal { display: grid; gap: 10px; }
.goal-n { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.goal-n b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.goal-n span { color: var(--muted); }
.goal.big .goal-n b { font-size: 34px; }

#toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 8px; z-index: 60; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgb(0 0 0 / .25); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100dvh; }
  .side.open { transform: none; }
  .side-x { display: block; }
  .side-bg.open { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 30; }
  .menu-btn { display: block; }
  .topbar { padding: 0 16px; }
  .view { padding: 20px 16px 64px; gap: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 40px 24px; gap: 16px; }
  .auth-points { display: none; }
}
@media (max-width: 640px) {
  .page-head h1 { font-size: 21px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-v { font-size: 19px; }
  .panel { padding: 16px; }
  .two { grid-template-columns: 1fr; }
  .tbl-wrap { margin: 0; padding: 0; overflow: visible; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; margin-bottom: 10px; }
  .tbl td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl td::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .tbl td[data-l=""]::before { content: none; }
  .tbl td > small, .tbl td > b { text-align: right; }
  .tbl td.r { text-align: right; }
  .filters .search { margin-left: 0; max-width: none; }
  .search { max-width: none; }
  .bulk .mini-in { min-width: 100%; }
  .thumbs.big .thumb { width: calc(50% - 4px); }
  .auth-card { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.cv { min-width: 0; }
.panel .form + .form, .panel .hint + .form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.panel .btns + .hint { margin-top: 8px; }
.tbl td .cv { min-width: 0; }
@media (max-width: 640px) { .tbl td .cv { text-align: right; } }

/* Selector de período */
.period { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period button { height: 34px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--card); font-size: 13px; font-weight: 500; color: var(--ink-2); border-radius: 0; margin-left: -1px; }
.period button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.period button[data-p=custom] { border-radius: 0 8px 8px 0; }
.period button:hover { background: var(--hover); }
.period button.on { background: var(--ink); border-color: var(--ink); color: #fff; position: relative; z-index: 1; }
.period { gap: 0; }
.period .custom { display: inline-flex; gap: 6px; margin-left: 8px; }
.period .custom input { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 8px; background: var(--card); }
@media (max-width: 640px) { .period .custom { margin: 8px 0 0; width: 100%; } .period button { flex: 1; padding: 0 6px; } }

/* Menú del usuario: botón abajo de la barra lateral con desplegable hacia arriba */
.user-menu { position: relative; border-top: 1px solid var(--side-2); padding: 8px; }
.side-user { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--side-ink); text-align: left; }
.side-user:hover, .side-user[aria-expanded="true"] { background: var(--side-2); }
.side-user .who { flex: 1; min-width: 0; }
.side-user .chev { width: 16px; height: 16px; fill: none; stroke: var(--side-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.side-user[aria-expanded="true"] .chev { transform: rotate(180deg); }
.user-pop { position: absolute; left: 8px; right: 8px; bottom: calc(100% - 2px); background: #232322; border: 1px solid #343432; border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgb(0 0 0 / .45); display: grid; gap: 1px; z-index: 5; }
.user-pop-mail { color: var(--side-muted); font-size: 12.5px; padding: 8px 10px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pop a, .user-pop button { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 7px; color: var(--side-ink); text-decoration: none; font-size: 14px; border: 0; background: none; width: 100%; text-align: left; }
.user-pop a:hover, .user-pop button:hover { background: #333331; }
.user-pop .badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.user-pop hr { border: 0; border-top: 1px solid #343432; margin: 4px 2px; }
.auth-blank { min-height: 100dvh; background: var(--side); }

/* Escalas de comisión */
.tiers { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tiers li { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; background: var(--card); min-width: 92px; }
.tiers li b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tiers li small { margin: 0; }
.tiers li.done { border-color: var(--ok); background: var(--ok-bg); }
.tiers li.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.tiers li.on small { color: #c9c9c6; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.tier-editor { display: grid; gap: 8px; }
.nw { white-space: nowrap; }
.wa-link { color: #0e7a40; font-weight: 600; text-decoration: none; white-space: nowrap; }
.wa-link::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #25d366; margin-right: 6px; vertical-align: 1px; }
.wa-link:hover { text-decoration: underline; }
.btns.spaced { margin-top: 16px; }
.btn.danger-txt { color: var(--bad); }
.codigo { font-size: 30px; font-weight: 800; letter-spacing: .18em; text-align: center; padding: 14px; background: var(--soft); border: 1px dashed var(--line-2); border-radius: 10px; user-select: all; }
