/* ── Settings → Portal branding (73-UI-SPEC.md §Components 6–7) ───
   Staff grammar: bordered containers, no card shadow, 32px controls, coral
   focus ring (the ring itself comes from shell.css's ".staff-page
   :focus-visible" rule — every element here is a plain HTML element so no
   MudBlazor runtime style ever needs to be fought with !important).
   Written against app.css's token variables. Dark mode is a CSS-variable
   remap in .mud-theme-dark only (CLAUDE.md). */

.branding-layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
}

.branding-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 0 0 560px;
    min-width: 320px;
    max-width: 560px;
}

/* ── PortalPreview ─────────────────────────────────────────────── */
.portal-preview {
    flex: 1 1 auto;
    min-width: 420px;
    position: sticky;
    top: 88px;
}

@media (max-width: 1199px) {
    .branding-layout {
        flex-direction: column;
    }

    .branding-form {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
    }

    .portal-preview {
        position: static;
        width: 100%;
    }
}

/* UAT: a11y fix — --text-tertiary (#8B919E) measured ~3.05-3.16:1 on white via axe
   (serious color-contrast); --text-secondary clears 4.5:1+. Same root-cause bump
   71/72 already applied to their analogous small-text selectors (see shell.css). */
.portal-preview-label {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.portal-preview-frame {
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    min-width: 420px;
    background: #FFFFFF;
}

.portal-preview-chrome {
    height: 28px;
    background: #F4F5F7;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
}

.portal-preview-chrome-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C9CDD4;
    flex: 0 0 auto;
}

/* UAT: a11y fix — --text-tertiary (#8B919E) measured ~3.05-3.16:1 on white via axe
   (serious color-contrast); --text-secondary clears 4.5:1+. Same root-cause bump
   71/72 already applied to their analogous small-text selectors (see shell.css). */
.portal-preview-chrome-url {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.portal-preview-bar {
    height: 56px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
}

.portal-preview-bar-lockup {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    margin-right: 16px;
    overflow: hidden;
}

.portal-preview-bar-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-preview-bar-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.portal-preview-nav {
    display: flex;
    gap: 16px;
    flex: 1 1 auto;
}

.portal-preview-nav-item {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.portal-preview-nav-active {
    color: var(--text-primary);
    position: relative;
}

.portal-preview-nav-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -19px;
    height: 2px;
    background: var(--portal-accent);
}

.portal-preview-cta {
    height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--portal-accent);
    color: var(--portal-accent-text);
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    flex: 0 0 auto;
}

.portal-preview-body {
    background: #FFFFFF;
    padding: 16px;
}

.portal-preview-card {
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.portal-preview-card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.portal-preview-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.portal-preview-item-kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.portal-preview-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--portal-accent);
    flex: 0 0 auto;
}

.portal-preview-item-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
}

/* UAT: a11y fix — --text-tertiary (#8B919E) measured ~3.05-3.16:1 on white via axe
   (serious color-contrast); --text-secondary clears 4.5:1+. Same root-cause bump
   71/72 already applied to their analogous small-text selectors (see shell.css). */
.portal-preview-item-meta {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.portal-preview-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.portal-preview-btn-primary,
.portal-preview-btn-outline {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
}

.portal-preview-btn-primary {
    background: var(--portal-accent);
    color: var(--portal-accent-text);
}

.portal-preview-btn-outline {
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.portal-preview-caption {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: #BF423A;
    margin: 8px 0 0;
}

/* TenantMark's own styling (portal.css) is scoped to .portal-shell/
   .portal-prelogin ancestors only — this preview lives outside both, so its
   Sm-size rules are replicated here rather than widening portal.css's
   selectors (T2's <files> scope is this file only). */
.portal-preview .tenant-mark {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--portal-accent);
}

.portal-preview .tenant-mark-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.portal-preview .tenant-mark-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #FFFFFF;
    border: 1px solid #E6E8EC;
    box-sizing: border-box;
    padding: 2px;
}

