/* RTFM Portal — crimson / black / light gray; colores vía CSS variables inyectadas */
:root {
  --brand-primary: #C41E3A;
  --brand-accent: #111111;
  --bg: #F5F5F5;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #6b7280;
  --border: #e8eaed;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 10px 28px rgba(17, 17, 17, 0.06);
  --shadow-lg: 0 4px 12px rgba(17, 17, 17, 0.06), 0 20px 40px rgba(17, 17, 17, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 60px;
  --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(1200px 400px at 10% -10%, rgba(196, 30, 58, 0.07), transparent 60%), var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-accent); text-decoration: underline; }

.container { width: min(1100px, 100% - 2rem); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17, 17, 17, 0.88);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  color: #fff;
  box-shadow: 0 8px 28px rgba(17, 17, 17, 0.18);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.55rem 0;
  flex-wrap: nowrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  flex-shrink: 0;
}
.logo:hover { color: #fff; text-decoration: none; }

.logo-img {
  height: 38px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 4px 8px;
}
.logo-client { height: 30px; max-width: 100px; }
.logo-sep {
  width: 1px; height: 26px;
  background: rgba(255,255,255,0.28);
  display: inline-block;
}
.logo-client-name {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.95;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 38px;
  padding: 0;
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-toggle:hover { background: rgba(255,255,255,0.14); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
  top: 0; transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
  top: 0; transform: rotate(-45deg);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex: 1;
  min-width: 0;
}
.nav-primary {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  min-width: 0;
}
.nav-primary a {
  position: relative;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-weight: 560;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-primary a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}
.nav-primary a.is-active {
  color: #fff;
  background: rgba(196, 30, 58, 0.22);
  text-decoration: none;
}
.nav-primary a.is-active::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.2rem;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-primary);
  box-shadow: 0 0 10px rgba(196, 30, 58, 0.55);
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-shrink: 0;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 200px;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}
.user-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.user-chip-avatar img { width:100%; height:100%; object-fit:cover; border-radius:999px; display:block; }
a.user-chip { text-decoration: none; color: inherit; }
.user-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  padding-right: 0.25rem;
}
.user-chip-name {
  font-size: 0.78rem;
  font-weight: 650;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-logout-form { display: inline; margin: 0; }
.nav-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 560;
  white-space: nowrap;
}
.nav-logout:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }

/* Slim secondary bar (PMO / Ingeniería / Admin) */
.nav-secondary-bar {
  background: rgba(245, 245, 245, 0.97);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-secondary {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  min-width: max-content;
  min-height: 40px;
  padding: 0.3rem 0;
}
.nav-secondary a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.nav-secondary a:hover {
  color: var(--ink);
  background: rgba(17, 17, 17, 0.05);
  text-decoration: none;
}
.nav-secondary a.is-active {
  color: #fff;
  background: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.25);
  text-decoration: none;
}

.nav-group-label {
  display: inline-flex;
  align-items: center;
  margin-left: 0.55rem;
  padding: 0.2rem 0.35rem 0.2rem 0.65rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.85;
  border-left: 1px solid var(--border);
}
.nav-group-label:first-child {
  margin-left: 0;
  padding-left: 0.35rem;
  border-left: 0;
}
html[data-theme="dark"] .nav-group-label {
  border-left-color: rgba(255,255,255,0.12);
}

.main { flex: 1; padding: 1.75rem 0 2.5rem; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1.25rem 0;
}

