/* ==========================================================================
 * 08-cartera.css · parte 8/11 — Cartera: charts, dashboard, dividendos y herramientas de gráfico
 * Orden de carga obligatorio (reproduce la cascada del styles.css original).
 * No reordenar los <link> ni mover reglas entre partes sin revisar la cascada.
 * ========================================================================== */


.pf-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pf-summary-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.pf-summary-card span { display: block; color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pf-summary-card strong { display: block; margin-top: 5px; font-size: 17px; font-variant-numeric: tabular-nums; }
.pf-summary-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.pf-summary-card strong.positive { color: var(--green); }
.pf-summary-card strong.negative { color: var(--red); }

.pf-panel {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.pf-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.pf-panel-head h4 { margin: 0; font-size: 14px; }
.pf-panel-head h5 { margin: 0; font-size: 12.5px; }
.pf-panel-head .secondary-button { padding: 5px 11px; font-size: 11.5px; }
.pf-sub-head { margin-top: 16px; }

.pf-hint { margin: 8px 2px 0; color: var(--muted); font-size: 11px; }

.pf-table-wrap { overflow-x: auto; }
.pf-positions-table { width: 100%; min-width: 1180px; border-collapse: collapse; }
.pf-positions-table th {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-mid);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.pf-positions-table th:first-child { text-align: left; }
.pf-positions-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-strong);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.pf-positions-table td:first-child { text-align: left; }
.pf-positions-table td.positive { color: var(--green); font-weight: 700; }
.pf-positions-table td.negative { color: var(--red); font-weight: 700; }
.pf-positions-table tbody tr[data-ticker] { cursor: pointer; }
.pf-positions-table tbody tr[data-ticker]:hover td { background: var(--accent-faint); }
.pf-positions-table tbody tr[data-ticker]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pf-positions-table .pf-totals-row td {
  background: var(--surface-2);
  border-top: 2px solid var(--line-mid);
  font-weight: 700;
  color: var(--ink);
}
.pf-company-cell strong { display: block; color: var(--ink); font-size: 12px; }
.pf-company-sub { display: block; color: var(--muted); font-size: 10.5px; }

.pf-transactions-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.pf-transactions-table th {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-mid);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.pf-transactions-table th:first-child, .pf-transactions-table th:nth-child(2), .pf-transactions-table th:nth-child(3) { text-align: left; }
.pf-transactions-table td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-strong);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.pf-transactions-table td:first-child, .pf-transactions-table td:nth-child(2), .pf-transactions-table td:nth-child(3) { text-align: left; }
.pf-transactions-table td.positive { color: var(--green); font-weight: 700; }
.pf-transactions-table td.negative { color: var(--red); font-weight: 700; }

.pf-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
.pf-type-badge.buy { background: var(--green-bg); color: var(--green); }
.pf-type-badge.sell { background: var(--red-bg); color: var(--red); }

.pf-delete-tx {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--red);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.pf-delete-tx:hover { background: var(--red-bg); border-color: var(--red); }

.pf-donuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.pf-donut-block h5 { margin: 0 0 10px; font-size: 12.5px; }
.pf-donut-wrap { display: flex; align-items: center; gap: 16px; }
.pf-donut { width: 130px; height: 130px; flex: 0 0 130px; }
.pf-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.pf-legend-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  font-size: 11.5px;
  color: var(--muted-strong);
}
.pf-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; align-self: center; }
.pf-legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-legend-pct { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-legend-value { color: var(--muted); font-variant-numeric: tabular-nums; }

.pf-form { display: flex; flex-direction: column; gap: 8px; }
.pf-form-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.pf-field { display: flex; flex-direction: column; gap: 4px; }
.pf-field > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pf-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface);
}
.pf-input:focus { border-color: var(--accent); outline: none; }
.pf-ticker-wrap { position: relative; }
.pf-ticker-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  overflow: hidden;
}
.pf-ticker-result {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: var(--surface);
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}
.pf-ticker-result:hover { background: var(--accent-faint); }
.pf-ticker-result span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pf-ticker-result strong { color: var(--accent); flex: 0 0 auto; }
.pf-ticker-empty { padding: 9px 10px; color: var(--muted); font-size: 11.5px; }
.pf-form-note { margin: 0; color: var(--red); font-size: 11.5px; }
.pf-form-note.hidden, .hidden { display: none; }
.pf-submit { align-self: end; white-space: nowrap; }
.pf-form-block { margin-bottom: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 7px; background: var(--surface-2); }

.pf-empty-state { padding: 26px 16px; text-align: center; }
.pf-empty-state p { margin: 0 auto 14px; max-width: 480px; color: var(--muted); font-size: 12.5px; }

.pf-history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, .6);
}
.pf-history-backdrop[hidden] { display: none; }
.pf-history-modal {
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: min(86vh, 720px);
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 22px 55px rgba(0, 0, 0, .35);
}
.pf-history-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.pf-history-head h4 { margin: 0; font-size: 15px; flex: 0 0 auto; }
.pf-history-count { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; text-align: right; }
.pf-history-close {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.pf-history-close:hover { color: var(--ink); border-color: var(--muted-2); }
.pf-history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.pf-history-filter { display: flex; flex-direction: column; gap: 3px; }
.pf-history-filter > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pf-history-filter select, .pf-history-filter input { min-width: 130px; width: auto; }
.pf-history-modal-body { overflow: auto; padding: 8px 18px 18px; }
.pf-history-empty { padding: 26px 0; color: var(--muted); font-size: 12.5px; text-align: center; }

.pf-company-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.pf-chart-panel {
  margin-top: 20px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line-soft2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  transition: all 0.2s ease;
}
.pf-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pf-chart-title-wrap h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}
.pf-chart-title-wrap p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}
.pf-chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pf-chart-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft2);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.pf-chart-checkbox:hover {
  background: var(--surface-2);
  border-color: var(--line-mid, #cbd5e1);
}
.pf-chart-checkbox.checked,
.pf-chart-checkbox:has(input:checked) {
  background: var(--surface-2);
  border-color: var(--info-border, #93c5fd);
  color: var(--info-text, #1d4ed8);
  font-weight: 600;
}
.pf-chart-checkbox input[type="checkbox"] {
  accent-color: var(--info-solid, #2563eb);
  cursor: pointer;
  width: 14px;
  height: 14px;
  margin: 0;
}
.pf-range-pills {
  display: inline-flex;
  align-items: center;
  background: var(--surface-3);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line-soft2);
}
.pf-range-pill {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-range-pill:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}
.pf-range-pill.active {
  color: #ffffff;
  background: var(--info-solid);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}
.pf-chart-zoom-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface-3);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line-soft2);
}
.pf-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-zoom-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.pf-zoom-btn:active {
  transform: scale(0.92);
}
.pf-chart-metric-select {
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  background-color: var(--surface-2);
  border: 1px solid var(--line-mid);
  border-radius: 8px;
  cursor: pointer;
}
.pf-chart-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line-mid);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-chart-picker-btn:hover,
.pf-chart-picker-btn.active {
  background: var(--accent-faint);
  color: var(--info-text);
  border-color: var(--info-border);
}
.pf-chart-fullscreen-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-mid);
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-chart-fullscreen-btn:hover,
.pf-chart-fullscreen-btn.active {
  background: var(--accent-faint);
  color: var(--info-text);
  border-color: var(--info-border);
}
.pf-chart-close-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
}
.pf-chart-close-btn:hover {
  background: var(--red-bg);
  color: var(--red-text);
  border-color: #fca5a5;
}

