/* ============================================================
   Módulo Estrategia
   ============================================================ */

/* HOME — rejilla de tarjetas (estilo "Colecciones") */
.est-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.est-grid-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 18px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex; flex-direction: column; gap: 12px;
}
.est-grid-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.est-gc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.est-gc-ic { color: var(--accent-light); display: inline-flex; }
.est-badge { font-size: 11px; font-weight: 600; border: 1px solid; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.est-gc-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.est-gc-progress { height: 5px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; }
.est-gc-progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.est-gc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.est-gc-meta { font-size: 11.5px; color: var(--text-muted); }

/* DETALLE — pantalla completa con botón Volver */
.est-detalle-head { margin-bottom: 14px; }
.est-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  padding: 7px 13px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.est-back:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.est-detalle { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }

/* Lista de tareas de Proyectos: tarjetas contenidas (mismo lenguaje que Estrategia) */
.pt-tasklist { max-width: 860px; }
.est-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.est-card-headrow { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 12px; }
.est-card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.est-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.est-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.est-title-edit { flex: 1; font-size: 20px; font-weight: 700; background: transparent; border: 1px solid transparent; color: var(--text-primary); border-radius: var(--r-sm); padding: 4px 8px; outline: none; font-family: inherit; }
.est-title-edit:hover { border-color: var(--border); }
.est-title-edit:focus { border-color: var(--accent); background: var(--bg-secondary); }

.est-field { margin-top: 12px; }
.est-field:first-child { margin-top: 0; }
.est-field label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.est-field-half { max-width: 260px; }
.est-input {
  width: 100%; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary);
  padding: 9px 11px; border-radius: var(--r-sm); font-size: 13.5px; outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s; resize: vertical;
}
.est-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Objetivo/Audiencia/Fecha en una fila compacta y alineada */
.est-row2 { display: grid; grid-template-columns: 1fr 1fr 180px; gap: 14px; align-items: end; }
@media (max-width: 620px) { .est-row2 { grid-template-columns: 1fr; } }
/* Misma altura exacta en los 3 campos (evita el desalineado con el input date) */
.est-row2 .est-input, .est-row2 .est-drop-summary { height: 40px; box-sizing: border-box; }
.est-row2 .est-drop-summary { padding-top: 0; padding-bottom: 0; }

/* Desplegable multi-selección (objetivos / segmentos) */
.est-drop-box { position: relative; }
.est-drop-summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; text-transform: none; letter-spacing: normal; font-weight: 400; }
.est-drop-summary::-webkit-details-marker { display: none; }
.est-drop-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.est-drop-summary::after { content: '▾'; color: var(--text-muted); font-size: 11px; margin-left: 8px; flex-shrink: 0; }
.est-drop-empty .est-drop-text { color: var(--text-muted); }
.est-drop-list { position: absolute; z-index: 30; left: 0; right: 0; margin-top: 5px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 34px rgba(0,0,0,0.32); padding: 6px; max-height: 280px; overflow: auto; }
.est-drop-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.est-drop-item:hover { background: var(--bg-hover); }
.est-drop-item.on { background: var(--accent-ring); }
.est-drop-check { width: 18px; height: 18px; flex-shrink: 0; border: 1.5px solid var(--border); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.est-drop-item.on .est-drop-check { background: var(--accent); border-color: var(--accent); }
.est-drop-label { font-size: 14px; color: var(--text-primary); }

/* Tarjeta colapsable (Indicadores de éxito) */
.est-collapse > summary { list-style: none; cursor: pointer; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.est-collapse > summary::-webkit-details-marker { display: none; }
.est-collapse > summary::before { content: '▸'; color: var(--text-muted); transition: transform .15s; }
.est-collapse[open] > summary::before { transform: rotate(90deg); }
.est-collapse-n { font-size: 12px; font-weight: 600; background: var(--bg-hover); color: var(--text-secondary); border-radius: 999px; padding: 1px 8px; }
.est-collapse-body { margin-top: 14px; }

.est-del { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 5px; border-radius: var(--r-sm); display: inline-flex; flex-shrink: 0; transition: color .15s, background .15s; }
.est-del:hover { color: var(--red); background: var(--red-soft); }
.est-dup { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 5px; border-radius: var(--r-sm); display: inline-flex; flex-shrink: 0; transition: color .15s, background .15s; }
.est-dup:hover { color: var(--accent); background: var(--bg-hover); }

/* Chips multi (objetivos / segmentos) */
.est-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.est-chip {
  background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s, color .12s;
}
.est-chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.est-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-light); font-weight: 600; }

