/*
 * FireDOMUS - sistema de gráficas y diagramas (tema claro, apto para imprimir).
 * Todas las herramientas comparten estos tokens: cambiar un color aquí cambia todas las gráficas.
 */
:root {
    --fd-ink: #0f172a;          /* texto principal, trazos de muros y ejes */
    --fd-muted: #475569;        /* etiquetas de ejes y cotas */
    --fd-faint: #94a3b8;
    --fd-grid: #e2e8f0;         /* cuadrícula */
    --fd-panel: #f8fafc;        /* fondo del recuadro de la gráfica */
    --fd-card: #ffffff;
    --fd-border: #dbe2ea;
    --fd-brand: #AF2B2E;        /* rojo FireDOMUS: límites normativos y avisos */
    --fd-blue: #1d4ed8;         /* dato principal (curvas, agua) */
    --fd-blue-soft: rgba(29, 78, 216, 0.10);
    --fd-teal: #0d9488;         /* punto de diseño / cumple */
    --fd-amber: #d97706;        /* punto de comprobación / atención */
    --fd-red-soft: rgba(175, 43, 46, 0.09);
    --fd-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --fd-head: 'Montserrat', 'Inter', system-ui, sans-serif;
}

.fd-figure {
    background: var(--fd-card);
    border: 1px solid var(--fd-border);
    border-radius: 12px;
    padding: 14px 16px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.fd-figure-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 8px;
}
.fd-figure-title { font: 700 15px/1.3 var(--fd-head); color: var(--fd-ink); margin: 0; }
.fd-figure-sub { font: 400 12.5px/1.4 var(--fd-font); color: var(--fd-muted); margin: 2px 0 0; }
.fd-badge {
    font: 700 11.5px/1 var(--fd-font); letter-spacing: .03em; text-transform: uppercase;
    padding: 5px 9px; border-radius: 999px; white-space: nowrap;
    background: #eef2f7; color: var(--fd-muted);
}
.fd-badge.ok { background: rgba(13, 148, 136, .12); color: #0f766e; }
.fd-badge.warn { background: rgba(217, 119, 6, .14); color: #b45309; }
.fd-badge.bad { background: var(--fd-red-soft); color: var(--fd-brand); }

.fd-plot { position: relative; height: 360px; }
.fd-plot canvas { width: 100% !important; }
.fd-svg-wrap svg { display: block; width: 100%; height: auto; }

.fd-figure-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--fd-grid);
    font: 400 12px/1.4 var(--fd-font); color: var(--fd-muted);
}
.fd-figure-foot .fd-src { font-style: italic; }
.fd-actions button {
    font: 600 12px var(--fd-font); color: var(--fd-ink); background: #fff; border: 1px solid var(--fd-border);
    border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
.fd-actions button:hover { background: var(--fd-panel); }

/* Estados de una gráfica: cargando / error / sin datos */
.fd-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
    min-height: 240px; border: 1px dashed var(--fd-border); border-radius: 10px; background: var(--fd-panel);
    font: 400 13.5px/1.5 var(--fd-font); color: var(--fd-muted); padding: 20px;
}
.fd-state strong { color: var(--fd-ink); font-size: 14.5px; }
.fd-state.error { border-color: rgba(175, 43, 46, .35); background: #fff7f7; }
.fd-skeleton {
    min-height: 240px; border-radius: 10px;
    background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%;
    animation: fd-shimmer 1.3s ease infinite;
}
@keyframes fd-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .fd-skeleton { animation: none; } }
@media print { .fd-actions { display: none; } .fd-figure { box-shadow: none; break-inside: avoid; } }

/* Cabecera y estados de la tarjeta de figura (FDFigure) */
.fd-head-right { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fd-badge[hidden], .fd-status[hidden], .fd-plot[hidden], .fd-svg-wrap[hidden] { display: none !important; }
.fd-link { color: var(--fd-brand); font: 700 13px var(--fd-font); text-decoration: underline; }
.fd-status .fd-state { min-height: 260px; }