.page-head { margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.page-head h1 { margin: 0 0 0.35rem; font-size: 1.65rem; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #a7f3d0; }

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--surface);
  padding: 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.auth-card h1 { margin-top: 0; font-size: 1.4rem; }

.form label {
  display: block;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
  font-size: 0.9rem;
}
.form input[type="email"],
.form input[type="password"],
.form input[type="text"],
.form input[type="number"],
.form input[type="date"],
.form input[type="file"],
.form input[type="color"],
.form select,
.form textarea,
.filters select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.form textarea { min-height: 110px; resize: vertical; }
.form input:focus,
.form select:focus,
.form textarea:focus,
.filters select:focus {
  outline: 2px solid var(--brand-accent);
  outline-offset: 1px;
  border-color: var(--brand-primary);
}
.form-row { display: grid; gap: 1rem; }
@media (min-width: 640px) {
  .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.hint { margin-top: 1.25rem; font-size: 0.85rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 650;
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-primary); color: #fff; box-shadow: 0 6px 16px rgba(196, 30, 58, 0.28); }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-accent { background: var(--brand-accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.05); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-secondary:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); color: #fff; }
.btn-small { width: auto; margin: 0; padding: 0.35rem 0.7rem; font-size: 0.875rem; }
.auth-card .btn-primary { width: 100%; margin-top: 1.15rem; }

.grid.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid.cards.cols-4 { grid-template-columns: repeat(4, 1fr); } .grid.cards.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.card h2 { font-size: 1.1rem; }
.card-link { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.card-link:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 6px 24px rgba(196, 30, 58, 0.12);
  text-decoration: none; color: inherit;
}
.stat { font-size: 2rem; font-weight: 700; color: var(--brand-primary); margin: 0.25rem 0; }

.filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end;
  margin-bottom: 1.25rem; background: var(--surface); padding: 1rem;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.filters label { font-weight: 600; font-size: 0.9rem; }
.filters select, .filters input { max-width: 280px; width: auto; flex: 1; }
.filters .btn { width: auto; margin: 0; }

.table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td {
  padding: 0.85rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
.table th {
  background: #fafafa; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; background: #fce8ec; color: var(--brand-primary);
  padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}
.badge-accent { background: #ffedd5; color: #9a3412; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

.actions { white-space: nowrap; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.empty {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted);
}

.info-section { margin-bottom: 2rem; }
.info-section h2 {
  font-size: 1.25rem; margin: 0 0 0.85rem; padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--brand-accent); display: inline-block;
}
.stack { display: grid; gap: 0.85rem; }
.meta { margin: 0 0 0.5rem; }

.thread { display: grid; gap: 0.85rem; margin: 1.25rem 0; }
.thread-item { border-left: 3px solid var(--brand-primary); padding-left: 1rem; }
.thread-item.staff { border-left-color: var(--brand-accent); }

.inline-form { display: inline; }

@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.35rem 0 0.65rem;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .nav.is-open { display: flex; }
  .nav-primary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
  }
  .nav-primary a {
    width: 100%;
    text-align: left;
    border-radius: 10px;
  }
  .nav-primary a.is-active::after {
    left: 0.85rem;
    right: auto;
    width: 28px;
    bottom: 0.45rem;
  }
  .nav-end {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .user-chip { max-width: none; flex: 1; }
  .nav-logout { width: auto; }
  .nav-secondary { gap: 0.2rem; }
  .nav-secondary a { font-size: 0.78rem; padding: 0.32rem 0.65rem; }
}

@media (max-width: 520px) {
  .user-chip-text { display: none; }
  .user-chip { padding-right: 0.2rem; }
}


/* KPI / SLA charts (SVG, sin dependencias externas) */
.kpi-charts {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .kpi-charts { grid-template-columns: repeat(3, 1fr); }
}
.kpi-charts .card h2 { font-size: 1rem; margin-bottom: 0.75rem; }
.kpi-chart { width: 100%; height: auto; max-height: 240px; display: block; }
.kpi-chart-label, .kpi-chart-value {
  font-size: 11px;
  fill: #64748b;
  font-family: var(--font);
}
.kpi-chart-value { font-weight: 700; fill: #0f172a; }
.kpi-chart-center {
  font-size: 22px;
  font-weight: 700;
  fill: var(--brand-primary);
  font-family: var(--font);
}
.kpi-donut-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.kpi-donut { width: 160px; height: 160px; flex-shrink: 0; }
.kpi-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
  display: grid;
  gap: 0.35rem;
}
.kpi-legend li { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.kpi-swatch {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0;
}
.sla-badges { margin-top: 0.65rem; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.sla-policy-hint { width: 100%; margin: 0.35rem 0 0; }
.checkbox-label { font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }


/* —— PMO area —— */
.area-pmo .main { padding-top: 2rem; }
.container { width: min(1180px, 100% - 2rem); }

.health-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  vertical-align: middle; margin-right: 0.35rem;
}
.health-green { background: #047857; }
.health-yellow { background: #eab308; }
.health-red { background: #b91c1c; }

.kpi-mini {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 1.5rem;
}
.kpi-mini .card { padding: 1.1rem 1.2rem; }
.kpi-mini .stat { font-size: 1.65rem; letter-spacing: -0.02em; }
.kpi-mini .label { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

.gantt-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.gantt-svg { width: 100%; min-width: 900px; height: auto; display: block; }
.gantt-label, .gantt-tick, .gantt-today, .gantt-section {
  font-family: var(--font); font-size: 11px; fill: #6b7280;
}
.gantt-label { fill: #111; font-size: 11px; }
.gantt-section { fill: var(--brand-primary); font-weight: 700; font-size: 12px; }
.gantt-today { fill: var(--brand-primary); font-weight: 700; font-size: 11px; }
.gantt-toolbar .btn-small { min-width: 4.5rem; }
tr.gantt-task-row.is-editing { background: #fff5f6; outline: 2px solid #C41E3A33; }
html[data-theme="dark"] tr.gantt-task-row.is-editing { background: #3a1520; }
.gantt-nudge .btn-small { padding: 0.2rem 0.45rem; font-size: 0.75rem; }


.wiki-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  line-height: 1.65;
}
.wiki-body h1 { font-size: 1.5rem; margin-top: 0; }
.wiki-body h2 { font-size: 1.25rem; border-bottom: 2px solid var(--brand-primary); padding-bottom: 0.25rem; display: inline-block; }
.wiki-body h3 { font-size: 1.05rem; }
.wiki-body ul, .wiki-body ol { padding-left: 1.25rem; }
.wiki-list { display: grid; gap: 0.65rem; }
.wiki-list a {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.15rem; color: inherit; text-decoration: none;
  box-shadow: var(--shadow);
}
.wiki-list a:hover { border-color: var(--brand-primary); }

.split-2 {
  display: grid; gap: 1.25rem;
}
@media (min-width: 960px) {
  .split-2 { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

.card { transition: box-shadow 0.15s ease; }
.form-card, .card, .table-wrap, .auth-card {
  border-radius: var(--radius);
}

.auth-card .logo-auth {
  display: block; height: 52px; width: auto; margin: 0 auto 1rem;
  background: #fff; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border);
}

.progress-bar {
  height: 8px; background: #eee; border-radius: 999px; overflow: hidden; margin-top: 0.35rem;
}
.progress-bar > span {
  display: block; height: 100%; background: var(--brand-primary); border-radius: 999px;
}


/* Documentos base + a11y */
.doc-checklist { display: grid; gap: 1rem; }
.doc-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.65rem; }
.doc-card-head h2 { margin: 0; font-size: 1.05rem; }
.doc-actions { display: grid; gap: 0.75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.doc-actions .inline-status, .doc-actions .inline-upload { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.doc-actions select, .doc-actions input[type="text"], .doc-actions input[type="file"] { width: auto; flex: 1 1 140px; margin: 0; }
.doc-chip-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.page-head h1 { font-size: clamp(1.45rem, 2.5vw, 1.85rem); letter-spacing: -0.03em; font-weight: 750; }
.card-link:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
@media (max-width: 640px) {
  .doc-actions .inline-status, .doc-actions .inline-upload { flex-direction: column; align-items: stretch; }
}

/* —— Ingeniería + gráficos extra —— */
.ing-hub { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .ing-hub { grid-template-columns: 1fr 1fr; } }
.formula-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  font-size: 0.9rem;
  margin: 1.25rem 0;
}
.formula-box h3 { margin-top: 0; font-size: 1rem; }
.formula-box p { margin: 0.4rem 0; }
.compare-panel { margin: 1.25rem 0 1.5rem; }
@media (min-width: 900px) {
  .kpi-charts.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .kpi-charts.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .kpi-charts.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1180px) {
  .kpi-charts.cols-4 { grid-template-columns: repeat(4, 1fr); }
}
.kpi-volume { max-height: 180px; }

/* —— Landing pública + hub Inicio —— */
.area-landing .site-header .nav,
.area-landing .site-header .nav-toggle,
.area-auth .site-header .nav-toggle { display: none !important; }
.area-landing .site-header .nav-secondary-bar { display: none; }

.landing { display: grid; gap: 1.5rem; padding: 1rem 0 2rem; }
.landing-hero {
  text-align: center;
  padding: 2.25rem 1.5rem 2rem;
  border-top: 4px solid var(--brand-primary);
}
.landing-logo { margin: 0 auto 1rem; height: 64px; }
.landing-hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  letter-spacing: -0.03em;
  color: var(--brand-accent);
}
.landing-hero .lead {
  max-width: 38rem;
  margin: 0 auto 1.35rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.landing-cta { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.landing-modules {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .landing-modules { grid-template-columns: repeat(3, 1fr); }
}
.landing-modules h2 { margin: 0 0 0.4rem; color: var(--brand-primary); font-size: 1.1rem; }
.landing-hint, .hint.landing-hint { font-size: 0.8rem; text-align: center; margin-top: 0.5rem; }

.hub-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .hub-grid { grid-template-columns: 1fr 1fr; }
}
.hub-card .stat { margin: 0.35rem 0 0.5rem; color: var(--brand-primary); }
.hub-card-muted { opacity: 0.85; border-style: dashed; }
.check-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  font-weight: 500;
}
.check-inline input { width: auto; margin: 0; }
.rvtools-box {
  border-left: 4px solid var(--brand-primary);
  margin: 1.25rem 0;
}

/* Nav tools: search + notifications */
.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-right: 0.15rem;
}
.nav-search input[type="search"] {
  width: 9.5rem;
  max-width: 28vw;
  height: 2rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.22);
  border-right: none;
  border-radius: 999px 0 0 999px;
  background: rgba(0,0,0,0.25);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
}
.nav-search input[type="search"]::placeholder { color: rgba(255,255,255,0.55); }
.nav-search input[type="search"]:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: rgba(0,0,0,0.4);
}
.nav-search-btn {
  height: 2rem;
  width: 2rem;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 0 999px 999px 0;
  background: rgba(196,30,58,0.35);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.nav-search-btn:hover { background: rgba(196,30,58,0.55); }

.nav-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}
.nav-bell:hover { background: rgba(255,255,255,0.14); text-decoration: none; }
.nav-bell-icon { font-size: 0.95rem; line-height: 1; }
.nav-bell-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.3rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px #111;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.hub-card-alert { border-color: var(--brand-primary); box-shadow: 0 0 0 1px rgba(196,30,58,0.25); }
.hub-card h3 { margin: 0; font-size: 0.95rem; }
.queue-section { margin-bottom: 0.5rem; }
.queue-cards { margin-bottom: 0.25rem; }
@media (min-width: 900px) {
  .queue-cards { grid-template-columns: repeat(3, 1fr); }
  .queue-lists { grid-template-columns: 1fr 1fr !important; }
}
.row-alert td { background: rgba(196,30,58,0.06); }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: none; }
.notif-list a {
  display: block;
  padding: 0.65rem 0.15rem;
  text-decoration: none;
  color: inherit;
}
.notif-list a:hover { background: rgba(196,30,58,0.04); }
.notif-list strong { display: block; color: var(--brand-primary); }

.notif-list-full .notif-item { padding: 0.15rem 0; }
.notif-list-full .badge { margin-right: 0.35rem; }
.notif-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.35rem 0;
}
.notif-main { flex: 1 1 16rem; }
.notif-actions { flex: 0 0 auto; margin: 0.35rem 0; }
.notif-item.is-unread { background: rgba(196,30,58,0.05); border-radius: 6px; padding-left: 0.35rem; padding-right: 0.35rem; }
.notif-item.is-read { opacity: 0.78; }
.nav-bell-badge.is-empty { display: none; }
.inline-form { display: inline; margin: 0; }
.tpl-nested { margin-top: 1.25rem; }
.tpl-nested h2 { margin-bottom: 0.5rem; }
.tpl-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.4rem 1rem;
}
.tpl-check-grid label { display: flex; gap: 0.4rem; align-items: center; font-weight: 500; }

.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li { border-bottom: 1px solid var(--border); }
.search-results a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.1rem;
  text-decoration: none;
  color: inherit;
}
.search-results a:hover { background: rgba(196,30,58,0.04); }
.search-results strong { color: var(--brand-primary); }

@media (max-width: 900px) {
  .nav-search input[type="search"] { width: 6.5rem; }
  .user-chip-text { display: none; }
}


/* Alcance de la plataforma (landing + hub) */
.landing-scope-title {
  margin: 0.25rem 0 0;
  font-size: 1.15rem;
  color: var(--brand-accent);
  text-align: center;
}
@media (min-width: 720px) {
  .landing-modules.landing-scope { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .landing-modules.landing-scope { grid-template-columns: repeat(4, 1fr); }
  .hub-grid.hub-scope { grid-template-columns: repeat(3, 1fr); }
}
.hub-scope .hub-card h2 { font-size: 1.05rem; }
.demo-roles {
  margin-top: 1.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px dashed rgba(0,0,0,0.18);
  border-radius: 10px;
  background: #fafafa;
  text-align: left;
}
.demo-roles summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-primary);
  list-style: none;
}
.demo-roles summary::-webkit-details-marker { display: none; }
.demo-roles[open] summary { margin-bottom: 0.6rem; }
.demo-roles-table { max-height: 16rem; overflow: auto; }
.demo-roles-table .table { font-size: 0.78rem; margin: 0; }
.demo-roles-table td, .demo-roles-table th { padding: 0.35rem 0.45rem; white-space: nowrap; }


/* Demo banner (lote 2) */
.demo-banner {
  background: #111;
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.75rem;
  border-bottom: 3px solid var(--brand-primary, #C41E3A);
}
.push-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0;
}
.push-panel .muted { flex: 1 1 100%; }

/* ========== Dark mode + densidad (Elon UX) ========== */
.ux-toggles {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}
.ux-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}
.ux-toggle:hover { background: rgba(255,255,255,0.18); }
.ux-toggle[aria-pressed="true"] {
  background: var(--brand-primary);
  border-color: transparent;
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #1a1d24;
  --ink: #e8eaed;
  --muted: #9aa0a6;
  --border: #2a2f3a;
  --danger: #f87171;
  --danger-bg: #3f1d1d;
  --ok: #34d399;
  --ok-bg: #0f2e24;
  --warn: #fbbf24;
  --warn-bg: #3b2f14;
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 10px 28px rgba(0,0,0,0.35);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4), 0 20px 40px rgba(0,0,0,0.45);
}

