/* Customer Panel – area styles (branding), 2026-10-12 redesign. Shared tokens and components live in app.css.
   Covers: the shared form pieces this area owns (NxField counter, colour field, logo field, preview, section card, back link),
   the Branding page (br-*) and the Team page (mb-*). Mobile-first, no fixed widths; touch targets ≥ 40 px on touch screens. */

/* ================================================================= shared form pieces */

.nx-field-count { color: var(--nx-text-faint); font-size: 0.75rem; align-self: flex-end; font-variant-numeric: tabular-nums; }
.nx-field-count.is-full { color: var(--nx-warning); }
.nx-field-hint-wrap .nx-spinner { width: 12px; height: 12px; vertical-align: -2px; }

.nx-section-card-heading { min-width: 0; }
.nx-section-card-desc { margin: 4px 0 0; color: var(--nx-text-faint); font-size: 0.84rem; }

.nx-back-link-arrow { font-size: 1rem; line-height: 1; }

/* colour field: swatch + hex + optional clear, wraps on narrow screens */
.nx-color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nx-color-row .nx-color-hex { flex: 1 1 120px; min-width: 0; max-width: 160px !important; }
.nx-color-field.is-disabled .nx-color-swatch { cursor: not-allowed; opacity: 0.6; }

/* logo field */
.nx-logo-mode { margin: 0 0 8px; font-size: 0.84rem; color: var(--nx-text-dim); }
.nx-logo-row { display: flex; align-items: flex-start; gap: 14px; }
.nx-logo-preview {
    width: 72px; height: 72px; flex: 0 0 72px; border-radius: 14px; overflow: hidden;
    background: var(--nx-bg-hover); border: 1px solid var(--nx-border-soft);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.5rem; color: var(--nx-text-dim);
}
.nx-logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.nx-logo-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.nx-logo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nx-logo-upload { position: relative; cursor: pointer; }
.nx-logo-upload:focus-within { box-shadow: var(--nx-focus); }
.nx-logo-upload.is-busy { opacity: 0.6; pointer-events: none; }
.nx-logo-locked { margin: 0; color: var(--nx-text-faint); font-size: 0.86rem; }
.nx-logo-notice { color: var(--nx-text-dim); }
.nx-logo-url { margin-top: 12px; padding: 12px; border: 1px dashed var(--nx-border); border-radius: var(--nx-radius-sm); }
.nx-logo-url-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nx-logo-url-row .nx-input { flex: 1 1 220px; min-width: 0; }

/* preview (fluid; app.css caps it at 440 px) */
.nx-branding-figure { margin: 0; min-width: 0; }
.nx-branding-figure .nx-stat-label { margin-bottom: 8px; }
.nx-branding-preview-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.nx-branding-preview-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nx-branding-preview-title { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.nx-branding-preview-discord {
    align-self: flex-start; margin-top: 6px; padding: 3px 10px; border: 1px solid var(--nx-border); border-radius: var(--nx-radius-pill);
    font-size: 0.74rem; font-weight: 600; color: var(--nx-text-dim);
}
.nx-branding-preview-powered { margin-top: 8px; font-size: 0.72rem; color: var(--nx-text-faint); }

/* ================================================================= branding page */

.br-lock, .mb-readonly { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 16px; }
.br-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.br-form { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.br-section { padding: 4px 0 12px; border-bottom: 1px solid var(--nx-border-soft); }
.br-section:last-of-type { border-bottom: 0; }
.br-section + .br-section { padding-top: 16px; }
.br-section-title { font-size: 0.8rem; color: var(--nx-text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 12px; }
.br-color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0 18px; }
.br-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; margin-top: 4px;
    border-top: 1px solid var(--nx-border-soft);
}
.br-save-state { font-size: 0.84rem; color: var(--nx-text-faint); }
.br-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.br-preview-card .nx-branding-preview { max-width: none; }
.br-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--nx-text-faint); }
.br-tiers-card { margin-bottom: 0; }
.br-tiers { list-style: none; margin: 0 0 12px; padding: 0; }
.br-tier { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--nx-border-soft); }
.br-tier:last-child { border-bottom: 0; }
.br-tier-text { min-width: 0; }
.br-tier-name { font-weight: 600; font-size: 0.92rem; }
.br-tier-desc { font-size: 0.8rem; color: var(--nx-text-faint); margin-top: 2px; }

