.account-page {
  min-height: 100dvh;
  background: #f4f5f6;
}

.account-shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
  /* Вырез и скруглённые углы iPhone в ландшафте. */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.account-header {
  border-bottom: 3px solid var(--orange);
  background: var(--black);
  color: var(--white);
}

.account-header .account-shell {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.account-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 800;
}

.account-back:hover {
  color: var(--orange);
}

.account-main {
  padding-block: 54px 80px;
}

.message-list {
  padding-top: 18px;
}

.message {
  border-left: 4px solid var(--green);
  background: var(--white);
  padding: 13px 16px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 6%);
  font-weight: 700;
}

.auth-panel {
  width: min(480px, 100%);
  margin-inline: auto;
  border-top: 4px solid var(--orange);
  background: var(--white);
  padding: 34px 38px 38px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 9%);
}

.auth-panel-wide {
  width: min(560px, 100%);
}

.auth-kicker {
  margin: 0 0 4px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-panel h1,
.profile-heading h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

.auth-intro {
  margin: 10px 0 26px;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #cfd2d6;
  margin-top: 22px;
}

.auth-switch a {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding-inline: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-switch a + a {
  border-left: 1px solid #cfd2d6;
}

.auth-switch a.is-active {
  background: var(--graphite);
  color: var(--white);
}

.auth-switch + .auth-intro {
  margin-top: 18px;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  font-size: 13px;
  font-weight: 800;
}

.form-field input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cfd2d6;
  border-radius: 4px;
  background: var(--white);
  padding-inline: 14px;
  outline: 0;
  font-size: 16px;
}

.form-field input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgb(244 81 11 / 12%);
}