/* KPIs */
.kpi-edit-head, .kpi-edit-row { display: grid; grid-template-columns: 1.6fr 90px 90px 1.1fr 32px; gap: 8px; align-items: center; }
.kpi-edit-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; padding: 0 2px 6px; }
.kpi-edit-row { margin-bottom: 8px; }
.est-input[readonly] { background: var(--bg-card); color: var(--text-secondary); cursor: default; }
/* Celda "Alcanzado" automática: número + % + mini barra */
.kpi-alc { display: flex; flex-direction: column; gap: 4px; }
.kpi-alc-top { font-size: 14px; font-variant-numeric: tabular-nums; }
.kpi-alc-top b { font-weight: 700; }
.kpi-pct { font-size: 11.5px; color: var(--text-muted); margin-left: 2px; }
.kpi-mini { height: 5px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.kpi-mini-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.est-add { background: none; border: 1px dashed var(--border-strong); color: var(--accent-light); font-size: 13px; padding: 9px 14px; cursor: pointer; border-radius: var(--r-sm); width: 100%; margin-top: 4px; transition: background .12s; }
.est-add:hover { background: var(--bg-hover); }

/* Tácticos */
.tac-list { display: flex; flex-direction: column; gap: 8px; }
.tac-row { display: flex; align-items: flex-start; gap: 14px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-secondary); }
.tac-row.tac-done { opacity: 0.6; }
.tac-main { flex: 1; min-width: 0; }
.tac-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tac-row.tac-done .tac-name { text-decoration: line-through; }
.tac-tag { font-size: 10px; color: var(--accent-light); border: 1px solid var(--accent-light); border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.tac-prio { font-size: 10px; border: 1px solid; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.tac-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }
.tac-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tac-link { color: var(--accent-light); cursor: pointer; }
.tac-link:hover { text-decoration: underline; }
.tac-link-warn { color: var(--yellow); cursor: default; }
.tac-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 230px; }
/* Estado clickeable con aspecto de "pill" gris (igual que el estado mostrado en una
   tarjeta), sin la flecha nativa del select. Un clic despliega y cambia el estado. */
.tac-estado-sel {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: var(--bg-hover); border: 1px solid transparent; color: var(--text-secondary);
  padding: 5px 13px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  outline: none; font-family: inherit; cursor: pointer; text-align: center;
}
.tac-estado-sel:hover { background: var(--border); color: var(--text-primary); }
.tac-estado-sel:focus { box-shadow: 0 0 0 2px var(--accent-ring); }
.tac-estado-mirror { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--bg-hover); color: var(--text-secondary); }
.tac-estado-mirror.done { background: var(--green-soft); color: var(--green); }
.tac-convertir {
  background: transparent; color: var(--green); border: 1px solid var(--green); padding: 6px 11px;
  border-radius: var(--r-sm); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
.tac-convertir:hover { background: var(--green-soft); }

@media (max-width: 900px) {
  .est-layout { grid-template-columns: 1fr; }
  .kpi-edit-head { display: none; }
  .kpi-edit-row { grid-template-columns: 1fr 1fr; }
  .tac-row { flex-direction: column; }
  .tac-side { max-width: none; justify-content: flex-start; }
}

/* ════════════════ Pestañas de Estrategia ════════════════ */
.est-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.est-tab { background: none; border: none; padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s; }
.est-tab:hover { color: var(--text-primary); }
.est-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ════════════════ Notas estilo Google Keep ════════════════ */
.keep-wrap { max-width: 1100px; margin: 0 auto; }

.keep-composer { max-width: 600px; margin: 0 auto 28px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.07); }
.keep-c-title { width: 100%; border: none; background: transparent; font-size: 15px; font-weight: 600; color: var(--text-primary); outline: none; padding: 4px 0; font-family: inherit; }
.keep-c-body { width: 100%; border: none; background: transparent; font-size: 14px; color: var(--text-primary); outline: none; resize: none; padding: 4px 0; font-family: inherit; line-height: 1.55; overflow: hidden; }
.keep-c-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.keep-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.keep-dot { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.18); cursor: pointer; padding: 0; transition: transform .1s; }
.keep-dot:hover { transform: scale(1.15); }
.keep-dot.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.keep-add { padding: 6px 18px; font-size: 13px; }