html[data-theme="dark"] body {
  background: radial-gradient(1200px 400px at 10% -10%, rgba(196, 30, 58, 0.12), transparent 60%), var(--bg);
  color: var(--ink);
}

html[data-theme="dark"] .site-header {
  background: rgba(10, 12, 16, 0.92);
  border-bottom-color: rgba(255,255,255,0.08);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .auth-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

html[data-theme="dark"] .table th {
  background: #12151b;
  color: var(--muted);
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
  border-color: var(--border);
}
html[data-theme="dark"] .muted { color: var(--muted); }
html[data-theme="dark"] .alert-error { background: var(--danger-bg); color: var(--danger); }
html[data-theme="dark"] .alert-success { background: var(--ok-bg); color: var(--ok); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #12151b;
  color: var(--ink);
  border-color: var(--border);
}
html[data-theme="dark"] .nav-secondary-bar {
  background: #12151b;
  border-color: var(--border);
}
html[data-theme="dark"] .site-footer {
  background: #0a0c10;
  color: var(--muted);
  border-color: var(--border);
}

/* Densidad compacta de tablas */
body.density-compact .table {
  font-size: 0.82rem;
}
body.density-compact .table th,
body.density-compact .table td {
  padding: 0.28rem 0.45rem;
}
body.density-compact .kpi-mini .card,
body.density-compact .form-card {
  padding: 0.75rem 0.9rem;
}
body.density-compact .page-head {
  margin-bottom: 0.75rem;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.monitor-grid .card .stat { font-size: 1.35rem; font-weight: 700; margin: 0.2rem 0; }
.monitor-ok { color: var(--ok); }
.monitor-warn { color: var(--warn); }
.monitor-bad { color: var(--danger); }


/* ——— App shell sidebar (estilo portal RR.HH.) ——— */
body.has-sidebar {
  display: block;
  min-height: 100vh;
}
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container-wide {
  width: min(1400px, 100% - 2rem);
  margin-inline: auto;
}
.app-body {
  display: flex;
  flex: 1;
  width: min(1400px, 100%);
  margin-inline: auto;
  align-items: stretch;
  min-height: 0;
}
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 1rem 0.85rem 2rem;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.85rem;
}
.sidebar-brand-text {
  font-weight: 750;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.sidebar-section { margin-bottom: 1rem; }
.sidebar-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  margin: 0 0 0.25rem;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}
.sidebar-nav a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-weight: 560;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a:hover {
  background: rgba(196, 30, 58, 0.08);
  color: var(--brand-primary);
  text-decoration: none;
}
.sidebar-nav a.is-active {
  background: rgba(196, 30, 58, 0.14);
  color: var(--brand-primary);
  box-shadow: inset 3px 0 0 var(--brand-primary);
  text-decoration: none;
}
.sidebar-group {
  margin: 0 0 0.35rem;
  border-radius: var(--radius-sm);
}
.sidebar-group > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-group > summary::-webkit-details-marker { display: none; }
.sidebar-group > summary::after {
  content: '▾';
  font-size: 0.7rem;
  color: var(--muted);
}
.sidebar-group:not([open]) > summary::after { content: '▸'; }
.sidebar-group > summary:hover {
  background: rgba(17, 17, 17, 0.04);
}
.sidebar-group .sidebar-nav { margin-top: 0.1rem; padding-left: 0.15rem; }
.app-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 2.25rem;
}
.app-footer {
  text-align: center;
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
}
.app-footer p { margin: 0; }
body.has-sidebar .header-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
html[data-theme="dark"] .sidebar {
  background: rgba(24, 24, 27, 0.92);
  border-right-color: rgba(255,255,255,0.08);
}
html[data-theme="dark"] .sidebar-group > summary:hover {
  background: rgba(255,255,255,0.06);
}
@media (max-width: 960px) {
  body.has-sidebar .nav-toggle { display: inline-flex; }
  .app-body { width: 100%; }
  .sidebar {
    display: block;
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    z-index: 90;
    max-height: none;
    width: min(300px, 88vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s ease, visibility 0.22s ease;
    will-change: transform;
  }
  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .app-main { padding: 1rem 1rem 2rem; }
}


/* Horas — pestañas internas (menú lateral corto) */
.horas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.1rem;
  padding: 0.35rem;
  background: rgba(17, 17, 17, 0.04);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}
