h1:focus {
    outline: none;
}

/* Override MudBlazor Info severity — blue is not in the brand palette.
   Use Medium Grey for informational/empty-state alerts. */
.mud-alert-text-info {
    color: #6b6b6d;
}

.mud-alert-text-info .mud-alert-icon {
    color: #BABABC;
}

.mud-alert-filled-info {
    background-color: #EDEDED;
    color: #2D2E2C;
}

.mud-alert-outlined-info {
    border-color: #BABABC;
    color: #6b6b6d;
}

.mud-alert-standard-info {
    background-color: #f5f5f5;
    color: #6b6b6d;
}

.mud-alert-standard-info .mud-alert-icon {
    color: #BABABC;
}

/* Dialog backdrop: blur background content */
.mud-overlay {
    backdrop-filter: blur(3px);
}

/* Standard dialog header — AN Red bar with white text/icons.
   Used by ConfirmDialog and all custom dialogs via Class="confirm-dialog". */
.confirm-dialog .mud-dialog-title {
    padding: 0 !important;
    background-color: #A7252C;
}

.confirm-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.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+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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;
}

/* ===================================================================
   ArchitectNow Brand Styles (from an-admin-api)
   =================================================================== */

.btn-primary {
    text-transform: uppercase;
    --bs-btn-bg: var(--mud-palette-primary) !important;
    --bs-btn-hover-bg: var(--mud-palette-primary-darken) !important;
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--mud-palette-primary) !important;
}

.nav {
    --bs-nav-link-color: var(--mud-palette-primary) !important;
    --bs-nav-link-hover-color: var(--mud-palette-primary-darken) !important;
}

.text-center {
    text-align: center;
}

.w-100 {
    width: 100%;
}

.blue-link {
    color: #007BFF;
    text-decoration: none;
}

.blue-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Markdown Content Styles */
.markdown-content {
    line-height: 1.6;
    color: var(--mud-palette-text-primary);
}

.markdown-content h1 {
    font-size: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.markdown-content h2 {
    font-size: 1.5rem;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.markdown-content h3 {
    font-size: 1.25rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content code {
    background-color: var(--mud-palette-background-grey);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.markdown-content pre {
    background-color: var(--mud-palette-background-grey);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-content blockquote {
    border-left: 4px solid var(--mud-palette-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-content th, .markdown-content td {
    border: 1px solid var(--mud-palette-divider);
    padding: 0.5rem;
    text-align: left;
}

.markdown-content th {
    background-color: var(--mud-palette-background-grey);
    font-weight: 500;
}

.markdown-content a {
    color: var(--mud-palette-primary);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

/* ===================================================================
   ProposalHub Client Viewer – Mobile-Responsive Styles
   Minimum supported viewport: 320px
   =================================================================== */

/* --- Utility Classes --- */
.ph-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ph-hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .ph-hide-mobile {
        display: inline-flex;
    }
}

/* Accessibility: Visible focus indicators for keyboard navigation */
*:focus-visible {
    outline: 2px solid #A7252C;
    outline-offset: 2px;
}

/* Skip link for keyboard users */
.ph-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #A7252C;
    color: #ffffff;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 0.875rem;
    text-decoration: none;
}

.ph-skip-link:focus {
    top: 0;
}

/* Ensure clickable divs show focus */
[role="button"]:focus-visible {
    outline: 2px solid #A7252C;
    outline-offset: 2px;
}

/* --- CSS Custom Properties --- */
:root {
    --ph-color-primary: #A7252C;
    --ph-color-primary-hover: #8b1f24;
    --ph-color-success: #16a34a;
    --ph-color-success-hover: #15803d;
    --ph-color-danger: #dc2626;
    --ph-color-danger-hover: #b91c1c;
    --ph-color-secondary: #2D2E2C;
    --ph-color-secondary-hover: #1a1a1a;
    --ph-color-border: #BABABC;
    --ph-color-bg: #ffffff;
    --ph-color-bg-muted: #EDEDED;
    --ph-color-text: #2D2E2C;
    --ph-color-text-muted: #BABABC;
    --ph-radius: 8px;
    --ph-radius-sm: 4px;
    --ph-font-body: 1rem;
    --ph-touch-min: 44px;
    --ph-spacing-xs: 0.25rem;
    --ph-spacing-sm: 0.5rem;
    --ph-spacing-md: 1rem;
    --ph-spacing-lg: 1.5rem;
    --ph-spacing-xl: 2rem;
}

/* --- Global App Layout --- */
.ph-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    border-bottom: 1px solid var(--ph-color-border);
    background: var(--ph-color-bg);
    flex-wrap: wrap;
    gap: var(--ph-spacing-sm);
}

.ph-header-brand {
    flex-shrink: 0;
}

.ph-logo {
    text-decoration: none;
    color: var(--ph-color-text);
    font-weight: 700;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-xs);
}

.ph-logo-divider {
    color: var(--ph-color-text-muted);
    font-weight: 300;
}

.ph-logo-product {
    color: var(--ph-color-primary);
}

.ph-header-nav {
    display: flex;
    gap: var(--ph-spacing-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ph-nav-link {
    text-decoration: none;
    color: var(--ph-color-text-muted);
    padding: var(--ph-spacing-sm) var(--ph-spacing-sm);
    min-height: var(--ph-touch-min);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 0.875rem;
}

.ph-nav-link:hover {
    color: var(--ph-color-primary);
}

.ph-main {
    flex: 1;
}

/* --- Buttons --- */
.ph-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--ph-radius-sm);
    cursor: pointer;
    font-size: var(--ph-font-body);
    font-weight: 500;
    min-height: var(--ph-touch-min);
    min-width: var(--ph-touch-min);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
    line-height: 1.4;
    white-space: nowrap;
}

.ph-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ph-btn-sm {
    font-size: 0.875rem;
    min-height: var(--ph-touch-min);
    padding: var(--ph-spacing-xs) var(--ph-spacing-sm);
}

.ph-btn-primary {
    background: var(--ph-color-primary);
    color: #fff;
}
.ph-btn-primary:hover:not(:disabled) {
    background: var(--ph-color-primary-hover);
}

.ph-btn-success {
    background: var(--ph-color-success);
    color: #fff;
}
.ph-btn-success:hover:not(:disabled) {
    background: var(--ph-color-success-hover);
}

.ph-btn-danger {
    background: var(--ph-color-danger);
    color: #fff;
}
.ph-btn-danger:hover:not(:disabled) {
    background: var(--ph-color-danger-hover);
}

.ph-btn-secondary {
    background: var(--ph-color-secondary);
    color: #fff;
}
.ph-btn-secondary:hover:not(:disabled) {
    background: var(--ph-color-secondary-hover);
}

.ph-btn-outline {
    background: transparent;
    border-color: var(--ph-color-border);
    color: var(--ph-color-text);
}
.ph-btn-outline:hover:not(:disabled) {
    background: var(--ph-color-bg-muted);
}

.ph-btn-link {
    background: none;
    border: none;
    color: var(--ph-color-primary);
    padding: 0;
    min-height: auto;
    min-width: auto;
    text-decoration: underline;
    font-weight: 400;
}

/* --- Form Elements --- */
.ph-input {
    display: block;
    width: 100%;
    min-height: var(--ph-touch-min);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    font-size: 1rem; /* Prevents iOS zoom on focus */
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius-sm);
    background: var(--ph-color-bg);
    color: var(--ph-color-text);
    box-sizing: border-box;
}

.ph-input:focus {
    outline: 2px solid var(--ph-color-primary);
    outline-offset: -1px;
    border-color: var(--ph-color-primary);
}

.ph-textarea {
    resize: vertical;
    min-height: 80px;
}

.ph-form-group {
    margin-bottom: var(--ph-spacing-md);
}

.ph-form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--ph-spacing-xs);
    font-size: 0.875rem;
    color: var(--ph-color-text);
}

.ph-required {
    color: var(--ph-color-danger);
}

.ph-char-count,
.ph-char-counter {
    font-size: 0.75rem;
    color: var(--ph-color-text-muted);
    text-align: right;
    margin-top: var(--ph-spacing-xs);
}

.ph-char-warning {
    color: var(--ph-color-danger);
}

/* --- Alerts --- */
.ph-alert {
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    border-radius: var(--ph-radius-sm);
    margin-bottom: var(--ph-spacing-md);
    font-size: 0.9375rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.ph-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* --- Badges / Tags --- */
.ph-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}
.ph-badge-warning {
    background: #fef3c7;
    color: #92400e;
}
.ph-badge-success {
    background: #dcfce7;
    color: #166534;
}
.ph-badge-default {
    background: #f3f4f6;
    color: #374151;
}

.ph-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin: 0.125rem;
    white-space: nowrap;
}
.ph-tag-industry,
.ph-tag-project {
    background: #fef2f2;
    color: #991b1b;
}
.ph-tag-technology,
.ph-tag-tech {
    background: #ede9fe;
    color: #5b21b6;
}

