/* ==========================================================================
   BEXP OPS — Estilos
   Noir Minimal: negro / carbón, líneas finas, sin glow.
   Acentos: azul eléctrico (en curso · Claude) y oro (detalles · Qwen).
   ========================================================================== */

:root {
  /* Marca (manual BEXP · Noir Minimal) */
  --bg: #0A0A0A;          /* negro profundo */
  --surface: #111111;     /* tarjetas */
  --surface-2: #161616;   /* tarjetas elevadas / inputs */
  --line: #1F1F1F;        /* bordes suaves */
  --line-2: #2A2A2A;      /* gris carbón: bordes marcados */
  --text: #F8F8F8;        /* blanco limpio */
  --text-2: #D0D0D0;      /* gris claro */
  --muted: #8A8A8A;       /* texto terciario */
  --blue: #0099FF;        /* azul eléctrico */
  --gold: #C4A962;        /* oro sutil */

  /* Estados (funcionales, sin neón) */
  --s-progress: var(--blue);
  --s-pending: #E8A33D;
  --s-done: #3DBE8B;
  --s-blocked: #E5484D;

  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --head-h: 56px;
  --gutter: 16px;

  --f-head: 'Montserrat', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;

}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- App bar */
.appbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: rgba(10,10,10,.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-in {
  height: var(--head-h); max-width: 1080px; margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px;
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--f-head); font-weight: 700; letter-spacing: .24em; font-size: 15px; }
.logo .sep { width: 1px; height: 14px; background: var(--line-2); }
.logo .ops { color: var(--gold); font-weight: 600; letter-spacing: .3em; font-size: 12px; }
.appbar .spacer { flex: 1; }
.live { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.live.on i { background: var(--s-done); }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: var(--text-2);
  border: 1px solid var(--line);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn .badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--gold); color: #0A0A0A; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* ------------------------------------------------------------- Layout */