.horas-tabs a {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  text-decoration: none !important;
  font-weight: 650;
  font-size: 0.88rem;
  color: var(--muted);
}
.horas-tabs a:hover {
  color: var(--ink);
  background: rgba(255,255,255,0.7);
}
.horas-tabs a.is-active {
  background: var(--brand-primary);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.25);
}
html[data-theme="dark"] .horas-tabs {
  background: rgba(255,255,255,0.06);
}
html[data-theme="dark"] .horas-tabs a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}




/* Títulos de menú intercalados RTFM (color por título, tipografía intacta) */
.sidebar-group.rtfm-tone-a > summary {
  color: var(--brand-primary);
}
.sidebar-group.rtfm-tone-b > summary {
  color: var(--brand-accent);
}
html[data-theme="dark"] .sidebar-group.rtfm-tone-a > summary {
  color: #ff7a8a;
}
html[data-theme="dark"] .sidebar-group.rtfm-tone-b > summary {
  color: #ffffff;
}
html[data-theme="dark"] .sidebar-group.rtfm-tone-a > summary::after,
html[data-theme="dark"] .sidebar-group.rtfm-tone-b > summary::after {
  color: rgba(255,255,255,0.55);
}


/* Títulos de sección en página (mismo intercalado RTFM, tipografía intacta) */
.page-head h1,
.page-head h2 {
  color: var(--brand-primary);
}
.main .card > h2:first-child,
.app-main .card > h2:first-child {
  color: var(--brand-accent);
}
.main .card:nth-of-type(odd) > h2:first-child,
.app-main .card:nth-of-type(odd) > h2:first-child {
  color: var(--brand-primary);
}
.main .card:nth-of-type(even) > h2:first-child,
.app-main .card:nth-of-type(even) > h2:first-child {
  color: var(--brand-accent);
}
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .page-head h2,
html[data-theme="dark"] .main .card:nth-of-type(odd) > h2:first-child,
html[data-theme="dark"] .app-main .card:nth-of-type(odd) > h2:first-child {
  color: #ff7a8a;
}
html[data-theme="dark"] .main .card:nth-of-type(even) > h2:first-child,
html[data-theme="dark"] .app-main .card:nth-of-type(even) > h2:first-child {
  color: #ffffff;
}


