
/* AGROCULTIVO_ANDROID_RESPONSIVE_V1
   AGROCULTIVO ERP - ADAPTACION PARA ANDROID
   Complemento visual. No cambia la logica del ERP.
*/

html {
    -webkit-text-size-adjust: 100%;
}

body {
    max-width: 100%;
}

button, a, select, input {
    touch-action: manipulation;
}

@media screen and (max-width: 700px) {

    html, body {
        max-width: 100%;
        overflow-x: clip;
    }

    .app-shell,
    .main-area,
    .dashboard-content {
        min-width: 0;
        max-width: 100%;
    }

    .dashboard-content {
        padding: 16px 12px 35px;
    }

    .dashboard-header {
        gap: 15px;
        margin-bottom: 20px;
    }

    .dashboard-header h1 {
        font-size: clamp(20px, 5.3vw, 25px);
        line-height: 1.25;
    }

    .dashboard-filters {
        width: 100%;
    }

    .dashboard-filters select {
        min-height: 44px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        min-width: 0;
        min-height: 92px;
        padding: 14px;
        gap: 13px;
    }

    .stat-info strong {
        font-size: 20px;
        overflow-wrap: anywhere;
    }

    .dashboard-charts {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
        margin-top: 20px;
    }

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

    .panel-heading {
        padding: 15px 14px 0;
    }

    .chart-placeholder {
        padding: 14px;
        min-width: 0;
    }

    .agro-grafica-resumen {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .agro-grafica-detalle {
        overflow-wrap: anywhere;
    }

    .topbar {
        min-height: 62px;
        padding: 9px 11px;
        gap: 8px;
    }

    .topbar-left,
    .topbar-right {
        min-width: 0;
        gap: 8px;
    }

    .topbar-heading {
        min-width: 0;
    }

    .topbar-heading strong {
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    .topbar-icon-button {
        flex-shrink: 0;
        width: 44px;
        height: 44px;
    }

    .topbar-logout {
        min-height: 44px;
    }

    .sidebar {
        max-width: min(280px, 86vw);
    }

    .sidebar-item {
        min-height: 46px;
    }

    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        max-width: 100%;
        font-size: 16px;
    }

    button {
        max-width: 100%;
    }

    img, video, canvas, svg {
        max-width: 100%;
    }

    /* Tablas amplias: desplazamiento dentro de la tabla,
       sin obligar a desplazar toda la pantalla. */

    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table th,
    table td {
        overflow-wrap: normal;
    }

    /* Ventanas modales existentes */

    [role="dialog"] {
        max-width: 100%;
        max-height: 92dvh;
        overflow-y: auto;
    }

    .dashboard-notice {
        max-width: none;
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
}

@media screen and (max-width: 380px) {
    .stat-info strong {
        font-size: 18px;
    }

    .topbar-heading strong {
        font-size: 11px;
    }

    .agro-grafica-resumen {
        gap: 6px;
    }

    .agro-grafica-indicador {
        padding: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stat-card,
    .sidebar {
        transition-duration: 0.01ms;
    }
}