/* ── Chart Fullscreen Mode ─────────────────────────────────── */
.pf-chart-panel:fullscreen,
.pf-chart-panel.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 14px 24px 16px !important;
  border-radius: 0 !important;
  background: var(--surface) !important;
  border: none !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.pf-chart-panel:fullscreen .pf-chart-layout,
.pf-chart-panel.is-fullscreen .pf-chart-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  margin-bottom: 6px;
  height: calc(100vh - 165px);
}

.pf-chart-panel:fullscreen .pf-chart-main,
.pf-chart-panel.is-fullscreen .pf-chart-main {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.pf-chart-panel:fullscreen .pf-chart-canvas-wrap,
.pf-chart-panel.is-fullscreen .pf-chart-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.pf-chart-panel:fullscreen [data-pf-chart],
.pf-chart-panel.is-fullscreen [data-pf-chart] {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.pf-chart-panel:fullscreen [data-pf-chart-canvas-inner],
.pf-chart-panel.is-fullscreen [data-pf-chart-canvas-inner] {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.pf-chart-panel:fullscreen .pf-chart-svg,
.pf-chart-panel.is-fullscreen .pf-chart-svg {
  width: 100%;
  height: 100% !important;
  max-height: calc(100vh - 165px) !important;
  overflow: visible !important;
}

.pf-chart-panel:fullscreen .pf-chart-sidebar,
.pf-chart-panel.is-fullscreen .pf-chart-sidebar {
  max-height: calc(100vh - 165px);
  overflow-y: auto;
}

.pf-chart-panel:fullscreen .pf-timeline-bar-wrap,
.pf-chart-panel.is-fullscreen .pf-timeline-bar-wrap {
  margin-top: 4px;
  flex-shrink: 0;
}

.pf-chart-panel:fullscreen .pf-chart-note,
.pf-chart-panel.is-fullscreen .pf-chart-note {
  margin-top: 3px;
  flex-shrink: 0;
}

.pf-chart-panel:fullscreen .chart-quote-badge,
.pf-chart-panel.is-fullscreen .chart-quote-badge {
  padding: 5px 12px;
  border-radius: 7px;
  background: var(--surface-3);
  border-color: var(--line-mid);
}

.pf-chart-panel:fullscreen .chart-quote-badge.is-hovering,
.pf-chart-panel.is-fullscreen .chart-quote-badge.is-hovering {
  background: var(--accent-faint);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.18);
}

.pf-chart-panel:fullscreen .chart-quote-badge-price,
.pf-chart-panel.is-fullscreen .chart-quote-badge-price {
  font-size: 20px;
}

.pf-chart-panel:fullscreen .chart-quote-badge-change,
.pf-chart-panel.is-fullscreen .chart-quote-badge-change {
  font-size: 13px;
}

.pf-chart-panel:fullscreen .chart-quote-badge-date,
.pf-chart-panel.is-fullscreen .chart-quote-badge-date {
  font-size: 12px;
}

.pf-chart-panel:fullscreen .chart-quote-badge-ma,
.pf-chart-panel.is-fullscreen .chart-quote-badge-ma {
  font-size: 12px;
  padding: 2px 8px;
}

/* ── Gráfico independiente de valor de cartera y aportaciones ─ */
.pf-value-chart-panel {
  margin-top: 20px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line-soft2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}
.pf-value-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pf-value-chart-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 16px;
  align-items: stretch;
}
.pf-value-chart-canvas {
  position: relative;
  min-height: 340px;
  user-select: none;
}
.pf-value-chart-svg {
  display: block;
  width: 100%;
  height: 340px;
  overflow: visible;
}
.pf-value-chart-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.pf-value-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pf-value-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft2);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 11.5px;
}
.pf-value-legend-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.pf-value-legend-name {
  overflow: hidden;
  color: var(--muted-strong);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-value-legend-value {
  margin-left: auto;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-value-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line-soft2);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 11.5px;
}
.pf-value-summary[hidden] {
  display: none;
}
.pf-value-summary-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.pf-value-summary strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.pf-value-summary .positive { color: var(--green-text-2); }
.pf-value-summary .negative { color: var(--red-text); }
.pf-value-chart-panel:fullscreen,
.pf-value-chart-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 14px 24px 16px;
  border: none;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
  box-sizing: border-box;
}
.pf-value-chart-panel:fullscreen .pf-value-chart-body,
.pf-value-chart-panel.is-fullscreen .pf-value-chart-body {
  flex: 1 1 auto;
  min-height: 0;
}
.pf-value-chart-panel:fullscreen .pf-value-chart-canvas,
.pf-value-chart-panel.is-fullscreen .pf-value-chart-canvas {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.pf-value-chart-panel:fullscreen .pf-value-chart-svg,
.pf-value-chart-panel.is-fullscreen .pf-value-chart-svg {
  flex: 1 1 auto;
  height: 100%;
  max-height: calc(100vh - 170px);
}
.pf-value-chart-panel:fullscreen .pf-value-chart-side,
.pf-value-chart-panel.is-fullscreen .pf-value-chart-side {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}
@media (max-width: 760px) {
  .pf-value-chart-body { grid-template-columns: minmax(0, 1fr); }
  .pf-value-chart-side { flex-direction: row; flex-wrap: wrap; }
  .pf-value-legend { flex: 1 1 220px; }
}

/* ── Elements Picker Panel ─────────────────────────────────── */
.pf-chart-picker-panel {
  background: var(--surface-2);
  border: 1px solid var(--line-soft2);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
}
.pf-chart-picker-panel[hidden] {
  display: none;
}
.pf-picker-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft2);
}
.pf-picker-tabs {
  display: flex;
  gap: 4px;
}
.pf-picker-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-picker-tab:hover {
  background: var(--surface);
  color: var(--ink-2);
}
.pf-picker-tab.active {
  background: var(--surface);
  color: var(--info-text);
  border-color: var(--line-mid);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.pf-picker-pill {
  display: inline-block;
  padding: 1px 6px;
  font-size: 9.5px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 700;
}
.pf-picker-tab.active .pf-picker-pill {
  background: var(--info-bg);
  color: var(--info-text);
}
.pf-picker-search-wrap {
  flex: 1;
  max-width: 240px;
  min-width: 150px;
}
.pf-picker-search-input {
  width: 100%;
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  background: var(--surface);
  outline: none;
}
.pf-picker-search-input:focus {
  border-color: var(--info-solid);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.pf-picker-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pf-picker-act-btn {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-strong);
  background: var(--surface);
  border: 1px solid var(--line-mid);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.pf-picker-act-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.pf-picker-count-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--info-text);
  background: var(--info-bg);
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--info-border);
}
.pf-chart-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 10px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}
.pf-chart-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line-soft2);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
  user-select: none;
}
.pf-chart-choice:hover {
  border-color: var(--info-border);
  background: var(--surface-2);
}
.pf-chart-choice.selected {
  border-color: #60a5fa;
  background: var(--info-bg);
}
.pf-chart-choice input[type="checkbox"] {
  accent-color: var(--info-text);
  cursor: pointer;
  flex-shrink: 0;
}
.pf-choice-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pf-choice-content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pf-choice-content strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-choice-content small {
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-choice-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.pf-choice-badge.valores {
  background: var(--info-bg);
  color: var(--info-text);
}
.pf-choice-badge.grupos {
  background: var(--amber-bg);
  color: var(--amber-text);
}
.pf-choice-badge.lotes {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ── Status Bar & Chart Layout ─────────────────────────────── */
.pf-chart-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 10.5px;
  color: var(--muted);
}
.pf-chart-status-info {
  font-weight: 500;
}
.pf-chart-source-tag {
  font-size: 10px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.pf-chart-layout {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-top: 4px;
}
.pf-chart-main {
  flex: 1;
  min-width: 0;
}
.pf-chart-canvas-wrap {
  position: relative;
  background: var(--surface-2);
  border: 1px solid #edf2f7;
  border-radius: 9px;
  padding: 8px 10px 4px;
}
.pf-chart-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--line-soft2);
  border-radius: 9px;
  padding: 10px 12px;
}
.pf-chart-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
}
.pf-chart-legend-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0;
  white-space: nowrap;
}
.pf-legend-clear-all {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 1px 6px;
  cursor: pointer;
  line-height: 1.3;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.pf-legend-clear-all:hover {
  color: var(--red-text);
  background: var(--red-bg);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ── SVG Chart Elements ────────────────────────────────────── */
.pf-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  overflow: visible;
}
.pf-chart-svg path {
  vector-effect: non-scaling-stroke;
}
.pf-chart-line {
  vector-effect: non-scaling-stroke;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}
.pf-chart-area {
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.pf-chart-zero {
  stroke: var(--muted-2);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}
.pf-chart-grid-line {
  stroke: var(--surface-3);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.pf-chart-vgrid-line {
  stroke: var(--surface-3);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.pf-chart-tick-mark {
  stroke: var(--line-mid);
  stroke-width: 1;
}
.pf-chart-axis-baseline {
  stroke: var(--line-soft2);
  stroke-width: 1;
}
.pf-chart-y-label {
  fill: var(--muted);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.pf-chart-x-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  user-select: none;
}
.pf-chart-x-label.major {
  fill: #1e222d;
  font-weight: 700;
}
.pf-chart-crosshair {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}
.pf-chart-x-badge {
  pointer-events: none;
}
.pf-chart-x-badge-bg {
  fill: #1e222d;
}
.pf-chart-x-badge-text {
  fill: #ffffff;
  font-size: 10px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  user-select: none;
}
.pf-chart-y-badge {
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.38));
}
.pf-chart-y-badge-bg {
  fill: #0f172a;
}
.pf-chart-y-badge-arrow {
  pointer-events: none;
}
.pf-chart-y-badge-text {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  user-select: none;
  dominant-baseline: central;
}
.pf-chart-hover-layer {
  pointer-events: none;
}
.pf-chart-hover-dot-wrap {
  pointer-events: none;
}
.pf-chart-hover-dot-halo {
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.45));
}
.pf-chart-dot,
.pf-chart-hover-dot,
.pf-chart-hover-ma-dot {
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
[data-pf-chart-canvas-inner] {
  position: relative;
  user-select: none;
  touch-action: none;
}
.pf-chart-overlay {
  cursor: crosshair;
}
[data-pf-chart-canvas-inner].panning,
[data-pf-chart-canvas-inner].panning .pf-chart-overlay,
[data-chart-canvas-inner].panning,
[data-chart-canvas-inner].panning .pf-chart-overlay,
[data-val-canvas-inner].panning,
[data-val-canvas-inner].panning .pf-chart-overlay {
  cursor: grabbing !important;
}
[data-pf-chart-canvas-inner].measuring,
[data-pf-chart-canvas-inner].measuring .pf-chart-overlay,
[data-pf-chart-canvas-inner].measuring-active,
[data-pf-chart-canvas-inner].measuring-active .pf-chart-overlay,
[data-chart-canvas-inner].measuring,
[data-chart-canvas-inner].measuring .pf-chart-overlay,
[data-chart-canvas-inner].measuring-active,
[data-chart-canvas-inner].measuring-active .pf-chart-overlay,
[data-val-canvas-inner].measuring,
[data-val-canvas-inner].measuring .pf-chart-overlay,
[data-val-canvas-inner].measuring-active,
[data-val-canvas-inner].measuring-active .pf-chart-overlay {
  cursor: crosshair !important;
}
.pf-measure-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-measure-tool-btn:hover {
  background: var(--surface-3);
}
.pf-measure-tool-btn.active {
  background: var(--red-bg) !important;
  border-color: #f87171 !important;
  color: var(--red-text) !important;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}
.pf-chart-measure-layer {
  pointer-events: none;
}
.pf-chart-measure-layer[hidden] {
  display: none !important;
}
.pf-chart-measure-box,
.pf-chart-measure-diagonal,
.pf-chart-measure-pt1,
.pf-chart-measure-pt2 {
  pointer-events: none;
}
.pf-chart-measure-pt1,
.pf-chart-measure-pt2 {
  filter: drop-shadow(0 1px 2px rgba(220, 38, 38, 0.3));
}
.pf-chart-measure-diagonal {
  filter: drop-shadow(0 1px 2px rgba(220, 38, 38, 0.25));
}
.pf-chart-measure-badge {
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.pf-chart-measure-badge-text {
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  user-select: none;
}

/* ── Google Finance Style Right-Click Compare Layer ──────────── */
[data-chart-canvas-inner].comparing,
[data-chart-canvas-inner].comparing .pf-chart-overlay,
[data-val-canvas-inner].comparing,
[data-val-canvas-inner].comparing .pf-chart-overlay {
  cursor: crosshair !important;
  user-select: none;
}
.pf-chart-compare-layer {
  pointer-events: none;
}
.pf-chart-compare-layer[hidden] {
  display: none !important;
}
.pf-chart-compare-band,
.pf-chart-compare-v1,
.pf-chart-compare-v2,
.pf-chart-compare-baseline,
.pf-chart-compare-connector,
.pf-chart-compare-pt1,
.pf-chart-compare-pt2,
.pf-chart-compare-pt1-halo,
.pf-chart-compare-pt2-halo,
.pf-chart-compare-badge {
  pointer-events: none;
}
.pf-chart-compare-badge {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}
.pf-chart-compare-badge-text {
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  user-select: none;
}
.pf-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 250px;
  color: var(--muted-2);
  font-size: 12px;
}

/* ── Dual-Handle Timeline Brush Bar ────────────────────────── */
.pf-timeline-bar-wrap {
  margin-top: 10px;
  padding: 10px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft2);
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.pf-timeline-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}
.pf-timeline-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft2);
  border-radius: 6px;
  padding: 3px 8px;
}
.pf-timeline-chip-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pf-timeline-date-chip strong {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.pf-timeline-hint {
  font-size: 10.5px;
  color: var(--muted-2);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-timeline-track {
  position: relative;
  height: 32px;
  background: var(--surface-3);
  border: 1px solid var(--line-mid);
  border-radius: 7px;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
}
.pf-timeline-sparkline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
  pointer-events: none;
}
.pf-timeline-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(226, 232, 240, 0.82);
  backdrop-filter: blur(1px);
  pointer-events: none;
}
.pf-timeline-mask.left {
  left: 0;
}
.pf-timeline-mask.right {
  right: 0;
}
.pf-timeline-window {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.12);
  border-top: 2px solid var(--info-solid);
  border-bottom: 2px solid var(--info-solid);
  display: flex;
  align-items: stretch;
  cursor: grab;
  touch-action: none;
}
.pf-timeline-window.dragging {
  cursor: grabbing;
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--info-text);
}
.pf-timeline-window-body {
  flex: 1;
  min-width: 0;
  height: 100%;
}
.pf-timeline-handle {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 14px;
  background: var(--info-solid);
  border: 1.5px solid #ffffff;
  border-radius: 4px;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  touch-action: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, transform 0.1s ease;
}
.pf-timeline-handle.left {
  left: -7px;
}
.pf-timeline-handle.right {
  right: -7px;
}
.pf-timeline-handle:hover,
.pf-timeline-handle.active {
  background: var(--info-solid);
  transform: scaleY(1.1);
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.4);
}
.pf-handle-grip {
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 1px;
}

