/* css/portal.css - Premium "Deep Indigo Glass" Theme */

:root {
    /* Google Brand Colors */
    --google-blue: #4285F4;
    --google-red: #EA4335;
    --google-yellow: #FBBC05;
    --google-green: #34A853;
    
    /* Light Mode (Default) */
    --portal-bg: #f8f9fa;
    --portal-card-bg: #ffffff;
    --portal-text-main: #202124;
    --portal-text-muted: #5f6368;
    --portal-border: #dadce0;
    --portal-glass-border: rgba(0, 0, 0, 0.1);
    --portal-input-bg: #ffffff;
    
    --shadow-soft: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-float: 0 4px 6px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
    --shadow-glow: 0 0 15px rgba(66, 133, 244, 0.4);
    
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 8px;
}

[data-theme="dark"] {
    --portal-bg: #202124;
    --portal-card-bg: #292a2d;
    --portal-text-main: #e8eaed;
    --portal-text-muted: #9aa0a6;
    --portal-border: #3c4043;
    --portal-glass-border: rgba(255, 255, 255, 0.1);
    --portal-input-bg: #202124;
    
    --shadow-soft: 0 1px 2px 0 rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
    --shadow-float: 0 4px 6px 0 rgba(0,0,0,0.3), 0 4px 8px 3px rgba(0,0,0,0.15);
}

body.portal-body {
    background-color: var(--portal-bg);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    font-family: 'Inter', sans-serif;
    color: var(--portal-text-main);
    overflow: hidden;
}

/* Auth Screen */
.auth-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--portal-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-screen:not(.active) {
    display: none;
}

.auth-card {
    background: var(--portal-card-bg);
    border: 1px solid var(--portal-border);
    padding: 4rem 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-float);
    text-align: center;
    max-width: 450px;
    width: 100%;
    color: var(--portal-text-main);
}

.auth-icon {
    width: 64px;
    height: 64px;
    color: var(--google-blue);
    margin-bottom: 1.5rem;
}

.auth-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.auth-card p {
    color: var(--portal-text-muted);
    line-height: 1.6;
}

/* Dark form controls inside the auth card */
.auth-screen .auth-card .form-control {
    background: var(--portal-input-bg);
    border-color: var(--portal-border);
    color: var(--portal-text-main);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-screen .auth-card .form-control:focus {
    border-color: var(--google-blue);
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.15);
    outline: none;
}
.auth-screen .auth-card .form-control::placeholder {
    color: var(--portal-text-muted);
    opacity: 0.6;
}
.auth-screen .auth-card .btn-portal-primary {
    background: var(--google-blue);
    color: white;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    font-weight: 600;
}
.auth-screen .auth-card .btn-portal-primary:hover {
    background: #3367d6; /* slightly darker google blue */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.auth-screen .auth-card .btn-portal-secondary {
    background: transparent;
    border: 1px solid var(--portal-border);
    color: var(--portal-text-main);
    transition: background 0.2s, color 0.2s;
}
.auth-screen .auth-card .btn-portal-secondary:hover {
    background: rgba(66, 133, 244, 0.05);
    color: var(--google-blue);
}

/* Layout */
.portal-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Clean Sidebar */
.portal-sidebar {
    width: 280px;
    background: var(--portal-card-bg);
    color: var(--portal-text-main);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--portal-border);
    z-index: 10;
}

.portal-brand {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--portal-border);
    gap: 0.75rem;
    color: var(--google-blue);
}

.portal-brand span {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--portal-text-main);
}

.client-identity {
    padding: 2.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--portal-border);
    position: relative;
    overflow: hidden;
}

/* Subtle glow behind avatar */
.client-identity::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 150px; height: 150px;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.1) 0%, transparent 70%);
    z-index: 0;
}

.client-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--google-blue);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 16px rgba(66, 133, 244, 0.2);
    border: 4px solid var(--portal-card-bg);
}

.client-identity .ngo-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--portal-text-main);
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
}

.client-identity .contact-name {
    font-size: 0.85rem;
    color: var(--portal-text-muted);
    position: relative;
    z-index: 1;
}

.portal-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.portal-nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    color: var(--portal-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.portal-nav-item i {
    width: 20px;
    height: 20px;
    z-index: 1;
}

.portal-nav-item span {
    z-index: 1;
}

.portal-nav-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--google-blue);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.portal-nav-item:hover {
    color: var(--google-blue);
    transform: translateX(5px);
}

.portal-nav-item:hover::before {
    opacity: 0.05;
}

.portal-nav-item.active {
    color: var(--google-blue);
    font-weight: 600;
    background: rgba(66, 133, 244, 0.08);
    border: 1px solid rgba(66, 133, 244, 0.2);
}

/* Main Content Area */
.portal-main {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
    background: var(--portal-bg);
    position: relative;
}

/* Background decorative blur */
.portal-main::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.portal-page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--portal-text-main);
    margin-bottom: 2.5rem;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.portal-tab-content {
    display: none;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    z-index: 1;
}

