/* Razor-only bridges for the storefront CSS. */
.aco-invoice-toolbar { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.aco-invoice-toolbar .ac-cancel-order { margin: 0; }
.aco-invoice-toolbar .ac-cancel-order .btn { width: auto; }
.aco-invoice { background: #fff; color: #1c2433; border: 1px solid #e4dccf; border-radius: 18px; overflow: hidden; box-shadow: 0 16px 40px rgba(34, 63, 115, .08); padding: 0 0 22px; }
.aco-invoice-top { display: flex; justify-content: space-between; align-items: center; gap: 18px; background: #223f73; padding: 18px 22px; }
.aco-invoice-logo { width: min(210px, 46vw); height: auto; }
.aco-invoice-doc { text-align: left; color: #fff; }
.aco-invoice-doc p { margin: 0; font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.aco-invoice-doc strong { display: inline-block; margin-top: 6px; color: #e7c98a; font-size: .84rem; font-weight: 600; }
.aco-invoice-serial, .aco-invoice-parties { display: grid; gap: 12px; padding: 18px 22px 0; }
.aco-invoice-serial { grid-template-columns: 1.5fr 1fr 1fr; }
.aco-invoice-parties { grid-template-columns: 1fr 1.4fr; }
.aco-invoice-serial > div, .aco-invoice-parties > div { background: #f8f5ef; border: 1px solid #eadfce; border-radius: 12px; padding: 12px 14px; }
.aco-invoice-serial span, .aco-invoice-parties h3 { display: block; margin: 0; color: #6d6458; font-size: .78rem; font-weight: 600; }
.aco-invoice-serial strong { display: block; margin-top: 4px; color: #223f73; font-size: 1.05rem; font-weight: 800; }
.aco-invoice-serial > div:first-child strong { font-size: 1.28rem; letter-spacing: .02em; }
.aco-invoice-parties p { margin: 6px 0 0; line-height: 1.7; }
.aco-invoice-table-wrap { overflow-x: auto; padding: 18px 22px 0; }
.aco-invoice-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; }
.aco-invoice-table th, .aco-invoice-table td { padding: 10px 8px; text-align: right; vertical-align: top; }
.aco-invoice-table th { background: #223f73; color: #fff; font-size: .8rem; font-weight: 600; }
.aco-invoice-table th:first-child { border-radius: 0 10px 0 0; }
.aco-invoice-table th:last-child { border-radius: 10px 0 0 0; }
.aco-invoice-table td { border-bottom: 1px solid #efe7db; }
.aco-invoice-table tbody tr:nth-child(even) td { background: #fcfaf6; }
.aco-invoice-money { white-space: nowrap; font-weight: 700; }
.aco-invoice-sku { color: #6d6458; font-size: .78rem; margin-top: 2px; }
.aco-invoice-totals { width: min(100% - 44px, 360px); margin: 16px 22px 0 auto; }
.aco-invoice-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 2px; }
.aco-invoice-totals dt, .aco-invoice-totals dd { margin: 0; }
.aco-invoice-totals > div:last-child { background: #223f73; color: #fff; border-radius: 12px; padding: 12px 14px; margin-top: 6px; }
.aco-invoice-totals > div:last-child dd { color: #f3e6c4; font-size: 1.12rem; font-weight: 800; }
.aco-invoice-note { margin: 16px 22px 0; color: #5c5348; background: #f8f5ef; border-radius: 12px; padding: 12px 14px; }
@media (max-width: 720px) {
  .aco-invoice-top { align-items: flex-start; }
  .aco-invoice-serial, .aco-invoice-parties { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .site-footer, .admin-topbar, .admin-sidebar, .admin-breadcrumb, .aco-no-print { display: none !important; }
  .admin-workspace, .admin-content, body, main { background: #fff !important; }
  .aco-invoice { border: 0; box-shadow: none; }
  .aco-invoice-top, .aco-invoice-table th, .aco-invoice-totals > div:last-child { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
:root { --aco-header-height: 148px; }
html { scroll-padding-top: calc(var(--aco-header-height) + 12px); }
.site-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1000;
  color: #fff;
  background:
    linear-gradient(100deg, rgba(214, 176, 92, .4) 0%, rgba(214, 176, 92, 0) 28%),
    linear-gradient(112deg, #101c34 0%, #1a3c74 52%, #3d6aab 100%);
  box-shadow: 0 3px 18px rgba(16, 36, 69, .13);
}
.co-product-gallery,
.co-order-summary,
.co-cart-summary,
.co-filter-panel {
  top: calc(var(--aco-header-height) + 12px) !important;
}
.desktop-nav a.active::after,
.desktop-nav a[aria-current="page"]::after { transform: scaleX(1); }
.mobile-navigation:not([hidden]) { display: grid; }
.app-icon, .footer-service-arrow { display: inline-flex; align-items: center; }
.footer-service-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; color: var(--gold); }
.co-swatch-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #c9ced6; cursor: pointer; padding: 0; }
.co-swatch-btn.selected { box-shadow: 0 0 0 2px var(--navy); }
.co-size-btn { min-width: 48px; min-height: 40px; border: 1px solid #dfe3e9; border-radius: 6px; background: #fff; padding: 6px 12px; }
.co-size-btn.selected { background: var(--navy); color: #fff; border-color: var(--navy); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.co-product-summary .co-product-price { font-size: 1.25rem; font-weight: 700; color: var(--navy); margin: 8px 0 14px; }
.co-buy-panel { display: grid; gap: 18px; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.co-option-block { margin: 0; padding: 0; border: 0; }
.co-option-block legend { font-size: .92rem; font-weight: 600; margin-bottom: 8px; }
.co-cart-lines { display: grid; gap: 14px; }
.co-cart-line { display: grid; grid-template-columns: 108px minmax(0,1fr) auto; gap: 16px; align-items: start; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.co-cart-thumb { display: block; overflow: hidden; border-radius: 8px; background: #f2efeb; }
.co-cart-summary { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 20px; position: sticky; top: 20px; }
.co-filter-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (max-width: 767.98px) {
  .co-cart-line { grid-template-columns: 84px minmax(0,1fr); }
  .co-cart-line-total { grid-column: 1 / -1; text-align: start; font-weight: 700; }
}
.co-color-option, .co-size-option {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px;
  padding: 6px 12px; border: 1px solid #dfe3e9; border-radius: 8px; background: #fff; cursor: pointer;
}
.co-color-option input, .co-size-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.co-color-option.selected, .co-size-option.selected { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(34,63,115,.12); }
.co-color-option.disabled, .co-size-option:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.co-product-colors, .co-product-sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.co-product-options { border: 0; margin: 0 0 18px; padding: 0; }
.co-product-options legend { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: .95rem; font-weight: 600; }
.co-current-option { color: var(--muted); font-weight: 500; margin-inline-start: 8px; }
.co-product-kicker { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.co-product-kicker a { color: var(--muted); font-size: .86rem; }
.co-type-link { color: var(--navy) !important; font-weight: 600; }
.co-sku { color: var(--muted); font-size: .82rem; }
.co-product-quantity-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0; }
.co-quantity { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.co-quantity button { width: 42px; height: 42px; border: 0; background: #f7f8fa; }
.co-quantity output { min-width: 48px; text-align: center; font-weight: 600; }
.co-buy-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.co-wish-button { display: grid; place-items: center; }
.co-rating-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; color: inherit; text-decoration: none; }
.co-rating-link:hover { color: inherit; }
.rv-distribution > div { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 26px; padding: 3px 7px; color: #758095; font-size: .74rem; }
.rv-distribution > div > span:first-child { min-width: 10px; }
.rv-distribution > div > span:last-child { min-width: 21px; }
.co-add-cart { flex: 1; }
.co-product-details { margin-top: 28px; border-top: 1px solid var(--line); }
.co-product-details details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.co-product-details summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.co-product-details dl { display: grid; gap: 8px; margin: 12px 0 0; }
.co-product-details dt { color: var(--muted); font-size: .82rem; }
.co-related-section { margin-top: 48px; }
.co-related-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.co-guide-size-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.co-guide-size-list span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.co-unavailable-message { color: #a33d3d; }
@media (max-width: 991.98px) {
  .co-related-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Account: Razor uses anchors in place of buttons */
.co-account-sidebar nav > a {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 12px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #677386;
  text-align: right;
  font-size: .87rem;
  text-decoration: none;
}
.co-account-sidebar nav > a:hover { background: #f5f7fa; color: var(--navy); }
.co-account-sidebar nav > a.active { background: #edf2f8; color: var(--navy); font-weight: 600; }
.ac-order-counts > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 16px 8px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  color: #9aa6b8;
  background: #fff;
}
.ac-order-counts > a > strong { color: #596e8c; font-size: 1.4rem; line-height: 1.4; font-weight: 600; }
.ac-order-counts > a > span { color: #8592a6; font-size: .7rem; white-space: normal; text-align: center; }
.ac-order-counts > a.active { background: #f2f6fb; border-color: #b6c7dd; box-shadow: inset 0 0 0 1px #d7e1ee; color: var(--navy); }
.ac-order-counts > a.active > strong,
.ac-order-counts > a.active > span { color: var(--navy); }
.ac-order-counts > a:hover { background: #f7f9fc; }

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #4d5d77;
  font-size: .75rem;
  font-weight: 650;
}
.admin-pill-danger { background: #f8e8e6; color: #9c5a51; }
.admin-pill-warning { background: #f7efd9; color: #8b6a2d; }
.admin-stat-hint { color: #7b8595; font-size: .72rem; }
.admin-task { display: flex; align-items: center; gap: .8rem; padding: 1rem .15rem; border-bottom: 1px solid #edf0f4; color: inherit; }
.admin-task strong { min-width: 2rem; font-size: 1.2rem; color: var(--admin-navy, #223f73); }

/* Admin mobile sidebar */
@media (max-width: 991.98px) {
  .aco-admin .admin-workspace { grid-template-columns: minmax(0, 1fr); }
  .aco-admin .admin-sidebar {
    position: fixed;
    inset: 83px auto 0 0;
    width: min(280px, 88vw);
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform .2s ease;
    max-height: calc(100vh - 83px);
  }
  html[dir="rtl"] .aco-admin .admin-sidebar { inset: 83px 0 0 auto; transform: translateX(105%); }
  .aco-admin .admin-sidebar.admin-sidebar-open { transform: translateX(0); }
}

/* Footer product types: keep the column short */
.footer-column-types .footer-type-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
  width: 100%;
}
.footer-column-types .footer-type-links a {
  min-height: 34px;
  padding-block: 3px;
  font-size: .8rem;
}
.footer-column-types .footer-all-products {
  margin-top: 8px;
  color: #f0d397;
  font-weight: 600;
}
@media (max-width: 575.98px) {
  .footer-column-types .footer-type-links { grid-template-columns: 1fr 1fr; gap: 0 10px; }
}

/* ——— Mobile + cross-browser polish ——— */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { overflow-x: hidden; }
img, video, canvas { max-width: 100%; height: auto; }
.asset-image > img,
.asset-image > svg,
.brand img,
.footer-logo img { height: 100%; }
.brand img,
.footer-logo img { height: auto; }
input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}
.co-size-option:has(input:disabled),
.co-size-option.disabled { opacity: .45; cursor: not-allowed; }
.co-filter-close { display: none; }
.co-filter-scrim {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1090;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(16, 28, 52, .45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body.co-filters-open { overflow: hidden; touch-action: none; }
body.co-filters-open .co-filter-scrim { display: block; }

@media (max-width: 991.98px) {
  .container-xl { --bs-gutter-x: 1.25rem; }
  .site-header { padding-bottom: 12px; }
  .topbar { min-height: 60px; gap: 10px; }
  .brand { width: min(148px, 42vw); }
  .header-search { margin-top: 4px; }
  /* Keep inputs at 16px on iOS to avoid focus zoom; icon stays on physical right. */
  .header-search input {
    height: 44px;
    font-size: 16px;
    padding: 7px 48px 7px 14px;
  }
  .form-control,
  .form-select,
  .co-form .form-control,
  .co-form .form-select { font-size: 16px; }
  .mobile-navigation:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0 4px;
  }
  .mobile-navigation a {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 14px;
    font-size: .92rem;
    text-align: right;
  }

  .co-departments { border-bottom: 1px solid var(--line); }
  .co-department-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .co-department-grid::-webkit-scrollbar { display: none; height: 0; }
  .co-department-grid > a {
    flex: 0 0 auto;
    width: auto;
    min-width: 4.5rem;
    padding: 12px 14px;
    font-size: .84rem;
    scroll-snap-align: start;
    white-space: nowrap;
  }
  .co-department-grid > a.active::after { left: 18%; right: 18%; }

  .co-filter-panel { display: none; }
  .co-filter-panel.is-open {
    display: block;
    position: fixed;
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: min(360px, 92vw);
    max-height: 100vh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 1100;
    border-radius: 0;
    border: 0;
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px rgba(16, 28, 52, .18);
    padding: 18px 16px 28px;
    background: #fff;
  }
  html[dir="rtl"] .co-filter-panel.is-open {
    right: 0;
    left: auto;
    border-left: 0;
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 40px rgba(16, 28, 52, .18);
  }
  .co-filter-close {
    display: inline-flex;
    color: var(--navy);
    background: #f3f5f8;
  }
  .co-filter-title-icon { display: none; }

  .home-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .home-intro h1 { font-size: clamp(1.2rem, 5.4vw, 1.45rem); line-height: 1.55; }
  .home-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  .home-product-grid .product-card:last-child:nth-child(odd) {
    grid-column: auto;
    display: block;
    grid-template-columns: none;
  }
  .type-grid > .type-card,
  .category-showcase > .category-card {
    flex-basis: calc(50% - 10px);
    min-width: calc(50% - 10px);
  }

  .co-product-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .co-product-gallery { position: static; }
  .co-buy-actions {
    position: -webkit-sticky;
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 16px -4px 0;
    padding: 12px 4px 12px;
    padding-bottom: calc(12px + constant(safe-area-inset-bottom));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(250, 249, 246, 0), #faf9f6 28%, #faf9f6);
    -webkit-backdrop-filter: saturate(1.1);
  }
  .co-buy-actions .co-add-cart { min-height: 52px; font-size: .95rem; }
  .co-product-details dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .co-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  .co-cart-layout,
  .co-checkout-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .co-cart-summary { position: static; }
  .co-cart-line {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }
  .co-cart-line-total {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-weight: 700;
    text-align: right;
  }
  .co-cart-line-total::before { content: "جمع این قلم"; color: var(--muted); font-weight: 500; font-size: .82rem; }
  .co-cart-line .d-flex.flex-wrap {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .co-cart-line form.d-flex {
    width: 100%;
    flex-wrap: wrap;
    align-items: flex-end !important;
  }
  .co-cart-line .form-control { width: 100% !important; max-width: 120px; }
  .co-cart-line .btn { min-height: 44px; }

  .footer-services { grid-template-columns: 1fr; }
  .footer-columns { grid-template-columns: 1fr 1fr; gap: 22px; }
  .footer-story { grid-column: 1 / -1; max-width: none; }
  .footer-tail { padding-left: 0; padding-right: 0; flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 575.98px) {
  .container-xl { --bs-gutter-x: 1rem; }
  .brand { width: min(128px, 38vw); }
  .topbar-right { gap: 6px; }
  .header-account span,
  .header-cart .cart-label { display: none; }
  .header-cart { padding: 8px 10px; min-width: 44px; }
  .header-search input { font-size: 16px; }

  .category-showcase { --category-gap: 10px; }
  .category-showcase > .category-card {
    flex-basis: calc(50% - 10px);
    min-width: calc(50% - 10px);
  }
  .category-caption { height: 42px; padding-inline: 22px; }
  .category-caption strong { font-size: .82rem; white-space: normal; text-align: center; line-height: 1.35; }
  .type-grid { --type-gap: 10px; }
  .type-grid > .type-card {
    flex-basis: calc(50% - 10px);
    min-width: calc(50% - 10px);
  }
  .type-card-body { padding: 10px; gap: 6px; }
  .type-card-body strong { font-size: .88rem; }
  .type-card-arrow { display: none; }
  .product-card-body { padding: 10px 8px 12px; }
  .product-name { font-size: .82rem; min-height: 0; }
  .product-price { font-size: .82rem; }
  .product-detail-link { font-size: .74rem; }
  .co-sale-badge-card { top: 8px; left: 8px; font-size: .68rem; }

  .co-page { padding-top: 16px; padding-bottom: 28px; }
  .co-heading-row { gap: 10px; }
  .co-heading-row h1 { font-size: 1.22rem; }
  .co-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .co-sort-control { width: 100%; justify-content: space-between; }
  .co-sort-control .form-select { flex: 1; max-width: none; }
  .co-checkout-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 8px;
    text-align: center;
  }
  .co-checkout-steps > li {
    flex-direction: column;
    font-size: .68rem;
    gap: 6px;
  }
  .co-form-section { padding: 16px 14px; }
  .co-method-card { align-items: flex-start; }
  .co-cart-line { grid-template-columns: 76px minmax(0, 1fr); padding: 12px; }
  .co-buy-actions {
    margin-inline: -8px;
    padding-inline: 8px;
  }
  .co-product-quantity-row { justify-content: space-between; gap: 12px; }
  .footer-columns { grid-template-columns: 1fr; gap: 18px; }
  .footer-column:last-child { grid-column: auto; display: flex; }
  .footer-topline { flex-direction: column; align-items: flex-start; }
  .ac-access-layout { margin-top: 12px; }
  .ac-access-form-panel,
  .ac-access-story { padding: 22px 18px; }
  .ac-order-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 379.98px) {
  .category-showcase > .category-card,
  .type-grid > .type-card {
    flex-basis: 100%;
    min-width: 100%;
  }
  .home-product-grid,
  .co-product-grid,
  .co-related-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mobile-menu-button,
  .header-cart,
  .header-account { width: 40px; height: 40px; min-height: 40px; }
}
