/* DTA Client Portal — full UX-1/UX-2 styling (Section 8 of SPEC.md).
   Hand-rolled CSS, no framework payload (UX-6.3) — mobile-first, WCAG-2.2-AA-conscious (UX-6.1).

   DESIGN TOKENS (UX-1.1): sampled from the live DTA marketing site build source —
   DTA-AerialDroneSurvey\src\AerialDroneSurvey.Web\Styles\tailwind.css (@theme block). That
   stylesheet documents the DTA identity as "engineering-drawing / map-sheet aesthetic built
   around the OFFICIAL brand green (#5CA745, sampled from the logo) and its black", with a
   hi-vis orange reserved for measurement callouts / alerts / focus. This file ports those exact
   hex values into portal-scoped custom properties (contour-600 #47842F is used as the DTA
   button/link primary — a shade darker than the raw logo green for AA contrast on white; the
   raw logo green #5CA745 is kept as --dta-contour-500 for accents/underlines/tints).

   Customer-layer tokens (UX-4.1) are emitted inline per request by MainLayout.razor/
   BareLayout.razor as CSS custom properties on `.portal-page`; the selectors below reference
   only the custom-property names, so this remains a single stylesheet for every page (admin,
   generic and customer-branded alike). admin.css (Area ADMIN only) imports/duplicates the same
   token block since there is no CSS build pipeline in this repo. */

@font-face {
    font-family: "Archivo Variable";
    font-style: normal;
    font-weight: 100 900;
    font-stretch: 62.5% 125%;
    font-display: swap;
    src: url("/fonts/archivo-var.woff2") format("woff2-variations");
}
@font-face {
    font-family: "IBM Plex Sans Variable";
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url("/fonts/plex-sans-var.woff2") format("woff2-variations");
}

:root {
    /* V0.0.029 — force light rendering; stops Android/Chrome auto-dark inverting hand-rolled colours. */
    color-scheme: only light;

    /* ── Type (sampled from the marketing-site @theme block) ───────────────────────────────── */
    --dta-font-display: "Archivo Variable", "Archivo", ui-sans-serif, system-ui, sans-serif;
    --dta-font-sans: "IBM Plex Sans Variable", "IBM Plex Sans", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
    --dta-font-mono: 'Consolas', 'SFMono-Regular', ui-monospace, monospace;

    /* ── DTA brand tokens (UX-1.1) ───────────────────────────────────────────────────────────
       --dta-brand-primary / -dark / -light are the three names required by SPEC.md UX-1.1;
       the rest of the ramp below is additional tokens sampled from the same source. */
    --dta-brand-primary: #47842F;      /* contour-600 — AA-safe on white; buttons/links */
    --dta-brand-primary-dark: #3A6E25; /* contour-700 — hover/active state */
    --dta-brand-dark: #171D18;         /* ink-900 — DTA bar/footer/admin header */
    --dta-brand-darker: #101410;       /* ink-950 */
    --dta-brand-light: #F5F7F2;        /* paper — page background */

    --dta-contour-500: #5CA745;  /* exact logo green — accents, underlines, tints */
    --dta-contour-100: #E4F1DC;  /* pale green tint */
    --dta-paper-deep: #EBEFE6;
    --dta-gridline: #D8DFD3;
    --dta-ink-800: #232B24;      /* body text */
    --dta-ink-700: #303C32;
    --dta-ink-600: #414F43;      /* muted text (AA on white/paper) */
    --dta-ink-500: #57685A;

    /* Hi-vis orange ramp — reserved for alerts/errors/callouts/focus, per brand rationale. */
    --dta-accent-800: #93390A;
    --dta-accent-700: #B04407;
    --dta-accent-600: #D15408;
    --dta-accent-500: #F2620F;
    --dta-accent-100: #FDE7D8;

    /* ── Spacing / radius / shadow scale ─────────────────────────────────────────────────────
       Matches the numeric spacing scale already implied by the mb-*/mt-*/gap-* utility classes
       used throughout the Razor markup (Bootstrap-shaped scale: 0/.25/.5/1/1.5/3rem). */
    --sp-0: 0;
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 1rem;
    --sp-4: 1.5rem;
    --sp-5: 3rem;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 2px 10px rgba(16, 20, 16, .08);
    --shadow-md: 0 10px 24px rgba(16, 20, 16, .14);
    --shadow-lg: 0 18px 50px rgba(16, 20, 16, .30);

    /* Fallback customer tokens (UX-4.5) — used whenever a page sets none of its own. */
    --cust-accent: var(--dta-brand-primary);
    --cust-accent-contrast: #FFFFFF;
    --cust-accent-tint: color-mix(in srgb, var(--cust-accent) 8%, transparent);
    --cust-bg-image: none;

    /* ── Slice 1 landing redesign tokens (docs/design/2026-09-15-portal-design-direction.md) ──── */
    --sheet-hero-min: 20rem;            /* 320px */
    --sheet-hero-max: 27.5rem;          /* 440px */
    --sheet-plate-size: 7.5rem;         /* 120px logo plate on desktop */
    --sheet-plate-size-sm: 5rem;        /* 80px on mobile */
    --sheet-measure: 60ch;              /* hero copy measure */
    --sheet-measure-body: 70ch;
    --type-display-wide: 112%;          /* Archivo width axis for customer name / project titles */
    --sheet-line-tint: color-mix(in srgb, var(--cust-accent) 55%, white);
}

* { box-sizing: border-box; }

html, body {
    font-family: var(--dta-font-sans);
    background: var(--dta-brand-light);
    color: var(--dta-ink-800);
    margin: 0;
    font-size: 16px;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--dta-font-display);
    font-weight: 700;
    color: var(--dta-brand-darker);
    line-height: 1.2;
    margin: 0 0 0.5rem;
}
h1, .h1 { font-size: 1.9rem; }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.25rem; }
h4, .h4 { font-size: 1.15rem; }
h5, .h5 { font-size: 1.02rem; }
h6, .h6 { font-size: 0.92rem; text-transform: uppercase; letter-spacing: .04em; color: var(--dta-ink-600); }

p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--cust-accent); text-decoration-thickness: 1px; }
/* V0.0.029 — only darken on hover-capable pointers; a tap on touch devices must not stick. */
@media (hover: hover) {
    a:hover { filter: brightness(0.85); }
}

