/**
 * NIKOGREEN — Customer Portal (matches admin dashboard shell)
 * One sidebar + one header. Mobile bottom nav on phones/tablets.
 */

:root {
    --portal-bg: var(--light, #fdfdfd);
    --portal-surface: var(--surface, #ffffff);
    --portal-border: var(--border, #eaeaea);
    --portal-text: var(--dark, #1a1a1a);
    --portal-muted: var(--gray, #6c757d);
    --portal-brand: var(--primary, #e63946);
    --portal-brand-dark: var(--primary-dark, #c92f3b);
    --portal-brand-light: var(--primary-muted, #fff0f1);
    --portal-radius: 14px;
    --portal-radius-lg: 14px;
    --portal-shadow: var(--shadow-md, 0 4px 24px rgba(15, 23, 42, 0.06));
    --portal-shadow-lg: var(--shadow-lg, 0 20px 50px rgba(15, 23, 42, 0.1));
}

body.portal-mode .portal-topbar,
body.portal-mode .portal-topbar-nav,
body.portal-mode #clientServicesStripWrap,
body.portal-mode #clientPortalWrap {
    display: none !important;
}

body.portal-mode #portalWelcomeBanner,
body.portal-mode #portalQuickActions {
    display: block !important;
}

body.portal-mode .portal-page-header.client-only {
    display: block !important;
}

/* ── Same shell as admin client view ── */
body.portal-mode {
    background: var(--light, #f1f5f9);
    font-family: 'Inter', system-ui, sans-serif;
}

body.portal-mode .sidebar,
body.portal-mode #sidebar {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

body.portal-mode .header {
    display: flex !important;
    align-items: center;
    gap: 12px;
}

body.portal-mode .header-title {
    flex: 1;
    min-width: 0;
}

body.portal-mode .header-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark, #0f172a);
    letter-spacing: -0.02em;
}

body.portal-mode .header-title p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--gray, #64748b);
    font-weight: 500;
}

body.portal-mode .mobile-menu-btn {
    display: none;
}

body.portal-mode.client-mode .main-content {
    margin-left: 280px !important;
    max-width: none;
    width: auto !important;
    padding: 28px 32px !important;
    min-height: 100vh;
    background: var(--light, #f1f5f9);
}

body.portal-mode .admin-only:not(.auth-keep-visible),
body.portal-mode .view-toggle.admin-only,
body.portal-mode #adminLoginGate,
body.portal-mode #adminAuthActions,
body.portal-mode #adminLogoutBtn,
body.portal-mode #adminProfileWrap,
body.portal-mode .sidebar-auth.admin-nav,
body.portal-mode #sidebarAdminLogoutBtn,
body.portal-mode .sidebar-auth.client-only-nav,
body.portal-mode #sidebarOpsFooter {
    display: none !important;
}

body.portal-mode #portalAdminLink {
    display: none !important;
}

@media (max-width: 1024px) {
    body.portal-mode .mobile-menu-btn {
        display: flex !important;
    }

    body.portal-mode.client-mode .main-content {
        margin-left: 0 !important;
        padding: 16px 16px 88px !important;
    }

    body.portal-mode.client-mode .client-bottom-nav {
        display: flex !important;
    }
}

/* ── Top bar ── */
.portal-topbar {
    display: none;
}

body.portal-mode .portal-topbar {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0 -20px 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--portal-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

body.portal-mode .portal-topbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px 12px;
}

body.portal-mode .portal-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

body.portal-mode .portal-topbar-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--portal-border);
    padding: 4px;
}

body.portal-mode .portal-topbar-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--portal-brand-dark), var(--portal-brand));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

body.portal-mode .portal-topbar-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body.portal-mode .portal-topbar-company {
    font-size: 15px;
    font-weight: 800;
    color: var(--portal-text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.portal-mode .portal-topbar-sub {
    font-size: 11px;
    font-weight: 600;
    color: var(--portal-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

body.portal-mode .portal-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

body.portal-mode .portal-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.15s, box-shadow 0.15s;
}

body.portal-mode .portal-icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--portal-shadow);
}

body.portal-mode .portal-icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.portal-mode .portal-lang {
    display: inline-flex !important;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
}

body.portal-mode .portal-lang button {
    border: none;
    background: transparent;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 800;
    color: var(--portal-muted);
    cursor: pointer;
}

body.portal-mode .portal-lang button.active {
    background: var(--portal-brand-light);
    color: var(--portal-brand-dark);
}

body.portal-mode .portal-account-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
    cursor: pointer;
    max-width: 160px;
    transition: box-shadow 0.15s;
}

