/* ==========================================================================
   SECPLAM · MÓDULO DE GESTIÓN (Fase 3) — prefijo .gx-
   ========================================================================== */

/* --- Semáforo --- */
.gx-sem { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); white-space: nowrap; cursor: help; }
.gx-sem-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.cp-card-top { flex-wrap: wrap; }
.cp-card-top .cp-year { margin-left: auto; }

/* --- Próxima acción en tarjetas --- */
.cp-next { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--border-color); font-size: 0.76rem; }
.cp-next svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; color: var(--primary-start); }
.cp-next strong { display: block; color: var(--text-main); font-weight: 700; line-height: 1.3; }
.cp-next span { color: var(--text-muted); font-weight: 600; }
.cp-next.is-soon { background: #fffbeb; border-color: #fde68a; }
.cp-next.is-soon svg { color: #ca8a04; }
.cp-next.is-over { background: #fef2f2; border-color: #fecaca; }
.cp-next.is-over svg, .cp-next.is-over span { color: #dc2626; }
.cp-next.is-none { align-items: center; color: var(--text-muted); font-weight: 600; border-style: dashed; }
.cp-next.is-none svg { color: #94a3b8; margin-top: 0; }
.cp-card-actions { display: flex; gap: 4px; border-top: 1px solid var(--border-color); padding-top: 8px; margin-top: 2px; }
.cp-card-actions button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: none; background: none; font-family: inherit; font-size: 0.72rem; font-weight: 600; color: var(--text-muted); padding: 6px 2px; border-radius: 6px; cursor: pointer; }
.cp-card-actions button:hover { background: #f1f5f9; color: var(--primary-start); }
.cp-card-actions svg { width: 14px; height: 14px; }
.cp-filter-rows { display: flex; flex-direction: column; gap: 8px; }
.cp-semchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-color); background: #fff; border-radius: 999px; padding: 5px 10px; font-family: inherit; font-size: 0.74rem; font-weight: 600; color: var(--text-main); cursor: pointer; }
.cp-semchip strong { color: var(--text-muted); font-weight: 800; }
.cp-semchip .cp-dot { background: var(--c); }
.cp-semchip.active { background: var(--c, var(--primary-start)); border-color: var(--c, var(--primary-start)); color: #fff; }
.cp-semchip.active strong { color: rgba(255, 255, 255, 0.85); }
.cp-semchip.active .cp-dot { background: #fff; }
.cp-semchip[data-sem="all"].active { background: var(--primary-start); border-color: var(--primary-start); }

/* --- Pestañas de la ficha única --- */
.gx-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-color); margin: 4px 0 18px; overflow-x: auto; scrollbar-width: thin; }
.gx-tab { display: inline-flex; align-items: center; gap: 7px; border: none; background: none; font-family: inherit; font-size: 0.84rem; font-weight: 600; color: var(--text-muted); padding: 11px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.gx-tab svg { width: 16px; height: 16px; }
.gx-tab em { font-style: normal; font-size: 0.68rem; font-weight: 800; background: #eef2f7; color: var(--text-muted); padding: 1px 7px; border-radius: 999px; }
.gx-tab em:empty { display: none; }
.gx-tab:hover { color: var(--text-main); }
.gx-tab.active { color: var(--primary-start); border-bottom-color: var(--primary-start); }
.gx-tab.active em { background: rgba(15, 76, 129, 0.1); color: var(--primary-start); }
.gx-tab:focus-visible { outline: 2px solid var(--primary-start); outline-offset: -2px; }
.gx-panel { display: none; flex-direction: column; gap: 16px; }
.gx-panel.active { display: flex; animation: gxIn 0.2s ease-out; }
@keyframes gxIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gx-panel.active { animation: none; } }
.gx-legacy { display: none !important; }
.gx-host { display: flex; flex-direction: column; gap: 16px; }
.gx-panel[data-gx-panel="hitos"] #project-tasks-card, .gx-panel[data-gx-panel="ficha"] #project-detail-header { margin: 0; }

/* --- Resumen --- */
.gx-sum-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; border-left: 5px solid var(--c); }
.gx-sum-sem { display: flex; align-items: center; gap: 12px; padding-right: 24px; border-right: 1px solid var(--border-color); }
.gx-sum-ico { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); }
.gx-sum-ico svg { width: 24px; height: 24px; }
.gx-sum-sem span:not(.gx-sum-ico) { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); display: block; }
.gx-sum-sem strong { font-size: 1.25rem; font-weight: 800; color: var(--c); }
.gx-sum-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
.gx-sum-dl dt, .gx-action-dl dt, .gx-mini-dl dt { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }
.gx-sum-dl dd, .gx-action-dl dd, .gx-mini-dl dd { font-size: 0.86rem; font-weight: 600; color: var(--text-main); word-break: break-word; }
.gx-sum-dl small, .gx-action-dl small { color: var(--text-muted); font-weight: 500; }
.gx-action { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--border-color); border-left: 5px solid var(--primary-start); border-radius: 12px; padding: 16px 20px; }
.gx-action .gx-lbl { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary-start); }
.gx-action > div > strong { display: block; font-size: 1.05rem; font-weight: 800; color: var(--text-main); margin: 2px 0 10px; }
.gx-action em { font-style: normal; font-size: 0.8rem; color: var(--text-muted); }
.gx-action-dl { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.gx-action.is-soon { border-left-color: #ca8a04; background: #fffdf5; }
.gx-action.is-over { border-left-color: #dc2626; background: #fffafa; }
.gx-action.is-over .gx-lbl { color: #dc2626; }
.gx-action-empty { border-left-color: #94a3b8; border-style: dashed; border-left-style: solid; }
.gx-action-empty .gx-lbl { color: var(--text-muted); }
.gx-action-empty strong { margin-bottom: 2px !important; }
.gx-st { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: var(--text-muted); }
.gx-st.st-pendiente { background: #fefce8; color: #a16207; }
.gx-st.st-en-proceso { background: #eff6ff; color: #1d4ed8; }
.gx-st.st-depende-de-tercero { background: #f5f3ff; color: #6d28d9; }
.gx-st.st-completada, .gx-st.st-realizada { background: #ecfdf5; color: #047857; }
.gx-st.st-vencida { background: #fef2f2; color: #dc2626; }
.gx-sum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gx-box { padding: 18px 20px !important; }
.gx-box h4 { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 700; color: var(--text-main); margin-bottom: 12px; }
.gx-box h4 svg { width: 16px; height: 16px; color: var(--primary-start); }
.gx-box h4.gx-sub { margin-top: 16px; }
.gx-box-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.gx-box-h h4 { margin: 0; }
.gx-muted { color: var(--text-muted); font-size: 0.84rem; }
.gx-muted.small, .gx-ok.small { font-size: 0.78rem; margin-top: 8px; }
.gx-ok { color: #047857; font-weight: 600; }
.gx-alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gx-alerts li { font-size: 0.82rem; line-height: 1.45; padding: 8px 10px 8px 12px; border-radius: 8px; background: #f8fafc; border-left: 3px solid #94a3b8; color: var(--text-main); }
.gx-alerts .lvl-critico { background: #fef2f2; border-color: #dc2626; }
.gx-alerts .lvl-riesgo { background: #fff7ed; border-color: #ea580c; }
.gx-alerts .lvl-atencion { background: #fefce8; border-color: #ca8a04; }
.gx-mini-dl { display: flex; flex-direction: column; gap: 8px; }
.gx-mini-dl div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.gx-doc-pct { display: flex; justify-content: space-between; align-items: baseline; }
.gx-doc-pct strong { font-size: 1.4rem; font-weight: 800; color: var(--text-main); }
.gx-doc-pct span { font-weight: 800; color: var(--primary-start); }
.gx-bar { height: 8px; background: #eef2f7; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.gx-bar.big { height: 10px; margin: 0 0 14px; }
.gx-bar div { height: 100%; background: var(--primary-start); border-radius: 4px; transition: width 0.4s ease; }
.gx-orgs { display: flex; flex-wrap: wrap; gap: 6px; }
.gx-orgs span { font-size: 0.74rem; font-weight: 700; padding: 3px 9px; border-radius: 6px; background: rgba(15, 76, 129, 0.07); color: var(--primary-start); }
.gx-obs { font-size: 0.8rem; color: var(--text-main); line-height: 1.45; margin-top: 6px; }
.gx-obs time { font-weight: 700; color: var(--text-muted); margin-right: 6px; }

/* --- Gestiones --- */
.gx-glist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.gx-glist li { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.gx-glist li:last-child { border-bottom: none; }
.gx-gtype { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; padding-top: 2px; }
.gx-glist li.is-acc .gx-gtype { color: var(--primary-start); }
.gx-glist strong { display: block; font-size: 0.86rem; color: var(--text-main); }
.gx-glist em { font-style: normal; font-size: 0.76rem; color: var(--text-muted); }
.gx-glist p { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* --- Documentos --- */
.gx-doc-badge { font-size: 0.76rem; font-weight: 800; color: var(--primary-start); background: rgba(15, 76, 129, 0.07); padding: 3px 10px; border-radius: 999px; }
.gx-chk { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.gx-chk li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--border-color); }
.gx-chk li:last-child { border-bottom: none; }
.gx-chk label { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; color: var(--text-main); cursor: pointer; }
.gx-chk input { width: 18px; height: 18px; accent-color: var(--primary-start); cursor: pointer; }
.gx-chk li.done label span { color: var(--text-muted); }
.gx-chk small { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.gx-chk li:not(.done) small { color: #b45309; font-weight: 600; }
.gx-opt { font-style: normal; font-size: 0.68rem; font-weight: 700; color: var(--text-muted); background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.gx-docs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gx-docs li { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; }
.gx-docs svg { width: 15px; height: 15px; color: var(--text-muted); }
.gx-docs small { margin-left: auto; color: var(--text-muted); font-size: 0.74rem; }
.gx-note { display: flex; gap: 8px; align-items: flex-start; font-size: 0.78rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; margin-top: 12px; line-height: 1.45; }
.gx-note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

/* --- Historial --- */
.gx-tl { display: flex; flex-direction: column; gap: 14px; }
.gx-tl-day > time { display: inline-block; font-size: 0.74rem; font-weight: 800; color: var(--primary-start); background: rgba(15, 76, 129, 0.07); padding: 3px 10px; border-radius: 6px; margin-bottom: 8px; }
.gx-tl-day ol { list-style: none; padding: 0 0 0 14px; margin: 0; border-left: 2px solid var(--border-color); display: flex; flex-direction: column; gap: 10px; }
.gx-tl-day li { display: flex; gap: 10px; align-items: flex-start; margin-left: -26px; }
.gx-tl-ico { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--c); color: var(--c); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gx-tl-ico svg { width: 12px; height: 12px; }
.gx-tl-day p { font-size: 0.84rem; color: var(--text-main); line-height: 1.45; }
.gx-tl-day em { font-style: normal; font-size: 0.72rem; color: var(--text-muted); }
.gx-tl-stage { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; }
.gx-tl-stage span { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: var(--text-muted); }
.gx-tl-stage span.new { background: rgba(15, 76, 129, 0.1); color: var(--primary-start); }
.gx-tl-stage svg { width: 12px; height: 12px; color: var(--text-muted); }

/* --- Modal de gestión --- */
.gx-modal-card { width: min(760px, 100%); }
.gx-current { background: #f8fafc; border: 1px solid var(--border-color); border-left: 4px solid var(--primary-start); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 2px; }
.gx-current span { font-size: 0.7rem; font-weight: 800; color: var(--primary-start); text-transform: uppercase; }
.gx-current strong { font-size: 0.9rem; color: var(--text-main); }
.gx-current em { font-style: normal; font-size: 0.76rem; color: var(--text-muted); }
.cp-form-sec small { font-weight: 500; color: var(--text-muted); }
.gx-check { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 600; color: var(--text-main); cursor: pointer; }
.gx-check input { width: 17px; height: 17px; accent-color: var(--primary-start); }

/* --- Administración --- */
.gx-admin { margin-top: 24px; padding: 20px 22px !important; }
.gx-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.gx-admin-chk { margin-top: 18px; border-top: 1px solid var(--border-color); padding-top: 14px; }
.gx-admin-chk summary { cursor: pointer; font-size: 0.86rem; font-weight: 700; color: var(--text-main); margin-bottom: 12px; }
.gx-admin-chk summary small { font-weight: 500; color: var(--text-muted); }
.gx-admin-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --- Responsivo --- */
@media (max-width: 1100px) {
  .gx-sum-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gx-admin-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .gx-sum-head { grid-template-columns: 1fr; }
  .gx-sum-sem { border-right: none; padding-right: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }
  .gx-sum-grid, .gx-admin-grid { grid-template-columns: 1fr; }
  .gx-action { flex-direction: column; align-items: stretch; }
  .gx-glist li { grid-template-columns: 1fr; gap: 4px; }
  .gx-mini-dl div { grid-template-columns: 1fr; gap: 0; }
  .gx-tab span { display: none; }
  .gx-tab.active span { display: inline; }
  .cp-card-actions span { display: none; }
}
@media print { .gx-tabs, .cp-card-actions { display: none !important; } }

.gx-link { border: none; background: none; padding: 0 0 0 6px; font-family: inherit; font-size: 0.74rem; font-weight: 700; color: var(--primary-start); text-decoration: underline; cursor: pointer; }

/* --- Cartera por etapa (reclasificación administrativa) --- */
.gx-recl-actual { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); background: color-mix(in srgb, var(--c) 6%, #fff); margin-bottom: 12px; }
.gx-recl-ico { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 75%, #000); flex-shrink: 0; }
.gx-recl-ico svg { width: 22px; height: 22px; }
.gx-recl-actual span:not(.gx-recl-ico) { display: block; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.gx-recl-actual strong { font-size: 1.1rem; font-weight: 800; color: color-mix(in srgb, var(--c) 70%, #000); }
.gx-recl-actual em { display: block; font-style: normal; font-size: 0.78rem; color: var(--text-muted); }
.gx-recl-help { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }
.gx-recl-help strong { color: var(--text-main); }
.gx-recl-ind { background: #f8fafc; border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.gx-recl-ind > span { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.gx-recl-ind ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.gx-recl-ind li { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-main); }
.gx-recl-ind li i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gx-recl-ind li em { font-style: normal; font-weight: 700; color: var(--text-muted); }
.gx-recl-sug { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.78rem; color: #92400e; background: #fffbeb; border-radius: 8px; padding: 6px 10px; }
.gx-recl-sug svg { width: 15px; height: 15px; flex-shrink: 0; }
.gx-recl-opts { border: none; padding: 0; margin: 0; min-width: 0; }
.gx-recl-opts legend { font-size: 0.8rem; font-weight: 800; color: var(--text-main); margin-bottom: 8px; padding: 0; }
.gx-recl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.gx-recl-opt[data-recl-et="compromiso"] { border-style: dashed; }
.gx-recl-opt[data-recl-et="compromiso"].sel { border-style: solid; }
.gx-recl-opt[data-recl-et="historicos"] { border-style: dashed; }
.gx-recl-opt[data-recl-et="historicos"].sel { border-style: solid; }
.gx-recl-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border: 2px solid var(--border-color); background: #fff; border-radius: 12px; font-family: inherit; cursor: pointer; text-align: center; transition: border-color 0.15s, background 0.15s; }
.gx-recl-opt svg { width: 22px; height: 22px; color: var(--c); }
.gx-recl-opt strong { font-size: 0.8rem; color: var(--text-main); line-height: 1.2; }
.gx-recl-opt small { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }
.gx-recl-opt:hover { border-color: color-mix(in srgb, var(--c) 50%, #fff); }
.gx-recl-opt.act { background: #f8fafc; }
.gx-recl-opt.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, #fff); }
.gx-recl-comp { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; border: 1px dashed var(--border-color); background: #fff; border-radius: 8px; padding: 6px 10px; font-family: inherit; font-size: 0.76rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.gx-recl-comp svg { width: 14px; height: 14px; }
.gx-recl-comp.sel { border-style: solid; border-color: #ca8a04; color: #854d0e; background: #fefce8; }
.gx-recl-sub, .gx-recl-mot { margin-top: 12px; }
.gx-recl-sub { max-width: 320px; }
.gx-recl-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.gx-recl-res { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.gx-recl-res span { font-weight: 800; padding: 3px 10px; border-radius: 999px; color: color-mix(in srgb, var(--c) 70%, #000); background: color-mix(in srgb, var(--c) 10%, #fff); }
.gx-recl-res svg { width: 16px; height: 16px; }
.gx-recl-foot .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.gx-recl-prev { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.gx-recl-prev li { display: grid; grid-template-columns: 140px 1fr; gap: 2px 12px; font-size: 0.8rem; }
.gx-recl-prev time { color: var(--text-muted); font-weight: 700; grid-row: span 2; }
.gx-recl-prev span { font-weight: 700; color: var(--text-main); }
.gx-recl-prev em { font-style: normal; color: var(--text-muted); font-size: 0.76rem; }
.fl-recl-note { font-size: 0.72rem !important; font-weight: 700; color: #0e7490 !important; background: rgba(14, 116, 144, 0.08); padding: 2px 8px; border-radius: 6px; flex: 0 1 auto !important; }
@media (max-width: 1100px) { .gx-recl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .gx-recl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gx-recl-prev li { grid-template-columns: 1fr; } }
