/* ============================================
   ARIA SECOND BRAIN — Design System
   Inspired by Obsidian's dark, minimal aesthetic
   ============================================ */

/* === DESIGN TOKENS === */
:root {
    /* Backgrounds */
    --bg-0: #0a0d14;
    --bg-1: #0f1117;
    --bg-2: #161b27;
    --bg-3: #1e2535;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(139, 92, 246, 0.2);
    --border-light: rgba(255, 255, 255, 0.07);

    /* Accent — Obsidian Purple */
    --accent: #7c3aed;
    --accent-bright: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-pale: #c4b5fd;
    --accent-glow: rgba(139, 92, 246, 0.25);
    --accent-subtle: rgba(139, 92, 246, 0.08);

    /* Secondary accents */
    --cyan: #06b6d4;
    --cyan-subtle: rgba(6, 182, 212, 0.1);
    --green: #10b981;
    --green-subtle: rgba(16, 185, 129, 0.1);

    /* Text */
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-faint: #475569;

    /* Memory type colors */
    --idea:        #f59e0b;
    --idea-bg:     rgba(245, 158, 11, 0.08);
    --idea-border: rgba(245, 158, 11, 0.35);

    --task:        #10b981;
    --task-bg:     rgba(16, 185, 129, 0.08);
    --task-border: rgba(16, 185, 129, 0.35);

    --note:        #818cf8;
    --note-bg:     rgba(129, 140, 248, 0.08);
    --note-border: rgba(129, 140, 248, 0.35);

    --person:        #ec4899;
    --person-bg:     rgba(236, 72, 153, 0.08);
    --person-border: rgba(236, 72, 153, 0.35);

    --project:        #0ea5e9;
    --project-bg:     rgba(14, 165, 233, 0.08);
    --project-border: rgba(14, 165, 233, 0.35);

    --fact:        #a855f7;
    --fact-bg:     rgba(168, 85, 247, 0.08);
    --fact-border: rgba(168, 85, 247, 0.35);

    /* Layout */
    --sidebar-w: 238px;
    --context-w: 255px;

    /* Spacing */
    --r-xs: 4px;
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 14px;
    --r-xl: 18px;

    /* Transitions */
    --t: 180ms ease;
    --t-slow: 320ms ease;
}

/* === BASE RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-0);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
button { border: none; cursor: pointer; background: none; font-family: inherit; font-size: inherit; }
input, textarea { font-family: inherit; font-size: inherit; outline: none; border: none; background: none; color: var(--text); }
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }

/* === APP SHELL === */
.app {
    display: flex;
    height: 100vh;         /* fallback */
    height: 100dvh;        /* dynamic viewport — accounts for mobile browser bars */
    overflow: hidden;
    background: var(--bg-0);
}

/* ============================================
   LEFT VAULT SIDEBAR
   ============================================ */
.vault-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--bg-1);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* Subtle gradient overlay at bottom */
.vault-sidebar::after {
    content: '';
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-1));
    pointer-events: none;
    z-index: 1;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px 14px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.logo-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(167,139,250,0.3));
}
.logo-icon svg { width: 100%; height: 100%; }
.logo-text h1 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 0.3px;
    line-height: 1.2;
}
.logo-text p {
    font-size: 10px;
    color: var(--text-faint);
    letter-spacing: 0.2px;
    margin-top: 1px;
}

/* Navigation */
.sidebar-nav {
    padding: 8px 8px 6px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--r);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--t);
    position: relative;
    text-align: left;
}
.nav-item i { width: 14px; text-align: center; font-size: 12px; flex-shrink: 0; }
.nav-item span:first-of-type { flex: 1; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-subtle); color: var(--accent-light); }
.nav-badge {
    background: var(--accent);
    color: white;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
    line-height: 14px;
}
.nav-badge.visible { display: block; }

/* Vault Sections */
.vault-section {
    overflow-y: auto;
    padding: 10px 8px;
    flex-shrink: 0;
}
.vault-categories { flex: 1; min-height: 150px; overflow-y: auto; border-bottom: 1px solid var(--border-light); }
.vault-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px 6px;
}
.vault-section-header span {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-faint);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.quick-add-btn {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--t);
}
.quick-add-btn:hover { background: var(--accent-subtle); color: var(--accent-light); }

/* Categories */
.category-list { display: flex; flex-direction: column; gap: 1px; }
.category-item {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 5px 8px;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: 12.5px;
    transition: all var(--t);
    cursor: pointer;
    text-align: left;
}
.category-item:hover { background: var(--surface); color: var(--text); }
.category-item.active { background: var(--accent-subtle); color: var(--accent-light); }
.cat-icon { font-size: 13px; width: 16px; text-align: center; flex-shrink: 0; }
.cat-name { flex: 1; }
.cat-count {
    font-size: 10px;
    color: var(--text-faint);
    background: var(--surface);
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

/* Tag Cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 2px; }
.tag-pill {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--t);
    line-height: 1.5;
}
.tag-pill:hover { background: var(--accent-subtle); color: var(--accent-light); border-color: var(--border); }
.tag-empty { font-size: 11px; color: var(--text-faint); padding: 2px 6px; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border-radius: var(--r);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all var(--t);
}
.footer-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border-light); }
.footer-btn i { font-size: 12px; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--bg-0);
}

/* Header / Tab Bar */
.main-header {
    display: flex;
    align-items: center;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-light);
    min-height: 46px;
    padding: 0 8px 0 12px;
    flex-shrink: 0;
    gap: 12px;
}
.tab-bar { display: flex; gap: 2px; }
.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    border-bottom: 2px solid transparent;
    transition: all var(--t);
    position: relative;
}
.tab i { font-size: 12px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-light); border-bottom-color: var(--accent); }
.tab-badge {
    background: var(--accent);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    line-height: 14px;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.aria-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
    animation: statusPulse 2.5s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(16,185,129,0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 12px rgba(16,185,129,0.3); }
}

