﻿/* === portal-ui-fixes overlay (synced from professional.css) === */
body.portal-pro { --pro-page-bg:#0b1220; --pro-surface:#111827; --pro-surface-elevated:#1e293b; --pro-surface-border:rgba(148,163,184,0.12); --pro-accent:#2dd4bf; --bg-primary:#0b1220; --bg-secondary:#0f172a; --bg-tertiary:#1e293b; --bg-card:rgba(30,41,59,0.72); --bg-hover:#334155; --border-color:rgba(148,163,184,0.14); background-color:var(--pro-page-bg)!important; }
/* ===== Unified main surfaces + UI polish (2026-07) ===== */

/* One page canvas for main content (expanded + default) — keep transparent so body atmosphere shows */
body.portal-pro main#mainContent.main-content,
body.portal-pro main#mainContent.main-content.expanded {
    background: transparent !important;
    background-color: transparent !important;
}

body.portal-pro .content-wrapper {
    background: transparent !important;
}

body.portal-pro .ticket-create-page,
body.portal-pro .ticket-create-card,
body.portal-pro .ticket-create-card-inner {
    background-color: transparent;
}

body.portal-pro .ticket-create-card {
    background: var(--pro-surface-elevated);
    border: 1px solid var(--pro-surface-border);
}

body.portal-pro .card-header,
body.portal-pro .table-wrap,
body.portal-pro .data-table thead th {
    background: transparent;
}

body.portal-pro .data-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.45);
}

/* Sidebar footer: same icon column as nav (under logo mark) */
body.portal-pro .sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 0.55rem 1rem;
}

body.portal-pro .sidebar-footer > .nav-link,
body.portal-pro .sidebar-footer .logout-btn {
    width: 100%;
    margin-inline: 0;
}

body.portal-pro .sidebar-footer .logout-form {
    width: 100%;
    margin-top: 0;
    display: flex;
    justify-content: stretch;
}

body.portal-pro .sidebar.collapsed .sidebar-footer {
    align-items: center;
    padding: 0.65rem 0.35rem 0.9rem;
    gap: 0.2rem;
}

body.portal-pro .sidebar.collapsed .sidebar-footer > .nav-link,
body.portal-pro .sidebar.collapsed .sidebar-footer .logout-btn {
    justify-content: center;
    align-self: center;
    width: auto;
    min-width: 2.5rem;
    padding: 0.72rem 0.5rem;
    margin: 0;
}

body.portal-pro .sidebar.collapsed:hover .sidebar-footer {
    align-items: stretch;
}

body.portal-pro .sidebar.collapsed:hover .sidebar-footer > .nav-link,
body.portal-pro .sidebar.collapsed:hover .sidebar-footer .logout-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    align-self: stretch;
}

/* Documents Index: hide header "Качи документ" (keep empty-state path) */
body.portal-pro.portal-client .content-wrapper > .page-header .page-header-actions > a.btn[href*="/Documents/Upload"],
body.portal-pro.portal-client .content-wrapper > .page-header .page-header-actions > a.btn[href*="Documents/Upload"] {
    display: none !important;
}

/* Ticket create help grid — equal columns */
body.portal-pro .ticket-create-help-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

body.portal-pro .ticket-create-help-grid > .card,
body.portal-pro .ticket-create-help-grid > .ticket-create-help-card {
    margin-top: 0 !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--pro-surface-elevated) !important;
    border: 1px solid var(--pro-surface-border);
    box-shadow: 0 4px 18px rgba(2, 6, 23, 0.22);
}

body.portal-pro .ticket-create-help-grid > .card > .card-header,
body.portal-pro .ticket-create-help-grid > .ticket-create-help-card > .card-header {
    background: transparent;
    border-bottom: 1px solid var(--pro-surface-border);
    padding: 1rem 1.15rem;
}

body.portal-pro .ticket-create-help-grid > .card > .card-body,
body.portal-pro .ticket-create-help-grid > .ticket-create-help-card > .card-body {
    flex: 1 1 auto;
    padding: 1rem 1.15rem 1.25rem;
    background: transparent;
}

@media (max-width: 768px) {
    body.portal-pro .ticket-create-help-grid {
        grid-template-columns: 1fr;
    }
}

/* Services Create — Advanced / Integrations */
body.portal-pro .service-integrations-section {
    margin: 1.25rem 0 1.5rem;
    padding: 0.85rem 1rem 1rem;
    border: 1px solid var(--pro-surface-border);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
}

body.portal-pro .service-integrations-summary {
    cursor: pointer;
    font-weight: 600;
    color: #e2e8f0;
    list-style: none;
}

body.portal-pro .service-integrations-summary::-webkit-details-marker {
    display: none;
}

body.portal-pro .service-integrations-summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.45rem;
    color: var(--pro-accent);
    transition: transform 0.15s ease;
}

body.portal-pro .service-integrations-section[open] .service-integrations-summary::before {
    transform: rotate(90deg);
}

body.portal-pro .service-integrations-help {
    margin: 0.65rem 0 1rem;
    color: #94a3b8;
    font-size: 0.875rem;
    line-height: 1.45;
}

body.portal-pro .service-integrations-section .form-group {
    margin-bottom: 0.85rem;
}

body.portal-pro .service-integrations-section .form-text,
body.portal-pro .service-integrations-section .text-muted {
    color: #64748b !important;
    font-size: 0.8rem;
}

/* Fallback when Views ACL-locked: clarify Monitoring/Settings URL fields */
body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="MonitoringUrl"]),
body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="SettingsUrl"]) {
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--pro-surface-border);
    background: rgba(15, 23, 42, 0.55);
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="MonitoringUrl"]) {
    margin-top: 1.25rem;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    padding-bottom: 0.35rem;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="SettingsUrl"]) {
    border-radius: 0 0 12px 12px;
    margin-bottom: 1.25rem;
    padding-top: 0.35rem;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="MonitoringUrl"])::before {
    content: "Разширени / интеграции (по желание)";
    display: block;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.45rem;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="MonitoringUrl"])::after {
    content: "Опционални връзки към Checkmk мониторинг и MSP панел за настройки. Оставете празни, ако не ползвате интеграции.";
    display: block;
    color: #94a3b8;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0.65rem;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="MonitoringUrl"]) label {
    font-size: 0;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="MonitoringUrl"]) label::after {
    content: "Мониторинг URL (Checkmk / мониторинг deep-link)";
    font-size: 0.95rem;
    color: #e2e8f0;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="SettingsUrl"]) label {
    font-size: 0;
}

body.portal-pro form:not(:has(.service-integrations-section)) .form-group:has(input[name="SettingsUrl"]) label::after {
    content: "Настройки URL (панел / управление)";
    font-size: 0.95rem;
    color: #e2e8f0;
}

/* Rename Табло → Контролен панел (sidebar + dashboard header) */
body.portal-pro .sidebar .nav-list > .nav-item:first-child > .nav-link > span {
    font-size: 0 !important;
    line-height: 0;
    width: 100%;
    text-align: center;
}

body.portal-pro .sidebar .nav-list > .nav-item:first-child > .nav-link > span::after {
    content: "Контролен панел";
    display: block;
    font-size: 0.78rem;
    line-height: 1.25;
    font-weight: 550;
    text-align: center;
    width: 100%;
}

body.portal-pro:has(.welcome-banner) .top-header .page-title {
    font-size: 0 !important;
    line-height: 0;
}

body.portal-pro:has(.welcome-banner) .top-header .page-title::after {
    content: "Контролен панел";
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #f1f5f9;
}

/* Ticket create: Ново запитване */
body.portal-pro .ticket-create-title {
    font-size: 0 !important;
    line-height: 0;
}

