﻿@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800&display=swap');

/* =========================================================
   VARIABLES GLOBALES – FARMANOVA CLARO
   ========================================================= */
:root {
    --sidebar: #626d7c;
    --bg: #eef2f7;
    --card-bg: #ffffff;
    --text: #0f172a;
    --muted: #6b7280;
    --blue: #0b5ed7;
    --shadow: 0 10px 24px rgba(15,23,42,.10);
}

/* Reset */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Sidebar layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ======================================
   SIDEBAR – OSCURO FINANCIERO (APLICA A TU <aside class="sidebar">)
   ====================================== */

/* ✅ tu template usa .sidebar (según DevTools) */
aside.sidebar,
.sidebar,
.app-sidebar {
    width: 260px;
    position: sticky;
    top: 0;
    height: 100vh;
    /* degradado */
    background: linear-gradient(180deg, #2f3540 0%, #252b34 55%, #1c222b 100%) !important;
    /* detalle premium */
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.05);
}

    /* brillo suave arriba */
    aside.sidebar::before,
    .sidebar::before,
    .app-sidebar::before {
        content: "";
        position: absolute;
        inset: 0;
        height: 120px;
        background: radial-gradient(closest-side at 25% 0%, rgba(255,255,255,.10), transparent 70%);
        pointer-events: none;
    }

/* 👇 IMPORTANTE: tu contenido real está dentro de .fn-sidebar
   La clase .sidebar (aside) NO tiene padding, el padding lo pone .fn-sidebar */
aside.sidebar,
.sidebar,
.app-sidebar {
    overflow: hidden;
}

/* Main */
.app-main {
    flex: 1;
    padding: 24px;
}

/* Dashboard page container */
.dash {
    max-width: 1200px;
    margin: 26px auto;
}

/* Header */
.dash-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.brand-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.header-text h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.1;
    font-weight: 800;
}

.header-text p {
    margin: 4px 0 0;
    color: var(--muted);
    font-weight: 500;
}

.btn-primary2 {
    margin-left: auto;
    background: var(--blue);
    border: none;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(11,94,215,.20);
    cursor: pointer;
}

    .btn-primary2:disabled {
        opacity: .65;
        cursor: not-allowed;
    }

/* Filters */
.filters {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.filter-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 12px 12px 10px;
    box-shadow: var(--shadow);
}

    .filter-card label {
        display: block;
        font-size: 12px;
        color: var(--muted);
        font-weight: 700;
        margin-bottom: 6px;
    }

.input {
    width: 100%;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(15,23,42,.12);
    padding: 0 12px;
    outline: none;
    background: #fff;
}

    .input:focus {
        border-color: rgba(11,94,215,.40);
        box-shadow: 0 0 0 3px rgba(11,94,215,.10);
    }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.kpi-title {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
}

.kpi-value {
    font-weight: 900;
    font-size: 28px;
    margin-top: 6px;
}

/* Charts */
.charts-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
}

.chart-card {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 12px;
}

.chart-title {
    font-weight: 800;
    margin-bottom: 10px;
}

.chart-wrap {
    height: 260px;
    width: 100%;
}

    .chart-wrap canvas {
        width: 100% !important;
        height: 100% !important;
    }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.10);
    background: rgba(15,23,42,.02);
    font-weight: 800;
    font-size: 11px;
    white-space: nowrap;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

/* Messages */
.msg {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15,23,42,.04);
    color: var(--muted);
    font-weight: 700;
}

    .msg.error {
        background: rgba(239,68,68,.08);
        color: #b91c1c;
    }

/* Table */
.table-wrap {
    margin-top: 16px;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table-title {
    font-weight: 800;
    margin-bottom: 10px;
}

/* Dashboard: tabla ancha */
.dash .table-wrap table {
    width: 100%;
    min-width: 1600px;
    border-collapse: collapse;
}

.dash .table-wrap th:first-child,
.dash .table-wrap td:first-child {
    position: sticky;
    left: 0;
    background: var(--card-bg);
    z-index: 2;
    box-shadow: 6px 0 10px rgba(15, 23, 42, 0.06);
}

.dash .table-wrap thead th:first-child {
    z-index: 3;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
    padding: 10px 10px;
    border-bottom: 1px solid rgba(15,23,42,.08);
    white-space: nowrap;
}

tbody td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(15,23,42,.06);
    vertical-align: middle;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 1100px) {
    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .filters {
        grid-template-columns: 1fr;
    }
}

/* Chart Legend */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-top: 10px;
    padding: 0 2px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #111;
    max-width: 220px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.06);
    flex: 0 0 auto;
}

.legend-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
