:root {
    --bg: #f1f3f5;
    --surface: #ffffff;
    --surface-strong: #15191e;
    --text: #171a1f;
    --muted: #6e7681;
    --line: #dfe3e7;
    --primary: #1f9d63;
    --primary-dark: #147947;
    --warning: #ef9f24;
    --danger: #dc3d4b;
    --info: #3d73d9;
    --radius: 24px;
    --shadow: 0 14px 40px rgba(18, 26, 35, 0.09);
    color-scheme: light;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 100% 0, rgba(31, 157, 99, 0.11), transparent 35%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

.boot-screen,
.auth-screen {
    display: grid;
    min-height: 100vh;
    padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    place-items: center;
}
.boot-screen {
    align-content: center;
    gap: 14px;
}
.boot-screen img {
    width: 112px;
    height: 112px;
    border-radius: 28px;
    object-fit: contain;
    box-shadow: var(--shadow);
}
.boot-screen span {
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
}
.auth-card {
    width: min(100%, 460px);
    padding: 34px 26px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.install-card {
    text-align: left;
}

.install-guide-open {
    overflow: hidden;
}

.install-guide-dialog {
    width: min(100% - 24px, 520px);
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 28px;
    background: #fff;
    box-shadow: var(--shadow);
}

.install-guide-dialog::backdrop {
    background: rgba(15, 20, 26, 0.66);
    backdrop-filter: blur(6px);
}

.install-guide {
    display: grid;
    max-height: calc(100dvh - 24px);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.install-guide-header {
    display: flex;
    padding: 22px 22px 14px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.install-guide-header h2 {
    margin: 0;
    font-size: 22px;
}

.install-guide-track {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.install-guide-track::-webkit-scrollbar {
    display: none;
}

.install-guide-slide {
    display: grid;
    min-width: 100%;
    padding: 0 22px;
    overflow-y: auto;
    align-content: start;
    scroll-snap-align: start;
}

.install-guide-slide img {
    width: 100%;
    max-height: 48dvh;
    border-radius: 18px;
    object-fit: contain;
    background: #f3f5f7;
}

.install-guide-slide > div {
    padding: 14px 0 4px;
}

.install-guide-slide span {
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.install-guide-slide h3 {
    margin: 5px 0 6px;
    font-size: 20px;
}

.install-guide-slide p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.45;
}

.install-guide-dots {
    display: flex;
    padding: 14px;
    justify-content: center;
    gap: 7px;
}

.install-guide-dots button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ccd2d8;
}

.install-guide-dots button.is-active {
    width: 24px;
    border-radius: 999px;
    background: var(--primary);
}

.install-guide-actions {
    display: grid;
    padding: 0 22px max(22px, env(safe-area-inset-bottom));
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.brand-mark {
    display: grid;
    width: 74px;
    height: 74px;
    margin-bottom: 26px;
    border-radius: 24px;
    overflow: hidden;
    place-items: center;
}
.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(30px, 7vw, 42px);
    line-height: 1.04;
}

h2 {
    margin-bottom: 16px;
    font-size: 24px;
    line-height: 1.1;
}

.auth-copy,
.muted {
    color: var(--muted);
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}

label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 58px;
    padding: 0 17px;
    border: 1px solid var(--line);
    border-radius: 16px;
    outline: none;
    color: var(--text);
    background: #fff;
    font-size: 18px;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(31, 157, 99, 0.12);
}

.button {
    display: inline-flex;
    min-height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 16px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.button:active {
    transform: scale(0.98);
}

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

.button-large {
    min-height: 62px;
}

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

.button-primary {
    color: #fff;
    background: var(--primary);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    color: var(--text);
    background: #e8ebee;
}

.button-warning {
    color: #201406;
    background: #ffc15b;
}

.button-danger {
    color: #fff;
    background: var(--danger);
}

.call-step {
    margin-top: 24px;
    padding: 22px;
    border-radius: 20px;
    text-align: center;
    background: #f3f5f6;
}

.call-number {
    display: block;
    margin: 10px 0 15px;
    color: var(--text);
    font-size: 30px;
    font-weight: 900;
    text-decoration: none;
}

.call-button {
    width: 100%;
    margin-bottom: 14px;
    font-size: 20px;
    text-decoration: none;
}

.loader-line {
    position: relative;
    height: 5px;
    margin: 18px 0;
    overflow: hidden;
    border-radius: 999px;
    background: #dce1e4;
}

.loader-line::after {
    position: absolute;
    width: 45%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    content: "";
    animation: loading 1.2s ease-in-out infinite;
}

@keyframes loading {
    from { left: -45%; }
    to { left: 100%; }
}

.form-error {
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 12px;
    color: #8d1620;
    background: #ffe6e8;
    font-weight: 700;
}

.app-shell {
    width: min(100%, 760px);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
}

.app-header {
    display: flex;
    padding: 8px 4px 20px;
    align-items: center;
    justify-content: space-between;
}

.app-header h1 {
    margin: 0;
    font-size: 28px;
}

.organization-button {
    padding: 5px 0;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: 14px;
    font-weight: 700;
}

.connection-state {
    display: grid;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(30, 37, 44, 0.08);
    place-items: center;
}

.connection-state span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 6px rgba(31, 157, 99, 0.13);
}

.connection-state.is-offline span {
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(220, 61, 75, 0.13);
}

.shift-bar {
    display: flex;
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 21px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--surface);
    box-shadow: 0 8px 26px rgba(30, 37, 44, 0.06);
}

.shift-bar strong,
.shift-bar span {
    display: block;
}

.shift-bar span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.warning-banner {
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 18px;
    color: #5d3700;
    background: #ffe5b7;
    font-weight: 800;
}

.warning-banner.is-overdue {
    color: #fff;
    background: var(--danger);
}

.app-view {
    display: none;
}

.app-view.is-active {
    display: block;
}

.active-order-card {
    position: relative;
    margin-bottom: 22px;
    padding: 24px;
    overflow: hidden;
    border-radius: 28px;
    color: #fff;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    transition:
        opacity 280ms ease,
        transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
        max-height 360ms cubic-bezier(0.22, 1, 0.36, 1),
        margin 360ms cubic-bezier(0.22, 1, 0.36, 1),
        padding 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.active-order-card.is-delivered-out {
    max-height: 0 !important;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
}

.active-order-card.is-delivered-in {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
}

.active-order-card.is-warning {
    color: #241606;
    background: #f3ae3d;
}

.active-order-card.is-overdue {
    background: #a92632;
}

.active-order-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.status-pill {
    display: inline-flex;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    align-items: center;
    color: var(--text);
    background: #e9edf0;
    font-size: 12px;
    font-weight: 900;
}

.active-order-card .status-pill {
    background: rgba(255, 255, 255, 0.9);
}

.eta-block {
    margin: 28px 0 22px;
}

.eta-block small {
    display: block;
    margin-bottom: 2px;
    opacity: 0.7;
    font-weight: 700;
}

.eta-time {
    display: block;
    font-size: clamp(42px, 12vw, 72px);
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    line-height: 1;
}
.eta-time.is-dated,
.eta-time.is-label {
    font-size: clamp(22px, 7vw, 38px);
}

.eta-countdown {
    display: block;
    margin-top: 8px;
    font-size: 17px;
    font-weight: 800;
}

.active-address {
    margin-bottom: 18px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.active-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.active-actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.active-actions .button {
    min-height: 64px;
}

.active-actions .button-wide {
    width: 100%;
}

.active-order-card .button-secondary {
    background: #fff;
}

.active-order-card .button-danger {
    background: #e44855;
}

.empty-card {
    margin-bottom: 22px;
    padding: 34px 22px;
    border: 1px dashed #cfd5da;
    border-radius: 26px;
    text-align: center;
    background: rgba(255, 255, 255, 0.65);
}

.empty-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 21px;
}

.empty-card span {
    color: var(--muted);
}

.section-block {
    margin-top: 22px;
}

.courier-statistics,
.history-statistics {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
}

.courier-statistics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-statistics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.courier-stat-card,
.history-stat-card {
    min-width: 0;
    padding: 16px 12px;
    border: 1px solid rgba(20, 28, 35, 0.06);
    border-radius: 19px;
    background: var(--surface);
    box-shadow: 0 6px 22px rgba(30, 37, 44, 0.05);
}

.courier-stat-card {
    appearance: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.courier-stat-card:active {
    transform: scale(0.97);
}

.courier-stat-card:focus-visible {
    border-color: var(--primary);
    outline: 3px solid rgba(38, 157, 105, 0.18);
    outline-offset: 2px;
}

.courier-stat-card strong,
.history-stat-card strong {
    display: block;
    margin-bottom: 5px;
    font-size: clamp(22px, 6vw, 30px);
    line-height: 1;
}

.courier-stat-card span,
.history-stat-card span {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
}

.history-filter {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.history-filter::-webkit-scrollbar {
    display: none;
}

.history-filter-button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    background: var(--surface);
    font-weight: 850;
}

.history-filter-button.is-active {
    border-color: var(--surface-strong);
    color: #fff;
    background: var(--surface-strong);
}

.flatpickr-calendar {
    z-index: 150 !important;
    border: 0;
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.section-heading {
    display: flex;
    margin: 6px 3px 14px;
    align-items: flex-end;
    justify-content: space-between;
}

.section-heading h2 {
    margin: 0;
}

.count-badge {
    display: grid;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 12px;
    color: #fff;
    background: var(--surface-strong);
    font-weight: 900;
    place-items: center;
}

.order-list {
    display: grid;
    gap: 12px;
}

.order-card {
    padding: 18px;
    border: 1px solid rgba(20, 28, 35, 0.05);
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 6px 22px rgba(30, 37, 44, 0.05);
}

.order-card-header,
.order-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.order-id {
    font-size: 19px;
    font-weight: 900;
}

.order-address {
    margin: 15px 0 6px;
    font-weight: 800;
    line-height: 1.3;
}

.order-meta {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
}
.order-meta.is-today {
    color: var(--text);
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.order-total {
    font-weight: 900;
}

.small-button {
    min-height: 44px;
    padding: 0 15px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: var(--surface-strong);
    font-weight: 800;
}

.profile-card {
    padding: 30px 22px;
    border-radius: 26px;
    text-align: center;
    background: #fff;
    box-shadow: var(--shadow);
}

.profile-avatar {
    display: grid;
    width: 88px;
    height: 88px;
    margin: 0 auto 18px;
    border-radius: 28px;
    color: #fff;
    background: var(--surface-strong);
    font-size: 27px;
    font-weight: 900;
    place-items: center;
}

.profile-card h2 {
    margin-bottom: 6px;
}

.profile-card p {
    margin-bottom: 0;
    color: var(--muted);
}

.safety-note {
    margin-top: 22px;
    padding: 15px;
    border-radius: 16px;
    color: #694312;
    background: #fff0d6;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.bottom-nav {
    position: fixed;
    z-index: 30;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    max-width: 720px;
    min-height: 72px;
    margin: 0 auto;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(21, 25, 30, 0.95);
    box-shadow: 0 18px 44px rgba(9, 15, 20, 0.28);
    backdrop-filter: blur(15px);
}

.nav-button {
    display: flex;
    border: 0;
    border-radius: 17px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #aeb5bc;
    background: transparent;
    font-size: 10px;
    font-weight: 800;
}

.nav-button span {
    font-size: 20px;
    line-height: 1;
}

.nav-button.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.sheet-backdrop {
    position: fixed;
    z-index: 80;
    inset: 0;
    background: rgba(9, 12, 16, 0.54);
    backdrop-filter: blur(3px);
}

.bottom-sheet {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: 760px;
    max-height: 92vh;
    margin: 0 auto;
    padding: 34px 22px calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 30px 30px 0 0;
    background: #fff;
    box-shadow: 0 -20px 55px rgba(10, 15, 20, 0.2);
    animation: sheet-in 0.22s ease-out;
}

@keyframes sheet-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sheet-handle {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 44px;
    height: 5px;
    border-radius: 99px;
    background: #d8dde0;
    transform: translateX(-50%);
}

.sheet-close {
    position: absolute;
    top: 22px;
    right: 20px;
    display: grid;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 15px;
    background: #edf0f2;
    font-size: 27px;
    place-items: center;
}

.sheet-order-number {
    margin-bottom: 8px;
    font-size: 34px;
    font-weight: 900;
}

.sheet-address {
    margin: 22px 0;
    font-size: 23px;
    font-weight: 850;
    line-height: 1.25;
}

.sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

.sheet-actions .button {
    min-height: 62px;
}

.detail-grid {
    display: grid;
    margin-bottom: 20px;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {
    padding: 14px;
    border-radius: 15px;
    background: #f1f3f5;
}

.detail-item span,
.detail-item strong {
    display: block;
}

.detail-item span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.items-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.items-list li {
    display: grid;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.items-list small {
    color: var(--muted);
}

.eta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 11px;
}

.eta-grid-three {
    grid-template-columns: repeat(3, 1fr);
}

.eta-grid button {
    min-height: 92px;
    border: 1px solid var(--line);
    border-radius: 20px;
    color: var(--text);
    background: #f5f6f7;
    font-size: 32px;
    font-weight: 900;
}

.eta-grid button span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.custom-eta {
    display: grid;
    margin-top: 18px;
    gap: 8px;
}

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

.organization-list button {
    min-height: 62px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 17px;
    text-align: left;
    background: #f5f6f7;
    font-weight: 850;
}

.organization-list button.is-active {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: #e5f5ec;
}

.toast {
    position: fixed;
    z-index: 120;
    right: 18px;
    bottom: calc(100px + env(safe-area-inset-bottom));
    left: 18px;
    max-width: 520px;
    margin: auto;
    padding: 16px 18px;
    border-radius: 17px;
    color: #fff;
    background: #171c21;
    box-shadow: var(--shadow);
    text-align: center;
    font-weight: 800;
}

@media (min-width: 700px) {
    .app-shell {
        padding-right: 24px;
        padding-left: 24px;
    }

    .order-list {
        grid-template-columns: 1fr 1fr;
    }

    .active-order-card {
        padding: 30px;
    }
}

@media (max-width: 390px) {
    .shift-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .sheet-actions {
        grid-template-columns: 1fr;
    }

    .eta-grid-three {
        grid-template-columns: 1fr;
    }
}

@media (display-mode: standalone) {
    #install-app-button {
        display: none;
    }
}

.maps-install-dialog {
    width: min(100% - 32px, 420px);
    color: var(--text);
    background: var(--surface);
}

.maps-install-card {
    padding: 28px 24px 22px;
    text-align: center;
}

.maps-install-mark {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 20px;
    place-items: center;
    color: var(--surface);
    background: var(--primary);
    font-size: 34px;
    font-weight: 800;
}

.maps-install-card h2 {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.15;
}

.maps-install-card p {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.5;
}

.maps-install-actions {
    display: grid;
    gap: 10px;
}

.maps-install-primary,
.maps-install-secondary {
    display: inline-flex;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.maps-install-primary {
    color: var(--surface);
    background: var(--primary);
}

.maps-install-secondary {
    color: var(--text);
    background: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