/* --- Spinner / Loading --- */
.ph-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--ph-color-border);
    border-top-color: var(--ph-color-primary);
    border-radius: 50%;
    animation: ph-spin 0.8s linear infinite;
    margin: 0 auto var(--ph-spacing-md);
}

@keyframes ph-spin {
    to { transform: rotate(360deg); }
}

.ph-loading {
    text-align: center;
    padding: var(--ph-spacing-xl);
    color: var(--ph-color-text-muted);
}

.ph-empty-state {
    text-align: center;
    padding: var(--ph-spacing-xl);
    color: var(--ph-color-text-muted);
}

/* ===================================================================
   Viewer Layout (ViewerLayout.razor) — No admin chrome
   =================================================================== */
.viewer-layout {
    min-height: 100vh;
    background: #fafafa;
}

/* ===================================================================
   Home Page (Home.razor)
   =================================================================== */
.ph-home-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fafafa;
}

.ph-home-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

.ph-home-hero {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.ph-home-title {
    font-size: 3.5rem;
    font-weight: 800;
    color: #2D2E2C;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}

.ph-home-subtitle {
    font-size: 1.4rem;
    color: #A7252C;
    font-weight: 600;
    margin: 0 0 2.5rem;
}

.ph-home-screenshot {
    margin: 0 auto 2.5rem;
    max-width: 680px;
    width: 100%;
}

.ph-home-screenshot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #EDEDED;
    border: 2px dashed #BABABC;
    border-radius: 12px;
    padding: 3rem 2rem;
    min-height: 300px;
    color: #BABABC;
    font-size: 0.95rem;
    font-weight: 500;
}

.ph-home-screenshot-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.ph-home-description {
    font-size: 1.15rem;
    color: #555;
    line-height: 1.7;
    margin: 0 auto;
    max-width: 600px;
}

.ph-home-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    color: #999;
}

/* Home page responsive */
@media (max-width: 600px) {
    .ph-home-title {
        font-size: 2.25rem;
    }
    .ph-home-subtitle {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    .ph-home-content {
        padding: 2rem 1.25rem;
    }
    .ph-home-screenshot-placeholder {
        min-height: 200px;
        padding: 2rem 1rem;
    }
    .ph-home-description {
        font-size: 1rem;
    }
}

/* ===================================================================
   Viewer Page Layout (ViewerPage.razor)
   =================================================================== */
.ph-viewer-page {
    max-width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Split layout: AI chat left 1/3, PDF viewer right 2/3 */
.ph-viewer-split {
    display: flex;
    flex: 1;
    min-height: 0; /* Critical: allows flex children to shrink and scroll */
}

.ph-viewer-chat-panel {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    border-right: 1px solid var(--ph-color-border);
    display: flex;
    flex-direction: column;
    background: var(--ph-color-bg);
    overflow: hidden; /* Children handle their own scroll */
}

.ph-viewer-pdf-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Children handle their own scroll */
}

/* Mobile chat FAB + popup (hidden on desktop) */
.ph-mobile-chat-fab,
.ph-mobile-chat-overlay {
    display: none;
}


/* Chat title: short version hidden on desktop, shown on mobile */
.ph-chat-title-short {
    display: none;
}

/* Mobile: PDF takes full width, chat becomes FAB + popup */
@media (max-width: 767px) {
    .ph-viewer-page {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    .ph-viewer-split {
        flex-direction: column;
        height: auto;
    }
    .ph-viewer-pdf-panel {
        flex: none;
        min-height: auto;
    }

    /* Hide the inline chat panel on mobile — use FAB instead */
    .ph-viewer-chat-panel.ph-desktop-only {
        display: none !important;
    }

    /* Show mobile chat FAB */
    .ph-mobile-chat-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--ph-color-primary, #cc0000);
        color: #fff;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        cursor: pointer;
        z-index: 1000;
        transition: transform 0.2s, background 0.2s;
    }
    .ph-mobile-chat-fab:active {
        transform: scale(0.92);
    }
    .ph-mobile-chat-fab.open {
        background: #555;
    }

    /* Mobile chat overlay */
    .ph-mobile-chat-overlay {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: 0;
        z-index: 999;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.25s ease;
    }
    .ph-mobile-chat-overlay.open {
        pointer-events: auto;
        opacity: 1;
    }
    .ph-mobile-chat-overlay::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.25s ease;
    }
    .ph-mobile-chat-overlay.open::before {
        opacity: 1;
    }

    /* Mobile chat popup window */
    .ph-mobile-chat-popup {
        position: absolute;
        bottom: 84px;
        left: 12px;
        right: 12px;
        height: 65vh;
        max-height: calc(100vh - 100px);
        background: var(--ph-color-bg, #fff);
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        transform: translateY(20px) scale(0.95);
        transition: transform 0.25s ease, opacity 0.25s ease;
        opacity: 0;
    }
    .ph-mobile-chat-overlay.open .ph-mobile-chat-popup {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    /* Adjust chat component inside popup */
    .ph-mobile-chat-popup .ph-chat-inline {
        height: 100%;
        border-radius: 16px;
    }

    /* Hide thumbnails and fullscreen buttons on mobile */
    .ph-pdf-toolbar .ph-hide-mobile {
        display: none !important;
    }
    .ph-pdf-toolbar button[aria-label="Enter fullscreen"],
    .ph-pdf-toolbar button[aria-label="Exit fullscreen"] {
        display: none !important;
    }

    /* Mobile tabs: wrap into rows so all tabs are visible */
    .ph-viewer-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    .ph-tab {
        font-size: 0.8rem;
        padding: 8px 12px;
        white-space: nowrap;
    }

    /* Chat: shorter title and icon-only buttons on mobile */
    .ph-chat-title-full {
        display: none;
    }
    .ph-chat-title-short {
        display: inline;
    }
    .ph-chat-btn-label {
        display: none;
    }

    /* Chat input: prevent iOS zoom */
    .ph-chat-input {
        font-size: 16px;
    }
    .ph-chat-input-wrapper {
        align-items: center;
    }

    /* Version notice: allow wrapping */
    .ph-version-notice-inline {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
}

.ph-viewer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--ph-spacing-lg);
    background: #fafafa;
}

.ph-viewer-error {
    text-align: center;
    padding: var(--ph-spacing-xl);
    color: var(--ph-color-danger);
}

.ph-viewer-header {
    background: linear-gradient(135deg, #8b0000 0%, #cc0000 100%);
    color: #fff;
    padding: var(--ph-spacing-md) var(--ph-spacing-md);
    flex-shrink: 0;
}

.ph-viewer-header-content {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-lg);
    flex-wrap: wrap;
}

.ph-viewer-brand {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
    flex-shrink: 0;
}

.ph-viewer-logo-img {
    height: 48px;
    width: auto;
    filter: brightness(0) invert(1);
}

.ph-viewer-brand-text {
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.ph-viewer-brand-separator {
    opacity: 0.5;
    font-weight: 300;
}

.ph-viewer-brand-product {
    opacity: 0.85;
    font-weight: 400;
}

.ph-viewer-confidential {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    padding: 0.325rem var(--ph-spacing-md);
    text-align: center;
}

.ph-viewer-confidential svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.ph-viewer-proposal-info {
    display: flex;
    align-items: baseline;
    gap: var(--ph-spacing-md);
    flex-wrap: wrap;
    min-width: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    padding-left: var(--ph-spacing-lg);
}

.ph-viewer-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-viewer-client {
    font-size: 0.9375rem;
    opacity: 0.85;
    white-space: nowrap;
}

/* --- Share Button (viewer header) --- */
.ph-viewer-share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.ph-viewer-share-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #fff;
}

.ph-viewer-share-btn:active {
    transform: scale(0.97);
}

/* --- CTA Action Buttons (Accept / Request Changes / Decline) --- */
.ph-viewer-cta-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* When share button is also present, don't double up on margin-left */
.ph-viewer-share-btn + .ph-viewer-cta-buttons {
    margin-left: 0;
}

.ph-cta-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    white-space: nowrap;
    color: #fff;
}

