/* Fork · components.css — componentes compartidos. CERO hex: solo var(--…). */

/* ---------- Shell: topbar + subtabs ---------- */
.f-topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); }
.f-topbar__in { max-width: var(--content-max); margin: 0 auto; padding: 0 36px; height: var(--topbar-h);
  display: flex; align-items: center; gap: 36px; }
.f-topbar__logo { height: 56px; width: auto; margin: -8px -6px; }
.f-topbar__logo--dark { display: none; }
[data-theme="dark"] .f-topbar__logo--light { display: none; }
[data-theme="dark"] .f-topbar__logo--dark { display: block; }
.f-nav { display: flex; gap: 26px; align-self: stretch; }
.f-nav a { display: flex; align-items: center; font-size: 14px; font-weight: var(--fw-medium); color: var(--text-muted);
  text-decoration: none; box-shadow: none; min-height: var(--touch-min); }
.f-nav a:hover { color: var(--text); }
.f-nav a[aria-current="page"] { color: var(--text); font-weight: var(--fw-bold); box-shadow: inset 0 -2px 0 var(--fork-blue); }
.f-topbar__end { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.f-menu-btn { display: none; }
.f-nav { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; }
.f-nav a { flex-shrink: 0; white-space: nowrap; }
.f-topbar__end { flex-shrink: 0; }
.f-usermenu { position: relative; }
.f-usermenu > summary { list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: var(--text); color: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.f-usermenu > summary::-webkit-details-marker { display: none; }
.f-usermenu__pop { position: absolute; right: 0; top: 46px; width: 260px; z-index: 60; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.f-usermenu__who { font-size: var(--fs-sm); color: var(--text-muted); padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.f-usermenu__cap { font-size: 11px; letter-spacing: var(--tracking-cap); text-transform: uppercase; font-weight: var(--fw-bold); color: var(--text-muted); }
.f-usermenu__pop a { font-size: 13px; color: var(--text); text-decoration: none; padding: 8px 2px; }
.f-seg--full { display: grid; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1080px) { .f-nav { gap: 18px; } .f-nav a { font-size: 13.5px; } }

.f-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.f-subtabs a { padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  font-size: 13px; font-weight: var(--fw-semi); color: var(--text); text-decoration: none; }
.f-subtabs a[aria-current="page"] { background: var(--text); color: var(--surface); border-color: var(--text); }

.f-main { max-width: var(--content-max); margin: 0 auto; padding: 30px 36px 64px; }
.f-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.f-pagehead__cap { font-size: var(--fs-cap); letter-spacing: .1em; text-transform: uppercase; font-weight: var(--fw-bold); color: var(--text-muted); }
.f-pagehead h1 { margin: 8px 0 0; font-size: var(--fs-h1); font-weight: var(--fw-strong); letter-spacing: var(--tracking-h1); line-height: 1.05; color: var(--text); }
.f-pagehead__sub { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.f-pagehead__tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Controles ---------- */
.f-seg { display: inline-flex; gap: 2px; background: var(--seg); padding: 3px; border-radius: var(--radius-sm); }
.f-seg button, .f-seg a { border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm);
  font-weight: var(--fw-semi); padding: 7px 11px; border-radius: 7px; cursor: pointer; text-decoration: none; }
.f-seg [aria-pressed="true"], .f-seg [aria-current="page"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.f-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 8px 14px; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; font-weight: var(--fw-semi); cursor: pointer; text-decoration: none;
  background: var(--fork-blue); color: var(--text-on-invert); border: 0; }
[data-theme="light"] .f-btn, :root:not([data-theme="dark"]) .f-btn { color: #fff; }
.f-btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--text); }
.f-btn--quiet { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.f-btn:focus-visible, .f-seg button:focus-visible, .f-nav a:focus-visible, .f-subtabs a:focus-visible {
  outline: 2px solid var(--fork-blue); outline-offset: 2px; }

.f-pill { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: var(--fw-bold);
  background: var(--seg); color: var(--text); }
.f-pill--ok   { background: var(--ok-bg);   color: var(--ok); }
.f-pill--warn { background: var(--warn-bg); color: var(--warn); }
.f-pill--err  { background: var(--err-bg);  color: var(--err); }
.f-pill--info { background: var(--info-bg); color: var(--fork-blue); }

/* ---------- Tarjetas y KPIs ---------- */
.f-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.f-card h2 { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-strong); color: var(--text); }
.f-card__sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 4px; }
.f-card--invert { background: var(--surface-invert); color: var(--text-on-invert); }

.f-kpis { display: flex; flex-wrap: wrap; gap: 18px; }
.f-kpis__pair { flex: 1 1 420px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.f-kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.f-kpi__lbl { font-size: var(--fs-cap); letter-spacing: var(--tracking-cap); text-transform: uppercase; font-weight: var(--fw-bold); color: var(--text-muted); }
.f-kpi__val { font-size: var(--fs-kpi); font-weight: var(--fw-strong); letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.f-kpi__bar { height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; }
.f-kpi__bar > i { display: block; height: 100%; background: var(--chart-1); }
.f-kpi__delta { font-size: var(--fs-sm); display: flex; gap: 8px; flex-wrap: wrap; }
.f-kpi__delta b.up { color: var(--ok); } .f-kpi__delta b.down { color: var(--err); }
.f-kpi__delta span { color: var(--text-muted); }

/* ---------- Barras HTML (rankings, POA) ---------- */
.f-bar { position: relative; height: 10px; background: var(--track); border-radius: var(--radius-pill); }
.f-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--chart-1); border-radius: var(--radius-pill); }
.f-bar > s { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--chart-poa); text-decoration: none; }

/* ---------- Tablas ---------- */
.f-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.f-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: var(--fw-bold);
  color: var(--text-muted); padding: 0 10px 8px; border-bottom: 1px solid var(--border); }