/* Views */
.view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.view.active { display: flex; }

/* ============================================
   CHAT VIEW
   ============================================ */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Messages */
.message {
    display: flex;
    gap: 10px;
    max-width: 820px;
    animation: msgIn 0.3s ease;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.assistant-msg { align-self: flex-start; }
.user-msg      { align-self: flex-end; flex-direction: row-reverse; }
.system-msg    { align-self: center; max-width: 500px; }

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    margin-top: 2px;
}
.msg-avatar.aria-av { background: transparent; padding: 0; }
.msg-avatar.user-av { background: linear-gradient(135deg, #1e3a5f, #1e40af); font-size: 12px; }

.msg-content { display: flex; flex-direction: column; gap: 4px; }

.msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.65;
    max-width: 580px;
    word-wrap: break-word;
}
.msg-bubble p { margin-bottom: 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { margin: 12px 0 6px; font-weight: 600; line-height: 1.3; }
.msg-bubble h1 { font-size: 1.2em; }
.msg-bubble h2 { font-size: 1.1em; }
.msg-bubble h3 { font-size: 1.05em; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 10px 20px; padding: 0; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble pre { background: rgba(0,0,0,0.2); padding: 8px; border-radius: 6px; overflow-x: auto; font-family: monospace; }
.msg-bubble code { background: rgba(0,0,0,0.1); padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }
.assistant-msg .msg-bubble {
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-top-left-radius: 4px;
    color: var(--text);
}
.user-msg .msg-bubble {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    color: white;
    border-top-right-radius: 4px;
}
.system-msg .msg-bubble {
    background: var(--cyan-subtle);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--cyan);
    font-size: 12px;
    border-radius: var(--r);
    padding: 8px 14px;
    text-align: center;
}
.user-msg .msg-content { align-items: flex-end; }

.msg-time { font-size: 10px; color: var(--text-faint); padding: 0 2px; }

/* Memory saved badge */
.memory-saved-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-subtle);
    border: 1px solid var(--border);
    color: var(--accent-light);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 6px;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 4px 0;
}
.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    animation: typingBounce 1.3s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); background: var(--text-faint); }
    30% { transform: translateY(-7px); background: var(--accent-light); }
}

/* Input Area */
.chat-input-area {
    padding: 14px 20px;
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
    background: var(--bg-1);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 8px 8px 8px 10px;
    transition: border-color var(--t), box-shadow var(--t);
}
.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-wrapper textarea {
    flex: 1;
    resize: none;
    font-size: 13.5px;
    line-height: 1.55;
    max-height: 130px;
    overflow-y: auto;
    background: transparent;
    padding: 3px 0;
    color: var(--text);
}
.input-wrapper textarea::placeholder { color: var(--text-faint); }

.voice-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 1px solid var(--border-light);
    transition: all var(--t);
    flex-shrink: 0;
}
.voice-btn:hover { background: var(--accent-subtle); color: var(--accent-light); border-color: var(--border); }
.voice-btn.recording {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: recPulse 1s ease infinite;
}
@keyframes recPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--t);
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 16px var(--accent-glow); }

.input-hints { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.hint-chip {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--t);
    line-height: 1.4;
}
.hint-chip:hover { background: var(--accent-subtle); border-color: var(--border); color: var(--accent-light); }

/* ============================================
   GROQ VISION — Image preview & attach
   ============================================ */
.vision-preview-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px 0;
}
.vision-preview-bar img {
    height: 72px;
    width: auto;
    max-width: 160px;
    border-radius: 10px;
    border: 2px solid var(--accent);
    object-fit: cover;
    box-shadow: 0 2px 12px rgba(139,92,246,0.3);
}
.vision-remove-btn {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    border: 2px solid var(--bg-1);
    flex-shrink: 0;
}
.vision-remove-btn:hover { background: #dc2626; }
.chat-img-thumb {
    display: block;
    max-width: 200px;
    max-height: 160px;
    border-radius: 10px;
    margin-bottom: 6px;
    object-fit: contain;
    border: 1px solid rgba(255,255,255,0.12);
    cursor: zoom-in;
}
#attach-btn.img-attached { color: var(--accent-light) !important; }

/* ============================================
   MEMORY VIEW
   ============================================ */
.memory-view { background: var(--bg-0); }

.memory-toolbar {
    padding: 16px 20px 0;
    background: var(--bg-0);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.memory-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    padding: 8px 10px;
    transition: border-color var(--t), box-shadow var(--t);
}
.memory-search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.memory-search-wrap i { color: var(--text-faint); font-size: 12px; flex-shrink: 0; }
.memory-search-wrap input { flex: 1; font-size: 13.5px; }
.memory-search-wrap input::placeholder { color: var(--text-faint); }
.search-clear {
    color: var(--text-faint);
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
}
.search-clear:hover { background: var(--surface); color: var(--text); }

.memory-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.filter-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    transition: all var(--t);
    line-height: 1.5;
}
.filter-chip:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.filter-chip.active { background: var(--accent-subtle); border-color: var(--border); color: var(--accent-light); }