.ph-cta-btn:active {
    transform: scale(0.97);
}

.ph-cta-accept {
    background: rgba(46, 125, 50, 0.85);
    border-color: rgba(255, 255, 255, 0.7);
}

.ph-cta-accept:hover {
    background: rgba(46, 125, 50, 1);
    border-color: #fff;
}

.ph-cta-changes {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
}

.ph-cta-changes:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #fff;
}

.ph-cta-decline {
    background: rgba(183, 28, 28, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

.ph-cta-decline:hover {
    background: rgba(183, 28, 28, 0.9);
    border-color: #fff;
}

/* --- Mobile/Desktop Visibility Utilities --- */
.ph-mobile-only {
    display: none !important;
}

/* --- Mobile Actions Dropdown --- */
.ph-mobile-actions {
    position: relative;
    align-self: center;
}

.ph-mobile-actions-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s, border-color 0.2s;
}

.ph-mobile-actions-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: #fff;
}

.ph-mobile-actions-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.ph-mobile-actions-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    min-width: 200px;
    z-index: 100;
    overflow: hidden;
}

.ph-mobile-action-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: #2D2E2C;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.ph-mobile-action-item:hover {
    background: #f5f5f5;
}

.ph-mobile-action-item + .ph-mobile-action-item {
    border-top: 1px solid #EDEDED;
}

.ph-mobile-action-accept svg {
    color: #2e7d32;
}

.ph-mobile-action-decline svg {
    color: #b71c1c;
}

/* --- Share Modal Overlay --- */
.ph-share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.ph-share-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.ph-share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #8b0000 0%, #cc0000 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.ph-share-modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.ph-share-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.ph-share-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.ph-share-modal-body {
    padding: 1.25rem;
}

.ph-share-description {
    color: #666;
    font-size: 0.875rem;
    margin: 0 0 1rem;
    line-height: 1.5;
}

.ph-share-recipient-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: flex-end;
}

.ph-share-field {
    flex: 1;
    min-width: 0;
}

.ph-share-field-email {
    flex: 1.4;
}

.ph-share-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ph-share-required {
    color: #cc0000;
}

.ph-share-field input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9375rem;
    color: #2D2E2C;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.ph-share-field input:focus {
    outline: none;
    border-color: #cc0000;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);
    background: #fff;
}

.ph-share-field input::placeholder,
.ph-share-field textarea::placeholder {
    color: #aaa;
}

.ph-share-note-field {
    margin-top: 0.75rem;
}

.ph-share-field textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #2D2E2C;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    resize: vertical;
}

.ph-share-field textarea:focus {
    outline: none;
    border-color: #cc0000;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);
    background: #fff;
}

.ph-share-remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.ph-share-remove-btn:hover {
    color: #cc0000;
    background: #fff0f0;
}

.ph-share-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    color: #cc0000;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.375rem 0;
    margin-bottom: 0.5rem;
}

.ph-share-add-btn:hover {
    text-decoration: underline;
}

.ph-share-error {
    color: #cc0000;
    font-size: 0.8125rem;
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.75rem;
    background: #fff0f0;
    border-radius: 6px;
}

.ph-share-success {
    color: #15803d;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.75rem;
    background: #f0fdf4;
    border-radius: 6px;
}

.ph-share-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #eee;
}

.ph-share-cancel-btn {
    padding: 0.5rem 1.25rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #555;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.ph-share-cancel-btn:hover {
    background: #f5f5f5;
}

.ph-share-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: #cc0000;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ph-share-send-btn:hover:not(:disabled) {
    background: #a00;
}

.ph-share-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile responsive share */
@media (max-width: 479px) {
    .ph-share-recipient-row {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        position: relative;
        padding-right: 2rem;
    }

    .ph-share-field-email {
        flex: 1;
    }

    .ph-share-remove-btn {
        position: absolute;
        top: 0;
        right: 0;
    }

    .ph-share-modal {
        max-width: 100%;
        border-radius: 12px;
    }

    .ph-share-modal-footer {
        flex-direction: column;
    }

    .ph-share-cancel-btn,
    .ph-share-send-btn {
        width: 100%;
        justify-content: center;
        padding: 0.625rem 1rem;
    }
}

/* Request New Link button on expired page */
.ph-request-link-btn {
    background-color: #A7252C;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Questrial', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s;
}

.ph-request-link-btn:hover:not(:disabled) {
    background-color: #8a1f24;
}

.ph-request-link-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ph-viewer-note {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    margin: 0;
    font-size: 0.9375rem;
    flex-shrink: 0;
}

/* --- Section Tabs --- */
.ph-viewer-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 2px solid var(--ph-color-border);
    background: var(--ph-color-bg);
    flex-shrink: 0;
}

.ph-viewer-tabs::-webkit-scrollbar {
    display: none;
}

.ph-tab {
    flex-shrink: 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    min-height: var(--ph-touch-min);
    white-space: nowrap;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.ph-tab:hover {
    color: var(--ph-color-text);
}

.ph-tab.active {
    color: #cc0000;
    border-bottom-color: #cc0000;
}

.ph-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background-color: #A7252C;
    border-radius: 10px;
    line-height: 1;
}

/* --- Viewer Content Area (Team/Questions tabs) --- */
.ph-viewer-content {
    padding: var(--ph-spacing-md);
    box-sizing: border-box;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* --- Viewer Footer --- */
.ph-viewer-footer {
    flex-shrink: 0;
    background: #2D2E2C;
    color: rgba(255, 255, 255, 0.75);
    padding: 0.375rem var(--ph-spacing-lg);
    border-top: 3px solid #A7252C;
}

.ph-viewer-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ph-spacing-md);
    flex-wrap: wrap;
}

.ph-viewer-footer-confidential {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.3;
    white-space: nowrap;
}

.ph-viewer-footer-confidential svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.ph-viewer-footer-brand {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.02em;
    white-space: nowrap;
    margin-left: auto;
}

@media (max-width: 767px) {
    .ph-viewer-footer-content {
        flex-direction: column;
        text-align: center;
    }

    .ph-viewer-footer-confidential {
        white-space: normal;
    }

    .ph-viewer-footer-brand {
        margin-left: 0;
    }
}

/* --- About Section --- */
.ph-about-section {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-about-content {
    line-height: 1.7;
    font-size: 1rem;
}

.ph-about-content img {
    max-width: 100%;
    height: auto;
}

.ph-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--ph-spacing-md);
}

/* ===================================================================
   Proposal Viewer (ProposalViewer.razor)
   =================================================================== */
.ph-proposal-viewer {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Video embed - responsive 16:9 */
.ph-proposal-video {
    margin-bottom: var(--ph-spacing-md);
}

.ph-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--ph-radius);
}

.ph-video-iframe {
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    height: calc(100% + 100px);
    border: none;
    z-index: 1;
}

/* Video loading placeholder — sits behind the iframe */
.ph-video-loading-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border-radius: var(--ph-radius);
    z-index: 0;
}

