/* Metas mensuales · v3: lista por rama, lectura como texto y edición en la fila. */
.monthly-targets-page { overflow: auto; height: auto; min-height: 100vh; }
.monthly-targets-page .app-container { height: auto; min-height: 100vh; overflow: visible; }
html:has(.monthly-targets-page) { scrollbar-gutter: stable; }

.targets-main { box-sizing: border-box; width: 100%; max-width: 1240px; margin: 0 auto; color: var(--ds-text); font-size: var(--ds-fs-md); }
.targets-head { padding-bottom: var(--ds-space-2); }
.targets-head .ds-page-title span { text-transform: lowercase; }
.targets-month { display: inline-flex; align-items: center; gap: 6px; color: var(--ds-text-muted); }
.targets-month .ds-input { height: 28px; padding: 0 8px; color: var(--ds-text); }
.targets-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.targets-actions .ds-input--search { width: 220px; }
.targets-pending { display: inline-flex; align-items: center; gap: 8px; font-size: var(--ds-fs-sm); color: var(--ds-text-body); }
.targets-pending[hidden] { display: none; }
#targetsStatus[hidden] { display: none; }

/* Índice lateral y cuerpo */
.targets-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: var(--ds-space-7); margin-top: var(--ds-space-6); }
.targets-layout[hidden] { display: none; }
.targets-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; align-self: start; }
.targets-nav button { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 0; border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-text-body); font: var(--ds-fw-regular) var(--ds-fs-sm)/1.3 var(--ds-font); text-align: left; cursor: pointer; }
.targets-nav button span { color: var(--ds-text-muted); font-variant-numeric: tabular-nums; }
.targets-nav button:hover { background: var(--ds-surface-subtle); color: var(--ds-text); }
.targets-nav button.active { background: var(--ds-surface-subtle); color: var(--ds-text); font-weight: var(--ds-fw-semibold); }
.targets-nav button:focus-visible { outline: none; box-shadow: var(--ds-focus-ring); }
.targets-note { margin: 0; padding: 14px 10px 0; font-size: var(--ds-fs-xs); line-height: 1.45; color: var(--ds-text-muted); }
.targets-note + .targets-note { padding-top: 8px; }

/* Secciones por rama */
.targets-section { margin-bottom: var(--ds-space-7); }
.targets-section[hidden] { display: none; }
.targets-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--ds-text); }
.targets-section-count { font-size: var(--ds-fs-sm); color: var(--ds-text-muted); }
.targets-more { display: block; padding: 12px 0 0; }
.targets-more[hidden] { display: none; }

/* Fila */
.targets-row { border-bottom: 1px solid var(--ds-border); }
.targets-row[hidden] { display: none; }
.targets-read { display: grid; grid-template-columns: minmax(0, 1fr) 170px 150px 64px; gap: 12px; align-items: center; padding: 10px 0; font-size: var(--ds-fs-sm); }
.targets-name { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: calc(var(--depth, 0) * 18px); color: var(--ds-text-body); }
.targets-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.targets-row.is-lead .targets-name { color: var(--ds-text); font-weight: var(--ds-fw-semibold); font-size: var(--ds-fs-md); }
.targets-changed { display: none; }
.targets-row[data-changed="true"] .targets-changed { display: inline-block; }
.targets-source { font-size: var(--ds-fs-xs); color: var(--ds-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.targets-source[data-kind="manual"] { color: var(--ds-accent); }
.targets-value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ds-text); }
.targets-prefix, .targets-unit { font-size: var(--ds-fs-xs); color: var(--ds-text-muted); }
.targets-unit { margin-left: 3px; }
.targets-none { color: var(--ds-text-dim); }
.targets-edit { text-align: right; }

/* Edición en la fila */
.targets-row.is-editing { margin: 6px -14px; padding: 0 14px 12px; border: 1px solid var(--ds-accent-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.targets-editor { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding-top: 4px; }
.targets-editor[hidden] { display: none; }
.targets-editor .ds-field[hidden] { display: none; }
.targets-editor .ds-input { width: 130px; text-align: right; }
.targets-hint { font-size: var(--ds-fs-xs); color: var(--ds-text-muted); padding-bottom: 8px; }
.targets-spacer { flex: 1; }

@media (max-width: 860px) {
  .targets-layout { grid-template-columns: minmax(0, 1fr); gap: var(--ds-space-4); }
  .targets-nav { flex-direction: row; flex-wrap: wrap; position: static; }
  .targets-note { display: none; }
  .targets-actions .ds-input--search { width: 100%; }
}
@media (max-width: 640px) {
  .targets-read { grid-template-columns: minmax(0, 1fr) auto 56px; }
  .targets-source { display: none; }
}

/* ---------- Cada rama en su tarjeta (v3d) ---------- */
.targets-section { padding: 20px 24px 8px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: var(--ds-shadow-card); }
.targets-section-head { border-bottom-color: var(--ds-border); }
.targets-nav button:hover, .targets-nav button.active { background: var(--ds-surface); box-shadow: inset 0 0 0 1px var(--ds-border); }