/* UX-6.1 — visible focus outlines, never removed. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--cust-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ── Skip link (UX-6.1) ─────────────────────────────────────────────────────────────────────── */
.portal-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    background: #fff;
    color: #000;
    padding: 0.6rem 1rem;
    border-radius: 0 0 6px 0;
}
.portal-skip-link:focus { left: 0; }

/* Screen-reader-only content (aria-live regions etc.) — UX-6.1. */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Page shell (sticky footer flex pattern, UX-1.3) ───────────────────────────────────────── */
.portal-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* V0.0.029 — accounts for mobile browser chrome collapsing on scroll. */
}

/* Client-branded pages only (design doc "Type") — larger body copy/line-height for the
   customer-facing landing/project pages; admin, auth and generic pages keep the 16px base. */
.portal-page.is-client {
    font-size: 17px;
    line-height: 1.55;
}

/* .portal-bare — modifier on .portal-page for the static-SSR auth shell (BareLayout.razor).
   Structural layout is already handled by .portal-page + .portal-bare-main/.portal-auth; this
   sets a dark fallback background so there is no white flash below the fold on very short
   viewports before the auth card's own gradient background paints. */
.portal-bare {
    background: var(--dta-brand-darker);
}

/* ── UX-1.2 persistent DTA bar ──────────────────────────────────────────────────────────────── */
.portal-dta-bar {
    background: var(--dta-brand-dark);
    height: 44px;
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
@media (min-width: 576px) {
    .portal-dta-bar { height: 48px; }
}

.portal-dta-bar-inner {
    max-width: 1140px;
    height: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.portal-dta-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    text-decoration: none;
    min-height: 44px;
}

.portal-dta-logo { max-height: 28px; height: 100%; width: auto; display: block; }

.portal-dta-wordmark {
    font-family: var(--dta-font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: #d7e6cd;
}
@media (max-width: 359px) {
    .portal-dta-wordmark { display: none; }
}

.portal-dta-nav { display: flex; align-items: center; min-height: 44px; }

.portal-dta-link-text { color: #d7e6cd; text-decoration: none; font-size: 0.85rem; }
.portal-dta-link-text:hover { color: #fff; filter: none; }

.portal-user-menu { position: relative; }
.portal-user-menu summary { list-style: none; cursor: pointer; }
.portal-user-menu summary::-webkit-details-marker { display: none; }

.portal-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    min-width: 44px;
    padding: 0 0.4rem;
    color: #fff;
    background: transparent;
    border: none;
    border-radius: 8px;
}
.portal-user-btn:hover { background: rgba(255, 255, 255, .08); }

.portal-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cust-accent);
    color: var(--cust-accent-contrast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.portal-user-name { color: #fff; font-size: 0.85rem; }

.portal-user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    color: var(--dta-ink-800);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
}

.portal-user-menu-panel a,
.portal-user-menu-panel button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--dta-ink-800);
    text-decoration: none;
    font-size: 0.9rem;
    min-height: 44px;
}
.portal-user-menu-panel a:hover,
.portal-user-menu-panel button:hover { background: var(--cust-accent-tint); }
.portal-user-menu-panel form { margin: 0; }

/* ── UX-1.4 customer co-branding band ───────────────────────────────────────────────────────── */
.portal-customer-band {
    background: #fff;
    border-bottom: 3px solid var(--cust-accent);
    min-height: 56px;
}
@media (min-width: 576px) {
    .portal-customer-band { min-height: 64px; }
}

.portal-customer-band-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.portal-customer-logo { max-height: 32px; object-fit: contain; }
@media (min-width: 576px) {
    .portal-customer-logo { max-height: 40px; }
}

.portal-customer-name-text { font-family: var(--dta-font-display); font-size: 1.15rem; font-weight: 600; color: var(--dta-brand-darker); }
.portal-customer-name-muted { color: var(--dta-ink-600); font-size: 0.9rem; }

/* ── Slice 1 — customer header "sheet" (design doc "the map sheet"), MainLayout.razor only.
   BareLayout.razor (auth pages) keeps .portal-customer-band above — it is not one of this
   slice's owned files. ─────────────────────────────────────────────────────────────────────── */
.portal-sheet-header {
    background: #fff;
    border-bottom: 1px solid var(--dta-gridline);
}
.portal-sheet-header-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    min-height: 64px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.portal-plate {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}
.portal-plate-logo {
    display: block;
    max-height: var(--sheet-plate-size-sm);
    max-width: 10rem;
    object-fit: contain;
}
@media (min-width: 768px) {
    .portal-plate-logo { max-height: var(--sheet-plate-size); max-width: 14rem; }
}
/* No-logo fallback (UX-4.5) — the plate itself becomes the customer name, styled as a
   finished plate rather than a missing-asset placeholder. */
.portal-plate-name {
    font-family: var(--dta-font-display);
    font-weight: 700;
    font-stretch: var(--type-display-wide);
    font-size: 1.1rem;
    color: var(--dta-brand-darker);
    background: var(--dta-paper-deep);
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.portal-sheet-header-name {
    font-family: var(--dta-font-display);
    font-weight: 600;
    font-stretch: var(--type-display-wide);
    font-size: 1.15rem;
    color: var(--dta-brand-darker);
    overflow-wrap: anywhere;
    min-width: 0;
}

.portal-sheet-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.25rem;
}
.portal-sheet-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--dta-ink-700);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}
.portal-sheet-nav a:hover { color: var(--cust-accent); filter: none; }
/* V0.0.029 — fit four nav links on a 390px-wide phone row more often. */
@media (max-width: 575.98px) {
    .portal-sheet-nav { gap: 0.25rem 0.9rem; }
    .portal-sheet-nav a { font-size: 0.88rem; }
}

/* ── Slice 1 — landing hero (design doc "Landing page structure") ──────────────────────────────
   Background: customer cover image with scrim (has-bg) OR the ContourField Hero art on the DTA
   dark ink (no cover) — both must look finished, never like a missing asset (UX-4.5). */
