/* Shared storefront and operator surfaces, loaded after the legacy component styles. */
html[data-theme] {
  --bg: #f2f3f6;
  --surface: #fff;
  --raised: #e9edf5;
  --text: #172135;
  --muted: #4d5c71;
  --line: #d6deea;
  --pet-ink: var(--text);
  --pet-muted: var(--muted);
  --pet-panel: var(--surface);
  --pet-line: var(--line);
  --pet-soft: var(--raised);
  --rm-nav: #142137;
  --rm-accent: #2258c9;
  --rm-accent-hover: #1947aa;
  --rm-selected: #e5edff;
  --rm-focus: #235be0;
  --rm-accent-text: #234fa8;
  --rm-hero: #14233e;
  --rm-hero-line: #719ef548;
  --rm-card-disabled: #edf0f4;
}

html[data-theme="dark"] {
  --bg: #0d1421;
  --surface: #171f31;
  --raised: #1e2b44;
  --text: #f3f6fb;
  --muted: #b0bdd0;
  --line: #34435e;
  --rm-nav: #101a2b;
  --rm-accent: #2861d0;
  --rm-accent-hover: #326edf;
  --rm-selected: #273e6b;
  --rm-focus: #94b8ff;
  --rm-accent-text: #b8cfff;
  --rm-hero: #142745;
  --rm-card-disabled: #151d2b;
}

html[data-theme] body { background: var(--bg); color: var(--text); font-size: 18px; line-height: 1.55; }
html[data-theme] :focus-visible { outline: 2px solid var(--rm-focus); outline-offset: 3px; }
html[data-theme] :is(.primary, .buy-button):not(:disabled) {
  background: var(--rm-accent);
  border-color: var(--rm-accent);
  color: #fff;
}
html[data-theme] :is(.primary, .buy-button):not(:disabled):hover {
  background: var(--rm-accent-hover);
  border-color: var(--rm-accent-hover);
}

