/* WHITE-LABEL THEME — Change these variables to rebrand the app.
   Brand-variable overrides ONLY. Semantic/surface/text/shadow/radius/semantic/typography
   tokens live in _content/Kwickblocks.Mortgage.Shared/design-system.css (Phase 12 Plan 01). */
/* phase-20: no new tokens — relies on Phase 12 P01 + Phase 18 + Phase 19 base set */
:root {
    /* Light-only app. Pin the document color-scheme so UA-themed controls — and
       the Google gmp-place-autocomplete web component, which reads the root
       color-scheme — never render their dark theme on dark-mode machines (that
       was painting the address search box black). */
    color-scheme: light;

    --brand-primary: #1f3864;
    --brand-secondary: #3a0647;
    --brand-accent: #0071c1;
    --brand-accent-hover: #1b6ec2;
    --brand-accent-border: #1861ac;
    --brand-accent-focus: #258cfb;
    --sidebar-gradient-start: rgb(5, 39, 103);
    --sidebar-gradient-end: #3a0647;
    --topbar-bg: #f7f7f7;
    --topbar-border: #d6d5d5;
    --nav-text: #d7d7d7;
    --nav-active-bg: rgba(255,255,255,0.37);
    --nav-hover-bg: rgba(255,255,255,0.1);

    /* Surface-brand composed from brand gradient tokens — kept here because it depends on
       --sidebar-gradient-*. (Allowed: this is a brand-derived composition, not a semantic
       token duplicate.) */
    --surface-brand: linear-gradient(135deg, var(--sidebar-gradient-start), var(--sidebar-gradient-end));

    /* ===== Phase 18 — Design System v2 tokens (lockstep with Admin/Webasm) ===== */
    /* DsTabs */
    --ds-tab-hover-bg: rgba(0, 0, 0, 0.04);

    /* DsModal — promoted from existing literals */
    --ds-modal-backdrop: rgba(0, 0, 0, 0.45);
    --ds-modal-max-w-sm: 26rem;
    --ds-modal-max-w-md: 35rem;
    --ds-modal-max-w-lg: 48rem;

    /* DsTable */
    --ds-row-hover-bg: rgba(0, 0, 0, 0.03);

    /* DsKanban — --ds-drag-target-bg is brand-derived; recompute on rebrand */
    --ds-drag-target-border: var(--brand-accent-border);
    --ds-drag-target-bg: rgba(37, 140, 251, 0.08);
    --ds-drag-ghost-opacity: 0.5;

    /* ===== Phase 19 — Shell tokens (lockstep with Admin/Webasm) ===== */
    --topbar-height: 3.5rem;
    --topbar-search-max-w: 22rem;
    --topbar-search-bg: var(--surface-primary);
    --topbar-search-border: var(--topbar-border);
    --sidebar-divider: rgba(255, 255, 255, 0.12);
    --badge-count-bg: var(--brand-accent);
    --badge-count-fg: #ffffff;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: var(--brand-accent);
}

.btn-primary {
    color: #fff;
    background-color: var(--brand-accent-hover);
    border-color: var(--brand-accent-border);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--brand-accent-focus);
}

.content {
    padding-top: 1.1rem;
}

/* Phase 33 — the vertical left sidebar was retired in favour of the horizontal
   top nav, so Admin pages own the full viewport width. Drop the shared
   .ds-page 1280px centred cap (design-system.css) app-wide; the base rule's
   horizontal padding is preserved so content still keeps a gutter off the
   viewport edges. Admin-only override — the Client WASM app keeps its sidebar
   and its capped .ds-page. */