.portal-preview .tenant-mark-initials {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--portal-accent-text);
}

.portal-preview .tenant-mark-loading {
    width: 100%;
    height: 100%;
    background: #F4F5F7;
    border-radius: inherit;
}

.branding-field {
    width: 100%;
}

.branding-field-group-label {
    display: block;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* ── Logo upload well ──────────────────────────────────────────── */
.logo-upload-well-group {
    display: flex;
    flex-direction: column;
}

.logo-upload-well {
    width: 120px;
    height: 120px;
    border: 2px dashed #C9CDD4;
    border-radius: 10px;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.logo-upload-well:disabled {
    cursor: default;
    opacity: 0.8;
}

.logo-upload-well-dragover {
    /* AV1-03 row 29 (M1 + brand-row-selected): border/bg re-pointed, fallbacks
       preserve today's literal (260827-pal: palette B's product defaults). */
    border-color: var(--brand-on-surface, #236FA8);
    background: var(--brand-row-selected, #E9F1F8);
}

.logo-upload-well-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.logo-upload-well-hint {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 8px;
}

.logo-upload-well-image {
    max-width: 100%;
    max-height: 100%;
    padding: 8px;
    object-fit: contain;
}

.logo-upload-well-spinner {
    color: var(--text-tertiary);
}

/* UAT: a11y fix — --text-tertiary (#8B919E) measured ~3.05-3.16:1 on white via axe
   (serious color-contrast); --text-secondary clears 4.5:1+. Same root-cause bump
   71/72 already applied to their analogous small-text selectors (see shell.css). */
.logo-upload-well-caption {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 8px 0 0;
}

.logo-upload-well-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.logo-upload-well-replace,
.logo-upload-well-remove {
    background: none;
    border: none;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    cursor: pointer;
}

.logo-upload-well-replace {
    color: var(--text-primary);
}

.logo-upload-well-remove {
    color: #BF423A;
}

.logo-upload-well-error {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: #BF423A;
    margin: 8px 0 0;
}

/* ── Accent colour ─────────────────────────────────────────────── */
.branding-accent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.branding-swatch {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.branding-hex-input {
    width: 130px;
    flex: 0 0 auto;
}

.branding-hex-input input {
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.branding-preset {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.branding-preset-selected {
    box-shadow: 0 0 0 2px #1A1D23;
}

.branding-color-picker-popover {
    margin-top: 8px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    background: var(--bg-secondary);
    padding: 8px;
    max-width: 300px;
}

.branding-contrast-line {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    margin: 12px 0 0;
}

.branding-server-error {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: #BF423A;
    margin: 4px 0 0;
}

/* ── Portal address ────────────────────────────────────────────── */
.branding-address-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.branding-address-input {
    flex: 1 1 auto;
}

.branding-address-input input {
    background: #F4F5F7;
    color: var(--text-secondary);
    cursor: default;
}

.branding-copy-button {
    background: none;
    border: none;
    padding: 4px 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* UAT: a11y fix — --text-tertiary (#8B919E) measured ~3.05-3.16:1 on white via axe
   (serious color-contrast); --text-secondary clears 4.5:1+. Same root-cause bump
   71/72 already applied to their analogous small-text selectors (see shell.css). */
.branding-address-note {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 8px 0 0;
}

/* ── Actions row ───────────────────────────────────────────────── */
.branding-actions-row {
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border-light);
    padding-top: 24px;
    margin-top: 8px;
}

.branding-save-button {
    height: 32px;
    padding: 0 16px;
    border-radius: 8px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    background: var(--accent-primary);
    color: #FFFFFF;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.branding-save-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.branding-save-spinner {
    color: #FFFFFF;
}

.mud-theme-dark .branding-save-button {
    background: var(--brand-on-surface, #5BB8E8);
    color: var(--brand-on-surface-text, #1A1D23);
}

.mud-theme-dark .branding-save-spinner {
    color: #1A1D23;
}

.branding-preview-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.branding-preview-link:hover {
    text-decoration: underline;
}
