/* ============================================================
   Frota Forquilha Despachante - Design System (mobile-first, app)
   Visual de aplicativo em todas as resoluções.
   Marca: Forquilha Despachante (forquilhadespachante.com.br)
   Paleta: amarelo #eaca15 (primária) + preto + cinzas gerenciados.
   ============================================================ */

:root {
    /* Bootstrap overrides — paleta Forquilha Despachante */
    --bs-primary: #eaca15;
    --bs-primary-rgb: 234, 202, 21;
    --bs-link-color: #8f7300;
    --bs-link-hover-color: #6b5a00;
    --bs-btn-color: #111111;
    --bs-btn-bg: #eaca15;
    --bs-btn-border-color: #eaca15;
    --bs-btn-hover-color: #111111;
    --bs-btn-hover-bg: #f2dc3f;
    --bs-btn-hover-border-color: #f2dc3f;
    --bs-btn-active-bg: #d4b812;
    --bs-btn-active-border-color: #d4b812;
    --bs-btn-disabled-bg: #eaca15;
    --bs-btn-disabled-border-color: #eaca15;
    --bs-btn-focus-shadow-rgb: 234, 202, 21;

    /* Design system tokens */
    --fd-primary: #eaca15;
    --fd-primary-dark: #8f7300;
    --fd-primary-tint: rgba(234, 202, 21, 0.14);
    --fd-primary-glow: rgba(234, 202, 21, 0.35);
    --fd-primary-light: #f2dc3f;
    --fd-ink: #111111;
    --fd-bg: #f5f4ed;
    --fd-surface: #ffffff;
    --fd-text: #1a2430;
    --fd-muted: #6b7686;
    --fd-border: #e7e5d8;
    --fd-radius: 16px;
    --fd-radius-sm: 12px;
    --fd-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    --fd-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --fd-gutter: 1rem;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--fd-font);
    color: var(--fd-text);
    background: var(--fd-bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.app-body {
    min-height: 100dvh;
}

/* ---------- Botões ---------- */
.btn {
    border-radius: 14px;
    font-weight: 600;
    padding: 0.7rem 1.1rem;
    transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
    --bs-btn-color: #111111;
    --bs-btn-bg: #eaca15;
    --bs-btn-border-color: #eaca15;
    --bs-btn-hover-color: #111111;
    --bs-btn-hover-bg: #f2dc3f;
    --bs-btn-hover-border-color: #f2dc3f;
    --bs-btn-active-bg: #d4b812;
    --bs-btn-active-border-color: #d4b812;
    --bs-btn-focus-shadow-rgb: 234, 202, 21;
}
.btn-outline-primary {
    --bs-btn-color: #8f7300;
    --bs-btn-border-color: #8f7300;
    --bs-btn-hover-color: #111111;
    --bs-btn-hover-bg: #eaca15;
    --bs-btn-hover-border-color: #eaca15;
    --bs-btn-active-color: #111111;
    --bs-btn-active-bg: #d4b812;
    --bs-btn-active-border-color: #d4b812;
    --bs-btn-focus-shadow-rgb: 234, 202, 21;
}
.btn-lg { border-radius: 16px; padding: 0.9rem 1.2rem; }
.btn-icon {
    background: none; border: none; color: var(--fd-muted);
    width: 40px; height: 40px; border-radius: 12px; display: inline-flex;
    align-items: center; justify-content: center;
}
.btn-icon:hover { background: rgba(0,0,0,0.05); color: var(--fd-text); }

/* botão Google */
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 0.6rem;
    background: #fff; color: #333; border: 1px solid var(--fd-border);
    border-radius: 14px; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.btn-google:hover { background: #f7f8fa; color: #111; }

/* ---------- Formulários ---------- */
.form-control {
    border-radius: 14px;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--fd-border);
    font-size: 1rem;
}
.form-control:focus {
    border-color: var(--fd-primary);
    box-shadow: 0 0 0 0.2rem var(--fd-primary-glow);
}
.form-label { font-weight: 600; font-size: 0.9rem; color: var(--fd-text); }
.form-text { font-size: 0.8rem; color: var(--fd-muted); }
.input-group .btn { border-radius: 0 14px 14px 0 !important; }

/* ---------- Cards / App ---------- */
.app-card {
    border: none;
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow);
}
.app-card__title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }

.app-alert { border-radius: 14px; border: none; }
.app-alert--wide { margin: 0.5rem 0; }

.app-divider {
    display: flex; align-items: center; color: var(--fd-muted); font-size: 0.8rem;
    margin: 0.25rem 0 0.5rem;
}
.app-divider::before, .app-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--fd-border); margin: 0 0.75rem;
}