/* ——— Dark mode site-wide (#11): cards/tables/forms/gantt/badges ——— */
html[data-theme="dark"] .badge {
  background: rgba(196, 30, 58, 0.28);
  color: #ffb3be;
}
html[data-theme="dark"] .badge-accent {
  background: rgba(251, 146, 60, 0.22);
  color: #fdba74;
}
html[data-theme="dark"] .badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}
html[data-theme="dark"] .badge-warn,
html[data-theme="dark"] .badge-warning {
  background: var(--warn-bg);
  color: var(--warn);
}
html[data-theme="dark"] .badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

html[data-theme="dark"] .empty {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}
html[data-theme="dark"] .wiki-body,
html[data-theme="dark"] .wiki-list a,
html[data-theme="dark"] .gantt-wrap {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}
html[data-theme="dark"] .wiki-list a:hover {
  border-color: var(--brand-primary);
}
html[data-theme="dark"] .progress-bar {
  background: #2a2f3a;
}
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] a.btn-secondary {
  background: #12151b;
  color: var(--ink);
  border-color: var(--border);
}
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] a.btn-secondary:hover {
  background: #1c212b;
}
html[data-theme="dark"] .form-card label,
html[data-theme="dark"] .card label {
  color: var(--muted);
}
html[data-theme="dark"] .table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
html[data-theme="dark"] .row-alert td {
  background: rgba(196, 30, 58, 0.12);
}
html[data-theme="dark"] .kpi-mini .label {
  color: var(--muted);
}
html[data-theme="dark"] .auth-card .logo-auth {
  background: #fff;
}

