/* Programación de Producción Easywood. Paleta y piezas de seguimiento-ingenieria (solo tema claro, como esa app),
   heredadas de la maqueta del 2026-10-22. */
:root {
  --bg: #f5f3ef; --panel: #ffffff; --panel-2: #faf8f5; --line: #e4dfd7; --line-2: #f0ece6;
  --text: #25221e; --muted: #7a7268; --accent: #8a5a2b; --accent-2: #b98452;
  --ok: #2f7d4f; --warn: #c98a12; --alert: #c0392b; --info: #3b6ea8;
  --e-blanco: #bdb3a7; --e-com: #2f6fd0; --e-ing: #c0392b; --e-dev: #2f7d4f; --e-prod: #25221e;
  --z-norte: #3b6ea8; --z-sur: #6a8f3c; /* Sur verde: el rojo queda solo para lo que pasa del límite */
  --curso: #f1efe9;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 2px 8px rgba(40, 30, 20, .05);
  --radius: 10px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .num { font-variant-numeric: tabular-nums; }
.error { color: var(--alert); font-size: 13px; margin: 0; min-height: 1em; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #744a22; }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.danger { color: var(--alert); }
.btn:disabled { opacity: .5; cursor: default; }
.ico { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 4px; font-size: 13px; line-height: 1; }
.ico:hover { background: var(--line-2); color: var(--text); }

/* Ingreso */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; width: min(380px, 100%); display: grid; gap: 12px; box-shadow: var(--shadow); }
.login-card label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.login-card input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-weight: 400; color: var(--text); }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .01em; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.topbar { display: flex; align-items: center; gap: 10px 20px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 550; }
.tabs button.active { background: var(--bg); color: var(--text); }
.tabs .cnt { font-size: 11px; background: var(--alert); color: #fff; border-radius: 9px; padding: 0 6px; margin-left: 4px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.me { display: flex; align-items: center; gap: 6px; font-weight: 550; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 18px; }
.filters input[type=search], .filters select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.filters input[type=search] { width: 220px; max-width: 100%; }
.check { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.view-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--accent); color: #fff; }
.wnav { display: flex; align-items: center; gap: 4px; }
.wnav b { min-width: 130px; text-align: center; }
main { padding: 0 18px 40px; display: grid; gap: 14px; }

.av { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 10.5px; font-weight: 700; color: #fff; flex: none; }
.av.sm { width: 20px; height: 20px; font-size: 9px; }
.badge { white-space: nowrap; font-size: 11px; font-weight: 650; padding: 1px 6px; border-radius: 6px; background: #eeeae4; color: var(--muted); }
.badge.warn { background: #fbefd5; color: #8a5d05; }
.badge.alert { background: #f8dcd8; color: var(--alert); }
.badge.ok { background: #dcefe3; color: var(--ok); }
.badge.info { background: #e1eaf5; color: var(--info); }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #efe9e0; color: #5c5044; white-space: nowrap; }
.chip.dia { background: #f8dcd8; color: var(--alert); }
.chip.zona { color: #fff; }
.chip.zona.Norte { background: var(--z-norte); } .chip.zona.Sur { background: var(--z-sur); }
.epill { border: 0; border-radius: 10px; color: #fff; background: var(--c); font-size: 11px; font-weight: 600; padding: 2px 8px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.epill.blanco { background: #fff; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--e-blanco); }
.epill[disabled] { cursor: default; }
.edot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.edot.blanco { background: #fff; box-shadow: inset 0 0 0 1.5px var(--e-blanco); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.panel > h3 { margin: 0 0 4px; font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.d-help { font-size: 12px; color: var(--muted); margin: 0 0 10px; line-height: 1.35; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }

/* Resumen de carga: números aparte, gráfico aparte */
.resu { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13px; }
.resu th, .resu td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
.resu th:first-child { text-align: left; }
.resu thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); vertical-align: bottom; }
.resu thead th.curso, .resu td.curso { background: var(--curso); }
.resu thead th .dias { display: flex; gap: 3px; justify-content: flex-end; flex-wrap: wrap; margin-top: 3px; }
.resu tbody th { font-weight: 600; }
.resu tbody th small, .resu td small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.resu td.prom { font-weight: 650; border-left: 1px solid var(--line); }
.resu td.over { color: var(--alert); font-weight: 650; }
.resu td .pc { display: block; font-size: 11px; color: var(--muted); }
.resu td.over .pc { color: var(--alert); }
.resu tr.sub th { font-weight: 400; padding-left: 22px; color: var(--muted); }
.resu tr.sub td { color: var(--muted); font-size: 12px; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; margin-top: 12px; }
.mini { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
.mini h4 { margin: 0; font-size: 12px; display: flex; justify-content: space-between; gap: 6px; }
.mini h4 span { color: var(--muted); font-weight: 400; }
.mini svg, .mult svg { width: 100%; height: auto; display: block; margin-top: 4px; }
svg .b { fill: var(--accent-2); } svg .b.curso { fill: #d9c9b4; } svg .b.over { fill: var(--alert); }
svg .b.Norte { fill: var(--z-norte); } svg .b.Sur { fill: var(--z-sur); } svg .b.otra { fill: #cfc6ba; }
svg .exceso { fill: var(--alert); fill-opacity: .35; stroke: var(--alert); stroke-width: 1.5; }
svg .cap { stroke: var(--alert); stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; }
svg .ax { stroke: var(--line); } svg .gr { stroke: var(--line-2); stroke-dasharray: 2 3; }
svg text { fill: var(--muted); font-size: 10px; font-family: inherit; }
svg .hit { fill: transparent; cursor: pointer; }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; align-items: center; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.semnotas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.semnotas label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); align-content: start; }
.semnotas input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); font-weight: 400; color: var(--text); }
.semnotas .ro { font-weight: 400; color: var(--text); min-height: 32px; padding: 6px 0; }
.semnotas .dias { display: flex; gap: 4px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 700; line-height: 1; }
.kpi .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi .u { font-size: 12px; color: var(--muted); }
.kpi.over .v, .kpi.over .u b { color: var(--alert); }

/* Acuerdos */
.acu { display: grid; }
.acu-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.acu-row:last-child { border-bottom: 0; }
.acu-row input[type=checkbox] { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--ok); }
.acu-row .t { display: grid; gap: 3px; }
.acu-row .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.acu-row.done .t > span:first-child { text-decoration: line-through; color: var(--muted); }
.lnk { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.acu-add { display: grid; grid-template-columns: minmax(0, 1fr) 180px 140px auto; gap: 6px; margin-top: 8px; }
.acu-add input, .acu-add select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); min-width: 0; }

/* Recorrido */
.rec-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rec-head .seg button { display: inline-flex; gap: 6px; align-items: center; }
.rec-head .seg .n { font-size: 11px; opacity: .8; }
.progress { flex: 1; min-width: 160px; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.progress .track { flex: 1; height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.progress .track i { display: block; height: 100%; background: var(--ok); }
.pjs { display: grid; gap: 10px; }
.pj { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pj.rev { border-color: #cfe3d6; }
.pj-h { display: flex; gap: 10px; align-items: center; padding: 10px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.pj-t { flex: 1; min-width: 160px; display: grid; gap: 1px; cursor: pointer; }
.pj-t b { font-size: 14px; }
.pj-t:hover b { color: var(--accent); }
.pj-nota { padding: 6px 12px; font-size: 12.5px; color: #5c5044; background: #fbf8f2; border-bottom: 1px solid var(--line-2); }
.wk-cli { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ciudad { font-size: 12px; color: var(--muted); font-weight: 400; }
.pj.rev .pj-h { background: #f3f9f5; }
.scroll { overflow-x: auto; }
.pj-grid { display: grid; grid-template-columns: 200px repeat(4, minmax(160px, 1fr)); min-width: 860px; }
.pj-grid > div { border-bottom: 1px solid var(--line-2); padding: 6px 8px; min-width: 0; }
.pj-grid .hd { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--panel-2); padding: 5px 8px; }
.pj-grid .hd.curso, .pj-grid .c.curso { background: var(--curso); }
.pj-grid .tp { display: grid; gap: 4px; align-content: start; }
.pj-grid .tp b { font-size: 13px; }
.pj-grid .tp .mot { font-size: 11.5px; color: var(--muted); }
.pj-grid .c { border-left: 1px solid var(--line-2); display: grid; gap: 4px; align-content: start; }
.pj-acu { padding: 4px 12px 10px; }
.pj-acu .acu-row { padding: 6px 0; }
.acu-det summary { cursor: pointer; color: var(--muted); font-size: 12.5px; padding: 8px 0 2px; width: max-content; }
.acu-det summary:hover { color: var(--accent); }

/* Bloques */
.wk-b { text-align: left; width: 100%; background: color-mix(in srgb, var(--c) 12%, var(--panel)); border: 0; border-left: 4px solid var(--c); border-radius: 6px; padding: 4px 8px; display: grid; gap: 1px; font-size: 12px; line-height: 1.25; cursor: pointer; min-width: 0; }
.wk-b:hover { box-shadow: 0 0 0 1px var(--c); }
.wk-b.blanco { background: #fff; box-shadow: inset 0 0 0 1px var(--line); border-left-color: var(--e-blanco); }
.wk-b[draggable=true] { cursor: grab; }
.wk-b.drag { opacity: .4; }
.wk-b.mitad { border-left-style: dashed; }
.wk-b .l1 { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.wk-b .q { font-weight: 650; }
.wk-b .pa { font-weight: 600; }
.wk-b .pt { font-size: 11px; color: var(--muted); }
.wk-b .cg { display: grid; grid-template-columns: auto auto; justify-content: space-between; gap: 0 8px; font-size: 11px; color: var(--muted); border-top: 1px dotted var(--line); margin-top: 3px; padding-top: 2px; }
.wk-b .cg b { color: var(--text); font-weight: 600; text-align: right; }
.wk-det { font-size: 11.5px; color: var(--muted); font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cu { font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 0 5px; }
.cu.cumplido { background: #dcefe3; color: var(--ok); } .cu.parcial { background: #fbefd5; color: #8a5d05; } .cu.no { background: #f8dcd8; color: var(--alert); }
.nt { text-align: left; width: 100%; border: 1px dashed #cfc6ba; background: #f7f5f1; color: #5c5044; border-radius: 6px; padding: 3px 7px; font-size: 11.5px; cursor: pointer; display: flex; gap: 5px; }
.nt::before { content: "✎"; color: var(--muted); }
.acts { display: flex; gap: 4px; opacity: 0; }
.add { border: 1px dashed var(--line); background: none; border-radius: 6px; color: var(--muted); font-size: 11.5px; padding: 2px 6px; cursor: pointer; }
.c:hover .acts, .cel:hover .acts, .acts:focus-within { opacity: 1; }
.drop-ok { outline: 2px dashed var(--accent-2); outline-offset: -3px; background: #fbf4ea !important; }

/* Trisemanal */
.load { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1000px; table-layout: fixed; }
.grid th, .grid td { border-bottom: 1px solid var(--line-2); vertical-align: top; }
.grid thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; text-align: left; padding: 8px 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.grid thead th.curso, .grid td.curso { background: var(--curso); }
.grid thead th .wh { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.grid thead th .dias { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 3px; font-weight: 400; }
.grid col.c-tip { width: 230px; }
.grid tr.zona td { background: #efe9e0; padding: 7px 10px; font-weight: 700; font-size: 13px; }
.grid tr.grupo td { background: var(--panel-2); padding: 6px 10px; }
.grupo .gx { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grupo .gx b { cursor: pointer; }
.grupo .gx b:hover { color: var(--accent); }
.grupo .gx .sp { flex: 1; }
.grupo .gnota { font-size: 12px; color: #5c5044; margin-top: 3px; }
.grid tr.grupo.rev td { background: #eef6f0; }

/* Lo que identifica (Jesús, 2026-11-11): semanas, proyecto, vivienda, partida y OT grandes, en negrita y varios en
   mayúscula, para ubicarse siempre de un vistazo */
.grid thead th.sem, .resu thead th { font-size: 14px; font-weight: 800; color: var(--text); text-transform: uppercase; letter-spacing: .02em; }
.grid thead th.sem.curso, .resu thead th.curso { color: var(--accent); }
.semnotas label { font-size: 13px; font-weight: 800; color: var(--text); text-transform: uppercase; }
.grid tr.zona td { font-size: 15px; font-weight: 800; letter-spacing: .04em; }
.grupo .gx .wk-cli { font-size: 12.5px; font-weight: 700; color: #5c5044; }
.grupo .gx b[data-pj] { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; }
.grupo .gx b[data-pj] .ciudad { text-transform: none; font-size: 13px; font-weight: 500; }
.tip b.viv, .tipo-g b.viv { font-size: 15px; font-weight: 800; text-transform: uppercase; }
.tip b.ot { font-size: 12.5px; font-weight: 800; color: var(--text); }
.wk-b { font-size: 12.5px; }
.wk-b .q { font-size: 13.5px; font-weight: 800; }
.wk-b .pa { font-size: 13px; font-weight: 800; text-transform: uppercase; }
.plg { border: 0; background: none; cursor: pointer; font: inherit; font-weight: 800; color: var(--text); padding: 2px 4px; border-radius: 4px; }
.plg:hover { background: rgba(0, 0, 0, .05); }
.grid tr.resumen-pj td { background: var(--panel); padding: 6px 10px; }
/* Jerarquía: zona › comercial › proyecto › tipología › OT, cada nivel un poco más adentro */
.grid tr.comercial td { background: #f4efe7; padding: 6px 10px 6px 22px; font-size: 13.5px; font-weight: 800; }
.grid tr.comercial td .av { vertical-align: middle; margin: 0 4px; }
.grid tr.grupo td { padding-left: 34px; }
.grid tr.tipo-g td { padding: 6px 10px 6px 34px; background: var(--panel); border-bottom-style: dashed; }
.grid tr.ot-row td.tip { padding-left: 46px; }
.tip b.ot.grande { font-size: 14px; }
.tip .sc { border: 0; cursor: pointer; margin-top: 3px; display: inline-block; }
/* Consumos en la ficha de la tipología: consumo y factor lado a lado */
.cons { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px 12px; margin-top: 8px; }
.cons label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cons .par { display: grid; grid-template-columns: minmax(0, 1fr) 58px; gap: 4px; }
.cons input { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; text-align: right; min-width: 0; font-size: 13px; }
.cons input.mano { box-shadow: inset 0 -2px 0 var(--warn); background: #fffaf0; }
.tip .ing { display: block; font-size: 11px; color: var(--info); margin-top: 2px; }
.grid tr.ot-info td { padding: 3px 10px 3px 46px; background: var(--panel); }
/* La grilla se recorre dentro de su caja: así el encabezado de las semanas queda siempre a la vista */
.load.trigrid { position: sticky; top: calc(var(--topbar, 56px) + 6px); max-height: calc(100vh - var(--topbar, 56px) - 52px); } /* 52 = el margen de abajo de main + aire: al final de la página tampoco se mete bajo la barra */
.grid thead th { z-index: 3; box-shadow: 0 1px 0 var(--line); }
.tbl td:nth-child(2) .lnk, .tbl td:nth-child(3) .lnk { font-weight: 800; text-transform: uppercase; color: var(--text); }
.tbl td:nth-child(3) small { font-weight: 800; color: var(--text); }
.d-head h2 { text-transform: uppercase; }
.grid tr.grupo .pj-acu { padding: 2px 0 0; }
.grid tr.grupo .pj-acu .acu-row { padding: 4px 0; }
details.panel > summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
details.panel > summary::marker { color: var(--muted); }
.grid td.tip { padding: 7px 10px; }
.tip .tn { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.grid td.cel { padding: 5px; border-left: 1px solid var(--line-2); }
.cel-in { display: grid; gap: 4px; min-height: 30px; align-content: start; }

/* Carga */
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.tt { position: fixed; z-index: 70; pointer-events: none; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 7px 10px; font-size: 12px; display: grid; gap: 2px; }
.tt span { color: var(--muted); }
.caps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 10px; }
.caps label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.caps input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-weight: 400; color: var(--text); }
.dias-list { display: grid; gap: 4px; margin-top: 8px; }
.dias-list .dr { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.dia-add input[name=motivo] { grid-column: 1 / 3; }
.dia-add { display: grid; grid-template-columns: 150px minmax(0, 1fr) 130px; gap: 6px; margin-top: 8px; }
.dia-add input, .dia-add select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); min-width: 0; }

/* Tipologías */
.tbl { border-collapse: collapse; width: 100%; min-width: 1100px; font-size: 13px; }
.tbl th, .tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
.tbl th:nth-child(-n+3), .tbl td:nth-child(-n+3) { text-align: left; }
.tbl thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
.tbl thead tr.g th { text-align: center; border-bottom: 0; }
.tbl td.v { cursor: default; }
.tbl td.v.ed { cursor: text; }
.tbl td.v.ed:hover { background: #fbf4ea; }
.tbl td.z { color: #d3ccc1; }
.tbl td.mano { box-shadow: inset 0 -2px 0 var(--warn); background: #fffaf0; }
.tbl td input { width: 70px; text-align: right; border: 1px solid var(--accent-2); border-radius: 4px; padding: 2px 4px; }
.tbl td.f { color: var(--muted); font-size: 12px; }
.fact ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 4px 20px; }
.fact li { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); padding: 3px 0; font-size: 13px; }

/* Ficha lateral */
.backdrop { position: fixed; inset: 0; background: rgba(30, 24, 18, .25); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); background: var(--panel); z-index: 50; box-shadow: -8px 0 30px rgba(0,0,0,.12); overflow-y: auto; }
.drawer-inner { padding: 20px 22px 40px; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.d-head { display: flex; gap: 10px; align-items: flex-start; }
.d-head h2 { margin: 0; font-size: 19px; flex: 1; text-wrap: balance; }
.d-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.d-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; align-content: start; }
.d-form .full { grid-column: 1 / -1; }
.d-form select, .d-form input, .d-form textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 14px; font-weight: 400; width: 100%; }
.d-form .hint { font-weight: 400; font-size: 11.5px; }
.d-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.d-actions .sp { flex: 1; }
.d-section h3 { margin: 0 0 8px; font-size: 14px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 5px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.opts button.active { border-color: var(--accent); background: #f6efe6; font-weight: 600; }
.opts button.off { opacity: .55; }
.parts { display: grid; gap: 6px; }
.parts .pr { display: grid; grid-template-columns: minmax(0, 1fr) 120px 30px; gap: 6px; align-items: center; }
.parts .pr input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
.prev { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto auto; gap: 3px 14px; font-size: 13px; background: var(--panel-2); }
.prev span { color: var(--muted); } .prev b { text-align: right; } .prev i { text-align: right; color: var(--muted); font-style: normal; }
.prev .h { font-size: 11px; color: var(--muted); font-weight: 600; text-align: right; }
.timeline { display: grid; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 10px; position: relative; font-size: 13px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: #eee8e0; }
.tl:last-child::before { display: none; }
.tl .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 2px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); background: var(--accent-2); }
.tl .meta { color: var(--muted); font-size: 12px; }
.resumen { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; max-height: 420px; overflow: auto; }
.cumpl { display: grid; gap: 8px; background: var(--curso); border-radius: 8px; padding: 10px 12px; }
.cumpl .opts input { width: 90px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }

/* Ventanas pequeñas: menú de estado, elegir correr o sumar */
.pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(40,30,20,.18); padding: 10px; width: min(300px, calc(100vw - 24px)); display: grid; gap: 8px; }
.pop .eo { display: grid; grid-template-columns: 14px 1fr; gap: 2px 8px; align-items: center; border: 1px solid transparent; background: none; border-radius: 8px; padding: 6px 8px; cursor: pointer; text-align: left; }
.pop .eo small { grid-column: 2; color: var(--muted); font-size: 11.5px; }
.pop .eo.active { border-color: var(--accent-2); background: #f6efe6; }
.pop .eo:hover { background: var(--panel-2); }
.pop select, .pop textarea { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 100%; background: var(--panel); }
.dlg-bg { position: fixed; inset: 0; background: rgba(30, 24, 18, .3); z-index: 65; display: grid; place-items: center; padding: 16px; }
.dlg { background: var(--panel); border-radius: 12px; padding: 18px 20px; width: min(460px, 100%); display: grid; gap: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.dlg h3 { margin: 0; font-size: 16px; }
.dlg .op { display: grid; gap: 2px; text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel); cursor: pointer; }
.dlg .op:hover { border-color: var(--accent-2); background: #fbf6ef; }
.dlg .op b { font-size: 14px; } .dlg .op span { font-size: 12.5px; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #2b2622; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 80; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--alert); }
.eq-roles { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
@media (max-width: 760px) {
  .topbar-right { margin-left: 0; width: 100%; }
  .semnotas { grid-template-columns: 1fr 1fr; } .acu-add, .dia-add { grid-template-columns: 1fr 1fr; } .acu-add input:first-child { grid-column: 1 / -1; }
  .d-form { grid-template-columns: 1fr; } .view-tools { margin-left: 0; }
}
