/* 
 * CRIODS Workspace - NamePros Inspired Professional Hub
 * High-Density / High-Activity Domain Marketplace Theme
 */

:root {
    /* Palette: Vibrant Orange & Warm Neutrals */
    --primary: #F97316;
    --primary-light: #FFF7ED;
    --primary-dark: #EA580C;
    --sidebar-bg: #271710;
    --bg-canvas: #FFFAF5;
    --bg-card: #FFFFFF;
    
    --studio-bg: #050505;
    
    --slate-50: #F8FAFC;
    --slate-100: #F1F5F9;
    --slate-200: #E2E8F0;
    --slate-300: #CBD5E1;
    --slate-400: #94A3B8;
    --slate-500: #64748B;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1E293B;
    --slate-900: #0F172A;
    
    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-on-dark: #F8FAFC;
    --border: #E2E8F0;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    --transition: all 0.2s ease;
    --sidebar-width: 220px;
    --pulse-width: 280px;
    --font-size-base: 13px; /* Smaller base font for high density */

    /* LUXURY STUDIO TOKENS */
    --luxury-pearl: #FAF9F6;
    --luxury-gold: #C5A059;
    --luxury-gold-soft: #F7E7CE;
    --luxury-sage: #C1CDC1;
    --luxury-charcoal: #2C3E50;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

/* --- LUXURY STUDIO SYSTEM --- */
.studio-glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.03);
}

.style-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.style-card:hover {
    transform: translateY(-4px);
    border-color: var(--luxury-gold);
}

.style-card.active {
    border-color: var(--luxury-gold);
    background: var(--luxury-gold-soft);
    box-shadow: 0 10px 20px rgba(197, 160, 89, 0.1);
}

.style-card.active::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--luxury-gold);
}

.studio-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--luxury-charcoal);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.luxury-btn {
    background: var(--luxury-charcoal);
    color: white;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.luxury-btn:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-canvas);
    color: var(--text-main);
    line-height: 1.4;
    display: flex;
    font-size: var(--font-size-base);
    overflow-x: clip !important;
}

html { overflow-x: clip !important; width: 100%; position: relative; }

a { color: inherit; text-decoration: none; transition: var(--transition); }
button { font-family: inherit; cursor: pointer; border: none; outline: none; transition: var(--transition); }
button:active { transform: scale(0.96); }
input, textarea, select { 
    font-family: inherit; 
    outline: none; 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    font-size: 1rem; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.form-input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    background: var(--bg-canvas);
    border: 1.5px solid var(--border);
    font-weight: 500;
}

.form-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
    transform: translateY(-1px);
}

textarea.form-input {
    height: auto;
    padding: 16px;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .responsive-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* --- Portal Layout Logic (Two-Phase Display) --- */

/* Normal Workspace Layout */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0; top: 0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    color: var(--text-on-dark);
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    min-height: 100vh;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#app-container {
    flex: 1;
    padding: 24px 32px;
    max-width: 1400px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.4s ease;
}

.pulse-sidebar {
    width: var(--pulse-width);
    border-left: 1px solid var(--border);
    background: white;
    padding: 24px 16px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

/* Portal Mode (Guest Landing Page) */
body.portal-mode {
    display: block !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

body.portal-mode .sidebar, 
body.portal-mode .pulse-sidebar {
    display: none !important;
}

body.portal-mode .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    display: block !important;
}

body.portal-mode #app-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Portal Components (Unified) */
.portal-header {
    background: var(--primary) !important;
    height: 80px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    padding: 0 24px;
}

.portal-nav-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.portal-logo img { height: 60px; filter: brightness(0) invert(1); }
/* Removed .portal-logo span to avoid duplication */

.portal-nav-links a {
    font-weight: 700;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
}

.portal-auth-btn {
    display: flex;
    gap: 12px;
}

/* --- Hero & Search Section --- */
.hero-portal {
    padding: 80px 0;
    background: white;
    text-align: center;
}

.hero-portal h1 {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 24px;
    line-height: 1.1;
}

.hero-portal p {
    font-size: 1.25rem;
    color: var(--slate-500);
    max-width: 700px;
    margin: 0 auto 48px;
    line-height: 1.6;
}

.search-box-premium {
    max-width: 750px;
    margin: 0 auto;
    display: flex;
    background: white;
    padding: 10px;
    border-radius: 24px;
    box-shadow: 0 25px 60px -12px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.02);
    border: 1.5px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box-premium:focus-within {
    border-color: var(--primary);
    box-shadow: 0 25px 60px -12px rgba(249, 115, 22, 0.15), 0 0 0 4px rgba(249, 115, 22, 0.08);
    transform: translateY(-2px);
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.search-input-wrapper i {
    position: absolute;
    left: 20px;
    color: var(--slate-400);
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: var(--transition);
}

.search-box-premium:focus-within i {
    color: var(--primary);
    transform: scale(1.1);
}

.search-box-premium input {
    width: 100%;
    border: none !important;
    padding: 0 24px 0 54px !important;
    font-size: 1.15rem;
    font-weight: 500;
    height: 64px;
    min-width: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.search-box-premium .btn {
    height: 64px;
    padding: 0 36px;
    border-radius: 18px;
    font-size: 1.05rem;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 10px 20px rgba(249, 115, 22, 0.2);
}



.portal-nav-links a:hover { color: var(--primary); }

.portal-auth-btn { display: flex; gap: 12px; }

/* --- Search Hero (Afternic Style) --- */
.hero-portal {
    padding: 100px 24px;
    text-align: center;
    background: white;
    border-bottom: 1px solid var(--border);
    background-image: 
        radial-gradient(at 0% 0%, hsla(28,100%,74%,0.15) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(12,100%,70%,0.1) 0, transparent 50%);
}

.hero-portal h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 24px;
    letter-spacing: -2px;
    line-height: 1;
}

.hero-portal p {
    font-size: 1.25rem;
    color: var(--slate-500);
    max-width: 600px;
    margin: 0 auto 48px;
}

.search-box-premium {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 8px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

.search-box-premium input {
    flex: 1;
    border: none;
    padding: 0 24px;
    font-size: 1.25rem;
    font-weight: 600;
}

.search-box-premium .btn-primary {
    height: 64px;
    padding: 0 40px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 14px;
}

/* --- Typography & Headers --- */
h1, h2, h3 { color: var(--slate-900); letter-spacing: -0.02em; font-weight: 800; }
.section-header { margin-bottom: 32px; display: flex; justify-content: space-between; align-items: center; }
.section-header h2 { font-size: 1.5rem; }

/* --- Sidebar Components --- */
.sidebar-logo {
    font-size: 1.2rem;
    font-weight: 900;
    color: white;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo i {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 8px;
    border-radius: 10px;
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--slate-400);
    font-size: 0.95rem;
    font-weight: 600;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.05); transform: translateX(4px); }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2); }

/* --- High-Density Domain Rows (NamePros Style) --- */
.domain-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.domain-row {
    background: white !important;
    padding: 16px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 24px;
    transition: var(--transition);
    border-bottom: 1px solid var(--slate-100);
    width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
}

.domain-row .row-asset-info { flex: 4 1 0% !important; }
.domain-row .row-price { flex: 1.2 1 0% !important; text-align: right !important; display:flex !important; align-items:center; justify-content:flex-end; font-weight: 800; }
.domain-row .row-stats { flex: 1 1 0% !important; text-align: center !important; display:flex !important; align-items:center; justify-content:center; }
.domain-row .row-actions { flex: 2 1 0% !important; display: flex !important; justify-content: flex-end !important; gap: 12px; }

/* Desktop-Only High Density Locking */
@media (min-width: 1025px) {
    .domain-row .row-asset-info { min-width: 250px; }
    .domain-row .row-price { min-width: 90px; }
    .domain-row .row-stats { min-width: 110px; }
    .domain-row .row-actions { min-width: 170px; }
}
.domain-row:hover { background: var(--slate-50); }

.row-asset-info { display: flex; flex-direction: column; gap: 2px; }
.row-name { font-weight: 800; font-size: 1rem; color: var(--primary); }
.row-category { font-size: 0.7rem; font-weight: 700; color: var(--slate-400); text-transform: uppercase; }

