:root {
  color-scheme: light;
  --ink: #181818;
  --muted: #626262;
  --surface: #f5f5f5;
  --gutter: clamp(16px, 4vw, 36px);
  --safe-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: calc(max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px)) + var(--tg-content-safe-area-inset-left, 0px));
  --safe-right: calc(max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px)) + var(--tg-content-safe-area-inset-right, 0px));
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  color: var(--ink);
  background: #fff;
  font: 400 14px/1.55 Graphik, Arial, sans-serif;
}
h1, h2, p, dl { margin: 0; }
h1, h2, strong, b { font-weight: 500; }
h1 { font-size: clamp(23px, 3.2vw, 29px); line-height: 1.25; overflow-wrap: anywhere; }
h2 { font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1:focus { outline: none; }
.muted { color: var(--muted); }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-200%); z-index: 30; padding: 10px; background: white; }
.skip-link:focus { transform: translateY(0); }

.site-header, .cabinet-main, .account-nav {
  max-width: 1050px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.site-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.text-link:hover { color: var(--ink); }
.wordmark { padding: 12px 0; display: inline-flex; align-items: center; min-height: 44px; }
.wordmark img { width: 150px; height: auto; filter: invert(1); }
.account-nav, .filters { display: flex; flex-wrap: wrap; gap: 6px; }
.account-nav a, .filters a { padding: 10px 15px; min-height: 44px; display: flex; align-items: center; color: var(--muted); border-radius: 6px; }
.account-nav a[aria-current], .filters a[aria-current], .account-nav a:hover, .filters a:hover { color: var(--ink); background: var(--surface); }
.cabinet-main { padding-top: 34px; padding-bottom: 56px; }
.page-heading { margin-bottom: 24px; }
.page-heading p { margin-top: 6px; overflow-wrap: anywhere; }
.overview-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.account-logout { margin-top: 4px; flex: none; }
.account-logout button { min-height: 36px; padding-inline: 3px; }
body[data-host='telegram'] [data-browser-only] { display: none !important; }
.overview-grid, .order-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 52px);
  align-items: start;
}
.overview-grid { grid-template-columns: minmax(220px, 1fr) minmax(0, 1.6fr); }
.account-summary { display: grid; gap: 12px; }
.balance-panel { padding: 18px 20px; background: var(--surface); border-radius: 8px; }
.balance-panel { max-width: 380px; }
.balance-panel .muted { font-size: 13px; }
.balance-number { display: block; width: fit-content; margin-block: 5px 3px; font-size: 30px; font-weight: 500; overflow-wrap: anywhere; }
.balance-number span { font-size: 14px; font-weight: 400; }
.text-link { background: none; border: 0; color: var(--muted); font-size: 13px; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.balance-panel .text-link { display: inline-block; margin-top: 9px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.order-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 8px; border-radius: 6px; }
.order-row.with-photo { grid-template-columns: 56px minmax(0, 1fr) auto; }
.order-row:hover { background: #f7f7f7; }
.order-thumb { width: 56px; aspect-ratio: 1; object-fit: contain; }
.order-identity { min-width: 0; overflow-wrap: anywhere; }
.order-reference, .order-status, .order-bonus { display: block; font-size: 12px; color: var(--muted); }
.order-reference time { margin-left: 5px; white-space: nowrap; }
.order-price { font-weight: 500; text-align: right; white-space: nowrap; }
.empty-state { padding: 10px 0; color: var(--muted); }
.empty-state a { display: inline-block; margin-top: 6px; }

.back-link { display: inline-block; margin-bottom: 14px; }
.detail-products, .detail-information, .rules-list { display: grid; gap: 24px; }
.detail-product { min-width: 0; }
.detail-product p { margin-top: 5px; }
.product-photo { width: 100%; max-width: 440px; aspect-ratio: 1; margin-bottom: 12px; }
.product-photo img { width: 100%; height: 100%; object-fit: contain; }
.facts { margin-top: 9px; }
.facts div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-block: 6px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.facts .total, .facts .total dt { color: var(--ink); font-weight: 500; }
.legacy-detail ul { margin: 10px 0 0; padding-left: 18px; }
.legacy-detail li + li { margin-top: 4px; }
.filters { margin-block: 16px 8px; }
.operation { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 11px; }
.operation time { margin-right: 6px; font-size: 12px; }
.rules-list { max-width: 620px; }
.rules-list p { margin-top: 5px; }

.code-address { overflow-wrap: anywhere; }
.auth-form { display: grid; gap: 8px; }
.auth-form { margin-top: 18px; }
label { font-size: 13px; }
input:not([type=hidden]) {
  min-width: 0;
  min-height: 46px;
  width: 100%;
  border: 1px solid #d7d7d7;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 16px;
}
input[readonly] { background: var(--surface); color: var(--muted); }
.auth-form label:not(:first-of-type) { margin-top: 6px; }
.primary-button, .secondary-button {
  min-height: 44px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 500;
  text-align: center;
}
.primary-button { color: white; background: var(--ink); margin-top: 4px; }
.primary-button:hover { background: #333; }
.secondary-button { background: #eaeaea; color: var(--ink); }
.secondary-button:hover { background: #e1e1e1; }
.telegram-login { width: 100%; margin-top: 10px; }
.auth-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 9px; align-items: baseline; }
.auth-actions form { margin: 0; }
.auth-actions a, .auth-actions button { padding-block: 7px; }
.auth-page > .text-link { display: inline-block; margin-top: 12px; }
.form-error { color: #9c2626; margin-top: 6px; }
.form-status { color: var(--muted); }

.navigation-progress { position: fixed; top: 0; width: 100%; height: 2px; background: var(--ink); transform: scaleX(0); transform-origin: left; }
html[data-loading] .navigation-progress { transform: scaleX(.7); }
.navigation-error { position: fixed; z-index: 30; left: 16px; right: 16px; bottom: calc(66px + var(--safe-bottom)); padding: 12px; background: var(--ink); color: white; display: flex; justify-content: space-between; gap: 8px; }
.navigation-error button { background: none; border: 0; color: white; text-decoration: underline; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.auth-body { background: #fff; min-height: 100svh; display: flex; flex-direction: column; }
.auth-header {
  display: flex; align-items: center; justify-content: center; flex: none;
  min-height: 76px; padding-inline: var(--gutter);
}
.auth-page {
  width: min(100%, 432px); max-width: none; margin: 0 auto;
  flex: 1; min-height: 0; display: grid; align-items: center;
  padding: 40px var(--gutter);
}
.auth-card { padding: 0; background: transparent; }
.auth-heading { margin-bottom: 25px; text-align: center; }
.auth-card h1 { margin-bottom: 0; text-align: center; font-size: clamp(21px, 4vw, 24px); }
.auth-heading p { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.auth-heading .code-address strong { display: block; color: #323232; font-weight: 400; }
.auth-card .auth-form { margin-top: 0; gap: 10px; }
.auth-card label { font-size: 13px; font-weight: 400; }
.auth-card input::placeholder { font-size: 13px; color: #767676; }
.auth-card input:not([type=hidden]), .auth-card .primary-button,
.auth-card .secondary-button, .auth-card .telegram-button { border-radius: 3px; min-height: 46px; }
.auth-card input:not([type=hidden]) { border-color: #dcdcdc; background: #fff; }
.auth-card input:focus { outline: 0; border-color: #777; box-shadow: 0 0 0 2px #18181808; }
.auth-card .primary-button { margin-top: 6px; font-size: 13px; }
.auth-or { display: block; text-align: center; color: #777; font-size: 12px; margin: 14px 0; }
.auth-card .telegram-button { background: #e6e6e6; color: #292929; font-size: 13px; margin-top: 0; }
.auth-card .telegram-button:hover { background: #dedede; }
.auth-card .telegram-icon { width: 21px; height: 21px; }
.auth-error { font-size: 13px; padding: 11px 12px; margin: -8px 0 20px; background: #a12a2a06; border-radius: 3px; }
.auth-card .auth-actions { margin-top: 15px; gap: 8px 14px; }
.auth-actions .text-link { font-size: 12px; }
.auth-return { display: inline-block; margin-top: 17px; }
.auth-test-code { display: block; width: fit-content; margin: 24px auto 0; font-size: 11px; }
.otp-control { position: relative; }
.otp-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp-slot {
  display: grid; place-items: center; height: 52px; min-width: 0;
  background: #fff; border: 1px solid #dedede; border-radius: 3px;
  font-size: 23px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums;
}
.otp-slot.is-filled { border-color: #cecece; }
.otp-control:focus-within .otp-slot.is-current { border-color: #626262; box-shadow: 0 0 0 2px #18181808; }
.auth-card .otp-control.is-enhanced .otp-input {
  position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; min-height: 0;
  padding: 0; border: 0; background: transparent; box-shadow: none; outline: none;
  color: transparent; caret-color: transparent; -webkit-text-fill-color: transparent;
}
.otp-input::selection { background: transparent; }
.auth-card .code-hint { margin-top: 1px; color: #737373; font-size: 11px; text-align: center; }
.telegram-icon { width: 19px; height: 19px; flex: none; }
.telegram-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  min-height: 40px;
  color: white;
  background: #126f9e;
  border-radius: 3px;
  font-weight: 500;
  text-align: center;
}
.telegram-button:hover { background: #0c5c86; }
.auth-card .telegram-login { margin-top: 0; }
.telegram-panel {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  align-items: center;
  gap: 13px 12px;
  padding: 20px;
  background: #222326;
  color: #f9f9f9;
  border-radius: 4px;
}
.telegram-panel h2 { font-size: 13px; }
.telegram-panel p { margin-top: 4px; font-size: 11px; line-height: 1.5; color: #bbbcc1; }
.telegram-panel-icon {
  width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center;
  color: #e5e5e8;
}
.telegram-panel-icon svg { width: 27px; height: 27px; }
.telegram-connect {
  grid-column: 2; justify-self: start;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 17px; min-height: 38px; border-radius: 2px;
  color: #242428; background: #f3f3f4; font-size: 12px; font-weight: 500;
}
.telegram-connect:hover { background: white; }
.telegram-panel :focus-visible { outline-color: white; }

.order-detail-page .page-heading { margin-bottom: 13px; }
.order-detail-page .page-heading h1 { font-size: clamp(27px, 4vw, 38px); }
.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-block: 1px solid #e7e7e7;
  padding-block: 12px;
  margin-bottom: 24px;
  font-size: 13px;
}
.detail-payment-status { color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; }
.detail-payment-status span { color: var(--ink); }
.order-detail-page .detail-product h2 { font-size: 19px; }
.order-detail-page .detail-product .item-total { margin-top: 10px; }
.order-detail-page .product-photo { background: #fafafa; }
.order-detail-page .detail-information h2 { font-size: 18px; }
.order-detail-page .facts div { border-bottom: 1px solid #ededed; padding-block: 9px; }
.order-detail-page .facts .total { border-bottom: 0; font-size: 16px; padding-top: 12px; }
.tracking-number { font-variant-numeric: tabular-nums; letter-spacing: .035em; }
.detail-route-link { display: inline-block; margin-top: 13px; }

.delivery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px clamp(22px, 5vw, 58px);
  align-items: start;
}
.active-deliveries h2 { margin-bottom: 14px; }
.section-count { color: #8b8b8b; margin-left: 7px; font-size: 12px; font-weight: 400; }
.delivery-order {
  display: grid; grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center; gap: 14px; padding: 15px 14px;
  margin: 0 0 6px; border-radius: 3px;
}
.delivery-order:hover, .delivery-order[aria-current] { background: #f5f5f5; }
.delivery-order strong { font-size: 14px; }
.delivery-order-marker { width: 6px; height: 6px; border-radius: 50%; background: #b4b4b4; }
.delivery-order-marker[data-phase='transit'], .delivery-order-marker[data-phase='pickup'] { background: #777; box-shadow: 0 0 0 4px #7777770b; }
.delivery-city { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.delivery-phase { font-size: 12px; color: var(--muted); text-align: right; }
.tracking-panel {
  position: relative; isolation: isolate; overflow: hidden;
  margin-bottom: 34px; padding-bottom: 25px;
  color: var(--ink); background: #f2f2f2; border-radius: 5px;
}
.tracking-panel::before {
  content: ''; position: absolute; z-index: -1; inset: 0;
  background: radial-gradient(ellipse at 35% 25%, #ffffffb3, transparent 65%);
}
.tracking-heading {
  position: relative; z-index: 2; display: flex; justify-content: space-between;
  align-items: center; gap: 14px; padding: 25px 28px 0;
}
.tracking-heading h2 { margin-top: 5px; font-size: clamp(17px, 2.5vw, 23px); line-height: 1.4; }
.route-separator { display: inline-block; padding-inline: 10px; color: #a1a1a1; font-weight: 400; }
.tracking-label { display: block; color: #6b6b6b; font-size: 11px; }
.tracking-number { display: block; margin-top: 3px; font-size: 14px; font-weight: 500; }
.tracking-phase { padding: 5px 9px; color: #525252; background: #ededed; border-radius: 3px; font-size: 11px; }
.tracking-phase[data-phase='transit'], .tracking-phase[data-phase='pickup'] { color: #3e3e3e; background: #e9e9e9; }
.globe-wrap { position: relative; isolation: isolate; }
.globe-wrap::before {
  content: ''; position: absolute; z-index: -1;
  left: 28%; right: 28%; bottom: 22px; height: 22px;
  background: radial-gradient(ellipse, #22222219, transparent 70%); filter: blur(8px);
}
.delivery-globe { display: block; width: 100%; height: 480px; cursor: grab; touch-action: pan-y; outline-offset: -5px; }
.delivery-globe:active { cursor: grabbing; }
.globe-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.globe-city { position: absolute; padding: 3px 7px; color: #3d3d3d; font-size: 11px; line-height: 1.5; white-space: nowrap; background: #ffffffe8; border-radius: 2px; box-shadow: 0 1px 6px #0000000a; }
.globe-reset { flex: none; color: #626262; padding: 7px 0 7px 10px; border: 0; background: none; font-size: 11px; }
.globe-reset:hover { color: #181818; }
.globe-reset:focus-visible, .delivery-globe:focus-visible { outline-color: #555; }
.globe-fallback { text-align: center; color: #626262; padding-block: 80px; font-size: 12px; }
.globe-unavailable { min-height: 200px; }
.tracking-card {
  position: relative; z-index: 2; width: min(540px, calc(100% - 56px));
  margin: -68px auto 0; padding: 17px 22px 14px;
  background: #fffffff0;
  border: 1px solid #00000004; border-radius: 5px;
  box-shadow: 0 10px 30px #00000009; backdrop-filter: blur(12px);
}
.globe-unavailable + .tracking-card { margin-top: 0; }
.tracking-heading + .tracking-card { margin-top: 24px; }
.tracking-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.delivery-progress { list-style: none; display: flex; padding: 0; margin: 22px 0 16px; }
.delivery-progress li { position: relative; flex: 1; font-size: 10px; color: #737373; }
.delivery-progress li:last-child { flex: 0 0 auto; }
.delivery-progress li:not(:last-child)::after { content: ''; position: absolute; top: 3px; height: 1px; left: 5px; width: calc(100% - 5px); background: #d9d9d9; }
.delivery-progress li.is-complete:not(.is-current)::after { background: #797979; }
.progress-point { position: relative; z-index: 1; display: block; width: 7px; height: 7px; background: #c8c8c8; border-radius: 50%; margin-bottom: 9px; }
.is-complete .progress-point { background: #626262; }
.is-current .progress-point { box-shadow: 0 0 0 4px #62626212; }
.delivery-progress .is-current { color: #272727; }
.tracking-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 9px 16px; }
.tracking-caption { color: #737373; font-size: 10px; overflow-wrap: anywhere; }
.tracking-card-bottom a { font-size: 11px; color: #424242; white-space: nowrap; }
.tracking-card-bottom a:hover { color: #181818; }
.delivery-notifications { display: flex; gap: 13px; padding: 4px 0; }
.delivery-notifications > svg { margin-top: 1px; color: #737379; width: 20px; }
.delivery-notifications h2 { font-size: 13px; }
.delivery-notifications p { font-size: 12px; margin-top: 4px; }
.delivery-notifications .text-link { display: inline-block; margin: 6px 9px 0 0; font-size: 12px; }

@media (min-width: 681px) {
  .delivery-notifications { padding: 20px; background: #f5f5f5; border-radius: 4px; }
  .delivery-notifications > svg { width: 25px; height: 25px; margin-top: 0; }
  .delivery-notifications p { max-width: 33ch; }
  .delivery-notifications .text-link {
    display: inline-flex; align-items: center; min-height: 36px;
    margin-top: 14px; padding: 6px 12px; border-radius: 2px;
    color: #343434; background: #fff; text-decoration: none;
  }
  .delivery-notifications .text-link:hover { background: #eaeaea; }
}

@media (max-width: 680px) {
  .site-header { min-height: 64px; }
  .auth-header { min-height: 64px; }
  .wordmark img { width: 127px; }
  .cabinet-main { padding-top: 14px; padding-bottom: calc(70px + var(--safe-bottom)); }
  .account-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 5px max(8px, var(--safe-right)) calc(5px + var(--safe-bottom)) max(8px, var(--safe-left));
    background: white;
    box-shadow: 0 -4px 20px #00000008;
  }
  .account-nav a { justify-content: center; padding: 8px 2px; font-size: 12px; }
  body[data-keyboard='open'] .account-nav { display: none; }
  .overview-grid, .profile-grid, .order-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .page-heading { margin-bottom: 17px; }
  .balance-panel { max-width: none; }
  .order-row { padding-inline: 0; }
  .delivery-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .tracking-panel { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; padding-bottom: 22px; margin-bottom: 28px; }
  .tracking-heading { padding: 20px var(--gutter) 0; }
  .tracking-heading h2 { font-size: 17px; }
  .route-separator { padding-inline: 6px; }
  .delivery-globe { height: clamp(340px, 108vw, 450px); }
  .tracking-card { width: calc(100% - 32px); margin-top: -60px; padding: 15px 17px 13px; }
  .tracking-card-bottom { align-items: flex-start; }
  .tracking-caption { max-width: 65%; }
  .tracking-phase { max-width: 48%; text-align: right; }
  .telegram-panel { grid-template-columns: 27px minmax(0, 1fr) auto; padding: 18px; }
  .telegram-connect { grid-column: 3; grid-row: 1; padding-inline: 12px; }
  .delivery-notifications { margin-top: 0; padding-inline: 14px; }
}
@media (max-width: 370px) {
  .telegram-panel { grid-template-columns: auto minmax(0, 1fr); }
  .telegram-panel .telegram-connect { grid-column: 2; grid-row: auto; }
  .account-nav a { font-size: 11px; }
}