/* Memory Grid */
.memory-grid {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    grid-auto-rows: min-content;
    gap: 12px;
    align-content: start;
}

/* Empty State */
.empty-vault {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: var(--text-faint);
}
.empty-icon { font-size: 48px; margin-bottom: 14px; display: block; opacity: 0.7; }
.empty-vault h3 { font-size: 15px; color: var(--text-muted); margin-bottom: 8px; }
.empty-vault p { font-size: 12.5px; line-height: 1.7; color: var(--text-faint); }

/* Memory Cards */
.memory-card {
    background: var(--bg-1);
    border-radius: var(--r-lg);
    padding: 13px 13px 11px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--t-slow);
    position: relative;
    overflow: hidden;
    animation: cardIn 0.3s ease;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cardOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
}
.memory-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }

/* Type-specific borders */
.memory-card.type-idea   { border-top: 2px solid var(--idea-border); }
.memory-card.type-task   { border-top: 2px solid var(--task-border); }
.memory-card.type-note   { border-top: 2px solid var(--note-border); }
.memory-card.type-person { border-top: 2px solid var(--person-border); }
.memory-card.type-project{ border-top: 2px solid var(--project-border); }
.memory-card.type-fact   { border-top: 2px solid var(--fact-border); }

.memory-card:hover.type-idea   { border-color: var(--idea-border); background: var(--idea-bg); }
.memory-card:hover.type-task   { border-color: var(--task-border); background: var(--task-bg); }
.memory-card:hover.type-note   { border-color: var(--note-border); background: var(--note-bg); }
.memory-card:hover.type-person { border-color: var(--person-border); background: var(--person-bg); }
.memory-card:hover.type-project{ border-color: var(--project-border); background: var(--project-bg); }
.memory-card:hover.type-fact   { border-color: var(--fact-border); background: var(--fact-bg); }

.card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.card-type-icon { font-size: 14px; line-height: 1; }
.card-type-label {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}
.type-idea   .card-type-label { color: var(--idea); }
.type-task   .card-type-label { color: var(--task); }
.type-note   .card-type-label { color: var(--note); }
.type-person .card-type-label { color: var(--person); }
.type-project.card-type-label { color: var(--project); }
.type-fact   .card-type-label { color: var(--fact); }
.type-project .card-type-label { color: var(--project); }

.card-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--t);
}
.memory-card:hover .card-actions { opacity: 1; }
.card-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    transition: all var(--t);
}
.card-action-btn:hover { background: var(--surface-hover); color: var(--text); }
.card-action-btn.pin-btn.is-pinned { color: var(--accent-light); opacity: 1; }
.card-action-btn.delete-btn:hover { color: #f87171; }

.card-content {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Task card */
.task-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
}
.task-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--task);
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
    font-size: 9px;
    color: transparent;
}
.task-checkbox.is-done { background: var(--task); color: white; }
.task-text.is-done { text-decoration: line-through; color: var(--text-faint); }

.card-footer {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.card-tag {
    font-size: 9.5px;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-faint);
    border: 1px solid var(--border-light);
    line-height: 1.5;
}
.card-time {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-faint);
    white-space: nowrap;
}

/* Pinned indicator */
.pin-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--accent-light);
    font-size: 10px;
    opacity: 0.7;
}

/* ============================================
   RIGHT CONTEXT PANEL
   ============================================ */
.context-panel {
    width: var(--context-w);
    min-width: var(--context-w);
    background: var(--bg-1);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.context-section { padding: 14px 14px 10px; flex-shrink: 0; }
.context-section:first-child { flex: 1; overflow-y: auto; padding-bottom: 6px; }

.context-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.context-header i { font-size: 11px; color: var(--accent-light); }

.context-related {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.context-empty {
    text-align: center;
    padding: 16px 8px;
    color: var(--text-faint);
    font-size: 12px;
}
.context-empty i { font-size: 22px; margin-bottom: 8px; display: block; }
.ctx-empty-text { font-size: 11px; color: var(--text-faint); }

/* Related Memory Cards */
.related-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    padding: 9px 10px;
    cursor: pointer;
    transition: all var(--t);
    animation: cardIn 0.3s ease;
}
.related-card:hover { border-color: var(--border); background: var(--surface-hover); transform: translateX(2px); }
.related-card-type {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 4px;
}
.related-card-content {
    font-size: 11.5px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
}

/* Divider */
.context-divider { height: 1px; background: var(--border-light); flex-shrink: 0; }

/* Context Tags */
.context-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 14px 14px 12px;
    flex-shrink: 0;
}

/* Stats */
.context-stats {
    display: flex;
    align-items: center;
    padding: 14px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    margin-top: auto;
    background: var(--bg-1);
}
.stat-item { flex: 1; text-align: center; }
.stat-number {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 9.5px; color: var(--text-faint); margin-top: 3px; display: block; }
.stat-divider { width: 1px; height: 32px; background: var(--border-light); flex-shrink: 0; }