body.portal-pro .ticket-create-title::after {
    content: "Ново запитване";
    font-size: var(--font-3xl, 1.875rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary, #f1f5f9);
}

body.portal-pro .ticket-create-back span {
    font-size: 0 !important;
}

body.portal-pro .ticket-create-back span::after {
    content: "Към запитванията";
    font-size: 0.9rem;
}

body.portal-pro .ticket-create-submit {
    font-size: 0 !important;
}

body.portal-pro .ticket-create-submit [data-lucide],
body.portal-pro .ticket-create-submit i {
    width: 1rem;
    height: 1rem;
    margin-right: 0.35rem;
}

body.portal-pro .ticket-create-submit::after {
    content: "Изпрати запитване";
    font-size: 0.95rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    body.portal-pro .ticket-create-title::after {
        font-size: var(--font-2xl, 1.5rem);
    }
}

/* END unified-surfaces-ui-polish */

/* Auth login: never show Lucide over brand mark; keep title readable */
.auth-logo .auth-icon svg,
.auth-logo .auth-icon i,
.auth-logo .auth-icon [data-lucide],
.auth-logo .auth-icon.auth-brand-wrap > *:not(img) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.auth-logo .auth-icon.auth-brand-wrap,
.auth-logo .auth-icon:has(.auth-mark-img) {
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.18) 0%, rgba(15, 23, 42, 0) 70%) !important;
    box-shadow: none !important;
}

.auth-logo h1.auth-brand-title,
.auth-logo:has(.auth-mark-img) > h1 {
    display: block !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
    background: none !important;
}

