:root {
    /* NutriLavoura — Tokens de Alto Contraste & Acessibilidade (WCAG AAA) */
    
    /* Superfícies & Fundo Neutro Limpo */
    --background: #f8fafc;
    --surface: #ffffff;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    --radius: 12px;
    
    /* Tipografia de Alto Contraste (Preto & Grafite Escuro) */
    --ink-black: #0f172a;
    --ink-graphite: #1e293b;
    --muted: #475569;
    --muted-light: #64748b;
    
    /* Cores de Ação (Verde Floresta Confiável & Acento Menta) */
    --green-primary: #15803d;
    --green-primary-hover: #166534;
    --green-accent: #059669;
    --mint-vibrant: #10b981;
    --mint-pastel: #ecfdf5;
    --mint-border: #a7f3d0;
    
    /* Barra Lateral Escura Institucional */
    --sidebar-deep: #0a2318;
    --sidebar-surface: #113525;
    --sidebar-border: rgba(255, 255, 255, 0.12);
    
    /* Alertas e Estados */
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --warning: #854d0e;
    --warning-bg: #fefce8;
    --warning-border: #fef08a;
    
    /* Aliases de Retrocompatibilidade */
    --green-950: var(--sidebar-deep);
    --green-900: var(--green-primary-hover);
    --green-800: var(--green-primary);
    --green-700: var(--green-primary);
    --green-600: var(--green-primary);
    --green-100: var(--mint-pastel);
    --green-50: #f1f5f9;
    --gold: #d97706;
    --ink: var(--ink-black);
    
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
}

* { box-sizing: border-box; }
html { background: var(--background); color: var(--ink-black); }
body {
    margin: 0;
    min-width: 320px;
    background: var(--background);
    color: var(--ink-black);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--green-primary);
    text-underline-offset: 3px;
    font-weight: 700;
}
a:hover {
    color: var(--green-primary-hover);
}

button, input, select, textarea { font: inherit; }
button, summary, select { cursor: pointer; }
button, a, input, select, textarea, summary { outline-offset: 3px; }

:focus-visible {
    outline: 3px solid #0f172a;
    box-shadow: 0 0 0 2px var(--mint-vibrant);
}

h1, h2, h3, p { margin-top: 0; }
h1 {
    margin-bottom: 0.35rem;
    color: var(--ink-black);
    font-size: clamp(1.85rem, 3.2vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    font-weight: 900;
}
h2 {
    color: var(--ink-black);
    font-size: 1.35rem;
    line-height: 1.25;
    font-weight: 850;
    letter-spacing: -0.015em;
}
h3 {
    color: var(--ink-black);
    font-size: 1.1rem;
    font-weight: 800;
}

.muted { color: var(--muted); }
.eyebrow {
    margin-bottom: 0.45rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 100;
    padding: 0.75rem 1.2rem;
    background: white;
    color: var(--ink-black);
    border: 2px solid var(--ink-black);
    border-radius: 8px;
    font-weight: 850;
}
.skip-link:focus { top: 1rem; }

/* Estrutura Geral */
.app-shell {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem 1.1rem;
    background: var(--sidebar-deep);
    color: white;
    border-right: 1px solid var(--sidebar-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: inherit;
    text-decoration: none;
    padding-bottom: 0.5rem;
}

.logo-mark, .brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #113824;
    border: 2px solid #34d399;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.logo strong {
    display: block;
    font-size: 1.22rem;
    letter-spacing: -0.02em;
    color: #ffffff;
    font-weight: 900;
}
.logo strong span {
    color: #34d399;
}
.logo small {
    display: block;
    color: #e2e8f0;
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-list {
    display: grid;
    gap: 0.35rem;
    margin: 1.8rem 0;
    padding: 0;
    list-style: none;
}
.nav-list a {
    display: flex;
    min-height: 46px;
    align-items: center;
    padding: 0.65rem 0.95rem;
    border-radius: 10px;
    color: #f1f5f9;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-list a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.nav-list a[aria-current="page"] {
    background: var(--sidebar-surface);
    color: #ffffff;
    box-shadow: inset 4px 0 0 #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding: 1rem 0;
    border-top: 1px solid var(--sidebar-border);
}
.sidebar-user strong {
    display: block;
    font-size: 0.94rem;
    color: #ffffff;
    font-weight: 800;
}
.sidebar-user small {
    display: block;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
}
.avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #1e3a8a;
    color: #ffffff;
    font-weight: 900;
    border: 2px solid #ffffff;
}

.main-column { min-width: 0; }
.main-content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 2.2rem clamp(1rem, 3vw, 3rem) 4rem;
}
.mobile-header { display: none; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.2rem;
    margin-bottom: 1.8rem;
    padding-bottom: 1.1rem;
    border-bottom: 1.5px solid var(--line);
}
.page-header p:last-child { margin-bottom: 0; color: var(--muted); font-size: 1.05rem; }
.page-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.75rem; }