.row-price { font-weight: 800; font-size: 1.1rem; color: var(--slate-900); }
.row-stats { font-size: 0.8rem; color: var(--slate-500); }

/* --- Pulse / Activity sidebar item --- */
.pulse-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--slate-100);
}
.pulse-user { font-weight: 700; color: var(--slate-900); font-size: 0.85rem; }
.pulse-action { font-size: 0.85rem; color: var(--slate-500); margin: 4px 0; }
.pulse-asset { font-weight: 800; color: var(--primary); }
.pulse-time { font-size: 0.75rem; color: var(--slate-400); }

/* --- Badges & Buttons --- */
.badge {
    padding: 2px 8px;
    border-radius: var(--radius-md);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-verified { background: #DCFCE7; color: #166534; }
.badge-tld { background: var(--slate-100); color: var(--slate-600); border: 1px solid var(--slate-200); }

/* Sold Circle Badge */
.badge-sold-circle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #10b981;
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
    animation: sold-pulse 2s infinite;
}
@keyframes sold-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25); }
    50%       { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.0); }
}

.btn {
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.96); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3); }
.btn-secondary { background: white; border: 1px solid var(--border); color: var(--slate-700); }

.pulse-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
@media (max-width: 640px) {
    .pulse-panel { padding: 24px 16px !important; }
}

/* --- Modals & Overlays --- */
/* --- Support AI Widget (Criods Intel Agent v2) --- */
.support-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.support-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 8px 24px rgba(249,115,22,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse-ring 3s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 8px 24px rgba(249,115,22,0.4), 0 0 0 0 rgba(249,115,22,0.3); }
    70% { box-shadow: 0 8px 24px rgba(249,115,22,0.4), 0 0 0 12px rgba(249,115,22,0); }
    100% { box-shadow: 0 8px 24px rgba(249,115,22,0.4), 0 0 0 0 rgba(249,115,22,0); }
}

.support-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 32px rgba(249,115,22,0.5);
}

.support-btn i { width: 22px; height: 22px; }

.support-chat {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 500px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.support-chat.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.support-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.support-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.agent-avatar i { width: 18px; height: 18px; }

.agent-info { display: flex; flex-direction: column; }
.agent-name { font-weight: 900; font-size: 0.9rem; letter-spacing: -0.3px; }
.agent-status { font-size: 0.7rem; opacity: 0.8; display: flex; align-items: center; gap: 4px; }
.agent-status::before {
    content: '';
    width: 6px; height: 6px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 6px #4ade80;
    animation: blink 2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.support-close-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 28px; height: 28px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}
.support-close-btn:hover { background: rgba(255,255,255,0.25); }

.support-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.support-messages::-webkit-scrollbar { width: 4px; }
.support-messages::-webkit-scrollbar-track { background: transparent; }
.support-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.msg {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 0.85rem;
    animation: msgIn 0.25s ease;
    word-wrap: break-word;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.ai {
    background: white;
    color: var(--slate-800);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
}

.msg.user {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(249,115,22,0.25);
}

.msg.typing {
    background: white;
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 14px 18px;
}

.typing-dots {
    display: flex; gap: 4px; align-items: center;
}
.typing-dots span {
    width: 7px; height: 7px;
    background: var(--slate-400);
    border-radius: 50%;
    animation: dot-bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-6px); opacity: 1; }
}

.support-quick-actions {
    padding: 8px 16px 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.quick-btn {
    background: white;
    border: 1.5px solid var(--border);
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--slate-700);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249,115,22,0.2);
}

.support-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.support-input-area input {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.85rem;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.support-input-area input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

.support-send-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .support-chat {
        position: fixed;
        bottom: 80px;
        right: 8px;
        left: 8px;
        width: auto;
        height: 420px;
        border-radius: 20px;
    }
}

/* Fix backdrop-filter lint */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.modal-card {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%; max-width: 480px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1280px) {
    .pulse-sidebar { display: none; }
    .main-content { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); }
}

@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 32px 10px; }
    .sidebar-logo span, .nav-item span { display: none; }
    .main-content { margin-left: 80px; }
}

@media (max-width: 768px) {
    body { flex-direction: column; padding-top: 60px; padding-bottom: 70px; }
    
    .sidebar {
        position: fixed;
        bottom: 0; left: 0; top: auto;
        width: 100%; height: 64px;
        flex-direction: row;
        justify-content: flex-start; align-items: stretch;
        padding: 0; margin: 0;
        z-index: 10000;
        border-top: 1px solid rgba(255,255,255,0.05);
        border-radius: 0;
        background: var(--sidebar-bg); /* Enforce solid block */
        display: block; /* Release flex layout for child scroll */
    }
    
    .sidebar-logo {
        position: fixed; top: 0; left: 0; width: 100%; height: 60px;
        background: var(--sidebar-bg); z-index: 9999;
        margin: 0; padding: 0 20px;
        display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .sidebar-logo span { display: inline-block !important; font-size: 1.1rem; }
    
    .sidebar-nav {
        display: flex; flex-direction: row; width: 100%; height:100%; justify-content: flex-start;
        padding: 0; margin: 0; gap: 0; align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    
    .nav-item {
        flex-direction: column; gap: 4px; padding: 0; justify-content: center; align-items: center;
        border-radius: 0; font-size: 0.65rem; text-align: center; height: 100%;
        min-width: 76px; flex-shrink: 0;
    }
    .nav-item span { display: block !important; margin: 0; font-size: 0.65rem; }
    .nav-item i { width: 22px; height: 22px; margin: 0 auto; display: block; }

    .sidebar > div:last-child {
        position: fixed; top: 12px; right: 16px; z-index: 10001;
        margin: 0 !important; padding: 0 !important; border: none !important;
        display: flex; flex-direction: row; gap: 8px; align-items: center;
    }
    .sidebar > div:last-child > div:first-child {
        background: rgba(255,255,255,0.1) !important; margin: 0 !important; padding: 6px 12px !important;
        border-radius: var(--radius-full) !important; height: 36px;
    }
    .sidebar > div:last-child > div:first-child span { display: none; }
    .sidebar > div:last-child > div:first-child i[data-lucide="chevron-down"] { display: none; }
    
    #profile-dropdown {
        position: fixed; top: 60px; right: 16px;
        background: var(--sidebar-bg);
        border: 1px solid rgba(255,255,255,0.1);
        width: auto; min-width: 140px; margin: 0;
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar > div:last-child a.nav-item {
        flex-direction: row; padding: 0 16px; border-radius: var(--radius-full);
        font-size: 0.8rem; height: 36px; color: white !important; background: rgba(255,255,255,0.1);
    }
    .sidebar > div:last-child a.nav-item i { display: none; }
    .sidebar > div:last-child a.nav-item span { font-size: 0.8rem; font-weight: 700; display: block !important; }

    .main-content { margin-left: 0; width: 100%; min-height: 100vh; }
    #app-container { padding: 12px; margin-top: 0; }
    
    /* Override grid layouts */
    .domain-row { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 16px; 
        padding: 20px;
    }
    .domain-row > div { 
        width: 100% !important; 
        text-align: left !important; 
        flex: none !important; 
        min-width: 0 !important;
        padding: 4px 0;
    }
    .domain-row .row-price {
        justify-content: flex-start !important;
        font-size: 1.2rem;
        color: var(--primary);
    }
    .domain-row .row-stats {
        justify-content: flex-start !important;
    }
    .domain-row .row-actions {
        justify-content: flex-start !important;
        border-top: 1px solid var(--slate-100);
        padding-top: 16px;
        margin-top: 8px;
    }
    .domain-row .row-name { font-size: 1.25rem; }
    
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: 1fr 1.5fr"] {
        grid-template-columns: 1fr !important;
    }

    .section-header { flex-direction: column; align-items: flex-start; gap: 16px; overflow: hidden; width: 100%; }
    .section-header div:last-child { width: 100%; display: flex; gap: 8px; flex-wrap: wrap; }
    .section-header button { flex: 1; height: 44px; }

    #onboarding-widget { top: 80px; right: 10px; width: calc(100% - 20px); left: 10px; }
    .pulse-sidebar { display: none; }
    
    /* Support Chat */
    .support-widget { bottom: 86px; }
    .support-chat { right: -10px; bottom: 60px; width: calc(100vw - 32px); }
    
    /* Native Chat Subsystem */
    .chat-layout { flex-direction: column !important; }
    .chat-sidebar { 
        width: 100% !important; 
        border-right: none !important; 
        border-bottom: 1px solid var(--slate-200);
        height: 35vh;
        flex-shrink: 0;
    }
    .chat-sidebar #inbox-list {
        max-height: calc(35vh - 75px);
    }
}