/* ===== Mobile symmetry (equal left/right padding, stacked grids) ===== */
@media (max-width: 900px) {
    body.portal-pro .landing-features-grid {
        grid-template-columns: 1fr !important;
        max-width: 22rem;
        margin-inline: auto;
        width: 100%;
    }

    body.portal-pro .landing-feature-card {
        min-height: 0 !important;
    }

    body.portal-pro .landing-hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 20rem;
        margin-inline: auto;
    }

    body.portal-pro .landing-hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    html {
        overflow-x: hidden;
    }

    body.portal-pro {
        overflow-x: hidden;
    }

    body.portal-pro .content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: auto !important;
        padding: 1rem !important;
        box-sizing: border-box;
    }

    body.portal-pro .top-header {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.portal-pro .top-header .page-title {
        max-width: none !important;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    body.portal-pro .content-wrapper > .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    body.portal-pro .content-wrapper > .page-header .page-header-actions,
    body.portal-pro .page-header-actions {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    body.portal-pro .content-wrapper > .page-header .page-header-actions .btn,
    body.portal-pro .page-header-actions .btn,
    body.portal-pro .page-header-actions > .btn,
    body.portal-pro .page-header-actions .dropdown-toggle {
        width: auto !important;
        max-width: 100%;
        flex: 0 0 auto !important;
        justify-content: center;
        min-height: 2.35rem;
        padding: 0.4rem 0.9rem;
        font-size: 0.8125rem;
    }

    body.portal-pro .table-container,
    body.portal-pro .table-wrap {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100%;
        max-width: 100%;
    }

    body.portal-pro .auth-container {
        padding: 1rem !important;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    body.portal-pro .auth-card {
        margin: 0 auto !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 1.25rem !important;
    }

    body.portal-pro .auth-features {
        grid-template-columns: 1fr !important;
        gap: 0.85rem;
    }

    body.portal-pro .invite-auth-meta {
        grid-template-columns: 1fr !important;
    }

    body.portal-pro .landing-trust-inner {
        justify-content: center !important;
        overflow-x: visible !important;
        flex-wrap: wrap !important;
        padding-inline: 1rem;
    }

    body.portal-pro .hero-section-msp,
    body.portal-pro .hero-section {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.portal-pro .landing-features,
    body.portal-pro .landing-footer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.portal-pro .landing-nav .container {
        padding-left: 1rem;
        padding-right: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    body.portal-pro .ticket-create-actions {
        flex-direction: column;
        align-items: stretch;
    }

    body.portal-pro .ticket-create-actions .btn {
        width: 100%;
        justify-content: center;
    }

    body.portal-pro .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    body.portal-pro .filter-bar .form-control {
        width: 100%;
        min-width: 0;
    }

@media (max-width: 768px) {
    body.portal-pro .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    body.portal-pro .stat-card,
    body.portal-pro a.stat-card {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 0.55rem !important;
        padding: 1.1rem 0.85rem !important;
        min-height: 7.25rem;
    }

    body.portal-pro .stat-icon {
        margin: 0 auto !important;
        flex-shrink: 0;
    }

    body.portal-pro .stat-content {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 0.15rem;
    }

    body.portal-pro .stat-value,
    body.portal-pro .stat-label {
        width: 100%;
        text-align: center !important;
        margin: 0;
    }

    body.portal-pro .form-row,
    body.portal-pro .client-edit-grid,
    body.portal-pro .invite-auth-meta {
        grid-template-columns: 1fr !important;
    }

    body.portal-pro .notifications-dropdown,
    body.portal-pro .user-menu-dropdown {
        width: min(360px, calc(100vw - 2rem)) !important;
        right: 0;
        left: auto;
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 480px) {
    /* Keep 2×2 stats on phones — avoids tall stacked asymmetric cards */
    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100%;
        max-width: none;
        margin-inline: 0;
        gap: 0.65rem !important;
    }

    body.portal-pro .stat-card,
    body.portal-pro a.stat-card {
        min-height: 6.25rem;
        padding: 0.9rem 0.6rem !important;
    }

    body.portal-pro .content-wrapper {
        padding: 0.85rem !important;
    }
}

/* ===== Professional atmosphere canvas (Client + Admin) ===== */
body.portal-pro {
    --pro-page-bg: #0b1220 !important;
    --bg-primary: #0b1220 !important;
    --bg-secondary: #0f172a !important;
    --bg-card: rgba(30, 41, 59, 0.78) !important;
    background-color: #0b1220 !important;
    background-image:
        radial-gradient(ellipse 90% 55% at 12% -8%, rgba(45, 212, 191, 0.14), transparent 52%),
        radial-gradient(ellipse 70% 45% at 92% 8%, rgba(56, 189, 248, 0.08), transparent 50%),
        radial-gradient(ellipse 55% 40% at 78% 92%, rgba(15, 118, 110, 0.12), transparent 55%),
        linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, #070b14 0%, #0b1220 42%, #0f172a 100%) !important;
    background-size: auto, auto, auto, 48px 48px, 48px 48px, auto !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat, no-repeat !important;
}

body.portal-pro.portal-admin {
    background-image:
        radial-gradient(ellipse 90% 55% at 12% -8%, rgba(45, 212, 191, 0.12), transparent 52%),
        radial-gradient(ellipse 65% 42% at 94% 6%, rgba(125, 211, 252, 0.07), transparent 48%),
        radial-gradient(ellipse 55% 40% at 80% 94%, rgba(15, 118, 110, 0.11), transparent 55%),
        linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, #070b14 0%, #0b1220 42%, #0f172a 100%) !important;
}

body.portal-pro main#mainContent,
body.portal-pro main#mainContent.main-content,
body.portal-pro main#mainContent.main-content.expanded,
body.portal-pro .app-container {
    background: transparent !important;
    background-color: transparent !important;
}

body.portal-pro .sidebar {
    background: rgba(11, 18, 32, 0.88) !important;
    backdrop-filter: blur(16px) saturate(1.15);
    border-right: 1px solid rgba(148, 163, 184, 0.1);
}

body.portal-pro .top-header {
    background: rgba(11, 18, 32, 0.78) !important;
    backdrop-filter: blur(14px) saturate(1.1);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* Header dropdowns: solid opaque panels (no glass / see-through) */
body.portal-pro .notification-dropdown,
body.portal-pro .notifications-dropdown,
body.portal-pro .user-menu-dropdown,
body.portal-pro #notificationDropdown.notification-dropdown,
body.portal-pro #userMenuDropdown.user-menu-dropdown {
    background: #1e293b !important;
    background-color: #1e293b !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 16px 48px rgba(2, 6, 23, 0.55), 0 0 0 1px rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
}

body.portal-pro .notification-dropdown-header,
body.portal-pro .notifications-header,
body.portal-pro .user-menu-header {
    background: #0f172a !important;
    background-color: #0f172a !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    color: #f1f5f9;
}

body.portal-pro .notification-dropdown-body,
body.portal-pro .notifications-list {
    background: #1e293b;
}

body.portal-pro .user-menu-item {
    color: #e2e8f0;
}

body.portal-pro .user-menu-item:hover {
    background: #334155 !important;
    color: #f8fafc;
}

body.portal-pro .notification-dropdown-body .notification-item:hover {
    background: #334155;
}

body.portal-pro .card,
body.portal-pro .stat-card,
body.portal-pro .welcome-banner,
body.portal-pro .ticket-create-card,
body.portal-pro .auth-card {
    background: rgba(30, 41, 59, 0.78) !important;
    border: 1px solid rgba(148, 163, 184, 0.14);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 36px rgba(2, 6, 23, 0.28);
    box-sizing: border-box;
}

body.portal-pro .auth-container {
    background-color: #0b1220 !important;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 212, 191, 0.16), transparent 55%),
        radial-gradient(ellipse 55% 40% at 100% 100%, rgba(56, 189, 248, 0.08), transparent 50%),
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, #070b14 0%, #0b1220 50%, #0f172a 100%) !important;
    background-size: auto, auto, 48px 48px, 48px 48px, auto !important;
    background-attachment: fixed !important;
}

body.portal-pro .landing-page,
body.portal-pro .landing-page-msp {
    background:
        radial-gradient(ellipse 95% 60% at 50% -18%, rgba(45, 212, 191, 0.15), transparent 55%),
        radial-gradient(ellipse 50% 40% at 100% 30%, rgba(56, 189, 248, 0.07), transparent 50%),
        radial-gradient(ellipse 45% 35% at 0% 80%, rgba(15, 118, 110, 0.1), transparent 50%),
        linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, #070b14 0%, #0b1220 40%, #0f172a 100%) !important;
    background-size: auto, auto, auto, 48px 48px, 48px 48px, auto !important;
    background-attachment: fixed !important;
}

body.portal-pro .landing-nav {
    background: rgba(7, 11, 20, 0.82) !important;
    backdrop-filter: blur(14px);
}

body.portal-pro .landing-feature-card {
    background: rgba(30, 41, 59, 0.72) !important;
    backdrop-filter: blur(8px);
}

body.portal-pro .landing-footer {
    background: rgba(7, 11, 20, 0.92) !important;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

@media (prefers-reduced-motion: reduce) {
    body.portal-pro,
    body.portal-pro .auth-container,
    body.portal-pro .landing-page-msp {
        background-attachment: scroll !important;
    }
}

/* ===== Unified smartphone experience (Client + Admin) ===== */
@media (max-width: 768px) {
    body.portal-pro {
        --mobile-header-height: 56px;
    }

    body.portal-pro .sidebar {
        width: min(280px, 80vw);
        border-radius: 0 16px 16px 0;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    }

    body.portal-pro .sidebar-header {
        height: var(--mobile-header-height);
        padding: 0 1rem;
    }

    body.portal-pro .main-content,
    body.portal-pro .main-content.expanded {
        margin-left: 0 !important;
    }

    body.portal-pro .top-header {
        height: var(--mobile-header-height);
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    body.portal-pro .header-left,
    body.portal-pro .header-right {
        gap: 0.5rem;
    }

    body.portal-pro .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: rgba(30, 41, 59, 0.6);
        border: 1px solid rgba(148, 163, 184, 0.14);
    }

    body.portal-pro .page-title {
        font-size: 1rem;
        font-weight: 600;
        max-width: 42vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.portal-pro .content-wrapper {
        padding: 0.75rem;
    }

    body.portal-pro .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    body.portal-pro .stat-card {
        padding: 0.75rem;
        gap: 0.5rem;
        border-radius: 12px;
    }

    body.portal-pro .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    body.portal-pro .stat-value {
        font-size: 1.125rem;
    }

    body.portal-pro .stat-label {
        font-size: 0.6875rem;
    }

    body.portal-pro .card {
        border-radius: 12px;
        margin-bottom: 0.75rem;
    }

    body.portal-pro .card-header {
        padding: 0.75rem;
        gap: 0.5rem;
        flex-direction: column;
        align-items: stretch;
    }

    body.portal-pro .card-body {
        padding: 0.75rem;
    }

    body.portal-pro .card-title {
        font-size: 0.9375rem;
    }

    body.portal-pro .btn {
        min-height: 40px;
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
        border-radius: 10px;
    }

    body.portal-pro .form-control,
    body.portal-pro input,
    body.portal-pro select,
    body.portal-pro textarea {
        min-height: 44px;
        font-size: 16px;
        padding: 0.625rem 0.75rem;
        border-radius: 10px;
    }

    body.portal-pro .page-header {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    body.portal-pro .page-header-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    body.portal-pro .page-header-actions .btn,
    body.portal-pro .card-header .btn {
        flex: 0 0 auto;
        min-width: 0;
        width: auto;
    }

    body.portal-pro .table-wrap,
    body.portal-pro .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }

    body.portal-pro .data-table {
        min-width: unset;
    }

    body.portal-pro .data-table th,
    body.portal-pro .data-table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    body.portal-pro .user-menu-btn,
    body.portal-pro .notification-bell-btn {
        width: 40px;
        height: 40px;
    }

    body.portal-pro .user-menu-wrapper .user-info,
    body.portal-pro .user-menu-btn .user-info {
        display: none;
    }

    body.portal-pro .notification-dropdown,
    body.portal-pro .user-menu-dropdown {
        width: calc(100vw - 1.5rem);
        max-width: 320px;
        right: 0.75rem;
        left: auto;
    }
}

@media (max-width: 576px) {
    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.portal-pro .service-grid {
        grid-template-columns: 1fr;
    }

    body.portal-pro .page-title {
        font-size: 0.9375rem;
        max-width: none;
    }

    body.portal-pro .top-header {
        padding: 0 0.5rem;
    }

    body.portal-pro .content-wrapper {
        padding: 0.5rem;
    }

    body.portal-pro .card {
        border-radius: 10px;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 360px) {
    body.portal-pro .page-title {
        max-width: 28vw;
    }

    body.portal-pro .mobile-toggle {
        width: 36px;
        height: 36px;
    }

    body.portal-pro .stat-card {
        padding: 0.625rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    body.portal-pro .btn,
    body.portal-pro .nav-link,
    body.portal-pro .mobile-toggle,
    body.portal-pro .notification-bell-btn,
    body.portal-pro .user-menu-btn,
    body.portal-pro .language-btn,
    body.portal-pro .data-table tbody tr {
        min-height: 44px;
    }

    body.portal-pro .form-control,
    body.portal-pro input,
    body.portal-pro select,
    body.portal-pro textarea {
        font-size: 16px;
    }
}

/* ===== Professional forms & content blocks for phones ===== */
@media (max-width: 768px) {
    body.portal-pro .auth-container {
        padding: 0.5rem;
        align-items: center;
    }

    body.portal-pro .auth-card {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
        padding: 1.25rem;
        border-radius: 16px;
    }

    body.portal-pro .auth-logo h1,
    body.portal-pro .auth-brand-title {
        font-size: 1.5rem;
    }

    body.portal-pro .auth-form {
        width: 100%;
    }

    body.portal-pro .auth-features {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    body.portal-pro .auth-feature {
        flex: 1 1 120px;
        min-width: 0;
        text-align: center;
        font-size: 0.75rem;
    }

    body.portal-pro .form-group,
    body.portal-pro .ticket-create-field {
        margin-bottom: 1rem;
    }

    body.portal-pro .form-label,
    body.portal-pro .ticket-create-label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
        display: flex;
        align-items: center;
        gap: 0.375rem;
    }

    body.portal-pro .form-row,
    body.portal-pro .ticket-create-row {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    body.portal-pro .form-row .form-group,
    body.portal-pro .ticket-create-row .ticket-create-field {
        width: 100%;
        margin-bottom: 1rem;
    }

    body.portal-pro .form-check {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;
    }

    body.portal-pro .form-check-input {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    body.portal-pro .btn-block {
        display: block;
        width: 100%;
        justify-content: center;
    }

    body.portal-pro .ticket-create-page {
        padding: 0;
    }

    body.portal-pro .ticket-create-header {
        margin-bottom: 1rem;
    }

    body.portal-pro .ticket-create-title {
        font-size: 1.25rem;
    }

    body.portal-pro .ticket-create-subtitle {
        font-size: 0.8125rem;
    }

    body.portal-pro .ticket-create-card {
        margin-bottom: 1rem;
        border-radius: 14px;
    }

    body.portal-pro .ticket-create-card-inner {
        padding: 1rem;
    }

    body.portal-pro .ticket-create-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-top: 1rem;
    }

    body.portal-pro .ticket-create-actions .btn {
        width: 100%;
        justify-content: center;
    }

    body.portal-pro .detail-block,
    body.portal-pro .section-gap,
    body.portal-pro .info-grid,
    body.portal-pro .detail-grid {
        margin: 1rem 0;
    }

    body.portal-pro .info-grid,
    body.portal-pro .detail-grid {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    body.portal-pro .welcome-banner {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    body.portal-pro .welcome-title {
        font-size: 1.25rem;
    }

    body.portal-pro .welcome-subtitle {
        font-size: 0.8125rem;
    }

    body.portal-pro .filter-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    body.portal-pro .filter-bar .form-control,
    body.portal-pro .filter-bar .btn {
        width: 100%;
    }

    body.portal-pro .kb-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    body.portal-pro .kb-card {
        padding: 0.75rem;
    }

    body.portal-pro .service-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    body.portal-pro .service-item {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }

    body.portal-pro .invoice-summary {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    body.portal-pro .invoice-total {
        text-align: center;
    }

    body.portal-pro .empty-state {
        padding: 2rem 1rem;
        text-align: center;
    }

    body.portal-pro .empty-state i,
    body.portal-pro .empty-state [data-lucide] {
        width: 3rem;
        height: 3rem;
        margin: 0 auto 1rem;
    }

    body.portal-pro .page-header {
        margin-bottom: 1rem;
    }

    body.portal-pro .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    body.portal-pro .form-actions .btn,
    body.portal-pro .auth-form .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    body.portal-pro .auth-card {
        padding: 1rem;
        border-radius: 12px;
    }

    body.portal-pro .auth-logo h1,
    body.portal-pro .auth-brand-title {
        font-size: 1.25rem;
    }

    body.portal-pro .auth-feature {
        flex: 1 1 100px;
    }

    body.portal-pro .ticket-create-card-inner {
        padding: 0.875rem;
    }

    body.portal-pro .ticket-create-title {
        font-size: 1.125rem;
    }

    body.portal-pro .detail-block,
    body.portal-pro .section-gap,
    body.portal-pro .info-grid,
    body.portal-pro .detail-grid {
        margin: 0.75rem 0;
    }

    body.portal-pro .service-grid {
        grid-template-columns: 1fr;
    }

    body.portal-pro .welcome-title {
        font-size: 1.125rem;
    }
}

@media (max-width: 360px) {
    body.portal-pro .auth-card {
        padding: 0.75rem;
    }

    body.portal-pro .form-label,
    body.portal-pro .ticket-create-label {
        font-size: 0.8125rem;
    }

    body.portal-pro .auth-feature {
        flex-basis: 100%;
    }
}

/* =====================================================================
   DESKTOP SYMMETRY LAYER — shared by Client + Admin portals
   Keep this file byte-identical between both portals.
   Sections:
     1. Shared design tokens
     2. Page shell rhythm
     3. Symmetrical stat grids
     4. Equal-height cards
     5. Tables
     6. Forms
     7. Buttons
     8. Focus / accessibility
   ===================================================================== */

/* --- 1. Shared design tokens --- */
body.portal-pro {
    --ui-gap: 1.25rem;
    --ui-radius: 14px;
    --ui-radius-sm: 10px;
    --ui-pad-card: 1.15rem;
    --ui-control-h: 42px;
    --ui-max-width: 1200px;
}

/* Tokens shrink on phones so every section scales together */
@media (max-width: 768px) {
    body.portal-pro {
        --ui-gap: 0.75rem;
        --ui-radius: 12px;
        --ui-radius-sm: 10px;
        --ui-pad-card: 0.85rem;
        --ui-control-h: 44px;
    }
}

@media (max-width: 576px) {
    body.portal-pro {
        --ui-gap: 0.625rem;
        --ui-radius: 10px;
        --ui-pad-card: 0.75rem;
    }
}

/* --- 2. Page shell rhythm --- */
@media (min-width: 769px) {
    body.portal-pro .content-wrapper {
        max-width: var(--ui-max-width);
        margin-inline: auto;
        padding: 1.5rem;
        gap: var(--ui-gap);
    }

    body.portal-pro .content-wrapper > .page-header {
        align-items: center;
        gap: 0.75rem 1rem;
    }

    body.portal-pro .content-wrapper > * {
        min-width: 0;
    }
}

/* --- 3. Symmetrical stat grids (no orphan cards) --- */
body.portal-pro .stats-grid {
    display: grid;
    gap: var(--ui-gap);
    align-items: stretch;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
}

@media (min-width: 993px) {
    /* Exact column counts so every row is full and balanced */
    body.portal-pro .stats-grid:has(> :nth-child(2):last-child) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.portal-pro .stats-grid:has(> :nth-child(3):last-child),
    body.portal-pro .stats-grid:has(> :nth-child(6):last-child),
    body.portal-pro .stats-grid:has(> :nth-child(9):last-child) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.portal-pro .stats-grid:has(> :nth-child(4):last-child),
    body.portal-pro .stats-grid:has(> :nth-child(8):last-child) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

body.portal-pro .stats-grid > .stat-card {
    margin-top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: var(--ui-pad-card);
    border-radius: var(--ui-radius);
    min-width: 0;
}

body.portal-pro .stat-card .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--ui-radius-sm);
    flex-shrink: 0;
}

body.portal-pro .stat-card .stat-content {
    min-width: 0;
}

body.portal-pro .stat-card .stat-value {
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

body.portal-pro .stat-card .stat-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 4. Equal-height cards in any grid --- */
body.portal-pro .dashboard-grid,
body.portal-pro .kb-grid,
body.portal-pro .service-grid,
body.portal-pro .ticket-create-help-grid {
    align-items: stretch;
    gap: var(--ui-gap);
}

body.portal-pro .dashboard-grid > .card,
body.portal-pro .kb-grid > .card,
body.portal-pro .service-grid > .card,
body.portal-pro .ticket-create-help-grid > .card {
    margin-top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body.portal-pro .card {
    border-radius: var(--ui-radius);
}

body.portal-pro .card > .card-header {
    padding: 0.9rem var(--ui-pad-card);
}

@media (min-width: 769px) {
    body.portal-pro .card > .card-header {
        min-height: 3.35rem;
        align-items: center;
    }
}

body.portal-pro .card > .card-body {
    flex: 1 1 auto;
    padding: var(--ui-pad-card);
}

body.portal-pro .card > .card-footer {
    padding: 0.9rem var(--ui-pad-card);
    margin-top: auto;
}

/* --- 5. Tables --- */
body.portal-pro .data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

body.portal-pro .data-table th,
body.portal-pro .data-table td {
    vertical-align: middle;
}

@media (min-width: 769px) {
    body.portal-pro .data-table th,
    body.portal-pro .data-table td {
        padding: 0.7rem 0.9rem;
    }
}

body.portal-pro .data-table th {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    white-space: nowrap;
}

body.portal-pro .data-table td.num,
body.portal-pro .data-table th.num,
body.portal-pro .data-table .text-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

body.portal-pro .data-table tbody tr {
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* --- 6. Forms --- */
body.portal-pro .form-group {
    margin-bottom: 1.15rem;
}

body.portal-pro .form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #cbd5e1;
}

body.portal-pro .form-control {
    width: 100%;
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-sm);
    padding: 0.55rem 0.8rem;
}

body.portal-pro textarea.form-control {
    min-height: 7rem;
    resize: vertical;
}

@media (min-width: 769px) {
    body.portal-pro .form-row,
    body.portal-pro .ticket-create-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 var(--ui-gap);
        align-items: start;
    }

    body.portal-pro .form-row > .form-group,
    body.portal-pro .ticket-create-row > .ticket-create-field {
        min-width: 0;
    }
}

body.portal-pro .form-actions,
body.portal-pro .ticket-create-actions {
    display: flex;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

@media (min-width: 769px) {
    body.portal-pro .form-actions,
    body.portal-pro .ticket-create-actions {
        align-items: center;
    }
}

body.portal-pro .validation-summary-errors,
body.portal-pro .field-validation-error {
    border-radius: var(--ui-radius-sm);
}

/* --- 7. Buttons --- */
body.portal-pro .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: var(--ui-control-h);
    padding: 0.5rem 1.05rem;
    border-radius: var(--ui-radius-sm);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

body.portal-pro .btn-sm {
    min-height: 34px;
    padding: 0.3rem 0.75rem;
    font-size: 0.8125rem;
}

body.portal-pro .btn-lg {
    min-height: 48px;
    padding: 0.7rem 1.4rem;
}

body.portal-pro .btn [data-lucide],
body.portal-pro .btn svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* .btn is inline-flex above; block buttons must stay full-width flex */
body.portal-pro .btn.btn-block {
    display: flex;
    width: 100%;
}

/* --- 8. Focus / accessibility --- */
body.portal-pro .btn:focus-visible,
body.portal-pro .form-control:focus-visible,
body.portal-pro .nav-link:focus-visible,
body.portal-pro a:focus-visible,
body.portal-pro button:focus-visible {
    outline: 2px solid var(--pro-accent);
    outline-offset: 2px;
}

/* =====================================================================
   9. LIST / INDEX PAGE SYMMETRY
   Makes Services, Invoices, Documents, Assets, Tickets, Clients and every
   other index page share one identical skeleton, whether or not the page
   has export buttons, filters or an empty state.
   ===================================================================== */

/* 9a. Page header — same height on every page, with or without actions */
body.portal-pro .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    min-height: var(--ui-control-h);
}

body.portal-pro .page-header > .page-title {
    margin: 0;
    min-width: 0;
}

body.portal-pro .page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

/* An empty actions container must not add width, height or gap */
body.portal-pro .page-header-actions:empty {
    display: none;
}

/* 9b. Card headers — bare text and .card-title look identical */
body.portal-pro .card > .card-header {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #f1f5f9;
}

body.portal-pro .card > .card-header > .card-title,
body.portal-pro .card > .card-header > h1,
body.portal-pro .card > .card-header > h2,
body.portal-pro .card > .card-header > h3 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    color: inherit;
}

/* 9c. Table shell — identical on every list page */
body.portal-pro .table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body.portal-pro .card > .table-wrap {
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

body.portal-pro .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--pro-surface-elevated);
}

/* 9d. Actions column — compact on desktop, never narrower than the button */
body.portal-pro .data-table th.actions,
body.portal-pro .data-table td.actions {
    width: 1%;
    min-width: 7.5rem;
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}

body.portal-pro .data-table td.actions > .actions-row {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 0.4rem;
    max-width: 100%;
}

/* Replaces per-view inline styles */
body.portal-pro .actions-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

body.portal-pro .actions-row--end {
    justify-content: flex-end;
}

body.portal-pro .actions-row--center {
    justify-content: center;
}

body.portal-pro .actions-row .btn-sm {
    min-width: 5.25rem;
    justify-content: center;
}

/* 9e. Badges — equal width so status columns form a clean vertical line */
body.portal-pro .data-table .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 6.5rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* 9f. Filter bars — uniform control widths on both portals.
   Client pages use .filter-bar; Admin pages use .filter-card > .form-inline. */
body.portal-pro .filter-bar,
body.portal-pro .form-inline {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

body.portal-pro .filter-bar {
    padding: var(--ui-pad-card);
}

body.portal-pro .filter-card {
    margin-bottom: 0;
}

body.portal-pro .filter-card > .card-body {
    padding: var(--ui-pad-card);
}

body.portal-pro .filter-bar .form-group,
body.portal-pro .form-inline .form-group {
    margin-bottom: 0;
    min-width: 0;
    flex: 1 1 13.75rem;
}

/* Beats the inline style="min-width:220px" still present in some views */
body.portal-pro .filter-bar .form-control,
body.portal-pro .filter-bar select.form-control,
body.portal-pro .form-inline .form-control,
body.portal-pro .form-inline select.form-control {
    width: 100%;
    min-width: 0 !important;
}

body.portal-pro .filter-bar .btn,
body.portal-pro .form-inline .btn {
    flex: 0 0 auto;
}

/* 9g. Empty states — identical composition on every page */
body.portal-pro .empty-state > .actions-row {
    justify-content: center;
    margin-top: 0.65rem;
}

/* 9h. Phone: card layout owns tables — do NOT force wide min-width or negative margins */
@media (max-width: 768px) {
    body.portal-pro .data-table thead th {
        position: static;
    }

    body.portal-pro .data-table .badge {
        min-width: 5.25rem;
        font-size: 0.7rem;
    }

    body.portal-pro .actions-row .btn-sm {
        min-width: 0;
    }

    body.portal-pro .page-header {
        min-height: 0;
    }
}

/* === 10. Inline-style safety net for guaranteed phone symmetry ===
   Any remaining inline style="..." layout declarations that could break
   the unified mobile layout are neutralized at smartphone widths.
   Cosmetic-only inline styles (color, font-size, spacing) are left alone.
*/
@media (max-width: 768px) {
    body.portal-pro [style*="display: grid"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    body.portal-pro [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    body.portal-pro [style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    body.portal-pro [style*="min-width:"] {
        min-width: 0 !important;
    }

    body.portal-pro [style*="max-width:"] {
        max-width: 100% !important;
    }

    body.portal-pro [style*="min-width: 200px"] {
        min-width: 100% !important;
    }
}

/* === 11. Phone list pages: force full-width blocks and center === */
@media (max-width: 480px) {
    body.portal-pro .content-wrapper,
    body.portal-pro .content-wrapper > .page-header,
    body.portal-pro .content-wrapper > .card,
    body.portal-pro .content-wrapper > .stats-grid {
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: 0 !important;
    }
}

/* Page title in list pages should wrap and use full width on phones */
body.portal-pro .content-wrapper > .page-header .page-title {
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

@media (max-width: 768px) {
    body.portal-pro .content-wrapper > .page-header .page-title {
        text-align: center;
    }
}

/* === 12. Header user avatar + list card headers — centered, professional === */
body.portal-pro .user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-secondary));
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(2, 6, 23, 0.35);
    text-transform: uppercase;
    flex-shrink: 0;
    box-sizing: border-box;
}

@media (max-width: 576px) {
    body.portal-pro .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }

    body.portal-pro .user-menu-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
    }

    body.portal-pro .user-menu-btn .user-info,
    body.portal-pro .user-menu-btn .user-menu-arrow {
        display: none;
    }

    body.portal-pro .card-header {
        justify-content: center;
    }

    body.portal-pro .card-title {
        width: 100%;
        text-align: center;
    }
}

/* === 13. Tables turn into professional cards on phones; filter forms stack === */
@media (max-width: 768px) {
    body.portal-pro .data-table {
        min-width: 0 !important;
        width: 100%;
        display: block;
        border-collapse: collapse;
    }

    body.portal-pro .data-table thead {
        display: none;
    }

    body.portal-pro .data-table tbody,
    body.portal-pro .data-table tbody tr,
    body.portal-pro .data-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    body.portal-pro .data-table tbody tr {
        margin-bottom: 1rem;
        padding: 0.75rem;
        border: 1px solid rgba(148, 163, 184, 0.14);
        border-radius: 12px;
        background: rgba(30, 41, 59, 0.55);
    }

    body.portal-pro .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.55rem 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.08);
        font-size: 0.875rem;
    }

    body.portal-pro .data-table td:last-child {
        border-bottom: none;
    }

    body.portal-pro .data-table td::before {
        content: attr(data-title);
        font-weight: 600;
        font-size: 0.75rem;
        color: #94a3b8;
        flex-shrink: 0;
        text-transform: none;
    }

    body.portal-pro .data-table td[data-title=""]::before,
    body.portal-pro .data-table td:not([data-title])::before {
        content: none;
    }

    /* Actions: full-width footer row — centered "Детайли" (Documents/Assets/Services) */
    body.portal-pro .data-table th.actions,
    body.portal-pro .data-table td.actions,
    body.portal-pro .data-table tbody td.actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: center !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        white-space: normal !important;
        text-align: center !important;
        padding: 0.85rem 0 0.15rem !important;
        margin: 0.15rem 0 0 !important;
        border-top: 1px solid rgba(148, 163, 184, 0.12);
        border-bottom: none !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    body.portal-pro .data-table td.actions::before {
        content: none !important;
        display: none !important;
    }

    body.portal-pro .data-table td.actions > .actions-row,
    body.portal-pro .data-table td.actions .actions-row,
    body.portal-pro .data-table .actions .actions-row,
    body.portal-pro .data-table .actions .actions-row--end,
    body.portal-pro .data-table .actions-row--end {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        left: auto !important;
        right: auto !important;
        position: relative !important;
    }

    body.portal-pro .data-table .actions .actions-row .btn,
    body.portal-pro .data-table .actions .actions-row .btn-sm,
    body.portal-pro .data-table td.actions .btn {
        flex: 1 1 auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        text-align: center !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: auto !important;
        transform: none !important;
    }

    body.portal-pro .table-wrap,
    body.portal-pro .card > .table-wrap {
        margin-inline: 0 !important;
        padding-inline: 0.75rem !important;
        overflow-x: visible !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    body.portal-pro .form-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    body.portal-pro .form-inline .form-group,
    body.portal-pro .form-inline .btn {
        width: 100%;
    }
}

/* === Export dropdown + mobile symmetry (2026-08) === */
body.portal-pro .page-header-actions .dropdown {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}

body.portal-pro .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.5rem;
}

/* Гарантирана симетрия: "Назад", "Свали фактура" и редовите действия за фактура
   винаги с еднаква височина, независимо от текст/икони. */
body.portal-pro .page-header-actions .btn,
body.portal-pro .page-header-actions .dropdown-toggle,
body.portal-pro .invoice-actions .btn,
body.portal-pro .invoice-actions .dropdown-toggle {
    height: 2.75rem;
    box-sizing: border-box;
}
body.portal-pro .page-header-actions form.inline-form,
body.portal-pro .invoice-actions form.inline-form {
    display: inline-flex;
    align-items: stretch;
}
body.portal-pro .invoice-actions .btn.btn-sm,
body.portal-pro .invoice-actions .dropdown-toggle.btn-sm {
    height: 2.25rem;
}

body.portal-pro .dropdown-toggle [data-lucide] {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

body.portal-pro .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 13rem;
    padding: 0.35rem;
    background: var(--pro-surface-elevated);
    border: 1px solid var(--pro-surface-border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
    list-style: none;
    z-index: 1200;
    overflow: hidden;
}

body.portal-pro .dropdown.open .dropdown-menu {
    display: block;
}

body.portal-pro .dropdown-menu-end {
    right: 0;
    left: auto;
}

body.portal-pro .dropdown-menu li {
    margin: 0;
    padding: 0;
}

body.portal-pro .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.875rem;
    white-space: nowrap;
}

body.portal-pro .dropdown-item [data-lucide] {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

body.portal-pro .dropdown-item:hover,
body.portal-pro .dropdown-item:focus {
    background: rgba(45, 212, 191, 0.12);
    color: #2dd4bf;
}

body.portal-pro .page-header {
    gap: 0.75rem 1rem;
    align-items: center;
}

body.portal-pro .page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    body.portal-pro .page-header {
        flex-direction: column;
        align-items: center;
    }

    body.portal-pro .page-header-actions {
        width: 100%;
        justify-content: center;
    }

    body.portal-pro .page-header-actions .btn,
    body.portal-pro .page-header-actions .dropdown-toggle {
        width: auto;
        flex: 0 0 auto;
        min-height: 2.35rem;
        padding: 0.4rem 0.85rem;
    }

    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    body.portal-pro .stat-card {
        padding: 0.75rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    body.portal-pro .table-wrap {
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Keep card layout — do not force a wide min-width that breaks mobile actions */
    body.portal-pro .data-table {
        min-width: 0 !important;
    }
}

@media (max-width: 576px) {
    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.portal-pro .page-header-actions .dropdown {
        width: auto;
        display: inline-flex;
    }

    body.portal-pro .page-header-actions .dropdown-toggle {
        width: auto;
        justify-content: center;
    }

    body.portal-pro .dropdown-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        min-width: 0;
        width: auto;
    }
}

/* === Final polish: visible text + symmetrical header buttons (2026-08) === */
body.portal-pro .page-title {
    line-height: 1.25;
    word-break: break-word;
}

body.portal-pro .page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

body.portal-pro .page-header-actions > .btn,
body.portal-pro .page-header-actions .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.5rem;
    white-space: nowrap;
}

body.portal-pro .page-header-actions .dropdown-toggle {
    min-width: 8rem;
}

body.portal-pro .page-header-actions .btn [data-lucide],
body.portal-pro .page-header-actions .dropdown-toggle [data-lucide] {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

body.portal-pro .actions-row--end {
    justify-content: flex-end;
}

@media (min-width: 769px) {
    body.portal-pro .data-table .actions .actions-row .btn {
        flex: 0 0 auto;
        min-width: max-content;
        min-height: 2rem;
        padding: 0.45rem 0.65rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }
}

body.portal-pro .data-table .actions .actions-row .btn [data-lucide] {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

body.portal-pro .card-title {
    word-break: break-word;
    line-height: 1.35;
}

@media (max-width: 768px) {
    body.portal-pro .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    body.portal-pro .page-title {
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        font-size: var(--font-lg);
    }

    body.portal-pro .page-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    body.portal-pro .page-header-actions > .btn,
    body.portal-pro .page-header-actions .dropdown-toggle {
        min-height: 2.75rem;
    }
}

@media (max-width: 576px) {
    body.portal-pro .page-header-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
    }

    body.portal-pro .page-header-actions > .btn,
    body.portal-pro .page-header-actions .dropdown,
    body.portal-pro .page-header-actions .dropdown-toggle {
        width: auto !important;
        flex: 0 0 auto !important;
    }

    body.portal-pro .page-header-actions .dropdown {
        display: inline-flex;
    }
}

/* ===== 2026-08 mobile polish batch (authoritative) ===== */

/* Sidebar toggle sizing (visibility rules below by breakpoint) */
body.portal-pro .sidebar-toggle,
body.portal-pro button.sidebar-toggle,
#sidebarToggle.sidebar-toggle {
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    line-height: 0 !important;
}

body.portal-pro .sidebar-toggle i,
body.portal-pro .sidebar-toggle svg,
body.portal-pro .sidebar-toggle [data-lucide],
#sidebarToggle.sidebar-toggle i,
#sidebarToggle.sidebar-toggle svg,
#sidebarToggle.sidebar-toggle [data-lucide] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    width: 1.1rem !important;
    height: 1.1rem !important;
    flex-shrink: 0;
}

/* Mobile: always show in-sidebar toggle (unchanged) */
@media (max-width: 992px) {
    body.portal-pro .sidebar-toggle,
    body.portal-pro button.sidebar-toggle,
    body.portal-pro .sidebar-header .sidebar-toggle,
    #sidebarToggle.sidebar-toggle {
        display: inline-flex !important;
    }
}

/* Desktop: hide collapse toggle until sidebar is expanded (hover or pinned open) */
@media (min-width: 993px) {
    body.portal-pro .sidebar.collapsed .sidebar-header .sidebar-toggle,
    body.portal-pro .sidebar.collapsed #sidebarToggle.sidebar-toggle {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.portal-pro .sidebar.collapsed:hover .sidebar-header .sidebar-toggle,
    body.portal-pro .sidebar.collapsed:hover #sidebarToggle.sidebar-toggle,
    body.portal-pro .sidebar:not(.collapsed) .sidebar-header .sidebar-toggle,
    body.portal-pro .sidebar:not(.collapsed) #sidebarToggle.sidebar-toggle {
        display: inline-flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}

body.sidebar-mobile-open {
    overflow: hidden;
}

body.portal-pro .sidebar-overlay {
    z-index: 90;
    pointer-events: none;
}

body.portal-pro .sidebar-overlay.active {
    pointer-events: auto;
}

body.portal-pro .sidebar {
    z-index: 110;
}

body.portal-pro .sidebar .nav-link,
body.portal-pro .sidebar .nav-link span,
body.portal-pro .sidebar .nav-link svg {
    pointer-events: auto;
}

@media (max-width: 992px) {
    body.portal-pro .sidebar {
        pointer-events: none;
    }
    body.portal-pro .sidebar.open {
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    /* Page header CTA: compact + centered */
    body.portal-pro .content-wrapper > .page-header,
    body.portal-pro .page-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 0.75rem;
    }

    body.portal-pro .page-header .page-title,
    body.portal-pro .top-header .page-title {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        text-align: center;
        width: 100%;
    }

    body.portal-pro .page-header-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }

    body.portal-pro .page-header-actions > .btn,
    body.portal-pro .page-header-actions > a.btn,
    body.portal-pro .page-header-actions .btn-primary,
    body.portal-pro .page-header-actions .dropdown,
    body.portal-pro .page-header-actions .dropdown-toggle {
        width: auto !important;
        max-width: max-content !important;
        flex: 0 0 auto !important;
        min-height: 2.25rem !important;
        padding: 0.4rem 0.85rem !important;
        font-size: 0.8125rem !important;
        justify-content: center;
        white-space: nowrap;
    }

    body.portal-pro .page-header-actions .dropdown-menu {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    /* Stats: 2x2, centered content */
    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
        width: 100%;
    }

    body.portal-pro .stats-grid > .stat-card,
    body.portal-pro .stat-card,
    body.portal-pro a.stat-card {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 0.45rem !important;
        padding: 0.95rem 0.65rem !important;
        min-height: 6.5rem;
        height: auto !important;
    }

    body.portal-pro .stat-card .stat-icon,
    body.portal-pro .stat-icon {
        margin: 0 auto !important;
        order: 0;
    }

    body.portal-pro .stat-card .stat-content,
    body.portal-pro .stat-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100%;
        min-width: 0;
    }

    body.portal-pro .stat-value,
    body.portal-pro .stat-label {
        text-align: center !important;
        width: 100%;
        margin: 0;
    }

    body.portal-pro .stat-label {
        line-height: 1.3;
        max-width: 11rem;
        margin-inline: auto;
    }

    /* Tables: equal padding + clean scroll */
    body.portal-pro .table-wrap,
    body.portal-pro .table-container {
        margin-inline: 0 !important;
        padding-inline: 0 !important;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    /* Notification dropdown */
    body.portal-pro .notification-bell-wrapper {
        position: static;
    }

    body.portal-pro #notificationDropdown.notification-dropdown,
    body.portal-pro .notification-dropdown {
        position: fixed !important;
        top: calc(var(--header-height, 56px) + 0.5rem) !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
        width: min(22rem, calc(100vw - 1.5rem)) !important;
        max-width: calc(100vw - 1.5rem) !important;
        max-height: min(70vh, 28rem);
        border-radius: 14px;
        z-index: 300;
    }

    body.portal-pro .notification-dropdown-header {
        padding: 0.9rem 1rem;
        gap: 0.75rem;
        align-items: center;
    }

    body.portal-pro .notification-dropdown-header strong {
        font-size: 0.95rem;
    }

    body.portal-pro .notification-view-all {
        font-size: 0.8125rem !important;
        font-weight: 600;
        padding: 0.35rem 0.55rem;
        min-height: 2rem;
        display: inline-flex;
        align-items: center;
        border-radius: 8px;
        background: rgba(45, 212, 191, 0.1);
        text-decoration: none !important;
    }

    body.portal-pro .notification-dropdown-body .notification-item {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
        min-height: 3.25rem;
    }
}

@media (max-width: 480px) {
    body.portal-pro .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Notifications index — desktop centered, mobile balanced */
body.portal-pro .content-wrapper:has(.notification-page-list),
body.portal-pro .content-wrapper:has(.notification-page-item) {
    max-width: 760px;
    margin-inline: auto;
}

body.portal-pro .notification-page-item {
    width: 100%;
    display: flex !important;
    align-items: flex-start;
    text-align: left;
    border-radius: 12px;
    padding: 1rem 1.1rem !important;
    gap: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(30, 41, 59, 0.55);
    margin-bottom: 0.55rem;
    cursor: pointer;
}

body.portal-pro .notification-page-li {
    border: none !important;
    padding: 0 !important;
}

body.portal-pro .notification-page-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(45, 212, 191, 0.12);
}

body.portal-pro .notification-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
    align-items: center;
}

@media (max-width: 768px) {
    body.portal-pro .content-wrapper:has(.notification-page-list),
    body.portal-pro .content-wrapper:has(.notification-page-item) {
        max-width: 100%;
    }

    body.portal-pro .notification-page-item {
        flex-direction: row;
        align-items: flex-start;
        padding: 0.9rem !important;
    }

    body.portal-pro .notification-page-meta {
        width: 100%;
    }
}

/* =====================================================================
   14. DOCUMENTS — Detail / Upload symmetry (Client + Admin)
   Reuses list-page skeleton; adds readable form + detail layout.
   ===================================================================== */

body.portal-pro .detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1.1rem;
}

body.portal-pro .detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    padding: 0.8rem 0.95rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

body.portal-pro .detail-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

body.portal-pro .detail-value {
    color: #e2e8f0;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
}

body.portal-pro .detail-block {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

body.portal-pro .detail-block > .detail-value,
body.portal-pro .detail-block > p {
    margin: 0.4rem 0 0;
}

body.portal-pro .content-wrapper:has(.documents-form-card),
body.portal-pro .content-wrapper:has(.documents-detail) {
    max-width: 960px;
    margin-inline: auto;
    width: 100%;
}

body.portal-pro .documents-form-card {
    margin-top: 0;
}

body.portal-pro .documents-upload-lead {
    margin: 0 0 1.25rem;
    line-height: 1.6;
    max-width: 42rem;
}

body.portal-pro .documents-upload-hint {
    margin: 0.4rem 0 0;
    font-size: 0.8125rem;
}

body.portal-pro .documents-form-actions {
    margin-top: 1.35rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

body.portal-pro .documents-detail {
    align-items: stretch;
}

body.portal-pro .documents-detail > .col-8,
body.portal-pro .documents-detail > .col-4 {
    min-width: 0;
}

body.portal-pro .documents-detail .detail-table {
    width: 100%;
}

body.portal-pro .documents-detail-actions {
    margin-top: 1.15rem;
    flex-wrap: wrap;
}

body.portal-pro .documents-detail-actions .btn,
body.portal-pro .documents-form-actions .btn {
    min-height: 2.4rem;
}

body.portal-pro .documents-detail-actions .inline-form {
    display: inline-flex;
}

@media (max-width: 768px) {
    body.portal-pro .content-wrapper:has(.documents-form-card),
    body.portal-pro .content-wrapper:has(.documents-detail) {
        max-width: 100%;
    }

    body.portal-pro .detail-grid {
        grid-template-columns: 1fr;
    }

    body.portal-pro .documents-detail {
        grid-template-columns: 1fr !important;
    }

    body.portal-pro .documents-detail > .col-8,
    body.portal-pro .documents-detail > .col-4 {
        grid-column: span 12;
        width: 100%;
    }

    body.portal-pro .documents-form-actions,
    body.portal-pro .documents-detail-actions {
        justify-content: center !important;
        width: 100%;
    }

    body.portal-pro .documents-form-actions .btn,
    body.portal-pro .documents-detail-actions .btn {
        flex: 1 1 auto;
        min-width: min(100%, 9rem);
        justify-content: center;
    }

    body.portal-pro .documents-upload-lead {
        text-align: center;
        margin-inline: auto;
    }

    body.portal-pro .documents-detail .card + .card {
        margin-top: 0.85rem;
    }
}

/* 2FA recommendation / short lesson (invite + setup) */
body.portal-pro .security-lesson {
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    background: linear-gradient(160deg, rgba(240, 253, 250, 0.95), rgba(236, 254, 255, 0.75));
    color: #0f172a;
}

body.portal-pro .security-lesson--page {
    margin-bottom: 1.5rem;
}

body.portal-pro .security-lesson-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f766e;
}

body.portal-pro .security-lesson-lead,
body.portal-pro .security-lesson-note {
    margin: 0 0 0.65rem;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #334155;
}

body.portal-pro .security-lesson-note {
    margin-bottom: 0;
    font-size: 0.85rem;
    color: #475569;
}

body.portal-pro .security-lesson-list,
body.portal-pro .security-lesson-steps {
    margin: 0 0 0.65rem;
    padding-left: 1.15rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #334155;
}

body.portal-pro .security-lesson-list li + li,
body.portal-pro .security-lesson-steps li + li {
    margin-top: 0.35rem;
}

body.portal-pro .invite-auth-hint {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #64748b;
}

body.portal-pro .setup2fa-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    align-items: start;
}

body.portal-pro .setup2fa-qr svg {
    display: block;
    max-width: 180px;
    height: auto;
}

body.portal-pro .font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
}

@media (max-width: 640px) {
    body.portal-pro .setup2fa-layout {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    body.portal-pro .setup2fa-secret {
        width: 100%;
        text-align: left;
    }
}

/* === Mobile table actions — final cascade win (Documents / Assets / Services) === */
@media (max-width: 768px) {
    body.portal-pro .data-table {
        min-width: 0 !important;
        width: 100% !important;
        display: block !important;
    }

    body.portal-pro .data-table tbody,
    body.portal-pro .data-table tbody tr {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body.portal-pro .data-table tbody td.actions {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        text-align: center !important;
        overflow: visible !important;
    }

    body.portal-pro .data-table tbody td.actions .actions-row,
    body.portal-pro .data-table tbody td.actions .actions-row--end {
        justify-content: center !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
    }

    body.portal-pro .data-table tbody td.actions .btn {
        width: 100% !important;
        max-width: 100% !important;
        left: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        transform: none !important;
    }
}



/* === 2026-08 header symmetry + hide duplicate top title (authoritative) === */
/* Hide duplicate page title in top header (title lives in main content) */
body.portal-pro .top-header .page-title,
body.portal-pro .top-header h1.page-title {
    display: none !important;
}

body.portal-pro .top-header {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-left: max(1rem, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(1rem, env(safe-area-inset-right, 0px)) !important;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between !important;
}

body.portal-pro .top-header .header-left,
body.portal-pro .top-header .header-right {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    min-width: 0;
    overflow: visible !important;
}

body.portal-pro .top-header .header-left {
    justify-content: flex-start;
    gap: 0.5rem;
}

body.portal-pro .top-header .header-right {
    justify-content: flex-end;
    gap: 0.5rem;
    margin-right: 0 !important;
    padding-right: 0 !important;
    margin-left: auto;
}

/* Desktop: no hamburger (sidebar is always available) */
@media (min-width: 993px) {
    body.portal-pro .top-header .mobile-toggle,
    body.portal-pro .top-header #mobileToggle {
        display: none !important;
    }

    /* If header-left only had title/toggle, collapse empty left slot */
    body.portal-pro .top-header .header-left:not(:has(.mobile-toggle:not([style*="display: none"]))) {
        display: none !important;
    }

    body.portal-pro .top-header {
        justify-content: flex-end !important;
    }
}

/* Mobile/tablet: ALWAYS show the menu button (supports old header-left AND new header-right layouts) */
@media (max-width: 992px) {
    body.portal-pro .top-header .header-left {
        display: flex !important;
    }

    body.portal-pro .top-header .mobile-toggle,
    body.portal-pro .top-header #mobileToggle,
    body.portal-pro .top-header .header-left .mobile-toggle,
    body.portal-pro .top-header .header-right .mobile-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        background: rgba(30, 41, 59, 0.85) !important;
        border: 1px solid rgba(148, 163, 184, 0.22) !important;
        color: #e2e8f0 !important;
        z-index: 5 !important;
        position: relative !important;
    }

    /* New layout: toggle is first child of header-right — pin it left */
    body.portal-pro .top-header .header-right:has(> .mobile-toggle) {
        width: 100%;
        justify-content: flex-end;
    }

    body.portal-pro .top-header .header-right > .mobile-toggle {
        margin-right: auto !important;
        order: -1;
    }
}

body.portal-pro .top-header .notification-bell-btn,
body.portal-pro .top-header .user-menu-btn {
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

body.portal-pro .top-header .user-avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

@media (max-width: 768px) {
    body.portal-pro .top-header {
        height: var(--mobile-header-height, 56px);
        padding-left: max(0.875rem, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(0.875rem, env(safe-area-inset-right, 0px)) !important;
    }

    body.portal-pro .top-header .mobile-toggle,
    body.portal-pro .top-header .notification-bell-btn,
    body.portal-pro .top-header .user-menu-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    body.portal-pro .top-header .user-avatar {
        width: 32px !important;
        height: 32px !important;
    }

    body.portal-pro .top-header .user-menu-btn .user-info,
    body.portal-pro .top-header .user-menu-btn .user-menu-arrow {
        display: none !important;
    }

    /* Documents / list pages: centered header + full action buttons */
    body.portal-pro .content-wrapper > .page-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 0.75rem;
    }

    body.portal-pro .content-wrapper > .page-header .page-title {
        display: block !important;
        width: 100%;
        text-align: center;
    }

    body.portal-pro .content-wrapper > .page-header .page-header-actions {
        width: 100%;
        justify-content: center !important;
        margin-left: 0 !important;
    }

    body.portal-pro .data-table tbody td.actions,
    body.portal-pro .data-table tbody td.actions .actions-row,
    body.portal-pro .data-table tbody td.actions .btn {
        left: auto !important;
        right: auto !important;
        margin-left: 0 !important;
        transform: none !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    body.portal-pro .data-table tbody td.actions .actions-row {
        justify-content: center !important;
        width: 100% !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    body.portal-pro .data-table tbody td.actions .btn {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 7.5rem;
        justify-content: center !important;
    }
}

@media (max-width: 576px) {
    body.portal-pro .top-header {
        /* Override older 0.5rem padding that clipped the avatar */
        padding-left: max(0.875rem, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(0.875rem, env(safe-area-inset-right, 0px)) !important;
    }
}

