﻿* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;
    background: #f5f7f8;
    color: #1f2937;
}

a {
    text-decoration: none;
    color: inherit;
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        linear-gradient(
            135deg,
            #eef5f1 0%,
            #f7f9fa 60%,
            #edf3f0 100%
        );
}

.login-wrapper {
    width: 100%;
    max-width: 430px;
}

.login-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 42px;
    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.10);
}

.login-brand {
    text-align: center;
    margin-bottom: 34px;
}

.login-logo {
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #245c43;
    color: white;

    font-size: 31px;
    font-weight: 700;
}

.login-brand h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.login-brand p {
    margin: 0;
    color: #6b7280;
    line-height: 1.5;
}

.login-error {
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 9px;

    background: #fef2f2;
    border: 1px solid #fecaca;

    color: #991b1b;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 44px;

    padding: 0 12px;

    border:
        1px solid #d1d5db;

    border-radius: 8px;

    background: white;
    font-size: 15px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #39785b;

    box-shadow:
        0 0 0 3px
        rgba(57, 120, 91, 0.12);
}

.btn-primary {
    height: 46px;

    border: none;
    border-radius: 9px;

    background: #245c43;
    color: #ffffff;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;
}

.btn-primary:hover {
    background: #1d4c37;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {
    height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background: #ffffff;

    border-bottom:
        1px solid #e5e7eb;

    position: sticky;
    top: 0;

    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 11px;

    background: #245c43;
    color: white;

    font-size: 22px;
    font-weight: 700;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
}

.brand-subtitle {
    margin-top: 2px;

    font-size: 12px;
    color: #6b7280;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.company-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.company-selector label {
    font-size: 12px;
    color: #6b7280;
}

.company-selector select {
    min-width: 190px;

    height: 36px;

    padding: 0 10px;

    border:
        1px solid #d1d5db;

    border-radius: 7px;

    background: white;
}

.user-box {
    border-left:
        1px solid #e5e7eb;

    padding-left: 22px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    margin-top: 2px;

    font-size: 11px;
    color: #6b7280;
}

.logout-link {
    font-size: 14px;
    color: #6b7280;
}

.logout-link:hover {
    color: #111827;
}


/* =========================================================
   APP
   ========================================================= */

.app-shell {
    display: flex;

    min-height:
        calc(100vh - 72px);
}

.sidebar {
    width: 235px;

    flex-shrink: 0;

    padding: 22px 14px;

    background: #ffffff;

    border-right:
        1px solid #e5e7eb;
}

.nav-section {
    margin:
        22px 12px
        8px;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.08em;

    color: #9ca3af;

    text-transform: uppercase;
}

.nav-item {
    display: block;

    padding:
        10px 12px;

    margin-bottom: 3px;

    border-radius: 7px;

    font-size: 14px;

    color: #4b5563;
}

.nav-item:hover {
    background: #f3f6f4;
    color: #245c43;
}

.nav-item.active {
    background: #e9f2ed;
    color: #245c43;

    font-weight: 600;
}

.main-content {
    flex: 1;

    min-width: 0;

    padding: 30px;
}


/* =========================================================
   DASHBOARD
   ========================================================= */

.page-header {
    display: flex;
    justify-content: space-between;

    margin-bottom: 26px;
}

.page-header h1 {
    margin: 0;

    font-size: 26px;
}

.page-header p {
    margin:
        6px 0 0;

    color: #6b7280;
}

.kpi-grid {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 24px;
}

.kpi-card {
    padding: 20px;

    border-radius: 12px;

    background: #ffffff;

    border:
        1px solid #e8eaed;
}

.kpi-label {
    margin-bottom: 10px;

    font-size: 12px;
    color: #6b7280;
}

.kpi-value {
    font-size: 25px;
    font-weight: 700;

    color: #111827;
}

.dashboard-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 20px;
}

.panel {
    min-height: 300px;

    background: #ffffff;

    border:
        1px solid #e8eaed;

    border-radius: 12px;
}

.panel-header {
    padding: 18px 20px;

    border-bottom:
        1px solid #edf0f2;

    font-size: 15px;
    font-weight: 600;
}

.empty-state {
    min-height: 230px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 30px;

    text-align: center;

    color: #6b7280;
}

.empty-state span {
    display: block;

    margin-top: 9px;

    max-width: 310px;

    font-size: 13px;

    color: #9ca3af;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {

    .kpi-grid {
        grid-template-columns:
            repeat(3, 1fr);
    }

}

@media (max-width: 800px) {

    .topbar {
        height: auto;

        padding: 14px 18px;

        flex-direction: column;
        align-items: flex-start;

        gap: 14px;
    }

    .topbar-actions {
        width: 100%;

        flex-wrap: wrap;

        gap: 12px;
    }

    .user-box {
        border-left: none;
        padding-left: 0;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;

        border-right: none;
        border-bottom:
            1px solid #e5e7eb;
    }

    .main-content {
        padding: 20px;
    }

    .kpi-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns:
            1fr;
    }

}

