@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cinzel+Decorative:wght@700&family=Playfair+Display:wght@400;600;700;900&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-dark: #07090e;
    --bg-surface: #0c111c;
    --bg-card: #0e1420;
    --bg-card-hover: #131b2b;
    --bg-input: #080c14;
    
    /* Gold & Amber Palette */
    --gold-primary: #d4af37;
    --gold-light: #f3e5ab;
    --gold-bright: #e6ca65;
    --gold-dim: rgba(212, 175, 55, 0.2);
    --gold-glow: rgba(212, 175, 55, 0.35);
    
    /* Celestial & Emerald Accents */
    --cyan-accent: #38bdf8;
    --cyan-glow: rgba(56, 189, 248, 0.3);
    --emerald-accent: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.25);
    --amber-accent: #f59e0b;
    --danger: #ef4444;

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-gold: #e6ca65;

    /* Borders & Shadows — Solid, no glass */
    --border-subtle: rgba(212, 175, 55, 0.12);
    --border-bright: rgba(212, 175, 55, 0.4);
    --border-cyan: rgba(56, 189, 248, 0.2);
    --shadow-card: 6px 6px 16px #040609, -4px -4px 12px #121a2e;
    --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.15);
    
    /* Neumorphic 2.0 Tokens */
    --neu-bg: #0e1420;
    --neu-shadow-dark: #060a10;
    --neu-shadow-light: #161e30;
    --neu-radius: 24px;
    
    /* Geometry: Sharp for structure, Soft for interaction */
    --radius-sharp: 2px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    /* Spring & Physics Easing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-heading: 'Cinzel', serif;
    --font-ornate: 'Cinzel Decorative', serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(212, 175, 55, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(56, 189, 248, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.02) 0%, transparent 60%);
    position: relative;
}

/* Grain Texture Overlay — Analogue depth */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px 180px;
}

/* Background Canvas for Sacred Particles */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1750px;
    margin: 0 auto;
    padding: 12px 20px;
    gap: 12px;
}

/* Header — Solid surface, no glass */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sharp);
    box-shadow: var(--shadow-card);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold-primary), #422006);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px var(--gold-glow);
    border: 1px solid var(--gold-light);
}

.brand-logo svg {
    width: 26px;
    height: 26px;
    fill: #000;
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 20%, var(--gold-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-badge {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sharp);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--border-subtle);
    color: var(--gold-light);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald-accent);
    box-shadow: 0 0 8px var(--emerald-accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-header {
    background: rgba(212, 175, 55, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sharp);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s var(--ease-spring);
}

.btn-header:hover {
    background: rgba(212, 175, 55, 0.16);
    border-color: var(--gold-primary);
    color: var(--gold-light);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1), 0 6px 20px rgba(0,0,0,0.4);
    transform: translateY(-3px) scale(1.02);
}

.btn-header:active {
    transform: scale(0.97);
    box-shadow: inset 3px 3px 6px var(--neu-shadow-dark), inset -3px -3px 6px var(--neu-shadow-light);
}

.btn-header.primary {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(245, 158, 11, 0.15));
    border-color: var(--gold-primary);
    color: var(--gold-light);
}

/* Main Grid Layout */
.main-workspace {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 14px;
    flex: 1;
    min-height: 0; /* Prevents overflow */
}

/* Left Sidebar — Solid neumorph surface */
.matrix-sidebar {
    background: var(--neu-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sharp);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    flex: 1;
    padding: 10px 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(212, 175, 55, 0.04);
}

.tab-btn.active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold-primary);
    background: rgba(212, 175, 55, 0.08);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.4);
}

/* Matrix Diagram Card */
.matrix-canvas-card {
    background: rgba(5, 8, 14, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.matrix-canvas-card svg {
    width: 100%;
    max-width: 380px;
    height: auto;
    filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.15));
}