.portal-sheet-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    min-height: var(--sheet-hero-min);
    max-height: var(--sheet-hero-max);
    margin-bottom: 2rem;
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius-md);
    background-color: var(--dta-brand-dark);
    color: #fff;
}
.portal-sheet-hero.has-bg {
    background-image: linear-gradient(rgba(10, 12, 16, 0.55), rgba(10, 12, 16, 0.70)), var(--cust-bg-image);
    background-size: cover;
    background-position: center;
}
.portal-contour-hero {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--cust-accent);
}
.portal-sheet-hero-content {
    position: relative;
    z-index: 1;
}
.portal-sheet-hero h1 {
    margin: 0 0 0.4rem;
    max-width: var(--sheet-measure);
    color: #fff;
    font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
}
.portal-sheet-hero p {
    margin: 0;
    max-width: var(--sheet-measure);
    color: rgba(255, 255, 255, .88);
}
.portal-sheet-hero p + p {
    margin-top: 0.35rem;
}
.portal-sheet-hero p a { color: #fff; }

/* ── Slice 1 — project register (design doc "Register") ────────────────────────────────────── */
.portal-register { margin-top: 0.5rem; max-width: var(--sheet-measure-body); }
.portal-register-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}
.portal-register-header h2 { margin: 0; }
.portal-register-count { color: var(--dta-ink-600); font-weight: 400; font-size: 1rem; }

.portal-register-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.portal-register-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 44px;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
}
@media (hover: hover) {
    .portal-register-row:hover { box-shadow: var(--shadow-sm); border-color: var(--sheet-line-tint); }
}

.portal-register-plate {
    flex-shrink: 0;
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--cust-accent-tint);
    color: var(--dta-ink-500);
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-register-plate img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portal-contour-mark { width: 100%; height: 100%; color: color-mix(in srgb, var(--cust-accent) 45%, var(--dta-ink-600)); }

/* V0.0.029 — color-mix() fallback for pre-16.2 iOS/Safari (no color-mix support). */
@supports not (color: color-mix(in srgb, red, blue)) {
    :root {
        --cust-accent-tint: rgba(71, 132, 47, 0.08);
        --sheet-line-tint: #A8CF97;
    }
    .portal-contour-mark { color: var(--dta-ink-600); }
    /* V0.0.029 — .portal-auth's gradient ends in a literal color-mix() stop (not just a
       custom-property reference), so it needs its own plain fallback here too. */
    .portal-auth { background: var(--dta-brand-dark); }
}

.portal-register-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.portal-register-title {
    font-family: var(--dta-font-display);
    font-weight: 600;
    font-stretch: var(--type-display-wide);
    font-size: 1.25rem;
    color: var(--dta-brand-darker);
    overflow-wrap: anywhere;
}
.portal-register-summary {
    font-size: 0.95rem;
    color: var(--dta-ink-700);
    overflow-wrap: anywhere;
}
.portal-register-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.75rem;
    font-size: 0.95rem;
    color: var(--dta-ink-600);
}

.portal-register-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--cust-accent-contrast);
    background: var(--cust-accent);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.portal-register-archived summary {
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--dta-ink-700);
    padding: 0.4rem 0;
}
.portal-register-archived .portal-register-list { margin-top: 0.75rem; }

/* Empty state (no projects) plate — reuses .portal-empty (existing) with the contour Mark art
   instead of an emoji icon. */
.portal-plate-empty {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 0.75rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--cust-accent-tint);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Slice 2 — project sheet (design doc "Project page") ───────────────────────────────────────
   ClientProject.razor only. AdminPreviewProject.razor (Area ADMIN, not owned by this slice) keeps
   rendering the pre-existing .portal-hero/.portal-breadcrumb/.portal-deliverable* rules above
   unchanged — none of those are touched here, only new classes are added. ─────────────────────── */
.portal-project-head { margin-bottom: 1.75rem; max-width: var(--sheet-measure-body); }
.portal-project-back { margin: 0 0 0.75rem; font-size: 0.9rem; }
.portal-project-back a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--dta-ink-700);
    text-decoration: none;
    font-weight: 600;
}
.portal-project-back a:hover { color: var(--cust-accent); filter: none; }

.portal-project-title {
    font-stretch: var(--type-display-wide);
    font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem);
    margin: 0 0 0.35rem;
    overflow-wrap: anywhere;
}
.portal-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 1rem;
    font-size: 0.95rem;
    color: var(--dta-ink-600);
    margin: 0 0 0.75rem;
}
.portal-project-description {
    max-width: var(--sheet-measure-body);
    color: var(--dta-ink-700);
    margin: 0;
}

.portal-project-group-heading {
    font-family: var(--dta-font-display);
    font-weight: 600;
    font-stretch: var(--type-display-wide);
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--sheet-line-tint);
    color: var(--dta-brand-darker);
}
.portal-project-group-heading:first-child { margin-top: 0; }

.portal-deliverable-row {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--dta-gridline);
}
.portal-deliverable-row:last-child { border-bottom: none; }
@media (min-width: 576px) {
    .portal-deliverable-row { flex-direction: row; align-items: center; }
}

.portal-deliverable-plate {
    flex-shrink: 0;
    width: var(--sheet-plate-size-sm);
    height: var(--sheet-plate-size-sm);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--cust-accent-tint);
    color: var(--dta-ink-500);
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-deliverable-plate img { width: 100%; height: 100%; object-fit: cover; display: block; }

.portal-deliverable-row-body { flex: 1 1 auto; min-width: 0; }
.portal-deliverable-row-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin: 0 0 0.2rem;
    color: var(--dta-brand-darker);
    overflow-wrap: anywhere;
}
.portal-deliverable-row-description {
    font-size: 0.92rem;
    color: var(--dta-ink-700);
    margin: 0 0 0.2rem;
    overflow-wrap: anywhere;
}
.portal-deliverable-row-date { font-size: 0.82rem; color: var(--dta-ink-600); margin: 0; }

.portal-deliverable-row-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    flex: 0 0 auto;
}
.portal-deliverable-row-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
@media (max-width: 639.98px) {
    .portal-deliverable-row { flex-direction: column; align-items: stretch; }
    .portal-deliverable-row-action { align-items: stretch; }
    .portal-deliverable-row-cta { justify-content: flex-start; }
    .portal-deliverable-row-action .portal-btn { width: 100%; }
}

.portal-password-helper {
    text-align: right;
    margin: 0;
    font-size: 0.8rem;
    color: var(--dta-ink-600);
}