@media (min-width: 1100px) {
    .br-layout { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
    .br-side { position: sticky; top: calc(var(--nx-topbar-h) + 16px); }
}

/* ================================================================= team page */

.mb-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.mb-main, .mb-side { min-width: 0; }
.mb-side .nx-section-card { margin-bottom: 0; }
@media (min-width: 1200px) {
    .mb-layout { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}

.mb-gate-title { font-size: 1.05rem; margin: 0 0 8px; }
.mb-gate-text { margin: 0; color: var(--nx-text-dim); }
.mb-muted { color: var(--nx-text-faint); font-size: 0.88rem; margin: 0; }
.mb-muted .nx-spinner { width: 14px; height: 14px; vertical-align: -2px; }

.mb-table-wrap { border: 0; background: transparent; }
.mb-table tr.is-inactive .mb-name { color: var(--nx-text-dim); }

.mb-identity { display: flex; align-items: flex-start; gap: 12px; min-width: 0; text-align: left; }
.mb-avatar { font-size: 0.82rem; }
.mb-avatar.is-anon { background: var(--nx-bg-inset); border: 1px dashed var(--nx-border); }
.mb-identity-text { min-width: 0; }
.mb-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.mb-sub { font-size: 0.8rem; color: var(--nx-text-faint); font-weight: 400; overflow-wrap: anywhere; }
.mb-steam { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; }
.mb-steam code { font-size: 0.78rem; color: var(--nx-text-dim); }
.mb-copy { width: 32px; height: 32px; }
.mb-steam-link { font-size: 0.78rem; }

.mb-role-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.mb-role-select { width: auto; min-width: 150px; max-width: 100%; }
.mb-role-apply { display: flex; flex-wrap: wrap; gap: 6px; }
.mb-role-text { font-weight: 600; }
.mb-lock-hint { color: var(--nx-text-faint); font-size: 0.78rem; max-width: 260px; }

.mb-add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 0 18px; }

.mb-suggestions .cp-row { align-items: flex-start; }
.mb-servers { margin-top: 4px; padding-left: 48px; }
.mb-suggestion-actions { align-items: center; }
.mb-suggest-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

.mb-roles { margin: 0 0 12px; }
.mb-role-item { padding: 10px 0; border-bottom: 1px solid var(--nx-border-soft); }
.mb-role-item:last-child { border-bottom: 0; }
.mb-role-item dt { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mb-role-item dd { margin: 2px 0 0; font-size: 0.84rem; color: var(--nx-text-dim); }
.mb-role-item.is-mine dt { color: var(--nx-accent-strong); }
.mb-note { margin: 0; font-size: 0.8rem; color: var(--nx-text-faint); }

/* stacked rows (< 760 px): the identity cell keeps its left alignment, the role cell sits under its label */
@media (max-width: 759px) {
    table.mb-table td { flex-wrap: wrap; }
    table.mb-table td[data-label] > .mb-role-cell { align-items: flex-end; }
    .mb-lock-hint { text-align: right; }
    .mb-servers { padding-left: 0; }
    .mb-suggestion-actions { margin-left: 0; width: 100%; }
}

/* ================================================================= touch targets */

@media (pointer: coarse) {
    .br-page .nx-btn-sm, .mb-layout .nx-btn-sm, .nx-logo-field .nx-btn-sm, .nx-color-field .nx-btn-sm { min-height: 40px; }
    .mb-copy { width: 40px; height: 40px; }
}
