:root {
  --bg: #f5f3ef; --panel: #fff; --text: #2b2620; --muted: #7a7064; --line: #e4ded5;
  --accent: #8a5a2b; --accent-2: #b07a45; --accent-soft: #f3e8dc;
  --ok: #2f7d4f; --ok-soft: #e3f3e8; --err: #b23b2e; --err-soft: #fbe6e3; --warn: #b7791f; --warn-soft: #fdf3dc;
  --side: #2f2821; --side-text: #e9e1d6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.side { width: 230px; flex: none; background: var(--side); color: var(--side-text); padding: 16px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .marca { display: block; margin: 0; background: none; border-radius: 0; padding: 0 18px 14px; font-weight: 700; font-size: 16px; color: #fff; border-bottom: 1px solid #ffffff1a; }
.side .marca small { display: block; font-weight: 400; font-size: 12px; color: #b9ad9e; }
.side h4 { margin: 16px 18px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #a89a89; }
.side a { display: block; padding: 6px 18px; color: var(--side-text); border-left: 3px solid transparent; }
.side a:hover { background: #ffffff10; text-decoration: none; }
.side a.on { background: #ffffff18; border-left-color: var(--accent-2); color: #fff; }
.side .paso { display: inline-block; width: 18px; color: #a89a89; font-size: 12px; }

main { flex: 1; padding: 22px 28px 60px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); margin-bottom: 18px; }
.cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.btn { display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 6px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn.sec { background: #fff; color: var(--accent); }
.btn.sec:hover { background: var(--accent-soft); }
.btn.peq { padding: 2px 8px; font-size: 12px; }
.btn.rojo { background: #fff; color: var(--err); border-color: #e3b6b0; }
.btn.rojo:hover { background: var(--err-soft); }
.btn.verde { background: var(--ok); border-color: var(--ok); }
.acciones { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #faf8f5; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
tbody tr:hover { background: #fcfaf7; }
.tabla-scroll { overflow-x: auto; }

input, select, textarea { font: inherit; padding: 5px 8px; border: 1px solid #d4ccc0; border-radius: 5px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent-2); }
input.n { width: 90px; text-align: right; }
input.n-s { width: 70px; text-align: right; }
textarea { min-height: 70px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.campos .ancho { grid-column: 1 / -1; }
.fila-alta { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fila-alta > div { flex: 1 1 120px; }
.fila-alta > div.mini { flex: 0 0 95px; }
.fila-alta > div.grande { flex: 3 1 220px; }
.buscador { display: flex; gap: 8px; margin-bottom: 12px; max-width: 560px; }

.flash { padding: 9px 12px; border-radius: 6px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--err-soft); color: var(--err); }
.flash.info { background: var(--warn-soft); color: #6e4810; }

.estado { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eee8df; color: #5b5146; }
.estado.Terminada, .estado.Aceptada, .estado.Servido, .estado.Entregado, .estado.Cobrada, .estado.Expedido, .estado.Ofertado, .estado.Facturado { background: var(--ok-soft); color: var(--ok); }
.estado.En.curso, .estado.En.fabricación, .estado.Enviada, .estado.Calculado, .estado.Cerrado { background: var(--warn-soft); color: var(--warn); }
.estado.Anulada, .estado.Anulado, .estado.Rechazada, .estado.Descartado { background: var(--err-soft); color: var(--err); }
.vivo { color: var(--ok); font-weight: 600; }
.vivo::before { content: "● "; animation: parpadeo 1.2s infinite; }
@keyframes parpadeo { 50% { opacity: .2; } }
.mas { color: var(--err); } .menos { color: var(--ok); }
.muted { color: var(--muted); }

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 700; }
.kpi .l { font-size: 12px; color: var(--muted); }

.flujo { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; font-size: 13px; }
.flujo .p { padding: 4px 10px; border-radius: 14px; background: #ece6dd; color: var(--muted); }
.flujo .p.on { background: var(--accent); color: #fff; }
.flujo .p a { color: inherit; }
.flujo .sep { color: #c0b5a7; }

.barra { height: 8px; background: #eee8df; border-radius: 4px; overflow: hidden; min-width: 80px; }
.barra > i { display: block; height: 100%; background: var(--ok); }
.barra > i.pasado { background: var(--err); }

.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tarjeta { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.tarjeta h3 { margin: 0 0 2px; font-size: 15px; }

@media (max-width: 800px) {
  .layout { display: block; }
  .side { width: auto; height: auto; position: static; }
  main { padding: 16px; }
}
@media print {
  .side, .no-print { display: none !important; }
  main { padding: 0; }
  body { background: #fff; }
}

/* ---------- Usuario, soporte y menús por rol ---------- */
.side { display: flex; flex-direction: column; }
.side .yo { margin-top: auto; padding: 14px 18px 4px; border-top: 1px solid #ffffff1a; }
.side .yo b { display: block; color: #fff; } .side .yo small { display: block; color: #b9ad9e; margin-bottom: 6px; }
.side .yo a { padding: 4px 0; border: 0; font-size: 13px; color: #d8cdbf; }
.soporte { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: 6px;
  background: var(--warn-soft); color: #6e4810; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.roles-info { margin-bottom: 16px; font-size: 13px; }
.rol { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eee8df; }
.rol.admin { background: var(--accent-soft); color: var(--accent); } .rol.taller { background: var(--ok-soft); color: var(--ok); }
tr.apagado td { color: #a99e91; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: 6px 0; }
label.check input { width: auto; }
form.plan { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 340px; }
form.plan input[name=notas] { flex: 1; min-width: 140px; }
details > summary { cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; }
details > summary h2 { color: var(--accent); }
.qr-panel { display: flex; gap: 18px; align-items: center; }
.qr-panel h2 { margin-bottom: 2px; } .qr-panel p { margin: 0 0 10px; }
.qr-panel img { flex: none; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ---------- Pantallas de acceso ---------- */
body.acceso { display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; min-height: 100vh; background: var(--panel); }
.acceso-lado { position: relative; overflow: hidden; padding: 48px 44px; background: var(--side); color: var(--side-text); }
.acceso-marca { font-size: 30px; font-weight: 700; line-height: 1.1; color: #fff; letter-spacing: -.01em; }
.acceso-marca span { color: #c9a77f; font-weight: 600; }
.acceso-lado p { max-width: 30ch; margin-top: 18px; color: #c9bcab; font-size: 15px; line-height: 1.55; }
.veta { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46%; }
.veta path, .veta ellipse { fill: none; stroke: #8a5a2b; stroke-width: 1.4; opacity: .55; }
.acceso-form { display: grid; place-items: center; padding: 40px 24px; }
.acceso-caja { width: min(440px, 100%); }
.acceso-caja h1 { font-size: 26px; }
.pila { display: grid; gap: 14px; }
.pila .dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pila input { padding: 9px 11px; }
.btn.grande { padding: 11px 18px; font-size: 15px; font-weight: 600; }
.opciones-modo { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.modo { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.modo input { width: auto; margin-top: 3px; }
.modo small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.modo:has(input:checked) { border-color: var(--accent-2); background: var(--accent-soft); }
@media (max-width: 760px) {
  body.acceso { grid-template-columns: 1fr; }
  .acceso-lado { padding: 28px 24px 70px; } .veta { height: 60px; }
}

/* ---------- Informes ---------- */
.pestanas { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.pestanas a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pestanas a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pestanas a:hover { text-decoration: none; color: var(--text); }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filtros > div { flex: 0 1 170px; } .filtros > div:last-child { flex: 0 0 auto; }
.kpi .v.mas { color: var(--err); }
table.informe td { vertical-align: top; }
.col-barra { width: 150px; } .col-barra.ancha { width: 210px; }
th.col-barra { font-size: 11px; }
.div-barra { position: relative; height: 12px; margin-top: 4px; background: linear-gradient(90deg, transparent calc(50% - .5px), #c9bfb2 calc(50% - .5px), #c9bfb2 calc(50% + .5px), transparent calc(50% + .5px)); }
.div-barra i { position: absolute; top: 1px; bottom: 1px; border-radius: 2px; }
.div-barra i.pos { background: var(--ok); } .div-barra i.neg { background: var(--err); }
.par-barras { display: grid; gap: 3px; margin-top: 3px; }
.par-barras i { display: block; height: 7px; border-radius: 2px; min-width: 1px; }
.par-barras i.prev, .ley.prev { background: #cdbfae; } .par-barras i.real, .ley.real { background: var(--ok); }
.par-barras i.real.pasado { background: var(--err); }
.ley { display: inline-block; width: 10px; height: 7px; border-radius: 2px; vertical-align: 1px; }
@media print { .pestanas, .filtros, .soporte { display: none !important; } }

/* ---------- Claude ---------- */
.side a.ia { color: #f0d9bd; }
.chat-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.chat-lista { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.chat-lista a:not(.btn) { padding: 6px 8px; border-radius: 6px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.chat-lista a.on { background: var(--accent-soft); color: var(--accent); }
.chat-lista .btn { margin-bottom: 10px; }
.chat { max-width: 860px; }
.chat-vacio { padding: 10px 0 20px; }
.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; }
.sugerencias button { font: inherit; padding: 7px 12px; border: 1px solid var(--line); background: var(--panel); border-radius: 16px; cursor: pointer; color: var(--text); text-align: left; }
.sugerencias button:hover { border-color: var(--accent-2); }
.mensajes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.msg { padding: 10px 14px; border-radius: 10px; max-width: 92%; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin: 0; } .msg ul { margin: 4px 0 8px; padding-left: 20px; }
.msg table { margin: 6px 0; font-size: 13px; background: #fff; }
.msg.yo { align-self: flex-end; background: var(--accent); color: #fff; white-space: pre-wrap; }
.msg.claude { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.herr { align-self: flex-start; max-width: 92%; font-size: 13px; color: var(--muted); }
.herr summary { cursor: pointer; padding: 2px 0; }
.herr summary::before { content: "▸ "; } .herr[open] summary::before { content: "▾ "; }
.herr pre { white-space: pre-wrap; background: #f4f0ea; padding: 8px 10px; border-radius: 6px; font-size: 12px; color: var(--text); }
.herr table { font-size: 12px; background: #fff; }
.tarjeta-ia { align-self: flex-start; max-width: 92%; padding: 10px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent-2); }
.tarjeta-ia ul { margin: 6px 0; padding-left: 20px; }
.tarjeta-ia.propuesta.pendiente { border-left-color: var(--warn); background: #fffdf8; }
.tarjeta-ia.propuesta.aplicada { border-left-color: var(--ok); }
.tarjeta-ia.propuesta.descartada { opacity: .7; border-left-color: #c9bfb2; }
.tarjeta-ia s { color: var(--muted); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); }
.chat-form textarea { min-height: 56px; resize: vertical; }
.pensando { margin: 0; }
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; } .chat-lista { position: static; } }

/* Tareas */
.casilla { width: 20px; height: 20px; border: 2px solid #b8ab9a; border-radius: 5px; background: #fff; cursor: pointer; padding: 0; vertical-align: middle; }
.casilla:hover { border-color: var(--ok); }
.casilla.marcada { background: var(--ok); border-color: var(--ok); }
.casilla.marcada::after { content: "✓"; color: #fff; font-size: 13px; line-height: 16px; display: block; text-align: center; }
.prioridad { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.prioridad.alta { background: var(--err-soft); color: var(--err); } .prioridad.baja { background: #eee8df; color: var(--muted); }

/* Importar */
.subida { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.zona-archivo { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 2px; padding: 18px; border: 2px dashed #d4ccc0; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.zona-archivo span { color: var(--muted); font-size: 12px; }
.zona-archivo input { margin-top: 8px; border: 0; padding: 0; }

/* Barras de informes personalizados */
.barra-h { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 100px; gap: 10px; align-items: center; padding: 3px 0; font-size: 13px; }
.barra-h > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-h > div { height: 12px; background: #f1ece5; border-radius: 3px; overflow: hidden; }
.barra-h i { display: block; height: 100%; background: var(--accent-2); } .barra-h i.neg { background: var(--err); }
.barra-h b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Avance, imágenes e iconos ---------- */
.avance { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.avance .barra { display: inline-block; vertical-align: middle; }
.avance b { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 34px; }
.miniatura { display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; background: var(--accent-soft); color: var(--accent); font-weight: 700; vertical-align: middle; }
.marca-logo { display: block; max-width: 150px; max-height: 46px; margin-bottom: 8px; background: #fff; padding: 4px; border-radius: 4px; }
.subir-imagen { display: flex; gap: 12px; align-items: center; }
.subir-imagen > div { display: flex; flex-direction: column; gap: 4px; }
.vista-imagen { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.vista-imagen.ancha { width: auto; max-width: 160px; height: 56px; object-fit: contain; background: #fff; padding: 4px; }
.selector-iconos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.selector-iconos label { margin: 0; cursor: pointer; }
.selector-iconos input { position: absolute; opacity: 0; width: 1px; }
.selector-iconos span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: #fff; text-align: center; }
.selector-iconos small { font-size: 11px; color: var(--muted); line-height: 1.2; }
.selector-iconos input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.selector-iconos input:focus-visible + span { outline: 2px solid var(--accent-2); }
.celda-icono, .icono-fase { color: var(--accent); line-height: 0; }
.icono { vertical-align: middle; flex: none; }
tr.alerta td { background: #fff6f4; }
.cabecera-cliente { display: flex; align-items: center; gap: 10px; }
.cabecera-cliente img { max-height: 40px; max-width: 120px; object-fit: contain; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 12px; background: #eee8df; color: var(--text); font-size: 12px; }
.etq { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #efe6da; color: var(--accent); }
.etq.servicio { background: #e3ecf5; color: #2f5d8a; }
input.fino, select.fino { padding: 3px 6px; font-size: 13px; }
tr.gasto-real td { background: #fbfdfb; }

/* ---------- Desplegable con fotos (recursos, máquinas, artículos) ---------- */
.sf { position: relative; min-width: 150px; }
.sf-oculto { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px; }
.sf-boton { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 3px 8px 3px 4px; text-align: left;
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.sf-boton:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.sf-fino .sf-boton { min-height: 30px; font-size: 13px; }
.sf-flecha { margin-left: auto; color: var(--muted); font-size: 11px; }
.sf-lista { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); min-width: 240px; max-height: 300px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(40,30,20,.16); }
.sf-arriba .sf-lista { top: auto; bottom: calc(100% + 4px); }
.sf-lista li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.sf-lista li:hover, .sf-lista li:focus { background: var(--accent-soft); outline: none; }
.sf-lista li[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); }
.sf-av { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.sf-lista .sf-av { width: 36px; height: 36px; }
.sf-nada { background: transparent; border: 1px dashed #cfc5b8; }
.sf-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sf-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-txt small { color: var(--muted); font-size: 11px; }
.miniatura.prod { border-radius: 6px; }
.con-foto { display: flex; align-items: center; gap: 8px; }

/* ---------- Dashboard de la orden ---------- */
.dash-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.dash-estado { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 18px 0; }
.dash-kpi { padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.dash-kpi .l { color: var(--muted); font-size: 12px; }
.dash-kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: 2px 0; }
.dash-kpi.destacado { background: var(--accent); border-color: var(--accent); color: #fff; }
.dash-kpi.destacado .l { color: #f1e4d4; }
.dash-kpi.perdida { background: var(--err); border-color: var(--err); }
.comparativa { display: grid; gap: 14px; }
.comp-fila { display: grid; grid-template-columns: 120px 1fr 120px; gap: 12px; align-items: center; }
.comp-fila .nom { font-weight: 600; }
.comp-barras { display: grid; gap: 4px; }
.comp-barras > div { display: grid; grid-template-columns: 52px 1fr 82px; align-items: center; gap: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.comp-barras .pista { display: block; min-width: 0; }
.comp-barras b { font-weight: 600; text-align: right; white-space: nowrap; }
.comp-barras i { display: block; height: 14px; border-radius: 3px; min-width: 2px; }
.comp-barras .p i { background: #cdbfae; } .comp-barras .r i { background: var(--ok); } .comp-barras .r i.pasado { background: var(--err); }
.comp-barras small { color: var(--muted); width: 54px; flex: none; }
.comp-fila .res { text-align: right; font-variant-numeric: tabular-nums; }
.cascada { width: 100%; height: auto; max-height: 340px; }
.cascada text { font: 12px system-ui, sans-serif; fill: var(--text); }
.cascada .valor { font-weight: 700; }
.cascada .venta { fill: var(--accent); } .cascada .coste { fill: #c88a6a; } .cascada .margen { fill: var(--ok); } .cascada .perdida { fill: var(--err); }
.cascada .eje { stroke: #b9ae9f; } .cascada .conector { stroke: #b9ae9f; stroke-dasharray: 3 3; }
.cascada .previsto { stroke: var(--text); stroke-width: 2; stroke-dasharray: 5 3; }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.leyenda i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.dias { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 10px; overflow-x: auto; }
.dias div { flex: 1 0 18px; max-width: 36px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 10px; color: var(--muted); }
.dias i { display: block; width: 100%; background: var(--accent-2); border-radius: 3px 3px 0 0; min-height: 2px; }
@media (max-width: 760px) { .comp-fila { grid-template-columns: 1fr; } .comp-fila .res { text-align: left; } }
@media print { .side, .no-imprimir, .soporte { display: none !important; } .layout { display: block; } main { padding: 0; } .panel, .dash-kpi { break-inside: avoid; } }

td.num, th.num { white-space: nowrap; }

/* Menú «Clonar» de los documentos */
.menu-clonar { position: relative; }
.menu-clonar > summary { list-style: none; }
.caja-clonar { position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; width: 300px; display: grid; gap: 8px; padding: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(40,30,20,.16); }
.caja-clonar p { margin: 0; font-size: 12px; }

.casillas-multi { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 6px 0; }
.muestra-color { display: inline-block; width: 22px; height: 22px; border-radius: 6px; vertical-align: middle; border: 1px solid rgba(0,0,0,.1); }

/* ---------- Inicio: el taller por secciones ---------- */
.secc-panel { padding: 16px 18px 18px; }
.secc-cab { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.secc-cab h2 { margin: 0; }
.secc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.secc { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  border-top: 5px solid var(--sc); transition: box-shadow .15s, transform .15s; }
.secc:hover { box-shadow: 0 6px 18px rgba(40,30,20,.1); transform: translateY(-1px); }
.secc header { display: flex; align-items: center; gap: 8px; }
.secc header i { width: 10px; height: 10px; border-radius: 3px; background: var(--sc); }
.secc header b { font-size: 15px; } .secc header .muted { margin-left: auto; font-size: 11px; }
.secc-cifras { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.anillo-s { width: 64px; height: 64px; }
.anillo-s .f { fill: none; stroke: #efe8de; stroke-width: 7; }
.anillo-s .v { fill: none; stroke: var(--sc); stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .8s ease; }
.anillo-s .v.pasado { stroke: var(--err); }
.anillo-s text { font: 700 13px system-ui, sans-serif; fill: var(--text); }
.carga .l { font-size: 11px; color: var(--muted); }
.carga .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.barra-carga { height: 6px; margin: 4px 0; border-radius: 3px; background: #f1ebe2; overflow: hidden; }
.barra-carga i { display: block; height: 100%; background: var(--sc); border-radius: 3px; transition: width .8s ease; }
.secc-ahora { display: flex; flex-direction: column; gap: 6px; min-height: 30px; }
.quien-ahora { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.quien-ahora img, .quien-ahora .ini { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ok); }
.quien-ahora .ini { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.quien-ahora.maquina img, .quien-ahora.maquina .ini { border-radius: 7px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #9bb5a4; }
.quien-ahora b { display: block; } .quien-ahora small { color: var(--muted); }
.nadie { font-size: 12px; }
.secc-dias { display: grid; grid-template-columns: repeat(7, 1fr) auto; gap: 4px; align-items: end; height: 54px; }
.secc-dias > div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.secc-dias i { display: block; width: 100%; max-width: 16px; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--sc); opacity: .85; }
.secc-dias small { font-size: 9px; color: var(--muted); }
.secc-dias .tot { font-size: 13px; font-weight: 700; text-align: right; padding-left: 6px; line-height: 1.1; }
.secc-dias .tot small { font-weight: 400; }
.secc-ofs summary { font-size: 12px; color: var(--accent); }
.secc-ofs ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.secc-ofs li { font-size: 12px; }
.secc-ofs .entrega { float: right; font-weight: 600; }
.mini-fases { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.mini-fases span { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 8px; background: #f4efe8; color: var(--muted); }
.mini-fases span.curso { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.sin-trabajo { margin: 0; font-size: 12px; }
.etiq-mini { display: inline-flex; gap: 4px; align-items: center; }

/* ---------- Licencias ---------- */
tr.grupo-mod td { background: #f6f2ec; font-weight: 700; font-size: 12px; color: var(--accent); padding-top: 12px; }
.ok-dot { color: var(--ok); font-weight: 800; }
.tarjeta-enlace { display: flex; flex-direction: column; gap: 4px; color: var(--text); margin: 0; }
.tarjeta-enlace:hover { text-decoration: none; border-color: var(--accent-2); }
.tarjeta-enlace span { color: var(--muted); font-size: 13px; }
code.clave { display: inline-block; margin-top: 6px; padding: 6px 10px; background: #fff; border-radius: 6px; user-select: all; word-break: break-all; }
pre.ejemplo { background: #2f2821; color: #efe7dc; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.destinos { display: flex; gap: 6px 22px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- Fichaje ---------- */
.fich-resumen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.fich-resumen div { padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.fich-resumen b { display: block; font-size: 26px; color: var(--text); }
.fich-resumen .dentro { border-left: 4px solid var(--ok); } .fich-resumen .sin_fichar { border-left: 4px solid var(--err); }
.fich-resumen .ausente { border-left: 4px solid #7a4b8c; } .fich-resumen .fuera { border-left: 4px solid #b9ad9e; }
.fich-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.fich-persona { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; border-top: 4px solid #d8d0c4; }
.fich-persona.dentro { border-top-color: var(--ok); } .fich-persona.sin_fichar { border-top-color: var(--err); }
.fich-persona.ausente { border-top-color: #7a4b8c; } .fich-persona.libre { opacity: .6; }
.fp-cab { display: flex; gap: 10px; align-items: center; color: var(--text); }
.fp-cab img, .fp-cab .ini { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.fp-cab small { display: block; color: var(--muted); }
.fp-estado { font-size: 13px; } .fp-cifras { display: flex; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.fp-acc { display: flex; gap: 6px; align-items: center; margin: 0; }
.jornada .finde td { color: #b0a597; } .jornada .aviso td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.marca { display: inline-flex; align-items: center; gap: 3px; margin: 1px 4px 1px 0; padding: 1px 6px; border-radius: 8px; font-size: 12px; background: #f1ebe2; }
.marca.entrada { background: var(--ok-soft); color: var(--ok); } .marca.salida { background: #f6e6e3; color: #8c2a20; }
.marca .x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; opacity: .5; font-size: 13px; }
.marca .x:hover { opacity: 1; }
.calendario th, .calendario td { padding: 0; text-align: center; min-width: 24px; height: 28px; font-size: 11px; border: 1px solid #f1ece5; }
.calendario td:first-child, .calendario th:first-child { text-align: left; padding: 0 8px; min-width: 140px; }
.calendario td.libre { background: #e8e2d8; } .calendario td.fest { background: #f3c9c3; }
.calendario th.hoy { background: var(--accent); color: #fff; }
@media (max-width: 700px) { .fich-resumen { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Planificación ---------- */
.gantt { --et: 270px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.g-fila { display: grid; grid-template-columns: var(--et) repeat(var(--n), minmax(26px, 1fr)); align-items: center; min-height: 34px; position: relative; }
.g-cab { position: sticky; top: 0; z-index: 3; background: #faf7f3; border-bottom: 1px solid var(--line); min-height: 40px; }
.g-dia { text-align: center; font-size: 11px; line-height: 1.1; color: var(--muted); padding: 4px 0; }
.g-dia small { display: block; font-size: 9px; } .g-dia.hoy { color: #fff; background: var(--accent); border-radius: 4px; }
.g-et { position: sticky; left: 0; z-index: 2; background: inherit; padding: 4px 10px; border-right: 1px solid var(--line); min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.g-cab .g-et, .g-of .g-et { background: #faf7f3; } .g-fase .g-et { background: #fff; }
.g-et small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-cuerpo { position: relative; }
.g-fondo { position: absolute; inset: 0; display: grid; grid-template-columns: var(--et) repeat(var(--n), minmax(26px, 1fr)); pointer-events: none; z-index: 0; }
.g-fondo .finde, .g-fondo .fest { background: #f1ece5; } .g-fondo .hoy { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.g-of { background: #faf7f3; border-top: 1px solid var(--line); min-height: 44px; z-index: 1; }
.g-of.tarde .g-et { box-shadow: inset 4px 0 0 var(--err); }
.g-fase { z-index: 1; } .g-fase.hecha { opacity: .5; }
.g-barra { grid-row: 1; height: 22px; margin: 0 1px; border-radius: 5px; background: var(--c); color: #fff; font-size: 11px; line-height: 22px; padding: 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; touch-action: none; position: relative; z-index: 2; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.g-barra.curso { background: repeating-linear-gradient(45deg, var(--c), var(--c) 6px, color-mix(in srgb, var(--c) 80%, #fff) 6px, color-mix(in srgb, var(--c) 80%, #fff) 12px); }
.g-barra.fija { box-shadow: 0 0 0 2px var(--text); } .g-barra.c-izq { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.g-barra.c-der { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g-barra.arrastrando { cursor: grabbing; opacity: .85; z-index: 5; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.g-barra:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 1px; }
.g-entrega { grid-row: 1; text-align: center; color: var(--err); font-size: 16px; z-index: 2; }
.urg { align-self: flex-start; display: inline-block; padding: 0 6px; border-radius: 8px; background: var(--err); color: #fff; font-size: 10px; font-weight: 700; }
.dialogo { border: 0; border-radius: 12px; padding: 20px; width: min(560px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.dialogo::backdrop { background: rgba(40,30,20,.4); }
.carga-tabla th, .carga-tabla td { text-align: center; padding: 3px 2px; font-size: 12px; }
.carga-tabla th.finde { color: #b9ad9e; } .carga-tabla th.hoy { background: var(--accent); color: #fff; border-radius: 4px; }
.carga-tabla td.rec { text-align: left; min-width: 220px; white-space: nowrap; padding: 4px 8px; }
.cel-carga { min-width: 30px; height: 34px; border-radius: 4px;
  background: color-mix(in srgb, color-mix(in srgb, #2f7d4f calc(min(var(--p), 100) * 1%), #e3efe6) calc(var(--p) * 1%), #fbfaf8); }
.cel-carga b { font-variant-numeric: tabular-nums; } .cel-carga b.sobre { color: #fff; }
.cel-carga:has(b.sobre) { background: var(--err); }
.cel-carga.sincap { background: #f1ece5; } .cel-carga.mont { background: #e7dcf0; color: #5b3470; } .cel-carga.aus { background: #f6e7c8; color: #7a5410; }
.cel-carga .eti { font-size: 10px; font-weight: 700; }
.mont-semanas { display: grid; gap: 8px; margin-bottom: 18px; }
.mont-semana { display: grid; grid-template-columns: repeat(5, 1fr) repeat(2, .55fr); gap: 6px; }
.mont-dia { min-height: 120px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 5px; }
.mont-dia.finde { background: #f6f2ec; } .mont-dia.hoy { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.md-cab { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); } .md-cab a { text-decoration: none; }
.mont-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 6px; background: #f1e9f6; border-left: 4px solid #7a4b8c; color: var(--text); font-size: 12px; }
.mont-card:hover { text-decoration: none; filter: brightness(.97); }
.mont-card.confirmado { background: #e3f1e8; border-left-color: var(--ok); } .mont-card.hecho { opacity: .55; }
.mont-card.conflicto { box-shadow: inset 0 0 0 2px var(--err); }
.mont-card span { color: var(--muted); } .mont-card .eq { display: flex; gap: 2px; margin-top: 2px; }
.mont-card .eq img, .mont-card .eq i { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 700; background: #fff; color: var(--accent); }
.mont-card .av { position: absolute; top: 4px; right: 6px; color: var(--err); font-weight: 700; }
@media (max-width: 900px) { .mont-semana { grid-template-columns: 1fr 1fr; } .gantt { --et: 180px; } }

/* ---------- Copias de seguridad ---------- */
.copia-estado { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; margin-bottom: 16px; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--ok); }
.copia-estado.mal { border-left-color: var(--err); background: #fff8f6; }
.copia-estado span { color: var(--muted); font-size: 13px; }
.chip-prod { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 9px; background: #eef0f7; color: #3d4f7a; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.tabla-ruta .sf { min-width: 130px; } .tabla-ruta td { padding-left: 4px; padding-right: 4px; }

/* Botón de ayuda de cada pantalla */
main { position: relative; }
.btn-ayuda { position: absolute; top: 18px; right: 22px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); color: var(--accent); font-weight: 700; box-shadow: 0 1px 4px rgba(40,30,20,.08); }
.btn-ayuda:hover { background: var(--accent-soft); text-decoration: none; }
main > .cab { padding-right: 40px; }