@media (max-width: 500px) {

    .login-card {
        padding: 28px 22px;
    }

    .kpi-grid {
        grid-template-columns:
            1fr;
    }

}

.company-logo {
    width: 54px;
    height: 54px;

    object-fit: contain;

    background: #ffffff;

    border-radius: 10px;

    padding: 3px;
}

/* =========================================================
   TABLAS Y MANTENIMIENTOS
   ========================================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 13px 16px;

    text-align: left;

    background: #f8faf9;

    border-bottom:
        1px solid #e5e7eb;

    color: #6b7280;

    font-size: 12px;
    font-weight: 600;
}

.data-table td {
    padding: 14px 16px;

    border-bottom:
        1px solid #edf0f2;

    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #fafcfb;
}

.actions-column {
    text-align: right !important;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.badge {
    display: inline-block;

    padding: 5px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 600;
}

.badge-active {
    background: #e8f5ed;
    color: #21633f;
}

.badge-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-auto {
    width: auto;
    padding: 0 18px;
}

.btn-secondary,
.btn-small {
    border:
        1px solid #d1d5db;

    border-radius: 7px;

    background: #ffffff;

    color: #374151;

    cursor: pointer;
}

.btn-secondary {
    height: 42px;
    padding: 0 18px;
}

.btn-small {
    height: 32px;
    padding: 0 11px;

    font-size: 12px;
}

.btn-small:hover,
.btn-secondary:hover {
    background: #f5f7f8;
}

.btn-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.btn-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.empty-table {
    padding: 40px !important;

    text-align: center;

    color: #9ca3af;
}


/* =========================================================
   ALERTAS
   ========================================================= */

.alert-success,
.alert-error {
    margin-bottom: 18px;

    padding: 13px 16px;

    border-radius: 8px;

    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}


/* =========================================================
   MODAL
   ========================================================= */

.modal-backdrop {
    position: fixed;

    inset: 0;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(17, 24, 39, 0.40);

    z-index: 1000;
}

.modal-backdrop.show {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 620px;

    background: white;

    border-radius: 14px;

    box-shadow:
        0 24px 60px
        rgba(0, 0, 0, 0.18);

    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 22px;

    border-bottom:
        1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;

    font-size: 18px;
}

.modal-close {
    width: 34px;
    height: 34px;

    border: none;

    border-radius: 7px;

    background: transparent;

    color: #6b7280;

    font-size: 24px;

    cursor: pointer;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    padding: 16px 22px;

    background: #f9fafb;

    border-top:
        1px solid #e5e7eb;
}

.form-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 18px;
}


@media (max-width: 600px) {

    .form-grid {
        grid-template-columns:
            1fr;
    }

    .page-header {
        gap: 16px;
        flex-direction: column;
    }

}


.form-group-full {
    grid-column: 1 / -1;
}

.field-help {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.4;
    color: #9ca3af;
}


.production-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 220px));
    gap: 16px;
    margin-bottom: 20px;
}

.note-indicator {
    display: inline-block;
    margin-right: 6px;
    padding: 4px 7px;

    border-radius: 6px;

    background: #eef2ff;
    color: #4338ca;

    font-size: 11px;

    cursor: help;
}


