* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.logo:link, .logo:visited, .logo:hover, .logo:active {
    color: white !important;
    text-decoration: none !important;
}
.logo-icon { font-size: 1.6em; }
.logo-text {
    font-size: 1.3em;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white !important;
}

nav a {
    color: #a0a0c0;
    text-decoration: none;
    margin-left: 24px;
    font-weight: 500;
    transition: color 0.2s;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
}
nav a:visited, nav a:link { color: #a0a0c0; }
nav a:hover { color: white; background: rgba(255,255,255,0.15); }

main { max-width: 1100px; margin: 32px auto; padding: 0 20px 60px; }

h1 { margin-bottom: 8px; font-size: 1.7em; font-weight: 700; color: #1a1a2e; }
.subtitle { color: #666; font-size: 0.9em; margin-bottom: 20px; }
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #1a1a2e;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    font-size: 0.9em;
    font-weight: 500;
    transition: opacity 0.3s, transform 0.3s;
    border-left: 4px solid #00d4aa;
}

.regioes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
.card-regiao {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 36px 24px;
    border-radius: 14px;
    text-decoration: none;
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    border: 2px solid transparent;
}
.card-regiao:visited { color: #1a1a2e; }
.card-regiao:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: #00d4aa;
}
.card-icon { font-size: 2.4em; }
.card-nome { font-size: 1.25em; font-weight: 700; }
.card-count {
    font-size: 0.82em;
    color: #888;
    background: #f0f2f5;
    padding: 4px 12px;
    border-radius: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 0.93em; }
th {
    background: #1a1a2e;
    color: white;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: #f8f9fb; }
tbody tr:last-child td { border-bottom: none; }
.acoes { display: flex; gap: 8px; align-items: center; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: #00b894;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.15s;
    font-family: inherit;
}
.btn:visited, .btn:link { color: white; }
.btn:hover {
    background: #00a883;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,184,148,0.3);
}

.btn-small {
    padding: 6px 14px;
    background: #0984e3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.82em;
    font-weight: 600;
    display: inline-block;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-small:visited, .btn-small:link { color: white; }
.btn-small:hover { background: #0773c5; transform: translateY(-1px); }

.btn-danger { background: #d63031; }
.btn-danger:hover { background: #c23131; box-shadow: 0 4px 12px rgba(214,48,49,0.3); }

.form-card {
    background: white;
    padding: 32px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    max-width: 520px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.88em;
    color: #2d3436;
}
.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.15s;
    background: #fafafa;
}
.form-group input:focus { outline: none; border-color: #00b894; background: white; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.form-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    align-items: center;
}
.form-inline input {
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    background: #fafafa;
    transition: border-color 0.15s;
}
.form-inline input:focus { outline: none; border-color: #00b894; background: white; }
.form-inline input:first-child { flex: 1; }
.form-inline input:nth-child(2) { width: 160px; }

.empty {
    text-align: center;
    padding: 48px 20px;
    color: #999;
    font-style: italic;
    font-size: 0.95em;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}
.search-icon { font-size: 1.1em; color: #999; }
.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1em;
    font-family: inherit;
    background: transparent;
    color: #1a1a2e;
}
.search-bar input::placeholder { color: #aaa; }

#tabela-pedido { margin-bottom: 16px; }
#tabela-pedido input, #tabela-pedido select { font-size: 0.9em; }
#tabela-pedido tfoot td {
    border-top: 2px solid #1a1a2e;
    background: #f8f9fb;
    padding: 14px 18px;
}

@media (max-width: 768px) {
    .top-bar { flex-direction: column; align-items: flex-start; }
    .acoes { flex-wrap: wrap; }
    .form-inline { flex-direction: column; }
    .form-inline input:nth-child(2) { width: 100%; }
}

/* ==================== CHECKBOXES ==================== */
#tabela-pedidos input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00b894;
}
/* ==================== CHECKBOXES ==================== */
#tabela-pedidos input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00b894;
}
/* ==================== FILTROS PEDIDOS ==================== */
.filtros {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filtro-group label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

.filtro-group input,
.filtro-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.filtro-group input:focus,
.filtro-group select:focus {
    border-color: #00b894;
}

.btn-small {
    padding: 6px 14px !important;
    font-size: 13px !important;
}

.info-selecao {
    margin-bottom: 12px;
    padding: 10px 16px;
    background: #f0f2f5;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
}

#contador-selecionados {
    font-weight: bold;
    color: #00b894;
    font-size: 16px;
}

/* ==================== MODULOS (EM BREVE) ==================== */

.card-breve {
    opacity: 0.8;
    position: relative;
}

.badge-breve {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    background: #eee;
    border-radius: 10px;
    padding: 2px 10px;
    margin-top: 4px;
}

.em-breve-aviso {
    color: #555;
    font-size: 15px;
    margin-bottom: 24px;
}

.em-breve-voltar {
    display: inline-block;
    margin-top: 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
}
/* ===== Menu hambúrguer ===== */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}
.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background: #ffffff;   /* branco fixo, não herda */
    border-radius: 2px;
}

header { display: flex; align-items: center; gap: 8px; }

.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 998;
}
.menu-overlay.ativo { opacity: 1; pointer-events: auto; }

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    background: #fff;
    transform: translateX(-105%);
    transition: transform .25s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
}
.drawer.aberto { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #eee;
}
.drawer-title { font-weight: 700; font-size: 1.1rem; }
.drawer-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
}