.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* --- Toast Notification System --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 11000; /* Must be higher than modal-overlay (10000) */
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: white;
    color: var(--slate-900);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-weight: 600;
    pointer-events: auto;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.3s ease;
    min-width: 300px;
    display: flex;
    align-items: center;
}

.toast.error {
    border-left-color: #ef4444;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Quest / Onboarding Widget --- */
#onboarding-widget {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    z-index: 1000;
    overflow: hidden;
    animation: slideInDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Explicit hide for Portal Mode */
body.portal-mode #onboarding-widget {
    display: none !important;
}

@keyframes slideInDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.quest-header {
    background: var(--slate-900);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quest-header h4 {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.quest-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
}

.quest-item:hover {
    background: var(--slate-50);
}

.quest-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quest-icon.pending {
    border: 2px solid var(--slate-200);
    border-radius: 50%;
}

.quest-icon.completed {
    color: #10b981;
}

.quest-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-600);
}

.quest-item.completed .quest-text {
    color: var(--slate-400);
    text-decoration: line-through;
}

/* --- Side-Specific Toasts --- */
.toast-container.left {
    right: auto;
    left: 24px;
}

.toast.error-gate {
    background: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.1);
}


/* CACC Command Center Styles */
/* --- Chat Subsystem Overrides --- */
.chat-layout {
    display: flex;
    flex-direction: row;
}

.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--slate-200);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* User Profile Nav elements */
.cacc-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    width: 100%;
    color: var(--slate-600);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    text-align: left;
}

.cacc-tab:hover {
    background: var(--slate-100);
    color: var(--slate-900);
}

.cacc-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.cacc-tab i {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.cacc-tab.active i {
    opacity: 1;
}

/* Modal Overlay fix for deep immersion */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

/* --- GUEST GATE & NEW SECTIONS --- */
body.gate-open .sidebar, 
body.gate-open .pulse-sidebar {
    display: none !important;
}
body.gate-open .main-content {
    margin-left: 0;
    width: 100%;
    background: var(--bg-canvas);
    color: var(--text-main);
}

.ai-tpl-btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

/* Marketplace Storefront */
.domain-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 24px !important;
    flex-direction: row !important;
    width: auto !important;

    /* Reset Workspace List Bleed Properties: */
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    padding: 0 40px 40px 40px !important;
}

.storefront-section-header {
    padding: 0 40px !important;
    margin-bottom: 24px !important;
}

/* Storefront Wrapper - Integrated Workspace Styling */
body:not(.portal-mode) .storefront-wrapper {
    border-radius: 24px !important;
    overflow: hidden !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
    min-height: auto !important;
    background-clip: padding-box;
}

body:not(.portal-mode) .storefront-wrapper .marketplace-hero {
    border-radius: 0 !important; /* Let the parent container's rounded corner clip the hero card at the top! */
    margin-bottom: 32px !important;
}

.domain-card {
    background: white;
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
}
.domain-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

.domain-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.domain-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
#app-container > div {
    animation: fadeIn 0.4s ease forwards;
}
/* --- AI STUDIO CREATIVE WORKSPACE --- */
body.studio-mode .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

body.studio-mode #app-container {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.studio-layout {
    background: var(--studio-bg) !important;
    color: #f8fafc !important;
    min-height: 100vh;
    padding: 60px 80px !important;
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 80px;
    align-items: center;
    position: relative;
}

.studio-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 32px;
    position: sticky;
    top: 40px;
}

.studio-input-group {
    margin-bottom: 32px;
}

.studio-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

.studio-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
}
.studio-input:focus {
    border-color: var(--primary) !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

.template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.template-card {
    height: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    background: rgba(0,0,0,0.3);
}

.template-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.template-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.2);
}

.template-card .preview-thumb {
    width: 100%;
    height: 100%;
    opacity: 0.6;
    background-size: cover;
    background-position: center;
}

.template-card .label {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: white;
}

/* Stage Environment */
.stage-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 700px;
}

.canvas-frame {
    padding: 24px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 32px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
    position: relative;
}

.canvas-frame::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.05;
    z-index: -1;
    pointer-events: none;
}

#ai-canvas {
    border-radius: 12px;
    display: block;
    max-width: 100%;
    height: auto;
}

/* Transitions */
.studio-enter {
    animation: studioFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes studioFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Hide navigation in Studio Mode */
body.studio-mode .sidebar,
body.studio-mode .pulse-sidebar {
    display: none !important;
}

body.studio-mode .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* --- STUDIO TABS & LAYER MANAGEMENT --- */
.studio-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-bottom: 24px;
    padding: 4px;
}

.studio-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    padding: 10px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.studio-tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.studio-tab-content {
    display: none;
}
.studio-tab-content.active {
    display: block;
}

.layer-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
}

.layer-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.layer-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(0,0,0,0.2);
}

.magic-ai-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(79, 70, 229, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}

.btn-magic {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white !important;
    border: none;
    font-weight: 900;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.btn-magic:hover {
    transform: translateY(-2px) scale(1.02);
}

.scale-slider {
    width: 100%;
    accent-color: var(--primary);
    margin-top: 8px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    appearance: none;
}

/* Mouse cursor for canvas */
#ai-canvas.dragging {
    cursor: grabbing !important;
}

.layer-card .controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.font-selector {
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: white !important;
    height: 40px;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 0.8rem;
    flex: 1;
}

.text-input-hybrid {
    position: relative;
    width: 100%;
}

.text-input-hybrid input {
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: white !important;
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    width: 100%;
}

#ai-canvas.text-active {
    cursor: text;
}

.studio-tab-btn i {
    width: 16px;
    height: 16px;
}

/* --- PREMIUM STOREFRONT TEMPLATES --- */

/* STOREFRONT BG EDIT UI */
.storefront-hero-container:hover .storefront-bg-edit { opacity: 1 !important; }
#bg-edit-dropdown.active { display: flex !important; }

/* 1. THE VISIONARY (GoPro/Tech Inspired) */
.tpl-visionary { background: #020617; color: white; }
.tpl-visionary .marketplace-hero {
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent),
                linear-gradient(135deg, #020617 0%, #1e1b4b 100%) !important;
    border-radius: 0 0 60px 60px !important;
    padding: 12vw 5% !important;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.tpl-visionary h1 {
    font-size: clamp(3rem, 8vw, 6rem) !important;
    text-transform: uppercase;
    letter-spacing: -0.06em !important;
    color: white;
    text-shadow: 0 20px 50px rgba(0,0,0,0.5);
    font-weight: 900 !important;
}
.tpl-visionary #store-logo-main {
    border: 3px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6) !important;
}
.tpl-visionary .domain-card {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    color: white;
    border-radius: 20px;
}
.tpl-visionary .domain-card:hover { border-color: var(--primary); transform: translateY(-8px); }
.tpl-visionary .domain-name { color: white !important; font-family: 'Inter', sans-serif; }
.tpl-visionary .domain-price { color: var(--primary) !important; }

/* 2. ORGANIC MINIMALISM (Luxury/Skincare Inspired) */
.tpl-organic { background: transparent !important; color: #1e293b; }
.tpl-organic .marketplace-hero {
    background: #f8fafc !important;
    color: #1e293b !important;
    padding: 10vw 5% !important;
    box-shadow: none !important;
    border-bottom: 1px solid var(--border);
    border-radius: 0 !important;
}
.tpl-organic h1 {
    letter-spacing: -0.04em !important;
    color: #1e293b;
    font-weight: 300 !important;
    font-style: italic;
    font-family: 'Serif', Georgia, serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem) !important;
}
.tpl-organic #store-logo-main {
    border: 1px solid var(--border) !important;
    background: white !important;
    color: var(--slate-900) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.03) !important;
    border-radius: 50% !important;
}
.tpl-organic .domain-card {
    border: 2px solid var(--slate-200);
    background: white;
    box-shadow: 0 20px 40px rgba(0,0,0,0.02);
    border-radius: 32px;
}
.tpl-organic .domain-card:hover { box-shadow: 0 30px 60px rgba(0,0,0,0.05); border-color: var(--slate-300); }

