/**
 * B2B portals (MR, Distributor) — premium shell polish
 * Depends on tokens.css, portal-ux.css, b2b-portals.css
 */

html.b2b-shell--premium[data-portal="mr"],
html.b2b-shell--premium[data-portal="distributor"] {
  --b2b-bottom-nav-h: 64px;
}

html.b2b-shell--premium[data-portal="mr"] .b2b-shell-header,
html.b2b-shell--premium[data-portal="distributor"] .b2b-shell-header {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-chrome) 90%, var(--portal-accent, #1e88c7)) 0%,
    var(--color-chrome-deep) 100%
  );
  color: var(--color-chrome-text);
  border-bottom: 1px solid var(--color-chrome-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  padding: 0;
}

html.b2b-shell--premium .b2b-shell-header .container {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.b2b-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(220px, 42vw);
  padding: 0.35rem 0.65rem 0.35rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, #fff 10%, transparent);
  border: 1px solid color-mix(in srgb, #fff 14%, transparent);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
}

.b2b-user-chip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--portal-accent, #1e88c7) 55%, #fff);
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.b2b-user-chip__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.b2b-user-chip__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.b2b-user-chip__sub {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-lang-switch {
  flex-shrink: 0;
}

.portal-lang-switch .bss-lang-btn {
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.68rem;
  border: 1px solid color-mix(in srgb, #fff 18%, transparent);
  color: rgba(255, 255, 255, 0.82);
  background: color-mix(in srgb, #fff 6%, transparent);
}

.portal-lang-switch .bss-lang-btn:hover {
  background: color-mix(in srgb, #fff 14%, transparent);
  color: #fff;
}

.portal-lang-switch .bss-lang-btn.active {
  background: var(--portal-accent, var(--color-brand-primary));
  color: #fff;
  border-color: transparent;
}

/* Auth pages: segmented control owned by auth.css (.bss-lang-switch--auth) */

.b2b-account-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.25rem;
  border-radius: 20px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-2);
}

.b2b-account-hero__eyebrow {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin: 0 0 0.35rem;
}

.b2b-account-hero__title {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
  color: var(--color-text-primary);
}

.b2b-account-hero__sub {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

html.b2b-shell--premium .b2b-main {
  max-width: 1120px;
  padding-bottom: calc(1.5rem + var(--b2b-bottom-nav-h, 0px));
}

html.b2b-shell--premium .b2b-main--auth {
  max-width: none;
  width: 100%;
  padding: 0;
  margin: 0;
}

html.b2b-shell--premium .b2b-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  min-height: var(--b2b-bottom-nav-h);
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--color-bg-surface) 94%, transparent);
  border-top: 1px solid var(--color-border-subtle);
  box-shadow: 0 -8px 24px color-mix(in srgb, var(--color-text-primary) 8%, transparent);
  backdrop-filter: blur(12px);
}

html.b2b-shell--premium .b2b-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0.25rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--color-text-tertiary);
  line-height: 1.1;
}

html.b2b-shell--premium .b2b-bottom-nav a i {
  font-size: 1.15rem;
}

html.b2b-shell--premium .b2b-bottom-nav a.active {
  color: var(--portal-accent, var(--color-brand-primary));
  background: var(--portal-accent-soft, var(--color-brand-soft));
}

html.b2b-shell--premium .b2b-panel,
html.b2b-shell--premium .b2b-account-hero {
  border-radius: 20px;
}

html.b2b-shell--premium .b2b-form-card .form-control,
html.b2b-shell--premium .b2b-form-card .form-select,
html.b2b-shell--premium .b2b-form-card textarea.form-control {
  border-radius: 12px;
  border-color: var(--color-border-subtle);
}

html.b2b-shell--premium .b2b-form-card .form-control:focus,
html.b2b-shell--premium .b2b-form-card .form-select:focus {
  border-color: color-mix(in srgb, var(--portal-accent, var(--color-brand-primary)) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-accent, var(--color-brand-primary)) 12%, transparent);
}

[data-theme="dark"][data-portal="mr"] .b2b-account-hero,
[data-theme="dark"][data-portal="distributor"] .b2b-account-hero {
  background: var(--color-bg-surface);
}

@media (min-width: 768px) {
  html.b2b-shell--premium .b2b-main {
    padding-bottom: 2.5rem;
  }

  html.b2b-shell--premium .b2b-bottom-nav {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .b2b-user-chip__sub {
    display: none;
  }

  .b2b-user-chip {
    max-width: 160px;
  }
}