body.portal-mode .portal-account-btn:hover {
    box-shadow: var(--portal-shadow);
}

body.portal-mode .portal-account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--portal-brand-dark), var(--portal-brand));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.portal-mode .portal-account-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--portal-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Desktop nav (inside top bar) ── */
.portal-topbar-nav {
    display: none;
}

body.portal-mode .portal-topbar-nav {
    display: flex;
    gap: 4px;
    padding: 0 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

body.portal-mode .portal-topbar-nav::-webkit-scrollbar {
    display: none;
}

body.portal-mode .portal-topbar-nav button {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--portal-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

body.portal-mode .portal-topbar-nav button i {
    font-size: 15px;
}

body.portal-mode .portal-topbar-nav button:hover {
    background: var(--portal-bg);
    color: var(--portal-text);
}

body.portal-mode .portal-topbar-nav button.active {
    background: var(--portal-brand-light);
    color: var(--portal-brand-dark);
}

/* ── Welcome hero ── */
body.portal-mode .portal-welcome {
    border-radius: 14px;
    background: var(--surface, #fff);
    color: var(--dark, #0f172a);
    padding: 24px 28px;
    box-shadow: var(--shadow-md, 0 4px 24px rgba(15, 23, 42, 0.06));
    border: 1px solid var(--border, #e2e8f0);
    border-left: 4px solid var(--primary, #ca8a04);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

body.portal-mode .portal-welcome::before {
    display: none;
}

body.portal-mode .portal-welcome.logged-in {
    background: var(--surface, #fff);
    color: var(--dark, #0f172a);
}

body.portal-mode .portal-welcome-eyebrow {
    color: var(--primary, #ca8a04);
    font-weight: 700;
}

body.portal-mode .portal-welcome h2 {
    color: var(--dark, #0f172a);
}

body.portal-mode .portal-welcome-copy p {
    color: var(--gray, #64748b);
}

body.portal-mode .portal-welcome .btn-outline {
    background: #fff !important;
    color: var(--primary, #ca8a04) !important;
    border: 2px solid var(--primary, #ca8a04) !important;
}

.portal-welcome::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.portal-welcome.logged-in {
    background: linear-gradient(135deg, #0c0a09 0%, #1c1917 100%);
    padding: 28px 32px;
}

.portal-welcome-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.portal-welcome-eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.75;
}

.portal-welcome h2 {
    margin: 0 0 10px;
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.portal-welcome-copy > p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
    max-width: 520px;
    line-height: 1.6;
}

.portal-welcome-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.portal-stat-pill {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 10px 14px;
    min-width: 90px;
}

.portal-stat-pill strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
}

.portal-stat-pill span {
    display: block;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portal-stat-pill.warn strong {
    color: #fde68a;
}

.portal-welcome-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-self: center;
}

.portal-welcome-actions .btn {
    border-radius: 12px;
    font-weight: 700;
    padding: 12px 20px;
    min-width: 130px;
    justify-content: center;
}

.portal-welcome-actions .btn-outline {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.portal-welcome.logged-in .portal-welcome-actions .btn-success {
    background: #fff;
    color: var(--portal-brand-dark);
    border-color: #fff;
}

/* ── Quick actions ── */
body.portal-mode .portal-quick-actions {
    margin: 0;
}

.portal-quick-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

body.portal-mode .portal-quick-grid {
    grid-template-columns: repeat(3, 1fr);
}

.portal-quick-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 18px 16px;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    background: var(--portal-surface);
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: var(--portal-shadow);
    min-height: 118px;
}

.portal-quick-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
    border-color: #cbd5e1;
}

.portal-quick-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.portal-quick-card.tone-green .portal-quick-icon { background: #dcfce7; color: #15803d; }
.portal-quick-card.tone-teal .portal-quick-icon { background: #ccfbf1; color: #92400e; }
.portal-quick-card.tone-blue .portal-quick-icon { background: #dbeafe; color: #1d4ed8; }
.portal-quick-card.tone-amber .portal-quick-icon { background: #fef3c7; color: #b45309; }
.portal-quick-card.tone-purple .portal-quick-icon { background: #ede9fe; color: #6d28d9; }
.portal-quick-card.tone-slate .portal-quick-icon { background: #f1f5f9; color: #475569; }

.portal-quick-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--portal-text);
    line-height: 1.2;
}

.portal-quick-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--portal-muted);
    line-height: 1.35;
}

/* ── Dashboard layout order ── */
body.portal-mode .content-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.portal-mode #portalWelcomeBanner { order: 1; }
body.portal-mode #portalQuickActions { order: 2; }
body.portal-mode .client-plot-explorer-card { order: 3; }
body.portal-mode #clientServicesStripWrap { order: 4; }
body.portal-mode #clientPortalWrap { order: 5; }

body.portal-mode #clientPortalWrap.portal-guest-hidden {
    display: none !important;
}

/* ── Services block ── */
body.portal-mode .portal-services-block {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    padding: 22px 24px;
    box-shadow: var(--portal-shadow);
}

.portal-section-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--portal-brand-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-section-title i { color: var(--portal-brand); }
.portal-section-desc { margin: 0; font-size: 0.875rem; color: var(--portal-muted); }
.portal-muted { color: var(--portal-muted); font-size: 13px; margin: 0; }

body.portal-mode .client-services-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

body.portal-mode .client-services-strip::-webkit-scrollbar { display: none; }

body.portal-mode .client-service-chip {
    flex: 0 0 auto;
    min-width: 130px;
    padding: 16px 14px;
    background: #f8fafc;
    border: 1px solid var(--portal-border);
    border-radius: 14px;
}

body.portal-mode .client-service-chip-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid var(--portal-border);
}

/* ── Activity grid (logged in) ── */
body.portal-mode .client-portal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

body.portal-mode .client-portal-section {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    padding: 20px 22px;
    box-shadow: var(--portal-shadow);
    display: flex;
    flex-direction: column;
}

body.portal-mode .client-portal-title {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--portal-brand-dark);
}

body.portal-mode .client-portal-title i { color: var(--portal-brand); }

body.portal-mode .portal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

body.portal-mode .portal-item:last-child { border-bottom: none; }
body.portal-mode .portal-auth-actions { display: none; }

body.portal-mode .portal-cta-btn {
    margin-top: auto;
    width: 100%;
    border-radius: 12px;
    font-weight: 700;
    padding: 11px 16px;
}

/* ── Plot explorer ── */
body.portal-mode .client-plot-explorer-card {
    border-radius: var(--portal-radius-lg);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
    background: var(--portal-surface);
}

body.portal-mode .client-plot-explorer-card .card-header {
    padding: 22px 24px 14px;
    border-bottom: 1px solid #f1f5f9;
}

body.portal-mode .client-plot-explorer-card .card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--portal-text);
}

body.portal-mode .plot-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px 16px;
}

body.portal-mode .plot-filter-btn {
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    padding: 7px 14px;
}

body.portal-mode .plot-map-container {
    min-height: 360px;
    padding: 16px 20px 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

body.portal-mode .plot-select-wrap,
body.portal-mode .plot-search-wrap {
    flex: 1;
    min-width: 160px;
}

/* ── Sub-pages ── */
body.portal-mode .portal-page-header {
    margin-bottom: 24px;
}

body.portal-mode .portal-page-header h1 {
    margin: 0 0 8px;
    font-size: clamp(1.4rem, 3vw, 1.75rem);
    font-weight: 800;
    color: var(--portal-text);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 12px;
}

body.portal-mode .portal-page-header h1 i {
    color: var(--portal-brand);
    font-size: 0.9em;
}

body.portal-mode .portal-page-header p {
    margin: 0;
    color: var(--portal-muted);
    font-size: 0.95rem;
    max-width: 560px;
    line-height: 1.55;
}

body.portal-mode #pageClientProfile,
body.portal-mode #pageMyLand,
body.portal-mode #pageServices,
body.portal-mode #pageDocuments {
    max-width: 100%;
}

/* ── My Land ── */
.my-land-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.my-land-stat {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--portal-shadow);
}

.my-land-stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--portal-brand);
}

.my-land-stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--portal-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.my-land-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.my-land-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    overflow: hidden;
    box-shadow: var(--portal-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.my-land-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(21, 128, 61, 0.12);
}

.my-land-empty {
    text-align: center;
    padding: 56px 28px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius-lg);
    border: 2px dashed #bbf7d0;
    box-shadow: var(--portal-shadow);
}

/* ── Profile ── */
body.portal-mode .client-profile-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 26px;
    background: linear-gradient(135deg, var(--portal-brand-dark), var(--portal-brand));
    color: #fff;
    border-radius: var(--portal-radius-lg);
    margin-bottom: 18px;
    box-shadow: var(--portal-shadow-lg);
}

body.portal-mode .client-profile-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-size: 1.4rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.portal-mode .client-profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

body.portal-mode .client-stat-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--portal-shadow);
}

body.portal-mode .client-dossier-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

body.portal-mode .client-dossier-tab {
    flex-shrink: 0;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--portal-muted);
}