.matrix-node {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.matrix-node:hover {
    transform: scale(1.15);
}

.matrix-node-circle {
    fill: #0c121e;
    stroke: var(--gold-primary);
    stroke-width: 1.5;
    transition: all 0.2s;
}
.matrix-node:hover .matrix-node-circle {
    fill: rgba(212, 175, 55, 0.3);
    stroke: var(--gold-bright);
    filter: drop-shadow(0 0 8px var(--gold-glow));
}
.matrix-node-text {
    fill: var(--gold-light);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
}

/* Key Aspects Stats Cards */
.aspects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.aspect-card {
    background: var(--neu-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    transition: all 0.3s var(--ease-spring);
    cursor: pointer;
    box-shadow: 4px 4px 10px var(--neu-shadow-dark), -3px -3px 8px var(--neu-shadow-light);
}
.aspect-card:hover {
    border-color: var(--gold-primary);
    background: var(--bg-card-hover);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08), 6px 6px 14px var(--neu-shadow-dark), -4px -4px 10px var(--neu-shadow-light);
}
.aspect-card:active {
    transform: scale(0.97);
    box-shadow: inset 3px 3px 6px var(--neu-shadow-dark), inset -3px -3px 6px var(--neu-shadow-light);
}

.aspect-title {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.aspect-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold-bright);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.aspect-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3x3 Grid Matrix View */
.pitagora-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.pitagora-cell {
    background: rgba(12, 17, 28, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6px;
}
.cell-digit {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    position: absolute;
    top: 4px;
    left: 6px;
}
.cell-count {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold-bright);
}
.cell-count.empty {
    color: rgba(255, 255, 255, 0.1);
}

/* Right Pane — Chat Workspace — Solid surface */
.chat-workspace {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sharp);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Message Item */
.message-wrapper {
    display: flex;
    gap: 14px;
    max-width: 88%;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.assistant {
    align-self: flex-start;
}

.message-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    border: 1px solid var(--border-subtle);
}

.message-wrapper.assistant .message-avatar {
    background: radial-gradient(circle, var(--gold-primary), #291703);
    color: #fff;
    box-shadow: 0 0 10px var(--gold-glow);
}

.message-wrapper.user .message-avatar {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: var(--cyan-accent);
    border-color: var(--border-cyan);
}

.message-bubble {
    background: #0a1020;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.65;
    position: relative;
    box-shadow: 4px 4px 12px var(--neu-shadow-dark), -3px -3px 8px var(--neu-shadow-light);
}

.message-wrapper.user .message-bubble {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), #0e1420);
    border-color: rgba(212, 175, 55, 0.25);
    color: #fff;
}

/* Markdown formatting within messages */
.message-bubble h1, .message-bubble h2, .message-bubble h3, .message-bubble h4 {
    font-family: var(--font-heading);
    color: var(--gold-bright);
    margin-top: 18px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.message-bubble h1:first-child, .message-bubble h2:first-child, .message-bubble h3:first-child {
    margin-top: 0;
}
.message-bubble p {
    margin-bottom: 12px;
}
.message-bubble p:last-child {
    margin-bottom: 0;
}
.message-bubble ul, .message-bubble ol {
    margin-left: 20px;
    margin-bottom: 12px;
}
.message-bubble li {
    margin-bottom: 6px;
}
.message-bubble strong {
    color: var(--gold-light);
}
.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.88rem;
}
.message-bubble th, .message-bubble td {
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}
.message-bubble th {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold-bright);
    font-family: var(--font-heading);
}
.message-bubble blockquote {
    border-left: 3px solid var(--gold-primary);
    padding-left: 14px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(212, 175, 55, 0.03);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Reasoning Collapsible Box */
.reasoning-box {
    margin-bottom: 12px;
    border: 1px solid rgba(56, 189, 248, 0.2);
    background: rgba(7, 15, 26, 0.7);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.reasoning-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--cyan-accent);
    background: rgba(56, 189, 248, 0.08);
}
.reasoning-header:hover {
    background: rgba(56, 189, 248, 0.15);
}
.reasoning-body {
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid rgba(56, 189, 248, 0.1);
    white-space: pre-wrap;
}

/* Quick Suggestion Chips */
.quick-suggestions {
    display: flex;
    gap: 8px;
    padding: 8px 24px;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.chip {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.chip:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--gold-light);
    border-color: var(--gold-primary);
}

/* Chat Input Bar */
.chat-input-container {
    padding: 16px 24px;
    background: rgba(10, 15, 25, 0.95);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-box-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.chat-input {
    width: 100%;
    min-height: 48px;
    max-height: 140px;
    padding: 12px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 14px var(--gold-dim);
}

.btn-send {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold-primary), #d97706);
    border: none;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--ease-spring);
    box-shadow: 4px 4px 10px var(--neu-shadow-dark), -3px -3px 8px var(--neu-shadow-light), 0 0 12px var(--gold-glow);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.08) translateY(-2px);
    filter: brightness(1.15);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15), 0 8px 24px rgba(0,0,0,0.5);
}

