/* =============================================================================
   Gestión de Proyectos v2 - Estilos
   Identidad del sitio (site.css v2.2): titanio claro, azul de marca, Inter +
   JetBrains Mono, consola oscura para datos. Tema oscuro automático.
   ============================================================================= */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --subtle: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --title: #0f172a;
  --body: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --blue: #0052cc;
  --blue-hover: #0041a8;
  --blue-soft: rgba(0, 82, 204, 0.08);
  --blue-ring: rgba(0, 82, 204, 0.2);
  --cyan: #00c6d7;
  --console: #090e17;
  --console-2: #0f172a;
  --console-line: rgba(255, 255, 255, 0.1);
  --ok: #059669;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: rgba(185, 28, 28, 0.08);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --radius: 12px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --logo-filter: none;
}

/* Tema oscuro: assets/tema.js pone data-theme según el sistema o lo elegido en el menú del usuario */
:root[data-theme="oscuro"] {
  --bg: #0b1120; --surface: #111a2e; --subtle: #17223a; --line: #1f2b44; --line-strong: #2c3b5a;
  --title: #f1f5f9; --body: #cbd5e1; --muted: #94a3b8; --faint: #64748b;
  --blue: #4c8dff; --blue-hover: #6ea2ff; --blue-soft: rgba(76, 141, 255, 0.14); --blue-ring: rgba(76, 141, 255, 0.3);
  --console: #060a12; --console-2: #0c1424;
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, 0.14); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, 0.14);
  --bad: #f87171; --bad-soft: rgba(248, 113, 113, 0.14);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35); --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --logo-filter: invert(1);
  color-scheme: dark;
  
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--body); font-family: var(--sans); font-size: 14px; line-height: 1.5; font-variant-ligatures: none; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
svg.lucide { width: 16px; height: 16px; flex-shrink: 0; }
.mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---------- Barra superior ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1.25rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--title); flex-shrink: 0; }
.brand-logo { height: 30px; display: block; filter: var(--logo-filter); }
.brand-text { line-height: 1.1; padding-left: 0.75rem; border-left: 1px solid var(--line); }
.brand-text small { display: block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.brand-text strong { font-size: 0.95rem; color: var(--title); }
.tabs { display: flex; gap: 0.15rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 0.6rem; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--blue); background: var(--blue-soft); }
.tab.active { color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.badge-num { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 0.66rem; display: inline-grid; place-items: center; }

.user-menu { position: relative; flex-shrink: 0; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; padding: 0.25rem; border-radius: 999px; color: var(--muted); font-size: 0.85rem; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.4rem; display: grid; }
.user-pop-head { padding: 0.5rem 0.6rem 0.6rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }
.user-pop-head strong { display: block; color: var(--title); }
.user-pop-head small { color: var(--muted); }
.user-pop a, .user-pop button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 0.6rem; border: 0; border-radius: 8px; background: none; color: var(--body); text-align: left; font-size: 0.85rem; }
.user-pop a:hover, .user-pop button:hover { background: var(--subtle); color: var(--blue); }
.user-pop form { margin: 0; }

.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; display: inline-grid; place-items: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar.xs { width: 18px; height: 18px; font-size: 0.5rem; }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; height: 36px; padding: 0 0.9rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--body); font-weight: 500; font-size: 0.85rem; white-space: nowrap; transition: all .2s; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #fff; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.btn-sm { height: 30px; padding: 0 0.65rem; font-size: 0.78rem; }
.btn-ghost { border-color: transparent; background: none; }
.mini { height: 26px; padding: 0 0.55rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 0.72rem; color: var(--muted); }
.mini:hover { border-color: var(--blue); color: var(--blue); }