/* Botões de Ação de Alto Contraste */
.button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-weight: 850;
    font-size: 0.98rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}
.button:active { transform: scale(0.98); }

.button-primary {
    background: var(--green-primary);
    color: #ffffff !important;
    border-color: var(--green-primary);
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
}
.button-primary:hover {
    background: var(--green-primary-hover);
    border-color: var(--green-primary-hover);
    color: #ffffff !important;
}

.button-secondary {
    border-color: #94a3b8;
    background: #ffffff;
    color: var(--ink-black) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.button-secondary:hover {
    background: #f1f5f9;
    border-color: #64748b;
    color: var(--ink-black) !important;
}

.button-quiet {
    border-color: var(--line-strong);
    background: #ffffff;
    color: var(--ink-black);
}
.button-quiet:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.sidebar .button-quiet {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}
.sidebar .button-quiet:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
}

.button-wide { width: 100%; }
.button-small { min-height: 42px; padding: 0.5rem 0.9rem; font-size: 0.92rem; }

/* Alertas & Notificações */
.alert, .notice {
    margin-bottom: 1.4rem;
    padding: 1.1rem 1.3rem;
    border: 1.5px solid;
    border-radius: 12px;
}
.alert-success {
    border-color: var(--mint-border);
    background: var(--mint-pastel);
    color: var(--green-primary-hover);
    font-weight: 750;
}
.alert-error {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 750;
}
.alert-warning {
    border-color: var(--warning-border);
    background: var(--warning-bg);
    color: var(--warning);
    font-weight: 750;
}
.notice {
    border-color: var(--line-strong);
    background: #ffffff;
}
.notice p { margin: 0.25rem 0 0; color: var(--ink-graphite); }

/* Cartões de Indicadores (Métricas) — Correção de Layout Vertical */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.6rem;
}
.metric-card, .panel, .create-panel, .department-card {
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.4rem 1.4rem 1.2rem;
    border-top: 4px solid var(--green-primary);
}
.metric-card span {
    display: block !important;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}
.metric-card strong {
    display: block !important;
    margin: 0.2rem 0 0.6rem;
    font-size: 2.3rem;
    line-height: 1.1;
    color: var(--ink-black);
    font-weight: 900;
}
.metric-card strong.money {
    font-size: 1.7rem;
    color: var(--ink-black);
}
.metric-card a {
    display: inline-flex !important;
    align-items: center;
    gap: 0.3rem;
    margin-top: auto;
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--green-primary);
    text-decoration: none;
}
.metric-card a:hover {
    text-decoration: underline;
    color: var(--green-primary-hover);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 1.4rem;
}
.panel {
    margin-bottom: 1.4rem;
    padding: 1.5rem;
}
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1.5px solid var(--line);
}
.panel-heading h2 { margin-bottom: 0; }
.panel-heading p { margin-bottom: 0; color: var(--muted); }

.task-list, .pipeline-summary { margin: 0; padding: 0; list-style: none; }
.task-list li {
    display: grid;
    grid-template-columns: 62px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--line);
}
.task-list li:last-child { border-bottom: 0; }
.task-list time {
    display: grid;
    place-items: center;
    padding: 0.4rem;
    border-radius: 9px;
    background: #f1f5f9;
    color: var(--ink-black);
    border: 1px solid #cbd5e1;
    font-size: 0.75rem;
    font-weight: 850;
}
.task-list time strong { font-size: 1.25rem; color: var(--ink-black); }
.task-list li.is-overdue time {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
}
.task-list div strong { display: block; color: var(--ink-black); font-size: 1.02rem; font-weight: 800; }
.task-list div span { display: block; color: var(--muted); font-size: 0.9rem; }

.pipeline-summary li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
}
.pipeline-summary li:last-child { border-bottom: 0; }
.pipeline-summary span { color: var(--ink-black); font-weight: 750; }
.pipeline-summary strong { color: var(--ink-black); font-size: 1.1rem; font-weight: 900; }
.pipeline-summary small { grid-column: 2 / 4; color: var(--muted); font-size: 0.9rem; }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--stage-color); }

