/* Cajón Sorpresa · panel. Ciruela + cinta mostaza. Una sola familia tipografica del sistema. */
:root {
  color-scheme: light dark;
  --font: "Avenir Next", "Avenir", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bg: #f5f4f8; --surface: #ffffff; --ink: #1c1726; --muted: #6a6477; --line: #e4e1ea;
  --plum: #2a1a3e; --plum-ink: #e9e2f4; --plum-mute: #b7a9cf;
  --tape: #f2b134; --tape-ink: #2b1c00; --link: #5a3a9a; --focus: #7c5cc4;
  --pine: #1b7a57; --berry: #b4233f; --amber: #946200;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14111b; --surface: #1d1926; --ink: #f1edf7; --muted: #a39bb4; --line: #342e43;
    --plum: #0e0b14; --plum-ink: #ece6f6; --plum-mute: #9b8fb3;
    --link: #b9a0f2; --focus: #a98cf0; --pine: #4fd1a0; --berry: #ff8199; --amber: #f2c14e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1 { margin: 0 0 6px; font-size: 1.85rem; line-height: 1.15; font-weight: 750; letter-spacing: -.025em; }
h2 { margin: 36px 0 14px; font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
h1 + .lead { margin: 0 0 22px; color: var(--muted); max-width: 62ch; }
code { font-size: .88em; background: color-mix(in srgb, var(--muted) 16%, transparent); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); font-size: .9rem; }

/* ---------- estructura: menu lateral + contenido ---------- */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--plum); color: var(--plum-ink); padding: 22px 14px 18px; display: flex; flex-direction: column;
        gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 20px; color: #fff; text-decoration: none;
         font-weight: 750; font-size: 1.06rem; letter-spacing: -.015em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.side .new { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 4px 16px; padding: 10px 12px;
             background: var(--tape); color: var(--tape-ink); border-radius: 10px; font-weight: 700; text-decoration: none; }
.side .new:hover { filter: brightness(1.06); }
.side .new svg, .nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
                             stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .side button.link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; border: 0; width: 100%;
         color: var(--plum-mute); text-decoration: none; font: inherit; font-weight: 600; background: none; cursor: pointer; text-align: left; }
.nav a:hover, .side button.link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: rgba(255,255,255,.13); color: #fff; }
.nav .count { margin-left: auto; background: var(--tape); color: var(--tape-ink); font-size: .74rem; font-weight: 750;
              padding: 1px 8px; border-radius: 99px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.side-foot a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--plum-mute);
               text-decoration: none; font-weight: 600; }
.side-foot a.on { background: rgba(255,255,255,.13); color: #fff; }
.side-foot a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-foot svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main { padding: 34px clamp(18px, 4vw, 52px) 72px; min-width: 0; max-width: 1200px; width: 100%; }
.foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px; }
  .brand { padding: 0 6px 0 0; } .brand span { display: none; }
  .side .new { margin: 0; padding: 7px 10px; order: 3; }
  .nav { flex-direction: row; overflow-x: auto; order: 2; flex: 1 1 100%; padding-bottom: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; width: auto; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; border: 0; padding: 0; order: 1; }
  .side-foot a span, .side-foot button span { display: none; }
  .main { padding-top: 22px; }
}

/* ---------- lo que requiere atencion (inicio) ---------- */
.attention { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius);
             background: var(--surface); overflow: hidden; margin: 6px 0 12px; }
.att { display: block; padding: 20px 22px; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); position: relative; }
.att:last-child { border-right: 0; }
.att:hover { background: color-mix(in srgb, var(--tape) 8%, transparent); }
.att b { display: block; font-size: 2.5rem; line-height: 1; font-weight: 780; letter-spacing: -.04em; }
.att span { display: block; margin-top: 8px; color: var(--muted); font-size: .92rem; }
.att.todo { box-shadow: inset 4px 0 0 var(--tape); }
.att.todo span { color: var(--ink); }
.quiet { display: flex; flex-wrap: wrap; gap: 4px 26px; margin: 0 0 26px; color: var(--muted); font-size: .9rem; }
.quiet b { color: var(--ink); font-weight: 700; margin-right: 4px; }
@media (max-width: 640px) { .attention { grid-template-columns: 1fr; } .att { border-right: 0; border-bottom: 1px solid var(--line); } .att:last-child { border-bottom: 0; } }

