:root {
    --brand: #1e1e2d;
    --accent: #435ebe;
    --background: #f4f6fb;
    --text: #253044;
    --muted: #6c7383;
    --card: #ffffff;
    --border: #dfe3ec;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
}

.app-shell {
    display: flex;
    align-items: center;
    width: min(100%, 480px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px;
}

.login-card,
.list-block,
.fuel-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.alert-message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    background: #ffe3e3;
    color: #7a1f1f;
    font-weight: 700;
}

.alert-message.is-success {
    background: #e1f5ea;
    color: #167048;
}

.login-card {
    width: 100%;
}

.brand-block {
    display: grid;
    gap: 10px;
    margin-bottom: 28px;
    justify-items: center;
    text-align: center;
}

.brand-block img {
    display: block;
    width: min(176px, 100%);
    height: auto;
}

h1,
h2,
p {
    margin: 0;
}

.brand-block h1 {
    font-size: 24px;
}

.brand-block p,
.list-block p,
.eyebrow,
.goal-panel span,
.result-grid span {
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    font: inherit;
}

input,
select {
    border: 1px solid var(--border);
    padding: 10px 12px;
    background: #fff;
    font-weight: 400;
}

input::placeholder {
    font-weight: 400;
}

input[readonly] {
    background: #f2f4f8;
}

button,
.primary-action {
    display: block;
    border: 0;
    padding: 14px 16px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
}

.home-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.home-header strong {
    display: block;
    font-size: 42px;
    line-height: 1;
}

.logout-link,
.page-title a {
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.goal-panel,
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.goal-panel div,
.result-grid div {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.goal-panel strong,
.result-grid strong {
    display: block;
    margin-top: 4px;
}

.primary-action {
    margin-bottom: 18px;
}

.list-block h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.page-title {
    margin-bottom: 18px;
}

.page-title h1 {
    margin-top: 10px;
    font-size: 26px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.home-shell {
    display: block;
    width: 100%;
    min-height: 100vh;
    padding: 0;
    background: #fbfcfe;
}

.driver-home {
    min-height: 100vh;
    background: #fbfcfe;
}

.driver-topbar {
    display: flex;
    min-height: 75px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 25px;
    border-bottom: 1px solid #d9dde6;
}

.driver-logo-link {
    display: inline-flex;
    align-items: center;
    min-width: 58px;
    min-height: 50px;
}

.driver-logo-link img {
    display: block;
    width: 58px;
    height: auto;
}

.driver-topbar a {
    color: #222833;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
}

.driver-home-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 48px;
    padding: 12px 0 12px 18px;
    letter-spacing: .02em;
}

.driver-home-link svg {
    width: 18px;
    height: 18px;
}

.driver-content {
    padding: 30px 25px 42px;
}

.driver-content h1 {
    margin-bottom: 26px;
    color: #222833;
    font-size: 24px;
    line-height: 1.1;
    font-weight: 800;
}

.driver-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 26px;
}

.driver-content .driver-title-row h1,
.fuel-content .driver-title-row h1 {
    display: block;
    flex: 1;
    margin: 0;
    margin-bottom: 0;
    min-height: 0;
    line-height: 1;
}

.driver-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 12px;
    height: 24px;
    min-width: 0;
    min-height: 0;
    color: #6c7383;
    font-size: 24px;
    line-height: 1;
    text-decoration: none;
}

.driver-back-link svg {
    display: block;
    width: 12px;
    height: 22px;
    max-height: 24px;
}

.driver-home-menu {
    display: grid;
    gap: 16px;
}

.driver-menu-card {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 86px;
    padding: 20px 22px;
    border: 1px solid #d9dde6;
    border-radius: 16px;
    background: #fff;
    color: #222833;
    text-decoration: none;
}

.driver-menu-card strong {
    font-size: 19px;
    line-height: 1.15;
    font-weight: 800;
}

.driver-menu-icon {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 14px;
    background: #eaf3fc;
    color: #2178c5;
}

.driver-menu-icon svg {
    width: 27px;
    height: 27px;
}

.ordem-list {
    display: grid;
    gap: 14px;
}

.ordem-card {
    display: grid;
    gap: 7px;
    padding: 18px 20px;
    border: 1px solid #d9dde6;
    border-radius: 14px;
    background: #fff;
    color: #222833;
    text-decoration: none;
}

.ordem-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.ordem-card span {
    color: #6c7383;
    font-size: 13px;
    font-weight: 400;
}

.ordem-card em {
    color: #6c7383;
    font-size: 13px;
    font-style: normal;
    font-weight: 800;
}

.ordem-card strong {
    font-size: 17px;
    line-height: 1.15;
}