/* Painéis de Criação / Formulários */
.create-panel {
    margin-bottom: 1.4rem;
    overflow: hidden;
    border-top: 4px solid var(--green-primary);
}
.create-panel > summary {
    min-height: 54px;
    padding: 1rem 1.4rem;
    color: var(--ink-black);
    font-weight: 900;
    font-size: 1.05rem;
    background: #ffffff;
}
.create-panel[open] > summary {
    border-bottom: 1.5px solid var(--line);
    background: #f8fafc;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; padding: 1.4rem; }
.form-stack { display: grid; gap: 1.2rem; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 0.4rem; font-weight: 800; color: var(--ink-black); font-size: 0.96rem; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid #94a3b8;
    border-radius: 9px;
    background: #ffffff;
    color: var(--ink-black);
    font-size: 1rem;
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.15);
}
.field small { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.88rem; }
.field-full { grid-column: 1 / -1; }
.field-small { max-width: 160px; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 0.5rem; }

.filter-bar { display: flex; align-items: flex-end; gap: 0.85rem; margin-bottom: 1.4rem; }
.filter-bar .field { flex: 1; max-width: 520px; }

/* Tabelas e Dados */
.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 0.95rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
    background: #f1f5f9;
    color: var(--ink-black);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
td { font-size: 0.98rem; color: var(--ink-black); }
td strong { display: block; color: var(--ink-black); font-weight: 800; }
td small { display: block; margin-top: 0.15rem; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }

.status, .status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 850;
    white-space: nowrap;
}
.status-success { background: var(--mint-pastel); color: var(--green-primary-hover); border: 1.5px solid var(--mint-border); }
.status-neutral { background: #f1f5f9; color: var(--ink-black); border: 1.5px solid #cbd5e1; }
.status-warning { background: var(--warning-bg); color: var(--warning); border: 1.5px solid var(--warning-border); }
.status-danger { background: var(--danger-bg); color: var(--danger); border: 1.5px solid var(--danger-border); }
.status-pill { border: 1px solid color-mix(in srgb, var(--stage-color) 38%, white); background: color-mix(in srgb, var(--stage-color) 12%, white); color: var(--ink-black); }

.text-danger { color: var(--danger); font-weight: 850; }
.empty-state { padding: 2.8rem 1rem; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 0.4rem; color: var(--ink-black); font-size: 1.15rem; font-weight: 850; }
.empty-state p { margin-bottom: 1rem; }

.department-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.department-card { display: flex; gap: 1.2rem; padding: 1.4rem; }
.department-card h2 { margin-bottom: 0.35rem; }
.department-card p { color: var(--muted); }
.department-initial {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--ink-black);
    border: 1.5px solid #cbd5e1;
    font-size: 1.3rem;
    font-weight: 900;
}

/* Search-enhanced select inputs with datalist autocomplete */
.order-search-input { display: none; }
.order-search-enhanced .order-search-input { display: block; }
.order-search-enhanced .order-search-select { display: none; }
.order-search-field small { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.85rem; }

/* Localização, GPS e Logística */
.location-gps-box {
    margin: 0.4rem 0;
    padding: 1.1rem;
    border: 1.5px dashed #0284c7;
    border-radius: 12px;
    background: #f0f9ff;
}
.location-gps-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.location-gps-header strong {
    color: #0369a1;
    font-size: 1.02rem;
    font-weight: 850;
}
.coordinates-grid {
    padding: 0 !important;
    margin: 0 !important;
}
.maps-input-wrap {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.maps-input-wrap input { flex: 1; }
.button-small {
    min-height: 38px;
    padding: 0.4rem 0.85rem;
    font-size: 0.88rem;
    border-radius: 8px;
}
.route-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.85rem;
    font-weight: 750;
    text-decoration: none;
    border: 1px solid #bae6fd;
}
.route-link:hover {
    background: #bae6fd;
    color: #0284c7;
}
.waze-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: #fef08a;
    color: #854d0e;
    font-size: 0.85rem;
    font-weight: 750;
    text-decoration: none;
    border: 1px solid #fde047;
}
.waze-link:hover {
    background: #fde047;
}


/* Telas de Autenticação — NutriLavoura */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #051c13 0%, #0a291c 50%, #061e14 100%);
    color: #ffffff;
}
.auth-shell {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    min-height: 100vh;
}

/* Painel Esquerdo — Apresentação Institucional */
.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2.5rem, 5.5vw, 5.5rem);
    background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.16) 0%, transparent 45%),
                radial-gradient(circle at 85% 75%, rgba(5, 150, 105, 0.12) 0%, transparent 50%),
                #082417;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-panel-content {
    max-width: 580px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}