.btn-send:active {
    transform: scale(0.95);
    box-shadow: inset 3px 3px 6px rgba(0,0,0,0.4);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-stop {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #0d121e;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 30px var(--gold-dim);
    width: 90%;
    max-width: 620px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(212, 175, 55, 0.05);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--gold-bright);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    padding: 10px 14px;
    background: rgba(5, 8, 14, 0.9);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
}
.form-control:focus {
    border-color: var(--gold-primary);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--gold-bright);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .main-workspace {
        grid-template-columns: 1fr;
    }
    .matrix-sidebar {
        max-height: 420px;
    }
}

/* TTS Voice Player & Actions */
.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-tts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: var(--radius-sm);
    color: var(--gold-bright);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-tts:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: var(--gold-bright);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

.btn-tts.playing {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--cyan-accent);
    color: var(--cyan-accent);
}

.soundwave {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.soundwave-bar {
    width: 2px;
    height: 100%;
    background: currentColor;
    border-radius: 1px;
    animation: soundwave 0.8s ease-in-out infinite alternate;
}

.soundwave-bar:nth-child(1) { animation-delay: 0.0s; }
.soundwave-bar:nth-child(2) { animation-delay: 0.2s; }
.soundwave-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes soundwave {
    0% { height: 3px; }
    100% { height: 12px; }
}

/* ===================================================
   MIT-GRADE LUXURY CREDITS & RECHARGE MODAL STYLES
   =================================================== */

.credits-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(8, 12, 20, 0.8));
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--text-gold);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
    backdrop-filter: blur(10px);
}

.credits-badge-btn:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(8, 12, 20, 0.9));
    border-color: var(--gold-bright);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.35);
    transform: translateY(-1px);
}

.credits-badge-btn .badge-recharge {
    font-size: 0.72rem;
    padding: 2px 8px;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: var(--radius-full);
    color: #fff;
    margin-left: 2px;
}

.credits-status-card {
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.08) 0%, rgba(12, 17, 28, 0.9) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-align: center;
    margin-bottom: 22px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.credits-balance-wrapper {
    margin-bottom: 8px;
}

.credits-balance-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.credits-balance-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--gold-bright);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.credits-balance-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
}

.recharge-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.recharge-card {
    background: rgba(14, 20, 32, 0.85);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
}

.recharge-card:hover {
    border-color: var(--gold-bright);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.2);
    transform: translateY(-3px);
}