.ordem-card small {
    color: #6c7383;
    font-size: 13px;
    line-height: 1.35;
}

.ordem-tabs {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin: 0 0 22px;
    border-bottom: 1px solid #d9dde6;
}

.ordem-tab-button {
    width: auto;
    min-height: 48px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    background: transparent;
    color: #435ebe;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 16px 10px;
}

.ordem-tab-button.is-active {
    background: #eef4ff;
    border-bottom-color: #435ebe;
    color: #435ebe;
}

.ordem-tab-panel {
    display: none;
}

.ordem-tab-panel.is-active {
    display: block;
}

.ordem-detail {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.ordem-detail div {
    display: grid;
    gap: 5px;
    padding: 14px 16px;
    border: 1px solid #d9dde6;
    border-radius: 12px;
    background: #fff;
}

.ordem-detail-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.ordem-detail span {
    color: #6c7383;
    font-size: 12px;
    font-weight: 800;
}

.ordem-detail strong {
    color: #222833;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 400;
}

.average-card {
    margin-bottom: 16px;
    padding: 22px 24px;
    background: #fff;
    border: 1px solid #c5cedc;
    border-radius: 18px;
}

.average-card.is-above {
    padding: 34px 38px;
    background: #35a86b;
    border-color: #35a86b;
    border-radius: 22px;
}

.average-card.is-below {
    padding: 34px 38px;
    background: #cc3d43;
    border-color: #c5cedc;
    border-radius: 22px;
}

.average-card p {
    color: #222833;
    font-size: 14px;
    font-weight: 400;
}

.average-card strong {
    display: block;
    margin: 8px 0 14px;
    font-size: 35px;
    line-height: 1;
    font-weight: 800;
}

.average-card.is-above > strong {
    margin: 0 0 22px;
    color: #fff;
    font-size: 44px;
}

.average-card span {
    display: block;
    color: #aaa;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 800;
}

.average-card.is-above span,
.average-card.is-below span {
    color: #fff;
    font-size: 20px;
    line-height: 1.12;
}

.average-card.is-above span {
    max-width: 330px;
}

.average-card.is-below span {
    margin-top: 22px;
    max-width: 330px;
}

.average-card.is-neutral > strong {
    color: #222833;
}

.average-alert-line {
    display: flex;
    align-items: center;
    gap: 24px;
}

.average-alert-line img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.average-alert-line strong {
    margin: 0;
    color: #ffeb2f;
    font-size: 42px;
}

.average-goal {
    margin-top: 30px;
    color: #fff;
    font-size: 22px;
    line-height: 1.1;
    font-weight: 800;
}

.average-goal strong {
    display: inline-block;
    margin: 0 0 0 8px;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    text-decoration: underline;
    text-underline-offset: 7px;
    text-decoration-thickness: 2px;
}

.previous-average {
    margin-bottom: 42px;
    color: #222833;
    font-size: 13px;
    line-height: 1.35;
}

.previous-average strong {
    font-weight: 800;
}

.driver-primary-action {
    display: block;
    margin-bottom: 54px;
    padding: 24px 18px;
    background: #2178c5;
    color: #fff;
    border-radius: 14px;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.history-block h2 {
    margin-bottom: 22px;
    color: #222833;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
}

.history-empty,
.history-item {
    border: 1px solid #d9dde6;
    border-radius: 14px;
    background: #fff;
}

.history-empty {
    padding: 24px;
    color: #6c7383;
    font-size: 17px;
}

.history-item {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 12px;
    padding: 18px 20px;
}

.history-item + .history-item {
    margin-top: 18px;
}

.history-date {
    color: #1f74c9;
    font-size: 13px;
    font-weight: 800;
}

.history-title {
    color: #222833;
    font-size: 15px;
    font-weight: 800;
}

.history-meta {
    margin-top: 6px;
    color: #6c7383;
    font-size: 13px;
}

@media (max-width: 390px) {
    .driver-topbar {
        min-height: 75px;
        padding: 12px 25px;
    }

    .driver-logo-link img {
        width: 58px;
    }

    .driver-content {
        padding: 30px 25px 42px;
    }

    .driver-content h1 {
        font-size: 24px;
        margin-bottom: 26px;
    }

    .driver-title-row h1 {
        margin-bottom: 0;
    }

    .average-card {
        padding: 22px;
    }

    .average-card strong {
        font-size: 35px;
    }

    .average-card.is-above,
    .average-card.is-below {
        padding: 28px 30px;
    }

    .average-card.is-above > strong {
        font-size: 40px;
    }

    .average-card.is-above span,
    .average-card.is-below span {
        font-size: 18px;
    }

    .average-alert-line {
        gap: 18px;
    }

    .average-alert-line img {
        width: 40px;
        height: 40px;
    }

    .average-alert-line strong {
        font-size: 38px;
    }

    .average-goal {
        font-size: 19px;
    }

    .average-goal strong {
        font-size: 32px;
    }

    .driver-primary-action {
        font-size: 20px;
        margin-bottom: 54px;
        padding: 24px 16px;
    }

    .history-block h2 {
        font-size: 18px;
    }

    .history-item {
        grid-template-columns: 68px 1fr;
        padding: 18px;
    }

    .ordem-card {
        padding: 16px 18px;
    }
}

.fuel-topbar {
    justify-content: flex-start;
}

.fuel-content h1 {
    margin-bottom: 28px;
}

.driver-form {
    display: grid;
    gap: 18px;
}

.driver-form label {
    display: grid;
    gap: 8px;
    color: #6c7383;
    font-size: 14px;
    font-weight: 800;
}

.driver-form input,
.driver-form select {
    width: 100%;
    min-height: 54px;
    border: 1px solid #c5cedc;
    border-radius: 9px;
    background: #fff;
    color: #6c7383;
    font-size: 16px;
    font-weight: 400;
    padding: 12px 16px;
}

.driver-form input[readonly] {
    background: #f8fafc;
}

.driver-form .uppercase-input {
    text-transform: uppercase;
}

.driver-photo-field {
    display: grid;
    gap: 8px;
}

.driver-photo-field > span {
    color: #6c7383;
    font-size: 14px;
    font-weight: 800;
}

.driver-photo-box {
    position: relative;
    display: grid;
    min-height: 132px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #c5cedc;
    border-radius: 14px;
    background: #fff;
    color: #6c7383;
    cursor: pointer;
}

.driver-photo-box input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.driver-photo-placeholder {
    display: grid;
    gap: 8px;
    place-items: center;
    text-align: center;
}

.driver-photo-placeholder svg {
    width: 34px;
    height: 34px;
}

.driver-photo-placeholder strong {
    color: #6c7383;
    font-size: 15px;
    font-weight: 800;
}

.driver-photo-preview {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 132px;
    object-fit: cover;
}

.driver-photo-box.has-photo .driver-photo-placeholder {
    display: none;
}

.driver-photo-box.has-photo .driver-photo-preview {
    display: block;
}

.signature-form-step {
    display: none;
    gap: 18px;
}

.signature-form-step.is-active {
    display: grid;
}

.signature-title {
    margin: 0;
    color: #6c7383;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 400;
}

.signature-pad-box {
    height: 190px;
    overflow: hidden;
    border: 1px solid #c5cedc;
    border-radius: 14px;
    background: #fff;
}

.signature-pad {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.signature-submit {
    margin-top: 0;
}

.driver-form .outros-posto-field {
    display: none;
}

.driver-form .outros-posto-field.is-visible {
    display: grid;
}

.driver-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.driver-submit,
.driver-cancel {
    display: block;
    min-height: 60px;
    border: 0;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.driver-submit {
    margin-top: 14px;
    background: #2178c5;
    color: #fff;
}

.driver-cancel {
    display: grid;
    place-items: center;
    background: #cbd1d8;
    color: #777;
}

.driver-cancel.signature-clear {
    border: 1px solid #c5cedc;
    background: #fff;
    color: #6c7383;
    font-weight: 600;
}

.calc-results {
    display: grid;
    gap: 18px;
}

.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.calc-card {
    min-height: 104px;
    padding: 20px 24px;
    border: 1px solid #c5cedc;
    border-radius: 18px;
    background: #fff;
}

.calc-card-full {
    min-height: 112px;
}

.calc-card span {
    display: block;
    margin-bottom: 10px;
    color: #6c7383;
    font-size: 14px;
    font-weight: 800;
}

.calc-card strong {
    display: block;
    color: #1f74c9;
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
}

.calc-card-full strong {
    font-size: 34px;
}

@media (max-width: 390px) {
    .driver-form {
        gap: 16px;
    }

    .driver-form input,
    .driver-form select {
        min-height: 52px;
        font-size: 15px;
        padding: 11px 14px;
    }

    .driver-field-grid {
        gap: 14px;
    }

    .calc-results,
    .calc-grid {
        gap: 14px;
    }

    .calc-card {
        min-height: 96px;
        padding: 18px 16px;
    }

    .calc-card span {
        font-size: 13px;
    }

    .calc-card strong {
        font-size: 23px;
    }

    .calc-card-full strong {
        font-size: 30px;
    }
}
