/* =========================================================
   sasangraphic — account dashboard (My Account) styles
   RTL layout: sidebar on the RIGHT (desktop), content on the
   LEFT; collapsible sidebar on mobile. Reuses the front-page
   design system (style.css): tokens, buttons, glass surfaces,
   reveal animations and the 980px/600px breakpoints. Only adds
   the account-specific layout on top of the shared design.
   ========================================================= */

/* ----- WooCommerce design tokens → site tokens (account area) -----
   WooCommerce ships its own :root palette (--wc-*). Remapping those
   variables on .sg-account (a descendant element) makes every WC
   surface inside follow the night/day theme without duplicated CSS. */
.sg-account {
  --wc-primary: var(--accent);
  --wc-primary-text: var(--on-accent);
  --wc-secondary: var(--surface-strong);
  --wc-secondary-text: var(--text);
  --wc-highlight: var(--accent);
  --wc-content-bg: transparent;
  --wc-subtext: var(--text-muted);
  --wc-form-border-color: var(--border-strong);
  --wc-form-border-radius: var(--radius-sm);
  --wc-red: #e5484d;
  --wc-green: #30a46c;
  --wc-blue: var(--accent);
}

html[data-theme="night"] .sg-account {
  --wc-red: #f2555a;
  --wc-green: #4cc38a;
}

/* ===================== LAYOUT ===================== */
.sg-account {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(2rem, 4vw, 3rem));
  padding-bottom: clamp(3rem, 6vw, 5rem);
  min-height: 72vh;
}
.sg-account-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr); /* RTL: first column = RIGHT = sidebar */
  align-items: start;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

/* ===================== SIDEBAR ===================== */
.sg-account-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  background: var(--surface);
  backdrop-filter: blur(14px) saturate(135%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-ambient);
  padding: 0.75rem;
}
.sg-account-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sg-account-nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.96rem;
  font-weight: 500;
  transition:
    color var(--dur-fast),
    background var(--dur-fast),
    border-color var(--dur-fast);
}
.sg-account-nav-item a .ic {
  display: inline-flex;
  flex-shrink: 0;
}
.sg-account-nav-item a .ic svg {
  width: 19px;
  height: 19px;
}
.sg-account-nav-item a:hover {
  color: var(--text);
  background: var(--surface-strong);
}
.sg-account-nav-item.is-active a {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  font-weight: 700;
}
.sg-account-nav-item.is-logout a {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding-top: 1rem;
}
.sg-account-nav-item.is-logout a:hover {
  color: var(--wc-red);
}

/* mobile: collapsible sidebar */
.sg-account-sidebar-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
}
.sg-account-sidebar-toggle > svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.sg-account-sidebar-toggle .chev {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease);
}
.sg-account-sidebar-toggle.open .chev {
  transform: rotate(180deg);
}

@media (max-width: 980px) {
  .sg-account-layout {
    grid-template-columns: 1fr;
  }
  .sg-account-sidebar {
    position: static;
  }
  .sg-account-sidebar-toggle {
    display: flex;
  }
  .sg-account-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--dur-med) var(--ease);
  }
  .sg-account-nav.open {
    max-height: 480px;
  }
}