.recharge-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.recharge-badge.free {
    background: #10b981;
    color: #fff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.recharge-badge.premium {
    background: linear-gradient(135deg, #d4af37, #f59e0b);
    color: #000;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

.recharge-badge.referral {
    background: #38bdf8;
    color: #000;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.recharge-icon {
    font-size: 2rem;
    color: var(--gold);
    margin: 12px 0 8px 0;
}

.recharge-title {
    font-family: var(--font-heading);
    font-size: 0.98rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.recharge-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 16px;
    flex: 1;
}

.btn-recharge {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s ease;
}

.btn-free {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-free:hover {
    background: #10b981;
    color: #fff;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-premium {
    background: linear-gradient(135deg, #d4af37, #f59e0b);
    color: #07090e;
}

.btn-premium:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    transform: scale(1.02);
}

.btn-referral {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.btn-referral:hover {
    background: #38bdf8;
    color: #07090e;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

/* ===================================================
   MIT-GRADE COMPREHENSIVE RESPONSIVE DESIGN SYSTEM
   =================================================== */

/* Tablet & Compact Screens (max-width: 1024px) */
@media (max-width: 1024px) {
    .app-container {
        height: auto;
        min-height: 100dvh;
        padding: 10px;
        gap: 10px;
    }

    .main-workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        gap: 12px;
    }

    .matrix-sidebar {
        width: 100%;
        max-height: 480px;
        border-radius: var(--radius-md);
    }

    .matrix-canvas-card svg {
        max-width: 320px;
    }

    .chat-workspace {
        height: 600px;
        min-height: 500px;
        border-radius: var(--radius-md);
    }

    .app-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }

    .header-status-indicator {
        display: none;
    }

    .header-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 8px;
        order: 3;
    }

    .btn-header {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .app-container {
        padding: 6px;
        gap: 8px;
    }

    .app-header {
        padding: 8px 10px;
        border-radius: var(--radius-md);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .brand-section {
        gap: 8px;
    }

    .brand-logo {
        width: 34px;
        height: 34px;
    }

    .brand-logo svg, .brand-logo i {
        font-size: 16px !important;
    }

    .brand-title {
        font-size: 1.0rem;
        letter-spacing: 0.5px;
        gap: 4px;
    }

    .brand-badge {
        font-size: 0.55rem;
        padding: 1px 5px;
    }

    .credits-badge-btn {
        padding: 4px 8px;
        font-size: 0.72rem;
        gap: 4px;
    }

    .credits-badge-btn .badge-recharge {
        font-size: 0.65rem;
        padding: 1px 5px;
    }

    .header-actions {
        margin-top: 4px;
        gap: 6px;
    }

    .btn-header {
        padding: 7px 8px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .sidebar-tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tab-btn {
        padding: 10px 8px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .matrix-sidebar {
        max-height: 380px;
    }

    .matrix-canvas-card {
        padding: 8px;
    }

    .matrix-canvas-card svg {
        max-width: 270px;
    }

    .chat-workspace {
        height: 520px;
        min-height: 420px;
    }

    .chat-messages {
        padding: 10px;
        gap: 10px;
    }

    .message-bubble {
        max-width: 95%;
        padding: 10px 12px;
        font-size: 0.88rem;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .quick-suggestions {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 6px 8px;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .quick-suggestions::-webkit-scrollbar {
        display: none;
    }

    .chip {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 0.72rem;
        padding: 5px 10px;
    }

    .chat-input-container {
        padding: 8px;
        gap: 6px;
    }

    .chat-input {
        font-size: 0.88rem;
        padding: 8px 10px;
    }

    .btn-send {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    /* Modals Responsive */
    .modal-card {
        width: 94vw !important;
        max-width: 94vw !important;
        max-height: 90vh !important;
        padding: 14px !important;
        border-radius: var(--radius-md) !important;
        margin: auto;
    }

    .modal-header h3 {
        font-size: 0.95rem !important;
    }

    .recharge-options-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .recharge-card {
        padding: 16px 12px !important;
    }

    .credits-status-card {
        padding: 14px !important;
        margin-bottom: 14px !important;
    }

    .credits-balance-value {
        font-size: 1.8rem !important;
    }
}

/* Small Smart Phones (max-width: 480px) */
@media (max-width: 480px) {
    .brand-title {
        font-size: 0.88rem;
    }

    .brand-badge {
        display: none;
    }

    .brand-logo {
        width: 30px;
        height: 30px;
    }

    .btn-header {
        font-size: 0.7rem;
        padding: 6px 4px;
    }

    .btn-header i {
        font-size: 0.75rem;
    }

    .matrix-sidebar {
        max-height: 340px;
    }

    .matrix-canvas-card svg {
        max-width: 230px;
    }

    .modal-body {
        padding: 10px 0 !important;
    }

    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }
}

/* ===================================================
   GDPR, EU AI ACT & LEGAL COMPLIANCE STYLES
   =================================================== */

/* App Footer */
.app-footer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 46px 8px 14px;
    background: rgba(8, 12, 20, 0.94);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-muted);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    flex-shrink: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 30;
}

.app-footer.is-hidden {
    display: none !important;
}

.footer-close-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 35;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.footer-close-btn:hover, .footer-close-btn:active {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.8);
    color: #ff6b6b;
    transform: translateY(-50%) scale(1.1);
}

.legal-reopen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(8, 33, 43, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-full);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    margin: 2px auto 0 auto;
    align-self: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 25;
    flex-shrink: 0;
}

.legal-reopen-btn:hover {
    color: var(--gold-bright);
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(8, 33, 43, 0.95);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-act-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--cyan-accent);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 600;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.74rem;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 2px 4px;
}

.footer-link:hover {
    color: var(--gold-bright);
    text-decoration: underline;
}

.footer-link.danger {
    color: #f87171;
}

.footer-link.danger:hover {
    color: #ef4444;
}

.dot-sep {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.6rem;
}

/* Floating GDPR Consent Banner */
.gdpr-banner-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 820px;
    background: rgba(12, 17, 28, 0.95);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 175, 55, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    padding: 20px 24px;
    display: none;
    animation: slideUpBanner 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gdpr-banner-container.active {
    display: block;
}

@keyframes slideUpBanner {
    from { opacity: 0; transform: translate(-50%, 40px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.gdpr-banner-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.gdpr-banner-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold-bright);
}

.gdpr-banner-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.gdpr-banner-text a {
    color: var(--cyan-accent);
    text-decoration: underline;
    cursor: pointer;
}

.gdpr-preferences-panel {
    display: none;
    background: rgba(5, 8, 14, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.gdpr-preferences-panel.active {
    display: block;
}

.gdpr-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.gdpr-toggle-row:last-child {
    border-bottom: none;
}

.gdpr-toggle-info h5 {
    font-size: 0.82rem;
    color: #fff;
    margin-bottom: 2px;
}

.gdpr-toggle-info p {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.gdpr-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-gdpr {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-gdpr.accept-all {
    background: linear-gradient(135deg, var(--gold-primary), #f59e0b);
    color: #07090e;
    font-weight: 700;
    border-color: var(--gold-light);
}

.btn-gdpr.accept-all:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 15px var(--gold-glow);
}

.btn-gdpr.reject {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-gdpr.reject:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-gdpr.customize {
    background: transparent;
    color: var(--cyan-accent);
    border-color: rgba(56, 189, 248, 0.3);
}

.btn-gdpr.customize:hover {
    background: rgba(56, 189, 248, 0.1);
}

/* Legal Modals Content Styling */
.legal-modal-body {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
    max-height: 65vh;
    overflow-y: auto;
    padding: 16px 20px;
}

.legal-modal-body h4 {
    color: var(--gold-bright);
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin: 18px 0 6px 0;
}

.legal-modal-body h4:first-child {
    margin-top: 0;
}

.legal-modal-body p {
    margin-bottom: 12px;
}

.legal-modal-body ul {
    margin: 8px 0 14px 20px;
}

.legal-modal-body li {
    margin-bottom: 6px;
}

.legal-badge-box {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 12px 0;
}

/* Print/PDF Watermark AI Act Disclosure */
@media print {
    .app-header, .chat-input-container, .quick-suggestions, .credits-badge-btn, .modal-overlay, .gdpr-banner-container, .app-footer, .onboarding-overlay {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    .report-ai-watermark {
        display: block !important;
        margin-top: 30px;
        padding-top: 15px;
        border-top: 1px solid #ccc;
        font-size: 8pt;
        color: #666;
        text-align: center;
    }
}

/* ===================================================
   ONBOARDING GUIDED TOUR & SPOTLIGHT SYSTEM
   =================================================== */

.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: none;
    pointer-events: auto;
}

.onboarding-overlay.active {
    display: block;
}

.onboarding-spotlight {
    position: fixed;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(3, 6, 12, 0.82), 0 0 30px rgba(212, 175, 55, 0.8);
    border: 2px solid var(--gold-bright);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10001;
    animation: spotlightPulse 2s infinite ease-in-out;
}

@keyframes spotlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(3, 6, 12, 0.82), 0 0 25px rgba(212, 175, 55, 0.6);
        border-color: var(--gold-primary);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(3, 6, 12, 0.82), 0 0 40px rgba(212, 175, 55, 0.95);
        border-color: #fff;
    }
}

.onboarding-tooltip {
    position: fixed;
    z-index: 10002;
    width: 320px;
    max-width: 90vw;
    background: rgba(12, 17, 28, 0.98);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(212, 175, 55, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 18px 20px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: tooltipFade 0.3s ease;
}

@keyframes tooltipFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.onboarding-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.onboarding-step-badge {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gold-bright);
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--border-subtle);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.onboarding-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.onboarding-close-btn:hover {
    color: #fff;
}

.onboarding-title {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.onboarding-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.onboarding-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.btn-onboarding-skip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-onboarding-skip:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.btn-onboarding-next {
    background: linear-gradient(135deg, var(--gold-primary), #f59e0b);
    color: #07090e;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gold-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-onboarding-next:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 15px var(--gold-glow);
    transform: translateY(-1px);
}

/* ==========================================================================
   🧊 Neumorphism 2.0 Dark Luxury — Hub Consulti Specializzati & Sinastria
   ========================================================================== */

.consults-hub-container {
    margin: 18px 0 24px 0;
    padding: 20px;
    background: radial-gradient(circle at top, rgba(14, 33, 43, 0.7) 0%, rgba(6, 23, 30, 0.95) 100%);
    border-radius: var(--radius-lg);
    box-shadow: 
        8px 8px 20px #041015,
        -6px -6px 18px #0d3443;
    border: 1px solid rgba(212, 175, 55, 0.22);
    position: relative;
    overflow: hidden;
}

.consults-hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.consults-hub-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold-bright);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.consults-hub-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.consults-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.neu-hub-card {
    background: #08212b;
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 
        5px 5px 12px #041117,
        -4px -4px 10px #0e3b4d;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.neu-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 
        7px 7px 16px #030d12,
        -5px -5px 14px #124c63,
        0 0 12px rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.35);
}

.neu-hub-card:active {
    transform: scale(0.98);
    box-shadow: 
        inset 4px 4px 8px #041117,
        inset -4px -4px 8px #0e3b4d;
}

.neu-hub-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}

.neu-hub-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.5), inset -2px -2px 4px rgba(255,255,255,0.05);
}

.neu-hub-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(244, 162, 11, 0.15);
    color: #f4a20b;
    border: 1px solid rgba(244, 162, 11, 0.35);
    display: flex;
    align-items: center;
    gap: 4px;
}

.neu-hub-badge.cyan {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

.neu-hub-badge.emerald {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.35);
}

.neu-hub-badge.coral {
    background: rgba(251, 157, 176, 0.15);
    color: #fb9db0;
    border-color: rgba(251, 157, 176, 0.35);
}

.neu-hub-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #eaf6fb;
    margin-bottom: 6px;
}

.neu-hub-card-desc {
    font-size: 0.76rem;
    color: #9cbacf;
    line-height: 1.35;
    margin-bottom: 12px;
    flex-grow: 1;
}

.btn-neu-action {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(244, 162, 11, 0.08));
    color: var(--gold-bright);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 6px #041117, -2px -2px 6px #0e3b4d;
}

.btn-neu-action:hover {
    background: linear-gradient(135deg, var(--gold-primary), #f59e0b);
    color: #06171e;
    box-shadow: 0 0 14px rgba(244, 162, 11, 0.4);
}

/* User Profile Saved Bar */
.user-profile-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-bottom: 14px;
    background: rgba(8, 33, 43, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-md);
    box-shadow: inset 2px 2px 6px #041015;
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: #eaf6fb;
}

.user-profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #d4af37);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #06171e;
    font-size: 0.8rem;
    font-weight: 800;
}