/* ── Legend Chips ──────────────────────────────────────────── */
.pf-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 270px;
  overflow-y: auto;
}
.pf-legend-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  margin-bottom: 5px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line-soft2);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-legend-chip:hover {
  border-color: var(--info-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.pf-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pf-legend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--ink-2);
}
.pf-legend-val {
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, monospace;
  margin-left: 4px;
}
.pf-legend-val.positive {
  color: var(--green-text);
}
.pf-legend-val.negative {
  color: var(--red-text);
}
.pf-legend-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: all 0.1s;
}
.pf-legend-remove:hover {
  background: var(--red-bg);
  color: var(--red-text);
}

.pf-chart-note {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 10.5px;
}
.pf-chart-trigger {
  display: inline-grid;
  width: 25px;
  height: 25px;
  margin-left: auto;
  padding: 4px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: var(--info-text);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-chart-trigger:hover,
.pf-chart-trigger:focus-visible {
  background: #eaf1ff;
  outline: none;
}
.pf-chart-trigger.active {
  color: var(--red-text);
  background: var(--red-bg);
}
.pf-chart-trigger.active:hover,
.pf-chart-trigger.active:focus-visible {
  background: #fde3e3;
}
.pf-chart-trigger svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.pf-lot-date .pf-chart-trigger {
  float: right;
  margin: -4px 0 0 6px;
}

/* ── Dashboard de cartera estilo DivvyDiary ─────────────────── */

.portfolio-page-section {
  padding: 30px 48px 44px;
  border-top: 1px solid #e1e3e7;
  background: #f5f6f8;
}

.portfolio-page-section > #portfolio-section {
  max-width: 1180px;
  margin: 0 auto;
}