.ph-video-loading-placeholder .ph-branded-message-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ph-video-loading-placeholder .ph-branded-message-text {
    color: var(--ph-color-text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* Intro Video tab section */
.ph-intro-video-section {
    max-width: 960px;
    margin: 0 auto;
}

/* Video intro overlay — full-screen on first view */
.ph-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.ph-video-overlay-content {
    width: 100%;
    max-width: 960px;
    background: #fff;
    border-radius: var(--ph-radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.ph-video-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #A7252C;
    color: white;
}

.ph-video-overlay-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.05rem;
}

.ph-video-overlay-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.ph-video-overlay-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ph-video-overlay-body {
    padding: 20px;
    background: #1a1a1a;
}

.ph-video-overlay-footer {
    display: flex;
    justify-content: center;
    padding: 16px 20px;
    background: #fff;
}

.ph-video-dismiss-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    border: none;
    border-radius: var(--ph-radius);
    background: #A7252C;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ph-video-dismiss-btn:hover {
    background: #8c1f24;
}

/* Version bar */
.ph-proposal-version-bar {
    margin-bottom: var(--ph-spacing-md);
}

.ph-proposal-pdf {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ===================================================================
   Version Selector (VersionSelector.razor)
   =================================================================== */
.ph-version-selector {
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-sm);
}

.ph-version-notice {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--ph-radius-sm);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    font-size: 0.875rem;
    color: #991b1b;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ph-spacing-sm);
}

.ph-version-dropdown-container {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
    flex-wrap: wrap;
}

.ph-version-label {
    font-weight: 500;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.ph-version-dropdown {
    min-height: var(--ph-touch-min);
    padding: var(--ph-spacing-sm);
    font-size: 1rem;
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius-sm);
    background: var(--ph-color-bg);
    max-width: 100%;
}

/* ===================================================================
   PDF Viewer (PdfViewer.razor)
   =================================================================== */
.ph-pdf-viewer {
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ph-pdf-viewer.ph-pdf-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    border-radius: 0;
    border: none;
    background: var(--ph-color-bg);
}

/* PDF Toolbar */
.ph-pdf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ph-spacing-sm);
    padding: var(--ph-spacing-xs) var(--ph-spacing-sm);
    background: var(--ph-color-bg-muted);
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--ph-color-border);
    align-items: center;
}

.ph-pdf-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
    flex-wrap: wrap;
}

.ph-pdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-xs);
    flex-wrap: wrap;
}

.ph-version-notice-inline {
    font-size: 0.75rem;
    color: var(--ph-color-danger);
}

.ph-pdf-toolbar-nav {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-xs);
    flex-shrink: 0;
}

.ph-pdf-page-info {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.875rem;
}

.ph-pdf-page-input {
    width: 3rem;
    min-height: 2rem;
    text-align: center;
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius-sm);
    font-size: 0.875rem;
    padding: 0 0.25rem;
}

.ph-pdf-toolbar-zoom {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-xs);
    flex-shrink: 0;
}

.ph-pdf-zoom-level {
    font-size: 0.875rem;
    min-width: 2.5rem;
    text-align: center;
}

.ph-pdf-toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-xs);
    margin-left: auto;
    flex-wrap: wrap;
}

/* PDF Content Area */
.ph-pdf-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ph-pdf-thumbnails {
    width: 120px;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid var(--ph-color-border);
    background: var(--ph-color-bg-muted);
}

.ph-pdf-canvas-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #525659;
}

.ph-pdf-page {
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ph-pdf-page canvas {
    display: block;
}

.ph-pdf-loading,
.ph-pdf-error {
    text-align: center;
    padding: var(--ph-spacing-xl);
    color: var(--ph-color-text-muted);
}

.ph-pdf-error {
    color: var(--ph-color-danger);
}

/* ===================================================================
   Chat Panel (ServerChatPanel.razor) – inline, always visible
   =================================================================== */
.ph-chat-inline {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.ph-chat-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    border-bottom: 1px solid var(--ph-color-border);
    background: linear-gradient(135deg, #8b0000 0%, #cc0000 100%);
    color: #fff;
    flex-shrink: 0;
}

.ph-chat-inline-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    flex-shrink: 0;
}


.ph-chat-header-actions {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
}

/* Version badge: informational, non-interactive */
.ph-chat-version-badge {
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.125rem 0.375rem;
    border-radius: var(--ph-radius-sm);
    border: none;
    letter-spacing: 0.02em;
}

/* Model selector button in chat header */
.ph-chat-model-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: var(--ph-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.ph-chat-model-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.ph-chat-model-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ph-chat-model-btn svg {
    flex-shrink: 0;
}

/* Action buttons (Clear, Close): interactive, distinct from badge */
.ph-chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.9);
    color: #8b0000;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--ph-radius-sm);
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    min-height: 28px;
}

.ph-chat-action-btn:hover {
    background: #fff;
    transform: scale(1.05);
}

.ph-chat-action-btn:active {
    transform: scale(0.95);
}

/* Messages */
.ph-chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--ph-spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-md);
}

.ph-chat-loading,
.ph-chat-empty {
    text-align: center;
    padding: var(--ph-spacing-lg);
    color: var(--ph-color-text-muted);
    font-size: 0.9375rem;
}

.ph-chat-welcome {
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.ph-chat-welcome-icon {
    color: #A7252C;
    opacity: 0.8;
}

.ph-chat-welcome-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2D2E2C;
}

.ph-chat-welcome-description {
    margin: 0;
    font-size: 0.875rem;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

.ph-chat-welcome-suggestions {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ph-chat-welcome-suggestions li {
    font-size: 0.8125rem;
    color: #555;
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    border-radius: 8px;
    line-height: 1.4;
}

.ph-chat-welcome-suggestions li::before {
    content: "💬 ";
    font-size: 0.75rem;
}

.ph-chat-welcome-note {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: #666;
    text-align: center;
    line-height: 1.5;
    padding: 0.625rem 0.75rem;
    background: #faf5f5;
    border-left: 3px solid #A7252C;
    border-radius: 0 6px 6px 0;
    align-self: stretch;
}

.ph-chat-welcome-link {
    color: #A7252C;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.ph-chat-welcome-link:hover {
    color: #8a1e23;
}

.ph-chat-message {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-chat-user {
    align-self: flex-end;
}

.ph-chat-user .ph-chat-message-content {
    background: var(--ph-color-primary);
    color: #fff;
    border-radius: var(--ph-radius) var(--ph-radius) var(--ph-radius-sm) var(--ph-radius);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
}

.ph-chat-assistant .ph-chat-message-content {
    background: var(--ph-color-bg-muted);
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius) var(--ph-radius) var(--ph-radius) var(--ph-radius-sm);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
}

.ph-chat-message-header {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
    margin-bottom: var(--ph-spacing-xs);
}

.ph-chat-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ph-color-text-muted);
}

.ph-chat-copy-btn {
    margin-left: auto;
    padding: 2px;
    background: none;
    border: none;
    color: var(--ph-color-text-muted);
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.15s;
    line-height: 1;
    border-radius: 4px;
}

.ph-chat-message:hover .ph-chat-copy-btn {
    opacity: 0.7;
}

.ph-chat-copy-btn:hover {
    opacity: 1 !important;
    color: var(--ph-color-text);
}

.ph-chat-msg-version {
    font-size: 0.6875rem;
    background: var(--ph-color-bg-muted);
    padding: 0 0.25rem;
    border-radius: var(--ph-radius-sm);
    color: var(--ph-color-text-muted);
}

.ph-chat-message-content {
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Markdown content styling within chat messages */
.ph-chat-markdown p {
    margin: 0 0 0.5em 0;
}

.ph-chat-markdown p:last-child {
    margin-bottom: 0;
}

.ph-chat-markdown strong {
    font-weight: 600;
}

.ph-chat-markdown ul,
.ph-chat-markdown ol {
    margin: 0.25em 0 0.5em 0;
    padding-left: 1.5em;
}

.ph-chat-markdown li {
    margin-bottom: 0.2em;
}

.ph-chat-markdown h2,
.ph-chat-markdown h3,
.ph-chat-markdown h4 {
    margin: 0.75em 0 0.35em 0;
    font-weight: 600;
    line-height: 1.3;
}

.ph-chat-markdown h2 {
    font-size: 1.1em;
}

.ph-chat-markdown h3 {
    font-size: 1.0em;
}

.ph-chat-markdown h4 {
    font-size: 0.95em;
}

.ph-chat-markdown h2:first-child,
.ph-chat-markdown h3:first-child,
.ph-chat-markdown h4:first-child {
    margin-top: 0;
}

.ph-chat-markdown code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    font-size: 0.875em;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.ph-chat-markdown pre {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.75em 1em;
    border-radius: var(--ph-radius-sm);
    overflow-x: auto;
    margin: 0.5em 0;
}

.ph-chat-markdown pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}

