/* =====================================================================
   ArgeLog UI — design system
   Carregado depois de bootstrap.min.css e style.css (legado).
   Objetivo: modernizar sem reescrever 8k linhas de template.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    /* Marca */
    --ag-brand: #2563eb;
    --ag-brand-600: #1d4ed8;
    --ag-brand-700: #1e40af;
    --ag-brand-soft: #eff4ff;
    --ag-brand-ring: rgba(37, 99, 235, .18);
    --ag-accent: #f59e0b;

    /* Superfícies */
    --ag-canvas: #f6f7f9;
    --ag-surface: #ffffff;
    --ag-surface-2: #f9fafb;
    --ag-border: #e6e8ee;
    --ag-border-strong: #d6dae3;

    /* Texto */
    --ag-ink: #101828;
    --ag-ink-2: #344054;
    --ag-muted: #667085;
    --ag-muted-2: #98a2b3;

    /* Semântica */
    --ag-success: #067647;
    --ag-success-bg: #ecfdf3;
    --ag-danger: #b42318;
    --ag-danger-bg: #fef3f2;
    --ag-warning: #b54708;
    --ag-warning-bg: #fffaeb;
    --ag-info: #0e7090;
    --ag-info-bg: #ecfdff;

    /* Sidebar */
    --ag-nav-bg: #0b1524;
    --ag-nav-bg-2: #101d31;
    --ag-nav-ink: #c7d2e1;
    --ag-nav-muted: #7d8ca3;
    --ag-nav-active: rgba(37, 99, 235, .22);

    /* Forma */
    --ag-r-sm: 8px;
    --ag-r: 12px;
    --ag-r-lg: 16px;
    --ag-r-xl: 20px;
    --ag-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --ag-shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --ag-shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
    --ag-shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .12), 0 4px 8px -4px rgba(16, 24, 40, .06);
    --ag-sidebar-w: 264px;
    --ag-topbar-h: 64px;

    /* Bootstrap bridge */
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: var(--ag-ink);
    --bs-body-bg: var(--ag-canvas);
    --bs-border-color: var(--ag-border);
    --bs-border-radius: var(--ag-r);
    --bs-link-color: var(--ag-brand);
    --bs-link-hover-color: var(--ag-brand-700);
    --bs-primary: var(--ag-brand);
}

