/*
 * SaloCart V5.2.1 — Professional Performance & Account Menu Polish
 * Presentation and delivery improvements only. No business, API, or data-flow rules change here.
 */

/* Restore the original SaloCart green identity for every account role. */
:root,
html[data-role-theme] {
  --sc-green: #0A6C48;
  --sc-green-deep: #074630;
  --sc-green-dark: #053521;
  --sc-lime: #A8D94C;
  --sc-lime-soft: #F1F8DF;
  --sc-mint: #EAF8F0;
  --sc-mint-strong: #D8F1E2;
  --sc-orange: #F4A83A;
  --sc-blue: #1765AE;
  --sc-blue-soft: #E8F2FC;
  --sc-coral: #C94D63;
  --sc-ink: #15231C;
  --sc-ink-soft: #516259;
  --sc-muted: #75857C;
  --sc-line: #DDE8E1;
  --sc-line-strong: #C9DCD0;
  --sc-soft: #F7FAF8;
  --sc-surface: #FFFFFF;
  --sc-surface-alt: #F3F7F4;
  --role-primary: #0A6C48;
  --role-primary-deep: #074630;
  --role-accent: #A8D94C;
  --role-soft: #EAF8F0;
  --role-ink: #15231C;
  --role-muted: #75857C;
  --role-line: #DDE8E1;
  --role-page: #F7FAF8;
  --role-glow: rgba(10, 108, 72, .14);
  --role-gradient: linear-gradient(118deg, #063C29 0%, #07583B 49%, #08734C 100%);
  --role-contrast: #FFFFFF;
  --font-display: "Sora", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Keep the original dark SaloCart palette, rather than reintroducing role-specific accents. */
html[data-theme="dark"][data-role-theme] {
  --sc-green: #52DB9D;
  --sc-green-deep: #A5F7C8;
  --sc-green-dark: #0B3D2A;
  --sc-lime: #C7EA6A;
  --sc-lime-soft: #293A1F;
  --sc-mint: #173726;
  --sc-mint-strong: #204E34;
  --sc-orange: #FFC35A;
  --sc-blue: #79C6FF;
  --sc-blue-soft: #173348;
  --sc-coral: #FF9BAA;
  --sc-ink: #ECF6EF;
  --sc-ink-soft: #C1D2C7;
  --sc-muted: #96AA9D;
  --sc-line: #2A4434;
  --sc-line-strong: #3B614A;
  --sc-soft: #0B1510;
  --sc-surface: #111D16;
  --sc-surface-alt: #16251C;
  --role-primary: #52DB9D;
  --role-primary-deep: #A5F7C8;
  --role-accent: #C7EA6A;
  --role-soft: #173726;
  --role-ink: #ECF6EF;
  --role-muted: #96AA9D;
  --role-line: #2A4434;
  --role-page: #0B1510;
  --role-glow: rgba(82, 219, 157, .14);
  --role-gradient: linear-gradient(118deg, #0B3D2A 0%, #12593E 52%, #237554 100%);
}

/* A quieter, more consistent system surface. */
html[data-role-theme] body {
  background:
    radial-gradient(760px 380px at 100% -180px, var(--role-glow), transparent 68%),
    linear-gradient(180deg, color-mix(in srgb, var(--role-page) 97%, #fff) 0%, var(--role-page) 62%);
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

:where(h1, h2, h3, h4, h5, h6, .brand-copy strong, .sheet-head h2, .account-menu-identity h3) {
  font-family: var(--font-display) !important;
  letter-spacing: -0.035em;
}

:where(.page-header p, .sheet-subtitle, .account-menu-identity p, .account-menu-action small, .mobile-menu-item small) {
  line-height: 1.52;
}

/* Stop retaining a compositor layer on every deal card. Hover/touch effects stay intact. */
.deal-card,
.workspace-card,
.workspace-action {
  will-change: auto;
}

.deal-card:hover,
.workspace-card:hover,
.workspace-action:hover {
  will-change: transform;
}

@supports (content-visibility: auto) {
  .page-root :is(
    .deal-card,
    .list-card,
    .workspace-card,
    .workspace-section,
    .seller-dashboard-section,
    .partner-receiving-section,
    .partner-ready-section,
    .partner-cash-reconcile-card,
    .role-guide-card
  ) {
    content-visibility: auto;
    contain-intrinsic-size: auto 300px;
  }
}

/* Account menu: a stable desktop dialog and a safe, scrollable mobile sheet. */
.account-menu-sheet {
  width: min(100%, 540px);
  overflow: hidden;
}

.account-menu {
  display: grid;
  gap: .78rem;
}

.account-menu-identity {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: .78rem;
  padding: .88rem;
  border: 1px solid color-mix(in srgb, var(--sc-green) 20%, var(--sc-line));
  border-radius: 18px;
  background:
    radial-gradient(280px 120px at 100% 0, color-mix(in srgb, var(--sc-lime) 24%, transparent), transparent 74%),
    linear-gradient(135deg, var(--sc-mint), var(--sc-surface));
}

.account-menu-avatar,
.account-menu-identity .account-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--sc-green), var(--sc-lime));
  box-shadow: 0 8px 18px rgba(7, 86, 58, .16);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.14rem;
  font-weight: 800;
}

.account-menu-identity > div {
  min-width: 0;
}

.account-menu-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .34rem;
  color: var(--sc-green);
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.account-menu-identity h3 {
  overflow: hidden;
  margin: .13rem 0 0;
  color: var(--sc-ink);
  font-size: 1rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-identity p,
.account-menu-identity small {
  display: block;
  overflow: hidden;
  margin: .1rem 0 0;
  color: var(--sc-ink-soft);
  font-size: .69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-identity small {
  color: var(--sc-muted);
  font-size: .61rem;
}

.account-menu-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--sc-line);
  border-radius: 17px;
  background: var(--sc-surface);
}

.account-menu-action {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) 16px;
  align-items: center;
  gap: .7rem;
  width: 100%;
  min-height: 60px;
  padding: .65rem .75rem;
  border: 0;
  border-bottom: 1px solid var(--sc-line);
  background: transparent;
  color: var(--sc-ink);
  text-align: left;
}

.account-menu-action:last-child {
  border-bottom: 0;
}

.account-menu-action:hover,
.account-menu-action:focus-visible {
  background: var(--sc-surface-alt);
  outline: none;
}

.account-menu-action:active {
  background: var(--sc-mint);
}

.account-menu-action > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: .12rem;
}

.account-menu-action strong,
.account-menu-action small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-action strong {
  color: var(--sc-ink);
  font-size: .75rem;
  font-weight: 800;
}

.account-menu-action small {
  color: var(--sc-muted);
  font-size: .61rem;
}

.account-menu-action > i:last-child {
  color: var(--sc-muted);
  font-size: .74rem;
}

.account-menu-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 11px;
  background: var(--sc-mint);
  color: var(--sc-green);
  font-size: .9rem;
}