.ph-chat-markdown blockquote {
    border-left: 3px solid var(--ph-color-primary);
    margin: 0.5em 0;
    padding: 0.25em 0.75em;
    color: var(--ph-color-text-muted);
}

.ph-chat-markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
    font-size: 0.875em;
}

.ph-chat-markdown th,
.ph-chat-markdown td {
    border: 1px solid var(--ph-color-border);
    padding: 0.35em 0.6em;
    text-align: left;
}

.ph-chat-markdown th {
    background: var(--ph-color-bg-muted);
    font-weight: 600;
}

.ph-chat-markdown hr {
    border: none;
    border-top: 1px solid var(--ph-color-border);
    margin: 0.75em 0;
}

.ph-chat-markdown img {
    max-width: 120px;
    height: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
    margin: 0.25em 0;
}

/* User messages: lighter code blocks to contrast blue background */
.ph-chat-user .ph-chat-markdown code {
    background: rgba(255, 255, 255, 0.2);
}

.ph-chat-user .ph-chat-markdown pre {
    background: rgba(255, 255, 255, 0.15);
}

.ph-chat-user .ph-chat-markdown blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.85);
}

.ph-chat-user .ph-chat-markdown th,
.ph-chat-user .ph-chat-markdown td {
    border-color: rgba(255, 255, 255, 0.3);
}

.ph-chat-user .ph-chat-markdown th {
    background: rgba(255, 255, 255, 0.1);
}

/* Mermaid chart rendering */
.ph-mermaid-chart {
    margin: var(--ph-spacing-sm) 0;
    padding: var(--ph-spacing-sm);
    background: #ffffff;
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    overflow-x: auto;
    text-align: center;
}

.ph-mermaid-chart svg {
    max-width: 100%;
    height: auto;
}

.ph-mermaid-error {
    border-left: 3px solid #d97706;
    opacity: 0.7;
}

.ph-mermaid-error-note {
    font-size: 0.75rem;
    color: #d97706;
    font-style: italic;
    margin-top: 0.25rem;
}

.ph-chat-streaming .ph-chat-cursor {
    animation: ph-blink 1s step-end infinite;
}

@keyframes ph-blink {
    50% { opacity: 0; }
}

.ph-chat-page-ref {
    color: var(--ph-color-primary);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dashed var(--ph-color-primary);
}

.ph-chat-page-ref:hover {
    text-decoration: none;
    border-bottom-style: solid;
    opacity: 0.85;
}

.ph-chat-questions-ref {
    color: var(--ph-color-primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.ph-chat-questions-ref:hover {
    color: #8a1e23;
}

/* Citations */
.ph-chat-citations {
    margin-top: var(--ph-spacing-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--ph-spacing-xs);
    align-items: center;
}

.ph-chat-citations-label {
    font-size: 0.75rem;
    color: var(--ph-color-text-muted);
    font-weight: 500;
}

.ph-chat-citation-link {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 9999px;
    color: var(--ph-color-primary);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    cursor: pointer;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
}

.ph-chat-citation-section {
    color: var(--ph-color-text-muted);
}

/* Chat Context Notices */
.ph-chat-context-notice,
.ph-chat-context-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.3;
    border-top: 1px solid var(--ph-color-border);
}

.ph-chat-context-notice {
    background: #f0f7ff;
    color: #4a5568;
}

.ph-chat-context-warning {
    background: #fff8e1;
    color: #7c6a0a;
}

.ph-chat-context-notice svg,
.ph-chat-context-warning svg {
    flex-shrink: 0;
}

.ph-chat-context-notice span,
.ph-chat-context-warning span {
    flex: 1;
}

.ph-chat-context-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: inherit;
    opacity: 0.6;
    flex-shrink: 0;
}

.ph-chat-context-dismiss:hover {
    opacity: 1;
}

.ph-chat-context-action {
    background: none;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    color: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.ph-chat-context-action:hover:not(:disabled) {
    background: rgba(0,0,0,0.05);
}

.ph-chat-context-action:disabled {
    opacity: 0.5;
    cursor: default;
}

.ph-chat-context-sep {
    font-size: 0.7rem;
    opacity: 0.6;
    flex-shrink: 0;
}

/* Chat Input */
.ph-chat-input-area {
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    border-top: 1px solid var(--ph-color-border);
    background: var(--ph-color-bg);
    flex-shrink: 0;
}

.ph-chat-input-wrapper {
    display: flex;
    gap: var(--ph-spacing-sm);
    align-items: center;
}

.ph-chat-input {
    flex: 1;
    height: var(--ph-touch-min);
    min-height: var(--ph-touch-min);
    max-height: var(--ph-touch-min);
    padding: 0.5rem var(--ph-spacing-md);
    font-size: 1rem; /* Prevents iOS zoom */
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    resize: none;
    box-sizing: border-box;
    line-height: 1.4;
}

.ph-chat-input:focus {
    outline: 2px solid var(--ph-color-primary);
    outline-offset: -1px;
    border-color: var(--ph-color-primary);
}

.ph-chat-send {
    min-height: var(--ph-touch-min);
    min-width: var(--ph-touch-min);
    padding: var(--ph-spacing-sm);
    background: var(--ph-color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--ph-radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.ph-chat-send:hover:not(:disabled) {
    background: var(--ph-color-primary-hover);
}

.ph-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ph-chat-send.ph-chat-cancel {
    background: #2D2E2C;
}

.ph-chat-send.ph-chat-cancel:hover {
    background: #444;
}

.ph-chat-status {
    color: #BABABC;
    font-style: italic;
    font-size: 0.875rem;
}

.ph-chat-error-content {
    background: #FFF5F5;
    border: 1px solid #E8CECE;
    border-radius: var(--ph-radius);
    padding: var(--ph-spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-sm);
}

.ph-chat-error-content .ph-chat-error-icon {
    color: #A7252C;
}

.ph-chat-error-content p {
    margin: 0;
    font-size: 0.875rem;
    color: #2D2E2C;
    line-height: 1.5;
}

.ph-chat-retry-btn {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #A7252C;
    color: white;
    border: none;
    border-radius: var(--ph-radius);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.ph-chat-retry-btn:hover {
    background: #8B1F25;
}

/* ===================================================================
   Proposal Actions (ProposalActions.razor)
   =================================================================== */
.ph-proposal-actions {
    margin-top: var(--ph-spacing-md);
}

.ph-actions-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ph-spacing-sm);
}

/* --- Modal --- */
.ph-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end; /* bottom sheet on mobile by default */
    justify-content: center;
    z-index: 200;
    padding: 0;
}

.ph-modal {
    background: var(--ph-color-bg);
    border-radius: var(--ph-radius) var(--ph-radius) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ph-modal-lg {
    /* Same as .ph-modal on mobile */
}

.ph-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--ph-spacing-md);
    border-bottom: 1px solid var(--ph-color-border);
    flex-shrink: 0;
}

.ph-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.ph-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    min-height: var(--ph-touch-min);
    min-width: var(--ph-touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ph-color-text-muted);
}

.ph-modal-body {
    padding: var(--ph-spacing-md);
    overflow-y: auto;
    flex: 1;
}

.ph-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--ph-spacing-sm);
    padding: var(--ph-spacing-md);
    border-top: 1px solid var(--ph-color-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ===================================================================
   Share Section (ShareSection.razor)
   =================================================================== */
.ph-share-section {
    margin-top: var(--ph-spacing-md);
}

.ph-share-form {
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    padding: var(--ph-spacing-md);
}

.ph-share-form h4 {
    margin: 0 0 var(--ph-spacing-xs);
    font-size: 1.125rem;
}

.ph-share-description {
    color: var(--ph-color-text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--ph-spacing-md);
}

.ph-share-actions {
    display: flex;
    gap: var(--ph-spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--ph-spacing-md);
}

/* ===================================================================
   Questions Section (QuestionsSection.razor)
   =================================================================== */
.ph-questions-section {
    max-width: 100%;
}

.ph-questions-section h3 {
    font-size: 1.25rem;
    margin-bottom: var(--ph-spacing-sm);
}

.ph-section-intro {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: var(--ph-spacing-lg);
}

.ph-question-form {
    margin-bottom: var(--ph-spacing-lg);
    padding-bottom: var(--ph-spacing-lg);
    border-bottom: 1px solid var(--ph-color-border);
}

.ph-question-list {
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-md);
}