/* ===================== WELCOME ===================== */
.sg-dash-welcome {
  position: relative;
  padding-block: clamp(0.5rem, 1.5vw, 1.25rem) clamp(1rem, 2vw, 1.5rem);
}
.sg-dash-welcome::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 15% 40%, #000, transparent 75%);
  opacity: 0.4;
  pointer-events: none;
}
.sg-dash-hello {
  position: relative;
  font-size: clamp(1.7rem, 2.4vw + 0.8rem, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.sg-dash-hello-sub {
  position: relative;
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
}

/* ===================== STATISTICS CARDS ===================== */
.sg-dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}
.sg-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--dur-fast) var(--ease),
    border-color var(--dur-fast),
    box-shadow var(--dur-fast);
}
.sg-stat-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  box-shadow: 0 18px 44px -20px var(--accent-glow);
}
.sg-stat-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
  margin-bottom: 0.25rem;
}
.sg-stat-ic svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.sg-stat-num {
  font-size: clamp(1.25rem, 1vw + 0.8rem, 1.6rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  word-break: break-word;
}
.sg-stat-label {
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* button icons — SVGs ship without dimensions; without explicit sizing the
   browser renders them at the default 300×150 and blows up the buttons */
.sg-account .ghost-btn svg,
.sg-shop .ghost-btn svg,
.sg-download-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.sg-account .ghost-btn,
.sg-shop .ghost-btn {
  white-space: nowrap;
}

@media (max-width: 980px) {
  .sg-dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .sg-dash-stats {
    gap: 0.75rem;
  }
  .sg-stat-card {
    padding: 1rem;
  }
}

/* ===================== DASHBOARD SECTIONS ===================== */
.sg-dash-section {
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}
.sg-dash-heading {
  font-size: clamp(1.15rem, 1vw + 0.7rem, 1.4rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

/* "view all" links */
.sg-dash-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  transition: opacity var(--dur-fast);
}
.sg-dash-more:hover { opacity: 0.75; }

/* ===================== RECENT ORDERS ===================== */
.sg-orders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.sg-order-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  transition: background var(--dur-fast);
}
.sg-order-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}
.sg-order-row:hover {
  background: var(--surface-strong);
}
.sg-order-num {
  font-weight: 700;
  color: var(--text);
  font-size: 0.98rem;
  white-space: nowrap;
}
.sg-order-num:hover { color: var(--accent); }
.sg-order-date {
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: nowrap;
}
.sg-order-total {
  justify-self: end;
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
}
.sg-order-status {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-strong);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.sg-status--completed { background: rgba(48, 164, 108, 0.14); color: var(--wc-green); border-color: rgba(48, 164, 108, 0.3); }
.sg-status--processing { background: rgba(0, 112, 230, 0.12); color: var(--accent-day); border-color: rgba(0, 112, 230, 0.28); }
.sg-status--pending { background: rgba(255, 186, 0, 0.14); color: #c98a00; border-color: rgba(255, 186, 0, 0.3); }
html[data-theme="night"] .sg-status--pending { color: #ffd166; }
.sg-status--on-hold { background: rgba(255, 186, 0, 0.1); color: var(--text-muted); border-color: var(--border); }
.sg-status--cancelled, .sg-status--failed { background: rgba(229, 72, 77, 0.12); color: var(--wc-red); border-color: rgba(229, 72, 77, 0.28); }
.sg-order-view {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  transition: opacity var(--dur-fast);
}
.sg-order-view:hover { opacity: 0.75; }

/* ===================== DOWNLOADS ===================== */
.sg-downloads-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sg-download-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    transform var(--dur-fast),
    box-shadow var(--dur-fast);
}
.sg-download-row:hover {
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  background: var(--surface-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -18px var(--accent-glow);
}
.sg-download-name {
  font-weight: 700;
  font-size: 0.98rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-download-name a { color: var(--text); }
.sg-download-name a:hover { color: var(--accent); }
.sg-download-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  white-space: nowrap;
}
.sg-download-meta span b { color: var(--text); }
.sg-download-btn { padding: 0.6rem 1.3rem; font-size: 0.88rem; }

/* ===================== ACCOUNT INFO ===================== */
.sg-info-card {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
}
.sg-info-list {
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}
.sg-info-item {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.sg-info-item dt {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.sg-info-item dd {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================== EMPTY STATES ===================== */
.sg-dash-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}
.sg-dash-empty p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 420px;
}

/* =========================================================
   WooCommerce endpoint templates (Orders / Downloads / Account
   details / View order) — native templates kept; only the look
   is mapped to the design tokens.
   ========================================================= */
.sg-account-content {
  min-width: 0;
}
.sg-account-content h1,
.sg-account-content h2 {
  font-weight: 800;
}

/* notices (WC hardcodes its own palette and floats its buttons, which wraps
   the RTL text around the pill) — flex layout keeps text and button aligned */
.sg-account-content .woocommerce-message,
.sg-account-content .woocommerce-info,
.sg-account-content .woocommerce-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-top-width: 3px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  list-style: none;
  /* WC pads 3.5em on the icon-glyph side — the glyph is removed here */
  padding: 1em 1.25em;
}
.sg-account-content .woocommerce-message { border-top-color: var(--wc-green); }
.sg-account-content .woocommerce-info { border-top-color: var(--accent); }
.sg-account-content .woocommerce-error { border-top-color: var(--wc-red); }
.sg-account-content .woocommerce-message::before,
.sg-account-content .woocommerce-message::after,
.sg-account-content .woocommerce-info::before,
.sg-account-content .woocommerce-info::after,
.sg-account-content .woocommerce-error::before,
.sg-account-content .woocommerce-error::after {
  display: none; /* icon-font glyphs + WC's clearfix pseudo (a stray flex item) */
}
.sg-account-content .woocommerce-message .button,
.sg-account-content .woocommerce-info .button,
.sg-account-content .woocommerce-error .button {
  float: none;
  order: 2; /* text node first (RTL start), button at the visual end */
  margin-inline-start: auto;
  margin-top: 0;
  margin-bottom: 0;
}

/* WC buttons */
.sg-account-content .woocommerce-Button,
.sg-account-content .woocommerce-button,
.sg-account-content button.button,
.sg-account-content a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in oklab, var(--accent) 62%, var(--violet))
  );
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 10px 26px -10px var(--accent-glow);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    filter var(--dur-fast) var(--ease);
  white-space: nowrap;
  text-shadow: none;
}
.sg-account-content .woocommerce-Button:hover,
.sg-account-content .woocommerce-button:hover,
.sg-account-content button.button:hover,
.sg-account-content a.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px -12px var(--accent-glow);
  filter: brightness(1.05);
  color: var(--on-accent);
}