.f-table td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.f-table tr[aria-selected="true"] td { background: var(--select); }
.f-table tbody tr:hover td { background: var(--select); }
.f-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Mensajes ---------- */
.f-msg { border-radius: 10px; padding: 10px 14px; font-size: 13px; border: 1px solid transparent; }
.f-msg--ok   { background: var(--ok-bg);   border-color: var(--ok-border);   color: var(--ok); }
.f-msg--warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.f-msg--err  { background: var(--err-bg);  border-color: var(--err-border);  color: var(--err); }

/* ---------- Tooltip de gráficos ---------- */
.f-tip { background: var(--surface-invert); color: var(--text-on-invert); padding: 12px 14px; border-radius: var(--radius);
  box-shadow: var(--shadow-pop); font-size: var(--fs-sm); }

/* ---------- Móvil ---------- */
@media (max-width: 920px) {
  .f-topbar__in { padding: 0 16px; gap: 12px; }
  .f-nav { display: none; }
  .f-menu-btn { display: inline-flex; min-height: var(--touch-min); align-items: center; padding: 0 14px; border-radius: var(--radius-sm);
    background: var(--seg); color: var(--text); border: 0; font: inherit; font-weight: var(--fw-semi); }
  .f-topbar.is-open .f-nav { display: flex; flex-direction: column; position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--surface);
    padding: 12px 16px; gap: 0; overflow-y: auto; }
  .f-topbar.is-open .f-nav a { padding: 0 8px; border-bottom: 1px solid var(--border); box-shadow: none; }
  .f-subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .f-main { padding: 18px 14px 48px; }
  .f-pagehead__tools { margin-left: 0; }
}

@media print {
  .f-topbar, .f-subtabs, .f-pagehead__tools, [data-noprint] { display: none !important; }
  body { background: #fff; }
  .f-card, .f-kpi { box-shadow: none; border: 1px solid var(--border); break-inside: avoid; }
}

/* =====================================================================
   Extensiones del REPO sobre el kit (antes en static/fork-nav.css, ya
   borrado). Solo tokens. Ver docs/redesign/PLAN.md § «Qué se conservó».
   ===================================================================== */
.shell { min-height: 100vh; background: var(--surface-sunken); font-family: var(--font-ui); font-size: var(--fs-base); color: var(--text); }
.shell-main > .app { padding: 0; max-width: none; }
.fk-skip { position: absolute; left: -999px; top: 8px; z-index: 300; background: var(--text); color: var(--text-on-invert);
  padding: 10px 14px; border-radius: var(--radius-sm); }
.fk-skip:focus { left: 12px; }
.f-topbar__in > a:first-child { display: flex; align-items: center; flex-shrink: 0; }

/* Derecha de la barra: área, campana con badge */
.fk-org { font-size: 13px; font-weight: var(--fw-medium); color: var(--text-muted); white-space: nowrap; }
.fk-bell { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch-min); height: var(--touch-min); border-radius: var(--radius-pill); color: var(--text); text-decoration: none; }
.fk-bell:hover { background: var(--seg); }
.fk-bell svg { width: 20px; height: 20px; }
.fk-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--fork-red); color: var(--text-on-invert); font-size: 11px; font-weight: var(--fw-bold); line-height: 18px;
  text-align: center; font-variant-numeric: tabular-nums; }