.brand-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.brand-mark-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 8px 20px rgba(16, 185, 129, 0.35));
    transition: transform 0.2s ease;
}
.brand-mark-modern:hover {
    transform: scale(1.04);
}
.brand-naming {
    display: flex;
    flex-direction: column;
}
.brand-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    line-height: 1.1;
}
.brand-title strong {
    color: #34d399;
    font-weight: 900;
}
.brand-subtitle {
    font-size: 0.78rem;
    color: #94a3b8;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 0.2rem;
}
.brand-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.95rem;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.32);
    color: #6ee7b7;
    font-size: 0.82rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    width: fit-content;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    animation: pulseGreen 2.2s infinite;
}
@keyframes pulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
    70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.brand-hero-block h1 {
    color: #ffffff;
    font-size: clamp(2.1rem, 3.6vw, 3.2rem);
    font-weight: 900;
    line-height: 1.16;
    letter-spacing: -0.03em;
    margin: 0.8rem 0 0.85rem;
}
.brand-hero-block h1 span {
    background: linear-gradient(135deg, #6ee7b7 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-hero-desc {
    color: #cbd5e1;
    font-size: 1.08rem;
    line-height: 1.6;
    margin: 0;
}
.brand-features-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.brand-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
}
.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: #34d399;
    flex-shrink: 0;
}
.feature-text strong {
    display: block;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 0.15rem;
}
.feature-text span {
    display: block;
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1.4;
}
.brand-footer-note {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #94a3b8;
    font-size: 0.84rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* Painel Direito — Container & Card de Autenticação */
.auth-card-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 3.5vw, 3.5rem);
    background: #061c13;
}
.auth-card {
    width: 100%;
    max-width: 460px;
    padding: clamp(1.85rem, 3.8vw, 2.6rem);
    border-radius: 20px;
    background: #ffffff;
    color: var(--ink-black);
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #059669 0%, #10b981 50%, #34d399 100%);
}
.auth-card-header {
    margin-bottom: 0.25rem;
}
.auth-mobile-logo {
    display: none;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}
.auth-mobile-logo strong {
    font-size: 1.35rem;
    color: #0f172a;
}
.auth-mobile-logo strong span {
    color: #059669;
}
.auth-card-title-group {
    margin-bottom: 1.35rem;
}
.auth-security-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.65rem;
    border-radius: 6px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.65rem;
}
.auth-security-pill.rep-pill {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.auth-security-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}
.auth-security-pill.rep-pill .auth-security-dot {
    background: #3b82f6;
}
.auth-card-heading {
    font-size: 1.75rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 0 0 0.35rem;
}
.auth-card-subtitle {
    font-size: 0.92rem;
    color: #475569;
    margin: 0;
    line-height: 1.5;
}

/* Mensagens de Alerta Flash */
.auth-flash-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.35rem;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
}
.auth-flash-message.alert-success {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    color: #166534;
}
.auth-flash-message.alert-warning {
    background: #fefce8;
    border: 1.5px solid #fde047;
    color: #854d0e;
}
.auth-flash-message.alert-danger {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
}
.auth-flash-message .alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
}
.auth-flash-message .alert-body {
    flex: 1;
}

/* Formulário de Autenticação */
.auth-form-enhanced .auth-field {
    margin-bottom: 1.2rem;
}
.auth-form-enhanced .field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}
.auth-form-enhanced .label-text {
    font-size: 0.92rem;
    font-weight: 750;
    color: #1e293b;
}
.auth-form-enhanced .auth-inline-link {
    font-size: 0.85rem;
    color: #059669;
    font-weight: 700;
    text-decoration: none;
    padding: 0.15rem 0;
}
.auth-form-enhanced .auth-inline-link:hover {
    color: #047857;
    text-decoration: underline;
}
.auth-form-enhanced .input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-form-enhanced .input-leading-icon {
    position: absolute;
    left: 0.95rem;
    color: #64748b;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.auth-form-enhanced .input-modern {
    width: 100%;
    height: 48px;
    padding: 0.7rem 1rem 0.7rem 2.75rem;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.98rem;
    font-weight: 500;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.auth-form-enhanced .input-password-group .input-modern {
    padding-right: 2.85rem;
}
.auth-form-enhanced .input-modern:focus {
    border-color: #059669;
    background: #ffffff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}
.auth-form-enhanced .input-modern::placeholder {
    color: #94a3b8;
    font-weight: 400;
}
.auth-form-enhanced .password-toggle-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.auth-form-enhanced .password-toggle-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}
.auth-form-enhanced .password-toggle-btn:focus-visible {
    outline: 2px solid #059669;
}

/* Botões de Ação de Autenticação */
.auth-actions {
    margin-top: 1.35rem;
}
.auth-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 800;
    border: none;
    box-shadow: 0 6px 18px rgba(21, 128, 61, 0.35);
    transition: all 0.18s ease;
    cursor: pointer;
    text-decoration: none;
}
.auth-submit-btn:hover {
    background: linear-gradient(135deg, #166534 0%, #14532d 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(21, 128, 61, 0.45);
    color: #ffffff;
}
.auth-submit-btn:active {
    transform: translateY(0);
}
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.35rem 0 1.15rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}
.auth-divider span {
    padding: 0 0.85rem;
}
.auth-rep-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.94rem;
    font-weight: 750;
    text-decoration: none;
    transition: all 0.15s ease;
}
.auth-rep-btn:hover {
    border-color: #059669;
    color: #059669;
    background: #f0fdf4;
}
.auth-card-footer {
    margin-top: 1.5rem;
    padding-top: 1.15rem;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}
