:root {
    --accent: #ff7a00;
    --ink: #111111;
    --muted: #6f7782;
    --line: #e3e7ec;
    --surface: #ffffff;
    --background: #f7f8fa;
    --success: #16794b;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

.page {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 60px;
}

.header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 22px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 14px;
    height: 34px;
    background: var(--accent);
    border-radius: 999px;
    transform: skew(-12deg);
}

h1 {
    margin: 5px 0 0;
    font-size: clamp(26px, 4vw, 40px);
    letter-spacing: -0.04em;
}

.subtitle {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
    gap: 20px;
    align-items: start;
}

.card,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(16, 24, 40, 0.05);
    overflow: hidden;
}

.card-body {
    padding: 22px;
}

.card-title {
    margin: 0 0 18px;
    font-size: 19px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field.full {
    grid-column: 1 / -1;
}

.field-spaced {
    margin-top: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #363b43;
    font-size: 13px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ccd2da;
    border-radius: 10px;
    background: white;
    color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(255, 122, 0, 0.2);
    outline-offset: 2px;
    border-color: var(--accent);
}

.inline-check {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid #ccd2da;
    border-radius: 10px;
}

.inline-check input {
    width: 18px;
    min-height: auto;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.route-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.field-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.privacy-note {
    padding: 12px 14px;
    border: 1px solid #d8dde4;
    border-radius: 10px;
    background: #f5f6f8;
    color: var(--muted);
    font-size: 13px;
}

.button {
    border: 0;
    border-radius: 10px;
    padding: 11px 15px;
    min-height: 44px;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.button-primary {
    background: var(--accent);
    color: white;
}

.button-secondary {
    background: #eff1f4;
    color: #22262c;
}

.button-danger {
    background: #fff1f0;
    color: var(--danger);
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
}

.button-full {
    width: 100%;
    margin-top: 18px;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.actions > * {
    flex: 1;
}

.calculation {
    margin-top: 14px;
    padding: 13px 14px;
    background: #fff7ef;
    border: 1px solid #ffd5ad;
    border-radius: 11px;
    font-size: 14px;
}

.calculation strong {
    font-size: 19px;
}

.flash {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 11px;
    font-weight: 650;
}

.flash.success {
    background: #eaf7f0;
    color: var(--success);
}

.flash.error {
    background: #fff1f0;
    color: var(--danger);
}

.summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-bottom: 1px solid var(--line);
}

.summary-item {
    padding: 19px 22px;
}

.summary-item + .summary-item {
    border-left: 1px solid var(--line);
}

.summary-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.summary-value {
    margin-top: 4px;
    font-size: 28px;
    font-weight: 850;
    letter-spacing: -0.04em;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

td {
    font-size: 14px;
}

.km {
    white-space: nowrap;
    font-weight: 800;
}

.route {
    color: var(--muted);
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.4;
}

.badge {
    display: inline-flex;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.badge.done {
    background: #eaf7f0;
    color: var(--success);
}

.badge.open {
    background: #fff2e6;
    color: #a44b00;
}

.table-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.link-button {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
}

.customer-totals {
    padding: 18px 20px 6px;
}

.totals-title {
    margin-bottom: 8px;
}

.customer-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

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

.empty {
    padding: 35px 20px;
    color: var(--muted);
    text-align: center;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-card {
    width: min(420px, 100%);
    padding: 30px;
}

.error-code {
    margin-top: 28px;
    color: var(--accent);
    font-size: 54px;
    font-weight: 900;
    letter-spacing: -0.05em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 860px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .page {
        width: min(100% - 18px, 1120px);
        padding-top: 16px;
    }

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

    .field.full {
        grid-column: auto;
    }

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

    .filters {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        overflow-x: auto;
    }

    th,
    td {
        padding: 11px 12px;
    }

    .hide-mobile {
        display: none;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions > * {
        flex: 1;
    }
}