/* ---------- Tela de autenticação (centro, estilo app) ---------- */
.auth-shell {
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.25rem var(--fd-gutter) 2.5rem;
    background:
        radial-gradient(1200px 400px at 50% -10%, var(--fd-primary-tint), transparent),
        var(--fd-bg);
}
.auth-shell__inner { width: 100%; max-width: 420px; }

.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand__logo {
    display: inline-block; width: auto; max-width: 180px; height: auto;
    margin-bottom: 0.6rem; border-radius: 8px;
}
.auth-brand__name { font-size: 1.15rem; font-weight: 800; margin: 0; color: var(--fd-primary-dark); }
.auth-brand__tag { color: var(--fd-muted); font-size: 0.85rem; margin: 0.15rem 0 0; }

/* ---------- Landing ---------- */
.landing-hero { text-align: center; }
.landing-hero h2 { font-size: 1.5rem; font-weight: 800; line-height: 1.25; color: var(--fd-primary-dark); }
.landing-hero p { color: var(--fd-muted); }
.landing-features { margin-top: 1.5rem; }
.landing-features li {
    display: flex; align-items: center; gap: 0.6rem;
    background: var(--fd-surface); border-radius: 14px; padding: 0.8rem 1rem;
    box-shadow: var(--fd-shadow); margin-bottom: 0.6rem; font-weight: 500;
}
.landing-features__icon { font-size: 1.2rem; }

/* ---------- App shell (área autenticada) ---------- */
.app-bar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.65rem var(--fd-gutter);
    background: var(--fd-primary); color: var(--fd-ink);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.app-bar__brand { display: flex; align-items: center; gap: 0.6rem; color: var(--fd-ink); }
.app-bar__logo {
    width: auto; height: 34px; border-radius: 6px;
}
.app-bar__titles { line-height: 1.15; color: var(--fd-ink); }
.app-bar__titles strong { display: block; font-size: 0.95rem; }
.app-bar__titles small { color: rgba(0,0,0,0.65); font-size: 0.7rem; }
.app-bar .btn-icon { color: var(--fd-ink); }
.app-bar .btn-icon:hover { background: rgba(0,0,0,0.10); color: var(--fd-ink); }
.app-bar__logout { margin: 0; }

.app-bar__user-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--fd-primary);
}

.app-main {
    max-width: 560px;
    margin: 0 auto;
    padding: 1.25rem var(--fd-gutter) 6.5rem; /* espaço para a bottom-nav */
}

.app-page-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.2rem; }

/* ---------- Stat cards ---------- */
.stat-card {
    background: var(--fd-surface); border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow); padding: 1.1rem;
}
.stat-card__label { display: block; font-size: 0.82rem; color: var(--fd-muted); font-weight: 600; }
.stat-card__value { font-size: 1.8rem; font-weight: 800; color: var(--fd-primary-dark); }
.stat-card__value--sm { font-size: 1.25rem; }
.stat-link { text-decoration: none; display: block; }
.stat-link:hover .stat-card { box-shadow: 0 6px 18px var(--fd-primary-glow); }

/* ---------- Dashboard ---------- */
.app-page-title--section { font-size: 1.05rem; }
.app-row { color: inherit; }
.app-row:last-child { border-bottom: none !important; }