.auth-security-seal {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
    margin: 0;
}
.error-page { width: min(680px, calc(100% - 2rem)); margin: 12vh auto; padding: 2rem; }


/* Paginação Acessível (WCAG AA - Alvos 44x44px) */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1.5px solid var(--line);
}
.pagination-info {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}
.pagination-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.4rem 0.85rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-black);
    font-weight: 700;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pagination-link:hover:not(.disabled) {
    background: var(--mint-pastel);
    border-color: var(--green-primary);
    color: var(--green-primary-hover);
}
.pagination-link[aria-current="page"] {
    background: var(--green-primary);
    color: #ffffff;
    border-color: var(--green-primary);
}
.pagination-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--line);
    color: var(--muted);
}
.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 1080px) {

    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    /* Safe Areas do iPhone (Notch, Dynamic Island e Home Indicator) */
    body {
        overflow-x: hidden;
    }
    .app-shell {
        display: block;
        overflow-x: hidden;
    }
    .sidebar { display: none; }
    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        min-height: 68px;
        align-items: center;
        justify-content: space-between;
        padding-top: max(0.65rem, env(safe-area-inset-top));
        padding-bottom: 0.65rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        background: var(--sidebar-deep);
        color: white;
        border-bottom: 2px solid #34d399;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    }
    .mobile-header .logo-mark { width: 42px; height: 42px; }
    .mobile-menu { position: relative; }
    .mobile-menu summary {
        display: grid;
        min-width: 76px;
        min-height: 44px;
        place-items: center;
        border: 1.5px solid #34d399;
        border-radius: 8px;
        font-weight: 850;
        list-style: none;
        color: #ffffff;
    }
    .mobile-menu[open] nav {
        position: absolute;
        top: 52px;
        right: 0;
        width: min(310px, calc(100vw - 2rem));
        padding: 0.65rem;
        border: 1.5px solid var(--line);
        border-radius: 12px;
        background: white;
        box-shadow: var(--shadow);
    }
    .mobile-menu ul { margin: 0; padding: 0; list-style: none; }
    .mobile-menu a, .mobile-menu button {
        display: flex;
        width: 100%;
        min-height: 48px;
        align-items: center;
        padding: 0.6rem 0.8rem;
        border: 0;
        background: white;
        color: var(--ink-black);
        font-weight: 800;
        text-decoration: none;
    }
    .main-content {
        padding-top: 1.25rem;
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
        padding-left: max(0.85rem, env(safe-area-inset-left));
        padding-right: max(0.85rem, env(safe-area-inset-right));
    }
    .page-header { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
    .page-header-actions { width: 100%; justify-content: flex-start; gap: 0.6rem; }
    .page-header-actions .button { flex: 1 1 100%; min-height: 46px; }
    
    /* Prevenção de Auto-Zoom no iOS Safari */
    input, select, textarea {
        font-size: 16px !important;
    }

    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .field-small { max-width: none; }
    .department-grid { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .brand-panel {
        min-height: auto;
        padding: max(2.5rem, env(safe-area-inset-top)) 1.25rem 2rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .brand-panel-content { gap: 1.5rem; }
    .brand-hero-block h1 { font-size: 1.95rem; }
    .brand-features-grid { display: none; }
    .auth-card-container {
        padding: 1.75rem 1rem max(3.5rem, env(safe-area-inset-bottom));
    }
    .auth-mobile-logo { display: flex; }

    /* Tabelas responsivas gerais */
    .table-container,
    .panel > table,
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 520px) {
    .metric-grid { grid-template-columns: 1fr; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .filter-bar .field, .filter-bar .button { width: 100%; max-width: none; min-height: 44px; }
    .department-card { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
    .sidebar, .mobile-header, .button, .create-panel { display: none !important; }
    .app-shell { display: block; }
    .main-content { padding: 0; }
    .panel, .metric-card { box-shadow: none; }
}