/* 3. DYNAMIC FLOW (Sport/Energy Inspired) */
.tpl-dynamic { background: white; color: var(--slate-900); }
.tpl-dynamic .marketplace-hero {
    background: linear-gradient(115deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: white !important;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
    padding: 12vw 5% 18vw !important;
    border-radius: 0 !important;
}
.tpl-dynamic h1 {
    font-style: italic;
    font-weight: 950 !important;
    letter-spacing: -0.05em !important;
    transform: skewX(-6deg);
    font-size: clamp(3rem, 10vw, 7rem) !important;
    color: white;
}
.tpl-dynamic .domain-card {
    border: 3px solid #f1f5f9;
    border-radius: 0;
    transform: skewX(-2deg);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tpl-dynamic .domain-card:hover { 
    transform: skewX(-2deg) scale(1.05); 
    border-color: var(--primary); 
    box-shadow: 20px 20px 0 var(--primary-light);
}

/* 4. GLOSSY PREMIUM (Retail/Modern Inspired) */
.tpl-glossy { background: #f1f5f9; color: var(--slate-900); }
.tpl-glossy .marketplace-hero {
    background: radial-gradient(circle at center, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    border-radius: 0 0 100px 100px !important;
    padding: 14vw 5% !important;
}
.tpl-glossy .marketplace-hero::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/glass.png');
    opacity: 0.2; pointer-events: none;
}
.tpl-glossy h1 {
    font-weight: 900;
    font-size: clamp(2.5rem, 7vw, 5.5rem) !important;
    color: white;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.2));
}
.tpl-glossy .domain-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid rgba(255,255,255,0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    border-radius: 24px;
}
.tpl-glossy .domain-card:hover { 
    background: white; 
    border-color: var(--primary);
    transform: scale(1.02);
}

/* --- THEME SELECTOR UI --- */
.template-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 12px;
}
.template-option {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: white;
}
.template-option:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.template-option.active { border-color: var(--primary); background: var(--slate-50); box-shadow: 0 10px 15px -3px rgba(99,102,241,0.1); }
.template-option .preview-swatch { 
    width: 100%; height: 60px; border-radius: 8px; margin-bottom: 12px; 
    display: flex; align-items: center; justify-content: center; color: white; font-weight: 900; font-size: 0.8rem;
}
.template-option .label { font-size: 0.75rem; font-weight: 800; text-align: center; display: block; color: var(--slate-600); }
.template-option.active .label { color: var(--primary); }

/* --- High-Authority Portal V2 Styles --- */

/* --- AI Studio Luxury UI --- */
.studio-container { 
    max-height: 94vh; 
    overflow-y: auto; 
    padding: 40px; 
    background: var(--luxury-pearl); 
    min-height: 100vh; 
    animation: fadeIn 0.8s ease; 
}
.studio-max-wrap { max-width: 1400px; margin: 0 auto; }
.studio-header { margin-bottom: 40px; display: flex; justify-content: space-between; align-items: flex-end; }
.studio-badge { display: inline-flex; align-items: center; gap: 12px; padding: 8px 24px; background: rgba(197, 160, 89, 0.1); border-radius: 100px; margin-bottom: 16px; }
.studio-badge i { width: 16px; height: 16px; color: var(--luxury-gold); }
.studio-badge span { font-size: 0.75rem; font-weight: 800; color: var(--luxury-gold); text-transform: uppercase; letter-spacing: 2px; }
.studio-title { font-size: 3rem; letter-spacing: -3px; font-weight: 900; color: var(--luxury-charcoal); margin: 0; }
.studio-mode-switcher { display: flex; background: white; padding: 6px; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.studio-grid { display: grid; grid-template-columns: 420px 1fr; gap: 60px; align-items: start; }

/* --- Guest Gate / Landing Page --- */
.gate-container { min-height: 90vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-grid { max-width: 900px; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.gate-icon-wrap { width: 64px; height: 64px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 18px; display: flex; align-items: center; justify-content: center; margin-bottom: 32px; }
.gate-icon-wrap i { width: 32px; height: 32px; color: white; }
.gate-title { font-size: 3.5rem; font-weight: 900; line-height: 1.1; margin-bottom: 24px; letter-spacing: -2px; }
.gate-desc { font-size: 1.1rem; color: var(--slate-400); margin-bottom: 40px; line-height: 1.6; }
.gate-actions { display: flex; gap: 16px; }
.gate-actions .btn { height: 54px; padding: 0 32px; font-size: 1rem; }
.gate-activity-panel { padding: 40px; background: linear-gradient(135deg, rgba(249,115,22,0.05), rgba(0,0,0,0.02)); border: 1px solid var(--border); position: relative; overflow: hidden; }
.activity-label { font-size: 0.8rem; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.activity-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 24px; }
.activity-stack { display: flex; flex-direction: column; gap: 16px; }
.gate-bg-icon { position: absolute; bottom: -40px; right: -40px; opacity: 0.1; transform: rotate(-15deg); }
.gate-bg-icon i { width: 200px; height: 200px; }




.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 24px; 
    width: 100%;
}

.section-title-wrap {
    text-align: center;
    margin-bottom: 48px;
}

.section-title-wrap h2 {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.section-title-wrap p {
    color: var(--slate-500);
    font-weight: 600;
}

.marketplace-strip {
    max-width: 1200px;
    margin: 100px auto;
    padding: 0 24px;
}
.partners-strip {
    background: var(--slate-50);
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 60px;
    align-items: center;
    opacity: 0.6;
    filter: grayscale(1);
    transition: var(--transition);
}

.partners-strip:hover { filter: grayscale(0); opacity: 1; }

.partner-logo { font-weight: 800; color: var(--slate-400); font-size: 1.1rem; letter-spacing: -0.5px; }

.category-discovery {
    padding: 80px 24px;
    background: white;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 40px auto 0;
}

.category-tile {
    padding: 32px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.category-tile:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(249, 115, 22, 0.08);
}

.category-tile i {
    width: 32px;
    height: 32px;
    color: var(--primary);
    margin-bottom: 16px;
}

.category-tile h4 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--slate-900);
}

.category-tile span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--slate-400);
}

.brokerage-section {
    padding: 100px 24px;
    background: #ffffff;
    color: var(--slate-900);
    overflow: hidden;
    position: relative;
}

.brokerage-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 80px;
}

.brokerage-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 99px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.brokerage-content h2 { color: var(--slate-900); font-size: 2.5rem; line-height: 1.1; margin-bottom: 24px; }
.brokerage-content p { color: var(--slate-600); font-size: 1.1rem; line-height: 1.6; margin-bottom: 32px; }

.enterprise-footer {
    background: var(--primary);
    padding: 80px 24px 40px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: white;
}

.enterprise-footer p {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
}

.footer-col h4 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: white;
    margin-bottom: 24px;
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { color: rgba(255,255,255,0.8); font-weight: 600; font-size: 1rem; }
.footer-links a:hover { color: white; }