/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.open { display: flex; animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 26px 28px;
    width: 460px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 24px 80px rgba(0,0,0,0.5),
        0 0 0 1px rgba(139,92,246,0.08),
        inset 0 1px 0 rgba(255,255,255,0.05);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.modal-icon { font-size: 22px; line-height: 1; }
.modal-header h2 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all var(--t);
}
.modal-close:hover { background: var(--surface); color: var(--text); }
.modal-subtitle { font-size: 12.5px; color: var(--text-muted); margin: -10px 0 18px; }

/* Capture type select */
.capture-type-select { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.type-btn {
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    transition: all var(--t);
    line-height: 1.4;
}
.type-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.type-btn.active { background: var(--accent-subtle); border-color: var(--border); color: var(--accent-light); }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.form-group input {
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    padding: 9px 12px;
    font-size: 13.5px;
    transition: all var(--t);
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-group input::placeholder { color: var(--text-faint); }
.form-group small { display: block; font-size: 11px; color: var(--text-faint); margin-top: 6px; }

/* Capture textarea & tag input */
#capture-content, #capture-tags {
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--text);
    transition: all var(--t);
    display: block;
    margin-bottom: 10px;
    resize: none;
    line-height: 1.6;
}
#capture-content:focus, #capture-tags:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
#capture-content::placeholder, #capture-tags::placeholder { color: var(--text-faint); }

/* Save button */
.save-btn {
    width: 100%;
    padding: 11px 16px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: white;
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--t);
    box-shadow: 0 4px 14px var(--accent-glow);
    margin-top: 6px;
}
.save-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.save-btn:active { transform: translateY(0); }

/* ============================================
   AVATAR — Trợ lý AI
   ============================================ */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.aria-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow), 0 0 0 3px rgba(124,58,237,0.15);
    display: block;
    transition: all var(--t-slow);
}

.aria-avatar:hover {
    box-shadow: 0 0 20px var(--accent-glow), 0 0 0 4px rgba(124,58,237,0.25);
    transform: scale(1.05);
}

.avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--bg-1);
    box-shadow: 0 0 6px rgba(16,185,129,0.7);
    animation: statusPulse 2.5s ease-in-out infinite;
}

.logo-text h1 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.logo-text p {
    font-size: 10px;
    color: var(--text-faint);
    letter-spacing: 0.2px;
    margin-top: 2px;
}

/* Mobile hamburger button */
.mobile-menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: var(--r);
    color: var(--text-muted);
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid var(--border-light);
    transition: all var(--t);
    flex-shrink: 0;
}
.mobile-menu-btn:hover { background: var(--surface); color: var(--text); }

/* Sidebar overlay backdrop (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 49;
    backdrop-filter: blur(2px);
    animation: overlayFade 0.2s ease;
}
.sidebar-overlay.visible { display: block; }
@keyframes overlayFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================
   RESPONSIVE — Laptop (1024px - 1280px)
   ============================================ */
@media (max-width: 1280px) {
    :root {
        --sidebar-w: 210px;
        --context-w: 230px;
    }
}

@media (max-width: 1100px) {
    /* Hide right context panel on small laptops */
    .context-panel { display: none; }
}

/* ============================================
   WIKI MAP
   ============================================ */
.wiki-map-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 12px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}
.wiki-map-btn:hover {
    background: var(--bg-3);
    color: var(--accent);
    border-color: var(--accent);
}

.wiki-map-content {
    width: 95vw;
    height: 90vh;
    max-width: none;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.wiki-map-content .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-2);
}
#wiki-map-container {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #0f0f13; /* Very dark background for Obsidian feel */
    position: relative;
    cursor: grab;
}
#wiki-map-container:active {
    cursor: grabbing;
}
.wiki-tooltip {
    background: var(--bg-1);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    pointer-events: none;
    max-width: 300px;
    word-wrap: break-word;
}

/* ============================================
   RESPONSIVE — Tablet (768px - 1024px)
   ============================================ */
@media (max-width: 1024px) {
    :root { --sidebar-w: 200px; }
    .context-panel { display: none; }

    .chat-history  { padding: 16px 16px; }
    .chat-input-area { padding: 12px 16px; }
    .memory-grid { padding: 14px 16px; }
    .memory-toolbar { padding: 14px 16px 0; }

    .msg-bubble { max-width: 480px; }
    .input-hints { gap: 5px; }
    .hint-chip { font-size: 10.5px; padding: 3px 8px; }
}

/* ============================================
   RESPONSIVE — Mobile (< 768px)
   ============================================ */