/* tables (orders / downloads / view order) */
.sg-account-content .woocommerce-orders-table,
.sg-account-content table.shop_table {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  width: 100%;
  box-shadow: var(--shadow-ambient);
}
.sg-account-content table.shop_table thead th {
  background: var(--surface-strong);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right; /* RTL */
}
.sg-account-content table.shop_table tbody td,
.sg-account-content table.shop_table tbody th {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  text-align: right;
  vertical-align: middle;
}
.sg-account-content table.shop_table tbody tr:last-child td,
.sg-account-content table.shop_table tbody tr:last-child th {
  border-bottom: none;
}
.sg-account-content table.shop_table tbody tr {
  transition: background var(--dur-fast);
}
.sg-account-content table.shop_table tbody tr:hover {
  background: var(--surface-strong);
}
/* WC smallscreen stripes every second row (td background) which fights the
   hover state — keep the rows even */
.sg-account-content .woocommerce-orders-table tbody tr:nth-child(2n) td {
  background-color: transparent;
}
/* WC smallscreen hides the order-number cell (a <th>) at mobile — the order
   number matters in a digital store, so restore it as a block row */
@media (max-width: 768px) {
  .sg-account-content .woocommerce-orders-table tbody th {
    display: block;
    padding: 1rem 1rem 0.35rem;
    border-bottom: none;
    background: transparent;
    text-align: right;
  }
}