.keep-section { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-muted); margin: 8px 4px 10px; }
.keep-grid { columns: 230px; column-gap: 14px; margin-bottom: 22px; }
.keep-note { break-inside: avoid; width: 100%; display: inline-block; margin: 0 0 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px 8px; cursor: pointer; position: relative; transition: box-shadow .12s; }
.keep-note:hover { box-shadow: 0 3px 14px rgba(0,0,0,0.14); }
.keep-note-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; word-break: break-word; padding-right: 22px; }
.keep-note-body { font-size: 13.5px; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.keep-pin { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 3px; border-radius: 6px; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.keep-note:hover .keep-pin { opacity: 1; }
.keep-pin.on { opacity: 1; color: var(--accent); }
.keep-pin:hover { background: rgba(0,0,0,0.07); }
.keep-note-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; opacity: 0; transition: opacity .12s; gap: 8px; }
.keep-note:hover .keep-note-foot { opacity: 1; }
.keep-note-foot .keep-dot { width: 16px; height: 16px; }
.keep-icon-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.keep-icon-btn:hover { color: var(--red); background: rgba(0,0,0,0.06); }
.keep-empty { text-align: center; color: var(--text-muted); font-size: 14px; padding: 44px 0; }

/* Editor (dentro del modal) */
.keep-editor { display: flex; flex-direction: column; }
.keep-editor .keep-c-body { min-height: 150px; max-height: 50vh; overflow: auto; }
.keep-editor-acts { display: flex; gap: 8px; align-items: center; }

/* Paleta de colores (claro). El mismo .knc-* pinta tarjeta, composer, editor y su punto. */
.knc-default { background: var(--bg-card); }
.knc-red     { background: #faafa8; }
.knc-orange  { background: #f8c99b; }
.knc-yellow  { background: #fdf3a8; }
.knc-green   { background: #d7f5c4; }
.knc-teal    { background: #c8f4ec; }
.knc-blue    { background: #d3ebf8; }
.knc-purple  { background: #e6d6fb; }
.knc-pink    { background: #fbdcec; }
.knc-gray    { background: #eceef0; }
/* En tarjetas/composer con color, el texto se mantiene oscuro y el borde se difumina. */
.keep-note:not(.knc-default), .keep-composer:not(.knc-default), .keep-editor:not(.knc-default) { border-color: rgba(0,0,0,0.08); }

/* Texto enriquecido: cuerpo editable + barra de formato */
.keep-rich { min-height: 26px; outline: none; }
.keep-c-body[contenteditable]:empty:before { content: attr(data-ph); color: var(--text-muted); pointer-events: none; }
.keep-editor-body { min-height: 150px; max-height: 50vh; overflow: auto; }
.keep-toolrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.keep-tools { display: flex; gap: 2px; }
.keep-tool { min-width: 28px; height: 28px; padding: 0 7px; border: none; background: none; border-radius: 6px; cursor: pointer; color: var(--text-secondary); font-size: 14px; line-height: 1; }
.keep-tool:hover { background: rgba(0,0,0,0.08); color: var(--text-primary); }
.keep-tool em { font-style: italic; }

/* Formato dentro de la nota (tarjeta y editor) */
.keep-note-body h1, .keep-note-body h2, .keep-note-body h3,
.keep-c-body h1, .keep-c-body h2, .keep-c-body h3 { font-size: 14.5px; font-weight: 700; margin: 6px 0 2px; line-height: 1.3; }
.keep-note-body ul, .keep-note-body ol,
.keep-c-body ul, .keep-c-body ol { margin: 4px 0 4px 20px; padding: 0; }
.keep-note-body li, .keep-c-body li { margin: 2px 0; }

@media (max-width: 560px) { .keep-grid { columns: 1; } }