/* .portal-dl — Help.razor's plain <dl> (Slice 3, not an owned file) styled via a descendant
   selector on the client page shell so no markup change is required there. */
.portal-page.is-client dl { margin: 0 0 1rem; }
.portal-page.is-client dl dt { font-weight: 600; color: var(--dta-brand-darker); margin-top: 0.75rem; }
.portal-page.is-client dl dt:first-child { margin-top: 0; }
.portal-page.is-client dl dd { margin: 0.15rem 0 0 0; color: var(--dta-ink-700); }

/* ── Main content ───────────────────────────────────────────────────────────────────────────── */
.portal-main { flex: 1; }
.portal-bare-main { flex: 1; display: flex; }

.portal-content {
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem 1rem 3rem;
}

/* Narrower long-form text block (privacy notice, legal copy) — replaces a one-off inline style. */
.portal-prose { max-width: 760px; }

/* ── UX-1.3 persistent DTA footer ───────────────────────────────────────────────────────────── */
.portal-dta-footer {
    background: var(--dta-brand-dark);
    color: rgba(255, 255, 255, .72);
    padding: 1.5rem 1rem;
}

.portal-dta-footer-inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
    text-align: center;
}
@media (min-width: 768px) {
    .portal-dta-footer-inner { align-items: flex-start; text-align: left; }
}

.portal-dta-footer-line1 { display: flex; align-items: center; gap: 0.6rem; }
.portal-dta-footer-logo { max-height: 22px; }
.portal-dta-footer-line1 a,
.portal-dta-footer-line2 a { color: rgba(255, 255, 255, .88); }
.portal-dta-footer-line1 a:hover,
.portal-dta-footer-line2 a:hover { color: #fff; filter: none; }
.portal-dta-footer-line2 { font-size: 0.8rem; display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
@media (min-width: 768px) {
    .portal-dta-footer-line2 { justify-content: flex-start; }
}

/* ── Static SSR auth card (login / invite / reset-password / denied — BareLayout) ─────────────── */
.portal-auth {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(16, 20, 16, .88) 0%, rgba(23, 29, 24, .78) 55%, color-mix(in srgb, var(--cust-accent) 55%, var(--dta-brand-darker)) 100%);
    padding: 20px;
    width: 100%;
}

.portal-auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 30px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
@media (max-width: 575.98px) {
    .portal-auth-card { border-radius: 0; box-shadow: none; padding: 24px 16px; }
    .portal-auth { padding: 0; align-items: flex-start; }
}

.portal-auth-card input[type="text"],
.portal-auth-card input[type="email"],
.portal-auth-card input[type="password"] {
    min-height: 48px;
}

.portal-brand-mark { font-family: var(--dta-font-display); font-size: 1.7rem; font-weight: 800; color: var(--cust-accent); }
.portal-brand-mark span { color: var(--dta-ink-500); font-weight: 400; margin-left: 0.35rem; font-size: 1rem; }

/* ── UX-3.3 welcome strip ───────────────────────────────────────────────────────────────────── */
.portal-welcome-strip {
    border-radius: var(--radius-md);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--cust-accent-tint);
    color: var(--dta-brand-darker);
}
.portal-welcome-strip.has-bg {
    background-image: linear-gradient(rgba(10, 12, 16, 0.55), rgba(10, 12, 16, 0.70)), var(--cust-bg-image);
    background-size: cover;
    background-position: center;
    color: #fff;
}
.portal-welcome-strip h1 { font-size: 1.5rem; margin: 0 0 0.25rem; color: inherit; }
.portal-welcome-strip p { margin: 0; }

/* ── UX-2.1/UX-3.3 project card grid ────────────────────────────────────────────────────────── */
.portal-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 576px) {
    .portal-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
    .portal-card-grid { grid-template-columns: repeat(3, 1fr); }
}

.portal-card {
    position: relative;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--dta-gridline);
}
@media (hover: hover) {
    .portal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
}
.portal-card { transition: box-shadow .15s ease, transform .15s ease; }

.portal-card-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--cust-accent-tint), var(--dta-paper-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cust-accent);
    font-size: 0.85rem;
    font-weight: 600;
}
.portal-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.portal-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.portal-card-title { font-weight: 600; font-size: 1.05rem; margin: 0; color: var(--dta-brand-darker); }
.portal-card-meta { font-size: 0.8rem; color: var(--dta-ink-600); }
.portal-card-summary { font-size: 0.85rem; color: var(--dta-ink-700); }

.portal-card-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: var(--cust-accent);
    color: var(--cust-accent-contrast);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    letter-spacing: .02em;
}

/* Whole-card stretched-link (UX-3.3). */
.portal-card-stretched::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* ── FR-6.3/UX-3.3 index search/sort/archived controls [Tier 2] ────────────────────────────────
   Progressive enhancement (T3): a plain GET form, works fully without JS. WCAG-2.2-AA contrast
   (UX-6.1) — text/borders use the same ink/muted tones proven elsewhere against a white card. */
.portal-index-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.portal-index-search,
.portal-index-sort {
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--dta-ink-800);
    background: #fff;
}
.portal-index-search { flex: 1 1 220px; min-width: 160px; }
.portal-index-sort { flex: 0 0 auto; }