.ds-page {
    max-width: none;
    margin: 0;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0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1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Phase 10: Auth page shell for /login, /bootstrap, /broker-claim */
.auth-page {
    min-height: calc(100vh - 3.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    background: #f7f7f7;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.auth-card__logo {
    display: block;
    width: min(100%, 240px);
    height: auto;
    margin: 0 auto 1.5rem;
}

.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.modal-card {
    background: var(--surface-primary);
    border: 1px solid var(--topbar-border);
    border-radius: var(--radius-md);
    min-width: 420px;
    max-width: 560px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--topbar-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

.field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.field-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.field-helper {
    font-size: 12px;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.btn-close-custom {
    /* Quick-task 260515-r12: 44×44 minimum so the dialog close × meets the
       Phase 20 mobile tap-target rule (previously 26×26 — set by the
       inherited line-height: 1 + 1.5rem font-size with no padding). */
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm, 0.375rem);
}

.btn-close-custom:hover {
    background: var(--surface-tertiary);
    color: var(--brand-accent);
}

.form-error {
    color: var(--danger);
    margin: 4px 0 0 0;
    font-size: 13px;
}

@media (max-width: 768px) {
    .modal-card {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        min-width: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        position: sticky;
        top: 0;
        background: var(--surface-primary);
        z-index: 1;
    }

    .modal-body {
        flex: 1;
        max-height: none;
    }
}

/* =============================================================
   AIP-form field styles for direct-mounted sub-components.
   Mirrors the `::deep` rules in AipForm.razor.css, which only
   match descendants of an <AipForm> scope ancestor. The Profile
   sub-pages mount <ApplicantPersonalDetails> / Employment /
   Financial directly (no AipForm wrapper), so those scoped rules
   don't reach them. These global rules apply on any host that
   opts in via `class="aip-form-context"`.
   ============================================================= */

.aip-form-context {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.85rem;
    color: var(--brand-primary);
}

.aip-form-context .applicant-column {
    padding: 0 4px;
}

.aip-form-context .sub-header {
    text-align: center;
    font-weight: bold;
    color: var(--brand-primary);
    font-size: 0.95rem;
    padding: 6px 0;
    text-decoration: underline;
    margin-bottom: 4px;
}

.aip-form-context .subsection-header {
    font-weight: bold;
    color: var(--brand-primary);
    font-size: 0.85rem;
    padding: 6px 4px 2px;
    margin-top: 8px;
}

.aip-form-context .subsection-header-italic {
    font-weight: bold;
    font-style: italic;
    color: var(--brand-primary);
    font-size: 0.85rem;
    padding: 6px 4px 2px;
    margin-top: 8px;
}

.aip-form-context .field-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-bottom: 3px;
    gap: 4px;
}

.aip-form-context .field-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.aip-form-context .field-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.aip-form-context .field-label {
    color: var(--brand-primary);
    font-size: 0.8rem;
    white-space: nowrap;
    min-width: fit-content;
    padding: 2px 4px;
}

.aip-form-context .field-section-label {
    font-weight: bold;
    color: var(--brand-primary);
    font-size: 0.8rem;
    padding: 4px 4px 1px;
    margin-top: 4px;
}

.aip-form-context .field-note {
    font-weight: bold;
    font-style: italic;
    color: var(--brand-primary);
    font-size: 0.75rem;
    padding: 2px 4px;
}

.aip-form-context .field-input {
    background-color: #ffffff;
    border: 1px solid var(--form-border);
    color: var(--brand-primary);
    font-size: 0.8rem;
    padding: 3px 6px;
    height: 26px;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.aip-form-context .field-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary);
}

.aip-form-context select.field-input {
    cursor: pointer;
    appearance: auto;
}

.aip-form-context .field-input-short {
    max-width: 120px;
    flex: 0 0 120px;
}

.aip-form-context .field-input-tiny {
    max-width: 40px;
    flex: 0 0 40px;
    text-align: center;
}

.aip-form-context .field-textarea {
    height: auto;
    min-height: 60px;
    resize: vertical;
    flex: 1;
    width: 100%;
}

.aip-form-context .inline-label-input {
    max-width: 100%;
    height: 24px;
}

.aip-form-context .currency-field {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 2px;
}

.aip-form-context .currency-prefix,
.aip-form-context .currency-suffix {
    color: var(--brand-primary);
    font-size: 0.8rem;
    font-weight: normal;
}

.aip-form-context .income-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-items: center;
}

.aip-form-context .total-row .field-label {
    text-align: right;
}

.aip-form-context .field-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.aip-form-context .checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-primary);
    font-size: 0.8rem;
    padding: 2px 0;
    cursor: pointer;
}

.aip-form-context .checkbox-label input[type="checkbox"],
.aip-form-context .checkbox-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.aip-form-context .checkbox-row {
    display: flex;
    gap: 24px;
    padding: 4px;
}

.aip-form-context .credit-history-checks {
    padding: 2px 4px;
}

.aip-form-context .check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 0;
    gap: 8px;
}

.aip-form-context .check-row .field-label {
    text-align: right;
    flex: 1;
}

.aip-form-context .detail-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 8px;
    font-size: 0.78rem;
}

.aip-form-context .detail-table th {
    background-color: var(--brand-primary);
    color: #ffffff;
    font-weight: bold;
    padding: 4px 6px;
    text-align: left;
    border: 1px solid var(--form-border);
    font-size: 0.75rem;
}

.aip-form-context .detail-table td {
    background-color: #ffffff;
    border: 1px solid var(--form-border);
    padding: 1px;
}

.aip-form-context .table-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--brand-primary);
    font-size: 0.78rem;
    padding: 3px 4px;
    height: 24px;
    box-sizing: border-box;
}

.aip-form-context .table-input:focus {
    outline: none;
    background-color: var(--form-focus-bg);
}

.aip-form-context .table-header-row {
    background-color: var(--form-bg);
    padding: 2px 0;
    font-size: 0.8rem;
}

/* Mobile — stack two-col grids and grow tap targets. Matches the
   @media (max-width: 768px) and 480px breakpoints in AipForm.razor.css. */
@media (max-width: 768px) {
    .aip-form-context .field-label {
        white-space: normal;
        font-size: 0.78rem;
    }

    .aip-form-context .field-input {
        height: 32px;
        font-size: 0.82rem;
        padding: 4px 8px;
    }

    .aip-form-context select.field-input {
        height: 32px;
    }

    .aip-form-context .field-textarea {
        min-height: 70px;
    }

    .aip-form-context .field-input-short {
        max-width: none;
        flex: 0 0 100px;
    }

    .aip-form-context .field-checkbox {
        width: 22px;
        height: 22px;
    }

    .aip-form-context .checkbox-label input[type="checkbox"],
    .aip-form-context .checkbox-label input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    .aip-form-context .detail-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.72rem;
    }

    .aip-form-context .detail-table th {
        font-size: 0.68rem;
        padding: 3px 4px;
        white-space: nowrap;
    }

    .aip-form-context .table-input {
        height: 28px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .aip-form-context .field-row {
        flex-wrap: wrap;
    }

    .aip-form-context .field-row.two-col {
        grid-template-columns: 1fr;
    }

    .aip-form-context .income-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .aip-form-context .checkbox-row {
        flex-direction: column;
        gap: 8px;
    }
}