main {
  max-width: 1080px; margin: 0 auto;
  padding: 20px max(var(--gutter), env(safe-area-inset-right)) calc(var(--nav-h) + env(safe-area-inset-bottom) + 32px) max(var(--gutter), env(safe-area-inset-left));
}
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 20px; }
.eyebrow { font-family: var(--f-head); font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
h1 { font-family: var(--f-head); font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -.01em; margin: 6px 0 4px; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; min-height: 28px; }
.section-head h2 { font-family: var(--f-head); font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; margin: 0; color: var(--text-2); }
.link { color: var(--blue); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.tap { transition: border-color .15s, background .15s; }
.tap:active { background: var(--surface-2); border-color: var(--line-2); }

.grid { display: grid; gap: 10px; }
@media (min-width: 900px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------------------- Pills / estados */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 1px solid currentColor; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.c-progress { color: var(--s-progress); }
.c-pending  { color: var(--s-pending); }
.c-done     { color: var(--s-done); }
.c-blocked  { color: var(--s-blocked); }
.c-gold     { color: var(--gold); }
.c-muted    { color: var(--muted); }
.c-text     { color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px;
  border: 1px solid var(--line-2); border-radius: 6px; font-size: 11.5px; color: var(--text-2);
}
.model { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 12px; font-weight: 500; border: 1px solid; }
.model.claude { color: var(--blue); border-color: rgba(0,153,255,.45); }
.model.qwen { color: var(--gold); border-color: rgba(196,169,98,.45); }
.model small { color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------------- Bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(10,10,10,.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); text-decoration: none; font-size: 10.5px; letter-spacing: .04em; min-height: 44px;
}
.nav a svg.i { width: 22px; height: 22px; }
.nav a.on { color: var(--text); }
.nav a.on::before { content: ''; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; background: var(--blue); border-radius: 0 0 2px 2px; }

/* ------------------------------------------------------------- Segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ------------------------------------------------------------- HOY */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { padding: 12px 12px 10px; min-width: 0; }
.kpi .lbl { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.kpi .lbl svg.i { width: 16px; height: 16px; }
.kpi .val { font-family: var(--f-head); font-weight: 700; font-size: 22px; margin: 6px 0 2px; white-space: nowrap; }
.kpi .delta { font-size: 11.5px; color: var(--muted); }
.kpi .delta b { font-weight: 500; }
.kpi svg.spark { width: 100%; height: 34px; margin-top: 8px; display: block; }
@media (min-width: 600px) { .kpi { padding: 16px; } .kpi .val { font-size: 28px; } }

.list > * + * { border-top: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 60px; width: 100%; text-align: left; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-size: 14.5px; font-weight: 500; }
.row-item .d { font-size: 13px; color: var(--muted); }
.row-item .time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-item > svg.i:last-child { color: var(--muted); width: 18px; height: 18px; }

.drop { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 14px; }
.drop img, .drop .ph { width: 112px; height: 140px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.drop .ph { display: grid; place-items: center; color: var(--line-2); border: 1px dashed var(--line-2); }
.drop h3 { font-family: var(--f-head); font-size: 16px; font-weight: 700; margin: 8px 0 2px; }
.drop .items { color: var(--muted); font-size: 12.5px; }
.drop .when { color: var(--text-2); font-size: 12.5px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.drop .when svg.i { width: 15px; height: 15px; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.countdown div { border: 1px solid var(--line-2); border-radius: 8px; text-align: center; padding: 6px 0 4px; }
.countdown b { display: block; font-family: var(--f-head); font-size: 17px; font-weight: 600; }
.countdown span { font-size: 9.5px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }

.cta-line { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; border-left: 2px solid var(--gold); }
.cta-line .grow { flex: 1; }

/* ------------------------------------------------------------- PEDIDOS */
.pipeline { display: flex; align-items: stretch; gap: 0; margin-bottom: 16px; }
.stage {
  flex: 1; min-width: 0; min-height: 64px; border: 1px solid var(--line-2); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 4px;
  /* el color lo da la clase de estado (.c-progress, .c-gold...) y pinta la barrita */
}
.stage .n { font-family: var(--f-head); font-weight: 700; font-size: 19px; color: var(--text); }
.stage .l { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.2; }
.stage .bar { width: 18px; height: 2px; border-radius: 2px; background: currentColor; margin-bottom: 4px; }
.stage.on { background: var(--surface-2); border-color: currentColor; }
.stage-link { width: 10px; flex: none; align-self: center; height: 1px; background: var(--line-2); }

.order { display: grid; grid-template-columns: 60px 1fr; gap: 12px; padding: 12px; align-items: start; width: 100%; text-align: left; }
.order .line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order .line.foot { margin-top: 10px; }
.order .line.foot .tags { margin-top: 0; }
.order .stuck-note { margin-top: 6px; }
.thumb { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.thumb.ph { display: grid; place-items: center; font-family: var(--f-head); font-weight: 700; font-size: 12px; letter-spacing: .1em; color: var(--muted); border: 1px solid var(--line); }
.order .ref { font-size: 12px; color: var(--muted); }
.order .prod { font-weight: 600; font-size: 14.5px; margin: 1px 0; }
.order .var { font-size: 12.5px; color: var(--muted); }
.order .tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.order .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.order .date { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.order.stuck { border-color: rgba(229,72,77,.55); }
.stuck-note { display: inline-flex; align-items: center; gap: 4px; color: var(--s-blocked); font-size: 12px; font-weight: 500; }
.stuck-note svg.i { width: 14px; height: 14px; }

/* ------------------------------------------------------------- CONTENIDO */
.week-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.week-nav .icon-btn { flex: none; }
.week { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day { min-height: 62px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid transparent; color: var(--muted); }
.day .dn { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.day .dd { font-family: var(--f-head); font-weight: 600; font-size: 16px; color: var(--text-2); }
.day .marks { display: flex; gap: 3px; height: 4px; }
.day .marks i { width: 4px; height: 4px; border-radius: 50%; background: var(--text-2); }
.day.today .dd { color: var(--gold); }
.day.on { border-color: var(--blue); background: var(--surface-2); }
.day.off { opacity: .45; }

.post { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; }
.post img { width: 84px; height: 105px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.post .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.post .plats { display: flex; gap: 6px; color: var(--text-2); }
.post .plats svg.i { width: 17px; height: 17px; }
.post h3 { font-size: 14.5px; font-weight: 600; margin: 6px 0 2px; }
.post .cap { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .hash { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.post > div { min-width: 0; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.fab {
  position: fixed; z-index: 25; right: max(var(--gutter), env(safe-area-inset-right));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  height: 48px; padding: 0 18px 0 14px; border-radius: 24px;
  background: var(--text); color: #0A0A0A; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
@media (min-width: 1112px) { .fab { right: calc((100vw - 1080px) / 2 + var(--gutter)); } }

/* ------------------------------------------------------------- AGENTES */
.savings { padding: 18px; position: relative; overflow: hidden; }
.savings::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--gold); }
.savings .big { font-family: var(--f-head); font-weight: 700; font-size: 48px; line-height: 1; margin: 10px 0 4px; }
.savings .big small { font-size: 18px; color: var(--muted); font-weight: 600; }
.savings svg.chart { width: 100%; height: 110px; margin-top: 14px; display: block; overflow: visible; }
.savings-in { display: grid; gap: 4px; }
@media (min-width: 600px) { .savings-in { grid-template-columns: 220px 1fr; align-items: center; gap: 20px; } .savings svg.chart { margin-top: 0; } }

.agent { padding: 14px; display: grid; grid-template-columns: 44px 1fr; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--text-2); }
.agent h3 { margin: 0; font-size: 15px; font-weight: 600; }
.agent .desc { color: var(--muted); font-size: 12.5px; margin: 2px 0 10px; }
.agent .stats { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: end; margin-top: 12px; }
.agent .k { font-size: 11px; color: var(--muted); }
.agent .v { font-family: var(--f-head); font-weight: 700; font-size: 18px; }
.agent .v small { font-family: var(--f-body); font-weight: 500; font-size: 11px; color: var(--s-done); margin-left: 4px; }
.meter { height: 3px; background: var(--line-2); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: currentColor; border-radius: 2px; }
.meter-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); }

.flow { display: grid; grid-template-columns: 1fr 24px 1fr 24px 1fr; align-items: center; padding: 16px 12px; text-align: center; }
.flow .node { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 4px; font-size: 12px; }
.flow .node b { display: block; font-family: var(--f-head); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 2px; }
.flow .node span { color: var(--muted); font-size: 11px; }
.flow .wire { height: 1px; background: var(--line-2); }

/* ------------------------------------------------------------- APROBACIONES */
/* Pila: las tarjetas de atrás asoman 26px cada una por encima de la principal */
.stack { position: relative; }
.stack .behind {
  position: absolute; left: 0; right: 0; height: 80px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); padding: 5px 16px 0; display: flex; align-items: flex-start; gap: 8px;
  color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden;
}
.stack .behind svg.i { width: 15px; height: 15px; }
.stack .behind.g0 { top: 0;    transform: scale(.92); transform-origin: top; opacity: .55; }
.stack .behind.g1 { top: 26px; transform: scale(.96); transform-origin: top; opacity: .85; }
.stack .behind.g1:only-of-type { top: 0; }
.approval { position: relative; padding: 16px; border-color: var(--line-2); touch-action: pan-y; transition: transform .35s ease, opacity .35s ease; }
.approval.out-r { transform: translateX(120%) rotate(8deg); opacity: 0; }
.approval.out-l { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.approval .hd { display: flex; align-items: center; gap: 12px; }
.approval .kind-ic { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.approval .hd .grow { flex: 1; min-width: 0; }
.approval .hd h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.approval .hd .d { font-size: 12.5px; color: var(--muted); }
.approval .body { display: grid; gap: 14px; margin-top: 16px; }
.approval .body.media { grid-template-columns: 112px 1fr; }
@media (min-width: 600px) { .approval .body.media { grid-template-columns: 200px 1fr; } }
.approval .body img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-sm); }
.approval .txt { white-space: pre-line; font-size: 14.5px; color: var(--text); }
.approval .tags-txt { color: var(--blue); font-size: 13.5px; margin-top: 8px; }
.budget { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.budget .from, .budget .to { font-family: var(--f-head); font-weight: 700; font-size: 26px; }
.budget .from { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.budget .unit { font-size: 12px; color: var(--muted); }
.reason { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 16px; }
.reason svg.i { color: var(--gold); width: 18px; height: 18px; margin-top: 2px; }
.reason b { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); }
.reason p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.btn {
  min-height: 52px; border-radius: 12px; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2);
}
.btn.primary { background: var(--text); color: #0A0A0A; border-color: var(--text); }
.btn.danger { color: var(--s-blocked); border-color: rgba(229,72,77,.5); }
.btn.ghost { color: var(--text-2); grid-column: 1 / -1; min-height: 46px; }
.btn:active { transform: scale(.98); }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.dots i.on { background: var(--text); }
.swipe-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ------------------------------------------------------------- ALMACÉN (lista) */
.status-strip { padding: 16px; }
.status-bar { display: flex; height: 4px; border-radius: 2px; overflow: hidden; gap: 2px; margin: 12px 0 14px; }
.status-bar i { display: block; height: 100%; background: currentColor; }
.legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.legend div { display: flex; flex-direction: column; gap: 2px; }
.legend .k { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend .k .dot { width: 6px; height: 6px; }
.legend b { font-family: var(--f-head); font-size: 20px; font-weight: 700; color: var(--text); }

.zone { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 14px; width: 100%; text-align: left; }
.zone .avatar { border-radius: 12px; }
.zone h3 { margin: 0; font-size: 15px; font-weight: 600; }
.zone .mini { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.zone .mini span { display: inline-flex; align-items: center; gap: 4px; }
.zone .mini .dot { width: 6px; height: 6px; }
.zone .load { font-family: var(--f-head); font-weight: 600; font-size: 13px; color: var(--text-2); }

/* ------------------------------------------------------------- ALMACÉN 3D */
.stage-slot {
  height: calc(100svh - var(--head-h) - var(--nav-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 150px);
  min-height: 380px;
}
.stage-slot.loading { display: grid; place-items: center; color: var(--muted); font-size: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.stage3d {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
/* Etiqueta táctil: área de toque ampliada sin agrandar el dibujo */
.zlabel::after { content: ''; position: absolute; inset: -9px -4px; }
.stage3d canvas { display: block; width: 100%; height: 100%; }
.stage3d .labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.zlabel {
  position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform;
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 8px;
  background: rgba(10,10,10,.8); border: 1px solid var(--line-2); border-radius: 7px;
  font: 600 9.5px/1 var(--f-head); letter-spacing: .14em; text-transform: uppercase; color: var(--text); white-space: nowrap;
}
.zlabel b { color: var(--gold); font-weight: 700; letter-spacing: 0; }
.zlabel.on { border-color: var(--blue); }
.zlabel.hub { pointer-events: none; background: none; border: 0; color: var(--muted); font-size: 9.5px; letter-spacing: .3em; min-height: 0; }
.hud { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; pointer-events: none; }
.hud-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 10px; border-radius: 10px; background: rgba(10,10,10,.78); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.hud-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hud-legend i { width: 7px; height: 7px; border-radius: 2px; }
.hud-legend b { color: var(--text); font-weight: 600; }
.hud-btn {
  pointer-events: auto; flex: none; min-height: 44px; padding: 0 14px; border-radius: 12px;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2);
  background: rgba(10,10,10,.85); border: 1px solid var(--line-2);
}
.hud-btn svg.i { width: 16px; height: 16px; }
.hud-btn:active { border-color: var(--blue); color: var(--text); }
.hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); pointer-events: none;
  font-size: 11.5px; color: var(--muted); background: rgba(10,10,10,.78); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; transition: opacity .6s;
}
.hint.gone { opacity: 0; }

/* Controles de tarea dentro del panel inferior */
.task .pill { cursor: pointer; min-height: 32px; }
.task select {
  appearance: none; -webkit-appearance: none; height: 32px; padding: 0 26px 0 10px; border-radius: 8px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8A8A' stroke-width='1.5'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 6px center / 14px;
  color: var(--text-2); border: 1px solid var(--line-2); font: 12px var(--f-body); max-width: 118px;
}
.task .ctrls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* ------------------------------------------------------------- Bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; max-width: 640px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 20px 20px 0 0;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
}
.sheet-wrap.open { pointer-events: auto; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet .grab { padding: 10px 0 6px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.sheet .grab i { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); }
.sheet .sheet-body { overflow-y: auto; padding: 4px 16px 20px; -webkit-overflow-scrolling: touch; }
.sheet h2 { font-family: var(--f-head); font-size: 20px; font-weight: 700; margin: 4px 0 2px; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 56px; }
.task + .task { border-top: 1px solid var(--line); }
.task .grow { flex: 1; min-width: 0; }
.task .t { font-size: 14px; font-weight: 500; }
.task .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
textarea.edit {
  width: 100%; min-height: 160px; margin-top: 12px; padding: 12px; border-radius: 12px; resize: vertical;
  background: var(--bg); color: var(--text); border: 1px solid var(--line-2); font: 15px/1.5 var(--f-body);
}
textarea.edit:focus { outline: none; border-color: var(--blue); }

/* ------------------------------------------------------------- Toast */
.toast {
  position: fixed; left: 50%; z-index: 60; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  transform: translate(-50%, 20px); opacity: 0; transition: .25s;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 16px;
  font-size: 14px; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------- Formularios (panel inferior) */
.form { display: grid; gap: 14px; margin-top: 14px; }
.form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.form input:not([type=checkbox]), .form select, .form textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line-2); font: 15px/1.4 var(--f-body);
}
.form textarea { min-height: 84px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--blue); }
.form input[type=datetime-local] { color-scheme: dark; }
.form .checks { display: flex; gap: 18px; border: 0; padding: 0; margin: 0; }
.form .checks legend { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.form .checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); min-height: 44px; }
.form .checks input { width: 20px; height: 20px; accent-color: var(--blue); }
.form .actions { margin-top: 4px; }
.new-task { width: 100%; margin-top: 12px; }
.task [data-hist] { cursor: pointer; }

/* ------------------------------------------------------------- LOGIN */
.login-page { min-height: 100svh; display: grid; place-items: center; padding: 24px max(var(--gutter), env(safe-area-inset-left)); }
.login { width: 100%; max-width: 360px; }
.login .logo { justify-content: center; font-size: 20px; margin-bottom: 8px; }
.login .tag { display: block; text-align: center; border: 0; color: var(--muted); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 32px; }
.login .card { padding: 22px 18px; border-top: 1px solid var(--gold); }
.login .btn.primary { width: 100%; }
.login .error { color: var(--s-blocked); font-size: 13px; min-height: 18px; margin: 0; }

/* ------------------------------------------------------------- Detalle de tarea: resultado y herramientas */
.result {
  white-space: pre-wrap; font-size: 14px; line-height: 1.55; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-2); border-left: 2px solid var(--gold);
  border-radius: 12px; padding: 12px 14px; margin: 12px 0; max-height: 40vh; overflow: auto; word-break: break-word;
}
.result a, .steps a { color: var(--blue); }
.tools { display: grid; gap: 10px; margin-top: 12px; }
.tool { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.tool-h { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tool-h svg.i { width: 18px; height: 18px; color: var(--gold); }
.tool-h span { font-size: 12px; }
.tool-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.tool select {
  min-height: 46px; padding: 0 12px; border-radius: 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); font: 14px var(--f-body);
}
.tool .btn { min-height: 46px; padding: 0 16px; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.ghost.danger { color: var(--s-blocked); border-color: transparent; grid-column: auto; }

/* ------------------------------------------------------------- CONEXIONES */
.conn { padding: 16px; display: grid; gap: 12px; align-content: start; }
.conn-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.conn-what { margin: 0; color: var(--muted); font-size: 13px; }
.conn details { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.conn summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 13.5px; color: var(--text-2); list-style: none; }
.conn summary::-webkit-details-marker { display: none; }
.conn summary::after { content: '+'; margin-left: auto; color: var(--muted); }
.conn details[open] summary::after { content: '–'; }
.steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.steps a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.steps a svg.i { width: 14px; height: 14px; }
.redirect { display: grid; gap: 6px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.redirect code { font-size: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.redirect .btn { justify-self: start; }
.conn .form { margin-top: 0; gap: 10px; }
.conn-test { margin: 0; font-size: 13px; }
.conn-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.conn-actions .btn { min-height: 44px; padding: 0 16px; text-decoration: none; }
.icon-btn .badge[hidden] { display: none; }

.post-preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin: 10px 0; }
.post.tap { cursor: pointer; text-align: left; }
