*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F5F5F5;
    color: #212121;
    -webkit-font-smoothing: antialiased;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 70px;
}

.top-bar {
    background: #512BD4;
    color: white;
    padding: 16px;
    text-align: center;
}
.top-bar h1 { font-size: 22px; font-weight: 700; }

.content {
    flex: 1;
    padding: 16px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #E0E0E0;
    padding: 8px 0;
    z-index: 100;
}

.bottom-nav a {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #757575;
    font-size: 12px;
    padding: 4px 4px;
    border-radius: 8px;
    transition: 0.2s;
}
.bottom-nav a.active { color: #512BD4; }
.nav-icon { font-size: 22px; }
.nav-label {
    margin-top: 2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s;
}
.dashboard-card:active { transform: scale(0.97); }
.card-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.card-title { font-size: 16px; font-weight: 600; display: block; }
.card-sub { font-size: 12px; color: #757575; margin-top: 2px; display: block; }

.dashboard-access-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-top: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.dashboard-access-code h3 { font-size: 17px; margin-bottom: 4px; }
.dashboard-access-code p { color: #616161; font-size: 13px; margin-bottom: 8px; }
.access-code-value {
    display: block;
    color: #512BD4;
    font-size: 24px;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.access-code-status {
    display: block;
    color: #616161;
    font-size: 13px;
}

.form-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #616161; }
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}
.form-input:focus { border-color: #512BD4; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:active { opacity: 0.8; }
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn-primary { background: #512BD4; color: white; }
.btn-secondary { background: #E0E0E0; color: #424242; }
.btn-danger { background: #EF5350; color: white; }
.btn-sm { padding: 6px 10px; font-size: 14px; min-width: 36px; }
.btn-full { width: 100%; }
.btn-google {
    background: #FFFFFF;
    color: #2F3A45;
    border: 1px solid #D6DEE7;
}
.login-link-button {
    display: block;
    text-align: center;
    text-decoration: none;
}

.list-container { margin-top: 12px; }
.list-card {
    background: white;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.list-card.clickable,
.clickable-row {
    cursor: pointer;
}
.list-card.clickable:hover,
.clickable-row:hover {
    background: #F8F6FF;
}
.card-info { display: flex; flex-direction: column; gap: 4px; }
.card-actions { display: flex; gap: 4px; }
.ocr-info { font-size: 12px; color: #2E7D32; }

.odometer-photo-preview {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    margin-top: 10px;
    background: #FAFAFA;
}

.alert-pendente { border-left: 4px solid #FF9800; }
.alert-vencido { border-left: 4px solid #EF5350; }

.report-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}
.report-card {
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}
.report-card span { font-size: 13px; color: #616161; display: block; }
.report-card strong { font-size: 24px; display: block; margin-top: 4px; }
.report-card.blue { background: #E3F2FD; }
.report-card.blue strong { color: #1565C0; }
.report-card.green { background: #E8F5E9; }
.report-card.green strong { color: #2E7D32; }

.map-container {
    width: 100%;
    min-height: 420px;
    border: 1px solid #DDE3EA;
    border-radius: 8px;
    background: #E9EEF4;
    overflow: hidden;
}

.map-error {
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid #F6B8B8;
    border-radius: 8px;
    background: #FDECEC;
    color: #9F1D1D;
    font-size: 13px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stat-card span {
    display: block;
    color: #616161;
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-card strong {
    display: block;
    font-size: 24px;
}

.mini-chart {
    display: flex;
    align-items: end;
    gap: 8px;
    height: 150px;
    padding-top: 8px;
    overflow-x: auto;
}

.mini-bar {
    display: flex;
    flex-direction: column;
    justify-content: end;
    align-items: center;
    gap: 4px;
    min-width: 38px;
    height: 100%;
    color: #757575;
    font-size: 11px;
}

.mini-bar-value {
    width: 24px;
    min-height: 6px;
    border-radius: 5px 5px 0 0;
    background: #512BD4;
}

.empty { text-align: center; color: #9E9E9E; padding: 32px 0; }

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        linear-gradient(135deg, rgba(81,43,212,0.10), rgba(25,118,210,0.08)),
        #F5F7FA;
}

.login-panel {
    width: min(100%, 440px);
    background: #FFFFFF;
    border: 1px solid #E3E8EF;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 16px 40px rgba(20, 31, 45, 0.12);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.login-brand h2 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1.2;
}

.login-car {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: #1B74E4;
    color: #FFFFFF;
    font-weight: 800;
    letter-spacing: 0;
}

.subtitle,
.login-help {
    color: #637083;
    font-size: 13px;
    line-height: 1.45;
}

.login-section {
    display: grid;
    gap: 10px;
}

.login-section h3 {
    margin: 0;
    font-size: 15px;
    color: #2A3442;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: #7A8797;
    font-size: 12px;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #E3E8EF;
}

.alert-error {
    background: #FDECEC;
    border: 1px solid #F6B8B8;
    color: #9F1D1D;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.4;
}

.code-input {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.terms-box {
    border: 1px solid #E3E8EF;
    border-radius: 8px;
    background: #F8FAFC;
    padding: 12px;
    margin-bottom: 18px;
}

.terms-scroll {
    max-height: 170px;
    overflow: auto;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.45;
    color: #516070;
    padding-right: 6px;
}

.terms-accept {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.35;
    color: #2A3442;
    cursor: pointer;
}

.terms-accept input {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.remember-login {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -4px 0 18px;
    font-size: 13px;
    color: #2A3442;
    cursor: pointer;
}

.remember-login input {
    width: 18px;
    height: 18px;
}

.language-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #637083;
}

.language-select {
    border: 1px solid #D6DEE7;
    border-radius: 8px;
    background: #FFFFFF;
    color: #2A3442;
    padding: 6px 8px;
}

.login-fallback-link {
    color: #1B74E4;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.btn-logout {
    border: 1px solid rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.12);
    color: #FFFFFF;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
}

.user-info {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.86;
}

.profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #EEEEEE;
}

.profile-row:last-child {
    border-bottom: 0;
}

.profile-row span,
.profile-help {
    color: #616161;
    font-size: 13px;
    line-height: 1.4;
}

.profile-row strong {
    color: #212121;
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
}

.profile-actions {
    justify-content: stretch;
}

.profile-actions .btn {
    flex: 1;
}

.profile-message {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.access-code-box {
    margin-top: 12px;
    padding: 14px;
    border-radius: 8px;
    background: #F1EDFF;
    color: #512BD4;
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.08em;
}

h2, h3 { margin-bottom: 8px; }
h3 { margin-bottom: 16px; }
.text-sm { font-size: 12px; color: #9E9E9E; }

@media (max-width: 520px) {
    .dashboard-access-code {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (min-width: 600px) {
    .dashboard-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
