/* B2B-portal styles. Layered on top of cs-overrides.css and the brand app.css.
   Goal: keep brand identity but make B2B feel like a workspace (denser layout,
   functional header with cart badge + organization name + logout). */

.b2b-body { background: #f4f5f7; }

/* Header: dense single row, no mega-menu. */
.b2b-header { background: #fff; box-shadow: 0 1px 0 rgba(0,0,0,0.05); position: relative; }
.b2b-header__row {
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0.65rem 1rem; max-width: 1280px; margin: 0 auto;
}
.b2b-header .header-main__branding { flex: 0 0 auto; }
.b2b-nav { flex: 1 1 auto; }
.b2b-nav .main-nav__list { display: flex; gap: 1.25rem; list-style: none; padding: 0; margin: 0; }
.b2b-nav .main-nav__list a { color: #1f2937; font-weight: 500; }
.b2b-nav .main-nav__list a:hover { color: #c8102e; text-decoration: none; }
.b2b-user { display: flex; align-items: center; gap: 0.75rem; }
.b2b-user__name { font-size: 0.9rem; color: #4b5563; }
.b2b-user__org { font-size: 0.85rem; color: #6b7280; padding: 2px 8px; background: #f3f4f6; border-radius: 4px; }
.b2b-logout-form { margin: 0; }

/* Cart badge */
.b2b-cart-link { position: relative; }
.b2b-cart-badge {
    display: inline-block; min-width: 18px; height: 18px; padding: 0 5px;
    background: #c8102e; color: #fff; border-radius: 9px; font-size: 11px;
    line-height: 18px; text-align: center; vertical-align: middle;
}

/* Main */
.b2b-main { padding: 1.5rem 1rem 3rem; max-width: 1280px; margin: 0 auto; }

/* Messages */
.b2b-messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.b2b-messages__item {
    padding: 0.6rem 0.9rem; border-radius: 4px; margin-bottom: 0.4rem; font-size: 0.92rem;
    background: #f3f4f6; border-left: 3px solid #9ca3af;
}
.b2b-messages__item--success { background: #ecfdf5; border-left-color: #059669; }
.b2b-messages__item--error { background: #fef2f2; border-left-color: #c8102e; }
.b2b-messages__item--warning { background: #fffbeb; border-left-color: #d97706; }
.b2b-messages__item--info { background: #eff6ff; border-left-color: #2563eb; }

/* Generic B2B building blocks */
.b2b-card {
    background: #fff; border-radius: 6px; padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.b2b-grid { display: grid; gap: 1rem; }
.b2b-grid--3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.b2b-grid--product { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.b2b-page-title { margin: 0 0 1rem; font-size: 1.5rem; font-weight: 600; color: #111827; }
.b2b-section-title { margin: 1.5rem 0 0.6rem; font-size: 1.1rem; font-weight: 600; color: #1f2937; }

/* Tables */
.b2b-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.b2b-table th, .b2b-table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid #e5e7eb; }
.b2b-table th { background: #f9fafb; font-weight: 600; color: #374151; }
.b2b-table td.num, .b2b-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.b2b-table tr:hover td { background: #fafafa; }

/* Status pills */
.b2b-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.78rem; font-weight: 500; }
.b2b-status--draft { background: #f3f4f6; color: #4b5563; }
.b2b-status--sent { background: #eff6ff; color: #2563eb; }
.b2b-status--confirmed { background: #ecfdf5; color: #059669; }
.b2b-status--shipped { background: #fffbeb; color: #d97706; }
.b2b-status--done { background: #ecfdf5; color: #047857; }
.b2b-status--canceled { background: #fef2f2; color: #c8102e; }

/* Buttons (reuse .btn but add a B2B accent) */
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.b2b-btn-add { background: #c8102e; color: #fff; border: 0; padding: 0.4rem 0.85rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.b2b-btn-add:hover { background: #a50d25; }
.b2b-btn-ghost { background: transparent; color: #c8102e; border: 1px solid #c8102e; padding: 0.35rem 0.75rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; text-decoration: none; display: inline-block; }
.b2b-btn-ghost:hover { background: #fef2f2; }

/* Product cards */
.b2b-product-card {
    background: #fff; border-radius: 6px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04); display: flex; flex-direction: column;
}
.b2b-product-card__img { aspect-ratio: 1/1; background: #f3f4f6; overflow: hidden; }
.b2b-product-card__img img { width: 100%; height: 100%; object-fit: contain; }
.b2b-product-card__body { padding: 0.7rem 0.85rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.b2b-product-card__title { font-size: 0.9rem; font-weight: 500; color: #1f2937; text-decoration: none; line-height: 1.3; }
.b2b-product-card__title:hover { color: #c8102e; }
.b2b-product-card__sku { font-size: 0.78rem; color: #6b7280; }
.b2b-product-card__price { font-size: 1rem; font-weight: 600; color: #111827; margin-top: auto; }

/* Forms */
.b2b-form { max-width: 460px; }
.b2b-form label { display: block; font-weight: 500; margin-bottom: 0.3rem; color: #374151; }
.b2b-form input[type=text], .b2b-form input[type=password], .b2b-form input[type=email], .b2b-form select, .b2b-form textarea {
    width: 100%; padding: 0.5rem 0.65rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.95rem;
}
.b2b-form input:focus, .b2b-form select:focus, .b2b-form textarea:focus { outline: 2px solid #c8102e; outline-offset: -1px; border-color: #c8102e; }
.b2b-form .form-row { margin-bottom: 0.9rem; }
.b2b-form .errorlist { color: #c8102e; font-size: 0.85rem; margin: 0.3rem 0 0; padding: 0; list-style: none; }

/* Login card */
.b2b-login-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 2rem 1rem; }
.b2b-login-card { width: 100%; max-width: 420px; }
.b2b-login-card__title { margin: 0 0 1rem; font-size: 1.4rem; font-weight: 600; color: #111827; }
.b2b-login-card__hint { color: #6b7280; font-size: 0.88rem; margin-bottom: 1rem; }

/* Footer */
.b2b-footer { background: #1f2937; color: #9ca3af; padding: 1rem; text-align: center; font-size: 0.85rem; }

@media (max-width: 768px) {
    .b2b-header__row { flex-wrap: wrap; gap: 0.75rem; }
    .b2b-nav { order: 3; flex-basis: 100%; }
    .b2b-user { margin-left: auto; }
}