.drawer-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

.menu-grupo { border-bottom: 1px solid #f0f0f0; }
.menu-pai {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    min-height: 48px;
}
.menu-pai.ativo { background: #f7f7f7; }
.menu-pai .seta { transition: transform .2s; }
.menu-pai.ativo .seta { transform: rotate(180deg); }

.menu-filhos {
    display: none;
    flex-direction: column;
    padding: 0 8px 8px 16px;
}
.menu-filhos.aberto { display: flex; }

.menu-subtitulo {
    font-size: .75rem;
    text-transform: uppercase;
    color: #999;
    padding: 10px 8px 4px;
    letter-spacing: .05em;
}

.menu-filhos a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    min-height: 44px;
    box-sizing: border-box;
}
.menu-filhos a:active,
.menu-filhos a:hover { background: #f0f0f0; }

.menu-badge {
    background: #00b894;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.menu-vazio {
    display: block;
    padding: 10px 8px;
    color: #aaa;
    font-size: .85rem;
    font-style: italic;
}

@media (min-width: 700px) {
    .drawer { width: 320px; }
}
/* ============================================================
   RESPONSIVO MOBILE — só age abaixo de 600px
   Desktop permanece exatamente como era
   ============================================================ */

/* ---------- BASE GLOBAL (seguro em qualquer tela) ---------- */
* {
    box-sizing: border-box;
}

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

img, table, pre, iframe, video {
    max-width: 100%;
}

/* ---------- CELULAR: ATÉ 600px ---------- */
@media (max-width: 600px) {

    html, body {
        overflow-x: hidden;
    }

    main {
        padding: 12px;
    }

    /* Header */
    header {
        padding: 10px 12px;
        flex-wrap: nowrap;
    }

    .logo {
        min-width: 0;
    }

    .logo-text {
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Cards em coluna única — só no celular */
    .regioes-grid,
    .hub-grid,
    .coleta-grid,
    .mort-grid,
    .gal-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }

    .card-regiao,
    .hub-card,
    .box-card,
    .mort-card,
    .gal-card {
        width: auto;
        min-width: 0;
        max-width: 100%;
    }

    /* Tabelas rolam dentro do próprio container */
    .rep-table,
    #tabela-pedidos {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .rep-table th,
    .rep-table td,
    #tabela-pedidos th,
    #tabela-pedidos td {
        padding: 8px 6px;
        font-size: 13px;
    }

    /* Filtros empilhados */
    .filtros {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
    }

    .filtro-group {
        width: 100%;
        min-width: 0;
    }

    .filtros .btn-small {
        width: 100%;
        justify-content: center;
    }

    /* Topo empilhado */
    .topo {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .topo > div {
        width: 100%;
    }

    .seletor-data {
        width: 100%;
        flex-wrap: wrap;
    }

    .seletor-data input[type="date"] {
        flex: 1;
        min-width: 0;
    }

    .topo .hist-btn,
    .topo .btn {
        width: 100%;
        text-align: center;
    }

    /* Stepper de mortalidade */
    .mort-stepper {
        gap: 6px;
    }

    .mort-stepper button {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .mort-stepper input {
        font-size: 16px;
    }

    /* Drawer */
    .drawer {
        width: 88vw;
        max-width: 320px;
    }

    .drawer-nav {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    /* Inputs: evita zoom automático do iOS */
    input,
    select,
    textarea {
        font-size: 16px;
        max-width: 100%;
    }

    /* Alvo de toque mínimo */
    button,
    .btn,
    .btn-small,
    .coleta-btn,
    .salvar-todas,
    .hist-btn,
    .mort-salvar {
        min-height: 44px;
        touch-action: manipulation;
    }

    h1 {
        font-size: 1.35rem;
    }
}

/* ---------- CELULAR PEQUENO: ATÉ 380px ---------- */
@media (max-width: 380px) {
    main {
        padding: 10px;
    }

    .logo-text {
        font-size: 0.95rem;
    }

    .rep-table th,
    .rep-table td,
    #tabela-pedidos th,
    #tabela-pedidos td {
        padding: 6px 4px;
        font-size: 12px;
    }
}