.portal-index-archived-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--dta-ink-700);
    min-height: 44px;
}
.portal-index-archived-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* ── UX-3.4 project hero ────────────────────────────────────────────────────────────────────── */
.portal-hero {
    border-radius: var(--radius-md);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.5rem;
    background-image: linear-gradient(rgba(10, 12, 16, 0.55), rgba(10, 12, 16, 0.70)), var(--cust-bg-image);
    background-color: var(--dta-brand-dark);
    background-size: cover;
    background-position: center;
    color: #fff;
}
.portal-hero h1 { margin: 0 0 0.35rem; font-size: 1.7rem; color: #fff; }
.portal-hero-meta { font-size: 0.85rem; color: rgba(255, 255, 255, .82); }
.portal-breadcrumb { display: inline-block; margin-bottom: 0.75rem; font-size: 0.85rem; }
.portal-breadcrumb a { color: var(--dta-ink-700); text-decoration: none; font-weight: 600; }
.portal-breadcrumb a:hover { color: var(--cust-accent); }

/* ── UX-3.4 deliverable groups & rows ───────────────────────────────────────────────────────── */
.portal-group-heading {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 1.75rem 0 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 3px solid var(--cust-accent);
    color: var(--dta-brand-darker);
}

.portal-deliverable {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-bottom: 0.85rem;
}
@media (min-width: 576px) {
    .portal-deliverable { flex-direction: row; align-items: center; }
}

.portal-deliverable-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--cust-accent-tint);
    flex-shrink: 0;
}
@media (min-width: 576px) {
    .portal-deliverable-thumb { width: 160px; }
}
.portal-deliverable-thumb:empty { display: none; }
.portal-deliverable-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.portal-deliverable-body { flex: 1; min-width: 0; }
.portal-deliverable-title { font-weight: 600; margin: 0 0 0.2rem; color: var(--dta-brand-darker); }
.portal-deliverable-desc,
.portal-deliverable-description { font-size: 0.9rem; color: var(--dta-ink-700); margin: 0 0 0.2rem; }
.portal-deliverable-date { font-size: 0.75rem; color: var(--dta-ink-600); }

.portal-deliverable-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ── Buttons (UX-2.2) — bespoke portal-branded buttons ─────────────────────────────────────── */
.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--dta-font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.portal-btn-primary { background: var(--cust-accent); color: var(--cust-accent-contrast); }
.portal-btn-primary:hover { filter: brightness(0.92); color: var(--cust-accent-contrast); }
.portal-btn-outline { background: #fff; color: var(--cust-accent); border-color: var(--cust-accent); }
.portal-btn-outline:hover { background: var(--cust-accent-tint); color: var(--cust-accent); }
.portal-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── UX-3.4/FR-7.2 password reveal/copy control ─────────────────────────────────────────────── */
.portal-password {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--dta-paper-deep);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.4rem;
    min-height: 44px;
    max-width: 100%; /* V0.0.029 — the chip must not overflow narrow phones. */
}
.portal-password-value {
    font-family: var(--dta-font-mono);
    font-size: 0.85rem;
    min-width: 8ch;
    padding: 0 0.25rem;
    color: var(--dta-ink-800);
    overflow-wrap: anywhere; /* V0.0.029 — a long revealed password must not overflow narrow phones. */
}
.portal-password button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 44px;
    min-width: 40px;
    border: none;
    background: transparent;
    color: var(--cust-accent);
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}
.portal-password button:hover { background: var(--cust-accent-tint); border-radius: 6px; }
.portal-password .portal-icon { width: 16px; height: 16px; }

/* ── Toasts (UX-2.2) ────────────────────────────────────────────────────────────────────────── */
.portal-toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dta-brand-darker);
    color: #fff;
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    box-shadow: var(--shadow-md);
    z-index: 1080;
}
@media (min-width: 768px) {
    .portal-toast { left: auto; right: 1.25rem; bottom: 1.25rem; transform: none; }
}

/* ── Empty states (UX-2.2) ──────────────────────────────────────────────────────────────────── */
.portal-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--dta-ink-600);
}
.portal-empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }

/* ══════════════════════════════════════════════════════════════════════════════════════════════
   MINI COMPONENT/UTILITY LAYER — hand-rolled, no framework. The Razor markup throughout this
   app (admin + client) was authored against Bootstrap-shaped class names (btn/form-control/
   card/badge/alert/table/nav-tabs/row·col-*/d-flex/gap-*/mb-*/text-muted, etc.) but no CSS
   framework is loaded anywhere (App.razor references only portal.css + the scoped-css bundle —
   see the "literally no CSS" bug report this pass fixes). Per the HARD CONSTRAINTS (no CSS
   frameworks/CDNs, hand-rolled only), this section implements exactly the subset of that
   vocabulary actually used in Components\**\*.razor (grepped exhaustively) as small, literal,
   DTA-themed rules — restyling the existing markup without renaming a single class.
   ══════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── Generic buttons (.btn — distinct from the bespoke .portal-btn family above) ───────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--dta-font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: #fff;
    color: var(--dta-ink-800);
    line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 0.75rem; font-size: 0.82rem; border-radius: var(--radius-sm); }

