:root {
    --ink: #17211e;
    --muted: #66736c;
    --paper: #f6f7f2;
    --line: #dfe4dc;
    --brand: #1f6f5b;
    --mint: #bdebd7;
    --lime: #d6ff6b;
    --amber: #f4b942;
    --red: #d95550;
    --white: #fff;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.mobile-shell {
    display: flex;
    justify-content: center;
}

.rider-app {
    width: min(100%, 480px);
    min-height: 100vh;
    padding: 16px;
}

.app-hero,
.workshop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 0;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

p,
h1,
h2 {
    margin: 0;
}

p {
    color: var(--muted);
    font-size: 0.85rem;
}

h1 {
    font-size: 2rem;
    line-height: 1.05;
}

h2 {
    font-size: 1.05rem;
}

.strava-button,
.compact-button,
.primary-button,
.nav-link,
.install-button,
.auth-tab {
    border: 0;
    cursor: pointer;
    text-decoration: none;
}

.strava-button {
    display: grid;
    min-width: 54px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    color: var(--white);
    background: #fc4c02;
    font-weight: 800;
    padding: 0 12px;
}

.nav-link,
.install-button {
    display: none;
    min-height: 38px;
    align-items: center;
    border-radius: 8px;
    padding: 0 12px;
    color: var(--brand);
    background: #e7f0ec;
    font-weight: 700;
}

.install-button {
    color: var(--ink);
    background: var(--lime);
}

.compact-button {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--ink);
    background: var(--lime);
}

.danger-button {
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px;
    color: var(--red);
    background: #ffe2e1;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    color: var(--white);
    background: var(--brand);
    font-weight: 700;
}

.auth-shell {
    display: grid;
    gap: 18px;
}

.auth-copy {
    padding: 20px 0 4px;
}

.auth-copy h2 {
    margin-bottom: 8px;
    font-size: 1.65rem;
}

.auth-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    padding: 14px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.account-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    border: 0;
    padding: 0;
    margin: 0;
}

.account-type legend {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.86rem;
}

.account-type label {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--ink);
}

.account-type input {
    width: 16px;
    min-height: 16px;
}

.access-denied {
    width: min(640px, calc(100% - 32px));
    margin: 80px auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.primary-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    margin-top: 18px;
    border-radius: 8px;
    padding: 0 14px;
    color: var(--white);
    background: var(--brand);
    text-decoration: none;
    font-weight: 700;
}

.auth-tab {
    min-height: 42px;
    border-radius: 8px;
    background: #edf1ea;
    color: var(--muted);
    font-weight: 700;
}

.auth-tab.active {
    background: var(--brand);
    color: var(--white);
}

.form-message {
    min-height: 20px;
    margin-top: 10px;
    color: var(--red);
    font-size: 0.9rem;
}

.form-message.success {
    color: var(--brand);
}

.profile-panel {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.profile-panel img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: #e7f0ec;
}

.profile-panel h2 {
    margin: 2px 0 4px;
    font-size: 1.2rem;
}

.profile-panel span {
    color: var(--muted);
    font-size: 0.88rem;
}

.photo-button,
.connect-button {
    min-height: 38px;
    place-items: center;
    border-radius: 8px;
    padding: 0 12px;
    color: var(--brand);
    background: #e7f0ec;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.connect-button {
    display: grid;
    color: var(--white);
    background: #fc4c02;
}

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

.metric-band {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    margin: 8px 0 16px;
    padding: 16px;
    border-radius: 8px;
    background: var(--brand);
    color: var(--white);
}

.metric-band span {
    display: block;
    color: var(--mint);
    margin-bottom: 8px;
}

.metric-band strong {
    font-size: 2rem;
}

.km-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.km-form input {
    min-height: 36px;
    border: 0;
}

.km-form button {
    min-width: 110px;
}

.ghost-button {
    background: #e7f0ec;
    color: var(--brand);
}

.stack {
    display: grid;
    gap: 10px;
}

.alert-card,
.panel,
.settings-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.alert-card {
    padding: 14px;
}

.alert-card strong {
    display: block;
    margin-bottom: 5px;
}

.alert-card.amarelo {
    border-left: 6px solid var(--amber);
}

.alert-card.vermelho {
    border-left: 6px solid var(--red);
}

.panel {
    margin-bottom: 16px;
    padding: 14px;
}

.alerts-panel {
    padding: 0;
    border: 0;
    background: transparent;
}

.alerts-panel .section-title {
    margin: 0 0 10px;
}

