:root {
    /* Cores Principais - Verde Moderno */
    --primary-color: #22c55e;
    /* Green 500 */
    --primary-hover: #16a34a;
    /* Green 600 */
    --primary-glow: rgba(34, 197, 94, 0.5);

    /* Cores de Estado */
    --danger-color: #ef4444;
    /* Red 500 */
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    /* Amber 500 */
    --info-color: #3b82f6;
    /* Blue 500 */
    --success-color: #22c55e;

    /* Cores de Fundo e Texto (Dark Mode Profundo) */
    --bg-body: #0f172a;
    /* Slate 900 - Fundo da página */
    --bg-card: #1e293b;
    /* Slate 800 - Fundo dos cards */
    --bg-input: #334155;
    /* Slate 700 - Fundo de inputs */
    --border-color: #334155;
    /* Bordas sutis */

    --text-main: #f1f5f9;
    /* Slate 100 - Texto principal */
    --text-muted: #94a3b8;
    /* Slate 400 - Texto secundário */

    /* Sombras e Efeitos */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 15px var(--primary-glow);
}

/* === Reset & Base === */
* {
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 80%);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-color);
}

ul {
    list-style: none;
    padding: 0;
}

/* === Header === */
header {
    background-color: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1,
header h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

header div strong {
    color: var(--primary-color);
}

/* === Botões Gerais === */
.btn,
button {
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* Botões Primários (Verde) */
.btn-primary,
button[type="submit"],
.btn-select,
.btn-confirm,
.btn-coletar,
.btn-save,
.btn-concluir {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 6px rgba(34, 197, 94, 0.2);
}

.btn-primary:hover,
button[type="submit"]:hover,
.btn-select:hover,
.btn-confirm:hover,
.btn-coletar:hover,
.btn-save:hover,
.btn-concluir:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-concluir:disabled,
.btn-select:disabled {
    background-color: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Botões de Perigo/Cancelar (Vermelho) */
.btn-danger,
.btn-cancel,
.btn-retorno,
.btn-esvaziar,
.btn-cancel-modal {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover,
.btn-cancel:hover,
.btn-retorno:hover,
.btn-esvaziar:hover,
.btn-cancel-modal:hover {
    background-color: var(--danger-hover);
}

/* Botões Secundários/Voltar */
.btn-voltar {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    text-transform: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-voltar:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(34, 197, 94, 0.05);
    transform: translateX(-5px);
}

/* Botão Sair (Logout) */
.btn-logout {
    background-color: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: #fff;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Botões de Ação Específicos */
.btn-acao {
    padding: 0.4rem 0.6rem;
    font-size: 1.1rem;
    border-radius: 0.4rem;
    margin-right: 0.3rem;
    line-height: 1;
}

.btn-editar {
    background-color: transparent;
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

.btn-editar:hover {
    background-color: var(--warning-color);
    color: #1e293b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.btn-excluir {
    background-color: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.btn-excluir:hover {
    background-color: var(--danger-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-entregue,
.btn-confirm-modal {
    background-color: var(--success-color);
    color: #fff;
}

.btn-rota {
    background-color: var(--info-color);
    color: #fff;
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* === Formulários === */
form {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

form h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1.2rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* === Tabelas === */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: rgba(34, 197, 94, 0.1);
    /* Cabeçalho levemente verde */
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

td small {
    color: var(--text-muted);
}

/* === Cards (Dashboard & Pedidos) === */
.dashboard-grid,
.grid-produtos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.card,
.pedido-card {
    background: rgba(30, 41, 59, 0.7); /* Fundo semi-transparente */
    backdrop-filter: blur(10px); /* Efeito de vidro */
    border-radius: 1.2rem;
    padding: 1.8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.card:hover,
.pedido-card:hover {
    transform: translateY(-5px);
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(34, 197, 94, 0.15);
    background: rgba(30, 41, 59, 0.9);
}

.card h3,
.pedido-card h3 {
    color: var(--text-muted);
    margin-top: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card .numero {
    font-size: 2.3rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
    display: inline-block;
}

/* Novos Estilos para Header do Card e Ícones */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-color);
    color: #fff;
}

/* Card de Ação Principal (Nova Entrega) */
.card-action {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(30, 41, 59, 0.8) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.card-action h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    text-transform: none;
    letter-spacing: normal;
}

.card p,
.pedido-card p {
    color: var(--text-muted);
    margin: 0.5rem 0;
}

/* Botões dentro dos Cards (Dashboard) */
.dashboard-grid .card .btn {
    margin-top: auto;
    width: fit-content;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.dashboard-grid .card .btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(34, 197, 94, 0.05);
    transform: translateX(5px);
}

/* Botão específico do card de ação */
.dashboard-grid .card-action .btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: auto;
    padding: 0.8rem 1.5rem;
    margin-top: auto;
}

.dashboard-grid .card-action .btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(34, 197, 94, 0.3);
}

/* Estilos Específicos de Pedido */
.pedido-card {
    border-left: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.pedido-card .info {
    margin-bottom: 1.5rem;
}

.pedido-card .actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.pedido-card .actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.card.mochila {
    border-left: 4px solid var(--info-color);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pendente {
    background-color: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.status-entrega {
    background-color: rgba(59, 130, 246, 0.2);
    color: var(--info-color);
    border: 1px solid var(--info-color);
}

.motivo-retorno {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.5rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

/* === Login === */
.login-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 420px;
    background: rgba(30, 41, 59, 0.75);
    /* Efeito vidro */
    padding: 3rem 2.5rem;
    border-radius: 1.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 10;
}

/* Linha de destaque no topo */
.login-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0.5;
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 2rem;
    color: var(--text-main);
    font-weight: 700;
    font-size: 2rem;
    text-align: center;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Resetar estilos de form genéricos para o login */
.login-container form {
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
    margin-bottom: 0;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 1rem 1.2rem;
    font-size: 1rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.login-container input:focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
    transform: translateY(-1px);
}

.login-container button {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
    margin-top: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 700;
}

.login-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

.erro {
    background-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.8rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* === Área Entregador === */
.tabs {
    display: flex;
    background: var(--bg-card);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    font-weight: 600;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(34, 197, 94, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* === Entregas (Carrinho/Sidebar) === */
.fab-cart {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--primary-color);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-glow);
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: transform 0.2s;
}

.fab-cart:hover {
    transform: scale(1.05);
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-sidebar {
    background: var(--bg-input);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.close-sidebar:hover {
    background: var(--danger-color);
    color: #fff;
    transform: rotate(90deg);
}

.sidebar-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.cart-item-info {
    flex-grow: 1;
    margin-right: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-input);
    border-left: 3px solid var(--primary-color);
    animation: fadeIn 0.3s ease;
}

.cart-item-info strong {
    color: var(--text-main);
}

.cart-item-info small {
    color: var(--text-muted);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bg-body);
    padding: 0.25rem;
    border-radius: 1.5rem;
}

.btn-qty {
    background-color: var(--border-color);
    color: var(--text-main);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-qty:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.cart-item-controls span {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.search-bar {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 2rem;
}

.search-bar input {
    margin-bottom: 0;
    max-width: 400px;
}

/* === Modals === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    max-height: 90vh;
    /* Controla a altura máxima */
    overflow-y: auto;
    /* Adiciona rolagem se o conteúdo exceder a altura */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: var(--danger-color);
}

.selection-buttons {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background-color: var(--bg-input);
    border-radius: 0.5rem;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.selection-buttons button {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    box-shadow: none;
    text-transform: none;
    font-weight: 500;
}

.selection-buttons button.active {
    background: var(--bg-card);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.selection-buttons button:hover:not(.active) {
    background: var(--border-color);
    color: #fff;
}

.edit-section {
    display: none;
}

.edit-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Estilização do Input de Cor */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 45px;
    padding: 0;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
    background: transparent;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* === Utilities === */
.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   === RESPONSIVIDADE (IDENTAÇÃO PARA 3 TIPOS DE TELA) ===
   ============================================================ */

/* 1. MOBILE (Celulares - Telas pequenas até 768px) */
@media (max-width: 768px) {
    /* Container com margem segura */
    .container {
        padding: 0 1rem;
        width: 100%;
    }

    /* Grid vira 1 coluna única */
    .dashboard-grid,
    .grid-produtos {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Header empilhado e centralizado */
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }

    /* Barra de busca empilhada */
    .search-bar {
        flex-direction: column;
        width: 100%;
    }

    .search-bar input {
        max-width: 100%; /* Input ocupa largura total */
    }

    /* Sidebar ocupa tela toda no mobile */
    .sidebar {
        max-width: none;
        width: 100%;
        left: 0;
        border-left: none;
        z-index: 2001;
    }

    /* Formulários mais compactos */
    form {
        padding: 1.5rem;
    }

    form h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    /* Login ajustado para telas estreitas */
    .login-container {
        width: 90%;
        padding: 2rem 1.5rem;
        max-width: none;
    }

    /* Modals ocupam quase toda a tela */
    .modal-box {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }

    /* Botões full width para facilitar o toque */
    .btn {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Tabelas com rolagem horizontal */
    .table-container {
        overflow-x: auto;
        /* Habilitar rolagem horizontal para tabelas */
        -webkit-overflow-scrolling: touch;
        /* Rolagem suave em iOS */
    }

    table {
        min-width: 600px; /* Força largura mínima para scroll */
    }

    th,
    td {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    /* Ajuste dos Botões da Aba Receber no Mobile */
    .mochila-actions .action-row {
        flex-direction: row; /* Garante que fiquem lado a lado */
    }
    
    /* Sobrescreve a regra geral de .btn para os botões dentro da .action-row */
    .mochila-actions .action-row .btn {
        width: auto; /* Permite que o flex:1 do style inline funcione */
    }

    /* Correção das Abas no Mobile (Gerenciar Pedidos / Clientes) */
    /* Usando Grid para garantir layout 2x2 e resolver problema de abas sumindo */
    .tabs {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 colunas */
        gap: 10px;
        background: transparent !important;
        border: none !important;
        overflow: visible;
        margin-bottom: 1rem;
    }
    
    .tab-btn {
        width: 100%;
        padding: 12px 5px;
        font-size: 0.85rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color) !important; /* Usa !important para sobrepor o border-bottom do desktop */
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        color: var(--text-muted);
    }
    .tab-btn.active {
        background: rgba(34, 197, 94, 0.15);
        border-color: var(--primary-color) !important;
        color: var(--primary-color);
        box-shadow: 0 4px 10px rgba(34, 197, 94, 0.1);
    }
    .grid-produtos {
        grid-template-columns: repeat(2, 1fr); /* 2 colunas */
        gap: 1.5rem;
    }

    .container {
        max-width: 95%; /* Aproveita mais a largura do tablet */
    }
    
    /* Header mantém linha, mas ajusta padding */
    header {
        padding: 1rem 1.5rem;
    }

    /* Botões lado a lado no tablet, mas ajustados */
    .mochila-actions .action-row {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .btn-receber { flex: 1 1 100%; margin-bottom: 5px; } /* Receber em cima */
    .btn-remarcar { flex: 1; }
    .btn-standby { flex: 0 0 auto; width: auto; padding: 0 20px; }
}

/* 3. DESKTOP (Computadores - Acima de 1025px) */
@media (min-width: 1025px) {
    /* O CSS base já define o padrão Desktop, mas aqui garantimos ajustes finos */
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === Mochila Actions (Area Entregador) === */
.mochila-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mochila-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.mochila-actions .action-row {
    display: flex;
    gap: 1rem;
}

/* Estilos Específicos para Botões da Aba Receber/Mochila */
.btn-receber {
    flex: 2; /* Ocupa mais espaço */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-remarcar {
    flex: 1;
    justify-content: center;
    border-color: var(--info-color) !important;
    color: var(--info-color) !important;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.btn-standby {
    flex: 0 0 auto; /* Tamanho fixo */
    width: 50px;
    justify-content: center;
    background: transparent !important;
    border: 1px solid var(--text-muted) !important;
    color: var(--text-muted) !important;
    display: flex;
    align-items: center;
}
.btn-standby:hover {
    background: rgba(255,255,255,0.1) !important;
}

/* Botão de remover item no modal de edição */
.btn-remove-item {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 0.4rem;
    font-weight: 600;
    text-transform: uppercase;
}

.btn-remove-item:hover {
    background: var(--danger-color);
    color: #fff;
}

/* === Modal de Notificação (Substituto do Alert) === */
.modal-notification-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease;
}

.modal-notification-box {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--primary-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.notification-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.notification-message {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* === Lista de Itens Scrollável (Modal Editar) === */
#listaItensContainer {
    max-height: 300px;
    /* Altura máxima para ativar o scroll */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 10px;
}

#listaItensContainer table {
    margin-top: 0;
    box-shadow: none;
    border-radius: 0;
}

/* Manter altura consistente apenas no modal de edição de pedidos (Admin) */
#modalEdit .modal-box {
    min-height: 500px;
}

/* === Modals de Notificação e Loading === */
.modal-notification-overlay,
.modal-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    /* Para compatibilidade com navegadores Webkit */
}

.modal-notification-box,
.modal-loading-box {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    /* Reduzir um pouco a largura para notificações */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.notification-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.notification-message {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

/* Estilos específicos para o Loading */
.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(34, 197, 94, 0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }

    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}