/* ---------- datos en linea (contadores secundarios) ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0 0 22px; }
.stat { color: var(--muted); font-size: .92rem; }
.stat b { color: var(--ink); font-size: 1.2rem; font-weight: 750; margin-right: 6px; letter-spacing: -.02em; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--tape); color: var(--tape-ink); border: 1px solid transparent;
       border-radius: 10px; padding: 9px 15px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { filter: brightness(1.05); }
.btn.alt { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 600; }
.btn.alt:hover { background: color-mix(in srgb, var(--muted) 12%, transparent); filter: none; }
.btn.danger { background: var(--berry); color: #fff; }
.btn.small { padding: 5px 11px; font-size: .84rem; border-radius: 8px; }
.btn[disabled], .btn.off { opacity: .4; cursor: not-allowed; pointer-events: none; }
form.inline { display: inline; }

/* ---------- etiquetas de estado ---------- */
.badge { --c: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: .8rem;
         font-weight: 650; white-space: nowrap; color: var(--c); background: transparent; border: 1px solid var(--line);
         background: color-mix(in srgb, var(--c) 11%, transparent); border-color: color-mix(in srgb, var(--c) 28%, transparent); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.badge.activo, .badge.validated { --c: var(--pine); }
.badge.agotado, .badge.caducado, .badge.rejected, .badge.expired, .badge.cerrado { --c: var(--berry); }
.badge.programado, .badge.order_declared { --c: var(--amber); }

/* ---------- tablas ---------- */
.scroll { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        overflow: hidden; font-size: .92rem; }
th { padding: 11px 16px; text-align: left; color: var(--muted); font-weight: 650; font-size: .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--muted) 6%, transparent); }
td.num { white-space: nowrap; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.shot { max-width: 100%; max-height: 72vh; border: 1px solid var(--line); border-radius: 12px; display: block; }

@media (max-width: 1100px) { th, td { padding-left: 10px; padding-right: 10px; } }

/* ---------- filtros ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips .btn { padding: 5px 13px; font-size: .86rem; border-radius: 99px; font-weight: 600; }
.chips .btn.alt { background: var(--surface); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.filters input, .filters select { width: auto; min-width: 160px; }
.filters input[type=search] { flex: 1 1 260px; min-width: 240px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 22px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 9px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); }
.subnav a.on { color: var(--ink); border-bottom-color: var(--tape); }

/* ---------- tarjetas, formularios, avisos ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card > b:first-child { display: block; margin-bottom: 2px; font-size: 1.02rem; letter-spacing: -.01em; }
label { display: block; font-weight: 650; margin: 16px 0 5px; font-size: .9rem; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
textarea { min-height: 200px; resize: vertical; line-height: 1.5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } @media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }
.flash { padding: 12px 16px; border-radius: 12px; margin: 0 0 20px; border: 1px solid var(--line); background: var(--surface); }
.flash.ok { border-color: color-mix(in srgb, var(--pine) 45%, transparent); background: color-mix(in srgb, var(--pine) 9%, var(--surface)); }
.flash.error { border-color: color-mix(in srgb, var(--berry) 50%, transparent); background: color-mix(in srgb, var(--berry) 9%, var(--surface)); color: var(--berry); }
.warnbar, .warnbar-lite { padding: 10px 16px; border-radius: 12px; margin: 0 0 18px; font-size: .9rem; color: var(--amber);
          border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 9%, transparent); }

/* ---------- detalle ---------- */
.detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; } @media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 20px; margin: 0; } dt { color: var(--muted); } dd { margin: 0; word-break: break-word; }
ul.tl { list-style: none; padding: 0; margin: 0; } ul.tl li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; } ul.tl li:last-child { border: 0; }

/* ---------- chat de IA ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.msg { padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; max-width: 78ch; }
.msg.user { background: color-mix(in srgb, var(--tape) 14%, var(--surface)); margin-left: auto; border-color: color-mix(in srgb, var(--tape) 35%, transparent); }
.msg.assistant { background: var(--surface); }
pre.tpl { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }

/* ---------- acceso ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.login-art { background: var(--plum); color: #fff; padding: 48px clamp(28px, 6vw, 80px); display: flex; flex-direction: column; justify-content: space-between; }
.login-art svg { width: 64px; height: 64px; }
.login-art h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.04; margin: 22px 0 14px; color: #fff; max-width: 14ch; }
.login-art p { color: var(--plum-mute); max-width: 36ch; margin: 0; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login-form form { width: 100%; max-width: 340px; }
.login-form h2 { margin: 0 0 4px; font-size: 1.4rem; letter-spacing: -.02em; }
.login-form .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 11px; }
@media (max-width: 760px) { .login { grid-template-columns: 1fr; } .login-art { min-height: 0; padding: 28px 24px; gap: 14px; } .login-art h1 { font-size: 1.7rem; margin: 10px 0 6px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ---------- ajustes ---------- */
.set { display: grid; gap: 22px; max-width: 760px; }
.set section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.set h2 { margin: 0 0 4px; font-size: 1.08rem; }
.set .hint { color: var(--muted); font-size: .9rem; margin: 0 0 4px; }
.set .state { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; margin: 8px 0 2px; }
.set .state i { width: 9px; height: 9px; border-radius: 50%; background: var(--berry); display: inline-block; }
.set .state.on i { background: var(--pine); }
.set .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.set .secret { color: var(--muted); font-size: .85rem; margin-top: 4px; }

.chanpick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
label.chk { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-weight: 600; cursor: pointer; }
label.chk input { width: auto; accent-color: var(--tape); }

.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.acts form { margin: 0; }

