/* ==========================================================================
   Controle de Passageiros — estilos
   Mobile-first. Visual seguindo as telas de referência:
   azul-marinho (cabeçalhos), verde (ação principal/pagante), azul (idoso/especial).
   ========================================================================== */

:root {
    --navy:       #0a2a5c;
    --navy-deep:  #04183b;
    --green:      #0aa866;
    --green-dark: #088a54;
    --green-soft: #e8f7ef;
    --blue:       #2a5be8;
    --blue-soft:  #eaf0ff;
    --ink:        #0d1b33;
    --muted:      #5f6b7d;
    --line:       #d5dbe5;
    --bg:         #f4f6fa;
    --card:       #ffffff;
    --danger:     #c62f3e;
    --danger-bg:  #fdecee;
    --warn-bg:    #fff4dc;
    --warn-ink:   #7a5200;
    --radius-xl:  28px;
    --radius-lg:  22px;
    --shadow:     0 10px 30px rgba(10, 42, 92, .10);
    --shadow-sm:  0 4px 14px rgba(10, 42, 92, .08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: #e6ebf3;
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid #7aa2ff; outline-offset: 2px; }

.ic { flex: none; display: block; }

/* ── Moldura do app (celular; no desktop vira uma coluna centralizada) ─── */
.app {
    position: relative;
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    background: #fff;
    overflow-x: clip;
}
@media (min-width: 560px) {
    .app { box-shadow: 0 0 0 1px rgba(10, 42, 92, .06), 0 20px 60px rgba(10, 42, 92, .16); }
}
.app-logged { padding-bottom: calc(104px + env(safe-area-inset-bottom)); background: #fff; }
.app-auth { display: flex; flex-direction: column; }

/* ── Botões ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 58px; padding: 0 24px;
    border: 0; border-radius: 16px;
    font-size: 19px; font-weight: 700; text-decoration: none; letter-spacing: .1px;
    color: #fff; transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-green { background: var(--green); }
.btn-green:hover { background: var(--green-dark); }
.btn-blue { background: var(--blue); }
.btn-blue:hover { filter: brightness(.94); }
.btn-block { width: 100%; }
.btn-pill { width: 100%; border-radius: 999px; min-height: 64px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: transparent; color: #7b8494;
}
.icon-btn:hover { background: rgba(10, 42, 92, .06); }
.icon-btn-blue { color: var(--blue); }

/* ── Avisos e toasts ──────────────────────────────────────────────────── */
.alert { border-radius: 14px; padding: 12px 16px; font-size: 15px; margin-bottom: 16px; }
.alert p + p { margin-top: 4px; }
.alert-erro  { background: var(--danger-bg); color: var(--danger); }
.alert-aviso { background: var(--warn-bg); color: var(--warn-ink); }
.alert a { color: inherit; font-weight: 700; }

.toasts {
    position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
    top: calc(12px + env(safe-area-inset-top));
    width: min(440px, calc(100% - 24px));
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    pointer-events: none; /* aviso é só informativo: não pode "roubar" o toque dos botões que ficam embaixo */
    padding: 14px 18px; border-radius: 14px;
    font-weight: 600; font-size: 15px; color: #fff;
    background: var(--navy); box-shadow: var(--shadow);
    animation: toast-in .18s ease-out;
}
.toast-ok   { background: var(--green-dark); }
.toast-erro { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── Acesso (login, cadastro...) ──────────────────────────────────────── */
.hero-bus {
    display: flex; align-items: center; justify-content: center;
    min-height: 150px; padding-top: env(safe-area-inset-top);
    background: var(--navy); color: #fff;
}
.auth-sheet { flex: 1; display: flex; flex-direction: column; padding: 40px 26px 28px; }
.auth-title { font-size: clamp(26px, 7.2vw, 34px); line-height: 1.1; font-weight: 800; letter-spacing: -.5px; }
.auth-sub { margin: 8px 0 28px; font-size: 18px; color: var(--muted); }

.field { display: block; margin-bottom: 18px; }
.field-label { display: block; margin-bottom: 8px; font-size: 17px; font-weight: 600; color: #465165; }
.input {
    width: 100%; height: 60px; padding: 0 18px;
    border: 1.5px solid #b9c0cc; border-radius: 16px; background: #fff;
    font-size: 17px;
}
.input:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 4px rgba(42, 91, 232, .15); }
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 58px; }
.input-eye {
    position: absolute; top: 0; right: 4px; width: 52px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    border: 0; background: transparent; color: var(--green);
}
.link-under { display: inline-block; margin: 4px 0 28px; color: #465165; font-size: 17px; font-weight: 600; text-decoration: underline; }
.auth-switch {
    margin-top: auto; padding: 22px 16px; text-align: center;
    background: #fff; border-radius: 20px; box-shadow: var(--shadow-sm);
    color: var(--muted); font-size: 17px;
}
.auth-sheet > .btn { margin-top: 8px; }
.auth-sheet form { margin-bottom: 32px; }
.auth-switch a { margin-left: 8px; color: #1b2fd6; font-weight: 800; text-decoration: none; }

/* ── Cabeçalhos azuis ─────────────────────────────────────────────────── */
.topbar { background: var(--navy); color: #fff; padding-top: env(safe-area-inset-top); }
.topbar h1 { font-weight: 800; letter-spacing: -.3px; }

.topbar-home {
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(28px + env(safe-area-inset-top)) 24px 70px;
}
.greet { font-size: 28px; }

.topbar-simple {
    position: relative; display: flex; align-items: center; justify-content: center;
    min-height: 104px; padding: calc(18px + env(safe-area-inset-top)) 56px 18px;
    border-radius: 0 0 28px 28px;
}
.topbar-simple h1 { font-size: clamp(19px, 5.6vw, 24px); text-align: center; white-space: nowrap; }
.topbar-simple .back { position: absolute; left: 12px; top: calc(50% + env(safe-area-inset-top) / 2); transform: translateY(-50%); }

.topbar-day {
    position: relative; text-align: center; border-radius: 0 0 34px 34px;
    padding: calc(22px + env(safe-area-inset-top)) 64px 28px;
}
.topbar-day .back { position: absolute; left: 12px; top: calc(26px + env(safe-area-inset-top)); }
.day-title h1 { font-size: clamp(22px, 6.6vw, 34px); line-height: 1.1; white-space: nowrap; }
.day-title p { margin-top: 4px; font-size: 18px; font-weight: 600; opacity: .92; }

.back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%; color: #fff; text-decoration: none;
}
.back:hover { background: rgba(255, 255, 255, .12); }

.avatar {
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    border-radius: 50%; background: #dbe4f5; color: var(--navy);
    font-weight: 800; text-decoration: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 58px; height: 58px; font-size: 24px; border: 3px solid rgba(255, 255, 255, .85); }
.avatar-lg { width: 112px; height: 112px; font-size: 44px; border: 4px solid #fff; box-shadow: var(--shadow); }

/* ── Folha branca (conteúdo) ──────────────────────────────────────────── */
.sheet { padding: 24px 20px 8px; }
.sheet-home { margin-top: -44px; padding-top: 26px; background: #fff; border-radius: 34px 34px 0 0; min-height: 60vh; }

/* Calendário */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cal-head h2 { font-size: 22px; font-weight: 800; }
.cal-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%; color: #7b8494; text-decoration: none;
}
.cal-nav:hover { background: var(--bg); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 4px; justify-items: center; }
.cal-week { margin-bottom: 10px; font-weight: 800; color: #4a5568; font-size: 16px; }
.cal-day {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 100%; max-width: 50px; aspect-ratio: 1; border-radius: 50%;
    border: 1.5px solid #c9cfda; background: #fff;
    color: var(--ink); font-size: 17px; font-weight: 800; text-decoration: none;
}
.cal-day:hover { border-color: var(--blue); }
.cal-day.is-today { background: var(--blue); border-color: var(--blue); color: #fff; }
.cal-day.has-data::after {
    content: ""; position: absolute; right: 2px; bottom: 5px;
    width: 9px; height: 9px; border-radius: 50%; background: #1f9d75; border: 2px solid #fff;
}

.card {
    background: var(--card); border-radius: var(--radius-xl);
    box-shadow: var(--shadow); padding: 22px 24px;
}
.card-resumo { margin: 26px 0 12px; padding: 24px; }
.card-resumo h2 { font-size: 24px; font-weight: 800; margin-bottom: 18px; }
.resumo-linha { display: flex; align-items: center; gap: 16px; font-size: 20px; margin-top: 14px; }
.resumo-linha strong { font-weight: 800; }
.ic-green { color: #1f9d75; }

/* ── Barra de navegação inferior ──────────────────────────────────────── */
.tabbar {
    position: fixed; z-index: 50; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 480px;
    display: grid; grid-template-columns: 1fr 1fr;
    padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
    background: #fff; border-radius: 34px 34px 0 0;
    box-shadow: 0 -8px 30px rgba(10, 42, 92, .10);
}
.tab {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 6px 0 10px; color: #7b8494; font-size: 17px; font-weight: 700; text-decoration: none;
}
.tab.is-active { color: var(--blue); }
.tab.is-active::after {
    content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 62px; height: 5px; border-radius: 3px; background: var(--blue);
}

/* ── Tela do dia ──────────────────────────────────────────────────────── */
.sheet-day { padding: 22px 18px 8px; display: flex; flex-direction: column; gap: 16px; background: var(--bg); min-height: calc(100vh - 140px); }
.app-logged:has(.sheet-day), .app-logged:has(.sheet-values) { background: var(--bg); }
.card-roleta { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 20px 26px; border-radius: 26px; }
.roleta-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-label { font-size: 17px; font-weight: 700; color: #1a2540; }
.roleta-valor { font-size: 34px; line-height: 1.1; font-weight: 800; color: #0a1f44; font-variant-numeric: tabular-nums; }
.roleta-valor.is-vazio { color: #b3bbc9; }
.roleta-input {
    width: 100%; max-width: 220px; height: 50px; padding: 0 14px;
    border: 2px solid var(--blue); border-radius: 12px; font-size: 28px; font-weight: 800; color: #0a1f44;
    font-variant-numeric: tabular-nums;
}
.roleta-input:focus { outline: 0; box-shadow: 0 0 0 4px rgba(42, 91, 232, .15); }

.section-label { margin: 6px 4px -6px; font-size: 17px; font-weight: 700; color: #1a2540; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg-btn {
    min-height: 58px; border-radius: 999px; border: 1.5px solid #cdd3de; background: #fff;
    font-size: 19px; font-weight: 800; color: #1a2540; font-variant-numeric: tabular-nums;
}
.seg-btn[aria-checked="true"] { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }

.count-row { display: grid; grid-template-columns: 1fr 92px; gap: 12px; align-items: stretch; }
.btn-count {
    justify-content: space-between; min-height: 76px; padding: 0 16px 0 24px;
    border-radius: 999px; font-size: clamp(16px, 4.5vw, 19px); text-align: left; line-height: 1.15; user-select: none; -webkit-user-select: none;
}
.btn-count:active { transform: scale(.97); }
.count-box {
    display: flex; align-items: center; justify-content: center; min-height: 76px;
    border-radius: 24px; background: #fff; border: 2.5px solid; font-size: 24px; font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.count-green { border-color: var(--green); color: var(--green-dark); }
.count-blue  { border-color: var(--blue);  color: var(--blue); }

.card-valor { text-align: center; border: 2.5px solid var(--green); box-shadow: none; padding: 22px 16px; }
.card-total { text-align: center; padding: 24px 16px; }
.valor-grande, .total-grande {
    margin: 6px 0; font-size: clamp(40px, 12vw, 54px); line-height: 1.05; font-weight: 800;
    color: #0a1f44; font-variant-numeric: tabular-nums; letter-spacing: -1px;
}
.muted { color: var(--muted); font-size: 16px; }
.card .muted { margin-top: 4px; }
.conferencia { margin-top: 10px; display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 15px; font-weight: 700; }
.conferencia.ok   { background: var(--green-soft); color: var(--green-dark); }
.conferencia.alerta { background: var(--warn-bg); color: var(--warn-ink); }

/* Janela "corrigir contagem" */
.overlay {
    position: fixed; z-index: 80; inset: 0; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(4, 24, 59, .55);
}
.bottom-sheet {
    width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
    padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
    background: #fff; border-radius: 28px 28px 0 0; animation: sheet-in .2s ease-out;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.bottom-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.bottom-sheet-head h2 { font-size: 22px; font-weight: 800; }
.ajuste-lista { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ajuste-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 12px 12px 18px; border-radius: 18px; background: var(--bg);
}
.ajuste-item strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.ajuste-item small { display: block; color: var(--muted); font-size: 14px; }
.ajuste-btn {
    width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--danger); background: #fff; color: var(--danger);
    display: inline-flex; align-items: center; justify-content: center;
}
.ajuste-btn:disabled { opacity: .35; cursor: default; }
.ajuste-vazio { text-align: center; color: var(--muted); padding: 18px 0; }

/* ── Plantão do dia (lista de carros + acerto) ───────────────────────── */
.day-title .hello { font-size: 15px; font-weight: 600; opacity: .85; margin-bottom: 2px; }
.avatar-top { position: absolute; right: 14px; top: calc(18px + env(safe-area-inset-top)); width: 48px; height: 48px; font-size: 20px; }
.topbar-day .back-right { left: auto; right: 12px; background: rgba(255, 255, 255, .10); }

.sheet-plantao { padding: 22px 18px 8px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); min-height: calc(100vh - 150px); }
.btn-novo-carro { justify-content: center; min-height: 68px; font-size: 20px; }
.lista-titulo { margin: 8px 4px -2px; font-size: 18px; font-weight: 800; color: #1a2540; }
.vazio { padding: 22px 18px; border-radius: 22px; background: #fff; box-shadow: var(--shadow-sm); text-align: center; color: var(--muted); }

.carros { display: flex; flex-direction: column; gap: 12px; }
.carro-card {
    display: block; padding: 18px 20px; border-radius: 24px; background: #fff; box-shadow: var(--shadow);
    color: inherit; text-decoration: none; border: 2px solid transparent;
}
.carro-card:hover { border-color: var(--blue); }
.carro-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.carro-nome { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.carro-roleta { margin-top: 6px; font-size: 17px; color: #3a4560; font-variant-numeric: tabular-nums; }
.carro-roleta strong { color: var(--ink); }
.carro-aviso { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--warn-ink); }
.carro-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.chip-ok     { background: var(--green-soft); color: var(--green-dark); }
.chip-alerta { background: var(--warn-bg); color: var(--warn-ink); }
.chip-espera { background: #eef1f6; color: #5f6b7d; }

.acerto { margin-top: 6px; padding: 22px 22px 20px; border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.acerto h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.acerto-linha { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 18px; border-bottom: 1px solid #edf0f5; }
.acerto-linha strong { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.acerto-menos { color: var(--muted); }
.acerto-forte span, .acerto-forte strong { font-weight: 800; color: var(--ink); }
.acerto-detalhe { margin-top: 10px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.acerto-total {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 14px 16px;
    border-radius: 18px; background: var(--green-soft); color: var(--green-dark); font-weight: 800; font-size: 18px;
}
.acerto-total span { flex: 1; min-width: 0; }
.acerto-total strong { font-size: clamp(22px, 6.8vw, 28px); letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acerto-alerta { margin: 14px 0 0; }

.btn-danger { background: #fff; border: 2px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.sep { border: 0; border-top: 1.5px solid #e4e8ef; margin: 22px 0 16px; }
#editar-carro .muted, #novo-carro .muted { margin-bottom: 12px; }
#form-carro .field:last-of-type { margin-bottom: 22px; }

/* ── Valores da passagem ──────────────────────────────────────────────── */
.sheet-values { display: flex; flex-direction: column; min-height: calc(100vh - 230px); padding-top: 26px; }
.lead-center { text-align: center; color: #4a5568; font-size: 17px; font-weight: 500; margin-bottom: 26px; }
#form-valores { flex: 1; display: flex; flex-direction: column; gap: 22px; }
#form-valores .btn-pill { margin-top: auto; margin-bottom: 8px; }
.value-card { padding: 22px 22px 22px 26px; border-radius: 26px; }
.value-label { display: block; font-size: 19px; font-weight: 800; color: #3a4be0; }
.value-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.value-prefix { font-size: 32px; font-weight: 800; color: var(--ink); }
.value-input {
    width: 150px; border: 0; background: transparent; padding: 4px 0;
    font-size: 36px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums;
}
.value-input:focus { outline: 0; border-bottom: 3px solid var(--blue); }
.value-input::placeholder { color: #c0c7d4; }

/* ── Meus dados ───────────────────────────────────────────────────────── */
.sheet-perfil { padding: 0 24px 8px; }
.avatar-wrap { position: relative; width: 112px; margin: -30px auto 8px; }
.avatar-cam {
    position: absolute; right: -2px; bottom: 4px; width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: #4a5568; border: 2px solid var(--line); cursor: pointer; box-shadow: var(--shadow-sm);
}
#form-perfil { display: flex; flex-direction: column; }
.row-field {
    position: relative; display: block; padding: 14px 36px 12px 2px;
    border-bottom: 1.5px solid #dfe3ea; text-decoration: none; color: inherit;
}
.row-field:focus-within { border-bottom-color: var(--blue); }
.row-label { display: block; font-size: 15px; color: #4a5568; }
.row-input {
    display: block; width: 100%; padding: 2px 0; border: 0; background: transparent;
    font-size: 21px; font-weight: 800; color: var(--ink);
}
.row-input:focus { outline: 0; }
.row-static { color: var(--blue); font-size: 18px; }
.row-chev { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: #1f9d75; }
#form-perfil .btn-pill { margin-top: 30px; }
.logout-form { margin-top: 26px; text-align: center; }
.logout-btn {
    display: inline-flex; align-items: center; gap: 12px; padding: 10px 14px;
    border: 0; background: transparent; color: var(--ink); font-size: 16px; font-weight: 600;
}
.logout-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid #aab2c0; color: #6b7587;
}

/* ── Acessibilidade: respeita quem reduz animações ────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
