:root {
    /* Paleta Premium Expressify - Produccion */
    --primary-color: #6200ea;
    --primary-gradient: linear-gradient(135deg, #6200ea 0%, #7c4dff 100%);
    --primary-hover: #5000cc;
    --secondary-color: #00bfa5;

    /* Textos */
    --text-main: #1a202c;
    --text-secondary: #718096;
    --text-light: #a0aec0;

    /* Fondos */
    --bg-page: #f4f7fe;
    --bg-card: #ffffff;
    --bg-sidebar: #111c44;
    --sidebar-text: #a0aec0;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: rgba(255, 255, 255, 0.1);

    /* UI Elements */
    --border-color: #e2e8f0;
    --focus-ring: rgba(98, 0, 234, 0.25);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Scaled down shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 10px 15px -3px rgba(0, 0, 0, 0.05);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --glass-blur: blur(12px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 0.85rem;
    overflow-x: hidden;
    width: 100%;
}

/* =========================================
   AUTH PAGES (Login)
   ========================================= */
body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: url('../assets/img/pattern_bg.png'), linear-gradient(135deg, #f4f7fe 0%, #e0e7ff 100%);
    background-size: cover;
}

.login-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 380px;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-gradient);
}

.login-header h2 {
    color: var(--primary-color);
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-group input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--focus-ring);
    outline: none;
}

.btn-primary {
    display: inline-block;
    width: 100%;
    padding: 0.9rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(98, 0, 234, 0.2);
}

/* =========================================
   ADMIN / DASHBOARD LAYOUT
   ========================================= */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
.admin-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1rem 0 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
}

.admin-logo {
    max-width: 140px;
    margin-bottom: 0.5rem;
}

.login-logo {
    max-width: 100px;
    margin: 0 auto 1.25rem;
    display: block;
}

.badge-admin,
.badge-messenger {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-nav a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-nav a .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.btn-logout-sidebar {
    color: #fc8181;
    text-align: center;
    display: block;
    margin-top: 1rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.btn-logout-sidebar:hover {
    color: #f56565;
    text-decoration: underline;
}

/* Main Content Area */
.admin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-page);
}

.admin-topbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--glass-blur);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: 80px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.topbar-actions {
    display: flex;
    gap: 1rem;
}

.btn-icon {
    background: white;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    position: relative;
}

.btn-icon:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.admin-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* =========================================
   COMPONENTS
   ========================================= */

/* Chart specific */
.chart-container {
    position: relative;
    height: 220px;
    /* Reduced from 300px for compactness */
    width: 100%;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Force side-by-side */
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Cards General */
.card,
.stat-card,
.dashboard-card,
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    /* Reduced to md */
    box-shadow: var(--shadow-premium);
    border: none;
    padding: 0.8rem;
    /* Further reduced from 1rem */
    transition: transform 0.2s ease;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    /* Further reduced min-width */
    gap: 0.8rem;
    /* Further reduced gap */
    margin-bottom: 1.2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
}

.stat-icon {
    width: 40px;
    /* Reduced from 48px */
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(98, 0, 234, 0.1) 0%, rgba(124, 77, 255, 0.1) 100%);
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    /* Reduced from 1.4rem */
}

.stat-info h3 {
    font-size: 1.2rem;
    /* Reduced from 1.4rem */
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.1;
}

.stat-info p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.75rem;
    /* Reduced from 0.8rem */
    font-weight: 500;
}

/* Tables */
.data-table,
.table-orders {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}

.data-table th,
.table-orders th {
    background: #f8fafc;
    padding: 0.6rem;
    /* Reduced from 0.75rem */
    font-size: 0.65rem;
    /* Reduced */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.data-table td,
.table-orders td {
    padding: 0.6rem;
    /* Reduced from 0.75rem */
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.8rem;
    /* Reduced from 0.85rem */
    vertical-align: middle;
}

/* Buttons */
.btn {
    padding: 0.4rem 0.8rem;
    /* Reduced */
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    /* Reduced */
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    /* Reduced max-width for more compact modals */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 0.8rem 1.2rem;
    /* Reduced padding */
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1rem;
    /* Reduced */
}

.modal-body {
    padding: 1.2rem;
    /* Reduced */
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
        z-index: 1000;
    }

    .admin-sidebar.active {
        left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-topbar {
        padding: 1rem;
    }
}

/* =========================================
   ALLY (ALIADO) LAYOUT
   ========================================= */
.ally-layout {
    display: flex;
    min-height: 100vh;
}

.ally-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ally-logo {
    max-width: 140px;
    margin-bottom: 0.5rem;
}

.ally-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

.ally-topbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--glass-blur);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: 80px;
}