.ph-question-thread {
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
}

.ph-question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--ph-spacing-sm);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    background: var(--ph-color-bg-muted);
}

.ph-question-meta {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.ph-question-author {
    font-weight: 600;
    font-size: 0.875rem;
    word-break: break-word;
}

.ph-question-date {
    font-size: 0.75rem;
    color: var(--ph-color-text-muted);
}

.ph-question-body {
    padding: var(--ph-spacing-md);
    font-size: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-question-response {
    background: var(--ph-color-bg-muted);
    border-top: 1px solid var(--ph-color-border);
    padding: var(--ph-spacing-md);
}

.ph-response-header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ph-spacing-sm);
    align-items: baseline;
    margin-bottom: var(--ph-spacing-sm);
}

.ph-response-author {
    font-size: 0.8rem;
    color: var(--ph-color-text-secondary, #555);
    font-style: italic;
}

.ph-response-date {
    font-size: 0.75rem;
    color: var(--ph-color-text-muted);
}

.ph-subsection-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--ph-spacing-md);
    color: var(--ph-color-text-primary, #2D2E2C);
}

/* ===================================================================
   Additional Files Section (AdditionalFilesSection.razor)
   =================================================================== */
.ph-additional-files-intro {
    color: #555;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: var(--ph-spacing-lg);
    max-width: 720px;
}

.ph-additional-files-list {
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-md);
}

.ph-additional-file-card {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-md);
    padding: var(--ph-spacing-md);
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
}

.ph-additional-file-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    color: #888;
}

.ph-additional-file-info {
    flex: 1;
    min-width: 0;
}

.ph-additional-file-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--ph-color-text-primary);
}

.ph-additional-file-title-link {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #cc0000;
    text-decoration: none;
}

.ph-additional-file-title-link:hover {
    text-decoration: underline;
}

.ph-additional-file-download {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #cc0000;
    transition: background-color 0.2s;
}

.ph-additional-file-download:hover {
    background-color: rgba(204, 0, 0, 0.08);
}

.ph-additional-file-description {
    font-size: 0.875rem;
    color: #555;
    margin: 0.25rem 0 0;
    line-height: 1.4;
}

.ph-additional-file-meta {
    font-size: 0.75rem;
    color: #999;
    display: block;
    margin-top: 0.25rem;
}

/* ===================================================================
   Case Studies Section (CaseStudiesSection.razor)
   =================================================================== */
.ph-case-studies-section h3 {
    font-size: 1.25rem;
    margin-bottom: var(--ph-spacing-md);
}

.ph-case-studies-intro {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: var(--ph-spacing-lg);
    max-width: 720px;
}

.ph-case-study-filters-row {
    display: flex;
    align-items: flex-start;
    gap: var(--ph-spacing-md);
    margin-bottom: var(--ph-spacing-md);
}

.ph-case-study-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    flex: 1;
}

.ph-case-study-search {
    flex-shrink: 0;
}

.ph-case-study-search-input {
    padding: 0.375rem 0.75rem;
    border: 1px solid #BABABC;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: 'Questrial', sans-serif;
    outline: none;
    width: 220px;
}

.ph-case-study-search-input:focus {
    border-color: #A7252C;
}

.ph-filter-tag {
    display: inline-block;
    font-size: 0.8125rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--ph-color-border);
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}

.ph-filter-tag:hover {
    border-color: #999;
    color: #333;
}

.ph-filter-tag-active {
    background: var(--ph-color-accent, #cc0000);
    border-color: var(--ph-color-accent, #cc0000);
    color: #fff;
}

.ph-filter-tag-active:hover {
    opacity: 0.9;
    color: #fff;
}

.ph-filter-tag-clear {
    background: transparent;
    border-color: transparent;
    color: #888;
    text-decoration: underline;
    font-size: 0.75rem;
}

.ph-filter-tag-clear:hover {
    color: #555;
}

.ph-case-study-no-results {
    color: #888;
    font-size: 0.9375rem;
    padding: var(--ph-spacing-md) 0;
}

.ph-case-study-cards {
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-md);
}

.ph-case-study-card {
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
}

.ph-case-study-card-inner {
    display: flex;
    align-items: flex-start;
    gap: var(--ph-spacing-md);
    padding: var(--ph-spacing-md);
}

.ph-case-study-logo {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--ph-color-bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ph-case-study-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ph-case-study-card-inner .ph-case-study-content {
    flex: 1;
    min-width: 0;
    border-top: none;
    padding: 0;
}

.ph-case-study-header {
    padding: var(--ph-spacing-md);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ph-case-study-header:active {
    background: var(--ph-color-bg-muted);
}

.ph-case-study-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ph-spacing-sm);
}

.ph-case-study-title-row h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.ph-expand-icon {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ph-color-text-muted);
    flex-shrink: 0;
    min-width: var(--ph-touch-min);
    min-height: var(--ph-touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ph-case-study-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ph-color-dark);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-case-study-client {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    margin: 4px 0 var(--ph-spacing-xs);
}

.ph-case-study-description,
.ph-case-study-desc {
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: var(--ph-spacing-xs) 0 var(--ph-spacing-sm);
    white-space: pre-line;
}

.ph-case-study-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ph-spacing-xs);
    margin-top: var(--ph-spacing-sm);
}

.ph-case-study-content {
    border-top: 1px solid var(--ph-color-border);
    padding: var(--ph-spacing-md);
}

.ph-case-study-body {
    line-height: 1.6;
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ph-case-study-body img {
    max-width: 100%;
    height: auto;
}

.ph-case-study-download {
    margin-top: var(--ph-spacing-md);
}

/* ===================================================================
   Solution Offerings Section (SolutionOfferingsSection.razor)
   =================================================================== */
.ph-solution-offerings-intro {
    color: #555;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: var(--ph-spacing-lg);
    max-width: 720px;
}

.ph-solution-offering-cards {
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-md);
}

.ph-solution-offering-card {
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
}

.ph-solution-offering-card.ph-solution-offering-primary {
    border-color: #cc0000;
    border-width: 2px;
}

.ph-solution-offering-card-inner {
    display: flex;
    align-items: flex-start;
    gap: var(--ph-spacing-md);
    padding: var(--ph-spacing-md);
}

.ph-solution-offering-content {
    flex: 1;
    min-width: 0;
}

.ph-solution-offering-header {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
    margin-bottom: 0.25rem;
}

.ph-solution-offering-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--ph-color-text-primary);
}

.ph-solution-offering-badge {
    display: inline-block;
    background: #cc0000;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    flex-shrink: 0;
}

.ph-solution-offering-description {
    color: #555;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0.25rem 0 0.5rem;
}

.ph-solution-offering-funding {
    background: #f8f5f0;
    border-left: 3px solid #cc0000;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: #444;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.ph-solution-offering-funding-label {
    font-weight: 600;
    margin-right: 0.25rem;
}

.ph-solution-offering-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.ph-solution-offering-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ===================================================================
   Team Section (TeamSection.razor)
   =================================================================== */
.ph-team-section .ph-section-title {
    font-size: 1.25rem;
}

.ph-team-intro {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: var(--ph-spacing-lg);
    max-width: 720px;
}

.ph-team-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--ph-spacing-md);
}

.ph-team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1.25rem;
    border: 1px solid var(--ph-color-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ph-team-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.ph-team-card-primary {
    border-color: var(--ph-color-primary);
    border-width: 2px;
    background: rgba(167, 37, 44, 0.02);
}

.ph-team-primary-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ph-color-primary);
    background: rgba(167, 37, 44, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-top: 0.25rem;
}