body.portal-mode .client-dossier-tab.active {
    background: var(--portal-brand);
    color: #fff;
    border-color: var(--portal-brand);
}

body.portal-mode .client-login-box {
    max-width: 420px;
    margin: 48px auto;
    padding: 36px 28px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius-lg);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow-lg);
}

.client-settings-form {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 24px;
    border: 1px solid var(--portal-border);
    margin-top: 20px;
    box-shadow: var(--portal-shadow);
}

/* ── Modals ── */
body.portal-mode #clientLoginModal .modal-content,
body.portal-mode #clientRegisterModal .modal-content {
    border-radius: var(--portal-radius-lg);
    border: none;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.18);
}

body.portal-mode #clientLoginModal .btn-success,
body.portal-mode #clientRegisterModal .btn-success {
    border-radius: 12px;
    font-weight: 800;
    width: 100%;
    padding: 13px;
}

/* ── Bottom nav (mobile) ── */
body.portal-mode .client-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--portal-border);
    padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
    z-index: 950;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.08);
    justify-content: space-around;
}

body.portal-mode .client-bottom-nav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: none;
    background: none;
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--portal-muted);
    cursor: pointer;
    border-radius: 10px;
    min-width: 0;
}

body.portal-mode .client-bottom-nav button i {
    font-size: 20px;
}