@media (max-width: 767px) {
    :root {
        --sidebar-w: 260px;
    }

    /* Show hamburger button */
    .mobile-menu-btn { display: flex; }

    /* Hide status text on mobile */
    .aria-status span:last-child { display: none; }

    /* Context panel hidden */
    .context-panel { display: none; }

    /* Sidebar: slide-in drawer on mobile */
    .vault-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform var(--t-slow);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .vault-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Full width main */
    .main-content { width: 100%; }

    /* Smaller header */
    .main-header {
        padding: 0 12px;
        min-height: 50px;
    }

    /* Tabs slightly smaller */
    .tab {
        padding: 8px 12px;
        font-size: 12.5px;
    }
    .tab i { display: none; }

    /* Chat */
    .chat-history { padding: 12px 12px; gap: 10px; }

    .msg-bubble {
        font-size: 13px;
        padding: 9px 12px;
        max-width: calc(100vw - 80px);
    }

    .chat-input-area { padding: 10px 12px; }
    .input-hints { display: none; } /* Hide on mobile to save space */
    .input-wrapper textarea { font-size: 14px; }

    /* Memory */
    .memory-toolbar { padding: 12px 12px 0; }
    .memory-grid {
        padding: 12px 12px;
        grid-template-columns: 1fr;  /* Single column on mobile */
        gap: 10px;
    }

    /* Memory filters scroll horizontal */
    .memory-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .memory-filters::-webkit-scrollbar { display: none; }
    .filter-chip { white-space: nowrap; flex-shrink: 0; }

    /* Modals */
    .modal-content {
        padding: 20px 18px;
        border-radius: 16px 16px 0 0;
        width: 100%;
        max-width: 100%;
        margin-top: auto;
        align-self: flex-end;
    }
    .modal { align-items: flex-end; }

    /* Avatar slightly smaller */
    .aria-avatar { width: 38px; height: 38px; }
}

/* ============================================
   RESPONSIVE — Small mobile (< 375px)
   ============================================ */
@media (max-width: 375px) {
    .tab { padding: 8px 10px; font-size: 12px; }
    .msg-bubble { font-size: 12.5px; }
    .capture-type-select { gap: 4px; }
    .type-btn { padding: 4px 9px; font-size: 11px; }
}

/* ============================================
   GOOGLE SIGN-IN + CALENDAR
   ============================================ */

/* Google section in sidebar */
.google-section {
    padding: 8px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.hidden { display: none !important; }

/* Google Sign-In Button */
.google-signin-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border-radius: var(--r);
    color: #3c4043;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid #dadce0;
    cursor: pointer;
    transition: all var(--t);
    font-family: 'Inter', sans-serif;
    justify-content: center;
}
.google-signin-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}
.google-signin-btn svg { flex-shrink: 0; }

/* Signed-in user info */
.google-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 2px 6px;
}
.google-user-photo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(66, 133, 244, 0.4);
    flex-shrink: 0;
}
.google-user-text {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}
.google-user-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.google-user-email {
    display: block;
    font-size: 10px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.google-signout-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: all var(--t);
}
.google-signout-btn:hover { background: rgba(239,68,68,0.15); color: #f87171; }

.calendar-refresh-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 5px 8px;
    background: var(--accent-subtle);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--accent-light);
    font-size: 11.5px;
    cursor: pointer;
    transition: all var(--t);
}
.calendar-refresh-btn:hover { background: rgba(124,58,237,0.2); }
.calendar-refresh-btn i { font-size: 11px; }

/* ── Calendar Panel (Right Context) ─────── */
.calendar-section { padding-bottom: 6px; }

.cal-date {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-faint);
    font-weight: 400;
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.cal-empty {
    text-align: center;
    padding: 14px 8px;
    color: var(--text-faint);
    font-size: 11.5px;
}
.cal-empty i { font-size: 20px; margin-bottom: 5px; display: block; opacity: 0.5; }

/* Calendar Event Card */
.cal-event {
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-left: 3px solid #4285F4;
    border-radius: var(--r-sm);
    padding: 6px 9px;
    cursor: pointer;
    transition: all var(--t);
    animation: cardIn 0.2s ease;
}
.cal-event:hover { background: var(--bg-3); transform: translateX(1px); }
.cal-event.is-today-event { border-left-color: #10b981; }
.cal-event.is-soon { border-left-color: #f59e0b; }

.cal-event-time {
    font-size: 10px;
    color: var(--text-faint);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cal-event-time i { font-size: 9px; }
.cal-event.is-soon .cal-event-time { color: #f59e0b; }

.cal-event-title {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* "Add to Calendar" button inside chat bubble */
.add-to-cal-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(66,133,244,0.15);
    border: 1px solid rgba(66,133,244,0.35);
    color: #93c5fd;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 12px;
    margin-top: 7px;
    cursor: pointer;
    transition: all var(--t);
}
.add-to-cal-btn:hover { background: rgba(66,133,244,0.25); color: #bfdbfe; }

/* View all button */
.view-all-cal-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 5px 6px;
    border-radius: var(--r-sm);
    color: var(--text-faint);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--t);
    margin-top: 4px;
    border: 1px solid transparent;
}
.view-all-cal-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border-light); }
.view-all-cal-btn i { font-size: 11px; }

/* ── Settings Divider ─────────────────── */
.settings-divider {
    border-top: 1px solid var(--border-light);
    padding-top: 14px !important;
    margin-bottom: 0 !important;
}
.settings-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================
   WELCOME / LOGIN SCREEN
   ============================================ */
.welcome-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(109,40,217,0.35) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(6,182,212,0.15) 0%, transparent 50%),
                #080b14;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
    animation: wsIn 0.6s ease;
}
@keyframes wsIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.welcome-screen.exit {
    animation: wsOut 0.5s ease forwards;
}
@keyframes wsOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(1.04); }
}