.form-field .code-input {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.form-field.has-error input {
  border-color: #b91c1c;
}

.field-help {
  color: var(--muted);
  font-size: 11px;
}

.field-help ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.field-error,
.form-errors p {
  margin: 0;
  color: #a31515;
  font-size: 12px;
  font-weight: 700;
}

.form-errors {
  border-left: 3px solid #b91c1c;
  background: #fff1f1;
  padding: 11px 13px;
}

.auth-submit {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: var(--orange);
  padding-inline: 22px;
  color: var(--white);
  font-size: 16px;
  font-weight: 800;
}

.auth-submit:hover {
  background: var(--orange-dark);
}

.auth-code-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-code-actions form {
  display: contents;
}

.auth-secondary,
.auth-change-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd2d6;
  border-radius: 4px;
  background: var(--white);
  padding-inline: 18px;
  color: var(--graphite);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.auth-secondary:hover:not(:disabled),
.auth-change-link:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.auth-secondary:disabled {
  background: #f1f2f3;
  color: var(--muted);
  cursor: not-allowed;
}

.auth-links {
  display: grid;
  gap: 9px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.auth-links a {
  color: var(--orange-dark);
  font-weight: 800;
}

.auth-result p:not(.auth-kicker) {
  margin: 14px 0 24px;
  color: var(--muted);
}

.profile-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.logout-button {
  min-height: 44px;
  border: 1px solid #cfd2d6;
  border-radius: 4px;
  background: var(--white);
  padding-inline: 20px;
  font-weight: 800;
}

.logout-button:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.profile-nav {
  display: flex;
  gap: 30px;
  border-bottom: 1px solid #d8dade;
  margin-bottom: 28px;
}

.profile-nav a {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  font-weight: 800;
}

.profile-nav a.is-active {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.profile-nav span {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--graphite);
  color: var(--white);
  font-size: 10px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.profile-sidebar,
.profile-main-column {
  min-width: 0;
}

.profile-sidebar {
  position: sticky;
  top: 24px;
}

.profile-main-column {
  display: grid;
  gap: 28px;
}

.profile-section {
  background: var(--white);
  padding: 28px;
  box-shadow: 0 12px 34px rgb(0 0 0 / 6%);
}

.profile-section h2 {
  margin: 0 0 22px;
  font-size: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.orders-empty {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border-top: 1px solid var(--line);
}

.orders-empty strong {
  font-size: 18px;
}

.orders-empty p {
  max-width: 440px;
  margin: 5px 0 18px;
  color: var(--muted);
}

.orders-empty a {
  color: var(--orange-dark);
  font-weight: 800;
}

.orders-list {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.order-entry {
  border: 1px solid #d8dade;
  padding: 18px;
}

.order-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.order-entry-header > div {
  display: grid;
  gap: 4px;
}

.order-entry-header > div > strong {
  font-size: 16px;
}

.order-entry-header time {
  color: var(--muted);
  font-size: 12px;
}

.order-status {
  flex: 0 0 auto;
  border: 1px solid #cfd2d6;
  border-radius: 3px;
  padding: 6px 9px;
  color: var(--graphite);
  font-size: 11px;
  font-weight: 800;
}

.order-status-new {
  border-color: #f7a17d;
  background: #fff4ef;
  color: #a53508;
}

.order-status-processing {
  border-color: #d6ae55;
  background: #fff9e9;
  color: #71520b;
}

.order-status-confirmed {
  border-color: #74a6c7;
  background: #eef7fc;
  color: #205b80;
}

.order-status-shipped {
  border-color: #9d90ce;
  background: #f4f1ff;
  color: #51418d;
}

.order-status-completed {
  border-color: #80bd96;
  background: #edf8f0;
  color: #176132;
}

.order-status-cancelled {
  border-color: #d59a9a;
  background: #fff1f1;
  color: #8f2222;
}

.order-summary {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
  gap: 18px;
  margin-top: 16px;
  border-block: 1px solid var(--line);
  padding-block: 12px;
}

.order-summary > span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
}

.order-summary strong {
  color: var(--black);
  font-size: 13px;
}

.order-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--orange-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.order-details summary::-webkit-details-marker {
  display: none;
}

.order-details summary::before {
  content: "+";
  width: 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.order-details[open] summary::before {
  content: "−";
}

.order-items {
  display: grid;
  border-top: 1px solid var(--line);
}

.order-item-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(80px, auto);
  align-items: center;
  gap: 14px;
  padding-block: 12px;
}

.order-item-row + .order-item-row {
  border-top: 1px solid var(--line);
}

.order-item-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.order-item-row a,
.order-item-row > div > strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.order-item-row a:hover {
  color: var(--orange-dark);
}

.order-item-row small,
.order-item-row > span {
  color: var(--muted);
  font-size: 11px;
}

.order-item-row > strong {
  font-size: 12px;
  text-align: right;
}

.orders-pagination {
  min-height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
}

.orders-pagination a {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 800;
}

.orders-pagination span {
  color: var(--muted);
  font-size: 11px;
}

.garage-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.garage-form label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
}

.garage-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 12px;
  font: inherit;
}

.garage-form .auth-submit {
  min-height: 48px;
  margin: 0;
  padding-inline: 22px;
}

.garage-form .auth-submit:disabled {
  background: #d7d9dc;
  color: #777c84;
  cursor: not-allowed;
}

.garage-form-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.garage-form-status.is-error {
  color: #a31515;
}

.garage-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.garage-vehicle {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.garage-vehicle-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.garage-vehicle-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border: 1px solid #f0c5b3;
  background: #fff7f2;
  color: var(--orange-dark);
}

.garage-vehicle-icon .ui-icon {
  width: 27px;
  height: 27px;
}

.garage-vehicle-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.garage-vehicle-info span,
.garage-empty {
  color: var(--muted);
  font-size: 12px;
}

.garage-vehicle-info strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.garage-vehicle-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.garage-vehicle-actions > a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--orange);
  background: var(--orange);
  padding: 0 18px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.garage-vehicle-actions > a::after {
  content: "→";
  font-size: 18px;
  line-height: 1;
}

.garage-vehicle-actions > a:hover,
.garage-vehicle-actions > a:focus-visible {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
}

.garage-vehicle-actions button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.garage-vehicle-actions button:hover,
.garage-vehicle-actions button:focus-visible {
  color: #a31515;
}

.garage-recommendations .section-heading {
  align-items: flex-start;
}

.garage-recommendations .section-heading h2 {
  margin-bottom: 0;
}

.garage-recommendations-intro {
  max-width: 560px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

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

.garage-recommendations-empty {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: 1px solid var(--line);
}

.garage-recommendations-empty strong {
  font-size: 17px;
}

.garage-recommendations-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .profile-layout { grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr); }
  .garage-form { grid-template-columns: 1fr; }
  .garage-form .auth-submit { grid-column: 1 / -1; }
  .garage-vehicle { align-items: flex-start; flex-direction: column; }
  .garage-vehicle-actions { width: 100%; }
  .garage-vehicle-actions > a { flex: 1; }
}

@media (max-width: 760px) {
  .account-shell {
    width: calc(100% - 24px);
  }

  .account-header .account-shell {
    min-height: 76px;
  }

  .account-header .brand-tagline {
    display: none;
  }

  .account-header .brand-logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .account-header .brand-name {
    font-size: 18px;
  }

  .account-back {
    font-size: 0;
  }

  .account-back::before {
    content: "←";
    font-size: 24px;
  }

  .account-main {
    padding-block: 28px calc(50px + env(safe-area-inset-bottom));
  }

  .auth-panel {
    padding: 26px 20px 28px;
  }

  .auth-panel h1,
  .profile-heading h1 {
    font-size: 26px;
  }

  .profile-heading {
    align-items: flex-start;
  }

  .profile-nav {
    gap: 18px;
    overflow-x: auto;
  }

  .profile-nav a {
    flex: 0 0 auto;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-sidebar {
    position: static;
  }

  .garage-form { grid-template-columns: 1fr; }
  .garage-vehicle-actions { align-items: stretch; flex-direction: column; gap: 4px; }
  .garage-vehicle-actions > a { justify-content: space-between; }
  .garage-vehicle-actions form { display: grid; }
  .garage-vehicle-actions button { text-align: left; }

  .profile-section {
    padding: 22px 18px;
  }

  .order-entry {
    padding: 15px;
  }

  .order-entry-header {
    align-items: flex-start;
  }

  .order-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .order-item-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .order-item-row > strong {
    grid-column: 1 / -1;
    text-align: left;
  }
}