.account-menu-icon.tone-blue {
  background: var(--sc-blue-soft);
  color: var(--sc-blue);
}

.account-menu-icon.tone-lime {
  background: var(--sc-lime-soft);
  color: #637D20;
}

.account-menu-icon.tone-slate {
  background: var(--sc-surface-alt);
  color: var(--sc-ink-soft);
}

.account-menu-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  width: 100%;
  min-height: 43px;
  border: 1px solid color-mix(in srgb, var(--sc-coral) 30%, var(--sc-line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--sc-coral) 6%, var(--sc-surface));
  color: var(--sc-coral);
  font-size: .71rem;
  font-weight: 800;
}

.account-menu-signout:hover {
  background: color-mix(in srgb, var(--sc-coral) 11%, var(--sc-surface));
}

/* Desktop account trigger: labels never squeeze the action icons. */
@media (min-width: 992px) {
  .top-actions {
    min-width: 0;
  }

  .account-button {
    min-width: 0;
    max-width: 188px;
    border-color: transparent;
  }

  .account-button > span:not(:first-child) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-menu-sheet {
    max-height: min(720px, calc(100dvh - 52px));
    border-radius: 24px !important;
  }

  .account-menu-sheet .sheet-head {
    padding: 1rem 1.05rem .8rem !important;
  }

  .account-menu-sheet .sheet-body {
    padding: .9rem 1.05rem 1.05rem !important;
  }
}

/* Keep a direct account entry point in the compact header while Menu remains available below. */
@media (max-width: 991.98px) {
  .top-actions .account-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 3px !important;
    border: 1px solid var(--sc-line) !important;
    border-radius: 14px !important;
    background: var(--sc-surface-alt) !important;
    color: var(--sc-ink) !important;
  }

  .top-actions .account-button > :not(:first-child) {
    display: none !important;
  }

  .top-actions .account-button .avatar-initial,
  .top-actions .account-button .avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: .78rem;
  }

  .account-menu-sheet,
  .mobile-menu-sheet {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(90dvh - env(safe-area-inset-top)) !important;
    overscroll-behavior: contain;
  }

  .account-menu-sheet .sheet-head,
  .mobile-menu-sheet .sheet-head {
    padding: .92rem 1rem .72rem !important;
  }

  .account-menu-sheet .sheet-body,
  .mobile-menu-sheet .sheet-body {
    padding: .2rem .9rem calc(.95rem + env(safe-area-inset-bottom)) !important;
  }

  .account-menu-identity {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .68rem;
    padding: .76rem;
  }

  .account-menu-avatar,
  .account-menu-identity .account-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .account-menu-action {
    grid-template-columns: 34px minmax(0, 1fr) 14px;
    min-height: 58px;
    gap: .62rem;
    padding-inline: .68rem;
  }

  .account-menu-icon {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 390px) {
  .top-actions {
    gap: 4px !important;
  }

  .top-actions .account-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .top-actions .account-button .avatar-initial,
  .top-actions .account-button .avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .account-menu-identity h3 {
    font-size: .92rem;
  }

  .account-menu-action small {
    font-size: .58rem;
  }
}

@media (max-width: 340px) {
  .top-actions .cart-button {
    display: none !important;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar,
  .mobile-nav,
  .sheet-head {
    background: var(--sc-surface) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deal-card,
  .workspace-card,
  .workspace-action,
  .account-menu-action,
  .account-menu-signout {
    transition: none !important;
  }
}


/* V5.2.2 — Target-triggered Seller packing notice */
.seller-auto-pack-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--sc-green, #168548) 26%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--sc-green, #168548) 8%, var(--surface, #fff));
  color: var(--ink, #183127);
}
.seller-auto-pack-notice > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  background: var(--sc-green, #168548);
  color: #fff;
  font-size: 1.15rem;
}
.seller-auto-pack-notice > div { min-width: 0; }
.seller-auto-pack-notice strong { display: block; font-family: var(--font-display, inherit); font-size: 0.98rem; line-height: 1.3; }
.seller-auto-pack-notice p { margin: 4px 0 0; color: var(--muted, #607166); font-size: 0.86rem; line-height: 1.48; }
.seller-auto-pack-notice .btn-sc-light { white-space: nowrap; }
@media (max-width: 620px) {
  .seller-auto-pack-notice { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px; }
  .seller-auto-pack-notice .btn-sc-light { grid-column: 1 / -1; width: 100%; min-height: 42px; }
}