.field { display: grid; gap: 0.3rem; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.field > span { font-family: var(--mono); }
.field input, .field select, .field textarea, .input { width: 100%; min-height: 38px; padding: 0.45rem 0.7rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--title); font: 0.88rem var(--sans); text-transform: none; letter-spacing: 0; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
.hint { font-size: 0.76rem; color: var(--muted); text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.seg { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; height: 32px; padding: 0 0.75rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font: 500 0.8rem var(--sans); text-transform: none; letter-spacing: 0; color: var(--body); }
.seg input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.checks label { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; font: 500 0.8rem var(--sans); text-transform: none; letter-spacing: 0; color: var(--body); cursor: pointer; }
.checks label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }

/* ---------- Página ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
h1 { margin: 0; font-size: clamp(1.45rem, 2.5vw, 1.95rem); font-weight: 800; letter-spacing: -0.025em; color: var(--title); text-wrap: balance; line-height: 1.2; }
h2 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--title); }
.eyebrow { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lead { margin: 0.35rem 0 0; color: var(--muted); max-width: 70ch; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-body { padding: 1rem; }
.count { font-family: var(--mono); font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--subtle); color: var(--muted); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--title); margin-bottom: 0.25rem; }

.flash { max-width: 1280px; margin: 1rem auto 0; padding: 0 1.25rem; }
.flash span { display: inline-block; }
.flash { display: flex; }
.flash > span { flex: 1; padding: 0.65rem 0.9rem; border-radius: 10px 0 0 10px; background: var(--console); color: #f8fafc; font-size: 0.86rem; }
.flash-x { border: 0; background: var(--console); color: #94a3b8; padding: 0 0.9rem; border-radius: 0 10px 10px 0; font-size: 1.1rem; }

/* ---------- Tareas ---------- */
.group-title { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem 0.35rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.group-title.late { color: var(--bad); }
.task { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; padding: 0.6rem 1rem; border-top: 1px solid var(--line); transition: background .15s, opacity .3s; }
.task:hover { background: var(--subtle); }
.task.busy { opacity: 0.5; pointer-events: none; }
.check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: none; display: grid; place-items: center; padding: 0; transition: all .2s; }
.check:hover { border-color: var(--ok); background: var(--ok-soft); }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .check::after { content: ''; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.task.done .t-title { text-decoration: line-through; color: var(--faint); }
.task-body { min-width: 0; }
.t-title { font-weight: 600; color: var(--title); word-break: break-word; }
.t-title:hover { color: var(--blue); }
.t-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.2rem; align-items: center; font-size: 0.75rem; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.05rem 0.45rem; border-radius: 6px; font-size: 0.7rem; font-weight: 500; border: 1px solid var(--line); background: var(--subtle); color: var(--body); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.pj { font-family: var(--mono); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, transparent); background: var(--blue-soft); }
.chip.com { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.chip.wait { color: var(--warn); background: var(--warn-soft); border-color: transparent; white-space: normal; }
.chip.doing { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.chip.new { color: #fff; background: var(--blue); border-color: var(--blue); }
.who-chip { display: inline-flex; align-items: center; gap: 0.3rem; }
.cmt { display: inline-flex; align-items: center; gap: 0.2rem; }
.cmt svg.lucide { width: 12px; height: 12px; }
.due { font-family: var(--mono); font-size: 0.72rem; white-space: nowrap; }
.due.late { color: var(--bad); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }
.t-actions { display: flex; gap: 0.3rem; align-items: center; }

.quick { display: flex; gap: 0.5rem; padding: 0.8rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; margin: 0; }
.quick-field { position: relative; flex: 1; min-width: 200px; display: flex; }
.quick input { flex: 1; min-width: 200px; height: 38px; padding: 0 0.75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--title); }
.quick input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
.quick-hint { padding: 0 1rem 0.85rem; font-size: 0.74rem; color: var(--muted); }
.quick-hint code { font-family: var(--mono); background: var(--subtle); padding: 0 0.3rem; border-radius: 4px; color: var(--blue); }

/* ---------- Consola de horas ---------- */
.console { background: var(--console); border: 1px solid var(--console-line); border-radius: 14px; color: #94a3b8; overflow: hidden; }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--console-line); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: #f8fafc; }
.led { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); display: inline-block; margin-right: 0.5rem; }
.console-body { padding: 1rem; }
.big { font-family: var(--mono); font-size: 1.9rem; color: var(--cyan); line-height: 1; font-variant-numeric: tabular-nums; }
.big small { font-size: 0.85rem; color: #94a3b8; }
.split { margin-top: 0.9rem; display: grid; gap: 0.5rem; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.6rem; font-size: 0.78rem; }
.split-row a { color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row a:hover { color: var(--cyan); }
.split-row .num { color: var(--cyan); font-size: 0.75rem; }
.split-bar { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: #1e293b; overflow: hidden; }
.split-bar i { display: block; height: 100%; background: linear-gradient(90deg, rgba(0, 198, 215, 0.4), var(--cyan)); }
.console-foot { margin-top: 0.9rem; font-size: 0.74rem; color: #94a3b8; line-height: 1.5; }

.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.65rem 1rem; border-top: 1px solid var(--line); font-size: 0.82rem; }
.side-list li:first-child { border-top: 0; }
.side-list small { display: block; color: var(--muted); font-size: 0.72rem; }
.side-list b { color: var(--title); font-weight: 600; }

/* ---------- Proyectos ---------- */
.filters { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.filters a { padding: 0.35rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; background: var(--surface); }
.filters a:hover { border-color: var(--blue); color: var(--blue); }
.filters a.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.proj { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; color: inherit; transition: all .2s; }
.proj:hover { border-color: var(--blue); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.proj-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.proj h3 { margin: 0.25rem 0 0; font-size: 1rem; color: var(--title); line-height: 1.3; }
.proj .client { font-size: 0.78rem; color: var(--muted); }
.light { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--mono); font-size: 0.66rem; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.light::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.light.g { color: var(--ok); background: var(--ok-soft); }
.light.y { color: var(--warn); background: var(--warn-soft); }
.light.r { color: var(--bad); background: var(--bad-soft); }
.light.n { color: var(--muted); background: var(--subtle); }
.bars { display: grid; gap: 0.35rem; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 40px; gap: 0.5rem; align-items: center; font-family: var(--mono); font-size: 0.66rem; color: var(--muted); }
.bar { height: 6px; border-radius: 999px; background: var(--subtle); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.bar.plan i { background: var(--line-strong); }
.proj-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.9rem; font-size: 0.75rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 0.6rem; }
.people { display: flex; }
.people .avatar { width: 24px; height: 24px; font-size: 0.55rem; border: 2px solid var(--surface); margin-left: -6px; }
.people .avatar:first-child { margin-left: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.kpi { padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.kpi b { display: block; font-family: var(--mono); font-size: 1.2rem; color: var(--title); font-variant-numeric: tabular-nums; font-weight: 600; }
.kpi span { font-size: 0.72rem; color: var(--muted); }
.kpi.neg b { color: var(--bad); }

.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.view-toggle a { padding: 0.35rem 0.75rem; font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.view-toggle a.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }

.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 0.8rem; overflow-x: auto; padding-bottom: 0.5rem; }
.col { background: var(--subtle); border-radius: 12px; padding: 0.6rem; min-height: 280px; display: flex; flex-direction: column; gap: 0.5rem; }
.col.over { outline: 2px dashed var(--blue); outline-offset: -2px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 0.2rem 0.3rem 0.4rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.7rem; cursor: grab; display: flex; flex-direction: column; gap: 0.45rem; }
.card:hover { border-color: var(--line-strong); }
.card.dragging { opacity: 0.5; }
.card-title { font-weight: 600; color: var(--title); font-size: 0.85rem; line-height: 1.35; }
.card-title:hover { color: var(--blue); }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.wait-reason { font-size: 0.72rem; color: var(--warn); }
.size { font-family: var(--mono); font-size: 0.64rem; color: var(--faint); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.data th { text-align: left; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); background: var(--subtle); white-space: nowrap; }
table.data td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
.right { text-align: right !important; }
.hours { display: flex; align-items: center; gap: 0.5rem; min-width: 150px; }
.hours .bar { flex: 1; }
.person { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }

/* ---------- Detalle de tarea / actividad ---------- */
.detail { display: grid; gap: 1rem; }
.desc { white-space: pre-wrap; color: var(--body); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 24px 1fr; gap: 0.6rem; padding: 0.6rem 1rem; border-top: 1px solid var(--line); font-size: 0.82rem; }
.feed li:first-child { border-top: 0; }
.feed small { color: var(--muted); }
.comment { padding: 0.75rem 1rem; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.comment-head b { color: var(--title); }
.comment p { margin: 0; white-space: pre-wrap; }
.states { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.states button { height: 34px; padding: 0 0.8rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 0.82rem; font-weight: 500; }
.states button:hover { border-color: var(--blue); color: var(--blue); }
.states button.on { border-color: var(--blue); background: var(--blue); color: #fff; font-weight: 600; }
.states button.on[value="hecha"] { background: var(--ok); border-color: var(--ok); }
.states button.on[value="esperando"] { background: var(--warn); border-color: var(--warn); color: #fff; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: grid; place-items: center; z-index: 50; padding: 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); background: var(--surface); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 1.25rem; display: grid; gap: 0.9rem; margin: auto; }
.modal.wide { width: min(720px, 100%); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  radial-gradient(circle at 20% 20%, var(--blue-soft), transparent 40%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2rem; display: grid; gap: 1rem; }
.auth-card .brand-logo { height: 36px; }
.error { padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 0.85rem; }
.ok-msg { padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 0.85rem; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--console); color: #f8fafc; padding: 0.6rem 1rem; border-radius: 10px; font-size: 0.85rem; z-index: 60; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) { .grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .top-inner { flex-wrap: wrap; gap: 0.6rem; padding: 0.6rem 1rem; }
  .tabs { order: 3; flex-basis: 100%; }
  .brand-text { display: none; }
  .user-name { display: none; }
  .top .btn-primary span { display: none; }
  .top .btn-primary { width: 36px; padding: 0; }
  .page { padding: 1.1rem 1rem 3rem; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .task { grid-template-columns: 26px minmax(0, 1fr); }
  .t-actions { grid-column: 2; }
  .board { grid-template-columns: repeat(4, 82%); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Correo ---------- */
.chk-inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; color: var(--body); cursor: pointer; }
.state-chip { font-family: var(--mono); font-size: 0.66rem; }
/* Casillas y radios dentro de .field no toman el estilo de los campos de texto */
.field input[type="checkbox"], .field input[type="radio"] { width: auto; min-height: 0; padding: 0; box-shadow: none; }
.field .hint, .field > span.hint { font-family: var(--sans); text-transform: none; letter-spacing: 0; }
.mini { white-space: nowrap; }
table.data td form[style*="flex"] { flex-direction: column; align-items: flex-end; }

/* ---------- Cotizaciones ---------- */
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.off { color: var(--faint); text-decoration: line-through; }
form.inline { display: inline-flex; margin: 0; }
.cot-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cot-search input { min-width: 240px; padding: 0.4rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--body); font: inherit; font-size: 0.85rem; }
.cot-search input:focus { outline: 2px solid var(--blue-ring); border-color: var(--blue); }
.cot-table .cot-title a, .cot-table td.mono a { color: var(--title); font-weight: 600; }
.cot-table .cot-title a:hover, .cot-table td.mono a:hover { color: var(--blue); }
.cot-table td.mono { font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; }
.cot-table tr.locked .cot-title { color: var(--muted); }
.cot-table .mini i, .menu-pop i { width: 14px; height: 14px; }
.cot-foot { margin-top: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Página de una cotización: ocupa todo el ancho y el redactor el resto de la altura */
.page:has(.cot-shell) { max-width: none; padding: 0; }
.cot-shell { display: flex; flex-direction: column; height: calc(100vh - 64px); height: calc(100dvh - 64px); }
.cot-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cot-id { min-width: 0; flex: 1; }
.cot-sub { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.15rem; }
.cot-sub b { color: var(--title); font-weight: 600; }
.cot-save { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.cot-save.dirty { color: var(--warn); }
.cot-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.cot-actions .btn i { width: 15px; height: 15px; }
.menu-more { position: relative; }
.menu-more summary { list-style: none; cursor: pointer; }
.menu-more summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 270px; padding: 0.35rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-pop form { margin: 0; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 0.6rem; border: 0; border-radius: 8px; background: none; color: var(--body); font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover:not(:disabled) { background: var(--subtle); color: var(--blue); }
.menu-pop button:disabled { color: var(--faint); cursor: default; }
.menu-pop button:disabled .chip { margin-left: auto; }
.menu-pop .danger { color: var(--bad); }
.cot-note { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.5rem 1.25rem; font-size: 0.82rem; background: var(--blue-soft); color: var(--body); border-bottom: 1px solid var(--line); }
.cot-note > i { width: 16px; height: 16px; color: var(--blue); flex: none; }
.cot-note > span { flex: 1; min-width: 220px; }
.cot-note.warn { background: var(--warn-soft); }
.cot-note.warn > i { color: var(--warn); }
.cot-note.ok { background: var(--ok-soft); }
.cot-note.ok > i { color: var(--ok); }
.cot-note.err { background: var(--bad-soft); }
.cot-note.err > i { color: var(--bad); }
.modal .cot-note { border: 0; border-radius: 8px; padding: 0.6rem 0.75rem; }
.cot-result select { margin-left: 0.4rem; padding: 0.2rem 0.4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--body); font: inherit; }
.cot-frame { flex: 1; width: 100%; border: 0; background: #e2e8f0; min-height: 420px; }
.cot-share { max-height: 50vh; overflow: auto; }
.cot-share li { align-items: center; }
.cot-share select { padding: 0.3rem 0.4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--body); font: inherit; font-size: 0.82rem; }
@media (max-width: 720px) {
  .cot-head { padding: 0.5rem 1rem; }
  .cot-actions .btn span { display: none; }
  .cot-shell { height: auto; }
  .cot-frame { height: 80vh; flex: none; }
}

/* ---------- Agregar tarea: selectores, sugerencias y vista previa ---------- */
.quick-tools { position: relative; flex-basis: 100%; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.quick-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border: 1px dashed var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 0.78rem; cursor: pointer; }
.quick-chip i { width: 14px; height: 14px; }
.quick-chip:hover { border-color: var(--blue); color: var(--blue); }
.quick-chip.on { border-style: solid; border-color: transparent; background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.quick-chip.bad { border-style: solid; border-color: var(--warn); color: var(--warn); }
.quick-pop { position: absolute; top: calc(100% + 6px); z-index: 25; width: 300px; max-height: 340px; overflow: auto; padding: 0.35rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.quick-pop button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.45rem 0.55rem; border: 0; border-radius: 8px; background: none; color: var(--body); font: inherit; font-size: 0.84rem; text-align: left; cursor: pointer; }
.quick-pop button:hover, .quick-pop button:focus-visible { background: var(--subtle); color: var(--blue); outline: none; }
.qp-title { padding: 0.45rem 0.55rem 0.2rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.qp-grid { display: grid; grid-template-columns: 1fr 1fr; }
.qp-date { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0.55rem; font-size: 0.84rem; color: var(--body); }
.qp-date input { padding: 0.2rem 0.35rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--title); font: inherit; }
.quick-pop .qp-clear { color: var(--muted); }
.quick-sug { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; margin: 0; padding: 0.3rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.quick-sug li { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.55rem; border-radius: 8px; font-size: 0.85rem; color: var(--body); cursor: pointer; }
.quick-sug li small { color: var(--muted); }
.quick-sug li[aria-selected="true"], .quick-sug li:hover { background: var(--blue-soft); color: var(--blue); }
.quick-preview { flex-basis: 100%; font-size: 0.78rem; color: var(--muted); min-height: 1.1em; }
.quick-preview b { color: var(--title); }
.avatar { position: relative; }
.badge-num.dot { position: absolute; top: -5px; right: -7px; font-size: 0.6rem; }

/* Barra con muchas secciones: en pantallas medianas «Nueva tarea» queda solo con el «+» y se achica la marca */
@media (max-width: 1360px) {
  .top .btn-primary[data-open="modal-tarea"] span { display: none; }
  .top .btn-primary[data-open="modal-tarea"] { padding: 0 0.65rem; }
  .user-name { display: none; }
}

/* ---------- Equipo: calendario ---------- */
.cal-mes { margin: 0; font-size: 1.15rem; color: var(--title); flex: 1; text-align: center; }
.cal-filtro select, .tareas-equipo select.reasignar, .tareas-filtro select { padding: 0.35rem 0.5rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--body); font: inherit; font-size: 0.82rem; }
.cal { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 0.6fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal-dow { background: var(--subtle); padding: 0.4rem 0.5rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cal-dia { background: var(--surface); min-height: 112px; padding: 0.35rem 0.4rem 0.45rem; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-dia.we, .cal-dow.we { background: var(--subtle); }
.cal-dia.fuera { opacity: 0.45; }
.cal-dia.feriado { background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.cal-dia.hoy { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-num { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); display: flex; align-items: center; gap: 0.3rem; }
.cal-dia.hoy .cal-num { color: var(--blue); font-weight: 700; }
.cal-fer { display: none; }
.cal-ev { display: block; font-size: 0.7rem; line-height: 1.3; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--body); }
.cal-ev.fer { color: var(--warn); font-weight: 600; background: none; padding-left: 0; }
.cal-ev.aus { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--title); border-left: 3px solid var(--c); }
.cal-ev.proy { background: var(--blue-soft); color: var(--blue); font-family: var(--mono); font-size: 0.66rem; }
.cal-ev.doc { background: var(--ok-soft); color: var(--ok); font-family: var(--mono); font-size: 0.66rem; }
.cal-ev.tarea { padding-left: 13px; position: relative; }
.cal-ev.tarea::before { content: ''; position: absolute; left: 3px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--c); }
.cal-ev.tarea:hover, .cal-ev.proy:hover, .cal-ev.doc:hover { background: var(--subtle); color: var(--blue); }
.cal-ev.tarea.hecha { text-decoration: line-through; opacity: 0.55; }
.cal-mas { font-size: 0.68rem; color: var(--blue); padding-left: 5px; }
.cal-agenda { display: none; }
.cal-paneles { margin-top: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.cal-paneles .row3 { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; }
.cal-url { display: flex; gap: 0.4rem; }
.cal-url input { flex: 1; min-width: 0; padding: 0.4rem 0.55rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--subtle); color: var(--body); font-family: var(--mono); font-size: 0.7rem; }
#modal-ausencia .seg { flex-wrap: wrap; }
@media (max-width: 760px) {
  .cal { display: none; }
  .cal-agenda { display: block; }
  .cal-paneles .row3 { grid-template-columns: 1fr; }
}

/* ---------- Equipo: tareas ---------- */
.tareas-filtro { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; padding: 0.9rem 1rem; align-items: end; }
.tareas-filtro-acc { display: flex; gap: 0.4rem; }
.tareas-equipo td { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.tareas-equipo td.t-col { width: 45%; }
.tareas-equipo .t-title { color: var(--title); font-weight: 500; }
.tareas-equipo .t-title:hover { color: var(--blue); }

/* ---------- Colaboradores de tareas ---------- */
.chip.colab { color: var(--body); background: var(--subtle); }
.chip.colab i, .chip.colab svg { width: 12px; height: 12px; }
.colab-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.colab-item { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.3rem 0.2rem 0.25rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8rem; background: var(--surface); }
.colab-item form { margin: 0; display: inline-flex; }
.colab-item button { border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 0.25rem; cursor: pointer; }
.colab-item button:hover { color: var(--bad); }
.multi-sel { position: relative; }
.multi-sel summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.multi-sel[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.multi-sel summary { list-style: none; cursor: pointer; height: 38px; display: flex; align-items: center; padding: 0 0.75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--title); font-family: var(--sans); font-size: 0.85rem; text-transform: none; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-sel summary::-webkit-details-marker { display: none; }
.multi-sel[open] summary { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
.multi-sel .multi-pop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 220px; overflow: auto; padding: 0.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.multi-sel label { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem; border-radius: 6px; font-family: var(--sans); font-size: 0.84rem; text-transform: none; letter-spacing: 0; color: var(--body); cursor: pointer; }
.multi-sel label:hover { background: var(--subtle); }
.multi-sel .multi-pop { padding-bottom: 0; }
.multi-acc .btn { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 0.82rem; }
.multi-acc { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 0.4rem 0.2rem; margin-top: 0.2rem; background: var(--surface); border-top: 1px solid var(--line); }

/* Última conexión */
td.conexion { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
td.conexion.online { color: var(--ok); font-weight: 600; }
.con-movil { display: none; }
.carga .hours .bar { width: 70px; flex: none; }
table.data.carga th, table.data.carga td { padding-left: 0.7rem; padding-right: 0.7rem; }
td.conexion.online::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 0.35rem; border-radius: 50%; background: var(--ok); vertical-align: 1px; }

/* ---------- Celular: tablas como tarjetas ---------- */
@media (max-width: 760px) {
  /* Tareas de Equipo: título arriba a todo el ancho; tipo, estado y fecha; responsable al pie */
  .tareas-equipo, .tareas-equipo tbody { display: block; }
  .tareas-equipo tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); }
  .tareas-equipo tr:first-child { border-top: 0; }
  .tareas-equipo td { display: block; padding: 0 !important; border: 0 !important; width: auto !important; }
  .tareas-equipo td:empty { display: none; }
  .tareas-equipo td.t-col { flex-basis: 100%; font-size: 0.9rem; }
  .tareas-equipo td.right { flex-basis: 100%; text-align: left; }
  .tareas-equipo select.reasignar { width: 100%; min-height: 38px; }

  /* Cotizaciones e informes: código y estado; título y cliente; autor, monto y fecha */
  .cot-table thead { display: none; }
  .cot-table, .cot-table tbody { display: block; }
  .cot-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); }
  .cot-table tr:first-child { border-top: 0; }
  .cot-table td { display: block; padding: 0 !important; border: 0 !important; }
  .cot-table td:nth-child(2) { order: 5; flex-basis: 100%; }
  .cot-table td:nth-child(3) { order: 6; }
  .cot-table td.right { order: 7; margin-left: auto; }
  .cot-table td:last-child { order: 7; font-size: 0.75rem; }
  .cot-table td.right { order: 8; }

  /* Resumen de Equipo: una tarjeta por persona: nombre; abiertas · atrasadas · esperando · hechas; horas */
  .carga thead { display: none; }
  .carga, .carga tbody { display: block; }
  .carga tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.9rem; padding: 0.7rem 1rem; border-top: 1px solid var(--line); }
  .carga tr:first-child { border-top: 0; }
  .carga td { display: block; padding: 0 !important; border: 0 !important; text-align: left !important; }
  .carga td:first-child { flex-basis: 100%; }
  .carga td.conexion { display: none; }
  .con-movil { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
  .con-movil.online { color: var(--ok); font-weight: 600; }
  .carga td[data-l]::after { content: ' ' attr(data-l); font-family: var(--sans); font-size: 0.75rem; color: var(--muted); font-weight: 400; }
  .carga td:last-child { flex-basis: 100%; }
}

/* ---------- Proyecto: etapas (filtro y avance) ---------- */
.etapas { display: flex; gap: 0.4rem; flex-wrap: wrap; padding: 0.75rem 1.25rem 0; }
.etapas a { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8rem; color: var(--body); background: var(--surface); }
.etapas a { isolation: isolate; }
.etapas a::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); background: color-mix(in srgb, var(--ok) 22%, transparent); z-index: -1; }
.etapas a .num { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.etapas a:hover { border-color: var(--blue); color: var(--blue); }
.etapas a.active { border-color: var(--blue); color: var(--blue); font-weight: 600; box-shadow: 0 0 0 2px var(--blue-ring); }
.etapas a.completa .num { color: var(--ok); font-weight: 600; }

/* ---------- App instalable y notificaciones ---------- */
.app-aviso { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.8rem 1rem; margin-bottom: 1rem; border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); border-radius: var(--radius); background: var(--blue-soft); }
.app-aviso-txt { flex: 1; min-width: 220px; display: grid; gap: 0.15rem; font-size: 0.85rem; }
.app-aviso-txt b { color: var(--title); }
.app-aviso-txt span { color: var(--body); }
.app-aviso-x { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 0.3rem; }
.push-estado { margin: 0; padding: 0.55rem 0.75rem; border-radius: 8px; background: var(--subtle); font-size: 0.85rem; }
.push-estado.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.push-estado.warn { background: var(--warn-soft); color: var(--title); }
.side-list.caja { border: 1px solid var(--line); border-radius: 10px; }
.side-list.caja li > i, .side-list.caja li > svg { width: 16px; height: 16px; color: var(--muted); }

/* Entorno de prueba: franja bien visible arriba de todo */
.franja-prueba { position: sticky; top: 0; z-index: 50; padding: 0.35rem 1rem; text-align: center; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: #fff; background: repeating-linear-gradient(45deg, #b45309, #b45309 12px, #92400e 12px, #92400e 24px); }

/* =============================================================================
   Stock (catálogo)
   ============================================================================= */
.stock-nav { margin: -0.25rem 0 1rem; }
.stock-filtros { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 0.75rem; align-items: end; padding: 0.85rem 1rem; margin-bottom: 1rem; }
.stock-filtros-btn { display: flex; gap: 0.4rem; }
.stock-table td { vertical-align: middle; }
.stock-mini-td { width: 60px; padding-right: 0 !important; }
.stock-mini { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.stock-mini.vacia { background: var(--subtle); color: var(--faint); }
.stock-mini.vacia svg { width: 18px; height: 18px; }
.stock-cod a { font-family: var(--mono); font-size: 0.78rem; color: var(--title); font-weight: 600; white-space: nowrap; }
.stock-titulo { display: block; color: var(--title); font-weight: 600; }
.stock-titulo:hover, .stock-cod a:hover { color: var(--blue); }
.stock-desc small { display: block; }
.stock-cat .chip { max-width: 260px; }
.stock-viejo { color: var(--warn); font-weight: 600; }
.stock-proximas { margin-top: 1.5rem; }
.panel-head .mini, .stock-edit > summary.mini { display: inline-flex; align-items: center; gap: 0.25rem; }
.panel-head .mini svg { width: 13px; height: 13px; }

/* Ficha */
.stock-ficha { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
.stock-col { display: grid; gap: 1.25rem; min-width: 0; }
.stock-principal { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; padding: 1rem; }
.stock-foto img, .stock-foto-vacia { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.stock-foto-vacia { display: grid; place-content: center; justify-items: center; gap: 0.35rem; background: var(--subtle); color: var(--muted); font-size: 0.8rem; border-style: dashed; }
.stock-dl { margin: 0; display: grid; gap: 0.85rem; align-content: start; }
.stock-dl dt { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stock-dl dd { margin: 0.15rem 0 0; color: var(--title); }
.stock-precio-big { font-size: 1.35rem; color: var(--title); }
.stock-codigo-big { color: var(--title); font-weight: 600; }
.stock-texto { white-space: normal; line-height: 1.6; }
table.data.stock-datos-t th { width: 40%; font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 500; background: transparent; border-bottom: 1px solid var(--line); white-space: normal; }
table.data.stock-datos-t td { color: var(--title); }
table.data.stock-datos-t tr:last-child th { border-bottom: 0; }
.stock-autoria { margin: 0; }
.stock-edit { position: relative; }
.stock-edit > summary { list-style: none; display: inline-flex; align-items: center; cursor: pointer; }
.stock-edit > summary::-webkit-details-marker { display: none; }
.stock-edit[open] > summary { border-color: var(--blue); color: var(--blue); }
.stock-edit[open] { flex-basis: 100%; order: 10; }
.stock-pop { display: grid; gap: 0.65rem; margin-top: 0.65rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); }
.stock-pop-del { margin-top: 0.5rem; }
.side-list li:has(> .stock-edit[open]) { flex-wrap: wrap; }
/* Acciones de una fila de tabla: flotan sobre la pantalla (app.js las ubica) para que la tabla con scroll no las recorte */
.flota { position: absolute; right: 0; z-index: 40; display: grid; gap: 0.7rem; width: min(360px, calc(100vw - 32px)); padding: 0.85rem; overflow-y: auto; white-space: normal; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.flota .stock-pop { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.flota .stock-pop + .stock-pop, .flota .stock-pop-del { margin: 0; padding-top: 0.7rem; border-top: 1px solid var(--line); }
@media (max-width: 600px) {
  .flotante[open]::before { content: ''; position: fixed; inset: 0; z-index: 39; background: rgba(15, 23, 42, 0.5); }
}

/* Formulario */
.stock-form { display: grid; gap: 1.25rem; max-width: 900px; }
.stock-sec { display: grid; gap: 0.85rem; }
.stock-sec h2 { margin: 0; font-size: 1rem; }
.mono-in { font-family: var(--mono) !important; }
.stock-datos { display: grid; gap: 0.5rem; }
.stock-dato { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 0.5rem; align-items: center; }
.stock-dato .mini { height: 38px; width: 38px; display: grid; place-items: center; padding: 0; }
.stock-dato .mini svg { width: 14px; height: 14px; }
.stock-radios { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.stock-radios legend { margin-bottom: 0.3rem; padding: 0; }
.stock-radio { display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.65rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; background: var(--surface); }
.stock-radio:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.stock-radio input { margin-top: 0.2rem; }
.stock-radio b { display: block; color: var(--title); font-size: 0.84rem; }
.stock-radio small { display: block; color: var(--muted); font-size: 0.74rem; line-height: 1.35; }
.stock-img-in { display: flex; gap: 0.75rem; align-items: flex-start; text-transform: none; letter-spacing: 0; font-family: var(--sans); color: var(--body); font-size: 0.82rem; }
.stock-img-in img { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; flex: none; }
.stock-img-in input[type="file"] { font-size: 0.8rem; max-width: 100%; }
.stock-acciones { display: flex; justify-content: flex-end; gap: 0.5rem; position: sticky; bottom: 0; padding: 0.75rem 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.stock-ajustes { max-width: 820px; }
.stock-arbol li > svg { width: 16px; height: 16px; color: var(--muted); }

@media (max-width: 1000px) {
  .stock-ficha { grid-template-columns: 1fr; }
  .stock-filtros { grid-template-columns: 1fr 1fr; }
  .stock-q { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .stock-principal { grid-template-columns: 1fr; }
  .stock-foto { max-width: 260px; }
  .stock-radios { grid-template-columns: 1fr; }
  .stock-filtros-btn { grid-column: 1 / -1; }
  /* Catálogo como tarjetas */
  .stock-table thead { display: none; }
  .stock-table, .stock-table tbody { display: block; }
  .stock-table tr { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 0.15rem 0.75rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); }
  .stock-table tr:first-child { border-top: 0; }
  .stock-table td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; }
  .stock-table .stock-mini-td { grid-row: 1 / span 3; width: auto; }
  .stock-table .stock-cod { grid-column: 2; }
  .stock-table .stock-precio { grid-column: 3; grid-row: 1 / span 2; }
  .stock-table .stock-desc { grid-column: 2 / span 2; }
  .stock-table .stock-cat { grid-column: 2 / span 2; }
  .stock-table .stock-cat .muted { display: none; }
  .stock-dato { grid-template-columns: 1fr auto; }
  .stock-dato [name="dato_valor[]"] { grid-column: 1; grid-row: 2; }
  .stock-dato .mini { grid-row: 1 / span 2; grid-column: 2; height: auto; }
}
.field .chk-inline { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 0.84rem; font-weight: 500; }

/* Stock: inventario (etapa 2) */
.stock-nav { display: flex; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; margin: -0.25rem 0 1rem; }
.stock-nav-sec a { font-size: 0.74rem; padding: 0.3rem 0.6rem; }
.stock-ok { color: var(--ok); font-weight: 600; }
.stock-res-chip { color: var(--warn); font-weight: 600; }
.stock-resumen { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.85rem 1rem; margin-bottom: 1.25rem; }
.stock-cifras { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.stock-cifra { display: grid; gap: 0.05rem; min-width: 90px; }
.stock-cifra span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stock-cifra b { font-size: 1.25rem; color: var(--title); line-height: 1.2; }
.stock-cifra.grande b { font-size: 1.7rem; color: var(--ok); }
.stock-cifra.grande.cero b { color: var(--bad); }
.stock-cifra small { font-size: 0.72rem; color: var(--muted); }
.stock-botones { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.stock-botones .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.stock-confirmar { padding: 1rem 1.1rem; margin-bottom: 1.25rem; border-color: var(--warn); background: var(--warn-soft); display: grid; gap: 0.6rem; }
.stock-confirmar h2 { margin: 0; font-size: 1rem; color: var(--warn); display: flex; gap: 0.4rem; align-items: center; }
.stock-confirmar h2 svg { width: 18px; height: 18px; }
.stock-confirmar ul { margin: 0; padding-left: 1.2rem; color: var(--title); }
.chip.ubic-deposito { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.chip.ubic-taller { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.stock-historial { margin-top: 1.25rem; }
.mov-table td { vertical-align: top; }
.mov-fecha small { display: block; font-size: 0.7rem; }
.mov-cant { white-space: nowrap; font-weight: 600; }
.mov-cant.mas { color: var(--ok); }
.mov-cant.menos { color: var(--bad); }
.mov-det small, .mov-prod small { display: block; font-size: 0.74rem; color: var(--muted); }
.mov-det .mov-com { color: var(--body); font-style: italic; }
.mov-det .mov-corr { color: var(--warn); }
.mov-prod a { font-size: 0.78rem; font-weight: 600; color: var(--title); }
.mov-acc { text-align: right; white-space: nowrap; }
.mov-acc .stock-edit { display: inline-block; text-align: left; }
.mov-anulado td { opacity: 0.55; }
.mov-anulado .mov-acc, .mov-anulado .mov-det { opacity: 1; }
.chip.mov-ingreso, .chip.mov-devolucion { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.mov-salida { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.chip.mov-ajuste { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.mov-anul { color: var(--muted); }
.mov-filtros { grid-template-columns: minmax(180px, 2fr) repeat(5, minmax(110px, 1fr)); }
.mov-filtros .stock-filtros-btn { grid-column: 1 / -1; justify-content: flex-end; align-items: center; gap: 0.75rem; }
.mov-totales { display: flex; gap: 1rem; flex-wrap: wrap; margin: -0.25rem 0 0.75rem; }
.stock-cant-in { display: grid; grid-template-columns: 1fr 1.3fr; gap: 0.75rem; align-items: start; }
.stock-cant-eq { grid-column: 1 / -1; margin: -0.35rem 0 0; min-height: 0; color: var(--blue); font-weight: 600; }
.stock-cant-eq:empty { display: none; }
.stock-destino { display: grid; grid-template-columns: 1fr 1.6fr; gap: 0.75rem; }
.stock-series { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.4rem; max-height: 240px; overflow-y: auto; padding: 2px; }
.stock-series:empty { display: none; }
.stock-unidades { display: grid; gap: 0.35rem; max-height: 260px; overflow-y: auto; text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.stock-unidad { display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--surface); }
.stock-unidad:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.stock-unidad:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.stock-unidad b { display: block; font-size: 0.82rem; color: var(--title); font-weight: 600; }
.stock-unidad small { display: block; font-size: 0.72rem; color: var(--muted); }
.stock-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; width: fit-content; }
.stock-seg label { cursor: pointer; }
.stock-seg input { position: absolute; opacity: 0; pointer-events: none; }
.stock-seg span { display: block; padding: 0.5rem 0.9rem; font: 500 0.84rem var(--sans); text-transform: none; letter-spacing: 0; color: var(--body); background: var(--surface); }
.stock-seg label + label span { border-left: 1px solid var(--line-strong); }
.stock-seg input:checked + span { background: var(--blue); color: #fff; }
.stock-seg input:focus-visible + span { outline: 2px solid var(--blue-ring); }
.stock-grupos { display: grid; gap: 1.25rem; max-width: 980px; }
.stock-acc-col { display: flex; gap: 0.35rem; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.stock-acc-col .mini { display: inline-flex; align-items: center; }
.stock-disp { color: var(--title); }
.stock-disp.cero { color: var(--faint); }
.stock-cant-td { white-space: nowrap; }
@media (max-width: 760px) {
  .stock-cant-in, .stock-destino { grid-template-columns: 1fr; }
  .stock-resumen { padding: 0.75rem; }
  .stock-cifras { gap: 1rem; }
  .stock-botones .btn { flex: 1 1 calc(50% - 0.4rem); justify-content: center; }
  .mov-filtros { grid-template-columns: 1fr 1fr; }
  .stock-table .stock-cant-td { grid-column: 3; grid-row: 3; text-align: right; }
  .mov-table thead { display: none; }
  .mov-table, .mov-table tbody { display: block; }
  .mov-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 0.2rem 0.6rem; padding: 0.7rem 1rem; border-top: 1px solid var(--line); }
  .mov-table tr:first-child { border-top: 0; }
  .mov-table td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; text-align: left; }
  .mov-table td.mov-cant { text-align: right; }
  .mov-table .mov-det, .mov-table .mov-prod { grid-column: 1 / -1; }
  .mov-table td.mov-acc { grid-column: 1 / -1; text-align: left; }
  .mov-acc .stock-edit[open] .stock-pop { position: static; width: auto; box-shadow: none; }
}
.mov-prod { min-width: 170px; }
.mov-prod a { white-space: nowrap; }
.mov-table td.right { white-space: nowrap; }
.mov-acc { width: 1%; }
@media (max-width: 760px) {
  .stock-principal { grid-template-columns: 110px minmax(0, 1fr); gap: 0.85rem; }
  .stock-foto { max-width: none; }
  .stock-foto-vacia span { display: none; }
  .stock-ex thead { display: none; }
  .stock-ex, .stock-ex tbody { display: block; }
  .stock-ex tr { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.6rem; padding: 0.65rem 1rem; border-top: 1px solid var(--line); }
  .stock-ex tr:first-child { border-top: 0; }
  .stock-ex td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; }
  .stock-ex td:nth-child(1) { grid-column: 1; }
  .stock-ex td:nth-child(3) { grid-column: 2; grid-row: 1; }
  .stock-ex td:nth-child(2) { grid-column: 1; }
  .stock-ex td:nth-child(4) { grid-column: 2; grid-row: 2; }
  .stock-ex td:nth-child(5) { grid-column: 1 / -1; font-size: 0.78rem; color: var(--muted); }
}

/* Stock: escáner (etapa 3) */
.stock-in-esc { display: flex; gap: 0.4rem; align-items: stretch; }
.stock-in-esc input { flex: 1; min-width: 0; }
.stock-in-esc .btn { padding: 0 0.7rem; min-height: 38px; height: auto; }
.esc-bg { position: fixed; inset: 0; z-index: 80; background: rgba(2, 6, 23, 0.85); display: grid; place-items: center; padding: 10px; overflow-y: auto; }
.esc { width: min(560px, 100%); background: var(--surface); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 0.85rem; display: grid; gap: 0.6rem; margin: auto; }
.esc-head { display: flex; justify-content: space-between; align-items: center; }
.esc-head b { color: var(--title); font-size: 1rem; }
.esc-x { border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--muted); padding: 0 0.3rem; }
.esc-video { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; max-height: 62vh; margin: 0 auto; width: 100%; outline: 3px solid transparent; transition: outline-color 0.15s; }
.esc-video.leido { outline-color: var(--ok); }
.esc-video video { width: 100%; height: 100%; object-fit: contain; display: block; }
.esc-mira { position: absolute; inset: 30% 6%; border: 2px solid rgba(255, 255, 255, 0.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.45); pointer-events: none; }
.esc-linea { position: absolute; left: 2%; right: 2%; top: calc(50% - 1px); height: 2px; background: #ef4444; box-shadow: 0 0 6px #ef4444; animation: esc-pulso 1.4s ease-in-out infinite alternate; }
@keyframes esc-pulso { from { opacity: 1; } to { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .esc-linea { animation: none; } }
.esc-marca { position: absolute; border: 3px solid #facc15; border-radius: 6px; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4); pointer-events: none; transition: all 0.12s; }
.esc-video.leido .esc-marca { border-color: #22c55e; }
.esc-opciones { display: grid; gap: 0.35rem; }
.esc-opciones b { font-size: 0.86rem; color: var(--title); }
.esc-opcion { display: grid; gap: 0.1rem; text-align: left; padding: 0.55rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--title); }
.esc-opcion:hover, .esc-opcion:focus-visible { border-color: var(--blue); background: var(--blue-soft); }
.esc-opcion small { font-size: 0.68rem; color: var(--muted); }
.esc-opcion span { font-size: 0.86rem; word-break: break-all; }
.esc-acciones { display: flex; justify-content: center; gap: 2rem; }
.esc-obturador, .esc-foto { display: grid; justify-items: center; gap: 0.25rem; border: 0; background: none; padding: 0; font: 600 0.78rem var(--sans); color: var(--title); cursor: pointer; }
.esc-circulo { width: 60px; height: 60px; border-radius: 50%; border: 4px solid var(--blue); display: grid; place-items: center; background: var(--surface); }
.esc-circulo span { width: 42px; height: 42px; border-radius: 50%; background: var(--blue); display: block; }
.esc-obturador:active .esc-circulo span { transform: scale(0.88); }
.esc-circulo.foto { border-color: var(--line-strong); background: var(--subtle) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E") center / 26px no-repeat; }
@media (max-width: 760px) {
  .esc-bg { padding: 0; place-items: stretch; }
  .esc { width: 100%; min-height: 100%; border-radius: 0; border: 0; align-content: start; }
  .esc-mira { inset: 30% 4%; }
}
.esc-ayuda { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.esc-estado { margin: 0; font-size: 0.88rem; color: var(--body); min-height: 1.3em; }
.esc-estado.bien { color: var(--ok); font-weight: 600; }
.esc-estado.mal { color: var(--bad); font-weight: 600; }
.esc-herr { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.esc-herr .btn { flex: 1 1 auto; justify-content: center; cursor: pointer; }
.esc-manual .field { gap: 0.35rem; }
.esc-manual-fila { display: flex; gap: 0.4rem; }
.esc-manual-fila .input { flex: 1; min-width: 0; font-family: var(--mono); }
.esc-pie { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.esc-diag { font-size: 0.68rem; color: var(--faint); }
.esc-pagina { display: grid; gap: 1rem; max-width: 720px; }
.esc-boton { height: 56px; font-size: 1.05rem; justify-content: center; }
.esc-boton svg { width: 22px; height: 22px; }
.esc-lectora { display: flex; gap: 0.6rem; align-items: flex-end; }
.esc-lectora .field { flex: 1; }
.esc-resultados { display: grid; gap: 0.6rem; }
.esc-card { display: flex; gap: 0.8rem; align-items: center; padding: 0.75rem 0.9rem; }
.esc-card img, .esc-card .stock-mini { width: 56px; height: 56px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.esc-card-txt { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
.esc-card-txt a b { color: var(--title); }
.esc-card-txt span { font-size: 0.86rem; }
.esc-card-txt small { font-size: 0.74rem; color: var(--muted); }
.esc-card-acc { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.esc-card.nada { display: grid; gap: 0.35rem; justify-items: start; border-color: var(--warn); }
.field > span .mini { margin-left: 0.4rem; text-transform: none; letter-spacing: 0; font-family: var(--sans); }

/* Etiquetas */
.etq-form { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.etq-lista { max-height: 300px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.etq-hojas { display: grid; gap: 1.5rem; justify-content: center; overflow-x: auto; padding-bottom: 1rem; }
.etq-hoja { width: 210mm; height: 297mm; background: #fff; color: #000; display: grid; grid-template-columns: repeat(var(--etq-cols), var(--etq-w)); grid-template-rows: repeat(var(--etq-filas), var(--etq-h)); box-shadow: var(--shadow-lg); }
.etq { box-sizing: border-box; padding: 2.5mm 3mm; display: flex; gap: 2.5mm; align-items: center; overflow: hidden; outline: 1px dashed #cbd5e1; font-family: var(--sans); }
.etq.vacia { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #eef2f7 6px, #eef2f7 12px); }
.etq-qr { flex: none; width: calc(var(--etq-h) - 6mm); height: calc(var(--etq-h) - 6mm); max-width: 40%; }
.etq-qr svg { width: 100%; height: 100%; display: block; }
.etq-txt { min-width: 0; display: grid; gap: 0.6mm; }
.etq-cod { font-family: var(--mono); font-size: 9pt; font-weight: 700; word-break: break-all; line-height: 1.15; }
.etq-desc { font-size: 7.5pt; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.etq-txt small { font-size: 6.5pt; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etq-4x10 .etq { padding: 1.5mm 2mm; gap: 1.5mm; }
.etq-4x10 .etq-cod { font-size: 7pt; }
.etq-4x10 .etq-desc { font-size: 6pt; -webkit-line-clamp: 2; }
.etq-4x10 .etq-txt small { display: none; }
.etq-2x5 .etq-cod { font-size: 12pt; }
.etq-2x5 .etq-desc { font-size: 10pt; -webkit-line-clamp: 4; }
.etq-2x5 .etq-txt small { font-size: 8pt; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .top, .franja-prueba, .flash, .no-imprimir, .modal-bg, .toast { display: none !important; }
  main.page, .page { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .etq-hojas { display: block; padding: 0; overflow: visible; }
  .etq-hoja { box-shadow: none; break-after: page; page-break-after: always; }
  .etq-hoja:last-child { break-after: auto; page-break-after: auto; }
  .etq { outline: 0; }
  .etq.vacia { background: none; }
}
@media (max-width: 760px) {
  .etq-hojas { justify-content: start; }
  .esc-card { flex-wrap: wrap; }
  .esc-card-acc { width: 100%; justify-content: stretch; }
  .esc-card-acc .btn { flex: 1; justify-content: center; }
}
.field .filters a { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 0.8rem; }

/* Stock: planillas (etapa 4) */
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.stock-previa { margin-bottom: 1.25rem; border-color: var(--blue); }
.stock-previa-res { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.stock-previa-tabla { max-height: 420px; overflow-y: auto; }
.stock-previa-acc { display: flex; gap: 0.6rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.stock-previa-acc .hint { margin-right: auto !important; }
.stock-planillas { grid-template-columns: 1fr 1fr; }
.stock-planillas .btn { justify-content: flex-start; }
.stock-mov-dl { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.6rem; align-items: end; }
.stock-planillas .stock-radio { margin-top: 0.35rem; }

/* Stock: estadísticas (etapa 5) */
.est-filtros { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.est-cifras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.est-cifra { padding: 0.9rem 1rem; display: grid; gap: 0.15rem; }
.est-cifra span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.est-cifra b { font-size: 1.35rem; color: var(--title); }
.est-cifra small { font-size: 0.74rem; color: var(--muted); }
.est-cifra.alerta b { color: var(--warn); }
.est-grid { grid-template-columns: 1fr 1fr; margin-bottom: 1.25rem; }
.est-barras { display: grid; gap: 0.45rem; }
.est-barra { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr auto; gap: 0.6rem; align-items: center; font-size: 0.8rem; }
.est-etq { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--title); }
.est-pista { height: 10px; border-radius: 5px; background: var(--subtle); overflow: hidden; }
.est-pista span { display: block; height: 100%; background: var(--blue); border-radius: 5px; }
.est-val { white-space: nowrap; font-size: 0.78rem; }
.est-val small { color: var(--muted); }
.est-tabla { margin-bottom: 1.25rem; }
.est-poco { color: var(--bad); font-weight: 700; }
.chip.abc-A { color: #fff; background: var(--blue); border-color: var(--blue); font-weight: 700; }
.chip.abc-B { color: var(--blue); background: var(--blue-soft); border-color: transparent; font-weight: 700; }
.chip.abc-C { font-weight: 700; }

/* Stock: servicios (etapa 6) */
.serv-top { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }
.serv-comb { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; align-items: end; }
.serv-tipo { margin-bottom: 1.25rem; }
.serv-table td { vertical-align: middle; }
.serv-edit { text-align: left; }
@media (max-width: 1000px) {
  .est-cifras { grid-template-columns: 1fr 1fr; }
  .est-grid, .stock-planillas, .serv-top { grid-template-columns: 1fr; }
  .est-filtros { grid-template-columns: 1fr 1fr; }
  .est-filtros > .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .est-barra { grid-template-columns: 1fr auto; }
  .est-pista { grid-column: 1 / -1; grid-row: 2; }
  .stock-mov-dl { grid-template-columns: 1fr 1fr; }
  .stock-mov-dl .btn { grid-column: 1 / -1; }
  .serv-table thead { display: none; }
  .serv-table, .serv-table tbody { display: block; }
  .serv-table tr { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.6rem; padding: 0.7rem 1rem; border-top: 1px solid var(--line); }
  .serv-table td { display: block; padding: 0 !important; border: 0 !important; }
  .serv-table td:nth-child(1) { grid-column: 1 / -1; }
  .serv-table td:nth-child(2), .serv-table td:nth-child(3) { display: none; }
  .serv-table td:nth-child(4) { text-align: left !important; }
  .serv-edit[open] .stock-pop { position: static; width: auto; box-shadow: none; }
}
.esc-opcion { position: relative; overflow: hidden; }
.esc-opcion.leido { border-color: var(--ok); background: var(--ok-soft); }
.esc-resto { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--blue); opacity: 0.6; transition: width 0.4s linear; }
.esc-opcion.leido .esc-resto { background: var(--ok); }
.esc-auto { display: flex; gap: 0.45rem; align-items: center; font-size: 0.8rem; color: var(--body); cursor: pointer; }
.esc-en-linea { display: none; margin-left: 0.4rem; font-style: normal; font-weight: 700; color: var(--warn); }
.esc-opcion.en-linea { border-color: #facc15; box-shadow: 0 0 0 1px #facc15; }
.esc-opcion.en-linea .esc-en-linea { display: inline; }