.ally-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.ally-user-info {
    color: var(--sidebar-text);
    font-size: 0.85rem;
}

.ally-user-info strong {
    color: white;
}

.btn-logout {
    color: #fc8181;
    text-align: center;
    display: block;
    margin-top: 1rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.btn-logout:hover {
    color: #f56565;
    text-decoration: underline;
}

.create-order-link {
    background: var(--primary-color) !important;
    color: white !important;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.welcome-text strong {
    color: var(--text-main);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-header h3 {
    margin: 0;
    color: var(--text-main);
}

/* =========================================
   ALLY LAYOUT
   ========================================= */
.ally-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Added to ensure sidebar scrolls independently if needed */
.ally-sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
}

.ally-logo {
    max-width: 120px;
    margin-bottom: 2rem;
    display: block;
}

.ally-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

.ally-topbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--glass-blur);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: 80px;
}

.ally-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.ally-user-info {
    color: var(--sidebar-text);
    font-size: 0.85rem;
}

.ally-user-info strong {
    color: white;
}

/* =========================================
   MESSENGER LAYOUT
   ========================================= */
.messenger-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.messenger-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
}

.messenger-logo {
    max-width: 140px;
    margin-bottom: 0.5rem;
}

.messenger-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

.messenger-topbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--glass-blur);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: 80px;
}

.messenger-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.messenger-user-info {
    color: var(--sidebar-text);
    font-size: 0.85rem;
}

.messenger-user-info strong {
    color: white;
}

.badge-messenger {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* =========================================
   ALLY ORDER MODAL REDESIGN
   ========================================= */

/* Section Labels */
.modal-section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Service Type Selection */
.service-type-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.service-option-label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    /* Override default label margin */
}

.service-option-input {
    display: none;
}

.service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    background: var(--bg-card);
    height: 100%;
}

.service-card:hover {
    border-color: #cbd5e0;
    transform: translateY(-2px);
}

.service-option-input:checked+.service-card {
    border-color: var(--primary-color);
    background: rgba(98, 0, 234, 0.04);
    box-shadow: 0 4px 12px rgba(98, 0, 234, 0.1);
}

.service-card-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.service-card-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.service-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Ally Info Card */
.ally-info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.ally-avatar-circle {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(98, 0, 234, 0.2);
}

.ally-info-details {
    display: flex;
    flex-direction: column;
}