/* ==========================================================================
   📱 MIT-GRADE UNIVERSAL MOBILE DESIGN SYSTEM (Apple HIG & Material 3)
   ========================================================================== */

/* Universal Touch & Performance Optimizations */
html, body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior-y: none;
}

.mobile-view-switcher {
    display: none;
    background: rgba(8, 20, 32, 0.95);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: var(--radius-full);
    padding: 4px;
    gap: 6px;
    margin-bottom: 2px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    z-index: 15;
    flex-shrink: 0;
}

.mobile-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s var(--ease-spring);
    min-height: 44px; /* Apple HIG standard touch target */
    user-select: none;
}

.mobile-tab-btn:active {
    transform: scale(0.96);
}

.mobile-tab-btn.active {
    background: linear-gradient(135deg, var(--gold-primary), #f59e0b);
    color: #06171e;
    box-shadow: 0 2px 12px rgba(244, 162, 11, 0.4);
}

/* Animations for Mobile Bottom Sheets */
@keyframes modalSheetUp {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Media Query for Tablets & Mobile Screens (max-width: 900px) */
@media (max-width: 900px) {
    .mobile-view-switcher {
        display: flex;
    }

    .app-container {
        padding: max(6px, env(safe-area-inset-top, 6px)) max(8px, env(safe-area-inset-right, 8px)) max(6px, env(safe-area-inset-bottom, 6px)) max(8px, env(safe-area-inset-left, 8px));
        gap: 6px;
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        width: 100vw;
        max-width: 100%;
    }

    .app-header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
        border-radius: var(--radius-md);
        flex-shrink: 0;
    }

    .brand-section {
        gap: 8px;
    }

    .brand-logo {
        width: 36px;
        height: 36px;
    }

    .brand-title {
        font-size: 1.05rem;
        letter-spacing: 0.8px;
    }

    .brand-badge {
        display: none;
    }

    .header-status-indicator {
        display: none;
    }

    .header-actions {
        width: 100%;
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 2px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .header-actions::-webkit-scrollbar {
        display: none;
    }

    .btn-header {
        padding: 8px 12px;
        font-size: 0.78rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-height: 44px; /* Touch target minimum */
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .credits-badge-btn {
        min-height: 44px;
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    .main-workspace {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        gap: 0;
        overflow: hidden;
    }

    /* Mobile switcher view states */
    .main-workspace.mobile-show-chat .matrix-sidebar {
        display: none !important;
    }

    .main-workspace.mobile-show-chat .chat-workspace {
        display: flex !important;
        flex: 1;
        height: 100%;
        min-height: 0;
    }

    .main-workspace.mobile-show-matrix .matrix-sidebar {
        display: flex !important;
        flex: 1;
        height: 100%;
        min-height: 0;
    }

    .main-workspace.mobile-show-matrix .chat-workspace {
        display: none !important;
    }

    .matrix-sidebar,
    .chat-workspace {
        border-radius: var(--radius-md);
        height: 100%;
        min-height: 0;
    }

    .sidebar-tabs {
        padding: 2px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 10px 8px;
        font-size: 0.78rem;
        min-height: 44px;
        gap: 5px;
        flex-shrink: 0;
    }

    .sidebar-content {
        padding: 12px;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .matrix-canvas-card {
        padding: 10px;
    }

    .matrix-canvas-card svg {
        width: 100%;
        max-width: 320px;
        max-height: 320px;
        margin: 0 auto;
        display: block;
    }

    /* Chat layout on mobile */
    .chat-messages {
        padding: 12px 10px;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .message-wrapper {
        max-width: 95%;
        gap: 8px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .message-bubble {
        padding: 12px 14px;
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .quick-suggestions {
        padding: 6px 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
    }

    .quick-suggestions::-webkit-scrollbar {
        display: none;
    }

    .chip {
        flex-shrink: 0;
        font-size: 0.78rem;
        padding: 8px 12px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .chat-input-container {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px;
        gap: 8px;
        background: #080c14;
        border-top: 1px solid var(--border-subtle);
        flex-shrink: 0;
        position: relative;
        z-index: 20;
    }

    .chat-input {
        font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
        padding: 10px 12px;
        border-radius: var(--radius-md);
        min-height: 44px;
    }

    .btn-send {
        width: 44px;
        height: 44px;
        min-width: 44px;
        flex-shrink: 0;
    }

    /* Native Bottom-Sheet Modals on Mobile */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        background: rgba(3, 6, 12, 0.85);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88dvh !important;
        margin: 0;
        padding: 20px 18px !important;
        border-radius: 24px 24px 0 0 !important;
        border-bottom: none !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9), 0 0 25px rgba(212, 175, 55, 0.2);
        animation: modalSheetUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
        position: relative;
    }

    .modal-card::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
        margin: -8px auto 14px auto;
    }

    .modal-header {
        padding: 0 0 14px 0;
        background: transparent;
    }

    .modal-header h3 {
        font-size: 1.05rem !important;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-body {
        max-height: calc(88dvh - 140px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 6px 0 16px 0;
    }

    .modal-footer {
        padding: 12px 0 0 0;
        background: transparent;
        border-top: 1px solid var(--border-subtle);
    }

    .form-control {
        font-size: 16px !important; /* iOS Safari auto-zoom prevention */
        padding: 12px 14px;
        min-height: 48px;
    }

    .recharge-options-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn-recharge {
        padding: 14px;
        font-size: 0.92rem;
        min-height: 48px;
    }

    /* GDPR Banner Mobile */
    .gdpr-banner-container {
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        max-width: calc(100vw - 16px);
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .gdpr-actions-row {
        flex-direction: column;
        gap: 8px;
    }

    .btn-gdpr {
        min-height: 44px;
    }

    /* Mobile Legal Footer */
    .app-footer {
        padding: 8px 48px 8px 10px;
        font-size: 0.7rem;
        gap: 6px;
        max-height: 110px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex-shrink: 0;
        z-index: 30;
    }

    .footer-left {
        gap: 4px;
        font-size: 0.68rem;
    }

    .footer-links {
        gap: 4px;
        flex-wrap: wrap;
    }

    .footer-close-btn {
        top: 8px;
        transform: none;
        right: 6px;
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
        background: rgba(255, 255, 255, 0.22);
        border: 1px solid rgba(255, 255, 255, 0.45);
        color: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
        z-index: 40;
    }
}

/* ==========================================================================
   🎬 MIT-GRADE ANIMATION SYSTEM — Scroll Reveals, Spring Physics, Stagger
   ========================================================================== */

/* Scroll-triggered Reveal Base State */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
    will-change: opacity, transform;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays (applied via JS or nth-child) */
.reveal-on-scroll:nth-child(1) { transition-delay: 0ms; }
.reveal-on-scroll:nth-child(2) { transition-delay: 60ms; }
.reveal-on-scroll:nth-child(3) { transition-delay: 120ms; }
.reveal-on-scroll:nth-child(4) { transition-delay: 180ms; }
.reveal-on-scroll:nth-child(5) { transition-delay: 240ms; }
.reveal-on-scroll:nth-child(6) { transition-delay: 300ms; }

/* Initial page entrance animation */
@keyframes slideUpReveal {
    from {
        opacity: 0;
        transform: translateY(32px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Subtle glow pulse for active SVG nodes */
@keyframes glowPulseSubtle {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.6));
    }
}

/* App-level entrance stagger */
.app-header {
    animation: slideUpReveal 0.5s var(--ease-out-expo) both;
}

.mobile-view-switcher {
    animation: slideUpReveal 0.5s var(--ease-out-expo) 0.1s both;
}

.matrix-sidebar {
    animation: slideUpReveal 0.6s var(--ease-out-expo) 0.15s both;
}

.chat-workspace {
    animation: slideUpReveal 0.6s var(--ease-out-expo) 0.2s both;
}

.app-footer {
    animation: slideUpReveal 0.5s var(--ease-out-expo) 0.3s both;
}

/* Message entrance — spring bounce */
.message-wrapper {
    animation: slideUpReveal 0.4s var(--ease-spring) both;
}

/* Modal entrance refinement */
.modal-overlay.active .modal-card {
    animation: fadeScaleIn 0.3s var(--ease-out-expo) both;
}

/* Neu Hub Card spring hover */
.neu-hub-card {
    transition: all 0.3s var(--ease-spring);
}

.neu-hub-card:hover {
    transform: translateY(-5px) scale(1.02);
}

/* Matrix SVG node glow on data load */
.matrix-node-circle.active {
    animation: glowPulseSubtle 2.5s ease-in-out infinite;
}

/* ==========================================================================
   ♿ PREFERS-REDUCED-MOTION — Accessibility first
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .reveal-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    
    .app-header,
    .matrix-sidebar,
    .chat-workspace,
    .app-footer,
    .mobile-view-switcher,
    .message-wrapper {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    body::after {
        display: none;
    }
}

/* ==========================================================================
   🧊 Neumorphic Input Fields — Cohesive dark luxury
   ========================================================================== */

.chat-input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: inset 2px 2px 4px var(--neu-shadow-dark), inset -2px -2px 4px var(--neu-shadow-light);
    transition: all 0.25s var(--ease-smooth);
}

.chat-input:focus {
    border-color: var(--gold-primary);
    box-shadow: inset 2px 2px 4px var(--neu-shadow-dark), inset -2px -2px 4px var(--neu-shadow-light), 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-control {
    box-shadow: inset 2px 2px 4px var(--neu-shadow-dark), inset -2px -2px 4px var(--neu-shadow-light);
    transition: all 0.25s var(--ease-smooth);
}

.form-control:focus {
    border-color: var(--gold-primary);
    box-shadow: inset 2px 2px 4px var(--neu-shadow-dark), inset -2px -2px 4px var(--neu-shadow-light), 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* ==========================================================================
   ✨ Chip / Quick Actions — Spring upgrade
   ========================================================================== */

.chip {
    transition: all 0.25s var(--ease-spring);
    box-shadow: 2px 2px 6px var(--neu-shadow-dark), -2px -2px 4px var(--neu-shadow-light);
}

.chip:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.12), 3px 3px 8px var(--neu-shadow-dark);
}

.chip:active {
    transform: scale(0.96);
    box-shadow: inset 2px 2px 4px var(--neu-shadow-dark);
}