/* ================= hoja de seguimiento ================= */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:root {
  --orange: #994806;
  --row-ok: color-mix(in srgb, var(--pine) 13%, var(--surface));
  --row-rev: color-mix(in srgb, #f59324 20%, var(--surface));
  --row-bad: color-mix(in srgb, var(--berry) 13%, var(--surface));
  --row-off: color-mix(in srgb, var(--muted) 7%, var(--surface));
  --head: #f6c445; --head-ink: #2b1c00; --head-line: #d9a422;
  --grid: color-mix(in srgb, var(--ink) 13%, var(--surface));
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --orange: #ffb057; --row-ok: color-mix(in srgb, var(--pine) 15%, var(--surface)); --row-rev: color-mix(in srgb, #ff9a2e 19%, var(--surface));
          --row-bad: color-mix(in srgb, var(--berry) 17%, var(--surface)); --head: #e9b233; --head-line: #b98a17; }
}
.main.wide { max-width: none; padding: 28px clamp(12px, 2vw, 28px) 28px; }
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-head .lead { margin: 0; color: var(--muted); max-width: 62ch; }
.sheet-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sheet-tools .btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--pine); box-shadow: 0 0 0 0 color-mix(in srgb, var(--pine) 55%, transparent); animation: live 2.8s ease-out infinite; }
.live[data-state=error] { color: var(--berry); font-weight: 650; } .live[data-state=error] i { background: var(--berry); animation: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pine) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

.sheet-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin: 0 0 14px; }
.sheet-filters .fld { display: flex; flex-direction: column; min-width: 0; flex: 0 1 190px; }
.sheet-filters .fld.grow { flex: 1 1 260px; }
.sheet-filters .fld.date { flex: 0 1 150px; }
.sheet-filters label { margin: 0 0 4px; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sheet-filters input[type=search], .sheet-filters input[type=date], .sheet-filters select { padding: 8px 10px; border-radius: 9px; background: var(--surface); min-height: 38px; }
.sheet-filters input[type=date] { width: 100%; border: 1px solid var(--line); color: var(--ink); font: inherit; }
.sheet-filters label.tick { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
                            font-size: .9rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); cursor: pointer; white-space: nowrap; }
.sheet-filters label.tick:has(input:checked) { border-color: var(--orange); background: var(--row-rev); }
.sheet-filters label.tick:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.sheet-filters label.tick input { accent-color: var(--orange); width: 16px; height: 16px; margin: 0; }
.sheet-filters > .btn { min-height: 38px; }
.more-btn { display: none !important; } .more-btn b { background: var(--tape); color: var(--tape-ink); border-radius: 99px; padding: 0 7px; font-size: .76rem; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border-radius: 9px; font-size: .9rem; background: color-mix(in srgb, var(--tape) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tape) 45%, transparent); }

.sheet { border: 1px solid var(--grid); border-radius: 12px; background: var(--surface); overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 12px 28px -22px rgba(28,23,38,.5); }
.sheet.loading .grid tbody { opacity: .55; }
.sheet-scroll { overflow: auto; max-height: max(340px, calc(100dvh - 318px)); position: relative; overscroll-behavior-x: contain; }
.sheet-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 0; }
table.grid { width: 100%; min-width: 1080px; border: 0; border-radius: 0; border-collapse: separate; border-spacing: 0; overflow: visible; font-size: .875rem; background: var(--surface); }
.grid th, .grid td { padding: 6px 9px; border-bottom: 1px solid var(--grid); border-right: 1px solid var(--grid); vertical-align: middle; background: var(--surface); height: 52px; }
.grid tr > :last-child { border-right: 0; }
.grid tbody tr:last-child > * { border-bottom: 0; }
.grid thead th { position: sticky; top: 0; z-index: 3; height: auto; padding: 0; background: var(--head); color: var(--head-ink); border-bottom: 2px solid var(--head-line); border-right-color: var(--head-line);
                 font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; text-align: left; line-height: 1.2; vertical-align: bottom; }
.grid thead th > button, .grid thead th > span { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit;
                                                 text-transform: inherit; text-align: left; cursor: pointer; }
