/* Customer portal responsive hardening — dashboard, profile, orders and support. */
@media (max-width: 1050px) {
  .account-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .account-sidebar,
  .account-main,
  .account-panel,
  .account-hero,
  .account-stats {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 820px) {
  .page-account,
  .page-order_detail,
  .page-ticket_list,
  .page-ticket_detail,
  .page-ticket_create,
  .page-profile_edit,
  .page-password_change,
  .page-password_change_done {
    overflow-x: clip;
  }

  .page-account main,
  .page-order_detail main,
  .page-ticket_list main,
  .page-ticket_detail main,
  .page-ticket_create main,
  .page-profile_edit main,
  .page-password_change main,
  .page-password_change_done main {
    width: 100%;
    min-width: 0;
  }

  .account-shell,
  .account-shell *,
  .simple-page,
  .simple-page *,
  .profile-edit-page,
  .profile-edit-page * {
    box-sizing: border-box;
  }

  /* Dashboard shell */
  .account-shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 16px 12px calc(118px + env(safe-area-inset-bottom, 0px));
    display: block;
  }

  .account-sidebar,
  .account-main {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .account-sidebar {
    position: relative;
    top: auto;
    min-height: 0;
    padding: 16px 14px 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    background:
      radial-gradient(circle at 12% 0, rgba(185, 255, 55, .09), transparent 35%),
      linear-gradient(145deg, #121814, #0b0f0d);
    box-shadow: 0 14px 34px rgba(7, 13, 9, .14);
  }

  .account-user {
    min-width: 0;
    padding: 1px 2px 14px;
    gap: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }

  .account-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    font-size: 19px;
  }

  .account-user h2 {
    max-width: calc(100vw - 155px);
    font-size: 14px;
  }

  .account-user div > span {
    font-size: 10px;
  }

  .account-nav {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 12px 0 3px;
    display: flex;
    flex-flow: row nowrap;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    -webkit-overflow-scrolling: touch;
  }

  .account-nav a,
  .account-nav a:nth-last-child(-n + 2) {
    min-height: 42px;
    padding: 9px 12px;
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    scroll-snap-align: start;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 10px;
    background: #1a211c;
    white-space: nowrap;
    font-size: 10px;
  }

  .account-nav a.active {
    border-color: rgba(185, 255, 55, .25);
    background: rgba(185, 255, 55, .105);
  }

  .account-nav a i {
    font-size: 14px;
  }

  .account-nav a b {
    margin-right: 3px;
  }

  .account-help {
    display: none;
  }

  .account-logout {
    position: absolute;
    top: 15px;
    left: 13px;
    margin: 0;
  }

  .account-logout button {
    width: auto;
    min-width: 48px;
    min-height: 44px;
    padding: 7px 12px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 9px;
    background: rgba(255, 255, 255, .035);
    color: #aeb7b1;
    text-align: center;
    font-size: 0;
  }

  .account-logout button::after {
    content: "خروج";
    font-size: 10px;
  }

  .account-main {
    margin-top: 14px;
  }

  /* Hero and summary */
  .account-hero {
    width: 100%;
    min-height: 0;
    padding: 25px 20px 22px;
    display: block;
    overflow: hidden;
    border-radius: 16px;
  }

  .account-hero::after {
    left: -165px;
    top: -95px;
    width: 310px;
    height: 310px;
    border-width: 62px;
  }

  .account-hero .eyebrow {
    display: block;
    max-width: 78%;
    line-height: 1.8;
  }

  .account-hero h1 {
    max-width: 100%;
    margin: 14px 0 13px;
    font-size: clamp(28px, 8.2vw, 36px) !important;
    line-height: 1.18;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
  }

  .account-hero p {
    max-width: 95%;
    margin: 0;
    font-size: 10px;
    line-height: 1.9;
  }

  .account-hero-action {
    margin-top: 20px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .account-hero-action a {
    min-height: 44px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 10px;
  }

  .account-stats {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 0;
    gap: 1px;
    background: #daddd5;
    border-radius: 0 0 14px 14px;
    overflow: hidden;
  }

  .account-stats article {
    min-width: 0;
    min-height: 110px;
    padding: 15px 13px;
    border: 0;
    background: #fff;
  }

  .account-stats strong {
    max-width: 100%;
    margin: 7px 0 3px;
    font-size: clamp(18px, 5.3vw, 23px);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .account-stats small {
    line-height: 1.6;
  }

  /* Shared dashboard panels */
  .account-panel {
    width: 100%;
    min-width: 0;
    margin-top: 14px;
    padding: 17px 14px;
    overflow: hidden;
    border-radius: 14px;
  }

  .account-panel-head {
    padding-bottom: 15px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 11px;
  }

  .account-panel-head > div {
    min-width: 0;
    flex: 1 1 170px;
  }

  .account-panel-head h2 {
    font-size: 17px;
    line-height: 1.5;
  }

  .account-panel-head > a {
    min-height: 42px;
    padding: 10px 13px;
    flex: 1 1 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    text-align: center;
    white-space: normal;
  }

  .account-profile-grid {
    width: 100%;
    min-width: 0;
    margin-top: 16px;
    grid-template-columns: minmax(0, 1fr);
    border-radius: 10px;
    overflow: hidden;
  }

  .account-profile-grid p,
  .account-profile-grid p.wide {
    min-width: 0;
    min-height: 65px;
    grid-column: auto;
    padding: 13px 14px;
  }

  .account-profile-grid b {
    overflow-wrap: anywhere;
  }

  .account-order-list,
  .account-inquiry-list,
  .account-ticket-list {
    min-width: 0;
    margin-top: 16px;
  }

  .account-order-card {
    min-width: 0;
    overflow: hidden;
    border-radius: 11px;
  }

  .account-order-top {
    min-width: 0;
    padding: 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 10px;
  }

  .account-order-top > div {
    min-width: 0;
  }

  .account-order-top > div:nth-of-type(2),
  .account-order-top > div:nth-of-type(3) {
    padding-top: 10px;
    border-top: 1px solid #e3e6e1;
  }

  .account-order-top > div:nth-of-type(3) {
    text-align: left;
  }

  .account-order-top b {
    overflow-wrap: anywhere;
  }

  .account-order-top > a {
    min-height: 42px;
    grid-column: 1 / -1;
    padding: 10px 12px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #111;
    color: #fff;
    text-align: center;
  }

  .account-order-products {
    padding: 13px;
  }

  .account-order-products > div {
    width: 100%;
    min-width: 0;
  }

  .account-order-products p {
    min-width: 0;
  }

  .account-order-products b,
  .account-order-products small,
  .tracking-code {
    overflow-wrap: anywhere;
  }

  .account-inquiry-list article {
    min-width: 0;
    padding: 14px;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    border-radius: 11px;
  }

  .account-inquiry-list article > .status-pill {
    grid-row: auto;
  }

  .account-inquiry-list article > div {
    min-width: 0;
  }

  .account-inquiry-list h3,
  .account-inquiry-list p {
    overflow-wrap: anywhere;
  }

  .flow-point {
    width: 100%;
    min-width: 0;
    padding: 11px 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 9px;
  }

  .account-ticket-list > a {
    min-width: 0;
    padding: 13px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    border-radius: 10px;
  }

  .account-ticket-list > a > div {
    min-width: 0;
  }

  .account-ticket-list h3,
  .account-ticket-list small {
    display: block;
    overflow-wrap: anywhere;
  }

  .account-ticket-list .status-pill {
    grid-column: 2;
    margin-top: 2px;
  }

  .account-ticket-list > a > i {
    display: none;
  }

  .account-empty,
  .account-empty.compact {
    padding: 25px 15px;
  }

  .account-empty.compact {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .account-empty.compact div {
    margin: 0;
  }

  .account-empty.compact > a {
    min-height: 43px;
    display: grid;
    place-items: center;
  }

  /* Order, ticket and profile subpages */
  .simple-page {
    width: calc(100% - 24px);
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding: 32px 0 calc(120px + env(safe-area-inset-bottom, 0px));
  }

  .simple-page.narrow {
    width: calc(100% - 24px);
  }

  .simple-page .section-title,
  .simple-page .section-heading {
    margin-bottom: 22px;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .simple-page .section-title h1,
  .simple-page .section-heading h1 {
    max-width: 100%;
    font-size: clamp(28px, 8.5vw, 37px);
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .simple-page .section-title > a,
  .simple-page .section-heading > a {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d7dbd5;
    border-radius: 10px;
    text-align: center;
  }

  .order-progress {
    margin: 22px 0 28px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 0;
    overflow: visible;
    border: 1px solid #dfe3dd;
    border-radius: 14px;
    background: #fff;
  }

  .order-progress > div {
    width: 100%;
    min-width: 0 !important;
    min-height: 48px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    flex: none;
    position: relative;
    text-align: right;
  }

  .order-progress > div::before {
    top: -50%;
    right: 16px;
    left: auto;
    width: 2px;
    height: 100%;
  }

  .order-progress i {
    width: 32px;
    height: 32px;
    margin: 0;
  }

  .order-progress span {
    margin: 0 10px 0 0;
    font-size: 10px;
    text-align: right;
  }

  .order-columns {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .panel,
  .form-card,
  .ticket-table {
    min-width: 0;
    padding: 16px 14px;
    border-radius: 14px;
  }

  .ordered-product {
    min-width: 0;
    padding: 12px 0;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .ordered-product-image {
    width: 56px;
    height: 56px;
    grid-row: span 2;
  }

  .ordered-product > div:nth-child(2) {
    min-width: 0;
  }

  .ordered-product b,
  .ordered-product small,
  .ordered-product p,
  .ordered-product strong {
    overflow-wrap: anywhere;
  }

  .ordered-product strong {
    grid-column: 2;
    margin: 5px 0 0;
    font-size: 10px;
  }

  .ordered-total {
    gap: 12px;
    align-items: center;
  }

  .ordered-total b {
    text-align: left;
    overflow-wrap: anywhere;
  }

  .panel > p {
    overflow-wrap: anywhere;
    line-height: 1.9;
  }

  .messages-box {
    max-height: none;
    padding: 2px;
  }

  .chat {
    width: 92%;
    max-width: 100%;
    margin: 9px 0;
    padding: 12px 13px;
    overflow-wrap: anywhere;
  }

  .chat.staff {
    margin-right: auto;
    margin-left: 0;
  }

  .chat.customer {
    margin-right: 0;
    margin-left: auto;
  }

  .chat p {
    font-size: 11px;
    line-height: 1.9;
  }

  .conversation form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e4df;
  }

  .conversation textarea,
  .form-card input,
  .form-card select,
  .form-card textarea,
  .simple-page input,
  .simple-page select,
  .simple-page textarea {
    min-height: 48px;
    font-size: 16px !important;
  }

  .conversation textarea,
  .form-card textarea,
  .simple-page textarea {
    min-height: 120px;
  }

  .conversation button,
  .form-card button {
    width: 100%;
    min-height: 48px;
  }

  /* Ticket list */
  .ticket-table {
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .ticket-head {
    display: none;
  }

  .ticket-row {
    min-width: 0;
    margin-bottom: 10px;
    padding: 15px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    overflow: hidden;
    border: 1px solid #dfe3de;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(14, 31, 20, .04);
  }

  .ticket-row > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .ticket-row > span:first-child {
    grid-column: 1 / -1;
    font-size: 11px;
    line-height: 1.8;
  }

  .ticket-row > span:last-child {
    grid-column: 1 / -1;
    padding-top: 9px;
    border-top: 1px solid #edf0ec;
    color: #7d8680;
    font-size: 9px;
  }

  .ticket-title {
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .ticket-title > div {
    min-width: 0;
    width: 100%;
  }

  .ticket-title h1 {
    max-width: 100%;
    margin: 7px 0 0;
    font-size: clamp(27px, 8vw, 35px);
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .ticket-title > .ticket-status {
    align-self: flex-start;
  }

  .form-hint {
    font-size: 10px;
    line-height: 1.9;
  }

  /* Profile and password pages */
  .profile-edit-page {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 34px 12px calc(120px + env(safe-area-inset-bottom, 0px));
  }

  .profile-edit-page header {
    margin-bottom: 21px;
  }

  .profile-edit-page header > a {
    width: max-content;
    max-width: 100%;
    min-height: 40px;
    margin-bottom: 20px;
    padding: 9px 11px;
    display: flex;
    align-items: center;
    border: 1px solid #d8dcd6;
    border-radius: 9px;
  }

  .profile-edit-page h1 {
    font-size: clamp(29px, 8.3vw, 38px);
    line-height: 1.35;
  }

  .profile-edit-page header p {
    line-height: 1.9;
  }

  .profile-edit-form {
    min-width: 0;
    padding: 17px 14px;
    border-radius: 14px;
  }

  .profile-edit-form .form-grid {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-edit-form .field,
  .profile-edit-form .field.wide {
    min-width: 0;
    grid-column: auto;
  }

  .profile-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
    gap: 12px;
  }

  .profile-form-actions button,
  .profile-form-actions a {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .account-shell {
    padding-inline: 10px;
  }

  .account-sidebar {
    padding-inline: 12px;
  }

  .account-user h2 {
    max-width: calc(100vw - 148px);
    font-size: 13px;
  }

  .account-hero {
    padding-inline: 17px;
  }

  .account-hero-action {
    grid-template-columns: 1fr;
  }

  .account-hero-action span {
    order: 2;
  }

  .account-stats article {
    padding-inline: 11px;
  }

  .account-panel {
    padding-inline: 12px;
  }
}

@media (max-width: 900px) {
  .announcement a,
  .section-heading > a,
  .footer-lead-actions > a,
  .footer-v2-bottom > a {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    touch-action: manipulation;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-nav {
    scroll-behavior: auto;
  }
}