/* downloads endpoint list (ul.woocommerce-Downloads.digital-downloads) */
.sg-account-content ul.digital-downloads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sg-account-content ul.digital-downloads li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast);
}
.sg-account-content ul.digital-downloads li:hover {
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  background: var(--surface-strong);
}
.sg-account-content ul.digital-downloads li::before {
  display: none; /* remove the icon-font glyph */
}
.sg-account-content ul.digital-downloads li a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
}
.sg-account-content ul.digital-downloads li a:hover {
  color: var(--accent);
}
.sg-account-content ul.digital-downloads li .count {
  float: none;
  order: 2; /* product link first (RTL start), remaining count at the end */
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

/* forms (edit-account) */
.sg-account-content .woocommerce-EditAccountForm fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.sg-account-content .woocommerce-EditAccountForm legend {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.5rem;
}
.sg-account-content .woocommerce-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  padding: 0;
}
.sg-account-content .woocommerce-form-row label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.sg-account-content .woocommerce-form-row .required {
  color: var(--wc-red);
}
.sg-account-content .woocommerce-form-row em {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: normal;
}
.sg-account-content .woocommerce-Input.input-text,
.sg-account-content .woocommerce-Input.input-email {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  transition:
    border-color var(--dur-fast),
    box-shadow var(--dur-fast),
    background var(--dur-fast);
}
.sg-account-content .woocommerce-Input.input-text:focus,
.sg-account-content .woocommerce-Input.input-email:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.sg-account-content .woocommerce-password-strength {
  border-radius: 999px;
  font-size: 0.84rem;
  padding: 0.35rem 0.8rem;
}
.sg-account-content .woocommerce-pagination {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.sg-account-content .addresses .title h3 {
  float: none;
  display: inline-block;
}
.sg-account-content .addresses .title .edit {
  float: none;
  display: inline-block;
  margin-inline-start: 0.5rem;
}

@media (max-width: 600px) {
  .sg-order-row {
    grid-template-columns: 1fr auto;
    gap: 0.4rem 0.75rem;
    padding: 1rem;
  }
  .sg-order-num { grid-column: 1; grid-row: 1; }
  .sg-order-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .sg-order-date { grid-column: 1; grid-row: 2; }
  .sg-order-view { grid-column: 2; grid-row: 2; justify-self: end; }
  .sg-order-total { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  .sg-download-row {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .sg-download-meta {
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    white-space: normal;
  }
  .sg-download-btn {
    width: 100%;
    justify-content: center;
  }
  .sg-info-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   CART + CHECKOUT (classic WooCommerce templates) — same design
   system. Shipping elements hide natively for digital carts; the
   physical address fields are filtered out when nothing ships.
   ========================================================= */

/* ----- WooCommerce design tokens → site tokens (shop area) ----- */
.sg-shop {
  --wc-primary: var(--accent);
  --wc-primary-text: var(--on-accent);
  --wc-secondary: var(--surface-strong);
  --wc-secondary-text: var(--text);
  --wc-highlight: var(--accent);
  --wc-content-bg: transparent;
  --wc-subtext: var(--text-muted);
  --wc-form-border-color: var(--border-strong);
  --wc-form-border-radius: var(--radius-sm);
  --wc-red: #e5484d;
  --wc-green: #30a46c;
}
html[data-theme="night"] .sg-shop {
  --wc-red: #f2555a;
  --wc-green: #4cc38a;
}

/* ----- shop shell (sg chrome wrapper) ----- */
.sg-shop {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(2rem, 4vw, 3rem));
  padding-bottom: clamp(3rem, 6vw, 5rem);
  min-height: 72vh;
}
.shop-header {
  position: relative;
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
}
.shop-title {
  font-size: clamp(1.9rem, 2.6vw + 1rem, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
}
.shop-content {
  min-width: 0;
}
.sg-cart-continue {
  margin-top: 1.25rem;
}

/* ----- cart table ----- */
.sg-shop table.shop_table.cart {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  width: 100%;
  box-shadow: var(--shadow-ambient);
}
.sg-shop table.shop_table.cart thead th {
  background: var(--surface-strong);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right; /* RTL */
}
.sg-shop table.shop_table.cart tbody td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.sg-shop table.shop_table.cart tbody tr:last-child td {
  border-bottom: none;
}
.sg-shop table.shop_table.cart tbody tr:hover {
  background: var(--surface-strong);
}
.sg-shop table.shop_table.cart .product-thumbnail img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.sg-shop table.shop_table.cart .product-name {
  font-weight: 700;
  font-size: 0.98rem;
}
.sg-shop table.shop_table.cart .product-name a {
  color: var(--text);
}
.sg-shop table.shop_table.cart .product-name a:hover {
  color: var(--accent);
}
.sg-shop table.shop_table.cart .product-price,
.sg-shop table.shop_table.cart .product-subtotal {
  font-weight: 700;
  white-space: nowrap;
}
.sg-shop table.shop_table.cart .product-price del,
.sg-shop table.shop_table.cart .product-subtotal del {
  color: var(--text-faint);
  font-weight: 400;
}

/* quantity input */
.sg-shop .quantity .qty {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0.5rem;
  width: 4.5rem;
  text-align: center;
  transition:
    border-color var(--dur-fast),
    box-shadow var(--dur-fast);
}
.sg-shop .quantity .qty:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* remove button (WC ships color with !important — the remapped --wc-red wins) */
.sg-shop table.shop_table.cart a.remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 0;
  line-height: 1;
  background: color-mix(in oklab, var(--wc-red) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--wc-red) 28%, transparent);
  color: var(--wc-red) !important; /* WC sets !important on .remove */
  transition:
    background var(--dur-fast),
    transform var(--dur-fast);
}
.sg-shop table.shop_table.cart a.remove:hover {
  background: color-mix(in oklab, var(--wc-red) 22%, transparent);
  transform: translateY(-2px);
}
.sg-shop table.shop_table.cart a.remove .ct-icon {
  width: 11px;
  height: 11px;
  font-size: initial;
}

/* coupon row + update cart */
.sg-shop table.shop_table.cart td.actions {
  padding: 1.1rem 1rem;
  background: var(--surface-strong);
}
.sg-shop table.shop_table.cart td.actions .coupon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.sg-shop table.shop_table.cart td.actions .coupon .input-text {
  flex: 1;
  min-width: 10rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.6rem 1.1rem;
}
.sg-shop table.shop_table.cart td.actions .coupon .input-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* ----- cart totals ----- */
.sg-shop .cart-collaterals {
  margin-top: 1.5rem;
}
.sg-shop .cart-collaterals .cart_totals {
  width: min(420px, 100%);
  float: none;
  margin-inline-start: auto; /* RTL: totals block at the visual end */
}
.sg-shop .cart-collaterals .cart_totals > h2 {
  font-size: clamp(1.15rem, 1vw + 0.7rem, 1.4rem);
  font-weight: 800;
  margin-bottom: 1rem;
}
.sg-shop .cart-collaterals table.shop_table {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  width: 100%;
  box-shadow: var(--shadow-ambient);
}
.sg-shop .cart-collaterals table.shop_table td,
.sg-shop .cart-collaterals table.shop_table th {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-align: right;
}
.sg-shop .cart-collaterals table.shop_table tr:last-child td,
.sg-shop .cart-collaterals table.shop_table tr:last-child th {
  border-bottom: none;
}
.sg-shop .cart-collaterals .order-total {
  font-weight: 800;
  font-size: 1.05rem;
}

/* proceed to checkout */
.sg-shop .wc-proceed-to-checkout {
  padding: 1rem 1.1rem;
}
.sg-shop .wc-proceed-to-checkout .checkout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in oklab, var(--accent) 62%, var(--violet))
  );
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.98rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 10px 26px -10px var(--accent-glow);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    filter var(--dur-fast) var(--ease);
  white-space: nowrap;
  text-shadow: none;
}
.sg-shop .wc-proceed-to-checkout .checkout-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px -12px var(--accent-glow);
  filter: brightness(1.05);
  color: var(--on-accent);
}

