/* =========================================================
   Impulsa PYME — estructura del panel (vendedor y comprador)
   Requiere assets/styles.css
   ========================================================= */
body { font-size: 14px; }
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* ---------- Barra lateral ---------- */
.sb { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(5, 7, 6, 0.78); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.sb-top { padding: 18px 16px 12px; display: grid; gap: 14px; }
.store-switch { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.02); text-align: left; width: 100%; }
.store-switch:hover { border-color: var(--line-2); }
.store-switch .avatar { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.store-switch b { font-weight: 500; font-size: 13.5px; display: block; line-height: 1.3; }
.store-switch span { font-size: 11.5px; color: var(--dim); }
.store-switch > svg { width: 16px; height: 16px; color: var(--dim); margin-left: auto; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.sb-group { margin-top: 6px; }
.sb-group summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 6px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); }
.sb-group summary::-webkit-details-marker { display: none; }
.sb-group summary svg { width: 13px; height: 13px; transition: transform .2s; }
.sb-group[open] summary svg { transform: rotate(180deg); }
.sb-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: 13.5px; transition: background .15s, color .15s; position: relative; }
.sb-link svg { width: 17px; height: 17px; flex: none; }
.sb-link:hover { background: rgba(255,255,255,.04); color: var(--text); }
.sb-link[aria-current="page"] { background: rgba(var(--accent-rgb), .09); color: var(--accent); }
.sb-link[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-link[aria-current="page"] svg { color: var(--accent); }
.sb-link .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; display: grid; place-items: center; background: var(--lime); color: var(--ink); }
.sb-link .count.soft { background: rgba(255,255,255,.08); color: var(--muted); }
.sb-link .ai { margin-left: auto; color: var(--accent); width: 14px; height: 14px; }
.sb-foot { padding: 14px 16px 18px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.ai-meter { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.02); display: grid; gap: 10px; }
.ai-meter .row-between { font-size: 12.5px; color: var(--muted); }
.ai-meter b { color: var(--text); font-weight: 500; }
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--jade), var(--accent)); }

/* ---------- Contenido ---------- */
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); background: rgba(2, 3, 2, 0.7); backdrop-filter: blur(16px); }
.cmdk { flex: 1; min-width: 0; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--dim); font-size: 13.5px; text-align: left; }
.cmdk:hover { border-color: var(--line-2); color: var(--muted); }
.cmdk svg { width: 16px; height: 16px; flex: none; }
.cmdk span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk kbd { margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); }
.topbar .spacer { flex: 1; }
.sb-toggle { display: none; }