.ph-team-avatar {
    width: 96px;
    height: 96px;
    min-width: 96px;
    border-radius: 50%;
    background: var(--ph-color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.75rem;
    flex-shrink: 0;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ph-team-avatar-img {
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ph-team-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ph-team-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    word-break: break-word;
}

.ph-team-title {
    font-size: 0.875rem;
    color: var(--ph-color-text-muted);
    margin: 0.25rem 0 0.75rem;
}

.ph-team-recognitions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.ph-team-recognition {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f8f5f0;
    border: 1px solid #e8e4df;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: #444;
}

.ph-team-recognition-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.ph-team-recognition-name {
    font-weight: 500;
    white-space: nowrap;
}

a.ph-team-recognition-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.ph-team-recognition-link:hover {
    border-color: #cc0000;
    background: #fdf2f2;
}

.ph-team-contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ph-color-border);
    width: 100%;
}

.ph-team-email,
.ph-team-phone {
    font-size: 0.875rem;
    color: var(--ph-color-primary);
    text-decoration: none;
    word-break: break-all;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
}

.ph-team-email:hover,
.ph-team-phone:hover {
    text-decoration: underline;
}

.ph-team-description {
    font-size: 0.875rem;
    color: var(--ph-color-text-muted);
    margin: 0.25rem 0 var(--ph-spacing-sm);
    line-height: 1.4;
}

.ph-team-link {
    font-size: 0.85rem;
    color: var(--ph-color-primary);
    text-decoration: none;
    word-break: break-all;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.ph-team-link:hover {
    text-decoration: underline;
}

.ph-section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin: var(--ph-spacing-lg) 0 var(--ph-spacing-md);
    color: var(--ph-color-text-muted);
}

/* ===================================================================
   Materials Section (MaterialsSection.razor)
   =================================================================== */
.ph-materials-section .ph-section-title {
    font-size: 1.25rem;
}

.ph-materials-list {
    display: flex;
    flex-direction: column;
    gap: var(--ph-spacing-sm);
}

.ph-material-item {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
    padding: var(--ph-spacing-sm) var(--ph-spacing-md);
    border: 1px solid var(--ph-color-border);
    border-radius: var(--ph-radius);
    flex-wrap: wrap;
}

.ph-material-icon {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ph-color-text-muted);
    background: var(--ph-color-bg-muted);
    padding: 0.25rem 0.375rem;
    border-radius: var(--ph-radius-sm);
    flex-shrink: 0;
}

.ph-material-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.ph-material-name {
    font-size: 0.9375rem;
    font-weight: 500;
    word-break: break-word;
}

.ph-material-size {
    font-size: 0.75rem;
    color: var(--ph-color-text-muted);
}

.ph-material-actions {
    flex-shrink: 0;
}

/* ===================================================================
   RESPONSIVE BREAKPOINTS
   =================================================================== */

/* --- Small mobile: 320px–479px (default styles above cover this) --- */

/* Viewer header stacks on mobile */
@media (max-width: 479px) {
    .ph-viewer-header {
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
        padding: 0.5rem 0.75rem;
    }

    .ph-viewer-header-content {
        flex-direction: column;
        gap: 0.25rem;
    }

    .ph-viewer-brand {
        gap: var(--ph-spacing-xs);
    }

    .ph-viewer-brand-text {
        font-size: 1rem;
    }

    .ph-viewer-logo-img {
        height: 32px;
    }

    .ph-viewer-proposal-info {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 0.25rem;
        flex-direction: column;
        gap: 0.125rem;
    }

    .ph-viewer-title {
        font-size: 1rem;
    }

    .ph-viewer-client {
        font-size: 0.75rem;
    }

    .ph-viewer-confidential {
        font-size: 0.675rem;
        padding: 0.25rem 0.5rem;
    }

    /* Hide desktop buttons on mobile */
    .ph-desktop-only {
        display: none !important;
    }

    /* Show mobile actions dropdown */
    .ph-mobile-only {
        display: block !important;
    }

    /* Explicit order: logo/title → confidentiality → actions dropdown */
    .ph-viewer-header-content {
        order: 1;
    }

    .ph-viewer-confidential {
        order: 2;
    }

    .ph-mobile-actions {
        order: 3;
    }
}

/* Ensure action buttons stack on very narrow screens */
@media (max-width: 479px) {
    .ph-actions-buttons {
        flex-direction: column;
    }

    .ph-actions-buttons .ph-btn {
        width: 100%;
    }

    .ph-share-actions {
        flex-direction: column;
    }

    .ph-share-actions .ph-btn {
        width: 100%;
    }

    .ph-modal-footer {
        flex-direction: column-reverse;
    }

    .ph-modal-footer .ph-btn {
        width: 100%;
    }

    /* PDF toolbar: stack on small screens */
    .ph-pdf-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--ph-spacing-xs);
        flex-wrap: wrap;
    }

    .ph-pdf-toolbar-left,
    .ph-pdf-toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    /* Hide zoom percentage on very small screens */
    .ph-pdf-zoom-level {
        display: none;
    }

    /* Constrain version dropdown */
    .ph-version-dropdown {
        max-width: 120px;
    }

    /* Smaller button padding */
    .ph-btn-sm {
        padding: var(--ph-spacing-xs) var(--ph-spacing-xs);
    }
}

/* --- Tablet: 480px+ --- */
@media (min-width: 480px) {
    .ph-viewer-logo-img {
        height: 52px;
    }

    .ph-viewer-title {
        font-size: 1.375rem;
    }

    .ph-team-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .ph-material-item {
        flex-wrap: nowrap;
    }
}

/* --- Tablet landscape / small desktop: 768px+ --- */
@media (min-width: 768px) {
    .ph-viewer-header {
        padding: var(--ph-spacing-md) var(--ph-spacing-lg);
    }

    .ph-viewer-logo-img {
        height: 56px;
    }

    .ph-viewer-brand-text {
        font-size: 1.25rem;
    }

    .ph-viewer-title {
        font-size: 1.5rem;
    }

    .ph-viewer-content {
        padding: var(--ph-spacing-lg);
    }

    /* Modal becomes centered dialog instead of bottom sheet */
    .ph-modal-overlay {
        align-items: center;
        padding: var(--ph-spacing-lg);
    }

    .ph-modal {
        border-radius: var(--ph-radius);
        max-width: 480px;
    }

    .ph-modal-lg {
        max-width: 600px;
    }

    .ph-modal-footer {
        flex-direction: row;
    }

    .ph-modal-footer .ph-btn {
        width: auto;
    }

    /* PDF toolbar: single row */
    .ph-pdf-toolbar {
        flex-wrap: nowrap;
    }

    .ph-actions-buttons {
        flex-direction: row;
    }

    .ph-actions-buttons .ph-btn {
        width: auto;
    }

    .ph-share-actions {
        flex-direction: row;
    }

    .ph-share-actions .ph-btn {
        width: auto;
    }

    .ph-case-study-cards {
        gap: var(--ph-spacing-lg);
    }
}

/* --- Desktop: 1024px+ --- */
@media (min-width: 1024px) {
    .ph-viewer-logo-img {
        height: 60px;
    }

    .ph-viewer-brand-text {
        font-size: 1.375rem;
    }

    .ph-viewer-title {
        font-size: 1.625rem;
    }

    .ph-pdf-content {
        min-height: 0;
    }

    .ph-team-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

/* ===================================================================
   Branded Message (BrandedMessage.razor) — Expired/Error states
   =================================================================== */
.ph-branded-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--ph-spacing-lg);
    background: #fafafa;
}

.ph-branded-message-card {
    max-width: 520px;
    width: 100%;
    border-radius: var(--ph-radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    background: #fff;
}

.ph-branded-message-header {
    background: linear-gradient(135deg, #8b0000 0%, #cc0000 100%);
    padding: var(--ph-spacing-md) var(--ph-spacing-lg);
    display: flex;
    justify-content: center;
}

.ph-branded-message-brand {
    display: flex;
    align-items: center;
    gap: var(--ph-spacing-sm);
}

.ph-branded-message-logo-img {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
}

.ph-branded-message-brand-text {
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    font-size: 1.125rem;
    color: #fff;
    white-space: nowrap;
}

.ph-branded-message-separator {
    opacity: 0.5;
    font-weight: 300;
}

.ph-branded-message-product {
    opacity: 0.85;
    font-weight: 400;
}

.ph-branded-message-body {
    text-align: center;
    padding: var(--ph-spacing-xl) var(--ph-spacing-lg);
}

.ph-branded-message-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--ph-color-text);
    margin-bottom: var(--ph-spacing-sm);
}