/* Floating particles */
.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.particles span {
    position: absolute;
    border-radius: 50%;
    background: rgba(167,139,250,0.15);
    animation: particleFloat linear infinite;
}
.particles span:nth-child(1)  { width:6px;  height:6px;  left:12%;  animation-duration:14s; animation-delay:0s;   top:80%; }
.particles span:nth-child(2)  { width:4px;  height:4px;  left:25%;  animation-duration:18s; animation-delay:2s;   top:70%; }
.particles span:nth-child(3)  { width:8px;  height:8px;  left:40%;  animation-duration:12s; animation-delay:4s;   top:90%; background:rgba(6,182,212,0.12); }
.particles span:nth-child(4)  { width:3px;  height:3px;  left:55%;  animation-duration:20s; animation-delay:1s;   top:85%; }
.particles span:nth-child(5)  { width:5px;  height:5px;  left:68%;  animation-duration:16s; animation-delay:3s;   top:75%; background:rgba(167,139,250,0.2); }
.particles span:nth-child(6)  { width:7px;  height:7px;  left:80%;  animation-duration:11s; animation-delay:5s;   top:88%; }
.particles span:nth-child(7)  { width:4px;  height:4px;  left:8%;   animation-duration:22s; animation-delay:0.5s; top:92%; background:rgba(6,182,212,0.18); }
.particles span:nth-child(8)  { width:6px;  height:6px;  left:90%;  animation-duration:15s; animation-delay:2.5s; top:78%; }
.particles span:nth-child(9)  { width:3px;  height:3px;  left:33%;  animation-duration:19s; animation-delay:6s;   top:95%; }
.particles span:nth-child(10) { width:5px;  height:5px;  left:75%;  animation-duration:13s; animation-delay:1.5s; top:83%; }
@keyframes particleFloat {
    from { transform: translateY(0) rotate(0deg); opacity: 0.7; }
    to   { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

/* Main container */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 32px 24px;
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
    animation: wsContentIn 0.7s ease 0.2s both;
}
@keyframes wsContentIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Avatar frame */
.welcome-avatar-wrap {
    position: relative;
    width: 190px;
    height: 190px;
    flex-shrink: 0;
}
.welcome-avatar-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid;
    animation: ringRotate linear infinite;
}
.welcome-avatar-ring.outer {
    inset: -12px;
    border-color: transparent rgba(167,139,250,0.5) transparent rgba(6,182,212,0.3);
    animation-duration: 8s;
}
.welcome-avatar-ring.inner {
    inset: -4px;
    border-color: transparent rgba(124,58,237,0.7) transparent rgba(139,92,246,0.4);
    animation-duration: 5s;
    animation-direction: reverse;
}
@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.welcome-avatar-img {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 3px solid rgba(124,58,237,0.6);
    display: block;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 4px rgba(124,58,237,0.15),
                0 20px 60px rgba(0,0,0,0.5);
}
.welcome-avatar-glow {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124,58,237,0.2) 0%, transparent 70%);
    z-index: 0;
    filter: blur(16px);
    animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.15); }
}

/* Text area */
.welcome-text { text-align: center; }
.welcome-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.3;
}
.welcome-title .wave {
    display: inline-block;
    animation: waveHand 1.5s ease-in-out 1s 3;
}
@keyframes waveHand {
    0%, 100% { transform: rotate(0deg); }
    30%       { transform: rotate(-20deg); }
    70%       { transform: rotate(20deg); }
}
.welcome-title .highlight {
    background: linear-gradient(90deg, #a78bfa, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.welcome-sub {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.welcome-sub strong { color: var(--accent-light); }

/* Typing effect */
.welcome-typing-wrap {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.welcome-typing {
    font-size: 14px;
    color: rgba(255,255,255,0.65);
    text-align: center;
    line-height: 1.6;
    font-style: italic;
    position: relative;
}
.welcome-typing::after {
    content: '|';
    color: var(--accent-light);
    animation: blink 0.8s step-end infinite;
    margin-left: 1px;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Feature pills */
.welcome-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.feat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    font-size: 12.5px;
    backdrop-filter: blur(8px);
    animation: pillIn 0.4s ease both;
}
.feat-pill:nth-child(1) { animation-delay: 0.4s; }
.feat-pill:nth-child(2) { animation-delay: 0.55s; }
.feat-pill:nth-child(3) { animation-delay: 0.7s; }
@keyframes pillIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* Action buttons */
.welcome-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.welcome-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: #fff;
    border-radius: 12px;
    color: #3c4043;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
    animation: btnIn 0.5s ease 0.8s both;
}
@keyframes btnIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.welcome-google-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.15);
}
.welcome-google-btn:active { transform: translateY(0); }

.welcome-skip-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 13.5px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    animation: btnIn 0.5s ease 0.95s both;
    width: 100%;
    justify-content: center;
}
.welcome-skip-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border-color: rgba(255,255,255,0.25);
}

.welcome-notice {
    font-size: 11.5px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 5px;
    animation: btnIn 0.5s ease 1.1s both;
}
.welcome-notice i { color: var(--green); }