.grid thead th > span { cursor: default; }
.grid thead th > button::after { content: "↕"; opacity: .38; font-size: .9em; letter-spacing: 0; }
.grid thead th[aria-sort=ascending] > button::after { content: "▲"; opacity: 1; font-size: .7em; }
.grid thead th[aria-sort=descending] > button::after { content: "▼"; opacity: 1; font-size: .7em; }
.grid thead th > button:hover { background: rgba(43,28,0,.09); }
.grid thead th > button:focus-visible { outline: 2px solid var(--head-ink); outline-offset: -3px; border-radius: 0; }
.grid thead th[aria-sort=ascending], .grid thead th[aria-sort=descending] { background: color-mix(in srgb, var(--head) 86%, #7a4d00); }
/* primera columna fija (fecha) con la banda de color del estado */
.grid .c-date { position: sticky; left: 0; z-index: 2; white-space: nowrap; box-shadow: inset 4px 0 0 var(--bar, transparent), 1px 0 0 var(--grid); }
.grid thead .c-date { z-index: 4; box-shadow: 1px 0 0 var(--head-line); }
.grid tbody th.c-date { font-weight: 600; text-align: left; color: var(--ink); font-size: inherit; padding-left: 14px; padding-right: 14px; }
.grid tbody .c-date a { color: inherit; text-decoration: none; display: block; }
.grid tbody .c-date a:hover { text-decoration: underline; }
.grid tbody .c-date small { display: block; color: color-mix(in srgb, var(--muted) 78%, var(--ink)); font-weight: 500; font-size: .78rem; line-height: 1.2; }
.grid tbody tr:hover > * { background-image: linear-gradient(rgba(127,110,160,.09), rgba(127,110,160,.09)); }
.grid .c-prod { min-width: 158px; max-width: 320px; }
.grid .c-prod a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--ink); text-decoration: none; line-height: 1.3; }
.grid .c-prod a:hover, .grid .c-user a:hover { text-decoration: underline; }
.grid td.c-price { text-align: right; white-space: nowrap; font-weight: 600; }
.grid .c-user { white-space: nowrap; max-width: 142px; overflow: hidden; text-overflow: ellipsis; }
.grid .c-user a { font-weight: 600; text-decoration: none; }
.grid .c-user .ban { display: block; color: var(--berry); font-size: .74rem; font-weight: 700; line-height: 1.1; }
.grid .c-order { white-space: nowrap; }
.grid code { font-family: var(--mono); font-size: .78rem; background: none; padding: 0; letter-spacing: -.01em; }
.grid .nil { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.grid td.c-shot { text-align: center; padding: 3px 6px; width: 58px; } .grid thead .c-shot, .grid thead .c-coupon { width: 1%; }
.shot-btn { display: block; margin: 0 auto; padding: 0; width: 44px; height: 44px; border: 1px solid var(--grid); border-radius: 7px; overflow: hidden; background: var(--bg); cursor: zoom-in; }
.shot-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-btn:hover { border-color: var(--ink); } .shot-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.grid .c-coupon { white-space: nowrap; }
.yn { display: inline-block; min-width: 30px; text-align: center; font-weight: 800; font-size: .78rem; letter-spacing: .05em; padding: 2px 7px; border-radius: 6px; }
.yn.yes { color: var(--pine); background: color-mix(in srgb, var(--pine) 15%, transparent); }
.yn.no { color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.mark { margin-left: 5px; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent); border-radius: 7px; background: var(--surface); color: var(--ink); font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer; }
.mark:hover { background: var(--tape); color: var(--tape-ink); border-color: transparent; } .mark:disabled { opacity: .6; cursor: progress; }
.grid .c-status { white-space: nowrap; }
.grid .c-status .why { display: block; margin-top: 2px; color: var(--orange); font-size: .76rem; font-weight: 600; white-space: normal; max-width: 150px; line-height: 1.25; }
.grid .badge.link_sent { --c: var(--link); }
/* filas por estado: verde validado, naranja por revisar, rojo rechazado */
.grid tr.st-validated > * { background-color: var(--row-ok); } .grid tr.st-validated { --bar: var(--pine); }
.grid tr.st-order_declared > * { background-color: var(--row-rev); } .grid tr.st-order_declared { --bar: #f08a1c; }
.grid tr.st-rejected > * { background-color: var(--row-bad); } .grid tr.st-rejected { --bar: var(--berry); }
.grid tr.st-expired > *, .grid tr.st-interested > * { background-color: var(--row-off); }
.grid tr.st-expired .c-prod a, .grid tr.st-interested .c-prod a, .grid tr.st-expired td.c-price, .grid tr.st-interested td.c-price { color: var(--muted); }
.grid tr.st-link_sent { --bar: color-mix(in srgb, var(--link) 55%, transparent); }
/* celda de notas editable */
.grid td.c-note { padding: 3px 4px; width: 24%; }
.grid td.c-note textarea { display: block; width: 100%; min-width: 158px; min-height: 34px; height: 34px; max-height: 132px; resize: none; overflow: hidden; padding: 7px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent;
                           color: var(--ink); font: inherit; line-height: 1.35; }
.grid td.c-note textarea::placeholder { color: transparent; }
.grid tr:hover td.c-note textarea::placeholder, .grid td.c-note textarea:focus::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.grid td.c-note textarea:hover { border-color: color-mix(in srgb, var(--ink) 22%, transparent); cursor: text; }
.grid td.c-note textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; background: var(--surface); overflow: auto; }
.note-foot { display: none; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; padding: 1px 8px 3px; font-size: .74rem; font-weight: 650; line-height: 1.2; }
.c-note[data-state=dirty] .note-foot, .c-note[data-state=saving] .note-foot, .c-note[data-state=saved] .note-foot, .c-note[data-state=error] .note-foot { display: flex; }
.c-note[data-state=dirty] .note-msg, .c-note[data-state=saving] .note-msg { color: var(--muted); }
.c-note[data-state=saved] .note-msg { color: var(--pine); } .c-note[data-state=saved] .note-msg::before { content: "✓ "; }
.c-note[data-state=error] .note-msg { color: var(--berry); } .c-note[data-state=error] .note-msg::before { content: "! "; font-weight: 900; }
.c-note[data-state=error] textarea { border-color: var(--berry); }
.note-retry { border: 0; background: none; padding: 0; color: var(--link); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
/* filas nuevas o cambiadas por el refresco automatico: una marca discreta que se apaga sola */
.grid tr.is-new .c-date::after, .grid tr.is-changed .c-date::after { content: ""; position: absolute; top: 5px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--tape); box-shadow: 0 0 0 2px var(--surface); }
.grid tr.is-changed .c-date::after { background: var(--link); }
.grid tr.is-new > *, .grid tr.is-changed > * { animation: touched 2.4s ease-out 1; }
@keyframes touched { 0%, 35% { background-image: linear-gradient(color-mix(in srgb, var(--tape) 34%, transparent), color-mix(in srgb, var(--tape) 34%, transparent)); } 100% { background-image: linear-gradient(transparent, transparent); } }
.sheet-empty { margin: 0; padding: 44px 20px; text-align: center; color: var(--muted); position: sticky; left: 0; }

.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 22px; flex-wrap: wrap; padding: 9px 14px; border-top: 2px solid var(--grid); background: color-mix(in srgb, var(--muted) 7%, var(--surface)); }
.totals { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; }
.totals > div { display: flex; flex-direction: column; }
.totals dt { font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.totals dd { font-size: 1.12rem; font-weight: 760; letter-spacing: -.02em; line-height: 1.25; }
.totals .ok dd { color: var(--pine); } .totals .bad dd { color: var(--berry); } .totals .rev dd { color: var(--orange); }
.totals .sum { padding-left: 22px; border-left: 1px solid var(--grid); }
.totals small { font-size: .74rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.pager { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); white-space: nowrap; }
.pager select { width: auto; padding: 5px 8px; border-radius: 8px; font-size: .84rem; background: var(--surface); }
.pager .btn { padding: 3px 11px; font-size: 1.05rem; line-height: 1.2; background: var(--surface); }
.pager .btn:disabled { opacity: .35; cursor: default; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; list-style: none; margin: 0; padding: 8px 14px 10px; border-top: 1px solid var(--grid); font-size: .78rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 12px; border-radius: 3px; border: 1px solid var(--grid); background: var(--surface); }
.legend .st-validated i { background: var(--row-ok); border-color: var(--pine); } .legend .st-order_declared i { background: var(--row-rev); border-color: #f08a1c; }
.legend .st-rejected i { background: var(--row-bad); border-color: var(--berry); } .legend .st-expired i { background: var(--row-off); }

/* visor de capturas */
.visor { width: min(96vw, 980px); max-height: 94dvh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); overflow: hidden; }
.visor::backdrop { background: rgba(14, 11, 20, .72); }
.visor[open] { display: flex; flex-direction: column; }
.visor-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.visor-top p { margin: 0 auto 0 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.visor-top .btn { white-space: nowrap; flex: none; }
.visor-top code { font-family: var(--mono); background: none; padding: 0; }
.visor-top kbd { font: inherit; font-size: .72rem; padding: 0 5px; border-radius: 4px; background: rgba(43,28,0,.16); }
.visor-img { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 10px 6px; min-height: 240px; background: var(--bg); overflow: auto; }
.visor-img img { max-width: 100%; max-height: calc(94dvh - 92px); margin: 0 auto; display: block; border-radius: 8px; }
.visor-nav { width: 40px; height: 64px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.visor-nav:hover:not(:disabled) { background: var(--tape); color: var(--tape-ink); } .visor-nav:disabled { opacity: .25; cursor: default; }

/* ================= ficha de cliente ================= */
.who { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.who .avatar { width: 58px; height: 58px; border-radius: 16px; background: var(--plum); color: var(--tape); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; flex: none; text-transform: uppercase; }
.who h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.who p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.who p b { color: var(--ink); font-weight: 650; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin: 0 0 22px; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi b { display: block; font-size: 1.9rem; line-height: 1; font-weight: 780; letter-spacing: -.035em; }
.kpi span { display: block; margin-top: 7px; color: var(--muted); font-size: .84rem; line-height: 1.25; }
.kpi.ok b { color: var(--pine); } .kpi.bad b { color: var(--berry); } .kpi.rev b { color: var(--orange); }
.kpi .meter { height: 6px; margin-top: 9px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 20%, transparent); overflow: hidden; }
.kpi .meter i { display: block; height: 100%; background: var(--pine); border-radius: 99px; }
@media (max-width: 980px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi:nth-child(3) { border-right: 0; } .kpi:nth-child(-n+3) { border-bottom: 1px solid var(--line); } }
@media (max-width: 480px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line) !important; } .kpi:nth-child(2n) { border-right: 0 !important; }
                            .kpi:nth-last-child(-n+2) { border-bottom: 0; } .kpi b { font-size: 1.6rem; } }
.duo { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; } @media (max-width: 860px) { .duo { grid-template-columns: 1fr; } }
.duo .card h2 { margin: 0 0 4px; font-size: 1.02rem; }
.card .hint { margin: 0 0 12px; color: var(--muted); font-size: .88rem; }
.card textarea.note { min-height: 120px; }
.card .row-end { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.lock { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0 0 6px; }
.lock i { width: 10px; height: 10px; border-radius: 50%; background: var(--pine); } .lock.on i { background: var(--berry); } .lock.on { color: var(--berry); }
table.grid.static { min-width: 860px; }
.grid.static thead th { padding: 10px; position: static; }
.grid.static .c-date { position: static; }
.grid.static td.c-note { padding: 6px 10px; width: 22%; min-width: 160px; color: var(--ink); overflow-wrap: anywhere; }
.framed { border: 1px solid var(--grid); border-radius: 12px; overflow: auto; background: var(--surface); }
ul.tl li b { font-weight: 650; }

@media (max-width: 880px) {
  .main.wide { padding-left: 12px; padding-right: 12px; }
  .sheet-scroll { max-height: max(420px, calc(100dvh - 150px)); }
  .grid .c-prod { min-width: 190px; }
}
@media (max-width: 560px) {
  .sheet-head h1 { font-size: 1.5rem; }
  .sheet-head .lead { display: none; }
  .sheet-head { margin-bottom: 12px; }
  .more-btn { display: inline-flex !important; flex: 1 1 100%; justify-content: center; }
  .sheet-filters:not(.open) > :not(.grow):not(.more-btn) { display: none; }
  .sheet-tools { width: 100%; justify-content: space-between; }
  .sheet-filters .fld, .sheet-filters .fld.date { flex: 1 1 calc(50% - 6px); }
  .sheet-filters .fld.grow { flex: 1 1 100%; }
  .grid th, .grid td { padding: 5px 8px; }
  .grid tbody th.c-date { padding-left: 11px; }
  .totals { gap: 8px 16px; } .totals dd { font-size: 1rem; } .totals .sum { padding-left: 0; border-left: 0; }
  .sheet-bar { padding: 9px 10px; } .pager { width: 100%; justify-content: flex-end; }
  .visor-nav { width: 32px; height: 52px; } .visor-top kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { .live i { animation: none !important; } }

/* Vista previa de las condiciones (burbuja de Telegram) */
.cond-preview{max-width:460px;margin:8px 0 14px}
.cond-bubble{background:#fff;color:#111;border-radius:14px 14px 4px 4px;padding:12px 14px;line-height:1.45;font-size:14px;overflow-wrap:anywhere}
.cond-btns{display:flex;gap:2px;margin-top:2px}
.cond-btns span{flex:1;text-align:center;background:#3f7d4f;color:#fff;font-weight:600;font-size:13px;padding:8px 4px;border-radius:4px}
.cond-btns span:first-child{border-bottom-left-radius:14px}.cond-btns span:last-child{border-bottom-right-radius:14px}

.msg-ed{border-top:1px solid var(--line, rgba(255,255,255,.12));padding:10px 0}
.msg-ed summary{cursor:pointer;display:flex;gap:10px;align-items:baseline;padding:4px 0}
.msg-ed summary:focus-visible{outline:2px solid var(--focus, #f2b134);outline-offset:2px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.msg-group{margin:22px 0 6px;font-size:15px}

/* ---------- mejoras: IA en nueva oferta, lista de espera, repetidores, informes, respuestas, copias ---------- */
.aifill { margin-bottom: 18px; box-shadow: inset 4px 0 0 var(--tape); }
.aifill textarea { min-height: 130px; }
.aifill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.aifill-state { font-size: .9rem; color: var(--muted); flex: 1 1 240px; min-width: 0; }
.aifill-state.ok { color: var(--pine); font-weight: 600; } .aifill-state.bad { color: var(--berry); font-weight: 600; }
input.ai-filled, textarea.ai-filled { border-color: var(--tape); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tape) 28%, transparent); }
.badge.repeat { --c: var(--focus); }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 980px) { .trio { grid-template-columns: 1fr; } }
.trio .card > .muted, .trio .card > p { overflow-wrap: anywhere; }
.big { margin: 8px 0 6px; font-size: 2rem; line-height: 1; font-weight: 780; letter-spacing: -.035em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big small { font-size: .9rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
ul.checks { margin: 10px 0 16px; padding: 0; list-style: none; }
ul.checks li { padding: 4px 0 4px 26px; position: relative; }
ul.checks li::before { content: "✓"; position: absolute; left: 4px; color: var(--pine); font-weight: 800; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.btnrow form { margin: 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.replies { display: grid; gap: 14px; max-width: 860px; }
.reply header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 14px; flex-wrap: wrap; }
.reply header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.reply .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.reply .subj { margin: 10px 0 6px; font-weight: 700; overflow-wrap: anywhere; }
.reply.done { opacity: .72; }
.quote { box-shadow: inset 4px 0 0 var(--line); }
.set section[id] { scroll-margin-top: 16px; }
.set label.chk { align-items: flex-start; font-weight: 500; } .set label.chk input { margin-top: 4px; flex: none; }
.set { grid-template-columns: minmax(0, 1fr); }      /* en movil las secciones no pueden ensanchar la pagina (tablas, textos largos) */
.set > section { min-width: 0; }
.set .state { max-width: 100%; } .set .state i { flex: none; }
.set label.chk > span, .set label.chk { overflow-wrap: anywhere; }

/* ---------- VIP e incumplimientos ---------- */
.badge.vip { --c: var(--amber); font-weight: 750; letter-spacing: .04em; }
.badge.vip::before { content: "★"; width: auto; height: auto; background: none; font-size: .78rem; line-height: 1; }
.badge.breach { --c: var(--orange); }
.badge.breach.hot { --c: var(--berry); }
.grid .c-user .vip { display: inline-block; margin-left: 6px; color: var(--amber); font-size: .72rem; font-weight: 800; letter-spacing: .05em; }
.grid .c-user .miss { display: block; color: var(--orange); font-size: .74rem; font-weight: 700; line-height: 1.1; }
.duo.even { grid-template-columns: 1fr 1fr; margin-top: 20px; } @media (max-width: 860px) { .duo.even { grid-template-columns: 1fr; } }
.lock.vip i { background: var(--amber); } .lock.off i { background: var(--muted); }
.lock.warn i { background: var(--orange); } .lock.warn { color: var(--orange); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0 0; }
.inline-form > div { flex: 1 1 170px; min-width: 0; }
.inline-form label { margin: 0 0 4px; font-size: .84rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; } .btn-row form { margin: 0; }
.steps { display: flex; gap: 4px; margin: 10px 0 2px; } .steps i { flex: 1; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 20%, transparent); }
.steps i.on { background: var(--orange); } .steps i.on.hot { background: var(--berry); }
.vipbox { margin-top: 16px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line)); border-radius: 12px;
          background: color-mix(in srgb, var(--amber) 6%, transparent); }
.vipbox > b { display: block; margin-bottom: 2px; } .vipbox .muted { margin: 0 0 4px; }
.notice-vip { padding: 12px 16px; border-radius: 12px; margin: 0 0 18px; border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
              background: color-mix(in srgb, var(--amber) 9%, var(--surface)); display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.notice-vip form { margin: 0; } .notice-vip p { margin: 0; flex: 1 1 260px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis.four .kpi:nth-child(3) { border-right: 1px solid var(--line); } .kpis.four .kpi:nth-child(2n) { border-right: 0; }
                            .kpis.four .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); } .kpis.four .kpi:nth-child(n+3) { border-bottom: 0; } }
.inline-form input[type=date] { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; min-height: 40px; }
.steps + .hint { margin-top: 10px; }

/* ---------- menu de ayuda: incidencias, reseñas comunicadas y botones del bot ---------- */
.tk-table td.tk-body { min-width: 140px; max-width: 420px; overflow-wrap: anywhere; }
.tk-table { min-width: 780px; }
.tk-table td.rv-url { min-width: 130px; max-width: 230px; overflow-wrap: anywhere; font-size: .86rem; }
.tk-table td.rv-offer { min-width: 130px; }
.tk-table td.rv-acts { width: 1%; } .tk-table td.rv-acts form { display: block; margin: 3px 0; } .tk-table td.rv-acts .btn { width: 100%; justify-content: center; white-space: nowrap; }
.tk-table td.tk-kind { min-width: 96px; }
.tk-table .shot-btn { margin: 0; cursor: pointer; }
.tk-msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.bb-go { margin-top: 16px; }
a.badge { text-decoration: none; }
.grid .c-status .rv-mark, .grid .c-status .tk-mark { display: block; margin-top: 2px; font-size: .74rem; font-weight: 700; white-space: nowrap; line-height: 1.25; }
.grid .c-status .rv-mark { color: var(--amber); } .grid .c-status .tk-mark { color: var(--orange); }
.bb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.bb-side { position: sticky; top: 24px; }
@media (max-width: 1020px) { .bb-layout { grid-template-columns: 1fr; } .bb-side { position: static; order: -1; max-width: 420px; } }
.bb-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.bb { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bb:last-child { border-bottom: 0; }
.bb:target { box-shadow: inset 4px 0 0 var(--tape); }
.bb.off .bb-txt b, .bb.off .bb-pos { opacity: .5; }
.bb-pos { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--muted) 14%, transparent); font-size: .8rem; font-weight: 750; color: var(--muted); }
.bb-txt { min-width: 0; }
.bb-txt b { display: block; overflow-wrap: anywhere; }
.bb-txt small { display: block; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; line-height: 1.35; }
.bb-txt .tagline { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; margin-right: 4px; color: color-mix(in srgb, var(--muted) 80%, var(--ink)); }
.bb-txt .bad { color: var(--berry); font-weight: 650; }
.bb-acts { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.bb-acts form { margin: 0; }
.btn.icon { min-width: 34px; justify-content: center; padding-left: 8px; padding-right: 8px; }
.btn.danger-text { color: var(--berry); }
.bb-edit { grid-column: 2 / -1; min-width: 0; }
.bb-edit summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: .9rem; width: max-content; padding: 2px 0; }
.bb-edit[open] { padding-bottom: 6px; }
.bb-edit[open] summary { margin-bottom: 4px; }
.bb-kind { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.bb-kind legend { padding: 0; font-weight: 650; font-size: .9rem; margin-bottom: 4px; }
.bb-photo { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; }
.bb-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
@media (max-width: 560px) { .bb { grid-template-columns: auto minmax(0, 1fr); } .bb > .badge { grid-column: 2; justify-self: start; } .bb-acts, .bb-edit { grid-column: 1 / -1; } }
/* vista previa del menu (chat de Telegram) */
.tg { background: #cfdbe6 linear-gradient(160deg, #d7e3ee, #c3d2e0); border-radius: 18px; padding: 16px 14px 18px; border: 1px solid var(--line); }
.tg-cmd { width: max-content; max-width: 80%; margin: 0 0 10px auto; background: #e3fdd0; color: #111; border-radius: 14px 14px 4px 14px; padding: 6px 12px; font-size: 14px; }
.tg-bubble { background: #fff; color: #111; border-radius: 14px 14px 14px 4px; padding: 10px 13px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-keys { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; }
.tg-keys span { position: relative; background: rgba(40, 62, 84, .62); color: #fff; text-align: center; font-weight: 600; font-size: 13.5px; padding: 9px 24px; border-radius: 8px; overflow-wrap: anywhere; }
.tg-keys span i { position: absolute; right: 8px; top: 4px; font-style: normal; font-size: 11px; opacity: .85; }
.badge.gone { --c: var(--muted); }
.grid .c-status .rv-mark.gone { color: var(--muted); }

/* ================= programadas y cola de publicacion ================= */
input[type=time] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; min-height: 42px; }
.daypick { border: 0; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 2px 18px; }
.daypick legend { padding: 0; font-weight: 650; font-size: .9rem; margin-bottom: 4px; }
.created-note { margin: 0 0 18px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: inset 4px 0 0 var(--tape); max-width: 680px; overflow-wrap: anywhere; }
.badge.fija { --c: var(--link); }
.bad { color: var(--berry); font-weight: 650; }
.sheet-tools form { margin: 0; }
.pq-rhythm { display: flex; flex-wrap: wrap; gap: 4px 26px; margin: 0 0 16px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
             box-shadow: inset 4px 0 0 var(--tape); font-size: .92rem; }
.pq-rhythm b { font-weight: 700; }
.pq-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.pq-item { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; grid-template-areas: "photo main when" "photo acts acts" "time time time" "detail detail detail";
           gap: 6px 18px; align-items: start; padding: 16px 18px; border-bottom: 1px solid var(--line); scroll-margin-top: 14px; }
.pq-item:last-child { border-bottom: 0; }
.pq-item:target { box-shadow: inset 4px 0 0 var(--tape); }
.pq-photo { grid-area: photo; display: block; width: 112px; height: 112px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.pq-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pq-photo span { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: .78rem; }
.pq-main { grid-area: main; min-width: 0; }
.pq-title { margin: 0 0 4px; font-size: 1.06rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pq-title a { color: var(--ink); text-decoration: none; }
.pq-title a:hover { text-decoration: underline; }
.pq-pos { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; margin-right: 4px; border-radius: 8px; background: color-mix(in srgb, var(--muted) 14%, transparent);
          color: var(--muted); font-size: .78rem; font-weight: 750; vertical-align: 2px; }
.pq-meta { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .92rem; }
.pq-price { font-size: 1.12rem; font-weight: 760; letter-spacing: -.02em; }
.pq-chans { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; font-size: .86rem; color: var(--muted); }
.pq-chan { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); overflow-wrap: anywhere; }
.pq-chan .badge { border: 0; background: none; padding: 0; }
.pq-window { color: var(--amber); font-weight: 650; }
.pq-when { grid-area: when; text-align: right; min-width: 168px; }
.pq-when time { display: block; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.03em; white-space: nowrap; }
.pq-when time b { font-weight: 780; }
.pq-day { font-size: .86rem; letter-spacing: 0; color: var(--muted); font-weight: 600; }
.pq-count { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 99px; font-size: .86rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
            color: var(--ink); background: color-mix(in srgb, var(--muted) 13%, transparent); }
.pq-item.is-soon .pq-count { background: var(--tape); color: var(--tape-ink); }
.pq-item.is-due .pq-count { background: color-mix(in srgb, var(--pine) 18%, transparent); color: var(--pine); }
.pq-acts { grid-area: acts; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.pq-acts form { margin: 0; }
.pq-more span { font-size: 1.1rem; line-height: 1; font-weight: 800; }
.pq-timeform { grid-area: time; margin: 8px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.pq-timeform label { margin: 0 0 6px; }
.pq-timeform .muted { margin: 8px 0 0; }
.pq-timerow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pq-timerow input { flex: 1 1 220px; max-width: 280px; background: var(--surface); }
.pq-detail { grid-area: detail; margin: 8px 0 0; padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--muted) 7%, transparent); }
.pq-detail dl { grid-template-columns: minmax(96px, auto) minmax(0, 1fr); font-size: .92rem; }
.pq-detail p { margin: 12px 0 0; }
.pq-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; margin: 14px 0 0; color: var(--muted); font-size: .88rem; }
.pq-pager > span:first-child { margin-right: auto; }
.pq-empty { margin: 0; padding: 40px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.pq-empty p { margin: 0 0 10px; }
@media (max-width: 760px) {
  .pq-item { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "photo main" "when when" "acts acts" "time time" "detail detail"; gap: 8px 12px; padding: 14px 12px; }
  .pq-photo { width: 84px; height: 84px; }
  .pq-when { text-align: left; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .pq-when time { font-size: 1.25rem; }
  .pq-count { margin-top: 0; }
  .pq-acts { margin-top: 0; }
  .pq-acts .btn.small { padding: 8px 12px; }          /* dedo: botones algo mas altos */
  .pq-detail dl { grid-template-columns: 1fr; gap: 2px 0; } .pq-detail dd { margin-bottom: 8px; }
  .pq-pager { justify-content: space-between; } .pq-pager > span:first-child { flex: 1 1 100%; }
  #pq-filtros .fld { flex: 1 1 calc(50% - 6px); } #pq-filtros .fld.grow { flex: 1 1 100%; }
}
