:root {
    color-scheme: dark;
    --bg: #101214;
    --surface: #1b1e22;
    --surface-raised: #292d32;
    --surface-muted: #353a40;
    --surface-highlight: #302c1c;
    --ink: #f7f8fa;
    --ink-soft: #e3e6eb;
    --muted: #afb6c0;
    --muted-strong: #d1d6de;
    --line: #34393f;
    --line-strong: #5c636c;
    --accent: #ffc414;
    --accent-bright: #ffd34d;
    --accent-ink: #17160f;
    --success: #7ed5a2;
    --success-soft: #20372b;
    --danger: #ff8989;
    --danger-soft: #3d2428;
    --focus: #f7f8fa;
    --radius-card: 8px;
    --radius-control: 8px;
    --page-gutter: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}
body[data-app-ready="false"] .app-shell {
    visibility: hidden;
}
body[data-app-ready="true"] .app-shell {
    visibility: visible;
}
button, input, select, textarea { font: inherit; }
button {
    min-width: 0;
    cursor: pointer;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
}
button:disabled { cursor: not-allowed; }
button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -3px;
}
button:focus:not(:focus-visible) { outline: 0; }
button:focus-visible:is(.active, .primary-button) { outline-color: var(--accent-ink); }
h1, h2, h3, p { margin: 0; }
h1 { max-width: 290px; font-size: 26px; line-height: 1.08; }
h2 { font-size: 25px; line-height: 1.1; }
h3 { font-size: 16px; line-height: 1.2; }

.app-shell {
    width: min(100%, 760px);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) max(var(--page-gutter), env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(var(--page-gutter), env(safe-area-inset-left));
}
.app-header, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header { position: relative; align-items: center; margin-bottom: 19px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.brand-mark, .profile-initial {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 21px;
    font-weight: 900;
}
.brand-logo {
    display: block;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 0;
}
.brand-lockup > div { min-width: 0; flex: 1 1 auto; }
.brand-lockup h1 { overflow-wrap: anywhere; }
.title-secondary { color: var(--muted); font-weight: 600; }
.header-actions { display: flex; flex-shrink: 0; align-items: center; gap: 5px; }
.language-switch { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--surface); }
.language-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    padding: 0 7px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.language-flag {
    display: block;
    flex: 0 0 auto;
    width: auto;
    height: 12px;
    object-fit: contain;
    border-radius: 0;
    line-height: 1;
}
.language-code {
    line-height: 1;
}
.menu-button {
    display: grid;
    gap: 3px;
    place-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--surface);
}
.menu-button span { display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--ink); }
.mobile-menu {
    position: absolute;
    z-index: 5;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    min-width: 196px;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--surface);
    box-shadow: 0 14px 28px rgba(0, 0, 0, .28);
}
.menu-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 8px 11px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-muted); }
.menu-profile-item { gap: 9px; }
.menu-profile-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 900; }

.eyebrow { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.subtitle { max-width: 470px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.notice { min-height: 0; margin: -4px 0 14px; padding: 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 600; }
.notice[data-kind="success"] { background: var(--success-soft); color: var(--success); }
.notice:empty { display: none; padding: 0; background: transparent; }
.role-switch {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    border-radius: var(--radius-control);
    background: var(--surface);
}
.role-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    padding: 6px 5px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.role-tab svg, .button-arrow svg, .refresh-button svg { width: 18px; height: 18px; }
.hero-copy { margin-bottom: 18px; }

.order-card, .driver-status-card, .profile-card {
    border-radius: var(--radius-card);
    background: var(--surface);
}
.route-card { padding: 12px; background: var(--surface); }
.route-point { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px; margin: -12px; border-radius: var(--radius-card); background: var(--surface); }
.route-point.active { background: var(--surface-highlight); }
.route-point.active::before { position: absolute; top: 14px; bottom: 14px; left: 0; width: 3px; border-radius: 2px; background: var(--accent); content: ""; }
.point-badge { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-muted); color: var(--ink); font-size: 12px; font-weight: 700; }
.route-point.active .point-badge { background: var(--accent); color: var(--accent-ink); }
.route-stem { height: 24px; margin: 2px 0 2px 14px; border-left: 1px dashed var(--line-strong); }
.field-group { display: grid; gap: 8px; width: 100%; min-width: 0; }
.field-group + .field-group { margin-top: 12px; }
label { color: var(--muted-strong); font-size: 13px; font-weight: 600; }
.field-hint { color: var(--muted); font-size: 12px; }
/* Выделяется только адрес целиком: вложенные группы не рисуют рамки. */
.focus-block { min-width: 0; }

.address-layout { display: grid; gap: 8px; min-width: 0; }
.address-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.address-layout.with-passengers .address-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.address-layout.without-entrance .address-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.address-layout.without-entrance.with-passengers .address-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.address-tab {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 1px;
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-control);
    padding: 6px 4px;
    background: var(--surface-raised);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}