/* Mobile responsive */
@media (max-width: 480px) {
    .welcome-container { padding: 24px 20px; gap: 22px; }
    .welcome-avatar-wrap { width: 150px; height: 150px; }
    .welcome-avatar-img  { width: 150px; height: 150px; }
    .welcome-title { font-size: 22px; }
    .welcome-google-btn { font-size: 14px; padding: 13px 16px; }
}

/* Loading spinner for sign-in button */
.welcome-google-btn:disabled svg {
    animation: spinIcon 0.8s linear infinite;
}
@keyframes spinIcon {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.welcome-google-btn:disabled {
    cursor: wait;
    color: #666;
}

/* ============================================
   WORKSPACE HUB
   ============================================ */
.workspace-hub {
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--bg-1);
}

.workspace-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px 6px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-faint);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.workspace-header i { font-size: 10px; color: var(--accent-light); }

.workspace-services {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 8px 8px;
}

.ws-service {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: var(--r);
    transition: background var(--t);
}
.ws-service:hover { background: var(--surface-hover); }

.ws-service-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.ws-icon { font-size: 14px; flex-shrink: 0; }

.ws-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    flex: 1;
}

.ws-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-faint);
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
    line-height: 16px;
}
.ws-badge-ok {
    color: var(--green);
    background: rgba(16, 185, 129, 0.1);
}
.ws-badge-alert {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.ws-action-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--t);
    flex-shrink: 0;
    margin-left: 4px;
}
.ws-action-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent-light);
}

/* Mobile workspace hub */
@media (max-width: 768px) {
    .workspace-hub { display: block; }
    .ws-service { padding: 8px 10px; }
    .ws-name { font-size: 13px; }
}

/* ============================================
   MEETING VIEW
   ============================================ */
.meeting-view {
    flex-direction: column;
    background: var(--bg-0);
    overflow: hidden;
}

/* Recording Panel */
.rec-panel {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-light);
    padding: 14px 20px 12px;
    flex-shrink: 0;
}
.rec-title-row { margin-bottom: 10px; }
.meeting-title-input {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
}
.meeting-title-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); outline: none; }
.meeting-title-input::placeholder { color: var(--text-faint); }