.portal-tab-content.active {
    display: block;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Floating Cards */
.portal-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.portal-card {
    background: var(--portal-card-bg);
    border-radius: var(--radius-xl);
    padding: 2rem;
    border: 1px solid rgba(0,0,0,0.03);
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-float);
}

.portal-card h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--portal-text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Chat Redesign */
.chat-container {
    background: var(--portal-card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    box-shadow: var(--shadow-float);
    overflow: hidden;
}

.chat-header {
    padding: 1.5rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-header-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--google-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.chat-header-info h3 {
    margin: 0 0 0.25rem 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--portal-text-main);
}

.chat-header-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--portal-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-header-info p::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--google-green);
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(52, 168, 83, 0.5);
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.chat-msg {
    max-width: 65%;
    padding: 1rem 1.25rem;
    border-radius: 20px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

.chat-msg.client {
    background: var(--google-blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.agency {
    background: var(--portal-card-bg);
    border: 1px solid var(--portal-border);
    color: var(--portal-text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg .time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    display: block;
    text-align: right;
}

.chat-msg.agency .time {
    color: var(--portal-text-muted);
}

.chat-input-area {
    padding: 1.5rem 2rem;
    background: var(--portal-card-bg);
    border-top: 1px solid var(--portal-border);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 1px solid var(--portal-border);
    border-radius: 30px;
    font-family: inherit;
    background: var(--portal-input-bg);
    color: var(--portal-text-main);
    transition: all 0.2s;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--google-blue);
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.1);
}

.chat-input-area button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--google-blue);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(66, 133, 244, 0.3);
}

.chat-input-area button:hover {
    transform: scale(1.05);
    background: #3367d6;
}

/* Tasks / Tickets Styles */
.client-task-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.client-task-item {
    padding: 1.5rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--portal-card-bg);
    transition: all 0.2s;
    border-left: 4px solid var(--google-blue);
}

.client-task-item:hover {
    box-shadow: var(--shadow-soft);
    transform: translateX(4px);
}

.client-task-item .task-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--portal-text-main);
    margin-bottom: 0.5rem;
}