.dash-alert { border-radius: 12px; }
.dash-alert + .dash-alert { margin-top: 2px; }
.dash-alert:hover { background: var(--fd-primary-tint); }
.dash-alert__icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 30px; height: 30px; border-radius: 50%;
    font-weight: 800; font-size: 0.95rem;
}
.dash-alert__kind { white-space: nowrap; }
.dash-alert--danger .dash-alert__icon { background: rgba(231,76,60,0.14); color: #b03a2e; }
.dash-alert--warning .dash-alert__icon { background: rgba(241,196,15,0.18); color: #9a7d0a; }
.dash-alert--info .dash-alert__icon { background: rgba(46,204,113,0.15); color: #1e8449; }

.dash-bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.dash-bar {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    height: 100%; min-width: 0;
}
.dash-bar__track {
    flex: 1; width: 100%; min-height: 0;
    background: var(--fd-primary-tint); border-radius: 8px;
    display: flex; align-items: flex-end; overflow: hidden;
}
.dash-bar__fill {
    width: 100%; border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, var(--fd-primary), var(--fd-primary-dark));
}
.dash-bar__label { font-size: 0.68rem; color: var(--fd-muted); font-weight: 600; }

/* ---------- Relatórios ---------- */
.report-mini {
    background: var(--fd-primary-tint); border-radius: 12px; padding: 0.6rem 0.7rem; text-align: center;
}
.report-mini strong { display: block; font-size: 0.95rem; color: var(--fd-primary-dark); }
.report-mini span { font-size: 0.66rem; color: var(--fd-muted); font-weight: 600; }
.report-mini__value--sm { font-size: 0.72rem !important; }
.app-report-row {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 0.6rem 0; border-bottom: 1px solid var(--fd-border);
}
.app-report-row:last-child { border-bottom: none; }

/* ---------- Listas/usuários ---------- */
.min-w-0 { min-width: 0; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 42px; height: 42px; border-radius: 50%;
    background: linear-gradient(135deg, var(--fd-primary), var(--fd-primary-dark));
    color: var(--fd-ink); font-weight: 700; font-size: 1.05rem;
}
.form-select { border-radius: 14px; border: 1.5px solid var(--fd-border); padding: 0.6rem 0.9rem; }
.form-select:focus { border-color: var(--fd-primary); box-shadow: 0 0 0 0.2rem var(--fd-primary-glow); }
.form-select-sm { border-radius: 10px; }

/* ---------- Veículos ---------- */
.app-fab { border-radius: 22px; padding-inline: 1.1rem; font-weight: 700; box-shadow: var(--fd-shadow); }
.vehicle-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 44px; height: 44px; border-radius: 14px;
    background: var(--fd-primary-tint); color: var(--fd-primary-dark);
}
.situation-badge { font-size: 0.72rem; font-weight: 700; }
.situation-active { background: rgba(46,204,113,0.15); color: #1e8449; }
.situation-maintenance { background: rgba(241,196,15,0.18); color: #9a7d0a; }
.situation-inactive { background: rgba(149,165,166,0.18); color: #566573; }
.situation-sold { background: rgba(231,76,60,0.14); color: #b03a2e; }
.situation-pending { background: rgba(52,152,219,0.15); color: #1f618d; }
.situation-due_soon { background: rgba(241,196,15,0.18); color: #9a7d0a; }
.situation-overdue { background: rgba(231,76,60,0.15); color: #b03a2e; }
.situation-paid { background: rgba(46,204,113,0.15); color: #1e8449; }
.situation-cancelled { background: rgba(149,165,166,0.18); color: #566573; }

/* ---------- Painel administrativo ---------- */
.admin-body {
    background: var(--fd-bg);
    min-height: 100vh;
}
.admin-bar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.65rem var(--fd-gutter);
    background: var(--fd-primary); color: var(--fd-ink);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.admin-bar__brand { display: flex; align-items: center; gap: 0.6rem; color: var(--fd-ink); }
.admin-nav {
    display: flex; gap: 0.25rem; overflow-x: auto;
    padding: 0.5rem var(--fd-gutter);
    background: var(--fd-primary-dark); color: var(--fd-primary);
}
.admin-nav__item {
    flex-shrink: 0; padding: 0.45rem 0.9rem; border-radius: 12px;
    color: var(--fd-primary-tint); font-weight: 600; font-size: 0.85rem;
    text-decoration: none;
}
.admin-nav__item.is-active { background: var(--fd-primary); color: var(--fd-ink); }
.admin-main { max-width: 960px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.admin-table thead th {
    color: var(--fd-muted); font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 0.04em; border-top: none; white-space: nowrap;
}

/* ---------- Navegação inferior (bottom nav) ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--fd-surface); border-top: 1px solid var(--fd-border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.bottom-nav__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 0.55rem 0.1rem; color: var(--fd-muted);
    text-decoration: none; font-size: 0.66rem; font-weight: 600; line-height: 1.15;
    text-align: center; min-width: 0; overflow: hidden; white-space: nowrap;
    border-top: 2.5px solid transparent;
}
.bottom-nav__item.is-active { color: var(--fd-primary-dark); border-top-color: var(--fd-primary); }
.bottom-nav__item.is-disabled { opacity: 0.4; cursor: not-allowed; }

.is-disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

/* ---------- Área autenticada no desktop: largura centralizada estilo app ---------- */
@media (min-width: 768px) {
    :root { --fd-gutter: 1.5rem; }
    .bottom-nav { max-width: 560px; left: 50%; right: auto; transform: translateX(-50%); border-radius: 0 0 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Comprovantes (file storage) ---------- */
.receipt-wrap { border-top: 1px dashed var(--fd-border, #e5e7eb); padding-top: 0.75rem; }
.receipt-chip {
    max-width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--fd-border, #e5e7eb);
    border-radius: 0.5rem; background: var(--fd-sublime, #f8f9fa);
}
.receipt-file { max-width: 12rem; }