.footer-bottom {
    max-width: 1200px;
    margin: 60px auto 0;
    padding-top: 40px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- Mobile Logic for Portal V2 --- */
@media (max-width: 768px) {
    .partners-strip { gap: 30px; padding: 24px 20px; overflow-x: auto; justify-content: flex-start; }
    .hero-portal h1 { font-size: 2.2rem; }
    .brokerage-container { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .brokerage-badge { justify-content: center; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero-portal { padding: 60px 20px; }
}

/* --- Mobile Optimizations for Marketplace Storefronts --- */
@media (max-width: 768px) {
    .marketplace-hero { padding: 60px 20px !important; border-radius: 0 0 30px 30px !important; }
    .tpl-visionary h1, .tpl-organic h1, .tpl-dynamic h1, .tpl-glossy h1 { font-size: 2.5rem !important; letter-spacing: -1px !important; }
    #store-logo-main { width: 80px !important; height: 80px !important; font-size: 2rem !important; }
    .domain-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
    .tpl-dynamic .marketplace-hero { clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%); }
    .tpl-glossy .marketplace-hero { border-radius: 0 0 50px 50px !important; }
}

/* ============================================================
   COMPREHENSIVE MOBILE OPTIMIZATION LAYER
   Targets all known overflow/collision issues on screens ≤768px
   ============================================================ */
@media (max-width: 768px) {

    /* --- TOAST: move to top-center instead of top-right --- */
    .toast-container {
        top: 70px !important;
        right: 12px !important;
        left: 12px !important;
        align-items: stretch;
    }
    .toast { min-width: 0 !important; width: 100%; font-size: 0.85rem; }

    /* --- DOMAIN ROW ACTIONS: wrap buttons instead of overflowing --- */
    .domain-row .row-actions {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .domain-row .row-actions .btn {
        flex: 1;
        min-width: 44px;
        height: 44px !important;
        font-size: 0.8rem;
    }
    /* Trash icon admin button on mobile */
    .domain-row .row-actions button[style*="width:40px"] {
        width: 44px !important;
        height: 44px !important;
        flex-shrink: 0;
    }

    /* --- FILTER BAR: stack search and category vertically --- */
    [style*="display:flex"][style*="gap:12px"] > .form-input,
    [style*="display:flex"][style*="gap:16px"] > .form-input {
        width: 100% !important;
    }
    /* Marketplace filter row */
    #search-input { height: 44px; font-size: 0.95rem; }
    #filter-category { height: 44px !important; width: 100% !important; }

    /* --- VAULT/BANNER: collapse padding --- */
    .pulse-panel[style*="padding:40px"] {
        padding: 24px 16px !important;
    }
    /* Vault benefit inner text */
    .pulse-panel h2[style*="font-size:2rem"] { font-size: 1.4rem !important; }

    /* --- STATS GRID: single column on very small screens --- */
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* --- SELL / AUTH FORMS: full-width stacking --- */
    [style*="display:flex"][style*="gap:24px"] > div,
    [style*="display:flex"][style*="gap:32px"] > div {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* --- SECTION HEADER BUTTONS: full-width touch targets --- */
    .section-header .btn,
    .section-header button {
        width: 100%;
        height: 48px !important;
        font-size: 0.9rem;
        justify-content: center;
    }

    /* --- TABLES: horizontal scroll wrapper --- */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    table { min-width: 600px; }

    /* --- MODAL CARD: full-width with smaller padding --- */
    .modal-card {
        width: 96% !important;
        padding: 24px 16px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* --- DOMAIN DETAIL PAGE: stacked layout --- */
    [style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* --- PROFILE / AUTH PAGES: comfortable inputs --- */
    .form-input { height: 52px; font-size: 1rem; }
    .btn-block { height: 52px !important; font-size: 1rem !important; }

    /* --- DASHBOARD STORE SETTINGS: single column --- */
    [style*="grid-template-columns: 1fr 1.5fr"] {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* --- MESSAGES: Ensure action buttons are readable --- */
    [style*="display:flex"][style*="gap:12px"] > button {
        white-space: nowrap;
    }

    /* --- SECTION TITLE SIZES --- */
    h1[style*="font-size:2.5rem"],
    h1[style*="font-size:2.2rem"] {
        font-size: 1.6rem !important;
        letter-spacing: -0.5px !important;
    }
    h1[style*="font-size:3rem"],
    h1[style*="font-size:3.5rem"] {
        font-size: 2rem !important;
    }

    /* --- CONNECT / WALL: Admin purge button alignment --- */
    .pulse-panel button[style*="position:absolute"] {
        top: 12px !important;
        right: 12px !important;
    }

    /* --- NFC / OWNER PANEL: audience hub table --- */
    #user-table-body td:nth-child(4) code {
        max-width: 120px !important;
        font-size: 0.55rem !important;
    }

    /* --- BOTTOM NAV: ensure support widget clears it --- */
    .support-widget { bottom: 78px !important; }

    /* --- GENERAL FLEX ROWS that stack on mobile --- */
    .flex-mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .flex-mobile-stack > * { width: 100% !important; }
    
    /* --- PORTAL MOBILE OVERHAUL (FORCED RESET) --- */
    body.portal-mode { padding: 0 !important; margin: 0 !important; }
    body.portal-mode .main-content { padding: 0 !important; margin: 0 !important; }
    
    .portal-header { height: auto !important; padding: 12px 0 !important; }
    .portal-nav-container { flex-direction: column !important; gap: 12px !important; padding: 12px 16px !important; }
    .portal-nav-links { gap: 16px !important; flex-wrap: wrap !important; justify-content: center !important; }
    .portal-nav-links a { font-size: 0.825rem !important; color: white !important; font-weight: 800 !important; }
    .portal-auth-btn { width: 100% !important; justify-content: center !important; }
    .portal-auth-btn .btn { flex: 1 !important; height: 44px !important; font-size: 0.85rem !important; }

    .hero-portal { padding: 60px 16px 40px !important; }
    .hero-portal h1 { font-size: 2.2rem !important; margin-bottom: 16px !important; letter-spacing: -1px !important; }
    .hero-portal p { font-size: 1rem !important; margin-bottom: 32px !important; }

    .search-box-premium { 
        flex-direction: column !important; 
        background: transparent !important; 
        box-shadow: none !important; 
        border: none !important; 
        padding: 0 !important;
        gap: 16px !important;
        width: 100% !important;
    }

    .search-input-wrapper {
        width: 100% !important;
        background: white !important;
        border: 1.5px solid var(--border) !important; 
        border-radius: 16px !important; 
        box-shadow: var(--shadow-md) !important;
        transition: all 0.3s ease;
    }

    .search-box-premium:focus-within .search-input-wrapper {
        border-color: var(--primary) !important;
        box-shadow: 0 12px 24px rgba(249, 115, 22, 0.12) !important;
    }

    .search-input-wrapper i {
        left: 16px !important;
        width: 18px !important;
        height: 18px !important;
    }

    .search-box-premium input { 
        width: 100% !important; 
        border: none !important; 
        border-radius: 16px !important; 
        height: 56px !important;
        background: transparent !important;
        box-shadow: none !important;
        font-size: 1rem !important;
        padding: 0 16px 0 48px !important;
    }

    .search-box-premium .btn { 
        width: 100% !important; 
        height: 56px !important; 
        border-radius: 16px !important;
        font-size: 1.05rem !important;
        box-shadow: 0 8px 16px rgba(249, 115, 22, 0.2) !important;
    }


    /* Section Gaps reduction */
    .category-discovery { padding: 60px 16px !important; }
    .brokerage-section { padding: 60px 16px !important; }
    .marketplace-strip { margin: 60px auto !important; padding: 0 16px !important; }
    .enterprise-footer { padding: 60px 16px !important; }
    .footer-grid { gap: 32px !important; }

    .container { padding: 0 16px !important; }
    .section-title-wrap { margin-bottom: 24px !important; }
    .section-title-wrap h2 { font-size: 1.8rem !important; }
    .section-title-wrap p { font-size: 0.9rem !important; }

    .studio-container { padding: 16px !important; }
    .studio-header { flex-direction: column; align-items: flex-start !important; gap: 20px; }
    .studio-title { font-size: 2rem !important; }
    .studio-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
    .studio-mode-switcher { width: 100%; justify-content: space-between; }

    .gate-grid { grid-template-columns: 1fr !important; gap: 40px !important; text-align: center; }
    .gate-icon-wrap { margin: 0 auto 24px; }
    .gate-title { font-size: 2.2rem !important; margin-bottom: 16px; }
    .gate-actions { flex-direction: column; }
    .gate-activity-panel { padding: 24px 16px !important; }

    #onboarding-widget { display: none !important; }
}

/* Extra small phones */
@media (max-width: 400px) {
    #app-container { padding: 8px !important; }

    .domain-row { padding: 14px !important; }

    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    .btn { font-size: 0.78rem; padding: 0 10px; }

    h1[style*="font-size"] { font-size: 1.4rem !important; }
}

/* Guest Exit Flow */
.guest-back-btn {
    position: fixed;
    top: 105px;
    right: 16px;
    height: 40px;
    padding: 0 16px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}



.guest-back-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-2px);
    border-color: var(--primary);
}

.guest-back-btn i {
    width: 18px;
    height: 18px;
}

/* Auth Dropdown Logic */
.auth-dropdown {
    position: fixed;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    z-index: 10002; /* Higher than exit guest button if they ever overlap */
}


.auth-trigger {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-trigger:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--primary);
}

.auth-menu-content {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 12px;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 8px;
    width: 200px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 10001;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: slideUpFade 0.3s ease;
}

.auth-menu-content.active {
    display: flex;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .auth-menu-content {
        position: fixed;
        top: auto;
        bottom: 80px;
        left: 16px;
        width: calc(100% - 32px);
    }
}

/* --- FAQ Accordion Section --- */
.seo-faq-section {
    padding: 60px 24px;
    background: var(--slate-50);
    border-top: 1px solid var(--border);
}

.faq-container {
    max-width: 900px;
    margin: 0 auto;
}

.faq-header {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 40px;
    color: var(--slate-900);
}

.faq-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: var(--shadow-sm);
}

.faq-question {
    width: 100%;
    text-align: left;
    background: transparent;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--slate-900);
    cursor: pointer;
}

.faq-question i {
    color: var(--slate-500);
    width: 20px;
    height: 20px;
    transition: color 0.3s ease;
}

.faq-item.active .faq-question i {
    color: var(--slate-900);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.faq-answer p {
    padding: 0 24px 24px 24px;
    color: var(--slate-600);
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
}

/* Auth Separator for Google Login Option */
.auth-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--slate-400);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.auth-separator::before,
.auth-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--slate-200);
}