.client-task-item .task-meta {
    font-size: 0.85rem;
    color: var(--portal-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.priority-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.priority-dot.High { background: var(--google-red); box-shadow: 0 0 5px rgba(234, 67, 53, 0.5); }
.priority-dot.Medium { background: var(--google-yellow); box-shadow: 0 0 5px rgba(251, 188, 5, 0.5); }
.priority-dot.Low { background: var(--google-green); box-shadow: 0 0 5px rgba(52, 168, 83, 0.5); }

.client-task-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-backlog { background: rgba(95, 99, 104, 0.1); color: var(--portal-text-muted); border: 1px solid rgba(95, 99, 104, 0.2); }
.status-inprogress { background: rgba(66, 133, 244, 0.1); color: var(--google-blue); border: 1px solid rgba(66, 133, 244, 0.2); }
.status-review { background: rgba(251, 188, 5, 0.1); color: #d99c00; border: 1px solid rgba(251, 188, 5, 0.2); }
.status-done { background: rgba(52, 168, 83, 0.1); color: var(--google-green); border: 1px solid rgba(52, 168, 83, 0.2); }

/* Assets Drag & Drop */
.asset-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.asset-upload-zone::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(66, 133, 244, 0.05));
    opacity: 0;
    transition: opacity 0.3s;
}

.asset-upload-zone:hover {
    border-color: var(--google-blue);
    transform: scale(1.01);
}

.asset-upload-zone:hover::before {
    opacity: 1;
}

.asset-upload-zone i {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.asset-upload-zone:hover i {
    transform: translateY(-10px) scale(1.1);
    color: var(--google-blue);
}

.asset-upload-zone h3 {
    margin-bottom: 0.5rem;
    font-family: 'Outfit', sans-serif;
    color: var(--portal-text-main);
}

/* Modals matching portal theme */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.portal-modal .modal-content {
    background: var(--portal-card-bg);
    width: 100%;
    margin: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--portal-border);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.portal-modal .modal-header {
    background: var(--portal-bg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--portal-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.portal-modal .modal-header h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--portal-text-main);
    margin: 0;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--portal-text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #e2e8f0;
    color: var(--portal-text-main);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--portal-text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--radius-md);
    background: var(--portal-input-bg);
    color: var(--portal-text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--google-blue);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Buttons */
.btn-portal-primary {
    background: var(--portal-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.btn-portal-primary:hover {
    background: var(--portal-indigo-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.btn-portal-secondary {
    background: #ffffff;
    color: var(--portal-text-main);
    border: 1px solid #cbd5e1;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-portal-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* Billing Grid Semantic Classes */
.portal-billing-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: center;
}

.portal-billing-info-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ════════════════════════════════════════
   PORTAL MOBILE RESPONSIVENESS (< 768px)
   Pattern: Off-canvas sidebar + sticky top
   bar + bottom tab navigation
════════════════════════════════════════ */

/* ── Portal sidebar toggle button ──────── */
.portal-mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.portal-mobile-toggle:hover {
    background: rgba(255,255,255,0.18);
}

/* ── Portal mobile overlay ──────────────── */
.portal-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 299;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.portal-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── Portal bottom tab navigation ──────── */
.portal-bottom-tabs {
    display: none;
}

@media (max-width: 767px) {
    /* ── Layout becomes vertical ──────────── */
    .portal-layout {
        flex-direction: column;
        overflow: hidden;
    }

    /* ── Sidebar: off-canvas ──────────────── */
    .portal-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px !important;
        height: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        flex-wrap: nowrap !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
        z-index: 300;
        overflow-y: auto;
    }
    .portal-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* ── Show sidebar overlay ─────────────── */
    .portal-sidebar-overlay { display: block; }

    /* ── Portal brand in sidebar ──────────── */
    .portal-brand {
        padding: 1.25rem 1.5rem !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
        height: auto !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* ── Client identity: show in sidebar ─── */
    .client-identity {
        display: block !important;
        padding: 1.5rem 1rem !important;
    }
    .client-avatar {
        width: 64px !important;
        height: 64px !important;
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
    }

    /* ── Sidebar nav ──────────────────────── */
    .portal-nav {
        flex-direction: column !important;
        padding: 0.5rem 0.75rem !important;
        overflow-y: auto;
        gap: 0.25rem !important;
        border-top: none !important;
        margin-top: 0 !important;
        width: 100% !important;
        white-space: normal !important;
    }
    .portal-nav-item {
        padding: 0.875rem 1rem !important;
        font-size: 0.9rem !important;
        border-radius: 10px !important;
        flex: none !important;
        width: 100% !important;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .portal-nav-item i,
    .portal-nav-item svg { flex-shrink: 0; }

    /* ── Sticky top bar ───────────────────── */
    .portal-topbar {
        display: flex;
        align-items: center;
        height: 60px;
        padding: 0 1rem;
        background: linear-gradient(180deg, var(--portal-indigo-dark), var(--portal-indigo));
        border-bottom: 1px solid rgba(255,255,255,0.08);
        gap: 0.75rem;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        z-index: 50;
    }

    /* ── Toggle button: show in top bar ───── */
    .portal-mobile-toggle {
        display: flex;
    }

    /* ── Page view name ────────────────────── */
    .portal-topbar-title {
        font-family: 'Outfit', sans-serif;
        font-weight: 700;
        font-size: 1rem;
        color: #fff;
        flex: 1;
    }
    .portal-topbar-logo {
        width: 30px; height: 30px;
        border-radius: 8px;
        background: rgba(129,140,248,0.25);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #818cf8;
    }

    /* ── Main content area ────────────────── */
    .portal-main {
        padding: 1rem !important;
        height: auto !important;
        overflow-y: auto;
        flex: 1;
        padding-bottom: 80px !important; /* Space for bottom tab bar */
    }

    /* ── Portal bottom tab bar ────────────── */
    .portal-bottom-tabs {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 64px;
        background: var(--portal-indigo-dark);
        border-top: 1px solid rgba(255,255,255,0.08);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 200;
        align-items: center;
        justify-content: space-around;
        padding: 0 0.25rem;
    }
    .portal-tab-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        color: rgba(148,163,184,0.7);
        font-size: 0.62rem;
        font-weight: 600;
        font-family: 'Inter', sans-serif;
        cursor: pointer;
        padding: 0.5rem 0.75rem;
        border-radius: 10px;
        flex: 1;
        min-height: 48px;
        justify-content: center;
        transition: all 0.15s ease;
        border: none;
        background: transparent;
    }
    .portal-tab-btn i, .portal-tab-btn svg {
        width: 20px; height: 20px;
    }
    .portal-tab-btn.active {
        color: #818cf8;
    }
    .portal-tab-btn.active i, .portal-tab-btn.active svg {
        filter: drop-shadow(0 0 6px rgba(129,140,248,0.5));
    }
    .portal-tab-btn:active {
        transform: scale(0.92);
        background: rgba(255,255,255,0.05);
    }

    /* ── Grid stacks ──────────────────────── */
    .portal-grid-2 { grid-template-columns: 1fr; }
    .portal-card { padding: 1.25rem; }
    .portal-page-title { font-size: 1.35rem; margin-bottom: 1rem; }

    /* ── Chat ─────────────────────────────── */
    .chat-container { height: calc(100vh - 200px); }

    /* ── Auth card ────────────────────────── */
    .auth-screen .auth-card {
        margin: 1rem;
        padding: 2rem 1.5rem !important;
        max-width: calc(100vw - 2rem) !important;
        min-width: 0 !important;
    }
    .auth-screen .auth-card .form-control {
        font-size: 16px; /* Prevent iOS zoom */
    }
    .auth-screen .auth-orb-1 { width: 300px; height: 300px; }
    .auth-screen .auth-orb-2 { width: 220px; height: 220px; }

    /* ── Table scroll ─────────────────────── */
    .invoice-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .portal-billing-grid, .portal-billing-info-fields {
        grid-template-columns: 1fr !important;
    }
}

/* ════════════════════════════════════════
   KEYFRAMES
════════════════════════════════════════ */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.spin-loader {
    animation: spin 1.2s linear infinite;
}
