/* H&V Factoring · Dashboard ejecutivo y pantallas de módulo */

/* Hero del dashboard */
.dash-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 22px 24px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(70% 120% at 100% 0%, rgba(141, 183, 196, 0.20), transparent 60%),
    radial-gradient(50% 90% at 0% 100%, rgba(176, 138, 62, 0.10), transparent 60%),
    linear-gradient(135deg, #111B1E 0%, #1C292E 60%, #26343A 100%);
  color: #fff;
  box-shadow: var(--sh-2);
}
.dash-hero::after {
  /* retícula de puntos inspirada en la esfera del logotipo H&V */
  content: ""; position: absolute; right: -40px; top: -60px; width: 360px; height: 360px; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.2px, transparent 1.4px);
  background-size: 14px 14px;
  -webkit-mask-image: radial-gradient(circle at 60% 40%, #000 0%, transparent 62%);
  mask-image: radial-gradient(circle at 60% 40%, #000 0%, transparent 62%);
  opacity: 0.9;
}
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero .label { color: rgba(255, 255, 255, 0.6); }
.dash-hero h1 { font-family: var(--ff-display); font-weight: 600; font-size: 36px; line-height: 1.04; margin-top: 6px; }
.dash-hero p { color: rgba(255, 255, 255, 0.7); margin-top: 6px; font-size: 13.5px; }
.dash-hero .hero-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.dash-hero .hero-stat b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.dash-hero .hero-stat span { font-size: 11.5px; color: rgba(255, 255, 255, 0.62); }
.dash-hero .seg { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.08); }
.dash-hero .seg button { color: rgba(255, 255, 255, 0.62); }
.dash-hero .seg button:hover { color: #fff; }
.dash-hero .seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.95); color: #111B1E; }
.dash-hero .btn { --_bg: rgba(255, 255, 255, 0.06); --_fg: #fff; --_bd: rgba(255, 255, 255, 0.14); }
.dash-hero .btn:hover { --_bg: rgba(255, 255, 255, 0.12); }

/* Barra de filtros globales */
.filterbar {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 20;
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)) auto; gap: 8px; align-items: end;
  padding: 12px 14px; margin-bottom: 18px;
  background: color-mix(in srgb, var(--c-panel) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.filterbar .field > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-3); }
.filterbar .actions { display: flex; gap: 6px; align-items: center; }
.filter-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -8px 0 16px; font-size: 12px; color: var(--c-text-3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px;
  border-radius: var(--r-pill); background: var(--c-accent-soft); color: var(--c-text);
  font-size: 12px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--c-accent-strong) 20%, transparent);
}
.chip button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: none; color: var(--c-text-3); padding: 0; }
.chip button:hover { background: var(--c-panel); color: var(--c-text); }
.chip .ico { width: 12px; height: 12px; }

.filters-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 14px; border-radius: var(--r-md);
  background: var(--c-accent-soft); font-size: 12.5px;
}

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-group-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.kpi-group-label::after { content: ""; flex: 1; height: 1px; background: var(--c-line); }

/* Tarjetas de gráficos */
.chart-card { display: flex; flex-direction: column; }
.chart-card .chart { width: 100%; height: 320px; }
.chart-card .chart.h-260 { height: 260px; }
.chart-card .chart.h-280 { height: 280px; }
.chart-card .chart.h-360 { height: 360px; }
.chart-card .card-body { flex: 1; display: flex; flex-direction: column; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--c-text-2); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-legend .sw.line { height: 2px; border-radius: 1px; }
.chart-legend .sw.dash { height: 0; border-top: 2px dashed currentColor; background: none !important; width: 14px; }
.chart-note { font-size: 11.5px; color: var(--c-text-3); margin-top: 8px; line-height: 1.45; }

/* Composición: donut + leyenda */
.donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.donut-legend { display: flex; flex-direction: column; gap: 2px; }
.donut-legend button {
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px;
  width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 12.5px;
}
.donut-legend button:hover, .donut-legend button.is-active { background: var(--c-hover); }
.donut-legend button.is-active { box-shadow: inset 0 0 0 1px var(--c-line-strong); }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-legend .p { color: var(--c-text-3); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* Alertas */
.alert-list { display: flex; flex-direction: column; }
.alert-row {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 6px; border-bottom: 1px solid var(--c-line-soft); border-radius: 8px;
  text-align: left; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0;
}
.alert-row:last-child { border-bottom: 0; }
.alert-row:hover { background: var(--c-hover); }
.alert-row .a-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--c-sunken); color: var(--c-text-2); }
.alert-row .a-ico .ico { width: 16px; height: 16px; }
.alert-row.sev-high .a-ico { background: var(--c-neg-soft); color: var(--c-neg); }
.alert-row.sev-med .a-ico { background: var(--c-warn-soft); color: var(--c-warn); }
.alert-row.sev-low .a-ico { background: var(--c-info-soft); color: var(--c-info); }
.alert-row .a-title { font-size: 13px; font-weight: 700; }
.alert-row .a-sub { font-size: 12px; color: var(--c-text-3); margin-top: 1px; }
.alert-row .a-count { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.alert-row.is-zero { opacity: 0.55; }

/* Feed */
.feed { max-height: 448px; overflow-y: auto; padding-right: 4px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--c-pos); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse-dot 1.8s ease-in-out infinite; }
.live-dot.is-paused { color: var(--c-text-3); }
.live-dot.is-paused::before { animation: none; }

/* Pantalla planificada */
.plan-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.plan-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.plan-list li { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 9px; background: var(--c-panel-2); border: 1px solid var(--c-line-soft); font-size: 13px; }
.plan-list li .ico { width: 15px; height: 15px; margin-top: 2px; color: var(--c-accent-strong); }
.wire { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); }
.wire .skel { height: 64px; }
.wire .skel.w2 { grid-column: span 2; height: 150px; }
.wire .skel.w4 { grid-column: span 4; height: 110px; }
.wire-caption { font-size: 11.5px; color: var(--c-text-3); margin-top: 10px; display: flex; align-items: center; gap: 6px; }

/* Líneas bancarias */
.ring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.ring-card { display: flex; align-items: center; gap: 16px; padding: 16px; }
.ring-card h4 { font-size: 13.5px; }
.ring-card .muted { font-size: 12px; }

/* Ficha */
.profile-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.profile-kpis .pk { padding: 12px 14px; border-radius: var(--r-md); background: var(--c-panel); border: 1px solid var(--c-line); }
.profile-kpis .pk span { font-size: 11.5px; color: var(--c-text-3); font-weight: 600; }
.profile-kpis .pk b { display: block; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.drawer-section { margin-top: 18px; }
.drawer-section > h3 { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-3); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

/* Catálogo de componentes */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.catalog-grid .card-body { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch { display: flex; flex-direction: column; gap: 4px; width: 92px; font-size: 11px; }
.swatch i { height: 44px; border-radius: 8px; border: 1px solid var(--c-line); }

/* Banner de alcance del perfil demo */
.scope-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--c-info-soft); border: 1px solid color-mix(in srgb, var(--c-info) 22%, transparent); font-size: 13px; }
.scope-banner > .ico { color: var(--c-info); }
.scope-banner > span { flex: 1; min-width: 240px; }
.filterbar .select:disabled { opacity: 0.8; cursor: not-allowed; }