[data-theme="light"] .fk-badge, :root:not([data-theme="dark"]) .fk-badge { color: #fff; }
.f-usermenu > summary:focus-visible, .fk-bell:focus-visible, .f-menu-btn:focus-visible, .fk-links a:focus-visible {
  outline: 2px solid var(--fork-blue); outline-offset: 2px; }

/* Sub-tabs: enlace a hub y rutas secundarias del módulo activo */
.fk-subbar { padding-top: 18px; padding-bottom: 0; }
.fk-subbar .f-subtabs { margin-bottom: 0; }
.f-subtabs .fk-vista { margin-left: auto; border-style: dashed; }
.fk-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.fk-links a { font-size: var(--fs-sm); color: var(--text-muted); text-decoration: none; }
.fk-links a:hover { text-decoration: underline; }
.fk-links a.on { color: var(--text); font-weight: var(--fw-bold); }

/* Hoja móvil: todas las rutas del rol (reemplaza el desplegable .is-open del kit) */
.fk-sheet { position: fixed; inset: 0 auto 0 0; width: min(340px, 90vw); height: 100dvh; z-index: 400; background: var(--surface);
  box-shadow: var(--shadow-pop); overflow-y: auto; padding: 12px 0 24px; display: flex; flex-direction: column; }
.fk-sheet[hidden] { display: none; }
.fk-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 8px; }
.fk-sheet-head b, .fk-sheet .fk-sec { font-size: 12px; letter-spacing: var(--tracking-cap); text-transform: uppercase; color: var(--text-muted); font-weight: var(--fw-bold); }
.fk-sheet-head button { min-height: var(--touch-min); padding: 0 12px; border: 0; background: transparent; color: var(--text);
  font: inherit; font-weight: var(--fw-semi); cursor: pointer; }
.fk-sheet .fk-sec { margin: 0; padding: 16px 16px 6px; }
.fk-sheet nav a, .fk-sheet-foot a { display: flex; align-items: center; min-height: var(--touch-min); padding: 0 16px;
  color: var(--text); text-decoration: none; font-size: 14px; }
.fk-sheet nav a.on { font-weight: var(--fw-bold); box-shadow: inset 3px 0 0 var(--fork-blue); background: var(--info-bg); }
.fk-sheet nav a:hover { background: var(--seg); }
.fk-sheet a:focus-visible, .fk-sheet button:focus-visible { outline: 2px solid var(--fork-blue); outline-offset: -2px; }
.fk-sheet-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.fk-backdrop { position: fixed; inset: 0; z-index: 350; width: 100%; height: 100%; border: 0; background: rgba(13,19,33,.5); }
.fk-backdrop[hidden] { display: none; }
body.fk-open { overflow: hidden; }

@media (min-width: 921px) { .fk-sheet, .fk-backdrop { display: none !important; } }
@media (max-width: 920px) {
  .fk-org, .fk-links { display: none; }
  .f-usermenu > summary { width: var(--touch-min); height: var(--touch-min); }
  .f-subtabs a { min-height: var(--touch-min); display: inline-flex; align-items: center; white-space: nowrap; }
  .f-subtabs::-webkit-scrollbar { display: none; }
  .fk-subbar { padding: 12px 14px 0; }
  .shell-main table { display: block; overflow-x: auto; }
}
@media print { .fk-skip, .fk-sheet, .fk-backdrop, .fk-subbar { display: none !important; } .shell-main { padding: 0; } }