.ally-info-role {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ally-info-name {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
}

.ally-info-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Modern Inputs */
.form-row-modern {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group-modern {
    margin-bottom: 1.25rem;
    flex: 1;
}

.input-modern,
.select-modern,
.textarea-modern {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: all 0.2s;
    background: #fff;
    color: var(--text-main);
}

.input-modern:focus,
.select-modern:focus,
.textarea-modern:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
    outline: none;
}

.select-modern:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Cost Badge */
.cost-badge {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(98, 0, 234, 0.08);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

/* Financial Section */
.financial-summary-card {
    background: linear-gradient(to bottom right, #f8fafc, #fff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.financial-inputs-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    align-items: flex-start;
}

.price-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    font-weight: 600;
    pointer-events: none;
}

.input-price {
    padding-left: 2rem;
    /* Space for currency symbol */
    font-weight: 600;
    letter-spacing: 0.5px;
}

.mini-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.summary-details {
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.summary-row.highlight {
    color: var(--primary-color);
    font-weight: 500;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.summary-total-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.summary-total-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* =========================================
   TABLE & BADGE UTILITIES
   ========================================= */
.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    /* Fixed height container */
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    /* Context for sticky */
}

/* Scrollbar styling for table */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sticky Headers */
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8fafc;
    /* Slight contrast for header */
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    letter-spacing: 0.5px;
}

.status-pendiente {
    background-color: rgba(255, 179, 0, 0.15);
    color: #f59e0b;
}

.status-asignado {
    background-color: rgba(66, 153, 225, 0.15);
    color: #4299e1;
}

.status-recolectado {
    background-color: rgba(98, 0, 234, 0.15);
    color: var(--primary-color);
}

.status-en_camino,
.status-en_curso {
    background-color: rgba(72, 187, 120, 0.15);
    color: #38a169;
}

.status-entregado,
.status-completado {
    background-color: #def7ec;
    color: #03543f;
    border: 1px solid #def7ec;
}

.status-cancelado {
    background-color: #fed7d7;
    color: #c53030;
}

.badge-entrega {
    background-color: rgba(98, 0, 234, 0.1);
    color: var(--primary-color);
}

.badge-recoleccion {
    background-color: rgba(0, 191, 165, 0.1);
    color: var(--secondary-color);
}

/* =========================================
   MODAL BUTTON STYLES
   ========================================= */
.modal-close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    transform: rotate(90deg);
}

.btn-text {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-text:hover {
    background: #f8f9fa;
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.btn-primary-lg {
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(98, 0, 234, 0.2);
}

.btn-primary-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(98, 0, 234, 0.3);
}

.btn-primary-lg:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(98, 0, 234, 0.2);
}

/* =========================================
   RESPONSIVE DESIGN - MOBILE
   ========================================= */

/* Tablet and below */
@media (max-width: 1024px) {

    .admin-sidebar,
    .ally-sidebar,
    .messenger-sidebar {
        width: 220px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile devices */
@media (max-width: 768px) {

    /* Hide sidebar on mobile, show hamburger menu */
    .admin-sidebar,
    .ally-sidebar,
    .messenger-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        width: 280px;
    }

    .admin-sidebar.active,
    .ally-sidebar.active,
    .messenger-sidebar.active {
        left: 0;
    }

    /* Adjust main content */
    .admin-main,
    .ally-main,
    .messenger-main {
        width: 100%;
    }

    .admin-content,
    .ally-content,
    .messenger-content {
        padding: 1rem;
    }

    /* Topbar adjustments */
    .admin-topbar,
    .ally-topbar,
    .messenger-topbar {
        padding: 1rem;
    }

    /* Stats cards */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Hide less important columns on mobile */
    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        display: none;
    }

    /* Modals */
    .modal-content {
        max-width: 95% !important;
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body-scroll {
        padding: 1rem !important;
    }

    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .modal-footer button {
        width: 100%;
    }

    /* Form adjustments */
    .form-row-modern {
        flex-direction: column;
        gap: 0;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    /* Service type selector */
    .service-type-selector {
        flex-direction: column;
    }

    .service-card {
        width: 100%;
    }

    /* Dashboard cards */
    .dashboard-card {
        padding: 1rem;
    }

    /* Profile container */
    .profile-container {
        max-width: 100% !important;
        padding: 0;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {

    .admin-topbar h1,
    .ally-topbar h1,
    .messenger-topbar h1 {
        font-size: 1.2rem;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card p {
        font-size: 0.8rem;
    }

    .btn-primary,
    .btn-primary-lg {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    /* Stack financial summary on very small screens */
    .financial-inputs-row {
        flex-direction: column;
    }

    .summary-details {
        font-size: 0.85rem;
    }
}

/* --- Responsive Utility Classes --- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr !important;
    }
}

.mobile-hide {
    display: inherit;
}

@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-card {
        padding: 1rem !important;
    }

    /* Force tables to be scrollable if too wide */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    .data-table {
        min-width: 600px;
        /* Minimum width to ensure readability on mobile */
    }
}

/* Hamburger menu button (add to topbar) */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
}

/* Overlay for mobile menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* =========================================
   SIDEBAR REDESIGN (OVERRIDE)
   ========================================= */

.admin-sidebar,
.ally-sidebar,
.messenger-sidebar {
    background: #0f172a !important;
    /* Deep Slate Blue */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Logo Container to fix visibility */
.sidebar-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.ally-logo,
.admin-logo,
.messenger-logo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    margin-bottom: 0 !important;
    /* Remove individual margins */
}

/* Navigation Links */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav a {
    color: #94a3b8;
    /* Slate 400 */
    text-decoration: none;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    /* Slate 100 */
    transform: translateX(4px);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav a.create-order-link {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px dashed rgba(16, 185, 129, 0.3);
    margin-bottom: 1rem;
    justify-content: center;
}

.sidebar-nav a.create-order-link:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ally-user-info,
.messenger-user-info {
    margin-bottom: 1rem;
}

.ally-user-info small,
.messenger-user-info small {
    color: #64748b;
    /* Slate 500 */
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ally-user-info strong,
.messenger-user-info strong {
    color: #f8fafc;
    font-size: 0.95rem;
    display: block;
    margin-top: 2px;
}

.btn-logout {
    color: #ef4444;
    /* Red 500 */
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s;
    background: rgba(239, 68, 68, 0.1);
    justify-content: center;
    font-weight: 600;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

/* --- Assignment Selector Premium Styles --- */
.assignment-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
}

.assignment-select {
    appearance: none;
    -webkit-appearance: none;
    /* Safari */
    width: 100%;
    padding: 8px 32px 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    color: #475569;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    /* Pill shape */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Custom Arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.assignment-select:hover {
    background-color: white;
    border-color: #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.assignment-select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Success Icon Button Enhancements */
.btn-icon-success {
    background: #10b981;
    color: white;
    width: 30px;
    /* Larger hit area */
    height: 30px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    flex-shrink: 0;
}

.btn-icon-success:hover {
    background: #059669;
    /* Darker green */
    transform: scale(1.05);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.btn-icon-success:active {
    transform: scale(0.95);
}

/* =========================================
   MASTER RESPONSIVE FIXES (FINAL)
   ========================================= */
@media (max-width: 768px) {

    /* Layout Reset */
    .admin-layout,
    .ally-layout,
    .messenger-layout,
    .admin-body,
    .ally-body,
    .messenger-body {
        display: block !important;
        width: 100% !important;
        overflow-x: hidden !important;
        height: auto !important;
    }

    .admin-content,
    .ally-content,
    .messenger-content,
    .admin-main,
    .ally-main,
    .messenger-main {
        width: 100% !important;
        padding: 0.75rem !important;
        margin: 0 !important;
        display: block !important;
        height: auto !important;
    }

    /* Sidebar Fix - Ensure scroll and visibility */
    .admin-sidebar,
    .ally-sidebar,
    .messenger-sidebar {
        position: fixed !important;
        left: -285px !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 3000 !important;
        width: 280px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        padding: 1.5rem !important;
        background: #0f172a !important;
        /* Deep Slate Blue */
    }

    .admin-sidebar.active,
    .ally-sidebar.active,
    .messenger-sidebar.active {
        left: 0 !important;
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.6) !important;
    }

    /* Logout button visibility and Sidebar Footer */
    .sidebar-footer {
        margin-top: 2rem !important;
        padding-bottom: 3rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: block !important;
    }

    .btn-logout,
    .btn-logout-sidebar {
        height: 50px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        visibility: visible !important;
        background: rgba(239, 68, 68, 0.15) !important;
        color: #ef4444 !important;
        font-weight: 700 !important;
        margin-top: 0.5rem !important;
    }

    /* Topbars */
    .admin-topbar,
    .ally-topbar,
    .messenger-topbar {
        height: 70px !important;
        padding: 0 1rem !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1001 !important;
        background: white !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05) !important;
    }

    /* Grids */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .charts-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        margin-top: 1.5rem !important;
    }

    /* Tables & Responsive Containers */
    .table-responsive {
        margin: 1rem -0.75rem !important;
        width: calc(100% + 1.5rem) !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
    }

    .data-table {
        min-width: 700px !important;
    }

    .mobile-hide {
        display: none !important;
    }
}