.page { padding: clamp(20px, 3vw, 32px); display: grid; gap: 20px; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); letter-spacing: -.035em; }
.page-head p { color: var(--muted); margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.onboard { padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; }
.ring { width: 52px; height: 52px; }
.onboard-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.onboard-steps span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.onboard-steps span.done { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.2); }
.onboard-steps span.done svg { color: var(--accent); }
.onboard-steps span.next { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.onboard-steps svg { width: 13px; height: 13px; }
@media (max-width: 760px) { .onboard { grid-template-columns: auto 1fr; } .onboard > .btn { grid-column: 1 / -1; } }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 18px 20px; display: grid; gap: 6px; }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.kpi .label svg { width: 16px; height: 16px; color: var(--accent); }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.kpi .sub { font-size: 12.5px; color: var(--dim); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; color: var(--ok); }
.delta svg { width: 13px; height: 13px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr 1fr; } }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1180px) { .grid-2 { grid-template-columns: 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-3 { grid-template-columns: 1fr; } }
.box { padding: 20px; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.box-head h2 { font-size: 15.5px; letter-spacing: -.015em; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.box-head h2 svg { width: 17px; height: 17px; color: var(--accent); }
.box-head a { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.box-head a:hover { color: var(--text); }
.box-head a svg { width: 13px; height: 13px; }

/* Gráfico de barras */
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chart-head .big { font-size: 26px; font-weight: 600; letter-spacing: -.03em; }
.chart { position: relative; height: 230px; display: grid; grid-template-columns: 44px 1fr; }
.y-axis { position: relative; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.y-axis span { position: absolute; right: 10px; transform: translateY(50%); }
.plot { position: relative; border-bottom: 1px solid var(--line-2); }
.gridline { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.bars button { flex: 1; height: 100%; display: flex; align-items: flex-end; padding: 0; position: relative; }
.bars button i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: rgba(var(--jade-rgb), .5); transition: background .15s, box-shadow .15s; }
.bars button.today i { background: var(--accent); box-shadow: 0 0 18px -2px rgba(var(--accent-rgb), .7); }
.bars button:hover i, .bars button:focus-visible i { background: #e4fbb0; box-shadow: 0 0 18px -2px rgba(var(--jade-rgb), .8); }
.x-axis { display: flex; justify-content: space-between; padding: 8px 0 0 44px; font-size: 11px; color: var(--dim); }
.tip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 11px; border-radius: 10px; background: #101411; border: 1px solid var(--line-2); box-shadow: 0 12px 30px -10px rgba(0,0,0,.8); font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .12s; }
.tip b { display: block; font-size: 14px; font-weight: 600; }
.tip span { color: var(--muted); }
.tip.show { opacity: 1; }

/* Alertas */
.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.25); }
.alert > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert b { font-weight: 500; display: block; font-size: 13.5px; }
.alert span { font-size: 12.5px; color: var(--muted); }
.alert .btn { margin-left: auto; flex: none; }
.alert.danger > svg { color: var(--danger); }
.alert.warn > svg { color: var(--warn); }
.alert.info > svg { color: var(--info); }

/* Tabla de pedidos */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 680px; }
.tbl th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; white-space: nowrap; }
.tbl tbody tr { cursor: pointer; transition: background .15s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.025); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .mono { font-size: 12.5px; color: var(--muted); }
.tbl .cust { display: flex; align-items: center; gap: 10px; }
.tbl .cust .avatar { width: 28px; height: 28px; font-size: 10.5px; box-shadow: none; }
.tbl .cust b { font-weight: 500; display: block; line-height: 1.3; }
.tbl .cust span { font-size: 12px; color: var(--dim); }
.tbl .num { text-align: right; font-weight: 500; }
.filters-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filters-row .chip { height: 30px; font-size: 12.5px; padding: 0 12px; }

/* Asistente */
.assistant { background: linear-gradient(180deg, rgba(var(--accent-rgb),.07), rgba(255,255,255,.01) 50%); border-color: var(--accent-line); }
.todo { display: grid; gap: 8px; }
.todo label { display: flex; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.25); cursor: pointer; align-items: flex-start; transition: opacity .2s; }
.todo label:has(input:checked) { opacity: .45; }
.todo label:has(input:checked) b { text-decoration: line-through; }
.todo input { appearance: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; margin: 1px 0 0; display: grid; place-items: center; }
.todo input:checked { background: var(--accent); border-color: var(--accent); }
.todo input:checked::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.todo b { font-weight: 500; display: block; font-size: 13.5px; }
.todo span { font-size: 12.5px; color: var(--muted); }
.todo .why { font-size: 11.5px; color: var(--accent); margin-top: 4px; display: block; }
.ask { display: flex; gap: 8px; margin-top: 14px; }
.ask .input { height: 42px; font-size: 13.5px; }

/* Códigos */
.codes { display: grid; gap: 8px; }
.code-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25); }
.code-row .mono { font-size: 13px; letter-spacing: .04em; }
.code-row .meta { font-size: 11.5px; color: var(--dim); }
.code-row .switch { margin-left: auto; }
.code-row.off .mono { color: var(--dim); text-decoration: line-through; }

.top-products { display: grid; gap: 10px; }
.tp { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; }
.tp .p-thumb { border-radius: 10px; }
.tp b { font-weight: 500; font-size: 13.5px; display: block; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp .bar { margin-top: 6px; height: 4px; }
.tp .num { font-size: 13px; text-align: right; }
.tp .num span { display: block; font-size: 11px; color: var(--dim); }

.ads { display: grid; gap: 10px; }
.ads-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ads-kpis div { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25); display: grid; gap: 1px; }
.ads-kpis span { font-size: 11px; color: var(--dim); }
.ads-kpis b { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.ad-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.ad-row b { color: var(--text); font-weight: 500; }
.ad-row .tag { margin-left: auto; }

/* Detalle de pedido */
.od-body { display: grid; gap: 18px; padding: 18px 0; }
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 1px; background: var(--line-2); }
.tl-item.done:not(:last-child)::before { background: var(--accent-line); }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; background: var(--bg-2); }
.tl-item.done .tl-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tl-item.now .tl-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-dot svg { width: 12px; height: 12px; stroke-width: 2.6; }
.tl-item b { font-weight: 500; display: block; }
.tl-item span { font-size: 12.5px; color: var(--muted); }
.od-lines { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.od-lines div { display: flex; justify-content: space-between; padding: 11px 14px; font-size: 13.5px; }
.od-lines div + div { border-top: 1px solid var(--line); }
.od-lines .total { background: rgba(255,255,255,.03); font-weight: 600; }
.voucher-box { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--line); }
.voucher-box.ok { border-color: var(--accent-line); background: var(--accent-soft); }
.voucher-doc { width: 44px; height: 56px; border-radius: 8px; background: linear-gradient(170deg, #e9ecef, #bfc6c1); position: relative; flex: none; }
.voucher-doc::before { content: ""; position: absolute; inset: 10px 8px auto; height: 3px; border-radius: 2px; background: #7d55c7; box-shadow: 0 8px 0 #9aa19c, 0 15px 0 #9aa19c, 0 22px 0 #b5bbb7; }
.print-opts { display: flex; gap: 8px; flex-wrap: wrap; }

/* Paleta de comandos */
.cmd { position: fixed; inset: 0; z-index: 95; display: none; place-items: start center; padding-top: 12vh; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
.cmd.open { display: grid; }
.cmd-box { width: min(560px, calc(100% - 32px)); border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -20px rgba(0,0,0,.9); overflow: hidden; }
.cmd-box .input-icon .input { height: 54px; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); background: transparent; box-shadow: none; }
.cmd-list { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmd-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); }
.cmd-list a:hover, .cmd-list a.sel { background: rgba(255,255,255,.05); color: var(--text); }
.cmd-list a svg { width: 17px; height: 17px; }
.cmd-list .grp { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px 4px; }

.sb-scrim { display: none; }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sb { position: fixed; z-index: 70; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .4s var(--ease); }
  .sb.open { transform: none; box-shadow: 30px 0 80px rgba(0,0,0,.7); }
  .sb-toggle { display: inline-grid; }
  .sb-scrim { position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.5); display: none; }
  .sb.open + .sb-scrim { display: block; }
  .hide-sm { display: none !important; }
}