html[data-theme] .sidebar { background: var(--rm-nav); border-color: #ffffff19; }
html[data-theme] .nav-item { color: #c4d2e9; border-radius: 10px; }
html[data-theme] .nav-item.active { color: #fff; background: #28487e; box-shadow: none; }
html[data-theme] .nav-item:hover:not(:disabled) { color: #fff; background: #263c62; }
html[data-theme] .sidebar-bottom .operator-link { color: #b4c5e2; }
html[data-theme] .search-wrap { background: var(--surface); border-color: var(--line); border-radius: 11px; }
.topbar { padding-block: 12px; }

.rush-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: stretch;
  min-height: 286px;
  gap: 0;
  overflow: hidden;
  border-radius: 22px;
  background: var(--rm-hero);
}
.hero-copy { position: relative; padding: clamp(22px,4vw,56px); }
html[data-theme] .hero-copy h1 {
  color: #f7f9ff;
  font-size: clamp(36px,4.3vw,67px);
  line-height: 1.04;
  font-weight: 850;
  letter-spacing: -.065em;
  margin-bottom: 18px;
}
html[data-theme] .hero-copy h1 span { color: #a6c3ff; }
html[data-theme] .hero-copy p { color: #d7e2f6; line-height: 1.5; }
html[data-theme] .hero-actions .secondary {
  color: #eef4ff;
  background: #ffffff10;
  border-color: #ffffff57;
}
html[data-theme] .hero-actions .secondary:hover:not(:disabled) { background: #ffffff24; }
html[data-theme] .mascot-scene {
  height: auto;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at 50% 57%, #2d63b3 0%, #1b3b6b 46%, var(--rm-hero) 84%);
  background-color: var(--rm-hero);
}
html[data-theme] .mascot-scene::before {
  display: block;
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  content: "";
  border: 0;
  border-radius: 0;
  opacity: .42;
  pointer-events: none;
  background-image: radial-gradient(var(--rm-hero-line) 1px, transparent 1px);
  background-size: 16px 16px;
  mask-image: radial-gradient(ellipse, #000 22%, transparent 75%);
}
.store-heading :is(h1,h2), .page-heading h1 { font-weight: 850; letter-spacing: -.04em; }
.store-heading { margin-bottom: 16px; }
.category-tabs { gap: 6px; margin-bottom: 14px; }
html[data-theme] :is(.category-tab, .availability-filter, .catalog-toolbar select, .admin-tabs button) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  border-radius: 9px;
}
html[data-theme] :is(.category-tab.active, .availability-filter[aria-pressed="true"], .admin-tabs button.active) {
  background: var(--rm-selected);
  color: var(--rm-accent-text);
  border-color: var(--rm-accent-text);
}
html[data-theme] .category-tab small { background: var(--raised); color: var(--muted); border-radius: 5px; }
.catalog-toolbar { margin-bottom: 15px; }
.product-grid { gap: clamp(12px,1.3vw,20px); }
html[data-theme] .product-card {
  min-height: 236px;
  padding: clamp(16px,1.65vw,24px);
  border-color: var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 2px 4px #131d3010;
  transition: border-color .16s ease, box-shadow .16s ease;
}
html[data-theme] .product-card:hover { border-color: var(--rm-accent-text); box-shadow: 0 6px 16px #131d3016; }
html[data-theme] .product-card.service-disabled { background: var(--rm-card-disabled); filter: none; }
html[data-theme] .product-card.service-disabled :is(h3, .price, .product-category, .product-description, .product-meta) { color: var(--muted); }
.product-ident { align-items: center; min-width: 0; }
.product-card :is(h3,.product-description) { overflow-wrap: anywhere; }
.product-card h3 { font-size: 24px; line-height: 1.3; font-weight: 800; letter-spacing: -.025em; }
.product-card .product-description { margin-bottom: 12px; }
.product-card .product-term { margin-top: 10px; align-self: flex-start; }
.product-card .product-bottom { margin-top: auto; padding-top: 12px; border-color: var(--line); }
.product-card .buy-button { min-height: 48px; padding-inline: 20px; border-radius: 9px; font-size: 17px; }
.product-card .price { font-variant-numeric: tabular-nums; font-size: clamp(24px,2.1vw,32px); }
[data-action="more-products"] { display: flex; margin: 20px auto 0; }

html[data-theme] :is(.content-panel,.order-card,.profile-card,.admin-product,.ops-panel,.ops-metric,.empty-state) {
  background: var(--surface);
  border-color: var(--line);
  border-radius: 14px;
}
html[data-theme] :is(.field input,.field textarea,.field select,.ops-form input,.ops-form textarea,.ops-form select) {
  color: var(--text);
  background: var(--bg);
  border-color: var(--line);
  border-radius: 9px;
}
.ops-grid > *, .ops-metrics > *, .order-info > * { min-width: 0; }
:is(.ops-panel,.order-card,.content-panel) :is(h2,h3,p,code) { overflow-wrap: anywhere; }
.order-id { overflow-wrap: anywhere; }
.support-ticket { min-height: 44px; }
html[data-theme] dialog#modal { border-radius: 18px; background: var(--surface); border-color: var(--line); }
dialog#modal::backdrop { background: #081326b3; }
.modal-header { isolation: isolate; border-bottom: 1px solid var(--line); }
.checkout-submit { width: 100%; min-height: 46px; }
[data-form="checkout"] .modal-footer { text-align: center; }
.payment-order {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.payment-order span { min-width: 0; overflow-wrap: anywhere; }
.payment-order strong { font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payment-methods { min-width: 0; border: 0; padding: 0; margin: 20px 0; }
.payment-methods legend { padding: 0; margin-bottom: 10px; font-weight: 750; }
.payment-choices { display: grid; grid-template-columns: repeat(auto-fit,minmax(128px,1fr)); gap: 8px; }
.payment-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.payment-choice input { margin: 0; flex: none; accent-color: var(--rm-accent); }
.payment-choice strong, .payment-choice small { display: block; line-height: 1.4; }
.payment-choice small { color: var(--muted); font-size: 12px; }
.payment-choice:has(:checked) { color: var(--rm-accent-text); background: var(--rm-selected); border-color: currentColor; }
.payment-choice:has(:disabled) { color: var(--muted); background: var(--rm-card-disabled); cursor: default; }
.payment-invoice, .payment-outcome { display: grid; gap: 14px; min-width: 0; }
.invoice-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.invoice-state { display: inline-flex; align-items: center; gap: 8px; color: var(--rm-accent-text); }
.invoice-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.invoice-details { display: grid; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.invoice-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.invoice-field + .invoice-field { border-top: 1px solid var(--line); }
.invoice-field > div { min-width: 0; }
.invoice-field dt { color: var(--muted); font-size: 14px; }
.invoice-field dd { margin: 4px 0 0; color: var(--text); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.invoice-field:first-child dd { font-size: clamp(18px,4vw,23px); }
.invoice-field dd span { font-size: 0.75em; color: var(--muted); }
.invoice-field .button { min-height: 44px; min-width: 110px; padding-inline: 10px; font-size: 15px; }
.invoice-instruction, .invoice-check p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.invoice-check { display: grid; gap: 9px; }
.invoice-check .button { min-height: 46px; }
.invoice-check .button:disabled { color: var(--rm-accent-text); background: var(--rm-selected); border-color: var(--line); opacity: 1; }
.invoice-check .button[aria-busy="true"]::before {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
  animation: invoice-check-spin .8s linear infinite;
}
@keyframes invoice-check-spin { to { transform: rotate(1turn); } }
.payment-outcome .notice { margin: 0; }
.payment-outcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.billing-page { width: min(100%, 690px); margin-inline: auto; display: grid; gap: 14px; }
.billing-page .page-heading { margin-block-end: 0; }
.billing-page .page-heading p { overflow-wrap: anywhere; }
.billing-page .payment-invoice .notice { margin: 0; }
.billing-page .payment-invoice .payment-methods { margin-block: 0 16px; }
.billing-page .payment-outcome-actions { border-top: 1px solid var(--line); padding-top: 14px; }
.invoice-balance, .balance-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.invoice-balance { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: var(--bg); }
.invoice-balance p { margin: 4px 0 0; font-size: 14px; }
.balance-summary span, .balance-summary strong { display: block; }
.balance-summary span, .balance-list span, .balance-list small { color: var(--muted); }
.balance-summary strong { margin-top: 2px; font-size: clamp(24px,6vw,36px); line-height: 1.2; }
.balance-summary strong, .balance-list strong { font-variant-numeric: tabular-nums; }
.balance-panel h2 { margin-top: 0; }
.balance-form .form-grid { margin-block: 0 12px; }
.balance-list { margin: 0; padding: 0; list-style: none; }
.balance-list li { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; border-top: 1px solid var(--line); padding: 12px 0; }
.balance-list li:last-child { padding-bottom: 0; }
.balance-list a { color: var(--rm-accent-text); font-weight: 700; }
.balance-list small { display: block; margin-top: 2px; }
.order-reference { background: var(--surface); }
.order-reference .invoice-field:first-child dd { font-size: 13px; font-weight: 650; }
.invoice-progress { padding: 10px 12px; border-radius: 8px; background: var(--rm-selected); color: var(--rm-accent-text); }
.invoice-progress strong { margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
.delivery-page { gap: 10px; }
.delivery-page .page-heading p { margin-block: 4px 0; }
.delivery-page .invoice-details { min-width: 0; grid-template-columns: minmax(0,1fr); }
.delivery-page .invoice-field { min-width: 0; }
.delivery-page .invoice-field .button { flex: 0 0 auto; }
.account-delivery { display: grid; gap: 10px; padding: 14px; }
.account-delivery h2, .account-delivery p { margin: 0; }
.account-delivery .invoice-field { padding-block: 9px; }
.account-delivery .invoice-field dd { font-size: 19px; }
.account-delivery .delivery-code { min-height: 44px; }
.account-actions { display: grid; gap: 8px; }
.account-actions .button { width: 100%; min-height: 44px; }
.account-field-time { display: block; font-size: 13px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.account-delivery [data-reset-result]:empty { display: none; }
.account-delivery .delivery-hint, .account-delivery [data-code-result] { font-size: 14px; color: var(--muted); line-height: 1.4; }
.account-delivery [data-code-result]:empty { display: none; }
.delivery-code-history { margin-top: 8px; }
.account-delivery .delivery-code-history h3 { font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.delivery-code-history > .invoice-details { max-height: 240px; overflow-y: auto; margin-top: 4px; }
.delivery-page .order-reference .invoice-field { padding-block: 7px; }
.delivery-page .order-reference .invoice-field > div { flex: 1; }
.delivery-page .order-reference dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-reference .invoice-field { padding: 8px 12px; }
.order-reference .invoice-field > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }
.order-reference .invoice-field dd { margin: 0; }
.delivery-page :is(.account-delivery,.order-reference) .invoice-field .button { min-width: 0; }
.delivery-links { display: flex; flex-wrap: wrap; gap: 8px; }
.delivery-links .button { min-height: 44px; }
.field-optional { color: var(--muted); font-size: 12px; font-weight: 500; }
.checkout-validation { margin: 4px 0 10px; color: #a32238; font-size: 14px; font-weight: 700; }
html[data-theme="dark"] .checkout-validation { color: #ffacb8; }
[data-form="checkout"] [aria-invalid="true"] { outline: 1px solid currentColor; outline-offset: 2px; }
html[data-operator] :is(.topbar .search-wrap, .topbar .orders-button, .topbar .profile-button, .footer a) { display: none; }
html[data-operator] .topbar { justify-content: flex-end; min-height: 70px; }

@media (max-width: 760px) {
  .rush-hero { grid-template-columns: minmax(0, 1fr) clamp(100px,30vw,210px); min-height: 208px; border-radius: 16px; }
  .hero-copy { padding: 22px 0 22px 18px; }
  html[data-theme] .hero-copy h1 { font-size: clamp(26px,6.8vw,43px); margin-bottom: 10px; }
  .hero-copy p { font-size: 16px; margin-bottom: 14px; }
  .hero-actions .button { min-height: 44px; }
  .category-tabs { padding-bottom: 4px; }
  .product-card .buy-button { padding-inline: 12px; }
  .invoice-field { padding-inline: 10px; gap: 8px; }
  .invoice-field .button { min-width: 98px; padding-inline: 7px; }
  .main:has(.delivery-page) .topbar { grid-template-areas: "brand actions"; min-height: 0; margin-bottom: 14px; }
  .main:has(.delivery-page) .search-wrap { display: none; }
  html[data-theme] .delivery-page .account-delivery { padding: 12px; }
  .delivery-page .page-heading h1 { font-size: clamp(23px,6vw,30px); margin-block: 0; }
  dialog#modal:has([data-form="checkout"]) { max-height: calc(100dvh - 16px); overscroll-behavior: contain; scroll-padding-block-end: 70px; }
  dialog#modal:has([data-form="checkout"]) .modal-panel { padding: 16px 14px 0; }
  [data-form="checkout"] .field input[type="text"] { font-size: 16px; }
  .checkout-actions { position: sticky; bottom: 0; z-index: 1; padding: 9px 0 max(9px,env(safe-area-inset-bottom)); background: var(--surface); }
  html[data-operator] .topbar { justify-content: space-between; }
}

html[data-theme] :is(.button,.orders-button,.category-tab) { font-weight: 750; font-size: 16px; }
html[data-theme] :is(.field input,.field textarea,.field select) { font-size: 17px; }
html[data-theme] :is(.field label,.terms-row) { font-size: 15px; color: var(--text); }
html[data-theme] :is(.category-tab,.availability-filter,.catalog-toolbar select) { min-height: 44px; }
html[data-theme] :is(.product-description,.content-panel p,.content-panel li) { font-size: 17px; color: var(--muted); line-height: 1.55; }
html[data-theme] :is(.product-category,.product-term,.product-meta,.result-count,.price-updated,.status) { font-size: 14px; }
html[data-theme] :is(.page-heading h1,.store-heading h1,.store-heading h2) { font-size: clamp(30px,3vw,42px); line-height: 1.15; }
html[data-theme] .invoice-field .button { font-size: 15px; }
html[data-theme] .account-delivery .delivery-hint { font-size: 14px; }
html[data-theme] .product-card .buy-button { font-size: 17px; }
html[data-theme] .product-category { color: var(--muted); }
html[data-theme] .catalog-toolbar select { font-size: 15px; }
html[data-theme] .availability-filter { font-size: 15px; }
html[data-theme] .nav-item { font-size: 16px; }

@media (max-width: 760px) {
  html[data-theme] body { font-size: 17px; }
  html[data-theme] .nav-item { font-size: 12px; }
  html[data-theme] .product-card h3 { font-size: 23px; }
  html[data-theme] .hero-actions .button { font-size: 15px; padding-inline: 12px; }
  html[data-theme] .catalog-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  html[data-theme] .catalog-controls { flex-wrap: wrap; gap: 8px; }
  html[data-theme] .account-delivery { gap: 8px; }
  html[data-theme] .delivery-page .button { font-size: 14px; }
  html[data-theme] .delivery-page .invoice-field { padding-block: 7px; }
  html[data-theme] .delivery-page .account-delivery { gap: 6px; padding: 10px; }
  html[data-theme] .delivery-page .account-delivery .invoice-field dd { font-size: 17px; letter-spacing: -.02em; }
  html[data-theme] .delivery-page .account-delivery .invoice-field:first-child dd { white-space: nowrap; }
  html[data-theme] .delivery-page .account-delivery [data-code-result] dd { font-size: 21px; }
  html[data-theme] .delivery-page .page-heading h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] .product-card { transition: none; }
  .invoice-check .button[aria-busy="true"]::before { animation: none; }
}
