/*
  BECO Unidad 4 · Tema oscuro v1.6.0
  Capa de apariencia independiente de cronograma, presupuesto, analítica e importador.
  Los colores específicos de los frentes y la línea roja de corte NO se sustituyen.
*/
:root {
  --u4d-bg: #0c1622;
  --u4d-side: #111f2e;
  --u4d-panel: #162738;
  --u4d-raised: #1c3144;
  --u4d-hover: #213a4e;
  --u4d-line: #30475c;
  --u4d-text: #e9f2fa;
  --u4d-muted: #a3b9c9;
  --u4d-accent: #76c7e3;
  --u4d-green: #6bdfbc;
  --u4d-red: #ff9aaa;
}
/* Switch: se ve igual en todos los módulos y no ensancha la barra. */
.u4-theme-switch {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; min-height: 28px; padding: 4px 8px; border-radius: 7px;
  border: 1px solid #c4d7e3; background: #eef5f8; color: #17465c;
  font-family:inherit; font-size:11px; font-weight:700; line-height:1.2; cursor: pointer; white-space: nowrap;
}
.u4-theme-symbol { font-size: 15px; line-height: 1; }
.u4-theme-switch:hover { background: #dceff5; }
.u4-theme-switch:focus-visible { outline: 2px solid #2b95be; outline-offset: 2px; }
:root[data-u4-theme="dark"] { color-scheme: dark; --bg:var(--u4d-bg);--canvas:var(--u4d-bg);--ink:var(--u4d-text);--ink2:#c1d9e7;--muted:var(--u4d-muted);--border:var(--u4d-line);--line:var(--u4d-line);--white:var(--u4d-panel);--sky:var(--u4d-raised); }
:root[data-u4-theme="dark"],
:root[data-u4-theme="dark"] body { background: var(--u4d-bg) !important; color: var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .u4-theme-switch { background:#22394b !important;border-color:#487084 !important;color:#e7f5fc !important; }
:root[data-u4-theme="dark"] .u4-theme-switch:hover { background:#2d5265 !important; }
:root[data-u4-theme="dark"] ::selection { background:#245c6d; color:white; }
:root[data-u4-theme="dark"] ::-webkit-scrollbar { width:10px; height:10px; }
:root[data-u4-theme="dark"] ::-webkit-scrollbar-thumb { background:#426075; border:2px solid #142334; border-radius:12px; }
:root[data-u4-theme="dark"] ::-webkit-scrollbar-track { background:#122334; }

/* Esqueleto y superficies de todas las pantallas */
:root[data-u4-theme="dark"] .sidebar,
:root[data-u4-theme="dark"] .side { background:var(--u4d-side) !important; border-color:var(--u4d-line) !important; }
:root[data-u4-theme="dark"] .top,
:root[data-u4-theme="dark"] .topbar,
:root[data-u4-theme="dark"] .panel,
:root[data-u4-theme="dark"] .metric,
:root[data-u4-theme="dark"] .work-card,
:root[data-u4-theme="dark"] .front-card,
:root[data-u4-theme="dark"] .card,
:root[data-u4-theme="dark"] .stats article,
:root[data-u4-theme="dark"] .an-card,
:root[data-u4-theme="dark"] .an-kpi:not(.highlight),
:root[data-u4-theme="dark"] .history,
:root[data-u4-theme="dark"] .gantt-full-panel,
:root[data-u4-theme="dark"] .budget-toolbar { background:var(--u4d-panel) !important; border-color:var(--u4d-line) !important; color:var(--u4d-text) !important; box-shadow:none !important; }
:root[data-u4-theme="dark"] .hero,
:root[data-u4-theme="dark"] .hero-compact,
:root[data-u4-theme="dark"] .project-clock,
:root[data-u4-theme="dark"] .clock-card,
:root[data-u4-theme="dark"] .front-order-help,
:root[data-u4-theme="dark"] .historical-note,
:root[data-u4-theme="dark"] .gantt-meta,
:root[data-u4-theme="dark"] .gantt-heading,
:root[data-u4-theme="dark"] .metric-balance,
:root[data-u4-theme="dark"] .submetrics,
:root[data-u4-theme="dark"] .section-heading,
:root[data-u4-theme="dark"] .an-cut-head { background:var(--u4d-raised) !important; border-color:var(--u4d-line) !important; color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .side-link,
:root[data-u4-theme="dark"] .sidebar a { color:#c3d7e6 !important; }
:root[data-u4-theme="dark"] .side-link:hover,
:root[data-u4-theme="dark"] .sidebar a:hover { color:var(--u4d-text) !important;background:var(--u4d-hover) !important; }
:root[data-u4-theme="dark"] .side-link.active,
:root[data-u4-theme="dark"] .side-link.current,
:root[data-u4-theme="dark"] .sidebar a.active { color:#e6fbff !important;background:#224957 !important;border-color:#4bb6be !important; }
:root[data-u4-theme="dark"] .brand strong,
:root[data-u4-theme="dark"] .side-brand strong,
:root[data-u4-theme="dark"] .page-id strong,
:root[data-u4-theme="dark"] .toolbar-title strong,
:root[data-u4-theme="dark"] .toolbar-back,
:root[data-u4-theme="dark"] .detail-head h1,
:root[data-u4-theme="dark"] .intro h1,
:root[data-u4-theme="dark"] .an-title h1,
:root[data-u4-theme="dark"] .panel h2,
:root[data-u4-theme="dark"] .panel h3,
:root[data-u4-theme="dark"] .metric strong,
:root[data-u4-theme="dark"] .metric b,
:root[data-u4-theme="dark"] .work-card h3,
:root[data-u4-theme="dark"] .card-title-wrap h3,
:root[data-u4-theme="dark"] .an-card h2,
:root[data-u4-theme="dark"] .an-kpi strong { color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .eyebrow,
:root[data-u4-theme="dark"] .side-heading,
:root[data-u4-theme="dark"] .side-caption { color:#75c1d9 !important; }
:root[data-u4-theme="dark"] .hint,
:root[data-u4-theme="dark"] .footnote,
:root[data-u4-theme="dark"] .detail-head p,
:root[data-u4-theme="dark"] .an-title p,
:root[data-u4-theme="dark"] .metric span,
:root[data-u4-theme="dark"] .metric small,
:root[data-u4-theme="dark"] .card-bottom,
:root[data-u4-theme="dark"] .brand small,
:root[data-u4-theme="dark"] .side-brand small,
:root[data-u4-theme="dark"] .side-footer,
:root[data-u4-theme="dark"] .side-end,
:root[data-u4-theme="dark"] .source-note,
:root[data-u4-theme="dark"] .an-source,
:root[data-u4-theme="dark"] .an-card-heading small { color:var(--u4d-muted) !important; }

/* Formularios y controles, incluidos campos inline */
:root[data-u4-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
:root[data-u4-theme="dark"] select,
:root[data-u4-theme="dark"] textarea,
:root[data-u4-theme="dark"] .cell-input,
:root[data-u4-theme="dark"] .cell-select,
:root[data-u4-theme="dark"] .inline-cell,
:root[data-u4-theme="dark"] .money-input input,
:root[data-u4-theme="dark"] .input { background:#182d3f !important; color:#edf5fb !important; border-color:#416074 !important; }
:root[data-u4-theme="dark"] input::placeholder,
:root[data-u4-theme="dark"] textarea::placeholder { color:#98afc1 !important; opacity:1; }
:root[data-u4-theme="dark"] option { background:#1c3042;color:#f1f7fc; }
:root[data-u4-theme="dark"] input:disabled,
:root[data-u4-theme="dark"] select:disabled,
:root[data-u4-theme="dark"] .inline-cell:disabled { background:#1a2a35 !important;color:#9aabba !important; }
:root[data-u4-theme="dark"] button:not(.primary):not(.action.primary):not(.work-card):not(.front-card):not(.side-link):not(.u4-theme-switch),
:root[data-u4-theme="dark"] .secondary-action,
:root[data-u4-theme="dark"] .action.subtle,
:root[data-u4-theme="dark"] .add-section,
:root[data-u4-theme="dark"] .fit-columns { background:#20374a !important; border-color:#456075 !important; color:#e4f2fa !important; }
:root[data-u4-theme="dark"] button:not(.primary):not(.action.primary):not(.side-link):not(.u4-theme-switch):hover,
:root[data-u4-theme="dark"] .action.subtle:hover { background:#294a5e !important; }
:root[data-u4-theme="dark"] .primary,
:root[data-u4-theme="dark"] .action.primary { background:#0e706e !important;color:#fff !important;border-color:#258e87 !important; }
:root[data-u4-theme="dark"] a:not(.side-link) { color:var(--u4d-accent); }
:root[data-u4-theme="dark"] .tabs { border-color:var(--u4d-line) !important; }
:root[data-u4-theme="dark"] .tabs button { color:#bad3e3 !important; }
:root[data-u4-theme="dark"] .tabs button.active,
:root[data-u4-theme="dark"] .tabs .active { color:#8ce5ed !important; border-color:#55b6c5 !important; }
:root[data-u4-theme="dark"] .version,
:root[data-u4-theme="dark"] .tag,
:root[data-u4-theme="dark"] .badge:not(.danger),
:root[data-u4-theme="dark"] .group-chip { background:#2a4556 !important;color:#e3f4f7 !important; }

/* Cronograma: conservar barra de frente y progreso, pero oscurecer áreas y guías */
:root[data-u4-theme="dark"] .timeline-scroll,
:root[data-u4-theme="dark"] .table-scroll,
:root[data-u4-theme="dark"] .gantt-layout,
:root[data-u4-theme="dark"] .gantt-label,
:root[data-u4-theme="dark"] .gantt-months,
:root[data-u4-theme="dark"] .timeline-name,
:root[data-u4-theme="dark"] .month-labels { background:var(--u4d-panel) !important; color:var(--u4d-text) !important;border-color:var(--u4d-line) !important; }
:root[data-u4-theme="dark"] .timeline-track,
:root[data-u4-theme="dark"] .gantt-track,
:root[data-u4-theme="dark"] .gantt-grid { background-color:#122437 !important; border-color:#2f4558 !important; }
:root[data-u4-theme="dark"] .timeline-row,
:root[data-u4-theme="dark"] .gantt-row,
:root[data-u4-theme="dark"] .gantt-row>div { border-color:var(--u4d-line) !important; }
:root[data-u4-theme="dark"] .timeline-track { background-image:repeating-linear-gradient(to right,transparent 0,transparent calc(var(--timeline-grid,8.333%) - 1px),#2c455b calc(var(--timeline-grid,8.333%) - 1px),#2c455b var(--timeline-grid,8.333%)) !important; }
:root[data-u4-theme="dark"] .gantt-track { background-image:repeating-linear-gradient(to right,transparent 0,transparent calc(var(--timeline-grid,8.333%) - 1px),#2a4559 calc(var(--timeline-grid,8.333%) - 1px),#2a4559 var(--timeline-grid,8.333%)) !important; }
:root[data-u4-theme="dark"] .gantt-months span,
:root[data-u4-theme="dark"] .gantt-heading span,
:root[data-u4-theme="dark"] .month-labels span { background:#1c3043 !important;color:#c7deee !important;border-color:#385166 !important; }
:root[data-u4-theme="dark"] .gantt-label:hover,
:root[data-u4-theme="dark"] .timeline-row:hover .timeline-name { background:#263f52 !important; }
/* La línea de corte sigue roja; no se recolorean barras, hitos ni pins por frente. */
:root[data-u4-theme="dark"] .gantt-today,
:root[data-u4-theme="dark"] .today-line,
:root[data-u4-theme="dark"] .cutoff-line { border-color:#fa5e6c !important; }
:root[data-u4-theme="dark"] .cutoff-legend { background:#fa5e6c !important; }
:root[data-u4-theme="dark"] .gantt-legend,
:root[data-u4-theme="dark"] .legend { background:var(--u4d-panel) !important;color:#c3d8e6 !important; }

/* Tablas operativas y grupos */
:root[data-u4-theme="dark"] table,
:root[data-u4-theme="dark"] .data-table,
:root[data-u4-theme="dark"] #activityTable { background:var(--u4d-panel) !important;color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] th,
:root[data-u4-theme="dark"] .data-table th,
:root[data-u4-theme="dark"] #activityTable th { background:#223a4d !important;color:#e4f2fa !important;border-color:var(--u4d-line) !important; }
:root[data-u4-theme="dark"] td,
:root[data-u4-theme="dark"] .data-table td,
:root[data-u4-theme="dark"] #activityTable td { color:#dfedf7 !important;border-color:#2c4254 !important; }
:root[data-u4-theme="dark"] tbody tr:not(.group-row):not(.section-row) td { background:#172b3d !important; }
:root[data-u4-theme="dark"] tbody tr:not(.group-row):not(.section-row):nth-child(even) td { background:#192e40 !important; }
:root[data-u4-theme="dark"] tbody tr:not(.group-row):not(.section-row):hover td { background:#274558 !important; }
:root[data-u4-theme="dark"] .data-table tr.group-row td,
:root[data-u4-theme="dark"] .data-table tr.group-row .money-col,
:root[data-u4-theme="dark"] .group-row td,
:root[data-u4-theme="dark"] #activityTable .section-row td,
:root[data-u4-theme="dark"] .section-row td { background:#263e50 !important;color:#f2f9fd !important;border-color:#476074 !important; }
:root[data-u4-theme="dark"] .data-table .row-selected td { background:#23535c !important; }
:root[data-u4-theme="dark"] .data-table tr.drop-target td { background:#215f5e !important; }
:root[data-u4-theme="dark"] .section-add-row td,
:root[data-u4-theme="dark"] #activityTable .inline-add td,
:root[data-u4-theme="dark"] .inline-editor-row td { background:#193246 !important; }
:root[data-u4-theme="dark"] .inline-entry-form,
:root[data-u4-theme="dark"] .inline-form-grid,
:root[data-u4-theme="dark"] .inline-form-head { background:var(--u4d-raised) !important;color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .money-display .money-figure,
:root[data-u4-theme="dark"] .group-row .money-display .money-figure,
:root[data-u4-theme="dark"] .readonly-cell,
:root[data-u4-theme="dark"] .money-input .money-unit { color:#e4eff8 !important; }
:root[data-u4-theme="dark"] .money-display .money-label { color:#b0c4d3 !important; }
:root[data-u4-theme="dark"] .over-estimate .money-display .money-figure,
:root[data-u4-theme="dark"] .metric-negative { color:var(--u4d-red) !important; }
:root[data-u4-theme="dark"] .u4-row-context-menu,
:root[data-u4-theme="dark"] .row-menu,
:root[data-u4-theme="dark"] .popover,
:root[data-u4-theme="dark"] .drop-menu { background:#1b3042 !important;border-color:#456176 !important;box-shadow:0 10px 30px #0006 !important; }
:root[data-u4-theme="dark"] .u4-row-context-menu button,
:root[data-u4-theme="dark"] .row-menu button { color:#e1f1fb !important; }

/* Formularios y panel lateral de Presupuesto */
:root[data-u4-theme="dark"] .money-drawer,
:root[data-u4-theme="dark"] .drawer,
:root[data-u4-theme="dark"] .modal,
:root[data-u4-theme="dark"] .move-modal { background:#142536 !important;border-color:var(--u4d-line) !important;color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .currency-edit,
:root[data-u4-theme="dark"] .reported-group,
:root[data-u4-theme="dark"] .money-drawer-head,
:root[data-u4-theme="dark"] .money-foot,
:root[data-u4-theme="dark"] .move-label { background:#1b3042 !important;border-color:#334e62 !important;color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .currency-edit-title b,
:root[data-u4-theme="dark"] .money-drawer-head h2,
:root[data-u4-theme="dark"] .currency-conversion strong,
:root[data-u4-theme="dark"] .reported-foot strong,
:root[data-u4-theme="dark"] .reported-head b { color:#e8f5fc !important; }
:root[data-u4-theme="dark"] .currency-edit-title span,
:root[data-u4-theme="dark"] .currency-edit label,
:root[data-u4-theme="dark"] .reported-foot,
:root[data-u4-theme="dark"] .money-drawer-head p { color:var(--u4d-muted) !important; }
:root[data-u4-theme="dark"] .money-group-real,
:root[data-u4-theme="dark"] .currency-conversion,
:root[data-u4-theme="dark"] .control-totals { background:#203949 !important;border-color:#3d576a !important;color:#d5e8f5 !important; }

/* Importador Excel, avisos y zonas de carga */
:root[data-u4-theme="dark"] .filezone,
:root[data-u4-theme="dark"] .upload,
:root[data-u4-theme="dark"] .rules,
:root[data-u4-theme="dark"] .step-card,
:root[data-u4-theme="dark"] .maincols .panel,
:root[data-u4-theme="dark"] .stats article { background:var(--u4d-panel) !important;color:var(--u4d-text) !important;border-color:var(--u4d-line) !important; }
:root[data-u4-theme="dark"] .filezone strong { color:#e6f5fd !important; }
:root[data-u4-theme="dark"] .notice,
:root[data-u4-theme="dark"] .alert { background:#30412d !important;color:#ffedbd !important;border-color:#6d764a !important; }
:root[data-u4-theme="dark"] .notice.error,
:root[data-u4-theme="dark"] .alert.error { background:#492c38 !important;color:#ffc3ca !important;border-color:#8d4856 !important; }
:root[data-u4-theme="dark"] .notice.good,
:root[data-u4-theme="dark"] .alert.good { background:#1a4842 !important;color:#abf2d1 !important;border-color:#2d8575 !important; }
:root[data-u4-theme="dark"] .filezone small,
:root[data-u4-theme="dark"] .panel-head p { color:var(--u4d-muted) !important; }

/* Analítica financiera: gráficos legibles sobre superficies oscuras */
:root[data-u4-theme="dark"] .an-kpi.highlight { background:#0b615d !important; color:#fff !important;border-color:#2d938d !important; }
:root[data-u4-theme="dark"] .an-kpi.highlight strong { color:#fff !important; }
:root[data-u4-theme="dark"] .an-donut::before { background:var(--u4d-panel) !important; }
:root[data-u4-theme="dark"] .an-donut span,
:root[data-u4-theme="dark"] .an-legend,
:root[data-u4-theme="dark"] .cut-inspect h3,
:root[data-u4-theme="dark"] .an-compare h3 { color:var(--u4d-text) !important; }
:root[data-u4-theme="dark"] .an-table-scroll tbody tr:nth-child(even) td,
:root[data-u4-theme="dark"] .cut-list tbody tr:nth-child(even) td { background:#1c3143 !important; }
:root[data-u4-theme="dark"] .an-table-scroll th,
:root[data-u4-theme="dark"] .cut-list th { background:#254052 !important; }
:root[data-u4-theme="dark"] .cut-inspect,
:root[data-u4-theme="dark"] .an-compare,
:root[data-u4-theme="dark"] .cut-meta,
:root[data-u4-theme="dark"] .comparison-table { background:#1b3042 !important;color:#e6f3fa !important;border-color:#3b5266 !important; }
/* Los SVG de barras de la analítica tienen textos oscuros fijos: adaptar texto y guías, no colores de datos. */
:root[data-u4-theme="dark"] .an-bars svg text { fill:#deedf7 !important; }
:root[data-u4-theme="dark"] .an-bars svg line { stroke:#425a6d !important; }
@media (max-width: 760px) { .u4-theme-caption {display:none;} .u4-theme-switch {padding:5px 7px;min-width:30px;} }
@media print { .u4-theme-switch {display:none!important;} }
/* Conserva la identidad cromática de cada frente en las filas de encabezado del Gantt. */
:root[data-u4-theme="dark"] .gantt-workstream .gantt-label {
  background:color-mix(in srgb,var(--front-color) 24%,#15283b) !important;
  border-left:4px solid var(--front-color) !important;
}
:root[data-u4-theme="dark"] .gantt-section .gantt-label {
  background:color-mix(in srgb,var(--front-color) 12%,#172b3d) !important;
  border-left:3px solid var(--front-color) !important;
}
:root[data-u4-theme="dark"] .gantt-selected .gantt-label {
  background:#1d555e !important;
  box-shadow:inset 3px 0 #50c3c3 !important;
}
/* Acciones activas distinguibles del resto de los controles. */
:root[data-u4-theme="dark"] .zoom button.active,
:root[data-u4-theme="dark"] .gantt-controls button.active,
:root[data-u4-theme="dark"] .view-toggle button.active,
:root[data-u4-theme="dark"] .mode-active,
:root[data-u4-theme="dark"] button[aria-pressed="true"]:not(.u4-theme-switch),
:root[data-u4-theme="dark"] .structure-mode-button[aria-pressed="true"] {
  background:#145762 !important;
  color:#e4fffb !important;
  border-color:#4cb7b9 !important;
}
:root[data-u4-theme="dark"] .gantt-help,
:root[data-u4-theme="dark"] .gantt-help p,
:root[data-u4-theme="dark"] .gantt-help summary {
  background:#1c3144 !important;
  color:#d7e8f1 !important;
}