/* =========================================================
   Componentes de las secciones internas
   ========================================================= */
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--dim); margin-bottom: 8px; }
.crumb svg { width: 12px; height: 12px; }
.crumb a:hover { color: var(--text); }

/* Barra de herramientas sobre listas */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input-icon { flex: 1; min-width: 200px; }
.toolbar .input { height: 42px; }
.toolbar select.input { width: auto; }
.toolbar .chip { height: 34px; }

/* Pestañas subrayadas */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button, .tabbar a { padding: 11px 14px; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabbar button:hover, .tabbar a:hover { color: var(--text); }
.tabbar [aria-selected="true"], .tabbar [aria-current="page"] { color: var(--text); border-color: var(--accent); }
.tabbar .tag { font-size: 10.5px; padding: 0 6px; }

/* Tabla genérica: celdas */
.tbl .prod { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.tbl .prod .p-thumb { width: 44px; border-radius: 10px; flex: none; }
.tbl .prod b { font-weight: 500; display: block; line-height: 1.3; white-space: normal; }
.tbl .prod span { font-size: 12px; color: var(--dim); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl .muted-row td { opacity: .55; }
.tbl tbody tr.static { cursor: default; }
.tbl input[type="checkbox"] { margin: 0; }
.row-actions { display: inline-flex; gap: 4px; }
.row-actions .icon-btn { width: 32px; height: 32px; border-radius: 10px; }
.row-actions .icon-btn svg { width: 15px; height: 15px; }

/* Listas de filas */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li:first-child { padding-top: 0; }
.li .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.li b { font-weight: 500; }
.li .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.li .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--line-2); color: var(--accent); flex: none; }
.li .ic svg { width: 18px; height: 18px; }

/* Mini estadísticas */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.25); display: grid; gap: 2px; }
.stat span { font-size: 12px; color: var(--dim); }
.stat b { font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
.stat small { font-size: 11.5px; color: var(--muted); }

/* Formularios */
.form { display: grid; gap: 16px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .form-2 { grid-template-columns: 1fr; } }
textarea.input { height: auto; min-height: 104px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.hint { font-size: 12px; color: var(--dim); }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--dim); font-size: 14px; pointer-events: none; }
.input-prefix .input { padding-left: 38px; }

/* Ajustes: fila etiqueta / control */
.settings { display: grid; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: start; }
.set-row:first-child { padding-top: 4px; }
.set-row:last-child { border-bottom: 0; }
.set-row > div:first-child b { font-weight: 500; display: block; }
.set-row > div:first-child span { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .set-row { grid-template-columns: 1fr; gap: 12px; } }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row b { font-weight: 500; display: block; font-size: 14px; }
.toggle-row span { font-size: 12.5px; color: var(--muted); }

/* Zona para subir archivos */
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 16px; padding: 26px 18px; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); font-size: 13.5px; cursor: pointer; transition: border-color .2s, background .2s; position: relative; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent-line); background: var(--accent-soft); }
.dropzone > svg { width: 26px; height: 26px; color: var(--accent); }
.dropzone b { color: var(--text); font-weight: 500; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Pasos horizontales */
.hsteps { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 8px; }
.hsteps div { display: grid; gap: 8px; font-size: 12.5px; color: var(--dim); }
.hsteps i { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); display: block; }
.hsteps .done { color: var(--text); }
.hsteps .done i { background: linear-gradient(90deg, var(--jade), var(--accent)); }
.hsteps .now { color: var(--text); }
.hsteps .now i { background: linear-gradient(90deg, var(--accent) 50%, rgba(255,255,255,.08) 50%); }