@media (max-width: 600px) {

    .production-summary {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   LOGO EMPRESA - AJUSTE DE TAMAÑO
   ========================================================= */

.company-logo {
    width: 72px;
    height: 72px;

    object-fit: contain;

    flex-shrink: 0;

    background: transparent;

    border-radius: 8px;

    padding: 0;
}

.topbar {
    min-height: 92px;
    height: 92px;
}

.app-shell {
    min-height:
        calc(100vh - 92px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle {
    margin-top: 3px;
    font-size: 13px;
}


@media (max-width: 800px) {

    .topbar {
        height: auto;
        min-height: 92px;
    }

    .company-logo {
        width: 64px;
        height: 64px;
    }

}


/* =========================================================
   PRODUCCIÓN V2
   ========================================================= */

.filter-panel {
    margin-bottom: 20px;

    padding: 18px 20px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.filter-title {
    margin-bottom: 14px;

    font-size: 14px;
    font-weight: 700;
}

.production-filters {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(130px, 1fr))
        auto;

    gap: 12px;

    align-items: end;
}

.filter-field {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.filter-field label {
    font-size: 11px;
    font-weight: 600;

    color: #6b7280;
}

.filter-field input,
.filter-field select {
    width: 100%;
    height: 39px;

    padding: 0 9px;

    background: #ffffff;

    border: 1px solid #d1d5db;
    border-radius: 7px;

    font-size: 13px;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;

    border-color: #39785b;

    box-shadow:
        0 0 0 3px
        rgba(57, 120, 91, 0.10);
}

.filter-actions {
    display: flex;
    gap: 7px;

    align-items: center;
}

.filter-actions .btn-primary,
.filter-clear {
    height: 39px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-clear {
    padding: 0 14px;
}


.production-kpi-grid {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 20px;
}


.production-section {
    margin-bottom: 20px;
}


.panel-header {
    display: flex;

    justify-content: space-between;
    align-items: center;
}

.panel-header-note {
    font-size: 11px;
    font-weight: 400;

    color: #9ca3af;
}


.source-badge {
    display: inline-block;

    padding: 4px 7px;

    border-radius: 6px;

    background: #f3f4f6;

    color: #4b5563;

    font-size: 10px;
    font-weight: 700;
}

.source-test {
    background: #fff7ed;
    color: #9a3412;
}

.source-manual {
    background: #eff6ff;
    color: #1d4ed8;
}


@media (max-width: 1450px) {

    .production-filters {
        grid-template-columns:
            repeat(4, minmax(140px, 1fr));
    }

    .production-kpi-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


@media (max-width: 850px) {

    .production-filters {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .production-kpi-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 520px) {

    .production-filters {
        grid-template-columns: 1fr;
    }

    .production-kpi-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   GRÁFICAS DE PRODUCCIÓN
   ========================================================= */

.production-chart-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 20px;
}

.chart-panel {
    min-width: 0;
}

.chart-container {
    position: relative;

    width: 100%;
    height: 330px;

    padding: 18px 20px 22px;
}


@media (max-width: 950px) {

    .production-chart-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   DASHBOARD V2
   ========================================================= */

.dashboard-secondary-kpis {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 250px));

    gap: 16px;

    margin-bottom: 20px;
}


@media (max-width: 700px) {

    .dashboard-secondary-kpis {
        grid-template-columns: 1fr;
    }

}


.badge-development {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-harvest {
    background: #ecfdf5;
    color: #166534;
}


/* =========================================================
   NÓMINA V2
   ========================================================= */

.payroll-kpi-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 20px;
}

.kpi-development {
    color: #2563eb;
}

.kpi-harvest {
    color: #166534;
}

.kpi-subtext {
    margin-top: 4px;

    color: #9ca3af;

    font-size: 11px;
}


@media (max-width: 1200px) {

    .payroll-kpi-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 600px) {

    .payroll-kpi-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   COSTOS INTEGRALES
   ========================================================= */

.cost-kpi-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 20px;
}

.cost-total-card {
    border:
        2px solid #245c43;

    background: #f5faf7;
}

.cost-total-card .kpi-value {
    color: #245c43;
}

.cost-breakdown-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 20px;
}

.cost-breakdown-body {
    padding: 18px 20px;
}

.cost-line {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 11px 0;

    border-bottom:
        1px solid #edf0f2;

    font-size: 14px;
}

.cost-line:last-child {
    border-bottom: none;
}

.cost-line-total {
    margin-top: 4px;

    padding-top: 15px;

    font-size: 15px;

    color: #245c43;
}


@media (max-width: 1200px) {

    .cost-kpi-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 750px) {

    .cost-kpi-grid,
    .cost-breakdown-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   COMPARATIVO SEMANAL
   ========================================================= */

.weekly-kpi-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 20px;
}

.weekly-chart-grid {
    display: grid;

    grid-template-columns: 1fr;

    gap: 20px;

    margin-bottom: 20px;
}

.weekly-chart-large {
    height: 410px;
}


.metric-positive {
    color: #15803d;
}

.metric-negative {
    color: #dc2626;
}

.metric-warning {
    color: #d97706;
}


.compliance-badge {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 70px;

    padding: 5px 8px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
}


.compliance-good {
    background: #dcfce7;
    color: #166534;
}

.compliance-warning {
    background: #fef3c7;
    color: #92400e;
}

.compliance-low {
    background: #fee2e2;
    color: #991b1b;
}


@media (max-width: 1200px) {

    .weekly-kpi-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 600px) {

    .weekly-kpi-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   CURVA DIARIA SEMANAL
   ========================================================= */

.weekly-curve-panel {
    margin-bottom: 20px;
}

.weekly-curve-summary {
    display: flex;

    gap: 24px;

    align-items: center;

    padding:
        12px 20px 0;

    font-size: 12px;

    color: #64748b;
}

.curve-dot {
    display: inline-block;

    width: 10px;
    height: 10px;

    margin-right: 6px;

    border-radius: 999px;
}

.curve-budget {
    background: #64748b;
}

.curve-real {
    background: #16a34a;
}