.alerts-panel .section-title span,
.section-title span {
    color: var(--muted);
    font-size: 0.86rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.form-grid {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.86rem;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    color: var(--ink);
    background: var(--white);
}

textarea {
    min-height: 94px;
    resize: vertical;
}

.progress-track {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.progress-step {
    min-height: 48px;
    border-radius: 8px;
    padding: 7px;
    background: #edf1ea;
    color: var(--muted);
    font-size: 0.72rem;
}

.progress-step.active {
    background: var(--brand);
    color: var(--white);
}

.desktop-shell {
    min-width: 960px;
}

.workshop {
    width: min(1280px, calc(100% - 40px));
    margin: 0 auto;
}

.admin-shell {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
}

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.admin-row span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.admin-row mark {
    border-radius: 8px;
    padding: 8px 10px;
    background: #edf1ea;
    color: var(--muted);
}

.admin-row mark.aprovado {
    background: var(--mint);
    color: var(--brand);
}

.admin-row mark.pendente {
    background: #fff4d8;
    color: #725100;
}

.admin-row mark.reprovado {
    background: #ffe2e1;
    color: var(--red);
}

.admin-row mark.desabilitado {
    background: #edf1ea;
    color: var(--muted);
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.settings-row {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px;
}

.kanban {
    display: grid;
    grid-template-columns: repeat(5, minmax(170px, 1fr));
    gap: 12px;
    align-items: start;
}

.kanban-column {
    min-height: 62vh;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef2eb;
}

.kanban-column h2 {
    margin: 4px 4px 12px;
    font-size: 0.95rem;
}

.os-card {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    cursor: grab;
}

.os-card strong {
    font-size: 0.95rem;
}

.os-card span {
    color: var(--muted);
    font-size: 0.82rem;
}

.drag-over {
    outline: 2px solid var(--brand);
}

@media (max-width: 520px) {
    h1 {
        font-size: 1.75rem;
    }

    .metric-band {
        grid-template-columns: 1fr;
    }

    .profile-panel {
        grid-template-columns: 56px 1fr;
    }

    .profile-panel img {
        width: 56px;
        height: 56px;
    }

    .profile-panel form,
    .connect-button {
        grid-column: 1 / -1;
    }

    .km-form {
        grid-template-columns: 1fr;
    }

    .brand-lockup img {
        width: 48px;
        height: 48px;
    }

    .admin-row {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        flex-wrap: wrap;
    }
}

@media (min-width: 760px) {
    .mobile-shell {
        display: block;
        background:
            linear-gradient(90deg, rgba(31, 111, 91, 0.08), transparent 34%),
            var(--paper);
    }

    .rider-app {
        width: min(1120px, calc(100% - 48px));
        margin: 0 auto;
        padding: 34px 0 48px;
    }

    .app-hero {
        padding: 0 0 28px;
    }

    h1 {
        font-size: 2.45rem;
    }

    .nav-link,
    .install-button:not([hidden]) {
        display: flex;
    }

    .auth-shell {
        grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
        align-items: start;
        gap: 36px;
        padding-top: 18px;
    }

    .auth-copy {
        padding-top: 58px;
    }

    .auth-copy h2 {
        max-width: 560px;
        font-size: 3rem;
        line-height: 1.02;
    }

    .auth-copy p {
        max-width: 520px;
        margin-top: 14px;
        font-size: 1.05rem;
        line-height: 1.5;
    }

    .auth-card {
        padding: 22px;
        box-shadow: 0 14px 34px rgba(23, 33, 30, 0.06);
    }

    .rider-grid {
        display: grid;
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
        gap: 24px;
        align-items: start;
    }

    .overview-column,
    .action-column {
        display: grid;
        gap: 18px;
        min-width: 0;
    }

    .metric-band {
        min-height: 190px;
        margin: 0;
        padding: 28px;
        align-content: space-between;
        overflow: hidden;
    }

    .metric-band strong {
        font-size: clamp(2.35rem, 4vw, 3.2rem);
        line-height: 1;
    }

    .km-form {
        grid-template-columns: 1fr 1fr;
        width: 100%;
        max-width: 420px;
        justify-self: end;
    }

    .km-form input {
        grid-column: 1 / -1;
    }

    .profile-panel {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .connect-button,
    .profile-panel form {
        grid-column: 1 / -1;
    }

    .panel,
    .alert-card,
    .profile-panel {
        padding: 20px;
        box-shadow: 0 14px 34px rgba(23, 33, 30, 0.06);
    }

    .alerts-panel {
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .span-2 {
        grid-column: 1 / -1;
    }

    input,
    select {
        min-height: 48px;
    }

    .progress-step {
        min-height: 62px;
        padding: 10px;
        font-size: 0.82rem;
    }

    textarea {
        min-height: 126px;
    }
}