@font-face {
    font-family: 'Inter';
    src: url('../vendor/fonts/inter-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--bs-body-font-family);
    background: var(--ag-canvas);
    color: var(--ag-ink);
    font-size: 14.5px;
    line-height: 1.55;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
}

h1, h2, h3, h4, h5, h6 { color: var(--ag-ink); letter-spacing: -.015em; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.02rem; }
h5, h6 { font-size: .95rem; }

a { text-decoration: none; }
a:hover { text-decoration: none; }

.text-muted { color: var(--ag-muted) !important; }
.text-dark { color: var(--ag-ink) !important; }
.text-primary { color: var(--ag-brand) !important; }
.bg-light { background-color: var(--ag-surface-2) !important; }
.bg-white { background-color: var(--ag-surface) !important; }
.border-light { border-color: var(--ag-border) !important; }
.fw-bold, .fw-semibold { font-weight: 650 !important; }
.small, small { font-size: 12.5px; }
.text-uppercase { letter-spacing: .06em; }
.fs-4 { font-size: 1.25rem !important; }
.fs-5 { font-size: 1.05rem !important; }

hr { border-color: var(--ag-border); opacity: 1; }

::selection { background: rgba(37, 99, 235, .16); }

/* Scrollbars discretas (desktop) */
* { scrollbar-width: thin; scrollbar-color: #c3c9d4 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c9cfda; border-radius: 999px; border: 2px solid var(--ag-canvas); }
::-webkit-scrollbar-thumb:hover { background: #adb5c4; }

/* ---------- 3. Botões ---------- */
.btn {
    border-radius: 10px;
    padding: .5rem .95rem;
    font-weight: 600;
    font-size: .875rem;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    box-shadow: var(--ag-shadow-xs);
}
.btn:focus-visible { box-shadow: 0 0 0 4px var(--ag-brand-ring); outline: none; }
.btn i, .btn .fas, .btn .far { font-size: .9em; }

.btn-primary { background: var(--ag-brand); border-color: var(--ag-brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--ag-brand-600); border-color: var(--ag-brand-600); color: #fff; }
.btn-primary:active { background: var(--ag-brand-700) !important; border-color: var(--ag-brand-700) !important; }
.btn-primary:disabled, .btn-primary.disabled { background: #a9bdf5; border-color: #a9bdf5; }

.btn-success { background: #079455; border-color: #079455; color: #fff; }
.btn-success:hover { background: #067647; border-color: #067647; color: #fff; }
.btn-danger { background: #d92d20; border-color: #d92d20; color: #fff; }
.btn-danger:hover { background: #b42318; border-color: #b42318; color: #fff; }
.btn-warning { background: #f79009; border-color: #f79009; color: #fff; }
.btn-warning:hover { background: #dc6803; border-color: #dc6803; color: #fff; }

.btn-outline-primary { color: var(--ag-brand); border-color: #c7d5f8; background: #fff; }
.btn-outline-primary:hover { background: var(--ag-brand-soft); border-color: var(--ag-brand); color: var(--ag-brand-700); }
.btn-outline-secondary { color: var(--ag-ink-2); border-color: var(--ag-border-strong); background: #fff; }
.btn-outline-secondary:hover { background: var(--ag-surface-2); border-color: #b9c0cd; color: var(--ag-ink); }
.btn-outline-danger { color: var(--ag-danger); border-color: #f5c6c0; background: #fff; }
.btn-outline-danger:hover { background: var(--ag-danger-bg); border-color: var(--ag-danger); color: var(--ag-danger); }
.btn-outline-success { color: var(--ag-success); border-color: #a9e5c6; background: #fff; }
.btn-outline-success:hover { background: var(--ag-success-bg); border-color: var(--ag-success); color: var(--ag-success); }
.btn-outline-info { color: var(--ag-info); border-color: #a5dbe8; background: #fff; }
.btn-outline-info:hover { background: var(--ag-info-bg); color: var(--ag-info); }
.btn-outline-dark { color: var(--ag-ink-2); border-color: var(--ag-border-strong); background: #fff; }
.btn-light { background: var(--ag-surface-2); border-color: var(--ag-border); color: var(--ag-ink-2); box-shadow: none; }
.btn-light:hover { background: #eef0f4; border-color: var(--ag-border-strong); color: var(--ag-ink); }
.btn-link { box-shadow: none; color: var(--ag-brand); font-weight: 600; padding: .25rem .35rem; }
.btn-link:hover { color: var(--ag-brand-700); background: var(--ag-brand-soft); }

.btn-sm { padding: .35rem .7rem; font-size: .8125rem; border-radius: 8px; }
.btn-lg { padding: .7rem 1.2rem; font-size: .95rem; border-radius: 12px; }
.btn-group > .btn { box-shadow: none; }

/* ---------- 4. Cards ---------- */
.card {
    background: var(--ag-surface);
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-r-lg);
    box-shadow: var(--ag-shadow-xs);
    margin-bottom: 1.25rem;
    transition: border-color .15s ease, box-shadow .15s ease;
    overflow: hidden;
}
.card:hover { transform: none; border-color: var(--ag-border-strong); box-shadow: var(--ag-shadow-sm); }
.card > .card-header, .card-header {
    background: var(--ag-surface);
    border-bottom: 1px solid var(--ag-border);
    padding: 1rem 1.25rem;
    font-weight: 650;
    font-size: .9375rem;
    color: var(--ag-ink);
}
.card-header.bg-white { background: var(--ag-surface) !important; }
.card > .card-body, .card-body { padding: 1.25rem; }
.card > .card-footer, .card-footer {
    background: var(--ag-surface-2);
    border-top: 1px solid var(--ag-border);
    padding: .75rem 1.25rem;
}
.card.border-0 { border: 1px solid var(--ag-border) !important; }
.card.shadow-sm { box-shadow: var(--ag-shadow-xs) !important; }

/* ---------- 5. Tabelas ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ag-ink-2);
    --bs-table-border-color: var(--ag-border);
    --bs-table-hover-bg: #f8fafc;
    --bs-table-hover-color: var(--ag-ink);
    margin-bottom: 0;
    font-size: .875rem;
    vertical-align: middle;
}
.table > :not(caption) > * > * { padding: .8rem .9rem; border-bottom-color: var(--ag-border); }
.table thead th, .table > thead > tr > th {
    background: var(--ag-surface-2) !important;
    color: var(--ag-muted) !important;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--ag-border);
    white-space: nowrap;
    padding-top: .65rem;
    padding-bottom: .65rem;
}
.table tbody tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: var(--bs-table-hover-bg); }
.table-light, .table-light > th, .table-light > td { background: var(--ag-surface-2) !important; color: var(--ag-muted) !important; }
.table-responsive { border-radius: var(--ag-r); }
.table .btn-sm { box-shadow: none; }

/* ---------- 6. Badges / status ---------- */
.badge {
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .01em;
    padding: .38em .62em;
    border-radius: 999px;
    line-height: 1.15;
    vertical-align: middle;
}
.badge.bg-primary { background: var(--ag-brand-soft) !important; color: #175cd3 !important; }
.badge.bg-success { background: var(--ag-success-bg) !important; color: var(--ag-success) !important; }
.badge.bg-danger { background: var(--ag-danger-bg) !important; color: var(--ag-danger) !important; }
.badge.bg-warning { background: var(--ag-warning-bg) !important; color: var(--ag-warning) !important; }
.badge.bg-info { background: var(--ag-info-bg) !important; color: var(--ag-info) !important; }
.badge.bg-secondary { background: #f2f4f7 !important; color: #475467 !important; }
.badge.bg-dark { background: #eaecf0 !important; color: #344054 !important; }
.badge.bg-light { background: #f2f4f7 !important; color: #475467 !important; border: 1px solid var(--ag-border); }
.badge.bg-white { background: #fff !important; color: var(--ag-ink-2) !important; border: 1px solid var(--ag-border); }

/* Chips de status de viagem (legado .trip-status) */
.trip-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .6rem !important;
    border-radius: 999px !important;
    font-size: .7rem !important;
    font-weight: 700 !important;
    letter-spacing: .03em;
    text-transform: none !important;
    background: #f2f4f7;
    color: #475467;
    border: 0;
}
.trip-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.trip-status.agendada { background: var(--ag-brand-soft) !important; color: #175cd3 !important; }
.trip-status.em_andamento { background: var(--ag-warning-bg) !important; color: var(--ag-warning) !important; }
.trip-status.concluida { background: var(--ag-success-bg) !important; color: var(--ag-success) !important; }
.trip-status.cancelada { background: var(--ag-danger-bg) !important; color: var(--ag-danger) !important; }

/* ---------- 7. Formulários ---------- */
.form-label { font-size: .8125rem; font-weight: 600; color: var(--ag-ink-2); margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid var(--ag-border-strong);
    padding: .55rem .75rem;
    font-size: .875rem;
    color: var(--ag-ink);
    background-color: #fff;
    min-height: 42px;
    box-shadow: var(--ag-shadow-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: var(--ag-muted-2); }
.form-control:focus, .form-select:focus {
    border-color: var(--ag-brand);
    box-shadow: 0 0 0 3px var(--ag-brand-ring);
    outline: none;
}
.form-control:disabled, .form-control[readonly] { background: var(--ag-surface-2); color: var(--ag-muted); }
.form-text { font-size: .78rem; color: var(--ag-muted); }
.form-check-input { width: 1.05em; height: 1.05em; border-color: var(--ag-border-strong); }
.form-check-input:checked { background-color: var(--ag-brand); border-color: var(--ag-brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--ag-brand-ring); border-color: var(--ag-brand); }
.form-check-label { font-size: .875rem; color: var(--ag-ink-2); }
.input-group-text { background: var(--ag-surface-2); border-color: var(--ag-border-strong); color: var(--ag-muted); border-radius: 10px; font-size: .85rem; }
.invalid-feedback { font-size: .78rem; }
.form-section-title {
    font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ag-muted); margin: 1.5rem 0 .75rem; padding-bottom: .5rem;
    border-bottom: 1px solid var(--ag-border);
}
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .95rem; font-weight: 650; float: none; width: auto; }

/* ---------- 8. Alertas / toasts ---------- */
.alert {
    border-radius: var(--ag-r);
    border: 1px solid var(--ag-border);
    padding: .85rem 1rem;
    font-size: .875rem;
    box-shadow: var(--ag-shadow-xs);
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}
.alert-info { background: var(--ag-brand-soft); border-color: #d3e0fd; color: #1e40af; }
.alert-success { background: var(--ag-success-bg); border-color: #b5e8cd; color: #05603a; }
.alert-warning { background: var(--ag-warning-bg); border-color: #f5dca5; color: #93370d; }
.alert-danger { background: var(--ag-danger-bg); border-color: #f5c6c0; color: #912018; }
.alert .btn-close { margin-left: auto; font-size: .7rem; opacity: .6; }

.ag-toast-wrap {
    position: fixed; top: 1rem; right: 1rem; z-index: 2000;
    display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem));
}
.ag-toast {
    background: #fff; border: 1px solid var(--ag-border); border-left: 4px solid var(--ag-brand);
    border-radius: var(--ag-r); box-shadow: var(--ag-shadow-lg); padding: .8rem .9rem;
    font-size: .85rem; color: var(--ag-ink-2); display: flex; gap: .6rem; align-items: flex-start;
    animation: ag-toast-in .25s ease both;
}
.ag-toast.is-out { animation: ag-toast-out .2s ease both; }
.ag-toast .ag-toast-icon { color: var(--ag-brand); margin-top: .05rem; }
.ag-toast .ag-toast-close { margin-left: auto; border: 0; background: transparent; color: var(--ag-muted-2); cursor: pointer; padding: 0 .1rem; }
@keyframes ag-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes ag-toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- 9. Dropdowns / modais / tabs ---------- */
.dropdown-menu {
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-r);
    box-shadow: var(--ag-shadow-lg);
    padding: .35rem;
    font-size: .875rem;
}
.dropdown-item { border-radius: 8px; padding: .5rem .65rem; color: var(--ag-ink-2); display: flex; align-items: center; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--ag-surface-2); color: var(--ag-ink); }
.dropdown-divider { border-color: var(--ag-border); margin: .35rem 0; }

.modal-content { border: 0; border-radius: var(--ag-r-lg); box-shadow: var(--ag-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--ag-border); padding: 1rem 1.25rem; }
.modal-title { font-size: 1rem; font-weight: 650; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--ag-border); padding: .85rem 1.25rem; gap: .5rem; }
.modal-backdrop.show { opacity: .35; }

.nav-tabs { border-bottom: 1px solid var(--ag-border); gap: .25rem; }
.nav-tabs .nav-link {
    border: 0; border-bottom: 2px solid transparent; color: var(--ag-muted);
    font-weight: 600; font-size: .875rem; padding: .6rem .85rem; border-radius: 0;
}
.nav-tabs .nav-link:hover { color: var(--ag-ink); border-bottom-color: var(--ag-border-strong); }
.nav-tabs .nav-link.active { color: var(--ag-brand); background: transparent; border-bottom-color: var(--ag-brand); }
.nav-pills .nav-link { border-radius: 9px; color: var(--ag-ink-2); font-weight: 600; font-size: .85rem; }
.nav-pills .nav-link.active { background: var(--ag-brand); color: #fff; }

.list-group { border-radius: var(--ag-r); }
.list-group-item { border-color: var(--ag-border); padding: .85rem 1rem; color: var(--ag-ink-2); font-size: .875rem; background: transparent; }
.list-group-item-action:hover { background: var(--ag-surface-2); color: var(--ag-ink); }
.list-group-item.active { background: var(--ag-brand-soft); border-color: #d3e0fd; color: #175cd3; }
.list-group-flush > .list-group-item { border-width: 0 0 1px; }

.progress { height: .55rem; border-radius: 999px; background: #eef0f4; }
.progress-bar { border-radius: 999px; }

.pagination { --bs-pagination-border-radius: 9px; font-size: .85rem; }
.page-link { color: var(--ag-ink-2); border-color: var(--ag-border); }
.page-link:hover { background: var(--ag-surface-2); color: var(--ag-ink); }
.page-item.active .page-link { background: var(--ag-brand); border-color: var(--ag-brand); }

/* ---------- 10. Shell (sidebar + topbar) ---------- */
.ag-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.ag-sidebar {
    width: var(--ag-sidebar-w);
    flex: 0 0 var(--ag-sidebar-w);
    background: linear-gradient(180deg, var(--ag-nav-bg) 0%, var(--ag-nav-bg-2) 100%);
    color: var(--ag-nav-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1045;
    padding: .85rem .75rem 0;
    border-right: 1px solid rgba(255, 255, 255, .04);
}

.ag-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .35rem .5rem 1.05rem;
    color: #fff;
    text-decoration: none;
}
.ag-brand:hover { color: #fff; }
.ag-brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: 0 6px 14px -4px rgba(37, 99, 235, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
    color: #fff; font-size: 1.05rem;
}
.ag-brand-name { font-size: 1.06rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.ag-brand-sub { font-size: .66rem; color: var(--ag-nav-muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }

.ag-nav { flex: 1 1 auto; overflow-y: auto; padding-bottom: .75rem; margin: 0 -.25rem; }
.ag-nav::-webkit-scrollbar-thumb { background: #24344d; border-color: transparent; }
.ag-nav::-webkit-scrollbar { width: 6px; }
.ag-nav-label {
    font-size: .63rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
    color: #74869f; padding: 1rem .75rem .4rem;
}
.ag-nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .58rem .7rem; margin: .1rem .35rem;
    border-radius: 9px;
    color: var(--ag-nav-ink);
    font-size: .865rem; font-weight: 550;
    text-decoration: none;
    transition: background-color .14s ease, color .14s ease;
    position: relative;
}
.ag-nav-link i, .ag-nav-link .ag-nav-ico {
    width: 18px; text-align: center; font-size: .95rem; color: #8fa1ba; transition: color .14s ease;
}
.ag-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.ag-nav-link:hover i { color: #b9c8dc; }
.ag-nav-link.active { background: var(--ag-nav-active); color: #fff; font-weight: 650; }
.ag-nav-link.active i { color: #7fa9ff; }
.ag-nav-link.active::before {
    content: ''; position: absolute; left: -.35rem; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #4f8cff;
}
.ag-nav-link .badge { margin-left: auto; background: #d92d20 !important; color: #fff !important; }
.ag-nav-link .ag-nav-tag { margin-left: auto; font-size: .62rem; font-weight: 700; color: #93c5fd; background: rgba(59, 130, 246, .16); padding: .12rem .35rem; border-radius: 5px; }

.ag-sidebar-foot { padding: .6rem .35rem .9rem; border-top: 1px solid rgba(255, 255, 255, .07); margin-top: .25rem; }
.ag-user-btn {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 11px; padding: .5rem .55rem; color: #e6edf7; text-align: left;
    transition: background-color .15s ease;
}
.ag-user-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.ag-avatar {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
    display: grid; place-items: center; font-size: .78rem; font-weight: 700;
    background: linear-gradient(145deg, #334e77, #1f3555); color: #dbeafe;
    text-transform: uppercase; letter-spacing: .02em;
}
.ag-user-meta { min-width: 0; line-height: 1.25; }
.ag-user-name { font-size: .8rem; font-weight: 650; color: #eef4fb; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-user-role { font-size: .68rem; color: var(--ag-nav-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-user-btn .fa-chevron-down { font-size: .6rem; color: #6d7f99; }

/* Main */
.ag-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--ag-canvas); }

.ag-topbar {
    height: var(--ag-topbar-h);
    flex: 0 0 var(--ag-topbar-h);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--ag-border);
    position: sticky; top: 0; z-index: 1030;
}
.ag-page-title { font-size: 1.02rem; font-weight: 680; color: var(--ag-ink); letter-spacing: -.01em; line-height: 1.2; }
.ag-page-sub { font-size: .75rem; color: var(--ag-muted); line-height: 1.2; margin-top: .1rem; }
.ag-topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.ag-icon-btn {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    color: var(--ag-ink-2); background: transparent; border: 1px solid transparent;
    position: relative; transition: background-color .15s ease, border-color .15s ease;
}
.ag-icon-btn:hover { background: var(--ag-surface-2); border-color: var(--ag-border); color: var(--ag-ink); }
.ag-icon-btn .ag-dot {
    position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: #d92d20; color: #fff; font-size: .58rem; font-weight: 700;
    display: grid; place-items: center; border: 2px solid #fff;
}
.ag-menu-toggle { display: none; }

.ag-content { padding: 1.5rem; flex: 1 1 auto; width: 100%; max-width: 1560px; margin: 0 auto; }
.ag-footer {
    padding: 1rem 1.5rem 1.25rem; color: var(--ag-muted-2); font-size: .75rem;
    display: flex; gap: .5rem; justify-content: space-between; flex-wrap: wrap;
}

/* Cabeçalho de página dentro do conteúdo */
.ag-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.ag-page-head h1, .ag-page-head .h1 { font-size: 1.35rem; margin: 0; display: flex; align-items: center; gap: .55rem; }
.ag-page-head h1 i { color: var(--ag-muted-2); font-size: .85em; }
.ag-page-head .ag-page-desc { color: var(--ag-muted); font-size: .82rem; margin: .2rem 0 0; }
.ag-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.ag-content h1 { font-size: 1.35rem; }

/* Barra de estado offline */
.ag-offline-bar {
    display: flex; align-items: center; gap: .5rem;
    background: var(--ag-warning-bg); color: #93370d;
    border-bottom: 1px solid #f5dca5;
    padding: .45rem 1.5rem; font-size: .78rem; font-weight: 550;
}

/* Mobile drawer */
.ag-backdrop {
    position: fixed; inset: 0; background: rgba(9, 14, 24, .55);
    opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; z-index: 1040;
    backdrop-filter: blur(1px);
}
.ag-backdrop.show { opacity: 1; visibility: visible; }

/* Bottom nav (mobile / PWA) */
.ag-bottomnav {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--ag-border);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 10px rgba(16, 24, 40, .04);
}
.ag-bottomnav a {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .3rem .1rem; color: var(--ag-muted); font-size: .62rem; font-weight: 650;
    border-radius: 9px; position: relative;
}
.ag-bottomnav a i { font-size: 1.05rem; }
.ag-bottomnav a.active { color: var(--ag-brand); }
.ag-bottomnav a.active::before {
    content: ''; position: absolute; top: 0; width: 22px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--ag-brand);
}

/* ---------- 11. Componentes de página ---------- */
.ag-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.ag-kpi {
    background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-r-lg);
    padding: 1.05rem 1.1rem; display: flex; align-items: flex-start; gap: .85rem;
    box-shadow: var(--ag-shadow-xs); color: inherit; text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
a.ag-kpi:hover { border-color: #c9d6f7; box-shadow: var(--ag-shadow-sm); color: inherit; }
.ag-kpi-ico {
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: grid; place-items: center;
    font-size: 1rem; background: var(--ag-brand-soft); color: var(--ag-brand);
}
.ag-kpi-ico.is-green { background: var(--ag-success-bg); color: #079455; }
.ag-kpi-ico.is-amber { background: var(--ag-warning-bg); color: #dc6803; }
.ag-kpi-ico.is-red { background: var(--ag-danger-bg); color: #d92d20; }
.ag-kpi-ico.is-cyan { background: var(--ag-info-bg); color: var(--ag-info); }
.ag-kpi-ico.is-slate { background: #f2f4f7; color: #475467; }
.ag-kpi-label { font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ag-muted); margin-bottom: .2rem; }
.ag-kpi-value { font-size: 1.45rem; font-weight: 700; color: var(--ag-ink); line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ag-kpi-note { font-size: .74rem; color: var(--ag-muted); margin-top: .2rem; }

/* Compat: cards antigos .stats-card */
.stats-card { text-align: left !important; padding: 0 !important; }
.stats-card .card-body { display: flex; flex-direction: column; gap: .15rem; padding: 1.05rem 1.1rem; }
.stats-card i { font-size: 1rem !important; margin-bottom: .35rem !important; }
.stats-card .stats-value { font-size: 1.45rem !important; font-weight: 700 !important; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats-card .stats-label { font-size: .72rem !important; letter-spacing: .04em; }

/* Item de lista padrão (viagens, etc.) */
.ag-list { display: flex; flex-direction: column; }
.ag-list-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .8rem .35rem; border-bottom: 1px solid var(--ag-border);
    color: inherit; text-decoration: none;
}
.ag-list-item:last-child { border-bottom: 0; }
.ag-list-item:hover { background: #fafbfc; color: inherit; }
.ag-list-ico {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--ag-surface-2); color: var(--ag-muted); font-size: .85rem;
}
.ag-list-main { min-width: 0; flex: 1 1 auto; }
.ag-list-title { font-size: .875rem; font-weight: 620; color: var(--ag-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-list-sub { font-size: .75rem; color: var(--ag-muted); display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.ag-list-end { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; }

.empty-state { padding: 2.25rem 1rem; text-align: center; color: var(--ag-muted); }
.empty-state i { font-size: 1.4rem; display: block; margin-bottom: .6rem; color: var(--ag-muted-2); }
.empty-state p { margin: 0 0 .25rem; font-size: .875rem; }

/* Cabeçalho de card com ação */
.ag-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }

/* Estatística inline (mini) */
.ag-stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.ag-stat-row > div { min-width: 110px; }
.ag-stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ag-muted); font-weight: 650; }
.ag-stat-value { font-size: 1.05rem; font-weight: 700; color: var(--ag-ink); font-variant-numeric: tabular-nums; }

/* Dinheiro */
.ag-money { font-variant-numeric: tabular-nums; }
.ag-money.pos { color: var(--ag-success); }
.ag-money.neg { color: var(--ag-danger); }

/* ---------- 12. Auth (login/registro/cadastro) ---------- */
.ag-auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: #fff; }
.ag-auth-brand {
    position: relative; overflow: hidden; color: #fff; padding: 3rem 3.25rem;
    display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(120% 90% at 10% 0%, #1e40af 0%, #12294f 45%, #0b1524 100%);
}
.ag-auth-brand::after {
    content: ''; position: absolute; inset: auto -20% -35% -20%; height: 70%;
    background: radial-gradient(60% 100% at 50% 0%, rgba(37, 99, 235, .45), transparent 70%);
    pointer-events: none;
}
.ag-auth-brand > * { position: relative; z-index: 1; }
.ag-auth-logo { display: flex; align-items: center; gap: .7rem; font-size: 1.15rem; font-weight: 700; }
.ag-auth-logo .ag-brand-mark { width: 42px; height: 42px; flex: 0 0 42px; font-size: 1.15rem; }
.ag-auth-copy h2 { color: #fff; font-size: clamp(1.7rem, 2.4vw, 2.35rem); line-height: 1.15; letter-spacing: -.03em; margin-bottom: 1rem; font-weight: 700; }
.ag-auth-copy p { color: #b6c6dc; font-size: .95rem; max-width: 34ch; line-height: 1.6; }
.ag-auth-points { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: .7rem; }
.ag-auth-points li { display: flex; gap: .6rem; align-items: center; color: #d7e2f0; font-size: .86rem; }
.ag-auth-points i { color: #7fb0ff; font-size: .8rem; width: 18px; text-align: center; }
.ag-auth-foot { font-size: .72rem; color: #7286a1; letter-spacing: .02em; }

.ag-auth-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--ag-canvas); }
.ag-auth-card { width: 100%; max-width: 400px; }
.ag-auth-card .ag-auth-mobile-logo { display: none; }
.ag-auth-card h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em; margin: 0 0 .35rem; }
.ag-auth-card .ag-auth-sub { color: var(--ag-muted); font-size: .875rem; margin-bottom: 1.75rem; }
.ag-auth-card .form-control { min-height: 46px; }
.ag-auth-card .btn { min-height: 46px; font-size: .9rem; }
.ag-auth-card .card { border: 0; box-shadow: none; background: transparent; margin: 0; }
.ag-auth-card .card-header, .ag-auth-card .card-footer { display: none; }
.ag-auth-card .card-body { padding: 0; }
.ag-auth-extra { text-align: center; font-size: .82rem; color: var(--ag-muted); margin-top: 1.5rem; }
.ag-auth-extra a { font-weight: 600; }

/* ---------- 13. Responsivo ---------- */
@media (max-width: 1199.98px) {
    :root { --ag-sidebar-w: 248px; }
}

@media (max-width: 991.98px) {
    .ag-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
        transform: translateX(-104%);
        transition: transform .24s cubic-bezier(.32, .72, 0, 1);
        box-shadow: 20px 0 40px -20px rgba(9, 14, 24, .5);
        z-index: 1046;
    }
    .ag-shell.nav-open .ag-sidebar { transform: translateX(0); }
    .ag-menu-toggle { display: grid; }
    .ag-bottomnav { display: flex; }
    .ag-content { padding: 1.1rem 1rem calc(5.25rem + env(safe-area-inset-bottom, 0px)); }
    .ag-topbar { padding: 0 .9rem; }
    .ag-footer { display: none; }
    .ag-topbar .ag-page-sub { display: none; }
    .ag-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
    .ag-kpi { padding: .85rem .9rem; }
    .ag-kpi-value { font-size: 1.2rem; }
    .ag-kpi-ico { width: 34px; height: 34px; flex: 0 0 34px; font-size: .9rem; }
    .card-body { padding: 1rem; }
    .card-header { padding: .85rem 1rem; }
    .table > :not(caption) > * > * { padding: .65rem .6rem; }
    .ag-page-head h1 { font-size: 1.15rem; }
}

@media (max-width: 767.98px) {
    .ag-auth { grid-template-columns: 1fr; }
    .ag-auth-brand { display: none; }
    .ag-auth-panel { padding: 1.75rem 1.15rem; align-items: flex-start; }
    .ag-auth-card { max-width: 520px; margin: 0 auto; }
    .ag-auth-card .ag-auth-mobile-logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; font-weight: 700; color: var(--ag-ink); }
    .ag-toast-wrap { left: .75rem; right: .75rem; top: .75rem; max-width: none; }
    .ag-content > .row { --bs-gutter-x: 1rem; }
    h1 { font-size: 1.3rem; }
    .ag-kpi-value { font-size: 1.1rem; }
    .ag-kpi-note { font-size: .67rem; }
    .ag-kpi-label { font-size: .66rem; }
    .ag-page-head .ag-toolbar { width: 100%; }
    .ag-page-head .ag-toolbar .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .card:hover { transform: none; }
}

/* ---------- 14. Utilitários pequenos ---------- */
.width-20 { width: 20px; display: inline-block; text-align: center; }
.ag-sep { width: 1px; height: 24px; background: var(--ag-border); margin: 0 .25rem; }
.ag-chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.ag-scroll-x { overflow-x: auto; }
.ag-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Formulários longos: agrupa em grid responsivo */
@media (min-width: 768px) {
    .ag-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
}

/* Impressão */
@media print {
    .ag-sidebar, .ag-topbar, .ag-bottomnav, .ag-footer, .ag-toast-wrap { display: none !important; }
    .ag-content { padding: 0; }
    .card { box-shadow: none; border-color: #ddd; }
}