/* Gantt SVG text in dark theme */
html[data-theme="dark"] .gantt-label {
  fill: #e8eaed;
}
html[data-theme="dark"] .gantt-tick,
html[data-theme="dark"] .gantt-today,
html[data-theme="dark"] .gantt-section {
  fill: #9aa0a6;
}
html[data-theme="dark"] .gantt-section {
  fill: #ff7a8a;
}
html[data-theme="dark"] .gantt-today {
  fill: #ff7a8a;
}

/* Notifications (light touch) */
html[data-theme="dark"] .notif-list a:hover {
  background: rgba(196, 30, 58, 0.12);
}
html[data-theme="dark"] .notif-list strong {
  color: #ff7a8a;
}
html[data-theme="dark"] .notif-item.is-unread {
  background: rgba(196, 30, 58, 0.12);
}
html[data-theme="dark"] .notif-item.is-read {
  opacity: 0.72;
}

html[data-theme="dark"] .app-footer {
  background: #0a0c10;
  border-color: var(--border);
  color: var(--muted);
}



/* ——— #8 Mobile / responsive UX ——— */
.table-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.gantt-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  background: rgba(17, 17, 17, 0.45);
  z-index: 85;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.sidebar-backdrop.is-visible { display: block; }
body.sidebar-open { overflow: hidden; }

@media (max-width: 960px) {
  .header-end { gap: 0.4rem; }
  body.has-sidebar .header-end .user-chip-text { display: none; }
  .page-head { gap: 0.75rem; }
  .page-head .actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .page-head .actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filters select,
  .filters input {
    max-width: none;
    width: 100%;
  }
  .actions .btn,
  .table .btn,
  .btn-small {
    min-height: 40px;
    min-width: 40px;
  }
  /* Import Gantt / forms: usable on phone */
  #form-import-gantt .form-row,
  #importar-gantt .form-row {
    grid-template-columns: 1fr !important;
  }
  #form-import-gantt input[type="file"],
  #importar-gantt input[type="file"] {
    width: 100%;
    max-width: 100%;
  }
  .area-client .grid.cards,
  .area-client .grid.cards.cols-2,
  .area-client .grid.cards.cols-3,
  .area-client .grid.cards.cols-4,
  .area-partner .grid.cards,
  .area-partner .grid.cards.cols-2,
  .area-partner .grid.cards.cols-3,
  .area-partner .grid.cards.cols-4 {
    grid-template-columns: 1fr;
  }
  .monitor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-main { padding: 0.85rem 0.75rem 1.75rem; }
  .form-actions .btn { width: 100%; }
  .split-2 { grid-template-columns: 1fr; }
  .horas-tabs { width: 100%; border-radius: 14px; }
  .horas-tabs a { flex: 1 1 auto; text-align: center; }
}

/* Print / PDF: never force dark ink on paper */
@media print {
  html[data-theme="dark"],
  html[data-theme="dark"] body {
    --bg: #ffffff !important;
    --surface: #ffffff !important;
    --ink: #111111 !important;
    --muted: #555555 !important;
    --border: #dddddd !important;
    --shadow: none !important;
    --shadow-lg: none !important;
    background: #fff !important;
    color: #111 !important;
  }
  html[data-theme="dark"] .card,
  html[data-theme="dark"] .form-card,
  html[data-theme="dark"] .table-wrap,
  html[data-theme="dark"] .gantt-wrap,
  html[data-theme="dark"] .wiki-body,
  html[data-theme="dark"] .sidebar {
    background: #fff !important;
    color: #111 !important;
    border-color: #ddd !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] .gantt-label {
    fill: #111 !important;
  }
  html[data-theme="dark"] .gantt-tick,
  html[data-theme="dark"] .gantt-section,
  html[data-theme="dark"] .gantt-today {
    fill: #444 !important;
  }
  .site-header,
  .ux-toggle,
  #themeToggle,
  #densityToggle,
  .nav-toggle {
    display: none !important;
  }
  .sidebar,
  .sidebar-backdrop {
    display: none !important;
  }
  body.sidebar-open { overflow: visible !important; }
  .app-body { display: block !important; }
  .app-main { padding: 0 !important; width: 100% !important; }
}