.auth-separator:not(:empty)::before {
    margin-right: 12px;
}

.auth-separator:not(:empty)::after {
    margin-left: 12px;
}

/* --- STOREFRONT CUSTOM TRANSPARENT BOTTOM & WHITE CARDS --- */
.storefront-wrapper,
.storefront-wrapper.tpl-visionary,
.storefront-wrapper.tpl-organic,
.storefront-wrapper.tpl-dynamic,
.storefront-wrapper.tpl-glossy {
    background: transparent !important;
}

.storefront-wrapper .domain-card {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 16px !important;
    color: var(--slate-800) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
    transform: none !important;
    transition: all 0.3s ease !important;
}

.storefront-wrapper .domain-card:hover {
    background: #ffffff !important;
    border-color: var(--primary) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06) !important;
}

.storefront-wrapper .domain-name {
    color: var(--primary) !important;
}

.storefront-wrapper .domain-price {
    color: var(--slate-900) !important;
}

.storefront-wrapper .domain-meta {
    color: var(--slate-500) !important;
}

/* --- COOKIE CONSENT SYSTEM (all devices) --- */
html.cookie-consent-skip #cookie-consent-banner {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

html.has-cookie-banner body {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* Small cookie button — only after user has made a choice */
.cookie-fab {
    position: fixed;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 2147482999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(249, 115, 22, 0.55);
    background: linear-gradient(145deg, #1e293b, #0f172a);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.6);
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

html.cookie-fab-visible .cookie-fab {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
}

html.cookie-fab-visible .cookie-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
}

.cookie-fab.cookie-fab--pop {
    animation: cookie-fab-pop 0.45s cubic-bezier(0.34, 1.45, 0.64, 1);
}

@keyframes cookie-fab-pop {
    0% {
        opacity: 0;
        transform: scale(0.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 520px) {
    .cookie-fab {
        left: 12px;
        bottom: calc(86px + env(safe-area-inset-bottom, 0px)); /* Lift above 70px mobile nav bar */
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

html.has-cookie-banner .support-widget {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    transform: none;
    z-index: 2147483000;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.97) 0%, rgba(15, 23, 42, 0.99) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: cookie-banner-in 0.22s ease-out;
}

@keyframes cookie-banner-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bar shrinks away, then small cookie button appears */
.cookie-banner.cookie-banner--shrinking {
    animation: cookie-banner-shrink 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
    transform-origin: left bottom;
}

@keyframes cookie-banner-shrink {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        border-radius: 0;
    }
    55% {
        opacity: 0.9;
        transform: translateY(8px) scale(0.92);
    }
    100% {
        opacity: 0;
        transform: translateY(24px) scale(0.12);
        border-radius: 50%;
        max-height: 48px;
    }
}

.cookie-banner-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
}

.cookie-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.cookie-banner-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: rgba(249, 115, 22, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cookie-emoji {
    font-size: 1.65rem;
    line-height: 1;
    display: block;
}

.cookie-banner-text h4 {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.cookie-banner-text p {
    color: #94a3b8;
    font-size: clamp(0.72rem, 2.2vw, 0.82rem);
    line-height: 1.45;
    margin: 0;
}

.cookie-banner-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-banner-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.cookie-btn {
    font-family: inherit;
    font-size: clamp(0.7rem, 2vw, 0.78rem);
    font-weight: 700;
    padding: 10px 14px;
    min-height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.cookie-btn--ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.22);
}

.cookie-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12);
}

.cookie-btn--primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.cookie-btn--primary:hover {
    filter: brightness(1.06);
}

.cookie-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2147483001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cookie-modal-panel {
    background: var(--bg-card);
    color: var(--text-main);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    padding: 28px 28px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: relative;
}

.cookie-modal-panel h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.cookie-modal-intro {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.55;
    margin: 0 0 20px;
}

.cookie-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
}

.cookie-pref-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.cookie-pref-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.cookie-pref-item strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.cookie-pref-item p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.cookie-pref-tag {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #16a34a;
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 9999px;
    vertical-align: middle;
}

.cookie-pref-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 4px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.cookie-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.cookie-google-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    padding: 12px;
    background: var(--bg-canvas);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

.cookie-google-hint a {
    color: var(--primary);
    font-weight: 700;
}

/* Tablet */
@media (max-width: 900px) {
    .cookie-banner-inner {
        flex-wrap: wrap;
        gap: 12px;
    }

    .cookie-banner-actions {
        width: 100%;
        justify-content: stretch;
    }

    .cookie-banner-actions .cookie-btn {
        flex: 1;
        min-width: 0;
        text-align: center;
        white-space: normal;
        padding: 10px 10px;
    }

    html.has-cookie-banner body {
        padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px));
    }
}

/* Phone */
@media (max-width: 520px) {
    .cookie-banner-inner {
        padding: 12px 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-banner-content {
        align-items: flex-start;
    }

    .cookie-banner-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .cookie-emoji {
        font-size: 1.45rem;
    }

    .cookie-banner-actions {
        flex-direction: column;
        width: 100%;
    }

    .cookie-banner-actions .cookie-btn {
        width: 100%;
        flex: none;
        min-height: 44px;
        font-size: 0.8rem;
    }

    html.has-cookie-banner body {
        padding-bottom: calc(200px + env(safe-area-inset-bottom, 0px));
    }

    html.has-cookie-banner .support-widget {
        bottom: calc(208px + env(safe-area-inset-bottom, 0px));
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .cookie-banner-text h4 {
        font-size: 0.85rem;
    }

    .cookie-banner-actions .cookie-btn {
        font-size: 0.72rem;
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .cookie-modal-actions {
        flex-direction: column;
    }

    .cookie-modal-actions .cookie-btn {
        width: 100%;
        min-height: 44px;
    }

    .cookie-modal-panel {
        max-height: 85vh;
        padding: 22px 18px 18px;
    }
}

/* =============================================
   STEP 8: PUBLIC PROFILE PAGE
   ============================================= */
.profile-page-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.profile-hero {
    border-radius: 24px;
    padding: 60px 40px 40px;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    color: white;
    min-height: 280px;
    display: flex;
    align-items: flex-end;
}

.profile-hero-inner {
    display: flex;
    align-items: flex-end;
    gap: 28px;
    width: 100%;
    flex-wrap: wrap;
}

.profile-avatar-ring {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    padding: 4px;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3), 0 20px 40px rgba(0,0,0,0.3);
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
}

.profile-hero-info {
    flex: 1;
    min-width: 200px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.profile-username {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -2px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.profile-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-badge-verified {
    background: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,0.4);
}

.profile-badge-premium {
    background: rgba(249,115,22,0.3);
    color: #fdba74;
    border: 1px solid rgba(249,115,22,0.4);
}

.profile-bio {
    font-size: 0.9rem;
    opacity: 0.85;
    margin: 0 0 12px;
    line-height: 1.6;
    max-width: 500px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.profile-meta-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    opacity: 0.75;
    font-weight: 600;
}

.profile-meta-row span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.profile-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
    align-self: flex-start;
    padding-top: 8px;
}

.profile-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 20px 20px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.profile-stat {
    padding: 20px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.profile-stat:last-child {
    border-right: none;
}

.profile-stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--slate-800);
    line-height: 1;
    margin-bottom: 4px;
}

.profile-stat-label {
    font-size: 0.72rem;
    color: var(--slate-400);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-listings-section {
    margin-top: 8px;
}

.profile-listings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.profile-domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.profile-domain-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.profile-domain-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(249,115,22,0.1);
}

.profile-domain-name {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--slate-800);
    margin-bottom: 8px;
    word-break: break-all;
}

