/* Tema oscuro profesional por defecto (grises azulados). El tema claro se activa con
   <html data-theme="light"> desde el interruptor de la cabecera y se usa siempre al imprimir.
   Contraste verificado (WCAG AA ≥ 4.5:1) para texto, texto secundario y atenuado sobre bg/surface/surface-2. */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-ink: #93c5fd;
  --track: #334155;
  /* Estados (convención de la especificación), tonos ajustados para fondo oscuro */
  --st-done: #22c55e;
  --st-wip: #facc15;
  --st-todo: #f87171;
  --st-blocked: #fb923c;
  --st-done-bg: #133a26;
  --st-wip-bg: #3d3410;
  --st-todo-bg: #45191c;
  --st-blocked-bg: #452512;
  --info-bg: #1e3a5f;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f4f1; --surface: #fcfcfb; --surface-2: #f0efec; --border: #dcdbd6; --text: #0b0b0b; --text-2: #52514e;
  --muted: #66655f; --accent: #2468c4; --accent-ink: #1c5cab; --track: #e6e6e3;
  --st-done: #0ca30c; --st-wip: #fab219; --st-todo: #d03b3b; --st-blocked: #ec835a;
  --st-done-bg: #e3f4e3; --st-wip-bg: #fff3d6; --st-todo-bg: #fbe3e3; --st-blocked-bg: #fdeae2; --info-bg: #e8f0fb;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%);
  color-scheme: light;
}
@media print {
  :root, :root[data-theme="light"] {
    --bg: #fff; --surface: #fff; --surface-2: #f0efec; --border: #dcdbd6; --text: #0b0b0b; --text-2: #52514e;
    --muted: #66655f; --accent: #2468c4; --accent-ink: #1c5cab; --track: #e6e6e3;
    --st-done: #0ca30c; --st-wip: #fab219; --st-todo: #d03b3b; --st-blocked: #ec835a;
    --st-done-bg: #e3f4e3; --st-wip-bg: #fff3d6; --st-todo-bg: #fbe3e3; --st-blocked-bg: #fdeae2; --info-bg: #e8f0fb;
    --shadow: none;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.loading { padding: 32px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
/* Cabecera: NTT DATA arriba a la izquierda, el cliente arriba a la derecha; título y botones entre ambos.
   En anchos medios los botones bajan a una segunda fila; en móviles los logos se reducen. */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border);
  display: grid; gap: 8px 16px; align-items: center; padding: 10px 20px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "ntt brand actions client";
}
.topbar .logo-ntt { grid-area: ntt; }
.topbar .logo-client { grid-area: client; }
.topbar .brand { grid-area: brand; display: flex; flex-direction: column; min-width: 0; }
.topbar .brand strong { font-size: 15px; }
.topbar .brand span { color: var(--muted); font-size: 12px; }
.topbar .design-switch { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.topbar .design-switch:hover { color: var(--accent-ink); }
.topbar .actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }

/* ---------- Logos ---------- */
.logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.logo img { display: block; height: 32px; width: auto; max-width: none; }
.logo .logo-azul { display: none; }
:root[data-theme="light"] .logo .logo-azul { display: block; }
:root[data-theme="light"] .logo .logo-blanco { display: none; }
.login-logos { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 4px; }
.login-logos .logo img { height: 28px; }
nav.tabs { display: flex; flex-wrap: wrap; gap: 0 4px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
nav.tabs a {
  padding: 10px 12px; text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap;
}
nav.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1280px; margin: 0 auto; padding: 20px; display: grid; gap: 20px; }
.site-footer { max-width: 1280px; margin: 0 auto; padding: 0 20px 28px; font-size: 13px; }
.banner { padding: 8px 20px; background: var(--info-bg); font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card > h2 { margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.card > h2 .muted { font-weight: 400; font-size: 13px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

/* ---------- Botones / formularios ---------- */
.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 6px 12px; border-radius: 6px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn[aria-pressed="true"] { background: var(--info-bg); border-color: var(--accent); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; min-width: 0;
}
textarea { width: 100%; min-height: 60px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.form-row > * { flex: 1 1 160px; }
.form-row > .btn, .form-row > .check { flex: 0 0 auto; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.errors { color: var(--st-todo); font-size: 13px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Hero / KPIs ---------- */
.hero { display: grid; gap: 14px; }
.hero .headline { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.hero .big small { font-size: 16px; font-weight: 500; color: var(--text-2); margin-right: 6px; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { color: var(--text-2); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.kpi .value.date { font-size: 15px; font-weight: 600; margin-top: 8px; }

/* ---------- Barras ---------- */
.bar { position: relative; height: 12px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar.lg { height: 18px; }
.bar > .fill { height: 100%; background: var(--accent); border-radius: 4px; min-width: 0; transition: width .3s ease; }
.bar > .fill.done { background: var(--st-done); }
.stack { display: flex; gap: 2px; height: 22px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.stack > span { display: block; height: 100%; min-width: 3px; cursor: default; }
.stack > span:hover { filter: brightness(1.08); }
.seg-done { background: var(--st-done); }
.seg-wip { background: var(--st-wip); }
.seg-todo { background: var(--st-todo); }
.seg-blocked { background: var(--st-blocked); background-image: repeating-linear-gradient(45deg, rgb(255 255 255 / 30%) 0 2px, transparent 2px 7px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.compare { display: grid; gap: 6px; }
.compare-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.compare-row { padding: 4px 6px; border-radius: 6px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; color: var(--text); }
.compare-row:hover { background: var(--surface-2); }

/* ---------- Filas de avance con columnas fijas: [estado] [ID] [nombre] [barra] [%] [cronograma] ----------
   Todas las filas de una lista comparten la misma plantilla (sin columnas "auto"), así las barras tienen el mismo
   ancho y los badges quedan en columna sin importar el largo del texto. */
:root {
  --w-state: 124px;  /* badge de estado */
  --w-id: 52px;      /* 1.1 … 4.2.10 */
  --w-name: 320px;   /* nombre: máximo; elipsis + tooltip */
  --w-pct: 48px;     /* "100 %" */
  --w-sched: 184px;  /* badge de cronograma */
  --w-bar-t: 132px;  /* barra en tablas */
}
.prow {
  display: grid; column-gap: 10px; row-gap: 0; align-items: center;
  grid-template-columns: var(--w-state) var(--w-id) minmax(120px, var(--w-name)) minmax(100px, 1fr) var(--w-pct) var(--w-sched);
  grid-template-areas: "state id name bar pct sched" ". . meta meta meta meta";
}
.prow.with-caret {
  grid-template-columns: 16px var(--w-state) var(--w-id) minmax(120px, var(--w-name)) minmax(100px, 1fr) var(--w-pct) var(--w-sched);
  grid-template-areas: "caret state id name bar pct sched" ". . . meta meta meta meta";
}
.prow > .c-caret { grid-area: caret; }
.prow > .c-state { grid-area: state; display: flex; }
.prow > .c-id { grid-area: id; white-space: nowrap; }
.prow > .c-name { grid-area: name; min-width: 0; }
.prow > .c-bar { grid-area: bar; min-width: 0; }
.prow > .c-pct { grid-area: pct; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prow > .c-sched { grid-area: sched; display: flex; }
.prow > .c-meta { grid-area: meta; min-width: 0; margin-top: 4px; }
.prow-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 6px 4px; border-bottom: 1px solid var(--border); }
.prow-head > .c-state, .prow-head > .c-sched { display: block; }
.macro-list > .prow-head { padding: 0 15px 4px; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Celda de avance en tablas: barra de ancho fijo + % alineado a la derecha. */
.pcell, .pcell-head { display: grid; grid-template-columns: var(--w-bar-t) var(--w-pct); gap: 8px; align-items: center; }
.pcell .pct { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcell-head .num { text-align: right; }
.grid-table td { vertical-align: middle; }
.grid-table th { white-space: nowrap; vertical-align: bottom; }
.grid-table td.col-name .ellipsis, .grid-table td.col-name .name-box { width: 260px; max-width: 260px; }
.grid-table td.col-name .name-box .warn-line, .grid-table td.col-name .name-box .muted { white-space: normal; }
.grid-table td.col-name.small .ellipsis { width: 200px; max-width: 200px; }
.group-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 6px 0; }

/* ---------- Chips de estado ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip.COMPLETED { background: var(--st-done-bg); border-color: var(--st-done); }
.chip.IN_PROGRESS { background: var(--st-wip-bg); border-color: var(--st-wip); }
.chip.NOT_STARTED { background: var(--st-todo-bg); border-color: var(--st-todo); }
.chip.BLOCKED { background: var(--st-blocked-bg); border-color: var(--st-blocked); }
.chip.req { font-weight: 500; background: var(--surface-2); border-color: var(--border); }
.chip.req.Pendiente, .chip.req.Solicitado, .chip.req.En-validación { background: var(--st-todo-bg); border-color: var(--st-todo); }
.chip.req.Disponible { background: var(--st-done-bg); border-color: var(--st-done); }
.chip.internal { background: var(--surface-2); border-color: var(--border); color: var(--text-2); font-weight: 500; }
.chip.origin { background: var(--info-bg); font-weight: 500; }
.chip.local-open { background: var(--st-blocked-bg); border-color: var(--st-blocked); font-weight: 700; }
.chip-cell { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* Badge único (estado y cronograma): mismo alto, padding y ancho para todos los valores; ícono en columna fija.
   El texto usa siempre --text sobre fondos tenues (contraste AA en ambos temas); el color es refuerzo, no el único indicador. */
.badge {
  display: inline-grid; grid-template-columns: 16px minmax(0, 1fr); gap: 6px; align-items: center;
  height: 24px; padding: 0 10px 0 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12px; font-weight: 600; line-height: 1; color: var(--text); white-space: nowrap; box-sizing: border-box; flex: 0 0 auto;
}
.badge .ico { display: inline-flex; justify-content: center; align-items: center; width: 16px; font-size: 12px; }
.badge .lbl { overflow: hidden; text-overflow: ellipsis; text-align: left; }
.badge.st { width: var(--w-state); }
.badge.sch { width: var(--w-sched); font-weight: 500; }
.badge.sch.critical { font-weight: 700; }
.badge.st.COMPLETED, .badge.sch.green { background: var(--st-done-bg); border-color: var(--st-done); }
.badge.st.IN_PROGRESS, .badge.sch.yellow { background: var(--st-wip-bg); border-color: var(--st-wip); }
.badge.st.NOT_STARTED, .badge.sch.red { background: var(--st-todo-bg); border-color: var(--st-todo); }
.badge.st.BLOCKED { background: var(--st-blocked-bg); border-color: var(--st-blocked); }
.badge.sch.gray { color: var(--text-2); }

/* Contadores de las pestañas Alertas y Últimas actualizaciones. */
.tab-count {
  display: inline-block; min-width: 22px; margin-left: 6px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.tab-count.none { color: var(--muted); font-weight: 500; }
.tab-count.sev-critical { background: var(--st-todo-bg); border-color: var(--st-todo); }
.tab-count.sev-serious { background: var(--st-blocked-bg); border-color: var(--st-blocked); }
.tab-count.sev-warning { background: var(--st-wip-bg); border-color: var(--st-wip); }
.tab-count.sev-info, .tab-count.new { background: var(--info-bg); border-color: var(--accent); }
.sev-badge { display: inline-block; min-width: 84px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 11px; font-weight: 700; text-align: center; color: var(--text); }
.sev-badge.critical { background: var(--st-todo-bg); border-color: var(--st-todo); }
.sev-badge.serious { background: var(--st-blocked-bg); border-color: var(--st-blocked); }
.sev-badge.warning { background: var(--st-wip-bg); border-color: var(--st-wip); }
.sev-badge.info { background: var(--info-bg); border-color: var(--accent); }
.sev-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip.new-chip { background: var(--info-bg); border-color: var(--accent); }

/* ---------- Cronograma: semáforo (siempre color + texto) ---------- */
.sched { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; border: 1px solid var(--border); background: var(--surface-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.green .dot, .ms-dot.green { background: var(--st-done); }
.yellow .dot, .ms-dot.yellow { background: var(--st-wip); }
.red .dot, .ms-dot.red { background: var(--st-todo); }
.sched.green { border-color: var(--st-done); background: var(--st-done-bg); }
.sched.yellow { border-color: var(--st-wip); background: var(--st-wip-bg); }
.sched.red { border-color: var(--st-todo); background: var(--st-todo-bg); }
.sched.critical { font-weight: 700; }
.schedule { display: grid; gap: 14px; }
.schedule .headline { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; }
.sched-status { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 700; padding: 4px 14px; border-radius: var(--radius); border: 2px solid var(--border); }
.sched-status small { font-size: 15px; font-weight: 500; color: var(--text-2); }
.sched-status .dot { width: 14px; height: 14px; }
.sched-status.green { border-color: var(--st-done); background: var(--st-done-bg); }
.sched-status.yellow { border-color: var(--st-wip); background: var(--st-wip-bg); }
.sched-status.red { border-color: var(--st-todo); background: var(--st-todo-bg); }

/* Línea de hitos: posición proporcional al día hábil del plan (D1 … Dn). */
.milestones { display: grid; gap: 10px; }
.ms-track { position: relative; height: 54px; margin: 0 18px; }
.ms-line, .ms-progress { position: absolute; left: 0; top: 30px; height: 4px; border-radius: 2px; }
.ms-line { right: 0; background: var(--track); }
.ms-progress { background: var(--accent); }
.ms-today { position: absolute; top: 18px; bottom: 6px; width: 0; border-left: 2px dashed var(--accent-ink); }
.ms-today span { position: absolute; top: -18px; transform: translateX(-50%); font-size: 11px; color: var(--accent-ink); white-space: nowrap; }
.ms-dot {
  position: absolute; top: 24px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); background: var(--muted);
}
.ms-dot span { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text-2); }
.ms-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.ms-item { display: grid; gap: 2px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); border-left-width: 4px; text-decoration: none; color: var(--text); background: var(--surface-2); }
.ms-item strong { display: flex; gap: 6px; align-items: center; }
.ms-item.green { border-left-color: var(--st-done); }
.ms-item.yellow { border-left-color: var(--st-wip); }
.ms-item.red { border-left-color: var(--st-todo); }

/* Marca del avance planificado sobre las barras de avance real. */
.bar > .plan-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.schedule .cutoff { font-size: 15px; }
.banner.warn { background: var(--st-wip-bg); border-bottom: 1px solid var(--st-wip); }

/* Curva S (SVG). Planificado: línea discontinua atenuada; real: línea sólida de acento con puntos. */
.scurve-wrap { margin: 0; display: grid; gap: 6px; }
.scurve-wrap figcaption { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between; }
.scurve { width: 100%; height: auto; display: block; }
.scurve .grid { stroke: var(--border); stroke-width: 1; }
.scurve .axis { fill: var(--muted); font-size: 11px; }
.scurve .plan { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 4; stroke-linejoin: round; }
.scurve .real { fill: none; stroke: var(--accent-ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.scurve .real-dot { fill: var(--accent-ink); stroke: var(--surface); stroke-width: 2; }
.scurve .hit { fill: transparent; cursor: default; }
.scurve .hit:hover { fill: var(--accent-ink); fill-opacity: .15; }
.scurve .cut { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 3 3; }
.scurve .cut-label, .scurve .lbl { fill: var(--text-2); font-size: 11px; font-weight: 600; }
.legend i.line { display: inline-block; width: 18px; height: 0; border-radius: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--muted); background: none; }
.legend i.line.plan { border-top-style: dashed; }
.legend i.line.real { border-top: 3px solid var(--accent-ink); }
.legend i.line.cut { width: 0; height: 12px; border-top: 0; border-left: 2px dashed var(--text-2); }

/* Gantt: eje D1…Dn en días hábiles; las posiciones se asignan por CSSOM (sin estilos inline en el HTML). */
.gantt-wrap { overflow-x: auto; margin-top: 12px; }
.gantt { min-width: 940px; display: grid; gap: 2px; }
.g-row { display: grid; grid-template-columns: 220px minmax(360px, 1fr) calc(var(--w-sched) + var(--w-pct) + 126px); gap: 10px; align-items: center; min-height: 28px; }
.g-row:not(.g-head):hover { background: var(--surface-2); }
.g-head { position: sticky; top: 0; background: var(--surface); z-index: 1; border-bottom: 1px solid var(--border); }
.g-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; text-align: left; padding: 2px 4px; cursor: pointer; color: var(--text); text-decoration: none; }
.g-label .caret { color: var(--muted); display: inline-block; width: 14px; }
.g-subrow .g-label { padding-left: 22px; color: var(--text-2); }
.gantt { --g-day: 4%; }
.g-track { position: relative; height: 22px; background: repeating-linear-gradient(90deg, transparent 0 calc(var(--g-day) - 1px), var(--border) calc(var(--g-day) - 1px) var(--g-day)); }
.g-axis { height: 24px; background: none; }
.g-tick { position: absolute; top: 4px; text-align: center; font-size: 10px; color: var(--muted); overflow: hidden; }
.g-tick.now { color: var(--text); font-weight: 700; }
.g-bar { position: absolute; top: 4px; height: 14px; border-radius: 4px; border: 1.5px solid var(--muted); background: var(--surface-2); overflow: hidden; min-width: 4px; }
.g-bar.sub { top: 6px; height: 10px; }
.g-bar .g-fill { height: 100%; background: var(--muted); }
.g-bar.green { border-color: var(--st-done); } .g-bar.green .g-fill { background: var(--st-done); }
.g-bar.yellow { border-color: var(--st-wip); } .g-bar.yellow .g-fill { background: var(--st-wip); }
.g-bar.red { border-color: var(--st-todo); } .g-bar.red .g-fill { background: var(--st-todo); }
.g-diamond { position: absolute; top: 4px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg); background: var(--text); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--text-2); }
.g-today { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 2px dashed var(--accent-ink); z-index: 1; pointer-events: none; }
.g-status { display: grid; grid-template-columns: var(--w-sched) var(--w-pct) minmax(0, 1fr); gap: 8px; align-items: center; }
.g-status .pct { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.g-legend { margin-top: 10px; }
.g-key { display: inline-block; width: 14px !important; height: 10px !important; vertical-align: -1px; }
.g-key.plan { border: 1.5px solid var(--muted); background: var(--surface-2); border-radius: 3px; }
.g-key.fill { background: var(--muted); }
.g-key.diamond { width: 9px !important; height: 9px !important; transform: rotate(45deg); background: var(--text); }
.g-key.today { width: 0 !important; height: 12px !important; border-left: 2px dashed var(--accent-ink); border-radius: 0; }
.g-key.green { background: var(--st-done); } .g-key.yellow { background: var(--st-wip); } .g-key.red { background: var(--st-todo); }

/* ---------- Tarjetas de macro ---------- */
.macro-list { display: grid; gap: 10px; }
details.macro { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
details.macro > summary { list-style: none; cursor: pointer; padding: 10px 14px; }
details.macro > summary::-webkit-details-marker { display: none; }
details.macro > summary .caret { color: var(--muted); }
details.macro[open] > summary { border-bottom: 1px solid var(--border); }
details.macro .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
details.macro .body { padding: 10px 14px 14px; display: grid; gap: 10px; }
.sub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sub-list li { padding: 5px 0; border-bottom: 1px dashed var(--border); }
/* Las subactividades se alinean con las columnas de la tarjeta (sin columna de caret: se compensa con padding). */
details.macro .body .sub-list { padding-left: 26px; }
.sub-list li:last-child { border-bottom: 0; }
.warn-line { font-size: 12px; color: var(--text-2); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.expanded td { background: var(--surface-2); }

/* ---------- Alertas ---------- */
.alerts { display: grid; gap: 8px; }
.alert { border-left: 4px solid var(--border); padding: 8px 10px; background: var(--surface-2); border-radius: 0 6px 6px 0; display: grid; gap: 2px; }
.alert.critical { border-color: var(--st-todo); }
.alert.serious { border-color: var(--st-blocked); }
.alert.warning { border-color: var(--st-wip); }
.alert.info { border-color: var(--accent); }
.alert .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.alert .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- Detalle ---------- */
.detail-head { display: grid; gap: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px 20px; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; }
.prose { color: var(--text-2); }
.timeline { display: grid; gap: 6px; }
.edit-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 12px; display: grid; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters > * { flex: 0 1 auto; }
.filters label.field select, .filters label.field input { min-width: 120px; }

/* ---------- Login ---------- */
.login { max-width: 380px; margin: 10vh auto; }
.login form { display: grid; gap: 12px; }

#toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: 6px; z-index: 50; max-width: calc(100% - 32px);
}

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ntt brand client" "actions actions actions"; }
  .topbar .actions { justify-content: flex-start; }
}
@media (max-width: 1200px) { :root { --w-name: 240px; } }
/* Anchos medios: dos líneas por fila, columnas aún fijas.
   1.ª [estado] [ID] [nombre] [%] · 2.ª [cronograma (bajo estado+ID)] [barra (bajo nombre+%)]. */
@media (max-width: 960px) {
  :root { --w-sched: calc(var(--w-state) + var(--w-id) + 10px); }
  .prow {
    grid-template-columns: var(--w-state) var(--w-id) minmax(0, 1fr) var(--w-pct); row-gap: 6px;
    grid-template-areas: "state id name pct" "sched sched bar bar" "meta meta meta meta";
  }
  .prow.with-caret {
    grid-template-columns: 16px var(--w-state) var(--w-id) minmax(0, 1fr) var(--w-pct);
    grid-template-areas: "caret state id name pct" ". sched sched bar bar" ". meta meta meta meta";
  }
  .prow > .c-meta { margin-top: 0; }
  .prow-head { display: none; }
}
@media (max-width: 760px) {
  main { padding: 12px 16px; }
  .topbar { padding: 10px 16px; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ntt . client" "brand brand brand" "actions actions actions"; }
  .logo img { height: 24px; }
  nav.tabs { padding: 0 12px; }
  .sched-status { font-size: 18px; }
  .scurve .axis, .scurve .cut-label, .scurve .lbl { font-size: 26px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .logo img, .login-logos .logo img { height: 20px; }
}
@media print {
  .topbar .actions, nav.tabs, .no-print { display: none !important; }
  body { background: #fff; }
  .logo .logo-azul { display: block !important; }
  .logo .logo-blanco { display: none !important; }
}

/* Fuera de alcance: sigue visible, atenuado, con badge de cronograma de ancho fijo
   («⊘ Fuera de alcance», borde punteado) y barras grises punteadas en el Gantt. No cuenta en avances, KPIs ni alertas. */
.out-of-scope { opacity: .6; }
.out-of-scope:hover, .out-of-scope:focus-within { opacity: .85; }
.badge.sch.out { border-style: dashed; border-color: var(--muted); background: transparent; color: var(--text-2); }
.g-bar.out, .g-bar.out.neutral { border-style: dashed; border-color: var(--muted); background: transparent; }
.g-bar.out .g-fill { background: var(--muted); opacity: .45; }
.g-key.out { border: 1.5px dashed var(--muted); background: transparent; border-radius: 3px; }
.banner.scope { border: 1px dashed var(--muted); border-radius: 6px; margin: 4px 0; }
.scope-toggle { white-space: nowrap; }
@media print { .out-of-scope { opacity: .6; } }