.rec-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--r); font-size: 13px; font-weight: 600; transition: all var(--t); }
.rec-btn-start { background: linear-gradient(135deg,#dc2626,#ef4444); color: white; box-shadow: 0 2px 10px rgba(239,68,68,0.35); }
.rec-btn-start:hover { transform: scale(1.04); box-shadow: 0 4px 20px rgba(239,68,68,0.5); }
.rec-btn-start i { font-size: 10px; }
.rec-btn-pause { background: var(--surface); color: var(--text); border: 1px solid var(--border-light); }
.rec-btn-pause:hover { background: var(--surface-hover); }
.rec-btn-stop { background: var(--bg-2); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.rec-btn-stop:hover { background: rgba(239,68,68,0.1); }
.rec-btn.hidden { display: none; }

.rec-timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); letter-spacing: 1px; min-width: 60px; }

.rec-wave { display: none; align-items: flex-end; gap: 3px; height: 28px; }
.rec-wave.active { display: flex; }
.rec-wave span { display: inline-block; width: 4px; border-radius: 2px; background: #ef4444; animation: recWaveBar 0.6s ease infinite; }
.rec-wave span:nth-child(1){ height: 6px;  animation-delay:0s; }
.rec-wave span:nth-child(2){ height: 14px; animation-delay:.07s; }
.rec-wave span:nth-child(3){ height: 22px; animation-delay:.14s; }
.rec-wave span:nth-child(4){ height: 18px; animation-delay:.21s; }
.rec-wave span:nth-child(5){ height: 26px; animation-delay:.28s; }
.rec-wave span:nth-child(6){ height: 20px; animation-delay:.35s; }
.rec-wave span:nth-child(7){ height: 12px; animation-delay:.42s; }
.rec-wave span:nth-child(8){ height: 8px;  animation-delay:.49s; }
@keyframes recWaveBar { 0%,100%{ transform:scaleY(0.3); opacity:0.6; } 50%{ transform:scaleY(1); opacity:1; } }

.rec-status { margin-top: 8px; font-size: 12px; color: var(--text-muted); min-height: 18px; }

.meeting-content { flex: 1; display: flex; overflow: hidden; }
.meeting-left { width: 280px; min-width: 220px; border-right: 1px solid var(--border-light); display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }
.meeting-search-wrap { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-1); border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.meeting-search-wrap i { color: var(--text-faint); font-size: 11px; }
.meeting-search-wrap input { flex: 1; font-size: 12.5px; background: transparent; color: var(--text); }
.meeting-search-wrap input::placeholder { color: var(--text-faint); }
.meeting-list { flex: 1; overflow-y: auto; padding: 8px 6px; }

.meeting-empty { text-align: center; padding: 40px 16px; color: var(--text-faint); }
.meeting-empty-icon { font-size: 36px; display: block; margin-bottom: 10px; opacity: 0.6; }
.meeting-empty h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.meeting-empty p { font-size: 11.5px; line-height: 1.6; }

.meeting-item { padding: 10px 10px 8px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; transition: all var(--t); margin-bottom: 4px; }
.meeting-item:hover { background: var(--surface); border-color: var(--border-light); }
.meeting-item.active { background: var(--accent-subtle); border-color: var(--border); }
.meeting-item-header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 5px; }
.meeting-item-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.meeting-item-info { flex: 1; min-width: 0; }
.meeting-item-title { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meeting-item-meta { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }
.meeting-delete-btn { color: var(--text-faint); font-size: 10px; opacity: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: all var(--t); flex-shrink: 0; }
.meeting-item:hover .meeting-delete-btn { opacity: 1; }
.meeting-delete-btn:hover { background: rgba(239,68,68,0.15); color: #f87171; }
.meeting-item-summary { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meeting-item-footer { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.meeting-kw { font-size: 9.5px; padding: 1px 6px; border-radius: 8px; background: var(--surface); color: var(--text-faint); border: 1px solid var(--border-light); }
.meeting-drive-link { color: var(--text-faint); font-size: 12px; padding: 2px 5px; border-radius: 4px; transition: color var(--t); margin-left: auto; }
.meeting-drive-link:hover { color: var(--accent-light); text-decoration: none; }

.meeting-right { flex: 1; overflow-y: auto; min-width: 0; }
.meeting-detail { height: 100%; overflow-y: auto; }
.meeting-detail-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-faint); }
.meeting-detail-empty i { font-size: 28px; opacity: 0.4; }
.meeting-detail-empty p { font-size: 13px; }

.meeting-detail-inner { padding: 20px 24px 32px; }
.meeting-detail-head { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.meeting-detail-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.meeting-detail-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.meeting-detail-links { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-link-small { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border-light); color: var(--text-muted); font-size: 11.5px; transition: all var(--t); text-decoration: none; }
.btn-link-small:hover { background: var(--accent-subtle); border-color: var(--border); color: var(--accent-light); text-decoration: none; }

.meeting-section { margin-bottom: 20px; }
.meeting-section-title { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); margin-bottom: 10px; }
.meeting-section-title i { font-size: 12px; color: var(--accent-light); }

.meeting-summary-text { font-size: 13px; line-height: 1.7; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-light); border-radius: var(--r); padding: 12px 14px; }

.meeting-actions-list { display: flex; flex-direction: column; gap: 6px; }
.action-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; background: var(--green-subtle); border: 1px solid rgba(16,185,129,0.2); border-radius: var(--r-sm); font-size: 12.5px; color: var(--text); }
.action-num { background: var(--green); color: white; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.no-action { font-size: 12px; color: var(--text-faint); }

.meeting-transcript { background: var(--bg-2); border: 1px solid var(--border-light); border-radius: var(--r); padding: 12px 14px; max-height: 380px; overflow-y: auto; font-size: 12.5px; }
.utterance { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-light); line-height: 1.6; flex-wrap: wrap; }
.utterance:last-child { border-bottom: none; }
.utt-time { font-size: 10px; color: var(--text-faint); font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 36px; }
.utt-speaker { font-size: 11px; font-weight: 700; color: var(--accent-light); flex-shrink: 0; background: var(--accent-subtle); padding: 1px 7px; border-radius: 8px; }
.utt-text { color: var(--text); flex: 1; }
.transcript-plain { color: var(--text-muted); line-height: 1.7; white-space: pre-wrap; }

.meeting-linked { display: flex; flex-wrap: wrap; gap: 6px; }
.linked-meet-btn { padding: 5px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border-light); color: var(--text-muted); font-size: 12px; transition: all var(--t); cursor: pointer; }
.linked-meet-btn:hover { background: var(--accent-subtle); border-color: var(--border); color: var(--accent-light); }

/* Floating Recording Badge */
.recording-badge { position: fixed; top: 12px; right: 16px; z-index: 9999; display: none; align-items: center; gap: 8px; background: rgba(15,17,23,0.92); backdrop-filter: blur(12px); border: 1px solid rgba(239,68,68,0.4); border-radius: 24px; padding: 6px 10px 6px 12px; font-size: 13px; font-weight: 600; color: var(--text); box-shadow: 0 4px 24px rgba(239,68,68,0.25); animation: badgeSlideIn 0.3s ease; }
.recording-badge.active { display: flex; }
@keyframes badgeSlideIn { from{ opacity:0; transform:translateY(-8px) scale(0.96); } to{ opacity:1; transform:translateY(0) scale(1); } }
.rec-badge-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; flex-shrink: 0; animation: recBadgePulse 1s ease infinite; }
@keyframes recBadgePulse { 0%,100%{ opacity:1; box-shadow:0 0 0 0 rgba(239,68,68,0.6); } 50%{ opacity:0.8; box-shadow:0 0 0 5px rgba(239,68,68,0); } }
#rec-badge-stop { width: 26px; height: 26px; border-radius: 50%; background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.4); color: #f87171; display: flex; align-items: center; justify-content: center; font-size: 10px; transition: all var(--t); flex-shrink: 0; }
#rec-badge-stop:hover { background: #ef4444; color: white; }

@media (max-width: 768px) {
    .meeting-content { flex-direction: column; }
    .meeting-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border-light); max-height: 40vh; }
    .rec-controls { gap: 8px; }
    .rec-timer { font-size: 18px; }
    .meeting-detail-inner { padding: 14px 16px 24px; }
    .recording-badge { top: auto; bottom: 80px; right: 12px; }
}