/* Búsqueda tipada (#10) */
.search-type-chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(196, 30, 58, 0.12);
  color: #C41E3A;
  margin-right: 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}
.search-results a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.35rem;
}
.search-results a .search-type-chip { flex: 0 0 auto; }
.search-results a strong { flex: 1 1 auto; min-width: 8rem; }
.search-results a .muted { flex: 1 1 100%; margin-left: 0; padding-left: 0; }
html[data-theme="dark"] .search-type-chip {
  background: rgba(196, 30, 58, 0.25);
  color: #fca5a5;
}


/* ——— Gantt hub dropzone ——— */
.gantt-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 9rem;
  padding: 1.25rem 1rem;
  border: 2px dashed #C41E3A99;
  border-radius: 14px;
  background: #fff5f6;
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.gantt-dropzone:hover,
.gantt-dropzone.is-dragover {
  background: #ffecef;
  border-color: #C41E3A;
  box-shadow: 0 0 0 3px #C41E3A22;
}
.gantt-dropzone-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #C41E3A;
}
.gantt-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.gantt-dropzone-form .gantt-dropzone {
  position: relative;
}
.gantt-dropzone-file:not([hidden]) {
  margin-top: 0.35rem;
  font-weight: 600;
}
.gantt-hub-tabs a.is-active {
  /* inherits .horas-tabs */
}
html[data-theme="dark"] .gantt-dropzone {
  background: #3a1520;
  border-color: #C41E3Aaa;
}
html[data-theme="dark"] .gantt-dropzone:hover,
html[data-theme="dark"] .gantt-dropzone.is-dragover {
  background: #4a1a28;
}
.gantt-empty-state .btn { min-width: 14rem; }

/* ========== PMO Kanban profesional ========== */
.area-pmo .pmo-kanban-quickadd {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
}
.area-pmo .pmo-kanban-quickadd-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.area-pmo .pmo-kanban-quickadd-name { flex: 1 1 14rem; min-width: 0; }
.area-pmo .pmo-kanban-quickadd-name input {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.area-pmo .pmo-kanban-quickadd-assignee select {
  min-width: 10rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.area-pmo .pmo-kanban-grid,
.pmo-kanban--pro .pmo-kanban-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(220px, 1fr)) !important;
  gap: 0.85rem;
  align-items: stretch;
  min-height: 28rem;
  width: 100%;
  overflow-x: auto;
}
.area-pmo .pmo-kanban-col,
.pmo-kanban--pro .pmo-kanban-col {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px;
  min-height: 16rem;
  min-width: 220px;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}