.profile-domain-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.profile-domain-price {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--primary);
    margin-top: auto;
}

/* =============================================
   STEP 10: MARKETPLACE FILTER BAR
   ============================================= */
.marketplace-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.marketplace-filter-bar .form-input {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.marketplace-filter-bar .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

/* =============================================
   STEP 11: MOBILE OPTIMIZATION & DRAWER MENU
   ============================================= */

/* Mobile hamburger button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--slate-100);
}

/* Workspace Topbar base style */
.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--sidebar-bg);
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: 990;
}

.topbar-logo {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.topbar-logo img {
    height: 32px;
    width: auto;
}

/* Hide topbar when in portal guest mode */
.portal-mode .topbar {
    display: none !important;
}

/* Drawer overlay */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.drawer-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile sidebar drawer */
.sidebar-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--sidebar-bg);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar-drawer.open {
    transform: translateX(0);
}

.sidebar-drawer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Responsive Breakpoints ---- */
@media (max-width: 1024px) {
    .profile-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .profile-stat:nth-child(2) {
        border-right: none;
    }
    .profile-stat:nth-child(3) {
        border-top: 1px solid var(--border);
    }
    .profile-stat:nth-child(4) {
        border-top: 1px solid var(--border);
    }
    .profile-hero {
        padding: 40px 24px 32px;
    }
}

@media (max-width: 768px) {
    /* Sidebar hidden on mobile; shown via drawer */
    .sidebar {
        display: none !important;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Main layout full width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Show workspace topbar on mobile (hidden on desktop) */
    .topbar {
        display: flex !important;
        padding: 0 16px !important;
    }

    /* Push main content below topbar on mobile */
    body:not(.portal-mode) .main-content {
        padding-top: 60px;
    }

    /* Adjust app container top padding on mobile */
    body:not(.portal-mode) #app-container {
        padding-top: 16px !important;
    }

    /* Section header stacks on mobile */
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }

    /* Filter bar full-width on mobile */
    .marketplace-filter-bar {
        width: 100%;
    }

    .marketplace-filter-bar .form-input,
    .marketplace-filter-bar select,
    .marketplace-filter-bar input[type="text"],
    .marketplace-filter-bar input[type="number"] {
        flex: 1;
        min-width: 80px;
    }

    .marketplace-filter-bar > div:last-child {
        width: 100%;
        justify-content: flex-start;
    }

    /* Profile page mobile */
    .profile-hero {
        padding: 80px 20px 28px;
        border-radius: 16px;
        min-height: auto;
    }

    .profile-hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .profile-avatar-ring {
        width: 80px;
        height: 80px;
    }

    .profile-avatar {
        font-size: 1.8rem;
    }

    .profile-username {
        font-size: 1.6rem;
        letter-spacing: -1px;
    }

    .profile-hero-actions {
        margin-left: 0;
        width: 100%;
    }

    .profile-hero-actions .btn {
        flex: 1;
    }

    .profile-stats-bar {
        grid-template-columns: repeat(2, 1fr);
        border-radius: 0 0 12px 12px;
    }

    .profile-domain-grid {
        grid-template-columns: 1fr;
    }

    /* Profile settings phone grid stacks on mobile */
    #profile-settings-panel [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard grid 1 col */
    .responsive-grid {
        grid-template-columns: 1fr !important;
    }

    /* Store settings grid */
    #store-settings-panel > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Domain row on mobile */
    .domain-row {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .domain-row .row-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Pulse panel */
    .pulse-panel {
        padding: 20px !important;
    }

    /* Modal card full width */
    .modal-card {
        margin: 12px !important;
        max-width: calc(100vw - 24px) !important;
    }

    /* Auth forms */
    .auth-container {
        padding: 24px !important;
        margin: 20px !important;
    }

    /* App container padding */
    #app-container {
        padding: 16px !important;
    }
}

/* Seller phone-verified badge on listings */
.seller-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.seller-verified-badge--compact {
    padding: 2px 5px;
}

/* Legal & contact page layout */
.legal-page-grid,
.contact-page-grid {
    display: grid;
    gap: 32px;
}

.legal-page-grid {
    grid-template-columns: 220px 1fr;
}

.contact-page-grid {
    grid-template-columns: 1.2fr 1fr;
}

@media (max-width: 768px) {
    .legal-page-grid,
    .contact-page-grid {
        grid-template-columns: 1fr;
    }

    .toc-sidebar {
        position: static !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 8px !important;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border);
    }

    .toc-sidebar a {
        background: var(--bg-canvas);
        padding: 6px 12px;
        border-radius: 9999px;
        border: 1px solid var(--border);
    }
}

@media (max-width: 480px) {
    .profile-username {
        font-size: 1.3rem;
    }

    .profile-meta-row {
        gap: 12px;
        font-size: 0.72rem;
    }

    .marketplace-filter-bar {
        gap: 8px;
    }

    /* Topbar compact */
    .topbar-logo img {
        height: 28px !important;
    }

    /* Hide less important filter elements */
    #filter-sort {
        display: none;
    }
}


/* ==========================================================================
   TARGETED MOBILE OPTIMIZATION (Fixing the Marketplace & Layout)
   ========================================================================== */

@media (max-width: 768px) {
    /* Global Padding */
    .page-container, #appContainer > div:not(.sidebar) {
        padding: 16px !important;
    }

    /* Top Typography */
    h1[style*="font-size: 2.5rem"] {
        font-size: 1.8rem !important;
        margin-bottom: 4px !important;
    }

    /* Marketplace Filter Bar */
    .marketplace-filter-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .marketplace-filter-bar > div:first-child,
    .marketplace-filter-bar input#search-input {
        width: 100% !important; 
    }

    .marketplace-filter-bar select {
        width: 100% !important; /* Stack selects on very small screens */
    }

    /* Price Min/Max */
    .marketplace-filter-bar > div:last-child {
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    #filter-price-min, #filter-price-max {
        flex: 1 !important;
        width: auto !important;
    }

    /* Vault Banner adjustments */
    .vault-banner {
        padding: 20px !important;
        border-radius: 16px !important;
    }

    .vault-banner h2 {
        font-size: 1.5rem !important;
    }

    .vault-banner p {
        font-size: 0.9rem !important;
    }
    
    .vault-banner > div:first-child {
        padding: 0 !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .marketplace-filter-bar select {
        width: 100% !important;
    }
}

/* Storefront Profile Optimization */
@media (max-width: 768px) {
    .storefront-hero-container {
        padding: 40px 16px !important;
        border-radius: 16px !important;
        margin-bottom: 24px !important;
    }
    .storefront-hero-container h1 {
        font-size: 2.2rem !important;
        letter-spacing: -1px !important;
        word-break: break-word !important;
    }
    .storefront-hero-container > div[style*="display:flex"][style*="gap:16px"] {
        flex-direction: column !important;
        width: 100% !important;
    }
    .storefront-hero-container > div[style*="display:flex"][style*="gap:16px"] button {
        width: 100% !important;
        height: 46px !important;
    }
}