.btn-primary { background: var(--dta-brand-primary); border-color: var(--dta-brand-primary); color: #fff; }
.btn-primary:hover { background: var(--dta-brand-primary-dark); border-color: var(--dta-brand-primary-dark); color: #fff; }

.btn-success { background: var(--dta-contour-500); border-color: var(--dta-contour-500); color: #0d1b0a; }
.btn-success:hover { background: var(--dta-brand-primary); border-color: var(--dta-brand-primary); color: #fff; }

.btn-secondary { background: var(--dta-ink-700); border-color: var(--dta-ink-700); color: #fff; }
.btn-secondary:hover { background: var(--dta-brand-darker); border-color: var(--dta-brand-darker); }

.btn-link { background: transparent; border-color: transparent; color: var(--dta-brand-primary); min-height: auto; padding: 0.2rem 0.4rem; }
.btn-link:hover { text-decoration: underline; background: transparent; }

.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger, .btn-outline-success {
    background: #fff;
}
.btn-outline-primary { border-color: var(--dta-brand-primary); color: var(--dta-brand-primary); }
.btn-outline-primary:hover { background: var(--dta-contour-100); }
.btn-outline-secondary { border-color: var(--dta-gridline); color: var(--dta-ink-700); }
.btn-outline-secondary:hover { background: var(--dta-paper-deep); }
.btn-outline-danger { border-color: var(--dta-accent-600); color: var(--dta-accent-700); }
.btn-outline-danger:hover { background: var(--dta-accent-100); }
.btn-outline-success { border-color: var(--dta-contour-500); color: var(--dta-brand-primary-dark); }
.btn-outline-success:hover { background: var(--dta-contour-100); }

/* ── Forms ───────────────────────────────────────────────────────────────────────────────────
   44px controls (UX-2.1 touch targets); form-control-sm/form-select-sm relax that only for
   dense admin filter bars, which remain keyboard/mouse desktop-first per UX-3.7. */
.form-label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--dta-ink-700); margin-bottom: 0.3rem; }
.form-label.d-block { display: block; }

.form-control, .form-select {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0 0.75rem;
    font-size: 0.92rem;
    font-family: var(--dta-font-sans);
    color: var(--dta-ink-800);
    background: #fff;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus { border-color: var(--cust-accent); }
.form-control::placeholder { color: var(--dta-ink-500); }
.form-control-sm, .form-select-sm { min-height: 36px; padding: 0 0.6rem; font-size: 0.85rem; }
.form-control-color { min-height: 44px; padding: 4px; width: 4.5rem; cursor: pointer; }
textarea.form-control { min-height: 90px; padding: 0.6rem 0.75rem; resize: vertical; }
select.form-select { cursor: pointer; }

.form-text { color: var(--dta-ink-600); margin-top: 0.25rem; display: block; }

.form-check { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.form-check-inline { display: inline-flex; margin-right: 0.75rem; }
.form-check-input {
    width: 20px;
    height: 20px;
    accent-color: var(--cust-accent);
    cursor: pointer;
    flex-shrink: 0;
}
.form-check-label { cursor: pointer; color: var(--dta-ink-800); }

/* ── Alerts — brand rule: hi-vis orange ramp is reserved for alerts/errors/callouts (marketing
   site rationale); success/info use the contour green / ink-tint ramp instead. ─────────────── */
.alert {
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
    font-size: 0.92rem;
}
.alert.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.alert-danger { background: var(--dta-accent-100); border-color: #f3c7a3; color: var(--dta-accent-800); }
.alert-warning { background: var(--dta-accent-100); border-color: #f3c7a3; color: var(--dta-accent-700); }
.alert-success { background: var(--dta-contour-100); border-color: #bfe0af; color: var(--dta-brand-primary-dark); }
.alert-info { background: var(--dta-paper-deep); border-color: var(--dta-gridline); color: var(--dta-ink-700); }

/* ── Badges ──────────────────────────────────────────────────────────────────────────────────
   text-bg-* is a Bootstrap-5.3-ism (auto contrast text+bg pair) used verbatim in the admin
   deliverable/customer editors; bg-* is used bare (with a separate text-dark) on release notes. */
.badge {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .01em;
    background: var(--dta-paper-deep);
    color: var(--dta-ink-700);
}
.badge.border { border: 1px solid var(--dta-gridline); }
.bg-light, .text-bg-light { background: var(--dta-paper-deep) !important; color: var(--dta-ink-700) !important; }
.bg-secondary, .text-bg-secondary { background: var(--dta-ink-600) !important; color: #fff !important; }
.bg-success, .text-bg-success { background: var(--dta-contour-500) !important; color: #0d1b0a !important; }
.bg-warning, .text-bg-warning { background: var(--dta-accent-500) !important; color: #2b1400 !important; }
.bg-danger, .text-bg-danger { background: var(--dta-accent-700) !important; color: #fff !important; }
.text-dark { color: var(--dta-brand-darker) !important; }

/* ── Bootstrap-style cards (.card/.card-body — distinct from the bespoke .portal-card family) ── */
.card {
    background: #fff;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 1rem 1.25rem; }

/* ── Tables ──────────────────────────────────────────────────────────────────────────────────
   Stack-to-cards on mobile is UX-3.5's requirement for the Members table specifically (handled
   there via .table-responsive scroll on narrow widths, matching UX-2.1's "no horizontal page
   scroll" by scoping the scroll region to the table, not the page). */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.6rem 0.6rem; text-align: left; border-bottom: 1px solid var(--dta-gridline); vertical-align: middle; }
.table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--dta-ink-600); font-weight: 700; }
.table-sm th, .table-sm td { padding: 0.4rem 0.5rem; }
.table.align-middle td { vertical-align: middle; }
.table-warning { background: var(--dta-accent-100); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Nav tabs (admin Customer/Project editors) ──────────────────────────────────────────────── */
.nav { display: flex; list-style: none; margin: 0; padding: 0; }
.nav-tabs { border-bottom: 2px solid var(--dta-gridline); gap: 0.25rem; flex-wrap: wrap; }
.nav-item { display: block; }
.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 1rem;
    text-decoration: none;
    color: var(--dta-ink-600);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.nav-link:hover { color: var(--dta-brand-primary); }
.nav-link.active { color: var(--dta-brand-primary); border-bottom-color: var(--cust-accent); }

/* ── Grid system (row / col-* / col-md-*) — CSS-Grid-backed 12-col implementation of the subset
   actually used (col-4/6/8/12, col-md-1/2/3/4/5/6/8, plus the g-*/g-2/g-3 gap modifiers).
   UX-2.1 breakpoint: col-md-* only activates ≥ 768px, matching Bootstrap's `md` tier — below
   that every column is full-width, satisfying "no horizontal page scroll ≥ 320px". ───────────── */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}
.row > [class*="col"] { padding: 0 0.5rem; width: 100%; margin-bottom: 0.75rem; }
.row.g-1 > [class*="col"] { margin-bottom: 0.35rem; }
.row.g-2 > [class*="col"] { margin-bottom: 0.5rem; }
.row.g-3 > [class*="col"] { margin-bottom: 0.75rem; }

.col-4  { width: 33.3333%; }
.col-8  { width: 66.6667%; }
.col-12 { width: 100%; }

@media (min-width: 768px) {
    .col-md-1 { width: 8.3333%; }
    .col-md-2 { width: 16.6667%; }
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.3333%; }
    .col-md-5 { width: 41.6667%; }
    .col-md-6 { width: 50%; }
    .col-md-8 { width: 66.6667%; }
    .row.g-2 > [class*="col"], .row.g-3 > [class*="col"] { margin-bottom: 0; }
    .row.g-1 > [class*="col"] { margin-bottom: 0; }
}

/* ── Utility classes (the exact subset used across Components\**\*.razor) ──────────────────── */
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-block { display: block !important; }
.d-none { display: none !important; }
@media (min-width: 576px) { .d-sm-inline { display: inline !important; } }
@media (min-width: 768px) { .d-md-inline { display: inline !important; } }

.flex-wrap { flex-wrap: wrap !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-baseline { align-items: baseline !important; }
.align-self-center { align-self: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }

.gap-1 { gap: var(--sp-1) !important; }
.gap-2 { gap: var(--sp-2) !important; }
.gap-3 { gap: var(--sp-3) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--sp-1) !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-3 { margin-bottom: var(--sp-3) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }
.ms-1 { margin-left: var(--sp-1) !important; }
.ms-2 { margin-left: var(--sp-2) !important; }
.ms-auto { margin-left: auto !important; }
.p-0 { padding: 0 !important; }
.p-4 { padding: var(--sp-4) !important; }
.py-2 { padding-top: var(--sp-2) !important; padding-bottom: var(--sp-2) !important; }
.pt-0 { padding-top: 0 !important; }

.small { font-size: 0.83rem; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.text-muted { color: var(--dta-ink-600) !important; }
.text-danger { color: var(--dta-accent-700) !important; }
.text-end { text-align: right !important; }
.text-nowrap { white-space: nowrap !important; }
.text-break { overflow-wrap: anywhere; word-break: break-word; }
.w-100 { width: 100% !important; }

/* ── Slice 8 — organisation sheet (design doc "the map sheet"), Members.razor only ─────────────
   Presentation-only restyle of the lead-client Organisation page. New classes only — no existing
   rule above is edited. Reuses the established .portal-btn / .portal-card-meta / .sheet-* tokens
   and the same 44px-target / hairline / no-uppercase-eyebrow conventions as Slices 1-2. ────────── */
.portal-org-intro { max-width: var(--sheet-measure-body); color: var(--dta-ink-700); }
.portal-org-closing {
    max-width: var(--sheet-measure-body);
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--dta-gridline);
    color: var(--dta-ink-600);
    font-size: 0.92rem;
}

/* Feedback banners — text always states the outcome in full, never colour-only (UX-6.1). */
.portal-banner {
    max-width: var(--sheet-measure-body);
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--dta-gridline);
    font-size: 0.95rem;
}
.portal-banner-success { background: var(--dta-contour-100); border-color: color-mix(in srgb, var(--dta-contour-500) 45%, var(--dta-gridline)); color: var(--dta-ink-800); }
.portal-banner-info { background: var(--dta-paper-deep); color: var(--dta-ink-800); }
.portal-banner-error { background: var(--dta-accent-100); border-color: color-mix(in srgb, var(--dta-accent-600) 45%, var(--dta-gridline)); color: var(--dta-ink-800); }

/* Invite form. */
.portal-invite { max-width: var(--sheet-measure-body); margin: 1.75rem 0; }
.portal-invite h2 { margin-bottom: 0.35rem; }
.portal-form { margin-top: 0.75rem; }
.portal-form-row { display: flex; flex-direction: column; gap: 0.3rem; max-width: 26rem; margin-bottom: 1.1rem; }
.portal-form-row label { font-weight: 600; color: var(--dta-brand-darker); font-size: 0.92rem; }
.portal-form-row input[type="email"],
.portal-form-row input[type="text"] {
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--dta-ink-800);
    background: #fff;
}
.portal-form-row input:focus-visible { outline: 2px solid var(--cust-accent); outline-offset: 2px; }

.portal-check-fieldset { border: 1px solid var(--dta-gridline); border-radius: var(--radius-md); padding: 1rem; margin: 0 0 1.1rem; max-width: 32rem; }
.portal-check-fieldset legend { font-weight: 600; color: var(--dta-brand-darker); padding: 0 0.35rem; font-size: 0.95rem; }
.portal-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-height: 44px;
    padding: 0.3rem 0;
}
.portal-check input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; flex-shrink: 0; accent-color: var(--cust-accent); }
.portal-check label { color: var(--dta-ink-800); }
.portal-check-helper { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--dta-ink-600); }
.portal-check-list { list-style: none; margin: 0.25rem 0 0; padding: 0; border-top: 1px solid var(--dta-gridline); }
.portal-check-list li { border-bottom: 1px solid var(--dta-gridline); }
.portal-check-list li:last-child { border-bottom: none; }
.portal-check-meta { display: block; font-size: 0.82rem; color: var(--dta-ink-600); font-weight: 400; }

/* People register. */
.portal-people { max-width: var(--sheet-measure-body); margin-bottom: 1.5rem; }
.portal-people-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.portal-people-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-md);
}
.portal-people-plate {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-sm);
    background: var(--cust-accent-tint);
    color: var(--dta-ink-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--dta-font-display);
    font-weight: 700;
    font-size: 1rem;
}
.portal-people-body { flex: 1 1 16rem; min-width: 0; }
.portal-people-name { margin: 0 0 0.15rem; font-weight: 600; color: var(--dta-brand-darker); overflow-wrap: anywhere; }
.portal-people-role { margin-left: 0.5rem; font-size: 0.78rem; font-weight: 700; color: var(--dta-ink-600); text-transform: none; }
.portal-people-email { margin: 0 0 0.3rem; font-size: 0.9rem; color: var(--dta-ink-700); overflow-wrap: anywhere; }
.portal-people-status { margin: 0 0 0.2rem; font-size: 0.9rem; color: var(--dta-ink-700); }
.portal-people-projects { margin: 0; font-size: 0.85rem; color: var(--dta-ink-600); }
.portal-people-manage { margin-top: 0.6rem; }
.portal-people-manage summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--dta-ink-700); }
.portal-people-manage summary:hover { color: var(--cust-accent); }
.portal-people-manage .portal-check-fieldset { margin-top: 0.6rem; }
.portal-people-actions { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.portal-btn-danger { color: var(--dta-accent-700); border-color: var(--dta-accent-700); }
.portal-btn-danger:hover { background: var(--dta-accent-100); color: var(--dta-accent-700); }
@media (max-width: 575.98px) {
    .portal-people-actions { margin-left: 0; width: 100%; }
    .portal-people-actions .portal-btn { flex: 1 1 auto; }
}

/* ── Print (UX-6.4 — clean deliverables sheet; URLs in full, passwords omitted) ───────────────── */
@media print {
    .portal-dta-bar, .portal-user-menu, .portal-toast, .portal-skip-link, .portal-password { display: none !important; }
    .portal-hero, .portal-welcome-strip { background: none !important; color: var(--dta-ink-800) !important; }
    .portal-deliverable-actions a[href^="/go/"]::after { content: " (" attr(href) ")"; font-size: 0.75rem; color: var(--dta-ink-600); }
    body { background: #fff; }
}

/* ── #blazor-error-ui (framework default, kept) ────────────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── V0.0.026 — "no way back from My account" fix + icon/layout polish ─────────────────────────
   PortalIcon.razor (small inline-SVG set for nav/menu/button labels), the "My account" link in
   .portal-sheet-nav, the active-link state on customer-nav/breadcrumb links, and the two-column
   account layout below /account's breadcrumb. ────────────────────────────────────────────────── */

.portal-icon { flex: 0 0 auto; vertical-align: -0.2em; }

.portal-sheet-nav a.is-current {
    color: var(--dta-brand-darker);
    border-bottom: 2px solid var(--cust-accent, var(--dta-contour-500));
    padding-bottom: 2px;
}

.portal-user-menu-item {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
}

.portal-crumbs { margin-bottom: 0.75rem; }
.portal-crumbs a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    color: var(--dta-ink-700);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}
.portal-crumbs a:hover { color: var(--cust-accent, var(--dta-brand-primary)); filter: none; }

.portal-account-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (min-width: 768px) {
    .portal-account-grid { grid-template-columns: 1fr 1fr; }
    .portal-account-grid .card,
    .portal-account-grid .card.mb-3 { margin-bottom: 0; }
}

/* V0.0.027 — deliverable action cluster: right-align every row's action cluster and label the
   reveal/copy icon buttons (PortalIcon) so they read as text, not just glyphs. */
.portal-password-label { line-height: 1; }

/* ── V0.0.028 media gallery — db\160 native photos/video (ProjectMediaGallery.razor). Reuses the
   established tokens (--dta-*, --cust-accent, --radius-*, .portal-btn's 44px-target convention);
   reduced-motion is already handled globally by the `* { transition: none !important }` rule near
   the top of this file, so nothing extra is needed here. ─────────────────────────────────────── */
.portal-media { margin-top: 2.5rem; }
.portal-media h2 {
    font-family: var(--dta-font-display);
    font-size: 1.15rem;
    color: var(--dta-brand-darker);
    margin: 0 0 0.15rem;
}
.portal-media-count { color: var(--dta-ink-600); font-size: 0.88rem; margin: 0 0 1rem; }

.portal-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
@media (max-width: 479.98px) {
    .portal-media-grid { grid-template-columns: repeat(2, 1fr); }
}

.portal-media-item {
    margin: 0;
    background: var(--dta-paper-deep);
    border: 1px solid var(--dta-gridline);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* V0.0.029 — frame + absolutely-positioned image, so the box no longer relies on a
   percentage-height-of-an-aspect-ratio-derived-height chain that some WebKit builds collapse. */
.portal-media-frame {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--dta-paper-deep);
}
.portal-media-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* V0.0.029 — video now sits in the same .portal-media-frame as photos, so it is sized by the
   frame's own absolutely-positioned rule rather than its own aspect-ratio/object-fit. */
.portal-media-frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.portal-media-video {
    display: block;
    background: var(--dta-brand-darker);
}
.portal-media-video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    aspect-ratio: 4 / 3;
    background: var(--dta-brand-darker);
    color: var(--cust-accent-tint);
    padding: 0.75rem;
    text-align: center;
}
.portal-media-video-placeholder .portal-icon { color: #fff; }
.portal-media-video-placeholder span { color: #fff; font-size: 0.8rem; overflow-wrap: anywhere; }

.portal-media-caption {
    padding: 0.6rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 auto;
}
.portal-media-caption-text { font-size: 0.85rem; color: var(--dta-ink-800); font-weight: 600; overflow-wrap: anywhere; }
.portal-media-meta { font-size: 0.78rem; color: var(--dta-ink-600); }
.portal-media-download {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    margin-top: 0.15rem;
    color: var(--cust-accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    align-self: flex-start;
}
.portal-media-download:hover { text-decoration: underline; }

/* Lightbox — appended to <body> by client-portal.js, cloned from ProjectMediaGallery.razor's
   inert <template id="portal-lightbox-template">. Above the sticky .portal-dta-bar (z-index 1030). */
.portal-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1900;
    background: rgba(16, 20, 16, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    /* V0.0.029 — iOS safe-area + rubber-band containment. */
    overscroll-behavior: contain;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.portal-lightbox[hidden] { display: none; }
.portal-lightbox-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    /* V0.0.029 — desktop shrinks to the image so the positioned prev/next/close stay against it;
       phones override this to a full-width frame below. */
    max-width: min(90vw, 100%);
}
.portal-lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    max-height: 70dvh;
    border-radius: var(--radius-sm);
    display: block;
}
.portal-lightbox-caption { color: #fff; font-size: 0.9rem; text-align: center; margin: 0; max-width: 100%; }
.portal-lightbox-close,
.portal-lightbox-prev,
.portal-lightbox-next {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
}
.portal-lightbox-close:hover,
.portal-lightbox-prev:hover,
.portal-lightbox-next:hover { background: rgba(255, 255, 255, .22); }
.portal-lightbox-close { position: absolute; top: -0.5rem; right: -0.5rem; }
.portal-lightbox-prev { position: absolute; left: -1rem; top: 50%; transform: translateY(-50%); }
.portal-lightbox-next { position: absolute; right: -1rem; top: 50%; transform: translateY(-50%); }
.portal-lightbox-close:focus-visible,
.portal-lightbox-prev:focus-visible,
.portal-lightbox-next:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.portal-lightbox-download {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0 0.9rem;
    color: #fff;
    background: var(--cust-accent);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
}
.portal-lightbox-download:hover { filter: brightness(0.92); color: #fff; }

html.portal-lightbox-open, body.portal-lightbox-open { overflow: hidden; }

@media (max-width: 575.98px) {
    .portal-lightbox-prev { left: 0.25rem; }
    .portal-lightbox-next { right: 0.25rem; }
    /* V0.0.029 — keep controls off the image and within reach, with a visible backdrop margin. */
    .portal-lightbox-close { top: 0.25rem; right: 0.25rem; }
    .portal-lightbox-image { max-height: 60vh; max-height: 60dvh; }
    /* V0.0.029 — phones keep the full-width frame so the inset controls above have room. */
    .portal-lightbox-inner { width: 100%; max-width: 100%; }
}

@media print {
    .portal-lightbox { display: none !important; }
}