.address-tab:disabled { opacity: .45; cursor: not-allowed; }
.address-tab-value { display: block; width: 100%; min-height: 14px; overflow: hidden; color: var(--accent); font-size: 12px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.address-tab.has-value:not(.active) span[data-i18n] { color: var(--muted); font-size: 11px; }
.address-tab.active .address-tab-value { color: var(--accent-ink); font-weight: 600; }
.address-tab span[data-i18n] { max-width: 100%; overflow-wrap: anywhere; }
.address-panel { display: grid; gap: 6px; min-width: 0; }
.address-choice { display: grid; gap: 6px; min-width: 0; }
.address-choice + .address-choice { margin-top: 8px; }
.city-choice.city-selected .choice-label { display: none; }

.address-chips { display: flex; gap: 6px; overflow-x: auto; padding: 1px 1px 3px; scrollbar-width: none; }
.address-chips::-webkit-scrollbar { display: none; }
.address-chips-streets, .address-chips-numbers, .selection-options, .price-chips { display: grid; overflow: visible; }
.address-chips-streets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.address-chips-numbers, .selection-options { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.address-chip, .selection-button {
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--surface-raised);
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.address-chip { flex: 0 0 auto; padding: 10px 6px; white-space: nowrap; }
.city-chip { min-width: 44px; padding-inline: 10px; }
.address-chips-streets .address-chip, .address-chips-numbers .address-chip { width: 100%; white-space: normal; overflow-wrap: anywhere; }
.address-chips-streets .address-chip.long-label { font-size: 13px; }
.address-tab.active, .address-chip.active, .selection-button.active, .role-tab.active, .language-button.active {
    background: var(--accent);
    color: var(--accent-ink);
}
.address-tab.active .address-tab-value, .selection-button.active .payment-currency { color: var(--accent-ink); }
.address-tab:active:not(:disabled), .address-chip:active:not(:disabled), .selection-button:active:not(:disabled), .role-tab:active:not(:disabled), .language-button:active:not(:disabled) { background: var(--accent-bright); color: var(--accent-ink); }
.address-chip:active, .selection-button:active { transform: translateY(1px); }
.passenger-option { min-height: 44px; }
.passenger-composition { grid-column: span 2; font-size: 13px; }


input, select, textarea {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: var(--radius-control);
    padding: 11px 12px;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    caret-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
/* Нижняя линия обозначает фокус без двойной обводки вокруг поля. */
input:focus, select:focus, textarea:focus { outline: 0; box-shadow: inset 0 -2px var(--accent); }
textarea { min-height: 88px; resize: vertical; }

.details-card { display: grid; gap: 14px; margin-top: 24px; padding: 12px; border-top: 1px solid var(--line); }
.details-card input, .details-card textarea { background: var(--surface); }
.details-field-group { gap: 10px; }
.details-field-heading { display: grid; gap: 3px; }
.delivery-info-field { margin-top: 0 !important; }
.delivery-category-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.delivery-category-button { min-height: 44px; padding-inline: 6px; font-size: 13px; }
.delivery-info-field textarea { order: 3; }

.payment-block {
    position: relative;
    border-radius: var(--radius-card);
    padding: 12px;
    margin: -12px -12px 0;
    transition: background .15s ease;
}
.payment-block > .field-group:first-child {
    margin-top: 0;
}
.payment-block.is-active,
.payment-block.active {
    background: var(--surface-highlight);
}
.payment-block.is-active::before,
.payment-block.active::before {
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    content: "";
}
.choice-section { margin-top: 12px; }
.segmented-control { display: flex; gap: 6px; }
.service-switch-block {
    margin: 0 0 12px;
    padding: 12px;
    border-radius: var(--radius-card);
    background: var(--surface);
}
.service-switch-label { color: var(--muted-strong); font-size: 13px; font-weight: 600; }
.service-switch { margin-top: 8px; }
.service-chip { min-height: 46px; }
.delivery-info-field { margin-top: 0 !important; margin-bottom: 14px; }
.delivery-category-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 7px; }
.delivery-category-button { min-height: 44px; padding-inline: 6px; font-size: 13px; }

.segmented-control-wrap { flex-wrap: wrap; }
.selection-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 0;
    padding: 9px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.payment-chip { flex: 1 1 auto; }
.payment-logo {
    display: block;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 0;
    line-height: 1;
}
.payment-logo-kaspi { background: linear-gradient(135deg, #ffb24a, #ff7f00); }
.payment-logo-psb { background: linear-gradient(135deg, #173fbd, #0f2f8d); }
.payment-currency { color: var(--muted); }
.selection-button.active .payment-currency { color: inherit; }
#currency-section[hidden] { display: none; }
.price-field { margin-top: 20px; }
.price-field label, .comment-field label { color: var(--ink-soft); font-size: 13px; }
.price-input-wrap { position: relative; }
.price-currency { position: absolute; z-index: 1; top: 50%; left: 14px; color: var(--accent); font-size: 19px; font-weight: 700; line-height: 1; transform: translateY(-50%); pointer-events: none; }
.price-input-wrap input { min-height: 60px; padding-left: 54px; font-size: 24px; font-weight: 600; }
.price-input-wrap[data-currency="rub"] input,
.price-input-wrap input[data-default-currency="rub"] { padding-left: 70px; }
.price-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 7px; }
.comment-field { margin-top: 16px !important; }

.primary-button, .danger-button, .secondary-button {
    width: 100%;
    min-height: 48px;
    border-radius: var(--radius-control);
    padding: 10px 12px;
    font-weight: 700;
    transition: transform .15s, background .15s, opacity .15s;
}
.primary-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: var(--accent);
    color: var(--accent-ink);
}
.primary-button:hover { background: var(--accent-bright); }
.primary-button:active, .danger-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled, .danger-button:disabled, .secondary-button:disabled { opacity: .52; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--ink); }
.call-button { min-height: 58px; margin-top: 17px; padding: 9px 13px 9px 15px; }
.call-button-copy { display: grid; min-width: 0; gap: 1px; text-align: left; }
.call-button-label, .call-button-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-button-label { font-size: 15px; }
.call-button-hint { color: rgba(22, 26, 31, .68); font-size: 10px; font-weight: 800; }
.button-arrow { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: rgba(22, 26, 31, .12); }
.danger-button { border: 1px solid rgba(255, 137, 137, .34); background: transparent; color: var(--danger); }
.link-button, .refresh-button { min-height: 44px; border: 0; background: transparent; color: var(--accent-bright); font-weight: 800; }
.link-button { display: block; margin: 0 auto; padding: 8px; }
.refresh-button { display: grid; place-items: center; width: 44px; padding: 5px; }

.client-active { margin: 17px 0; padding: 15px; border: 1px solid rgba(126, 213, 162, .28); border-radius: var(--radius-card); background: var(--success-soft); }
.client-active .order-card { margin: 12px 0 9px; }
.client-active .danger-button { margin-top: 2px; }
.order-list { display: grid; gap: 12px; margin-top: 13px; }
.order-card { padding: 15px; }
.order-card-compact { cursor: pointer; }
.order-card-compact:hover { border-color: var(--line-strong); }
.order-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.order-card-head > div, .person-card > div, .profile-identity > div { min-width: 0; overflow-wrap: anywhere; }
.order-number { display: block; font-size: 13px; font-weight: 900; }
.order-time { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.mini-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 9px; padding: 12px; border-radius: 8px; background: var(--surface-raised); font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.mini-route span:last-child { text-align: right; }
.route-divider { display: grid; place-items: center; color: var(--accent); }
.route-divider svg { width: 18px; height: 18px; }
.detail-grid { display: grid; gap: 8px; margin-top: 13px; }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.detail-row:last-child { padding-bottom: 0; border-bottom: 0; }
.detail-label { color: var(--muted); font-size: 12px; }
.detail-value { max-width: 66%; font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.status-pill { flex-shrink: 0; padding: 6px 9px; border-radius: 999px; background: var(--surface-highlight); color: var(--accent-bright); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.status-accepted { background: var(--success-soft); color: var(--success); }
.status-completed { background: rgba(181, 192, 205, .12); color: var(--muted-strong); }
.status-rejected_by_user, .status-rejected_by_admin { background: var(--danger-soft); color: var(--danger); }
.person-card { display: flex; align-items: center; gap: 10px; margin-top: 13px; padding: 10px; border-radius: 11px; background: rgba(255, 255, 255, .035); }
.person-icon { color: var(--success); font-size: 20px; }
.person-name, .person-meta { display: block; }
.person-name { font-size: 13px; }
.person-meta { margin-top: 2px; color: var(--muted); font-size: 11px; }
.card-actions { margin-top: 14px; }
.card-actions .primary-button { justify-content: center; }

.driver-section { margin-top: 23px; }
.live-dot { color: var(--success); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.driver-status-card, .profile-card { margin-top: 13px; padding: 15px; }
.driver-status-content, .profile-identity { display: flex; align-items: center; gap: 12px; }
.online-dot { color: var(--success); }
.offline-dot { color: var(--muted); }
.status-message { color: var(--muted); font-size: 13px; font-weight: 700; }
.profile-identity { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.profile-initial { flex-basis: 48px; width: 48px; height: 48px; }

.empty-state, .loading-state, .error-state { border-radius: 12px; font-size: 13px; }
.empty-state { padding: 25px 14px; background: var(--surface-raised); color: var(--muted); text-align: center; }
.loading-state { min-height: 84px; padding: 25px 14px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-raised) 50%, var(--surface) 75%); background-size: 200% 100%; color: var(--muted); text-align: center; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-state { padding: 14px; background: var(--danger-soft); color: var(--danger); }
.error-state p { margin-bottom: 10px; }
.app-footer { margin-top: 29px; color: #6d7a88; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-align: center; }
.app-footer span { color: var(--accent); }

@media (max-width: 430px) {
    .app-shell { --page-gutter: 12px; --header-control-size: 40px; }
    .app-header { flex-wrap: nowrap; align-items: center; gap: 8px; }
    .brand-lockup { flex-basis: auto; gap: 6px; min-height: var(--header-control-size); }
    .brand-lockup > div { display: flex; flex-direction: column; justify-content: center; min-height: var(--header-control-size); }
    .brand-logo { width: var(--header-control-size); height: var(--header-control-size); }
    .brand-lockup .eyebrow { margin-bottom: 1px; font-size: 9px; line-height: 1; }
    .brand-lockup h1 { font-size: 15px; line-height: 1; white-space: nowrap; }
    .header-actions { width: auto; margin-left: auto; justify-content: flex-end; gap: 4px; }
    .language-switch { gap: 1px; padding: 1px; border-radius: 6px; }
    .language-button { min-width: var(--header-control-size); min-height: var(--header-control-size); padding: 0 6px; gap: 4px; font-size: 11px; }
    .language-flag { height: 11px; }
    .menu-button { width: var(--header-control-size); height: var(--header-control-size); gap: 3px; }
    .menu-button span { width: 16px; }
    .title-secondary { display: none; }
    .route-card { padding: 14px 12px; }
    .details-card { padding: 12px; }
    .address-tabs { gap: 4px; }
    .address-layout.with-passengers .address-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .address-layout.without-entrance.with-passengers .address-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .address-tab {
        min-height: 44px;
        padding: 4px 2px;
        font-size: 10px;
        line-height: 1.05;
        letter-spacing: -0.01em;
    }
    .address-tab-value { min-height: 12px; font-size: 10px; line-height: 1.1; }
    .address-tab.has-value:not(.active) span[data-i18n] { font-size: 10px; }
    .address-chips-streets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .address-chips-numbers { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .selection-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .address-chip { padding: 8px 4px; font-size: 13px; line-height: 1.15; }
    .address-chips-streets .address-chip { font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
    .price-input-wrap input { font-size: 22px; padding-left: 50px; }
    .price-input-wrap[data-currency="rub"] input,
    .price-input-wrap input[data-default-currency="rub"] { padding-left: 68px; }
    .mini-route { grid-template-columns: 1fr; gap: 3px; }
    .mini-route span:last-child { text-align: left; }
    .route-divider { display: none; }
    .role-tab { font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
    .payment-currency { display: inline; }
    .section-heading { flex-wrap: wrap; }
    .passenger-composition { white-space: normal; overflow-wrap: anywhere; }
}
@media (min-width: 700px) {
    .app-shell { --page-gutter: 28px; }
    .route-card { padding: 19px; }
    .details-card, .driver-status-card, .profile-card { padding: 18px; }
    .payment-block { margin: -18px -18px 0; padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