/* Mensajería */
.chat-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 64px - 150px); min-height: 520px; padding: 0; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list .head { padding: 14px; border-bottom: 1px solid var(--line); }
.chat-list .head .input { height: 40px; }
.threads { overflow-y: auto; flex: 1; }
.thread { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; align-items: flex-start; transition: background .15s; }
.thread:hover { background: rgba(255,255,255,.025); }
.thread[aria-selected="true"] { background: rgba(255,255,255,.05); box-shadow: inset 3px 0 0 var(--accent); }
.thread .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.thread b { font-weight: 500; font-size: 14px; }
.thread p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .when { font-size: 11px; color: var(--dim); white-space: nowrap; }
.thread .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.conv { display: flex; flex-direction: column; min-height: 0; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.conv-head b { font-weight: 500; display: block; }
.conv-body { flex: 1; overflow-y: auto; padding: 20px 18px; display: grid; gap: 10px; align-content: start; }
.conv-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.conv-foot form { display: flex; gap: 8px; }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.quick button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.quick button:hover { color: var(--text); border-color: rgba(255,255,255,.22); }
.msg { max-width: 76%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; }
.msg.them { background: rgba(255,255,255,.06); border-bottom-left-radius: 6px; justify-self: start; }
.msg.me { justify-self: end; background: var(--lime); color: var(--ink); border-bottom-right-radius: 6px; }
.msg time { display: block; font-size: 10.5px; opacity: .6; margin-top: 3px; }
.msg-note { justify-self: center; font-size: 11.5px; color: var(--dim); display: flex; gap: 6px; align-items: center; text-align: center; max-width: 90%; }
.msg-note svg { width: 13px; height: 13px; flex: none; }
.msg-note.warn { color: var(--warn); }
.msg-card { justify-self: end; max-width: 76%; display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(255,255,255,.03); font-size: 13px; }
.msg-card.them { justify-self: start; }
.msg-card .p-thumb { width: 44px; border-radius: 10px; flex: none; }
.conv-empty { margin: auto; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 10px; padding: 40px; }
.conv-empty svg { width: 36px; height: 36px; color: var(--dim); }
.back-btn { display: none !important; }
@media (max-width: 860px) {
  .chat-app { grid-template-columns: 1fr; height: calc(100vh - 64px - 130px); }
  .chat-app .conv { display: none; }
  .chat-app.reading .chat-list { display: none; }
  .chat-app.reading .conv { display: flex; }
  .back-btn { display: inline-grid !important; }
}

/* Tarjetas de contenido (novedades, foro, lecciones) */
.feed { display: grid; gap: 14px; }
.post { padding: 20px; display: grid; gap: 12px; }
.post-head { display: flex; gap: 12px; align-items: center; }
.post-head b { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.post-head span { font-size: 12px; color: var(--dim); }
.post p { color: var(--muted); }
.post .media { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.post .media .p-thumb { aspect-ratio: 4/3; border-radius: 12px; }
.post .media .p-thumb .p-icon { width: 30%; height: 40%; }
.post-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.post-actions button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); }
.post-actions button:hover { color: var(--text); border-color: var(--line-2); }
.post-actions button svg { width: 14px; height: 14px; }
.post-actions button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.post-actions button[aria-pressed="true"] svg { fill: currentColor; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { padding: 20px; display: grid; gap: 12px; align-content: start; }
.b-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.05); border: 1px solid var(--line-2); color: var(--accent); flex: none; }
.b-ico svg { width: 19px; height: 19px; }
.tile h3 { font-size: 15.5px; }
.tile p { color: var(--muted); font-size: 13.5px; }

/* Pila clave / valor */
.kv { display: grid; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 14px; font-size: 13.5px; }
.kv div + div { border-top: 1px solid var(--line); }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; text-align: right; }

/* Bloque IA */
.ai-box { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(var(--accent-rgb),.07), rgba(255,255,255,.01) 60%); }
.ai-out { padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.3); display: grid; gap: 10px; font-size: 14px; color: var(--muted); }
.ai-out b { color: var(--text); font-weight: 500; }
.ai-out ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: think 1s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 50% { opacity: .2; transform: translateY(-3px); } }

.inline-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* Barras horizontales simples (una serie) */
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 70px; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.hbar .bar { height: 8px; }
.hbar .num { text-align: right; color: var(--text); }

/* Drawer genérico del panel */
.pd-body { display: grid; gap: 18px; padding: 18px 0; }
.drawer-panel.wide { width: min(560px, 100%); }

/* Encabezado de sección con ícono */
.sec-title { display: flex; align-items: center; gap: 14px; }
.sec-title .b-ico { width: 44px; height: 44px; border-radius: 14px; }
@media (max-width: 420px) { .topbar { gap: 8px; } }