.pf-dashboard {
  color: #1d2a39;
}

.pf-metric-strip {
  display: grid;
  grid-template-columns: 1.08fr 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-soft2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 32, 45, .08);
}

.pf-metric-card {
  position: relative;
  min-height: 86px;
  padding: 17px 20px 14px;
}

.pf-metric-card-interactive {
  cursor: pointer;
  transition: background 0.15s ease;
}
.pf-metric-card-interactive:hover {
  background: var(--surface-2);
}
.pf-metric-card-interactive:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.pf-metric-card + .pf-metric-card { border-left: 1px solid var(--line-soft2); }

.pf-metric-label {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  color: #6f7b89;
  font-size: 11px;
}

.pf-metric-label > span { min-width: 0; }
.pf-metric-label i { display: inline-grid; width: 12px; height: 12px; margin-left: 3px; place-items: center; border-radius: 50%; background: #77818c; color: #fff; font-size: 8px; font-style: normal; font-weight: 700; vertical-align: 1px; }

.pf-period-select, .pf-select {
  height: 28px;
  padding: 0 9px;
  border: 1px solid #edf0f3;
  border-radius: 6px;
  background: #f7f8fa;
  color: #425064;
  font-size: 10px;
  font-weight: 700;
}

.pf-metric-value-row { display: flex; align-items: baseline; gap: 9px; margin-top: 4px; }
.pf-metric-value-row strong { color: #1c2a3b; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pf-metric-trend { font-size: 11px; font-weight: 700; white-space: nowrap; }
.pf-metric-trend.positive { color: #078c6a; }
.pf-metric-trend.negative { color: #dc4a4a; }
.pf-metric-action { position: absolute; right: 17px; bottom: 11px; color: #aeb7c2; font-size: 14px; }
.pf-net-toggle { display: inline-flex; align-items: center; gap: 9px; color: #8b96a3; font-size: 10px; font-weight: 400; white-space: nowrap; }
.pf-net-controls { display: inline-flex; align-items: center; gap: 8px; }
.pf-net-pct {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border: 1px solid var(--line-soft2);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 600;
}
.pf-net-pct.is-hidden { display: none; }
.pf-net-pct:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-faint); }
.pf-net-pct-input {
  width: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.pf-net-pct-input::-webkit-outer-spin-button,
.pf-net-pct-input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.pf-net-pct-sign { color: var(--muted); }
.pf-metric-net-note { margin-left: 8px; color: var(--muted); font-size: 10px; font-weight: 500; }

.pf-switch {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 19px;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #dfe3e8;
  cursor: pointer;
}

.pf-switch span { display: block; width: 15px; height: 15px; margin-left: 2px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); transition: transform .15s ease; }
.pf-switch.on { background: var(--accent); }
.pf-switch.on span { transform: translateX(15px); }
.pf-switch:disabled { cursor: not-allowed; opacity: .95; }

.pf-dashboard-tabs {
  display: flex;
  min-height: 68px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--line-soft2);
}

.pf-tab-list { display: flex; min-width: 0; align-items: flex-end; gap: 6px; overflow-x: auto; }
.pf-dashboard-tab { display: inline-flex; height: 43px; align-items: center; gap: 8px; padding: 0 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #687588; font-size: 12px; white-space: nowrap; }
.pf-dashboard-tab span { color: #738092; font-size: 16px; line-height: 1; }
.pf-dashboard-tab:hover { color: var(--accent); }
.pf-dashboard-tab.active { border-bottom-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.pf-dashboard-tab.active span { color: var(--accent); }
.pf-dashboard-add { margin-bottom: 8px; padding: 7px 11px; border: 1px solid #d6dce3; border-radius: 6px; background: var(--surface); color: #506075; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pf-dashboard-add:hover { border-color: var(--accent); color: var(--accent-text); }

.pf-allocation-card, .pf-broker-panel, .pf-dividend-panel, .pf-placeholder-panel {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line-soft2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 32, 45, .08);
}

.pf-allocation-card { padding: 17px 19px 0; }
.pf-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.pf-card-head h4 { margin: 0; color: #1e2c3d; font-size: 15px; font-weight: 700; }
.pf-card-head p { margin: 4px 0 0; color: #8a96a4; font-size: 11px; }
.pf-allocation-head { margin-bottom: 6px; }
.pf-allocation-controls { display: flex; align-items: center; gap: 13px; }
.pf-control-toggle { display: inline-flex; align-items: center; gap: 8px; color: #8a96a4; font-size: 10px; }
.pf-control-toggle .pf-switch { width: 35px; }

.pf-allocation-layout { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(280px, 1fr); align-items: center; gap: 32px; min-height: 380px; padding: 8px 10px 14px; }
.pf-allocation-visual { position: relative; width: min(100%, 380px); aspect-ratio: 1; margin: 0 auto; }
.pf-allocation-donut { display: block; width: 100%; height: 100%; overflow: visible; }
.pf-donut-slice {
  cursor: pointer;
  stroke: var(--surface, #ffffff);
  stroke-width: 0.75px;
  stroke-linejoin: round;
  transition: opacity 0.15s ease, filter 0.15s ease;
}
.pf-donut-slice:hover, .pf-donut-slice.hovered { filter: brightness(1.08) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.14)); }
.pf-allocation-visual.has-hover .pf-donut-slice:not(.hovered):not(:hover) { opacity: 0.35; }
.pf-allocation-center { position: absolute; top: 50%; left: 50%; display: flex; width: 48%; align-items: center; flex-direction: column; gap: 4px; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.pf-allocation-center span { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.pf-allocation-center strong { color: var(--ink); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-allocation-legend { max-height: 360px; margin: 0; padding: 0 16px 0 0; overflow-y: auto; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.pf-allocation-legend-item { display: flex; min-height: 30px; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; border-radius: 6px; padding: 3px 8px; cursor: pointer; transition: background-color 0.15s ease, opacity 0.15s ease; }
.pf-allocation-legend-item:hover, .pf-allocation-legend-item.hovered { background: var(--surface-3); }
.pf-allocation-legend.has-hover .pf-allocation-legend-item:not(.hovered):not(:hover) { opacity: 0.45; }
.pf-allocation-swatch { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 3px; }
.pf-allocation-legend-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pf-allocation-legend-item strong { min-width: 54px; color: var(--ink); font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.pf-card-footer { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #e3e6e9; }
.pf-footer-hint { color: #9aa4b0; font-size: 10.5px; }
.pf-footer-link { padding: 0; border: 0; background: transparent; color: var(--accent-text); font-size: 11px; }
.pf-footer-link:hover { color: #c94f35; text-decoration: underline; text-underline-offset: 2px; }
.pf-outline-button { min-height: 29px; padding: 0 10px; border: 1px solid var(--line-mid); border-radius: 6px; background: var(--surface); color: var(--muted-strong); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.pf-outline-button:hover { border-color: var(--accent); color: var(--accent-text); }

.pf-table-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pf-table-head-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pf-table-main-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.pf-table-main-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 15px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  line-height: 1;
  user-select: none;
}

.pf-table-main-tab:hover {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
}

.pf-table-main-tab.active {
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pf-table-main-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pf-table-tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.pf-table-main-tab.active .pf-table-tab-pill {
  background: var(--accent-faint);
  color: var(--accent-text);
}

.pf-table-head-desc {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.pf-positions-views {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}
.pf-positions-views .pf-view-button,
.pf-positions-views .pf-positions-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  line-height: 1;
  user-select: none;
}
.pf-positions-views .pf-view-button:hover,
.pf-positions-views .pf-positions-view-btn:hover {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
}
.pf-positions-views .pf-view-button.active,
.pf-positions-views .pf-positions-view-btn.active {
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.pf-positions-views .pf-view-button:focus-visible,
.pf-positions-views .pf-positions-view-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pf-expand-head { width: 26px; }
.pf-expand-cell { padding: 0 4px !important; }
.pf-expand-btn { display: grid; width: 26px; height: 26px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #9aa6b4; font-size: 11px; line-height: 1; cursor: pointer; transition: background 0.15s, color 0.15s; }
.pf-expand-btn::before { content: '▸'; display: block; transition: transform 0.18s ease; }
.pf-expand-btn:hover, .pf-expand-btn.open { background: var(--accent-faint); color: var(--accent-text); }
.pf-expand-btn.open::before { transform: rotate(90deg); }
.pf-broker-table tbody tr.pf-row-expanded td { background: var(--surface-2) !important; }
.pf-lot-row td { background: var(--surface-2) !important; color: #4a5a6d; font-size: 10.5px; }
.pf-lot-row .pf-expand-cell { text-align: center !important; }
.pf-lot-row .pf-lot-date { text-align: left; color: #8290a0; }
.pf-lot-row .pf-lot-date .pf-lot-badge { margin-left: 6px; }
.pf-lot-date-line { display: block; white-space: nowrap; }
.pf-lot-date-line + .pf-lot-date-line { margin-top: 3px; }
.pf-lot-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; background: var(--surface-3); color: #354356; font-size: 9.5px; font-weight: 700; }
.pf-lot-badge.sell { background: var(--red-bg); color: #c94f35; }
.pf-lot-badge.sold { background: #eee9f7; color: #6b4fa1; }
.pf-status-badge { display: inline-block; flex: 0 0 auto; padding: 2px 6px; border-radius: 4px; font-size: 8.5px; font-weight: 700; white-space: nowrap; }
.pf-status-badge.sold { background: var(--red-bg); color: #c94f35; }
.pf-status-badge.partial { background: var(--accent-faint); color: var(--accent-text); }

.pf-broker-panel, .pf-dividend-panel { padding: 17px 0 0; }
.pf-broker-panel > .pf-card-head, .pf-dividend-panel > .pf-card-head { margin: 0 19px 12px; }
.pf-broker-table-wrap, .pf-dividend-table-wrap { overflow-x: auto; }
.pf-broker-table > tbody > tr > td:first-child,
.pf-transactions-table > tbody > tr > td:first-child {
  display: table-cell;
  align-items: unset;
  gap: unset;
}
.pf-broker-table, .pf-dividend-table { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: auto; }
.pf-broker-table.pf-table-wide { min-width: 940px; }
.pf-broker-table.pf-table-wide td { font-size: 10px; }
.pf-broker-table th, .pf-dividend-table th { padding: 8px 3px; border-bottom: 1px solid #dce1e6; background: var(--surface-2); color: #8290a0; font-size: 8.5px; font-weight: 700; text-align: right; text-transform: uppercase; white-space: nowrap; }
.pf-broker-table th:first-child, .pf-dividend-table th:first-child { text-align: left; }
.pf-sort-mark { margin-left: 3px; color: #a5afba; font-size: 11px; }
.pf-broker-table th[data-sort-key] { cursor: pointer; user-select: none; }
.pf-broker-table th[data-sort-key]:hover, .pf-broker-table th.pf-sort-active { color: var(--accent-text); }
.pf-broker-table th.pf-sort-active .pf-sort-mark { color: var(--accent-text); }
.pf-mode-toggle { display: inline-grid; width: 19px; height: 19px; margin-left: 4px; place-items: center; border: 1px solid var(--line-mid); border-radius: 5px; background: var(--surface); color: var(--muted-strong); font-size: 10px; font-weight: 700; line-height: 1; cursor: pointer; vertical-align: middle; }
.pf-mode-toggle:hover { border-color: var(--accent); color: var(--accent-text); }
.pf-mode-toggle.active { background: var(--accent-faint); border-color: var(--accent); color: var(--accent-text); }
.pf-mode-toggle-text { width: auto; min-width: 38px; padding: 0 5px; font-size: 9px; }
.pf-broker-table td, .pf-dividend-table td { padding: 7px 4px; border-bottom: 1px solid #eef0f2; color: #26364a; font-size: 10.5px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pf-broker-table tbody tr:nth-child(even) td, .pf-dividend-table tbody tr:nth-child(even) td { background: var(--surface-2); }
.pf-broker-table tbody tr[data-ticker], .pf-dividend-table tbody tr[data-ticker] { cursor: pointer; }
.pf-broker-table tbody tr[data-ticker]:hover td, .pf-dividend-table tbody tr[data-ticker]:hover td { background: var(--surface-2); }
.pf-broker-table tbody tr[data-ticker]:focus-visible, .pf-dividend-table tbody tr[data-ticker]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pf-broker-first-head { min-width: 125px; }
.pf-broker-company { display: flex; min-width: 115px; align-items: center; gap: 7px; text-align: left !important; }
.pf-company-logo { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; overflow: hidden; border-radius: 50%; background: #edf1f5; color: #637187; font-size: 11px; font-weight: 700; }
.pf-company-logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pf-company-logo.fallback { background: #e9eef5; }
.pf-broker-company-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; text-align: left; }
.pf-broker-company-copy strong { overflow: hidden; color: #1d2b3c; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.pf-broker-company-copy small, .pf-double-value small { color: var(--muted); font-size: 10px; }
.pf-double-value { display: flex; min-width: 82px; align-items: flex-end; flex-direction: column; gap: 2px; }
.pf-double-value strong { color: #26364a; font-size: 11px; font-weight: 400; }
.pf-double-value.positive strong, .pf-broker-table td.positive .pf-double-value strong { color: #078c6a; }
.pf-double-value.negative strong, .pf-broker-table td.negative .pf-double-value strong { color: #dc4a4a; }

.pf-chart-tooltip {
  position: fixed;
  z-index: 2147483647 !important;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 140px;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.pf-chart-tooltip[hidden] { display: none; }
.pf-chart-tooltip-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 3px; }
.pf-chart-tooltip-header {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.pf-chart-tooltip-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pf-chart-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pf-chart-tooltip-name {
  color: var(--line-mid);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.pf-chart-tooltip-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  white-space: nowrap;
}
.pf-chart-tooltip-val.positive {
  color: #34d399;
}
.pf-chart-tooltip-val.negative {
  color: #f87171;
}

/* Measurement Tooltip Card */
.pf-measure-tooltip-head {
  padding-bottom: 7px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pf-measure-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--info-border);
}
.pf-measure-badge-tag.positive {
  color: #34d399;
}
.pf-measure-badge-tag.negative {
  color: #f87171;
}
.pf-measure-period {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
}
.pf-measure-sub {
  font-size: 10px;
  color: var(--muted-2);
}
.pf-measure-tooltip-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pf-measure-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
}
.pf-measure-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.pf-measure-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  font-weight: 500;
  color: var(--line-soft2);
}
.pf-measure-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  white-space: nowrap;
}
.pf-measure-from-to {
  font-size: 9.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.pf-measure-diff {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pf-measure-diff.positive {
  color: #34d399;
}
.pf-measure-diff.negative {
  color: #f87171;
}
.pf-double-value.positive small { color: #078c6a; }
.pf-double-value.negative small { color: #dc4a4a; }
.pf-broker-table td.positive, .pf-lot-row td.positive, .pf-broker-totals-row td.positive { color: var(--green); font-weight: 700; }
.pf-broker-table td.negative, .pf-lot-row td.negative, .pf-broker-totals-row td.negative { color: var(--red); font-weight: 700; }
.pf-broker-totals-row td { border-top: 2px solid #d4dbe2; background: #f6f8fa !important; color: #1d2b3c; font-weight: 700; }
.pf-broker-totals-row .pf-broker-company strong { font-size: 11px; }

.pf-dividend-panel { padding-bottom: 0; }
.pf-dividend-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 19px 15px; }
.pf-dividend-summary > div { padding: 11px 13px; border: 1px solid #e2e6ea; border-radius: 6px; background: var(--surface-2); }
.pf-dividend-summary span { display: block; color: #8290a0; font-size: 10px; }
.pf-dividend-summary strong { display: block; margin-top: 5px; color: #1d2b3c; font-size: 16px; font-variant-numeric: tabular-nums; }
.pf-dividend-table { min-width: 650px; }
.pf-dividend-table td:first-child { text-align: left; }

.pf-operations-form-panel { margin-top: 20px; }
.pf-operations-form-panel .pf-form-block { margin: 0; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 0; }
.pf-placeholder-panel { display: flex; min-height: 260px; align-items: center; justify-content: center; flex-direction: column; padding: 30px; text-align: center; }
.pf-placeholder-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--accent-faint); color: var(--accent); font-size: 21px; }
.pf-placeholder-panel h4 { margin: 15px 0 5px; font-size: 16px; }
.pf-placeholder-panel p { max-width: 410px; margin: 0; color: #8491a0; font-size: 12px; }
.pf-dashboard-empty-add { width: auto; }
.pf-empty-state { margin-top: 20px; border: 1px solid var(--line-soft2); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(20, 32, 45, .08); }

@media (max-width: 900px) {
  .portfolio-page-section { padding-right: 24px; padding-left: 24px; }
  .pf-allocation-layout { grid-template-columns: minmax(330px, 1fr) minmax(270px, .9fr); gap: 10px; }
  .pf-allocation-legend { padding-right: 4px; }
}

@media (max-width: 700px) {
  .portfolio-page-section { padding: 20px 15px 30px; }
  .pf-metric-strip { grid-template-columns: 1fr; }
  .pf-metric-card { min-height: 80px; }
  .pf-metric-card + .pf-metric-card { border-top: 1px solid var(--line-soft2); border-left: 0; }
  .pf-dashboard-tabs { min-height: 59px; align-items: flex-end; }
  .pf-tab-list { gap: 0; }
  .pf-dashboard-tab { padding: 0 10px; font-size: 11px; }
  .pf-dashboard-tab span { display: none; }
  .pf-dashboard-add { padding: 6px 8px; font-size: 10px; }
  .pf-allocation-card { padding-right: 12px; padding-left: 12px; }
  .pf-allocation-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .pf-allocation-controls { width: 100%; justify-content: space-between; }
  .pf-allocation-layout { display: flex; min-height: 0; align-items: stretch; flex-direction: column; gap: 14px; padding: 12px 0 18px; }
  .pf-allocation-visual { width: min(100%, 420px); }
  .pf-allocation-legend { max-height: none; padding: 0 5px; }
  .pf-dividend-summary { grid-template-columns: 1fr; margin-right: 12px; margin-left: 12px; }
  .pf-broker-panel > .pf-card-head, .pf-dividend-panel > .pf-card-head { margin-right: 12px; margin-left: 12px; }
  .pf-card-head { align-items: flex-start; flex-direction: column; }
  .pf-card-head .pf-outline-button { align-self: flex-start; }
  .pf-groups-section > .pf-card-head { margin-right: 12px; margin-left: 12px; }
  .pf-groups-head-actions { flex-wrap: wrap; }
  .pf-groups-tabs { margin-right: 12px; margin-left: 12px; flex-wrap: wrap; }
  .pf-groups-tab-actions { padding-bottom: 6px; }
  .pf-groups-empty { margin-right: 12px; margin-left: 12px; }
  .pf-dashboard-empty-add { width: auto; }
  .pf-chart-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .pf-chart-controls { width: 100%; justify-content: flex-start; }
  .pf-chart-controls .pf-metric-wrap { flex: 1; min-width: 130px; }
  .pf-chart-controls .pf-select { width: 100%; min-width: 0; }
  .pf-range-pills { overflow-x: auto; max-width: 100%; }
  .pf-chart-layout { flex-direction: column; }
  .pf-chart-sidebar { width: 100%; }
  .pf-chart-legend { display: flex; flex-wrap: wrap; gap: 6px; max-height: none; }
  .pf-timeline-info { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .pf-timeline-hint { display: none; }
}

/* ── Pestañas y grupos de la cartera ───────────────────────── */

.pf-g-dot { display: inline-block; width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; }
.pf-g-pills { display: inline-flex; max-width: 110px; flex-wrap: wrap; gap: 3px; align-items: center; }
.pf-g-pill { display: inline-flex; align-items: center; gap: 4px; max-width: 82px; overflow: hidden; padding: 1px 6px; border-radius: 9px; background: var(--surface-3); color: #44536a; font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.pf-groups-cell { text-align: left !important; }
.pf-g-add { display: inline-grid; width: 20px; height: 20px; margin-left: 4px; place-items: center; border: 1px solid var(--line-mid); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; vertical-align: middle; }
.pf-g-add:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-faint); }

.pf-groups-section { margin-top: 0; padding-top: 0; border-top: 0; }
.pf-groups-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pf-groups-title h5 { margin: 0; color: #1d2b3c; font-size: 12px; }
.pf-groups-hint { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; }
.pf-groups-controls { display: flex; align-items: center; gap: 6px; }
.pf-positions-head-actions, .pf-groups-head-actions { display: flex; align-items: center; gap: 10px; }
.pf-show-all-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--info-text); border-color: var(--line-mid); }
.pf-show-all-btn:hover { border-color: var(--info-solid); color: var(--info-text); background: var(--info-bg); }
.pf-show-all-btn svg { stroke: var(--info-solid); }
.pf-toggle-chart-btn { display: inline-flex; align-items: center; gap: 6px; }
.pf-toggle-chart-btn svg { color: var(--accent); }
.pf-chart-empty-clean { text-align: center; padding: 24px 20px; }
.pf-chart-empty-clean p { margin: 0; }
.pf-chart-empty-clean strong { color: var(--ink-3); font-size: 13px; }
.pf-chart-empty-sub { max-width: 500px; margin-top: 6px !important; color: var(--muted) !important; font-size: 11.5px !important; line-height: 1.5; }
.pf-inline-chart-icon { display: inline-grid; place-items: center; width: 17px; height: 17px; vertical-align: middle; background: var(--info-bg); border-radius: 4px; color: var(--info-text); }
.pf-legend-empty-hint { padding: 10px 12px; color: var(--muted-2); font-size: 11px; font-style: italic; list-style: none; }
.pf-groups-tabs { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 19px; border-bottom: 1px solid #e3e7eb; }
.pf-groups-tab-list { display: flex; min-width: 0; align-items: flex-end; gap: 6px; overflow-x: auto; }
.pf-groups-tab { display: inline-flex; height: 40px; align-items: center; gap: 6px; padding: 0 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #687588; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pf-groups-tab:hover { color: var(--accent); }
.pf-groups-tab.active { border-bottom-color: var(--accent); color: var(--accent-text); }
.pf-groups-tab-actions { display: flex; align-items: center; gap: 6px; padding: 0 0 8px; }
.pf-g-row-actions { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 0; margin-left: 6px; }
.pf-groups-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0; }
.pf-groups-empty { margin: 14px 19px; padding: 12px 14px; border: 1px dashed #d3d9e0; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 11px; }

.pf-g-pill-item { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line-mid); border-radius: 7px; background: var(--surface); }
.pf-g-pill-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pf-g-pill-btn { display: inline-flex; min-height: 27px; align-items: center; gap: 6px; padding: 0 8px; border: 0; background: transparent; color: #3b4a5f; font-size: 10.5px; font-weight: 700; cursor: pointer; }
.pf-g-pill-btn:hover { color: var(--accent-text); }
.pf-g-count { padding: 1px 6px; border-radius: 8px; background: var(--surface-3); color: var(--muted-strong); font-size: 9.5px; }
.pf-g-pill-edit, .pf-g-pill-del { display: grid; width: 25px; height: 27px; place-items: center; border: 0; border-left: 1px solid #eceff2; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.pf-g-pill-edit:hover { background: var(--surface-2); color: var(--accent-text); }
.pf-g-pill-del:hover { background: var(--red-bg); color: var(--red); }

.pf-g-form { margin-top: 12px; padding: 12px; border: 1px dashed #d3d9e0; border-radius: 8px; background: var(--surface); }
.pf-g-form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pf-g-form-head { margin-bottom: 9px; }
.pf-g-form-title { color: #1d2b3c; font-size: 11.5px; font-weight: 700; }
.pf-g-form-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.pf-g-name { width: 220px; height: 30px; }
.pf-g-color { width: 44px; height: 30px; padding: 2px; border: 1px solid var(--line-mid); border-radius: 6px; background: var(--surface); cursor: pointer; }
.pf-g-members-title { margin: 0 0 8px; color: var(--muted-strong); font-size: 10.5px; font-weight: 700; }
.pf-g-members-list { max-height: 280px; overflow-y: auto; padding-right: 6px; overscroll-behavior: contain; }
.pf-g-member-item { padding: 6px 0; border-bottom: 1px solid #eef1f4; }
.pf-g-member-item:last-child { border-bottom: 0; }
.pf-g-action-check { display: flex; align-items: center; gap: 8px; font-size: 11px; cursor: pointer; }
.pf-g-action-check input, .pf-g-subline-check input { accent-color: var(--accent); cursor: pointer; }
.pf-g-action-check strong { color: #1d2b3c; }
.pf-g-action-check small { color: var(--muted); }
.pf-g-sublines { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; margin: 5px 0 0 22px; }
.pf-g-subline-check { display: flex; align-items: center; gap: 7px; color: var(--muted-strong); font-size: 10px; cursor: pointer; }
.pf-g-subline-check span { white-space: nowrap; }
.pf-g-form-actions { display: flex; gap: 8px; margin-top: 12px; }
.pf-g-form-actions .primary-button { min-width: 120px; }
.pf-g-form-actions .pf-outline-button { min-height: 30px; }

.pf-g-popover { position: fixed; z-index: 1400; width: 280px; max-height: min(400px, 70vh); overflow: hidden; border-radius: 10px; background: var(--surface); box-shadow: 0 10px 34px rgba(0, 0, 0, .22); }
.pf-g-popover[hidden] { display: none; }
.pf-g-popover-row.disabled { opacity: .55; cursor: default; }
.pf-g-popover-row.disabled:hover { background: transparent; }
.pf-g-popover-row.disabled .watch-popover-name { color: var(--muted); }
.pf-g-popover-row.disabled .pf-g-dot { filter: saturate(.6); }

.pf-g-lot-row td { background: var(--surface-2) !important; color: #4a5a6d; font-size: 10.5px; }
.pf-g-lot-action .pf-broker-company-copy strong { font-size: 10px; }
.pf-g-members-table { min-width: 720px; }
.pf-g-groups-table { min-width: 940px; }
.pf-g-groups-table tbody tr.pf-row-expanded td { background: var(--surface-2) !important; }
.pf-g-groups-table .pf-g-row-actions .pf-g-pill-edit,
.pf-g-groups-table .pf-g-row-actions .pf-g-pill-del { width: 24px; height: 24px; }

/* ── Panel de Dividendos (Diseño idéntico a capturas) ───────── */

.pf-dividend-dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.pf-dividend-card {
  overflow: hidden;
  border: 1px solid var(--line-soft2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 32, 45, .06);
  padding: 20px 22px;
}

.pf-dividend-card .pf-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pf-dividend-card .pf-card-head h4 {
  margin: 0;
  color: #1e2c3d;
  font-size: 15px;
  font-weight: 700;
}

.pf-dividend-card .pf-card-head p {
  margin: 4px 0 0;
  color: #8a96a4;
  font-size: 11px;
}

.pf-segmented-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  background: var(--surface);
}

.pf-seg-btn {
  min-height: 28px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid #e2e6ea;
  background: transparent;
  color: #687588;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.pf-seg-btn:last-child {
  border-right: 0;
}

.pf-seg-btn:hover {
  background: var(--surface-2);
  color: var(--accent-text);
}

.pf-seg-btn.active {
  background: var(--surface);
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(235, 98, 68, 0.2);
}

/* 1. Distribución de tus dividendos */

.pf-dist-head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pf-dist-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.pf-dist-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: center;
  margin-top: 12px;
}

.pf-dist-visual-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pf-dist-donut-wrap {
  position: relative;
  width: min(100%, 290px);
  aspect-ratio: 1;
}

.pf-dist-donut-svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.pf-dist-slice {
  cursor: pointer;
  transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

.pf-dist-slice:hover,
.pf-dist-slice.highlighted {
  stroke-width: 44;
  opacity: 0.9;
}

.pf-dist-donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  width: 60%;
}

.pf-dist-donut-center span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.pf-dist-donut-center strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pf-dist-timeline-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 340px);
  margin-top: 4px;
}

.pf-dist-play-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-mid);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.pf-dist-play-btn.playing {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pf-dist-play-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pf-dist-play-btn.playing:hover {
  background: var(--accent-dark);
  color: #fff;
}

.pf-dist-timeline-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pf-dist-timeline-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted-2);
}

.pf-dist-timeline-tick {
  cursor: pointer;
  transition: color 0.15s ease;
}

.pf-dist-timeline-tick:hover {
  color: var(--accent);
}

.pf-dist-timeline-tick.active {
  color: var(--ink);
  font-weight: 700;
}

.pf-dist-timeline-line {
  height: 8px;
  border-radius: 4px;
  background: var(--line-soft2);
  position: relative;
  overflow: hidden;
}

.pf-dist-timeline-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.pf-dist-download-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  border-radius: 4px;
}

.pf-dist-download-btn:hover {
  background: var(--surface-3);
  color: var(--ink-3);
}

.pf-dist-legend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}

.pf-dist-legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pf-dist-legend-row:hover,
.pf-dist-legend-row.highlighted {
  background: var(--surface-2);
}

.pf-dist-legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: 0 0 11px;
}

.pf-dist-legend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-3);
  font-size: 11.5px;
}

.pf-dist-legend-val {
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* 2. Gráfico apilado de 12 meses */

.pf-stacked-chart-area {
  position: relative;
  width: 100%;
  height: 250px;
  padding: 24px 0 0;
}

.pf-stacked-avg-line-wrap {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
  transform: translateY(-50%);
}

.pf-stacked-avg-pill {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-dark);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}

.pf-stacked-avg-dashed {
  flex: 1;
  border-bottom: 1.5px dashed var(--accent);
  opacity: 0.8;
}

.pf-stacked-columns {
  position: absolute;
  top: 10px;
  left: 70px;
  right: 10px;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  align-items: flex-end;
}

.pf-stacked-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.pf-stacked-top-val {
  margin-bottom: 5px;
  color: var(--muted-strong);
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pf-stacked-bar-wrap {
  width: 100%;
  height: calc(100% - 38px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pf-stacked-bar {
  width: min(100%, 38px);
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
}

.pf-stacked-seg {
  width: 100%;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.pf-stacked-seg:hover {
  opacity: 0.8;
}

.pf-stacked-month-label {
  height: 20px;
  line-height: 20px;
  color: var(--muted-2);
  font-size: 9.5px;
  text-align: center;
  white-space: nowrap;
}

.pf-stacked-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--surface-3);
}

.pf-stacked-avg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.pf-stacked-avg-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

/* 3. Matriz de dividendos */

.pf-matrix-card {
  padding-bottom: 0;
}

.pf-matrix-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.pf-matrix-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: auto;
}

.pf-matrix-table th {
  padding: 8px 6px;
  border-bottom: 1px solid #dce1e6;
  background: var(--surface-2);
  color: #8290a0;
  font-size: 9px;
  font-weight: 700;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.pf-matrix-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #eef0f2;
  color: #26364a;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.pf-matrix-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.pf-matrix-table tbody tr:nth-child(even) td {
  background: var(--surface-2);
}

.pf-matrix-table tbody tr:hover td {
  background: var(--surface-2);
}

.pf-matrix-sticky-company {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  text-align: left !important;
  min-width: 160px;
}

.pf-matrix-table th.pf-matrix-sticky-company {
  background: var(--surface-2);
}

.pf-matrix-table tbody tr:nth-child(even) .pf-matrix-sticky-company {
  background: var(--surface-2);
}

.pf-matrix-table tbody tr:hover .pf-matrix-sticky-company {
  background: var(--surface-2);
}

.pf-matrix-company-logo {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  flex: 0 0 22px;
}

.pf-matrix-sticky-sum {
  position: sticky;
  left: 160px;
  background: var(--surface);
  z-index: 2;
  min-width: 90px;
  border-right: 1px solid #e2e6ea;
}

.pf-matrix-table th.pf-matrix-sticky-sum {
  background: var(--surface-2);
}

.pf-matrix-table tbody tr:nth-child(even) .pf-matrix-sticky-sum {
  background: var(--surface-2);
}

.pf-matrix-table tbody tr:hover .pf-matrix-sticky-sum {
  background: var(--surface-2);
}

.pf-matrix-sum-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pf-matrix-growth-icon {
  color: var(--accent-text);
  font-weight: 700;
  font-size: 11px;
}

/* 4. Resumen de dividendos (Grid de tarjetas) */

.pf-summary-grid-desc {
  color: var(--muted) !important;
  font-size: 11px !important;
  margin-top: 4px !important;
}

.pf-summary-head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pf-summary-toggle-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-mid);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.pf-summary-toggle-btn:hover {
  background: var(--surface-2);
  color: var(--ink-2);
}

.pf-summary-period-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.pf-month-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.pf-month-card {
  border: 1px solid var(--line-soft2);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pf-month-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid #edf2f7;
}

.pf-month-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pf-month-card-title strong {
  color: var(--ink-2);
  font-size: 11px;
}

.pf-month-card-count {
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 600;
}

.pf-month-card-total {
  color: #078c6a;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pf-month-card-body {
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pf-month-payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.pf-month-payment-row:hover {
  background: var(--surface-2);
}

.pf-month-payment-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.pf-month-payment-left .pf-company-logo {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  font-size: 9px;
  border-radius: 50%;
}

.pf-matrix-sticky-company .pf-company-logo {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  font-size: 9px;
  border-radius: 50%;
}

.pf-dist-legend-row .pf-company-logo {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  font-size: 8px;
  border-radius: 50%;
}

.pf-month-badge-logo {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 7.5px;
  font-weight: 700;
  flex: 0 0 18px;
}

.pf-month-payment-desc {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pf-month-payment-desc strong {
  color: var(--ink-2);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-month-payment-desc small {
  color: var(--muted-2);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.pf-month-payment-amount {
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pf-summary-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--surface-3);
}

.pf-export-csv-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
}

.pf-export-csv-btn:hover {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .pf-month-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .pf-dist-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (max-width: 700px) {
  .pf-month-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Calendario de Eventos de la Cartera ───────────────────── */
