/* ==========================================
   KPIs & OKRs MODULE STYLES
   Sprint Demo — Sub-Prompt 1
   ========================================== */

/* ─── HEADER ESTRATÉGICO ─── */
.kpis-strategic-header {
    background: linear-gradient(135deg, var(--brand) 0%, #004488 100%);
    border-radius: 14px;
    padding: 24px 28px;
    color: white;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.kpis-strategic-header::before {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(0,173,239,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.kpis-strategic-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 6px;
    font-weight: 600;
}

.kpis-strategic-text {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.35;
    max-width: 640px;
}

.kpis-strategic-text strong {
    color: var(--brand-2);
    font-weight: 700;
}

.kpis-strategic-stats {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.kpis-stat-pill {
    background: rgba(255,255,255,0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,0.95);
}

.kpis-stat-pill .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
}

/* ─── HEALTH GAUGE ─── */
.kpis-health-gauge {
    position: relative;
    width: 160px; height: 160px;
    z-index: 1;
}

.kpis-health-gauge svg {
    transform: rotate(-90deg);
}

.kpis-gauge-bg { stroke: rgba(255,255,255,0.1); }

.kpis-gauge-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.kpis-gauge-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.kpis-gauge-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

/* ─── SUBTABS ─── */
.kpis-subtabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.kpis-subtab {
    padding: 10px 22px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpis-subtab:hover { color: var(--brand); }

.kpis-subtab.active {
    color: var(--brand);
    border-bottom-color: var(--brand-2);
}

.kpis-subtab .badge {
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.kpis-subtab.active .badge {
    background: var(--brand-2);
    color: white;
}

/* ─── EMPTY STATE ─── */
.kpis-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.kpis-empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.kpis-empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

.kpis-empty-state-text {
    font-size: 13px;
    max-width: 380px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ─── RESPONSIVE SP-1 ─── */
@media (max-width: 768px) {
    .kpis-strategic-header {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .kpis-health-gauge {
        margin: 0 auto;
    }
    .kpis-strategic-stats {
        justify-content: center;
    }
}

/* ==========================================
   SP-2: Filters, Cards, Wizard, Grid
   ========================================== */

/* ─── STEERING BANNER ─── */
.steering-preview-banner {
    display: flex; align-items: center; gap: 10px;
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 10px; padding: 10px 16px; margin-bottom: 16px;
    font-size: 12px; color: #1e40af;
}

/* ─── FILTERS BAR ─── */
.kpis-filters-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.kpis-filters-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.kpi-chip {
    padding: 5px 12px; border-radius: 20px; border: 1px solid #e2e8f0;
    background: white; font-size: 11px; font-weight: 600; color: #64748b;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
    display: flex; align-items: center; gap: 4px;
}
.kpi-chip:hover { border-color: var(--brand-2); color: var(--brand); }
.kpi-chip.active { background: var(--brand); color: white; border-color: var(--brand); }
.chip-count { font-size: 9px; opacity: 0.7; }
.btn-add-kpi {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--brand); color: white;
    border: none; border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-add-kpi:hover { background: #004488; transform: translateY(-1px); }

/* ─── KPI GRID ─── */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ─── KPI CARD ─── */
.kpi-card {
    background: white; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 16px 18px; position: relative; transition: all 0.2s;
    cursor: default;
}
.kpi-card:hover { border-color: var(--brand-2); box-shadow: 0 4px 16px rgba(0,51,102,0.08); transform: translateY(-2px); }
.kpi-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kpi-category-tag { font-size: 10px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.kpi-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kpi-name { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 10px; line-height: 1.3; min-height: 36px; }
.kpi-value-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--brand); }
.kpi-trend { font-size: 12px; font-weight: 600; }
.kpi-trend.trend-up { color: var(--ok); }
.kpi-trend.trend-down { color: var(--nok); }
.kpi-sparkline { height: 45px; margin: 6px 0; }
.kpi-sparkline canvas { width: 100% !important; }
.kpi-meta { display: flex; justify-content: space-between; font-size: 11px; color: #94a3b8; margin-top: 4px; }
.kpi-source-badge {
    display: inline-block; margin-top: 8px; padding: 2px 8px;
    background: #eff6ff; color: #3b82f6; border-radius: 10px; font-size: 10px; font-weight: 600;
}
.kpi-delete-btn {
    position: absolute; top: 10px; right: 10px; background: none; border: none;
    font-size: 14px; cursor: pointer; opacity: 0; transition: opacity 0.2s; padding: 4px;
}
.kpi-card:hover .kpi-delete-btn { opacity: 0.6; }
.kpi-delete-btn:hover { opacity: 1 !important; }

/* ─── WIZARD MODAL ─── */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,20,40,0.6); z-index: 1100; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
}
.wizard-modal {
    background: white; border-radius: 16px; width: 95%; max-width: 620px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); overflow: hidden;
}
.wizard-header {
    background: linear-gradient(135deg, var(--brand) 0%, #004488 100%);
    padding: 20px 24px; color: white; position: relative;
}
.wizard-title { font-size: 18px; font-weight: 700; }
.wizard-subtitle { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 2px; }
.wizard-close {
    position: absolute; top: 16px; right: 16px; background: none; border: none;
    color: rgba(255,255,255,0.7); font-size: 20px; cursor: pointer;
}
.wizard-close:hover { color: white; }

/* ─── WIZARD STEPPER ─── */
.wizard-stepper { display: flex; gap: 6px; padding: 16px 24px; background: #f8fafc; }
.step-pill {
    flex: 1; height: 4px; border-radius: 2px; background: #e2e8f0; transition: all 0.3s;
}
.step-pill.active { background: var(--brand-2); }
.step-pill.done { background: var(--ok); }

/* ─── WIZARD BODY ─── */
.wizard-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 300px; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.step-question { font-size: 16px; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.step-hint { font-size: 12px; color: #94a3b8; margin-bottom: 16px; }

/* ─── CHOICE CARDS ─── */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice-grid-3 { grid-template-columns: repeat(3, 1fr); }
.choice-grid-small { grid-template-columns: repeat(3, 1fr); }
.choice-card {
    border: 2px solid #e2e8f0; border-radius: 10px; padding: 14px; cursor: pointer;
    text-align: center; transition: all 0.15s;
}
.choice-card:hover { border-color: var(--brand-2); background: #f8fafc; }
.choice-card.selected { border-color: var(--brand-2); background: #eff6ff; }
.choice-card-sm { padding: 10px; }
.choice-icon { font-size: 24px; margin-bottom: 6px; }
.choice-label { font-size: 12px; font-weight: 600; color: #1e293b; }
.choice-desc { font-size: 10px; color: #94a3b8; margin-top: 2px; }

/* ─── CATALOG LIST ─── */
.catalog-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.catalog-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all 0.15s;
}
.catalog-item:hover { border-color: var(--brand-2); background: #f8fafc; }
.catalog-item.selected { border-color: var(--brand-2); background: #eff6ff; }
.catalog-icon { font-size: 20px; flex-shrink: 0; }
.catalog-text { flex: 1; }
.catalog-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.catalog-desc { font-size: 11px; color: #94a3b8; }
.cat-badge {
    padding: 2px 8px; background: #dbeafe; color: #2563eb; border-radius: 10px;
    font-size: 9px; font-weight: 700; text-transform: uppercase;
}

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 4px; display: block; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 13px; font-family: inherit; color: #1e293b; box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--brand-2); }
.form-textarea { min-height: 60px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ─── SUMMARY BOX ─── */
.summary-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 20px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.summary-row:last-child { border-bottom: none; }
.summary-label { color: #64748b; }
.summary-value { color: #1e293b; font-weight: 500; text-align: right; }

/* ─── WIZARD FOOTER ─── */
.wizard-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}
.btn-wizard {
    padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit; border: none; transition: all 0.15s;
}
.btn-wizard.btn-primary { background: var(--brand); color: white; }
.btn-wizard.btn-primary:hover { background: #004488; }
.btn-wizard.btn-secondary { background: white; color: #64748b; border: 1px solid #e2e8f0; }
.btn-wizard.btn-secondary:hover { background: #f1f5f9; }
.btn-wizard:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── SP-2 RESPONSIVE ─── */
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .wizard-modal { width: 98%; max-height: 95vh; }
    .choice-grid, .choice-grid-3, .choice-grid-small { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .kpis-filters-bar { flex-direction: column; align-items: stretch; }
}

/* ==========================================
   SP-3: Detail Panel + OKRs
   ========================================== */

/* ─── DETAIL PANEL ─── */
.detail-panel-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,20,40,0.4); z-index: 1200;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.detail-panel-overlay.active { opacity: 1; pointer-events: auto; }
.detail-panel {
    position: fixed; top: 0; right: -520px; width: 500px; height: 100%;
    background: white; z-index: 1201; box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column; overflow: hidden;
}
.detail-panel.active { right: 0; }
.detail-panel-header {
    background: linear-gradient(135deg, var(--brand) 0%, #004488 100%);
    padding: 20px 24px; color: white; position: relative;
}
.detail-panel-category { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.6); margin-bottom: 4px; }
.detail-panel-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
.detail-panel-meta { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.detail-panel-close {
    position: absolute; top: 16px; right: 16px; background: none; border: none;
    color: rgba(255,255,255,0.7); font-size: 20px; cursor: pointer;
}
.detail-panel-close:hover { color: white; }
.detail-panel-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

.detail-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-stat { background: #f8fafc; border-radius: 10px; padding: 14px; text-align: center; }
.detail-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin-bottom: 4px; }
.detail-stat-value { font-size: 22px; font-weight: 700; color: var(--brand); }

.detail-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: #475569; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;
}
.detail-chart-container { height: 220px; margin-bottom: 24px; }

.measurement-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.measurement-table th { background: #f8fafc; padding: 8px; text-align: left; font-weight: 600; color: #475569; border-bottom: 2px solid #e2e8f0; }
.measurement-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; color: #1e293b; }
.btn-add-measurement {
    padding: 4px 12px; background: var(--brand); color: white; border: none; border-radius: 6px;
    font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-add-measurement:hover { background: #004488; }

/* ─── OKR CARDS ─── */
.okr-grid { display: flex; flex-direction: column; gap: 16px; }
.okr-card {
    background: white; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 20px; position: relative; transition: all 0.2s;
}
.okr-card:hover { border-color: var(--brand-2); box-shadow: 0 4px 16px rgba(0,51,102,0.06); }
.okr-card-header { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 4px; }
.okr-action-btn { background: none; border: none; cursor: pointer; font-size: 14px; opacity: 0.4; padding: 2px 4px; }
.okr-action-btn:hover { opacity: 1; }
.okr-objective { font-size: 16px; font-weight: 700; color: #1e293b; margin-bottom: 6px; line-height: 1.4; }
.okr-narrative { font-size: 12px; color: #64748b; margin-bottom: 10px; line-height: 1.5; }
.okr-meta-row { display: flex; gap: 16px; font-size: 11px; color: #94a3b8; margin-bottom: 16px; flex-wrap: wrap; }

.kr-list { display: flex; flex-direction: column; gap: 10px; }
.kr-item { border-top: 1px solid #f1f5f9; padding-top: 10px; }
.kr-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.kr-text { font-size: 13px; color: #1e293b; font-weight: 500; flex: 1; }
.kr-status-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #f8fafc; }
.kr-bar-bg { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin: 4px 0; }
.kr-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.kr-values { display: flex; justify-content: space-between; font-size: 10px; color: #94a3b8; }

/* ─── OKR MODAL ─── */
.okr-modal {
    background: white; border-radius: 16px; width: 95%; max-width: 700px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); overflow: hidden;
}
.okr-modal-header {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    padding: 20px 24px; color: white; position: relative;
}
.okr-modal-title { font-size: 18px; font-weight: 700; }
.okr-modal-close {
    position: absolute; top: 16px; right: 16px; background: none; border: none;
    color: rgba(255,255,255,0.7); font-size: 20px; cursor: pointer;
}
.okr-modal-close:hover { color: white; }
.okr-modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.okr-modal-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: #475569; margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0;
}
.okr-modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 24px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}

.kr-form-row {
    display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px;
}
.kr-remove-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 8px 4px; opacity: 0.5; flex-shrink: 0; }
.kr-remove-btn:hover { opacity: 1; }
.btn-add-kr {
    display: block; width: 100%; padding: 8px; background: #f8fafc; border: 1px dashed #cbd5e1;
    border-radius: 8px; color: #64748b; font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: inherit; margin-top: 4px;
}
.btn-add-kr:hover { background: #eff6ff; border-color: var(--brand-2); color: var(--brand); }

/* ─── SP-3 RESPONSIVE ─── */
@media (max-width: 768px) {
    .detail-panel { width: 100%; right: -100%; }
    .okr-modal { width: 98%; }
    .kr-form-row { flex-wrap: wrap; }
    .detail-stat-row { grid-template-columns: 1fr; }
}

/* ==========================================
   SP-4: Steering Mini-Grid + Demo Button
   ========================================== */

/* ─── STEERING MINI GRID ─── */
.st-kpis-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.st-kpi-mini {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 14px; cursor: pointer; transition: all 0.2s;
}
.st-kpi-mini:hover { border-color: var(--brand-2); box-shadow: 0 2px 10px rgba(0,51,102,0.08); transform: translateY(-1px); }
.st-kpi-mini-cat { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; font-weight: 600; margin-bottom: 4px; }
.st-kpi-mini-name { font-size: 12px; font-weight: 600; color: #1e293b; margin-bottom: 6px; line-height: 1.3; min-height: 30px; }
.st-kpi-mini-val { font-size: 20px; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 8px; }
.st-kpi-mini-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.st-kpi-mini-target { font-size: 10px; color: #94a3b8; margin-top: 4px; }

/* ─── DEMO BUTTON ─── */
.btn-load-demo {
    padding: 6px 14px; background: white; color: #64748b; border: 1px dashed #cbd5e1;
    border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: all 0.15s;
}
.btn-load-demo:hover { border-color: var(--brand-2); color: var(--brand); background: #eff6ff; }

/* ─── SP-4 RESPONSIVE ─── */
@media (max-width: 768px) {
    .st-kpis-mini-grid { grid-template-columns: 1fr; }
}