body.portal-mode .client-bottom-nav button.active {
    color: var(--portal-brand);
    background: var(--portal-brand-light);
}

body.portal-mode .site-visit-overlay { z-index: 960; }

body.portal-mode .master-plan-wrap,
body.portal-mode .interactive-map-canvas {
    max-width: 100%;
    touch-action: pan-x pan-y pinch-zoom;
}

/* ── Services page in portal ── */
body.portal-mode .services-hero {
    border-radius: var(--portal-radius-lg);
    margin-bottom: 20px;
}

body.portal-mode .service-card {
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .portal-quick-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    body.portal-mode .client-portal-grid {
        grid-template-columns: 1fr;
    }

    .my-land-hero,
    body.portal-mode .client-profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body.portal-mode .client-bottom-nav,
    body.portal-mode.client-mode .client-bottom-nav.client-only {
        display: flex !important;
    }

    body.portal-mode .main-content,
    body.portal-mode.client-mode .main-content {
        padding: 16px 14px 88px !important;
    }

    .portal-welcome {
        padding: 24px 20px;
        border-radius: var(--portal-radius);
    }

    .portal-welcome-actions {
        width: 100%;
    }

    .portal-welcome-actions .btn {
        flex: 1;
        min-width: 0;
    }

    .portal-quick-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .portal-quick-card {
        min-height: 108px;
        padding: 14px 12px;
    }

    body.portal-mode .plot-map-container {
        min-height: 280px;
        padding: 12px;
    }

    body.portal-mode .plot-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    body.portal-mode .client-profile-hero {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 400px) {
    .portal-quick-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portal-quick-label {
        font-size: 12px;
    }
}

@media (min-width: 769px) {
    body.portal-mode .client-bottom-nav {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   FIX: app.css forces .client-only { display:flex !important }
   which breaks grids, cards, and button rows on the portal.
   ═══════════════════════════════════════════════════════════ */
body.portal-mode.client-mode .content-grid {
    display: flex !important;
    flex-direction: column !important;
}

body.portal-mode.client-mode #pageClientProfile.client-only,
body.portal-mode.client-mode #pageMyLand.client-only,
body.portal-mode.client-mode #pageServices.client-only,
body.portal-mode.client-mode #pageDocuments.client-only,
body.portal-mode.client-mode .portal-page-header.client-only {
    display: block !important;
    width: 100%;
}

body.portal-mode.client-mode .portal-topbar.client-only,
body.portal-mode.client-mode .portal-topbar-nav.client-only {
    display: none !important;
}

body.portal-mode.client-mode .portal-lang.client-only,
body.portal-mode.client-mode .lang-toggle.portal-lang {
    display: inline-flex !important;
}

/* ── Buttons: consistent sizing & visibility ── */
body.portal-mode .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    border-radius: 12px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

body.portal-mode .btn:active {
    transform: scale(0.98);
}

body.portal-mode .btn-primary,
body.portal-mode .btn-success {
    color: #fff !important;
    border: none;
}

body.portal-mode .btn-primary {
    background: var(--primary, #ca8a04) !important;
}

body.portal-mode .btn-primary:hover {
    background: var(--primary-dark, #a16207) !important;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}

body.portal-mode .btn-success {
    background: var(--secondary, #b45309) !important;
}

body.portal-mode .btn-success:hover {
    background: var(--secondary-dark, #92400e) !important;
}

body.portal-mode .btn-outline {
    background: #fff;
    color: var(--primary, #ca8a04);
    border: 2px solid var(--primary, #ca8a04);
}

body.portal-mode .portal-welcome .btn-outline {
    background: rgba(255, 255, 255, 0.14) !important;
    border: 2px solid rgba(255, 255, 255, 0.45) !important;
    color: #fff !important;
}

body.portal-mode .portal-welcome .btn-outline:hover {
    background: rgba(255, 255, 255, 0.24) !important;
    color: #fff !important;
}

body.portal-mode .portal-welcome:not(.logged-in) .btn-success {
    background: var(--secondary, #b45309) !important;
    color: #fff !important;
}

body.portal-mode .portal-welcome:not(.logged-in) .btn-success:hover {
    background: var(--secondary-dark, #92400e) !important;
}

body.portal-mode .portal-welcome.logged-in .btn-success {
    background: #fff !important;
    color: var(--portal-brand-dark, #1c1917) !important;
}

body.portal-mode .plot-filter-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid var(--portal-border, #e2e8e4);
    background: #fff;
    color: var(--portal-muted, #64748b);
    cursor: pointer;
}

body.portal-mode .plot-filter-btn.active {
    background: var(--primary, #ca8a04) !important;
    border-color: var(--primary, #ca8a04) !important;
    color: #fff !important;
}

body.portal-mode .portal-quick-card {
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

body.portal-mode .portal-topbar-nav button {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

body.portal-mode .client-bottom-nav button {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

body.portal-mode .portal-icon-btn,
body.portal-mode .portal-account-btn {
    font-family: inherit;
}

/* ── Brand theme: hero & accents follow admin accent color ── */
body.portal-mode .portal-welcome {
    background: linear-gradient(
        135deg,
        var(--portal-brand-dark, #0c0a09) 0%,
        var(--portal-brand-dark, #1c1917) 45%,
        var(--portal-brand, #ca8a04) 100%
    );
}

body.portal-mode .portal-welcome.logged-in {
    background: linear-gradient(
        135deg,
        var(--portal-brand-dark, #0c0a09) 0%,
        var(--portal-brand-dark, #1c1917) 100%
    );
}

body.portal-mode .portal-topbar-icon,
body.portal-mode .portal-account-avatar {
    background: linear-gradient(
        135deg,
        var(--portal-brand-dark, #1c1917),
        var(--portal-brand, #ca8a04)
    );
}

body.portal-mode .portal-topbar-nav button.active,
body.portal-mode .client-bottom-nav button.active {
    color: var(--portal-brand, #ca8a04);
    background: var(--portal-brand-light, #fef3c7);
}

body.portal-mode .portal-stat-pill {
    border-color: rgba(255, 255, 255, 0.2);
}

body.portal-mode .client-service-chip:hover,
body.portal-mode.client-mode .client-service-chip.highlight {
    border-color: var(--portal-brand, #ca8a04);
    background: var(--portal-brand-light, #fffbeb);
}

body.portal-mode .client-dossier-tab.active {
    background: var(--portal-brand, #ca8a04);
    border-color: var(--portal-brand, #ca8a04);
}

body.portal-mode .my-land-stat-value,
body.portal-mode .portal-section-title i,
body.portal-mode .client-portal-title i {
    color: var(--portal-brand, #ca8a04);
}

body.portal-mode .portal-section-title {
    color: var(--portal-brand-dark, #1c1917);
}

/* Header: auth + language + account. Site visit / favorites live in the menu. */
body.portal-mode #clientAuthActions,
body.portal-mode.client-mode #clientAuthActions {
    display: flex !important;
}

body.portal-mode #clientAccountHeader,
body.portal-mode.client-mode #clientAccountHeader,
body.portal-mode.client-mode .user-profile.client-only {
    display: flex !important;
}

body.portal-mode #langToggle,
body.portal-mode.client-mode #langToggle {
    display: inline-flex !important;
}

body.portal-mode #siteVisitHeaderBtn,
body.portal-mode .header-fav-btn,
body.portal-mode.client-mode #siteVisitHeaderBtn,
body.portal-mode.client-mode .header-fav-btn {
    display: none !important;
}

body.portal-mode.client-mode .header-title.client-only {
    display: block !important;
}

body.portal-mode .content-grid {
    grid-template-columns: 1fr;
    gap: 20px;
}

body.portal-mode .card,
body.portal-mode .client-plot-explorer-card {
    border-radius: 14px;
    box-shadow: var(--shadow-md, 0 4px 24px rgba(15, 23, 42, 0.06));
}

/* Land-buyer explorer: hide apartment / staff chrome */
body.portal-mode .client-plot-explorer-card .live-indicator,
body.portal-mode #filterMaxEmi,
body.portal-mode #unitFilterBar,
body.portal-mode .plot-matcher-card,
body.portal-mode #compareModeBtn,
body.portal-mode #explorerSiteVisitBtn {
    display: none !important;
}

.portal-guest-hint {
    display: none !important;
    margin: 0 0 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--portal-brand-light, #fef3c7);
    color: var(--portal-text, #0f172a);
    font-size: 13px;
    line-height: 1.45;
}

body.portal-mode .portal-guest-hint.is-visible {
    display: block !important;
}

@media (max-width: 768px) {
    body.portal-mode {
        font-size: 15px;
        line-height: 1.5;
    }

    body.portal-mode .portal-welcome-eyebrow {
        font-size: 12px;
    }

    body.portal-mode .portal-welcome p,
    body.portal-mode .portal-section-desc,
    body.portal-mode .portal-muted {
        font-size: 14px;
    }

    body.portal-mode .portal-quick-label {
        font-size: 14px;
    }

    body.portal-mode .portal-quick-sub {
        font-size: 13px;
    }

    body.portal-mode .portal-stat-pill span,
    body.portal-mode .my-land-stat-label {
        font-size: 12px;
    }

    body.portal-mode .client-portal-title {
        font-size: 15px;
    }

    body.portal-mode .portal-guest-hint {
        font-size: 14px;
    }

    body.portal-mode #clientRegisterBtn {
        display: none !important;
    }
    body.portal-mode .header-actions {
        gap: 8px;
        flex-wrap: nowrap;
    }
    body.portal-mode .header-actions .btn-outline {
        flex: 0 0 auto;
        min-width: 0;
    }
}

/* Portal welcome copy stays readable on the light reference-theme surface. */
body.portal-mode .portal-welcome {
    background: #ffffff !important;
    color: #1d3557 !important;
    border-left: 4px solid #e63946 !important;
}

body.portal-mode .portal-welcome .portal-welcome-eyebrow {
    color: #e63946 !important;
    opacity: 1 !important;
}

body.portal-mode .portal-welcome h2 {
    color: #1d3557 !important;
}

body.portal-mode .portal-welcome .portal-welcome-copy > p {
    color: #53606d !important;
    opacity: 1 !important;
}

body.portal-mode .portal-welcome .portal-welcome-stats {
    color: #1d3557;
}