/* ==========================================================================
   ULTIMATE MOBILE OPTIMIZATION OVERRIDE 
   (Forces inline styles to yield on mobile screens)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. Global Page Paddings */
    .page-container, #appContainer > div {
        padding: 16px !important;
    }

    /* 2. Force Inline Grids to Stack */
    [style*="grid-template-columns: 1fr 340px"],
    [style*="grid-template-columns: 1fr 300px"],
    [style*="grid-template-columns: 1fr 280px"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns: repeat(auto-fill, minmax(280px, 1fr))"],
    [style*="grid-template-columns: 300px 1fr"],
    [style*="grid-template-columns: 1fr auto"],
    [style*="grid-template-columns: auto 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* 3. Collapse Inline Flex Layouts that should wrap/stack */
    [style*="display: flex"][style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }

    /* 4. Fix Giant Inline Fonts */
    [style*="font-size: 4.5rem"], [style*="font-size:4.5rem"] { font-size: 2.2rem !important; line-height: 1.1 !important; word-wrap: break-word; }
    [style*="font-size: 4rem"], [style*="font-size:4rem"] { font-size: 2rem !important; line-height: 1.1 !important; word-wrap: break-word; }
    [style*="font-size: 3rem"], [style*="font-size:3rem"] { font-size: 1.8rem !important; line-height: 1.2 !important; word-wrap: break-word; }
    [style*="font-size: 2.5rem"], [style*="font-size:2.5rem"] { font-size: 1.6rem !important; line-height: 1.2 !important; }
    [style*="font-size: 2rem"], [style*="font-size:2rem"] { font-size: 1.4rem !important; }

    /* 5. Fix Large Inline Paddings/Margins */
    [style*="padding: 48px"], [style*="padding:48px"] { padding: 16px !important; }
    [style*="padding: 40px"], [style*="padding:40px"] { padding: 16px !important; }
    [style*="padding: 32px"], [style*="padding:32px"] { padding: 16px !important; }
    [style*="padding: 24px"], [style*="padding:24px"] { padding: 16px !important; }
    [style*="padding: 10vw 20px"] { padding: 32px 16px !important; }
    
    /* 6. Ensure inputs and buttons don't overflow */
    .form-input, select, textarea {
        max-width: 100% !important;
    }

    /* 7. Hide desktop-only sidebars if they conflict */
    #pulse-feed {
        display: none !important; 
    }

    /* 8. Specific Component Overrides */
    
    /* Storefront Hero */
    .storefront-hero-container {
        padding: 24px 16px !important;
        border-radius: 16px !important;
    }
    .storefront-hero-container > div[style*="display:flex"][style*="gap:16px"] {
        flex-direction: column !important;
        width: 100% !important;
    }
    .storefront-hero-container > div[style*="display:flex"][style*="gap:16px"] button {
        width: 100% !important;
        height: 48px !important;
    }

    /* Filter Bars */
    .marketplace-filter-bar {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    .marketplace-filter-bar > div, 
    .marketplace-filter-bar input,
    .marketplace-filter-bar select {
        width: 100% !important;
    }
    .marketplace-filter-bar > div[style*="justify-content: space-between"] {
        flex-direction: row !important;
        gap: 8px !important;
    }
    .marketplace-filter-bar > div[style*="justify-content: space-between"] input {
        flex: 1 !important;
    }

    /* Domain Cards */
    .domain-card {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    .domain-card [style*="display: flex"][style*="align-items: center"][style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    .domain-card .action-buttons {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .domain-card .action-buttons button {
        width: 100% !important;
    }

    /* Gate / Landing */
    .gate-container {
        flex-direction: column !important;
    }
    .gate-content {
        padding: 32px 16px !important;
    }
    .gate-activity-panel {
        display: none !important; /* Hide right panel on landing */
    }

    /* Modals */
    .modal-content {
        width: 95% !important;
        margin: 10px auto !important;
        padding: 20px !important;
    }

    /* AI Studio Canvas */
    #studio-layout {
        flex-direction: column !important;
    }
    #canvas-container {
        height: 50vh !important;
        width: 100% !important;
    }

    /* Prevent body scroll overflow */
    body {
        overflow-x: hidden !important;
    }
}

/* ==========================================================================
   URGENT MOBILE FIXES: SCROLLING & BOTTOM PADDING
   ========================================================================== */

@media (max-width: 768px) {
    /* Restore vertical scrolling and remove trapped overflow */
    html, body {
        overflow-y: auto !important;
        overflow-x: clip !important; /* Safer than hidden for mobile */
        height: auto !important;
        min-height: 100vh !important;
    }

    #appContainer, .page-container, .dashboard-container {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
    }

    /* Add massive bottom padding so users can scroll PAST the floating widgets (support icon, cookie icon) */
    #appContainer > div {
        padding-bottom: 120px !important;
    }

    /* Fix the pulse panel wrapping for the Embed Widget Generator buttons */
    .pulse-panel > div[style*="display:flex"][style*="gap:12px"] {
        flex-wrap: wrap !important;
    }
    .pulse-panel > div[style*="display:flex"][style*="gap:12px"] button {
        flex: 1 !important;
        min-width: 140px !important;
    }
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION BAR (Scrollable)
   ========================================================================== */

@media (max-width: 768px) {
    /* Hide the hamburger top menu since we use bottom nav now */
    .topbar-mobile, .mobile-menu-btn {
        display: none !important;
    }

    /* Force the sidebar to be a fixed bottom navigation bar */
    .sidebar {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: 70px !important;
        flex-direction: row !important;
        background: var(--sidebar-bg, #0f172a) !important;
        z-index: 9999 !important;
        border-top: 1px solid rgba(255,255,255,0.1) !important;
        border-right: none !important;
        padding: 0 !important;
        align-items: center !important;
    }

    /* Hide the logo from the bottom nav */
    .sidebar-logo {
        display: none !important;
    }

    /* Make the nav links a scrollable horizontal row */
    .sidebar-nav {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        height: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        align-items: center !important;
        gap: 0 !important;
        padding: 0 10px !important;
    }

    /* Hide scrollbar */
    .sidebar-nav::-webkit-scrollbar {
        display: none !important;
    }

    /* Style the individual buttons */
    .nav-item {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        height: 100% !important;
        min-width: 72px !important;
        padding: 0 8px !important;
        gap: 4px !important;
        border-radius: 0 !important;
        color: rgba(255,255,255,0.6) !important;
        background: transparent !important;
    }

    .nav-item.active {
        color: var(--primary) !important;
    }

    .nav-item i {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
    }

    /* Show the text on the buttons for clarity */
    .nav-item span {
        display: block !important;
        font-size: 0.65rem !important;
        text-align: center !important;
        line-height: 1 !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* Adjust the main content so it doesn't get hidden under the bottom nav */
    #appContainer > div, .main-content {
        padding-bottom: 100px !important; 
    }

    /* If there's a profile or settings at the bottom of the sidebar, hide it or position it */
    .sidebar > div:last-child {
        display: none !important;
    }
}

/* Push floating widgets up so they don't block the new bottom nav bar */
@media (max-width: 768px) {
    .support-widget,
    #cookie-consent,
    [style*="position: fixed"][style*="bottom: 24px"],
    .fixed.bottom-4 {
        bottom: 90px !important; 
    }
}

/* ==========================================================================
   CENTER & ENLARGE MOBILE TOPBAR LOGO
   ========================================================================== */

@media (max-width: 768px) {
    /* Center the logo in the topbar */
    .topbar {
        justify-content: center !important;
        align-items: center !important;
        height: 70px !important; /* Make topbar slightly taller to fit big logo */
    }

    /* Hide the 40px spacer div that was pushing it off-center */
    .topbar > div[style*="width: 40px"] {
        display: none !important;
    }

    /* Make the logo bigger */
    .topbar-logo {
        margin: 0 auto !important; /* Force center */
    }

    .topbar-logo img {
        height: 42px !important; /* Significantly larger */
        width: auto !important;
    }

    /* Adjust page padding to account for taller topbar */
    body:not(.portal-mode) .main-content {
        padding-top: 70px !important;
    }
}

/* --- Scroll Animations --- */
.scroll-animate { opacity: 0; transform: translateY(30px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); will-change: opacity, transform; }
.scroll-animate.animate-in { opacity: 1; transform: translateY(0); }
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
