/* Plexus · estilos. Paleta inspirada en el cuarto de comunicaciones: tinta azul pizarra,
   aguamarina de latiguillo de fibra OM3 como acento, ámbar y rojo de LED para avisos. */
:root {
  --ink: #17212b;
  --ink-2: #3a4754;
  --muted: #64717e;
  --line: #d9dfe5;
  --line-2: #e8ecf0;
  --paper: #f1f4f6;
  --surface: #ffffff;
  --aqua: #0a7f8c;
  --aqua-2: #e2f3f4;
  --amber: #a86400;
  --amber-2: #fdf1dc;
  --red: #b8322a;
  --red-2: #fbe7e5;
  --green: #237a3b;
  --green-2: #e3f3e7;
  --violet: #6b4bb8;
  --rail: #17212b;
  --rail-text: #c7d1da;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-label: Bahnschrift, "DIN Alternate", "Segoe UI Variable Display", "Arial Narrow", system-ui, sans-serif;
  --r-sm: 4px;
  --r: 8px;
  --gap: 16px;
  --focus: 0 0 0 3px rgba(10, 127, 140, .35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--aqua); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
h1, h2, h3 { font-family: var(--font-label); font-weight: 600; letter-spacing: .005em; margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-family: var(--font-label); font-size: 1.25rem; font-weight: 600; }
.brand svg { flex: none; }
.rail a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--rail-text); font-size: .95rem; }
.rail a.nav:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.rail a.nav[aria-current="page"] { background: rgba(10,127,140,.28); color: #fff; box-shadow: inset 3px 0 0 #39c0cc; }
.rail a.nav .count { margin-left: auto; font-family: var(--font-label); font-size: .8rem; background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; }
.rail .grow { flex: 1; }
.rail .searchbtn { display: flex; align-items: center; gap: 8px; width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: var(--rail-text); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 12px; cursor: pointer; text-align: left; }
.rail .searchbtn kbd { margin-left: auto; font-size: .75rem; opacity: .7; }
.main { min-width: 0; padding: 24px 32px 80px; max-width: 1400px; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead .sub { color: var(--muted); margin-top: 4px; }
.pagehead .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; white-space: nowrap; min-height: 36px; }
.btn:hover { border-color: #b9c3cc; background: #fafbfc; }
.btn.primary { background: var(--aqua); border-color: var(--aqua); color: #fff; }
.btn.primary:hover { background: #086d78; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 3px 9px; min-height: 30px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.iconbtn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: var(--r-sm); color: var(--muted); line-height: 0; }
.iconbtn:hover { background: var(--line-2); color: var(--ink); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; color: var(--ink-2); font-weight: 500; }
label.f.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: .95rem; }
input[type=text], input[type=search], input[type=date], input[type=datetime-local], input[type=time], input[type=url], input[type=number], input[type=password], select, textarea {
  border: 1px solid #c5cdd5; background: #fff; border-radius: var(--r-sm); padding: 7px 9px; min-height: 36px; width: 100%; font-size: .95rem; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--aqua); box-shadow: var(--focus); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--aqua); cursor: pointer; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.formgrid .wide { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- estado: LED con forma + texto ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 500; white-space: nowrap; padding: 1px 8px 1px 6px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.st i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; border: 2px solid currentColor; }
.st.planificado, .st.pendiente, .st.por-abrir { color: #4f5d6b; }
.st.en_curso, .st.abierto, .st.en-curso { color: var(--aqua); background: var(--aqua-2); border-color: transparent; }
.st.en_curso i, .st.en-curso i, .st.abierto i { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.st.ejecutado { color: var(--violet); background: #efeafb; border-color: transparent; }
.st.ejecutado i { background: currentColor; }
.st.cerrado, .st.hecha, .st.completado, .st.completada, .st.resuelto, .st.final { color: var(--green); background: var(--green-2); border-color: transparent; }
.st.cerrado i, .st.hecha i, .st.completado i, .st.completada i, .st.final i { border: 0; border-radius: 0; width: 11px; height: 11px; background: currentColor; clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 24%, 86% 10%, 38% 72%); }
.st.cancelado, .st.cancelada, .st.anulado { color: var(--muted); text-decoration: line-through; }
.st.cancelado i, .st.cancelada i { border: 0; border-radius: 0; background: currentColor; clip-path: polygon(20% 0, 50% 30%, 80% 0, 100% 20%, 70% 50%, 100% 80%, 80% 100%, 50% 70%, 20% 100%, 0 80%, 30% 50%, 0 20%); }
.st.pendiente-de-tercero { color: var(--amber); background: var(--amber-2); border-color: transparent; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 600; padding: 1px 8px; border-radius: 20px; white-space: nowrap; }
.flag.blocked { color: var(--red); background: var(--red-2); }
.flag.blocked::before { content: ""; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid currentColor; }
.flag.overdue { color: var(--amber); background: var(--amber-2); }
.flag.overdue::before { content: "!"; font-weight: 800; }
.flag.req { color: var(--ink-2); background: var(--line-2); font-weight: 500; }
.prio { font-size: .8rem; font-weight: 600; color: var(--muted); }
.prio.alta { color: var(--amber); }
.prio.critica { color: var(--red); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* ---------- Mi día ---------- */
.daynav { display: flex; align-items: center; gap: 6px; }
.dayhead h1 { font-size: 2rem; }
.tally { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 22px; overflow: hidden; }
.tally a { flex: 1 1 120px; padding: 10px 16px; border-right: 1px solid var(--line-2); color: var(--ink); display: flex; flex-direction: column; }
.tally a:last-child { border-right: 0; }
.tally a:hover { background: #f8fafb; text-decoration: none; }
.tally b { font-family: var(--font-label); font-size: 1.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tally span { font-size: .84rem; color: var(--muted); }
.tally a.warn b { color: var(--amber); }
.tally a.bad b { color: var(--red); }
.tally a.zero b { color: #a3adb7; }
.daygrid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 28px; align-items: start; }
.block { margin-bottom: 28px; }
.block > header { display: flex; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.block > header .n { font-family: var(--font-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.block > header .more { margin-left: auto; font-size: .86rem; }
.empty { color: var(--muted); padding: 14px 0; font-size: .92rem; }

/* Línea de intervenciones: el elemento con más carácter. Hora grande tipo etiqueta de rack. */
.slots { list-style: none; margin: 0; padding: 0; }
.slot { display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; cursor: pointer; }
.slot:hover { background: linear-gradient(90deg, transparent, #f7fafb 30%); }
.slot .time { font-family: var(--font-label); font-size: 1.55rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.slot .time small { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); margin-top: 4px; }
.slot .what { min-width: 0; }
.slot .what .t { font-weight: 600; font-size: 1.02rem; }
.slot .what .loc { font-family: var(--font-label); color: var(--aqua); margin-right: 6px; }
.slot .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; font-size: .86rem; color: var(--muted); align-items: center; }
.slot .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.slot.is-blocked .time { color: var(--red); }
.slot .bar { grid-column: 2 / 4; }
.tec { font-size: .84rem; color: var(--ink-2); }
.tec b { font-weight: 600; }

.meter { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.meter > span { display: block; height: 100%; background: var(--aqua); }
.meter.done > span { background: var(--green); }
.reqline { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); }
.reqline .meter { flex: 1; max-width: 140px; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.rows > li:last-child { border-bottom: 0; }
.rows .body { min-width: 0; flex: 1; }
.rows .title { font-weight: 500; cursor: pointer; }
.rows .title:hover { color: var(--aqua); }
.rows .sub { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.rows .end { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.rows .done .title { text-decoration: line-through; color: var(--muted); }
.missing { margin: 6px 0 0; padding: 0; list-style: none; font-size: .86rem; }
.missing li { display: flex; gap: 6px; align-items: baseline; padding: 1px 0; }
.missing li::before { content: "○"; color: var(--amber); font-size: .8rem; }
.why { font-size: .86rem; color: var(--red); margin-top: 2px; }
.datechip { font-family: var(--font-label); font-size: .86rem; color: var(--ink-2); min-width: 64px; font-variant-numeric: tabular-nums; }
.datechip.late { color: var(--amber); font-weight: 600; }
.kind { font-size: .76rem; font-weight: 600; padding: 0 6px; border-radius: 3px; border: 1px solid; }
.kind.intervencion { color: var(--aqua); }
.kind.tarea { color: var(--ink-2); }
.kind.hito { color: var(--violet); }
.kind.limite { color: var(--amber); }
.projrow { padding: 10px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.projrow .top { display: flex; gap: 8px; align-items: center; }
.projrow .top b { font-weight: 600; }
.projrow .top .pct { margin-left: auto; font-family: var(--font-label); font-variant-numeric: tabular-nums; }
.projrow .meter { margin: 6px 0 4px; }
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); margin: 6px 0 4px; }
.stack span { display: block; height: 100%; }
.stack .s-cerrado { background: var(--green); }
.stack .s-ejecutado { background: var(--violet); }
.stack .s-en_curso { background: var(--aqua); }
.stack .s-planificado { background: #b7c1cb; }

/* ---------- tablas ---------- */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-weight: 600; font-size: .82rem; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); background: #f8fafb; white-space: nowrap; position: sticky; top: 0; }
table.t th button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7fafb; }
table.t td.nowrap { white-space: nowrap; }

/* ---------- pestañas ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a[aria-selected="true"] { border-bottom-color: var(--aqua); color: var(--ink); }
.tabs a .c { font-size: .8rem; color: var(--muted); margin-left: 4px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- panel lateral (trabajo / tarea) ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(23, 33, 43, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--paper); z-index: 41; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(23,33,43,.18); animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer > header { padding: 16px 20px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer > header .crumbs { font-size: .84rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.drawer > header h2 { font-size: 1.35rem; margin: 6px 0 10px; }
.drawer > header .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer .close { position: absolute; top: 12px; right: 12px; }
.drawer .scroll { overflow-y: auto; padding: 18px 20px 40px; flex: 1; }
.drawer section { margin-bottom: 22px; }
.drawer section > h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.drawer section > h3 .act { margin-left: auto; }
.lifecycle { display: flex; gap: 0; margin: 4px 0 2px; flex-wrap: wrap; }
.lifecycle button { border: 1px solid var(--line); background: #fff; padding: 6px 12px; cursor: pointer; margin-left: -1px; font-size: .88rem; display: inline-flex; gap: 6px; align-items: center; }
.lifecycle button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.lifecycle button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.lifecycle button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); position: relative; z-index: 1; }
.lifecycle button.past { color: var(--green); }
.closebox { border: 1px solid var(--line); border-left: 4px solid var(--amber); background: var(--surface); padding: 12px 14px; border-radius: var(--r-sm); }
.closebox.ok { border-left-color: var(--green); }
.blockbox { border-left: 4px solid var(--red); background: var(--red-2); padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.blockbox b { color: var(--red); }
.stage { font-family: var(--font-label); font-size: .86rem; color: var(--muted); margin: 12px 0 2px; }
.tasklist { list-style: none; margin: 0; padding: 0; }
.tasklist li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.tasklist li.sub { padding-left: 28px; }
.tasklist li .title { cursor: pointer; }
.tasklist li.done .title { text-decoration: line-through; color: var(--muted); }
.tasklist .meta { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: .84rem; color: var(--muted); flex: none; }
.history { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.history li { display: grid; grid-template-columns: 118px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.history time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history .a-reprogramar, .history .a-bloquear, .history .a-cancelar { color: var(--amber); }
.history .a-cerrar { color: var(--green); }
.attrs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.attrs div { font-size: .9rem; }
.attrs div span { color: var(--muted); margin-right: 4px; }

/* ---------- diálogos ---------- */
dialog { border: 0; border-radius: var(--r); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(23,33,43,.3); color: var(--ink); }
dialog.wide { width: min(980px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(23, 33, 43, .45); }
dialog form.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
dialog .dlg-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
dialog .dlg-b { padding: 18px 20px; overflow-y: auto; }
dialog .dlg-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #f8fafb; }
.err { color: var(--red); font-size: .9rem; margin-top: 10px; }
.hint { font-size: .84rem; color: var(--muted); }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: var(--ink); color: #fff; padding: 9px 16px; border-radius: var(--r-sm); box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: .92rem; pointer-events: auto; }
#toast div.bad { background: var(--red); }

/* ---------- calendario ---------- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month .dow { font-size: .8rem; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); background: #f8fafb; font-weight: 600; }
.cal-day { min-height: 118px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 4px 5px 6px; position: relative; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: #fafbfc; }
.cal-day.other .dnum { color: #a3adb7; }
.cal-day.today .dnum { background: var(--aqua); color: #fff; border-radius: 50%; }
.cal-day.weekend { background: #fbfcfd; }
.cal-day.drop { background: var(--aqua-2); outline: 2px dashed var(--aqua); outline-offset: -3px; }
a.dnum { color: var(--ink); text-decoration: none; }
.dnum { font-family: var(--font-label); font-size: .88rem; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-day .add { position: absolute; top: 4px; right: 4px; opacity: 0; }
.cal-day:hover .add, .cal-day .add:focus { opacity: 1; }
.ev { display: flex; align-items: center; gap: 5px; font-size: .8rem; padding: 2px 5px; border-radius: 3px; margin-top: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; background: #fff; }
.ev:hover { filter: brightness(.97); }
.ev .tm { font-family: var(--font-label); font-variant-numeric: tabular-nums; flex: none; }
.ev .tx { overflow: hidden; text-overflow: ellipsis; }
.ev.intervencion { background: var(--evc, var(--aqua)); color: #fff; }
.ev.limite { border: 1px dashed var(--evc, var(--amber)); color: var(--ink); }
.ev.limite::before { content: "⏱"; font-size: .75rem; }
.ev.tarea { border-color: var(--line); color: var(--ink-2); }
.ev.tarea::before { content: ""; width: 8px; height: 8px; border: 1.5px solid currentColor; border-radius: 2px; flex: none; }
.ev.tarea.st-hecha { text-decoration: line-through; color: var(--muted); }
.ev.hito { color: var(--violet); font-weight: 600; }
.ev.hito::before { content: "◆"; }
.ev.is-blocked::after { content: "bloqueado"; margin-left: auto; font-size: .7rem; background: var(--red); color: #fff; padding: 0 4px; border-radius: 2px; }
.ev.st-cerrado { opacity: .62; }
.ev.st-ejecutado.intervencion { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.ev[draggable="true"] { cursor: grab; }
.cal-more { font-size: .78rem; color: var(--muted); padding: 2px 5px; cursor: pointer; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week .col { border-right: 1px solid var(--line-2); min-height: 420px; padding: 6px; }
.cal-week .col:last-child { border-right: 0; }
.cal-week .col h3 { font-size: .9rem; display: flex; gap: 6px; align-items: baseline; margin-bottom: 6px; }
.cal-week .col.today h3 { color: var(--aqua); }
.cal-week .ev { white-space: normal; align-items: flex-start; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .84rem; color: var(--muted); margin-top: 10px; align-items: center; }
.legend .ev { display: inline-flex; margin: 0; cursor: default; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; }
.kcol { background: #e9edf1; border-radius: var(--r); padding: 10px; min-height: 300px; }
.kcol h3 { font-size: .95rem; margin: 2px 4px 10px; display: flex; gap: 6px; align-items: center; }
.kcol.drop { outline: 2px dashed var(--aqua); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 10px; margin-bottom: 8px; cursor: grab; font-size: .9rem; }
.kcard .sub { font-size: .8rem; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- búsqueda ---------- */
.searchbox input { font-size: 1.1rem; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.searchbox input:focus { box-shadow: none; }
.sres { max-height: 60vh; overflow-y: auto; padding: 6px 0 10px; }
.sres h4 { font-size: .8rem; color: var(--muted); margin: 10px 16px 4px; font-weight: 600; }
.sres a { display: block; padding: 7px 16px; color: var(--ink); }
.sres a:hover, .sres a.sel { background: var(--aqua-2); text-decoration: none; }
.sres a small { color: var(--muted); margin-left: 8px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--rail); }
.login form { background: var(--surface); padding: 28px; border-radius: var(--r); width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }

/* ---------- móvil ---------- */
.mobilebar { display: none; }
@media (max-width: 1100px) {
  .daygrid { grid-template-columns: 1fr; }
  .cols2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 16px 14px 96px; }
  .mobilebar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--rail); z-index: 30; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobilebar a, .mobilebar button { color: var(--rail-text); display: flex; flex-direction: column; align-items: center; font-size: .72rem; gap: 2px; padding: 6px 8px; border: 0; background: none; min-width: 56px; }
  .mobilebar a[aria-current="page"] { color: #6fd6df; }
  .dayhead h1 { font-size: 1.5rem; }
  .slot { grid-template-columns: 58px 1fr; }
  .slot .side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .slot .reqline .meter { max-width: 70px; }
  .slot .time { font-size: 1.25rem; }
  .formgrid { grid-template-columns: 1fr; }
  .cal-day { min-height: 74px; padding: 2px; }
  .cal-day .ev .tx { display: none; }
  .cal-day .ev { justify-content: center; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-week .col { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .kanban { grid-template-columns: repeat(4, 80vw); }
  .tally a { flex-basis: 33%; }
  .pagehead .actions { margin-left: 0; }
  .drawer { width: 100vw; }
  .history li { grid-template-columns: 1fr; gap: 0; }
}
@media print { .rail, .mobilebar, .actions, .toolbar { display: none !important; } .app { display: block; } }

/* ---------- sedes y salones: expediente único ---------- */
.dossier { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.dossier-index { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.dossier-index b { font-family: var(--font-label); margin-bottom: 6px; }
.dossier-index a { color: var(--ink-2); padding: 4px 8px; border-left: 2px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.dossier-index a:hover { border-left-color: var(--aqua); text-decoration: none; color: var(--ink); }
.sede { margin-bottom: 36px; scroll-margin-top: 12px; }
.sede-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 3px solid var(--ink); margin-bottom: 10px; }
.sede-h h2 { font-size: 1.4rem; }
.sede-h .btn { align-self: center; }
.sede-h .btn:first-of-type { margin-left: auto; }
.sede-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; }
details.salon { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; scroll-margin-top: 12px; }
details.salon > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
details.salon > summary::-webkit-details-marker { display: none; }
details.salon > summary::before { content: "▸"; color: var(--muted); transition: transform .12s; }
details.salon[open] > summary::before { transform: rotate(90deg); }
details.salon[open] > summary { border-bottom: 1px solid var(--line-2); }
details.salon .code { font-family: var(--font-label); font-weight: 600; color: var(--aqua); min-width: 64px; }
details.salon .sum-end { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.salon-body { padding: 12px 14px 6px; }
.salon-body h4 { font-size: .86rem; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
.salon-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }
.salon-grid h4 { margin-top: 0; }
ul.alerts { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.alerts li { font-size: .88rem; padding: 5px 10px; border-radius: var(--r-sm); border-left: 4px solid; }
ul.alerts li.bad { border-color: var(--red); background: var(--red-2); }
ul.alerts li.warn { border-color: var(--amber); background: var(--amber-2); }
ul.alerts li.info { border-color: var(--line); background: var(--line-2); color: var(--ink-2); }
ul.mini { list-style: none; margin: 0 0 8px; padding: 0; font-size: .9rem; }
ul.mini li { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
ul.mini li svg { color: var(--muted); flex: none; }
.imp-st { font-size: .8rem; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: var(--line-2); white-space: nowrap; }
.imp-st.nuevo { background: var(--green-2); color: var(--green); }
.imp-st.cambia { background: var(--amber-2); color: var(--amber); }
.imp-st.conflicto { background: var(--red-2); color: var(--red); }
.imp-st.igual, .imp-st.omitido { color: var(--muted); }
tr.imp-igual td, tr.imp-omitido td { color: var(--muted); }
del { color: var(--red); text-decoration: line-through; }
ins { color: var(--green); text-decoration: none; font-weight: 600; }
dialog.xwide { width: min(1200px, calc(100vw - 24px)); }
dialog .t select { min-width: 150px; font-size: .85rem; min-height: 30px; padding: 3px 6px; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--r); padding: 16px; text-align: center; color: var(--muted); font-size: .9rem; margin: 8px 0 10px; background: var(--surface); }
.dropzone.over { border-color: var(--aqua); background: var(--aqua-2); color: var(--ink); }
.onboarding { max-width: 760px; }
.onboarding p { line-height: 1.6; }
@media (max-width: 1000px) { .dossier { grid-template-columns: 1fr; } .dossier-index { position: static; flex-direction: row; flex-wrap: wrap; } .dossier-index a { border-left: 0; border-bottom: 2px solid var(--line); } .salon-grid, .sede-info { grid-template-columns: 1fr; } }
@media print {
  body { background: #fff; font-size: 11pt; }
  .main { padding: 0; max-width: none; }
  .dossier { display: block; } .dossier-index, .sede-h .btn, .salon-body .btn, .salon-body label.btn, #toast { display: none !important; }
  details.salon { break-inside: avoid; border-color: #bbb; }
  details.salon > summary::before { content: ""; }
  .sede { break-before: page; } .sede:first-child { break-before: auto; }
  .tablewrap { overflow: visible; border: 0; } table.t th { position: static; }
  a { color: inherit; }
}