.area-pmo .pmo-kanban-col-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.75rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.area-pmo .pmo-kanban-col-title {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}
.area-pmo .pmo-kanban-col-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  margin-top: 0.35rem;
  flex: 0 0 auto;
  background: #64748b;
}
.area-pmo .pmo-col-todo .pmo-kanban-col-dot { background: #64748b; }
.area-pmo .pmo-col-doing .pmo-kanban-col-dot { background: #C41E3A; }
.area-pmo .pmo-col-blocked .pmo-kanban-col-dot { background: #b45309; }
.area-pmo .pmo-col-done .pmo-kanban-col-dot { background: #15803d; }
.area-pmo .pmo-kanban-col-head h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.area-pmo .pmo-kanban-col-hint {
  margin: 0.1rem 0 0;
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.2;
}
.area-pmo .pmo-kanban-col-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}
.area-pmo .pmo-kanban-count {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}
.area-pmo .pmo-kanban-count.is-wip-over {
  background: #fef2f2;
  color: #C41E3A;
  outline: 1px solid #fecaca;
}
.area-pmo .pmo-kanban-wip { font-size: 0.65rem; }

.area-pmo .pmo-col-todo { border-top: 3px solid #64748b; }
.area-pmo .pmo-col-doing { border-top: 3px solid #C41E3A; }
.area-pmo .pmo-col-blocked { border-top: 3px solid #b45309; }
.area-pmo .pmo-col-done { border-top: 3px solid #15803d; }

.area-pmo .pmo-kanban-drop {
  padding: 0.55rem;
  min-height: 10rem;
  flex: 1;
  overflow-y: auto;
  max-height: min(70vh, 42rem);
}
.area-pmo .pmo-kanban-drop.is-over {
  outline: 2px dashed #C41E3A;
  outline-offset: -3px;
  background: #fff5f6;
}

.area-pmo .pmo-kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1.5rem 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: rgba(255,255,255,0.55);
  text-align: center;
  margin-bottom: 0.35rem;
}
.area-pmo .pmo-kanban-empty-icon {
  color: #cbd5e1;
  font-size: 1.1rem;
}
.area-pmo .pmo-kanban-empty p { margin: 0; }

.area-pmo .pmo-kanban-card,
.pmo-kanban--pro .pmo-kanban-card {
  position: relative;
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px;
  padding: 0.65rem 0.7rem 0.55rem 0.85rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.03);
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.area-pmo .pmo-kanban-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.area-pmo .pmo-kanban-card.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
  transform: rotate(1.5deg);
  user-select: none;
}
.area-pmo .pmo-kanban-card.is-dragging,
.area-pmo .pmo-kanban-card.is-dragging * {
  user-select: none;
}
.area-pmo .pmo-kanban-card[draggable="true"] { cursor: grab; }
.area-pmo .pmo-kanban-card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 10px 0 0 10px;
  background: #94a3b8;
}
.area-pmo .pmo-kanban-card--todo .pmo-kanban-card-accent { background: #64748b; }
.area-pmo .pmo-kanban-card--doing .pmo-kanban-card-accent { background: #C41E3A; }
.area-pmo .pmo-kanban-card--blocked .pmo-kanban-card-accent { background: #b45309; }
.area-pmo .pmo-kanban-card--done .pmo-kanban-card-accent { background: #15803d; }
.area-pmo .pmo-kanban-drag {
  position: absolute;
  right: 0.35rem;
  top: 0.35rem;
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}
.area-pmo .pmo-kanban-card-title {
  display: block;
  font-weight: 650;
  font-size: 0.88rem;
  color: #0f172a;
  text-decoration: none;
  margin: 0 1rem 0.45rem 0;
  line-height: 1.35;
}
.area-pmo .pmo-kanban-card-title:hover { color: #C41E3A; }
.area-pmo .pmo-kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #64748b;
}
.area-pmo .pmo-kanban-assignee-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}
.area-pmo .pmo-kanban-avatar {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #C41E3A, #9f1830);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}
.area-pmo .pmo-kanban-assignee-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}
.area-pmo .pmo-kanban-progress {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.72rem;
  color: #C41E3A;
  background: #fff5f6;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  line-height: 1.3;
}
.area-pmo .pmo-kanban-card--done .pmo-kanban-progress {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.area-pmo .pmo-kanban-card-dates {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.area-pmo .pmo-kanban-card-actions {
  margin-top: 0.45rem;
  opacity: 0.85;
}
.area-pmo .pmo-kanban-card:hover .pmo-kanban-card-actions { opacity: 1; }
.area-pmo .pmo-kanban-hint { margin: 0.85rem 0 0; }

.area-pmo .pmo-assignee-form { margin: 0; display: inline-block; max-width: 100%; min-width: 0; }
.area-pmo .pmo-assignee-select {
  font-size: 0.72rem;
  padding: 0.12rem 0.3rem;
  max-width: 9.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: inherit;
}
.area-pmo .pmo-kanban-card-meta .pmo-assignee-select { max-width: 100%; width: auto; }

@media (max-width: 1100px) {
  .area-pmo .pmo-kanban-grid,
  .pmo-kanban--pro .pmo-kanban-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)) !important; }
  .area-pmo .pmo-kanban-drop,
  .pmo-kanban--pro .pmo-kanban-drop { max-height: none; }
}
@media (max-width: 640px) {
  .area-pmo .pmo-kanban-grid,
  .pmo-kanban--pro .pmo-kanban-grid { grid-template-columns: minmax(260px, 1fr) !important; }
  .area-pmo .pmo-kanban-quickadd-row { flex-direction: column; align-items: stretch; }
  .area-pmo .pmo-kanban-quickadd-assignee select { width: 100%; }
}

html[data-theme="dark"] .area-pmo .pmo-kanban-col {
  background: #141416;
  border-color: #2a2a2e;
}
html[data-theme="dark"] .area-pmo .pmo-kanban-col-head,
html[data-theme="dark"] .area-pmo .pmo-kanban-card,
html[data-theme="dark"] .area-pmo .pmo-kanban-empty {
  background: #1a1a1d;
  border-color: #333;
}
html[data-theme="dark"] .area-pmo .pmo-kanban-col-head {
  background: rgba(26, 26, 29, 0.95);
}
html[data-theme="dark"] .area-pmo .pmo-kanban-card-title { color: #f1f5f9; }
html[data-theme="dark"] .area-pmo .pmo-kanban-drop.is-over {
  background: #3a1520;
}
html[data-theme="dark"] .area-pmo .pmo-kanban-quickadd-name input,
html[data-theme="dark"] .area-pmo .pmo-kanban-quickadd-assignee select,
html[data-theme="dark"] .area-pmo .pmo-assignee-select {
  background: #1f1f23;
  border-color: #3f3f46;
  color: #e4e4e7;
}
html[data-theme="dark"] .area-pmo .pmo-kanban-count {
  background: #333;
  color: #e2e8f0;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}


/* PMO project sticky subnav */
.pmo-subnav {
  position: sticky;
  top: var(--header-h, 60px);
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0 1rem;
  padding: 0.35rem 0.5rem;
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .pmo-subnav {
  background: rgba(24, 24, 27, 0.92);
}
.pmo-subnav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.pmo-subnav-list a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.pmo-subnav-list a:hover {
  background: rgba(196, 30, 58, 0.08);
  text-decoration: none;
}
.pmo-subnav-list a.is-active {
  background: var(--brand-primary);
  color: #fff;
}
.pmo-subnav-list a.is-active:hover { color: #fff; }

.flash-toast {
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.12);
  animation: flash-pop 0.45s ease-out;
  border-width: 2px;
  font-weight: 600;
}
@keyframes flash-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.progress-bar-lg { border-radius: 999px; }
.progress-bar-lg span { border-radius: 999px; }

.empty-state {
  text-align: left;
}
.empty-state .actions { justify-content: flex-start; }