.ph-branded-message-text {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: var(--ph-spacing-lg);
}

.ph-branded-message-contact {
    border-top: 1px solid var(--ph-color-border);
    padding-top: var(--ph-spacing-md);
    margin-top: var(--ph-spacing-md);
    font-size: 0.875rem;
    color: #666;
}

.ph-branded-message-contact a {
    color: #cc0000;
    text-decoration: none;
    font-weight: 500;
}

.ph-branded-message-contact a:hover {
    text-decoration: underline;
}

/* Self-service relink section */
.ph-relink-section {
    margin-bottom: var(--ph-spacing-lg);
}

.ph-relink-verify {
    text-align: center;
}

.ph-relink-prompt {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.ph-relink-hint {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: var(--ph-spacing-md);
}

.ph-relink-input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.ph-relink-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--ph-color-border);
    border-radius: 4px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.ph-relink-input:focus {
    border-color: #A7252C;
}

.ph-relink-error {
    color: #A7252C;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.ph-relink-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--ph-color-text);
    font-size: 0.95rem;
}

.ph-relink-loading {
    display: flex;
    justify-content: center;
    padding: var(--ph-spacing-md);
}

.ph-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ph-color-border);
    border-top-color: #A7252C;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===================================================================
   ADMIN MOBILE RESPONSIVE
   =================================================================== */

@media (max-width: 767px) {
    /* Hide non-essential DataGrid columns on mobile */
    .ph-admin-hide-mobile {
        display: none !important;
    }

    /* Ensure DataGrid horizontal scroll on mobile */
    .mud-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Reduce padding on mobile */
    .mud-paper.pa-6 {
        padding: 16px !important;
    }

    /* Ensure touch targets on icon buttons */
    .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Constrain dialogs on mobile screens */
@media (max-width: 599.95px) {
    mud-dialog {
        max-width: calc(100vw - 32px) !important;
        max-height: calc(100dvh - 32px) !important;
    }

    /* Stack dialog buttons vertically on small screens */
    mud-dialog .mud-dialog-actions {
        flex-direction: column;
        gap: 8px;
    }

    mud-dialog .mud-dialog-actions .mud-button-root {
        width: 100%;
    }
}

/* Normalize MudField height to match MudTextField/MudSelect outlined inputs */
.mud-field {
    min-height: 56px;
    display: flex;
    align-items: center;
}

/* Tab badge positioning — prevent clipping by scroll container (v9 class names) */
.mud-tabs .mud-tab .mud-badge {
    margin-left: -4px;
    margin-right: 4px;
}

.mud-tabs .mud-tabs-tabbar {
    overflow: visible;
    position: relative;
    z-index: 1;
}

.mud-tabs .mud-tabs-tabbar-content {
    overflow: visible;
}

.mud-tabs .mud-tabs-panels {
    position: relative;
    z-index: 0;
    padding-top: 16px;
}

/* Remove red focus outline from tab buttons */
.mud-tabs .mud-tab:focus-visible {
    outline: none;
}

/* Consistent admin page header — same h1 for both plain titles and breadcrumbs */
h1.ph-page-title {
    font-family: 'Museo', var(--mud-typography-default-family);
    font-size: 1.5rem;
    font-weight: 700;
    color: #2D2E2C;
    line-height: 1.3;
    margin: 0;
    padding: 0;
}

h1.ph-page-title .ph-page-title-link {
    font-weight: 400;
    color: #6c6c6c;
    text-decoration: none;
}

h1.ph-page-title .ph-page-title-link:hover {
    text-decoration: underline;
}

h1.ph-page-title .ph-page-title-separator {
    color: #6c6c6c;
    font-weight: 300;
    margin: 0 0.4rem;
}

h1.ph-page-title .ph-page-title-current {
    font-weight: 700;
    color: #2D2E2C;
}

/* AI query response markdown rendering */
.ph-ai-response {
    font-size: 0.875rem;
    line-height: 1.6;
}

.ph-ai-response h1,
.ph-ai-response h2,
.ph-ai-response h3 {
    margin: 0.75em 0 0.4em;
    font-weight: 600;
    color: #2D2E2C;
}

.ph-ai-response h2 {
    font-size: 1.1rem;
}

.ph-ai-response h3 {
    font-size: 1rem;
}

.ph-ai-response p {
    margin: 0.4em 0;
}

.ph-ai-response ul,
.ph-ai-response ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}

.ph-ai-response li {
    margin: 0.2em 0;
}

.ph-ai-response strong {
    font-weight: 600;
}

.ph-ai-response code {
    background: #f5f5f5;
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-size: 0.85em;
}

.ph-ai-response table {
    border-collapse: collapse;
    margin: 0.5em 0;
    width: 100%;
}

.ph-ai-response th,
.ph-ai-response td {
    border: 1px solid #e0e0e0;
    padding: 6px 10px;
    font-size: 0.85rem;
    text-align: left;
}

.ph-ai-response th {
    background: #f5f5f5;
    font-weight: 600;
}

/* ── Dashboard Overview ────────────────────────────────────────── */
.dash-overview {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0;
    margin-bottom: 32px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
    border: 1px solid #e8e8e8;
}

/* Hero — left column spanning both rows */
.dash-hero {
    grid-row: 1 / 3;
    display: flex;
    background: #2D2E2C;
    color: #fff;
    min-width: 220px;
    position: relative;
}

.dash-hero-accent {
    width: 5px;
    background: #A7252C;
    flex-shrink: 0;
}

.dash-hero-content {
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dash-hero-value {
    font-family: 'Museo', serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.dash-hero-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,.7);
    margin-top: 6px;
}

.dash-hero-sub {
    font-size: 0.8rem;
    color: rgba(255,255,255,.5);
    margin-top: 2px;
}

/* Stats panels — right column, stacked */
.dash-stats-panel {
    padding: 14px 24px;
    background: #fff;
}

.dash-stats-panel + .dash-stats-panel {
    border-top: 1px solid #EDEDED;
}

.dash-stats-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #BABABC;
    margin-bottom: 8px;
}

.dash-stats-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Individual stat chip */
.dash-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    background: #f9f9f9;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    min-width: 80px;
}

.dash-stat:hover {
    background: #EDEDED;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.dash-stat--active .dash-stat-count {
    color: #A7252C;
}

.dash-stat-count {
    font-family: 'Museo', serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: #2D2E2C;
}

.dash-stat-label {
    font-size: 0.72rem;
    color: #BABABC;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.dash-stat-amount {
    font-size: 0.7rem;
    font-weight: 600;
    color: #A7252C;
    margin-top: 1px;
}

/* ── AI Query Tab Responsive ────────────────────────────────── */
.ai-query-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-query-stats .dash-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.ai-query-stats .dash-stat {
    min-width: 0;
    padding: 8px 4px;
}

.ai-query-question {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

@media (max-width: 959px) {
    .ai-query-question {
        white-space: normal;
        max-width: none;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

@media (min-width: 960px) {
    .ai-query-stats .dash-stats-row {
        display: flex;
    }

    .ai-query-stats .dash-stat {
        padding: 8px 16px;
        min-width: 80px;
    }
}

/* ── Dashboard Activity ─────────────────────────────────────── */
.dash-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.dash-activity-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.dash-activity-table {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
}

.dash-activity-table .mud-table-head .mud-table-cell {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #BABABC;
    font-weight: 600;
    background: #fafafa;
    border-bottom: 1px solid #EDEDED;
}

.dash-activity-table .mud-table-body .mud-table-row:hover {
    background: #fafafa !important;
}

.dash-action-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.dash-user-system {
    color: #BABABC;
    font-style: italic;
}

/* Responsive: stack on small screens */
@media (max-width: 768px) {
    .dash-overview {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .dash-hero {
        grid-row: auto;
    }

    .dash-hero-content {
        padding: 20px 24px;
        text-align: center;
        align-items: center;
    }

    .dash-stats-row {
        justify-content: center;
    }
}