/* ----- checkout ----- */
.sg-shop .woocommerce-checkout {
  float: none;
  width: 100%;
}
.sg-shop .woocommerce-checkout .col2-set {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  width: 100%;
  float: none;
}
/* virtual carts: the shipping column renders empty — collapse to one column */
.sg-shop .woocommerce-checkout .col2-set:has(.col-2:empty) {
  grid-template-columns: 1fr;
}
.sg-shop .woocommerce-billing-fields > h3,
.sg-shop .woocommerce-additional-fields > h3,
.sg-shop #order_review_heading {
  font-size: clamp(1.15rem, 1vw + 0.7rem, 1.4rem);
  font-weight: 800;
  margin-bottom: 1.25rem;
}
/* generic WC inputs (the checkout form fields use input-text only) */
.sg-shop .input-text,
.sg-shop select.input-select,
.sg-shop textarea.input-text {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  transition:
    border-color var(--dur-fast),
    box-shadow var(--dur-fast),
    background var(--dur-fast);
}
.sg-shop .input-text:focus,
.sg-shop select.input-select:focus,
.sg-shop textarea.input-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* order review + payment */
.sg-shop #order_review {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-ambient);
  overflow: hidden;
}
.sg-shop #order_review .shop_table {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.sg-shop #order_review .shop_table td,
.sg-shop #order_review .shop_table th {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-align: right;
}
.sg-shop #order_review .shop_table tr:last-child td,
.sg-shop #order_review .shop_table tr:last-child th {
  border-bottom: none;
}
.sg-shop #order_review .order-total {
  font-weight: 800;
}
.sg-shop #payment {
  background: var(--surface-strong);
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 1.1rem 1.25rem;
}
.sg-shop #payment ul.payment_methods {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--border);
}
.sg-shop #payment ul.payment_methods li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  margin: 0;
}
.sg-shop #payment ul.payment_methods li input {
  accent-color: var(--accent);
}
.sg-shop #payment ul.payment_methods li label {
  color: var(--text);
  font-weight: 600;
}
.sg-shop #payment div.payment_box {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}
.sg-shop #place_order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in oklab, var(--accent) 62%, var(--violet))
  );
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.98rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 10px 26px -10px var(--accent-glow);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    filter var(--dur-fast) var(--ease);
  white-space: nowrap;
  text-shadow: none;
  /* WC floats the button with an ID-heavy selector (2,0,0) — width 100% makes
     the float irrelevant; the !important is the documented exception */
  float: none !important;
}
.sg-shop #place_order:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px -12px var(--accent-glow);
  filter: brightness(1.05);
  color: var(--on-accent);
}
.sg-shop #place_order:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* terms + conditions */
.sg-shop .woocommerce-terms-and-conditions-wrapper {
  margin: 1rem 0;
}
.sg-shop .woocommerce-terms-and-conditions-wrapper .woocommerce-privacy-policy-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.sg-shop .woocommerce-terms-and-conditions {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.sg-shop .woocommerce-terms-and-conditions-checkbox-text {
  font-size: 0.92rem;
  color: var(--text);
}
.sg-shop .woocommerce-terms-and-conditions-checkbox-text a {
  color: var(--accent);
}

@media (max-width: 980px) {
  .sg-shop .woocommerce-checkout .col2-set {
    grid-template-columns: 1fr;
  }
  .sg-shop .cart-collaterals .cart_totals {
    width: 100%;
  }
}
@media (max-width: 768px) {
  /* WC smallscreen: tables stack — give the cart rows a readable rhythm */
  .sg-shop table.shop_table.cart tbody td {
    display: block;
    padding: 0.7rem 1rem;
  }
  .sg-shop table.shop_table.cart tbody td.product-thumbnail {
    padding-bottom: 0;
  }
  .sg-shop table.shop_table.cart tbody td::before {
    color: var(--text-muted);
    font-size: 0.84rem;
  }
}