@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #0f172a;
    --secondary-color: #1e293b;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --light-bg: #f1f5f9;
    --surface: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --sidebar-width: 268px;
    --sidebar-collapsed-width: 80px;
    --header-height: 72px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body:not(.login-body) {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    overflow: hidden; /* Evita doble scroll */
}

.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-width);
}

/* Content Area - NUEVO: Contenedor principal del contenido */
.content {
    background-color: var(--light-bg);
    min-height: calc(100vh - 80px);
    padding: 1.5rem;
    overflow: auto; /* Permite scroll en el contenido */
}

/* Container Fluid - NUEVO: Asegura que use todo el ancho */
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Tablas Responsivas - MEJORADO */
.table-responsive {
    max-height: calc(100vh - 200px); /* Altura máxima basada en viewport */
    overflow-x: auto; /* Sin scroll horizontal */
    overflow-y: auto; /* Solo scroll vertical cuando sea necesario */
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%; /* Ocupa todo el ancho disponible */
}

/* Estilos para las barras de scroll - SOLO VERTICAL */
.table-responsive::-webkit-scrollbar {
    width: 8px; /* Solo scroll vertical */
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Tabla principal */
.table {
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}

.table th {
    background: #f8fafc;
    color: var(--text-primary, #1e293b);
    border: none;
    font-weight: 700;
    padding: 0.85rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    word-wrap: break-word;
    white-space: normal;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-color: #e9ecef;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

/* Eliminar la columna fija ya que no hay scroll horizontal */
.table td:first-child,
.table th:first-child {
    position: static; /* Ya no es sticky */
    background: inherit;
    box-shadow: none;
}

.table th:first-child {
    background: #f8fafc;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transition: width 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}

.logo-icon {
    font-size: 2rem;
    margin-right: 0.75rem;
}

.logo-text h5 {
    color: white;
    font-weight: 600;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.sidebar-collapsed .btn-close-sidebar {
    transform: rotate(180deg);
}

.sidebar-body {
    padding: 0.5rem 0;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 0.1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--accent-color);
}

.sidebar-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--accent-color);
}

.sidebar-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.sidebar-collapsed .sidebar-text {
    display: none;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0.5rem 0;
    flex: 0 0 auto;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.user-avatar {
    font-size: 2rem;
    margin-right: 0.75rem;
}

.user-details h6 {
    color: white;
    margin-bottom: 0;
}

.logout-link {
    color: rgba(255,255,255,0.8) !important;
}

.logout-link:hover {
    color: white !important;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.metric-card {
    background: white;
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-primary:hover {
    background: #2980b9;
    border-color: #2980b9;
    transform: translateY(-1px);
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1.5rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Fincas Styles */
.finca-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.finca-row:hover {
    background-color: #f8f9fa;
}

.finca-row.table-active {
    background-color: #e3f2fd;
    border-left: 3px solid #0d6efd;
}

#formularioInforme {
    transition: all 0.3s ease-in-out;
}

/* Responsive Design - MEJORADO */
@media (max-width: 1200px) {
    .table-responsive {
        max-height: calc(100vh - 180px);
    }
    
    .table td:nth-child(2),
    .table td:nth-child(3) {
        min-width: 100px;
        max-width: 150px;
    }
}

@media (max-width: 992px) {
    .content {
        padding: 1rem;
    }
    
    .table-responsive {
        max-height: calc(100vh - 160px);
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem;
    }
    
    .table td:nth-child(2),
    .table td:nth-child(3) {
        min-width: 80px;
        max-width: 120px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .main {
        margin-left: var(--sidebar-collapsed-width);
    }
    
    .sidebar-text {
        display: none;
    }
    
    .header {
        padding: 1rem;
    }
    
    .content {
        padding: 0.75rem;
    }
    
    .table-responsive {
        max-height: calc(100vh - 140px);
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    /* En móviles, permitir algo de scroll horizontal si es necesario */
    .table-responsive {
        overflow-x: auto;
    }
    
    .table {
        table-layout: auto; /* Layout automático en móviles */
        min-width: 600px; /* Ancho mínimo para móviles */
    }
}

@media (max-width: 576px) {
    .table-responsive {
        border-radius: 4px;
        overflow-x: auto; /* Scroll horizontal solo en móviles pequeños */
    }
    
    .table {
        min-width: 500px; /* Ancho mínimo reducido */
    }
    
    .btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Estilos para cuando hay muchos datos */
.data-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.table-loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Progress Bars */
.progress {
    height: 8px;
    border-radius: 4px;
}

.progress-bar {
    border-radius: 4px;
}

/* Toast Notifications */
.toast {
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.toast-header {
    border-radius: 8px 8px 0 0;
}

/* Login Page — diseño original, aislado del resto del sistema */
body.login-body {
    background: #2c3e50;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
}

.login-body .container-fluid,
.login-body .row.h-100 {
    min-height: 100vh;
}

.login-left {
    background: rgba(0, 0, 0, 0.2);
    position: relative;
}

.login-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.45);
    z-index: 0;
}

.login-left > div {
    position: relative;
    z-index: 1;
}

.login-body .col-lg-6.d-flex.align-items-center {
    background: rgba(0, 0, 0, 0.12);
}

.login-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 1.5rem 2rem;
}

.login-body h1,
.login-body h2,
.login-body .h3 {
    color: #fff;
    font-weight: 600;
}

.login-body .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

.login-body .form-label,
.login-body .form-check-label {
    color: #fff;
    font-weight: 500;
}

.login-body .form-control {
    background: #fff;
    border-color: #dce1e6;
}

.login-body .input-group-text {
    background: #fff;
    border-color: #dce1e6;
    color: #6c757d;
}

.login-body .btn-primary {
    background-color: #3498db;
    border-color: #3498db;
    font-weight: 600;
}

.login-body .btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.login-body .form-check-input {
    background-color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.login-body .table,
.login-body .table th,
.login-body .table td {
    background: transparent;
    position: static;
}

/* Asegurar que el sidebar tenga z-index alto */
.sidebar {
    z-index: 1000;
}

/* Header fijo */
.header {
    z-index: 999;
    position: sticky;
    top: 0;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .login-left {
        display: none !important;
    }
}

/* Tabla de pedidos: columnas de acciones visibles */
.table-pedidos {
    table-layout: auto;
    min-width: 900px;
}

.table-pedidos .col-id {
    width: 60px;
    white-space: nowrap;
}

.table-pedidos .col-tipo {
    width: 110px;
}

.table-pedidos .col-fecha {
    width: 105px;
    white-space: nowrap;
}

.table-pedidos .col-costo {
    width: 110px;
    white-space: nowrap;
}

.table-pedidos .col-estado {
    width: 100px;
}

.table-pedidos .col-entidad,
.table-pedidos .col-cliente {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-pedidos .col-acciones,
.table-pedidos th.col-acciones {
    width: 170px;
    min-width: 170px;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
    text-overflow: clip;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.table-pedidos .acciones-pedidos {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    align-items: center;
    justify-content: flex-start;
}

.table-pedidos .acciones-pedidos .btn {
    padding: 0.25rem 0.45rem;
    flex-shrink: 0;
}

/* ============================================================
   UI moderna - CM Gestión
   ============================================================ */

.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-lg);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sidebar-brand-img {
    height: 42px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapsed .sidebar-brand-text {
    display: none;
}

.sidebar-link {
    margin: 0 0.6rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    border-left: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar-brand-img {
    height: 34px;
}

.sidebar-footer .logout-link {
    margin: 0 0.6rem;
    border-radius: var(--radius-sm);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: rgba(37, 99, 235, 0.18);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.sidebar-link.active .sidebar-icon {
    color: #93c5fd;
}

.sidebar-footer .user-details small {
    color: rgba(255, 255, 255, 0.65);
}

.header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.875rem 1.75rem;
    min-height: var(--header-height);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 0.15rem 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-user {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.45rem 0.9rem 0.45rem 0.55rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.btn-user:hover,
.btn-user:focus {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content {
    padding: 1.5rem 1.75rem 2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.card-header .card-title {
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--accent-color);
    border-color: #bfdbfe;
}

.btn-outline-primary:hover {
    background: #eff6ff;
    color: var(--accent-hover);
    border-color: #93c5fd;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    font-size: 0.925rem;
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
}

.table-responsive {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.table th {
    background: #f8fafc;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-color: #f1f5f9;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #fafbfc;
}

.table-hover > tbody > tr:hover > * {
    background-color: #f1f5f9;
}

/* Tablas de detalle (información), sin cabecera oscura */
.table-borderless th,
.table-borderless td {
    background: transparent !important;
    position: static !important;
    text-transform: none;
    letter-spacing: normal;
    border: none;
    padding: 0.4rem 0.75rem 0.4rem 0;
    font-size: 0.9rem;
    vertical-align: top;
}

.table-borderless th {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.table-borderless td {
    color: var(--text-primary);
    font-weight: 500;
}

.badge {
    font-weight: 600;
    padding: 0.4em 0.65em;
    border-radius: 999px;
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.65rem 1rem;
}

.nav-tabs .nav-link:hover {
    color: var(--accent-color);
    background: #f8fafc;
}

.nav-tabs .nav-link.active {
    color: var(--accent-color);
    background: #fff;
    border-bottom: 2px solid var(--accent-color);
}

.pagination .page-link {
    border-radius: var(--radius-sm);
    margin: 0 0.15rem;
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
}

.pagination .page-item.active .page-link {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.alert {
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}

.metric-card {
    border: 1px solid var(--border-color);
}

.metric-icon {
    border-radius: var(--radius-md);
}

.cm-swal-toast {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-lg) !important;
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.filter-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* IDs sin fondo oscuro */
.cell-id {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

thead.table-dark th,
.table .table-dark th {
    background: #f8fafc !important;
    color: var(--text-primary) !important;
}

/* Filas expandibles (+) */
.col-expand {
    width: 2.5rem;
    padding: 0.5rem !important;
    text-align: center;
    vertical-align: middle;
}

.btn-expand-row {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    line-height: 1;
    font-weight: 700;
    font-size: 1rem;
    border-radius: var(--radius-sm, 0.375rem);
}

.btn-expand-row.expanded {
    background: var(--primary-color, #2563eb);
    color: #fff;
    border-color: var(--primary-color, #2563eb);
}

.row-detail > td {
    background: #f8fafc !important;
    padding: 0.65rem 1rem 0.85rem 2.75rem !important;
    border-top: none;
}

.row-detail-inner {
    font-size: 0.85rem;
}

.row-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.35rem 1.25rem;
}

.row-detail-grid .detail-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.row-detail-grid .detail-value {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.table-compact td,
.table-compact th {
    padding: 0.65rem 0.75rem;
}

.content {
    overflow-x: hidden;
    max-width: 100%;
}

.main {
    min-width: 0;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-compact {
    width: 100%;
    max-width: 100%;
}

.table-compact .col-acciones {
    width: 1%;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .table-compact td,
    .table-compact th {
        padding: 0.5rem 0.4rem;
        font-size: 0.82rem;
    }

    .btn-expand-row {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.85rem;
    }

    .acciones-pedidos .btn,
    .table-compact .btn-group .btn {
        padding: 0.2rem 0.35rem;
    }
}