/* Knowledge Garden - Obsidian-Style Layout */
/* M3 Expressive + Periwinkle Dark Theme */

/* ============================================
   1. ROOT VARIABLES (M3 Periwinkle references)
   Colors inherited from m3e-tokens.css.
   Only terminal semantic colors and layout vars here.
   ============================================ */
:root {
    /* Terminal semantic colors (kept distinct from M3 palette) */
    --terminal-green: #a6e3a1;
    --terminal-red: #f38ba8;
    --terminal-yellow: #f9e2af;
    --terminal-cyan: #89dceb;
    --terminal-blue: #89b4fa;
    --terminal-magenta: #E8B9D5;

    /* Shape aliases (reference M3 tokens) */
    --radius-sm: var(--md-sys-shape-corner-extra-small);
    --radius-md: var(--md-sys-shape-corner-small);
    --radius-lg: var(--md-sys-shape-corner-medium);
    --radius-xl: var(--md-sys-shape-corner-large);

    /* Motion aliases (reference M3 tokens) */
    --motion-spring: var(--motion-spring-bouncy);
    --motion-jiggle: cubic-bezier(0.36, 0.07, 0.19, 0.97);

    /* Typography */
    --font-chrome: var(--md-ref-typeface-brand);
    --font-terminal: 'JetBrains Mono', monospace;

    /* Sidebar */
    --sidebar-width: 260px;
}

/* ============================================
   2. BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-terminal);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

/* ============================================
   3. BACKGROUND BLOBS
   ============================================ */
.blob-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.2;
    animation: blobFloat 30s ease-in-out infinite;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(187, 195, 255, 0.6), transparent 70%);
    top: -150px;
    left: -150px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(232, 185, 213, 0.5), transparent 70%);
    bottom: -100px;
    right: -100px;
    animation-delay: -15s;
}

@keyframes blobFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(20px, -30px) scale(1.03);
    }

    66% {
        transform: translate(-15px, 20px) scale(0.97);
    }
}

/* ============================================
   4. APP CONTAINER
   ============================================ */
.app-container {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   5. FLOATING TERMINAL
   ============================================ */
.floating-terminal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 480px;
    height: 300px;
    min-width: 320px;
    min-height: 180px;
    background: rgba(18, 19, 24, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(187, 195, 255, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: var(--elevation-2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    resize: both;
}

.floating-terminal.dragging {
    animation: terminalJiggle 0.15s var(--motion-jiggle);
    box-shadow: var(--elevation-3);
}

.floating-terminal.minimized {
    width: 200px !important;
    height: 40px !important;
    resize: none;
}

.floating-terminal.maximized {
    width: 70vw !important;
    height: 70vh !important;
    bottom: 15vh;
    right: 15vw;
}

@keyframes terminalJiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-0.5deg) scale(1.01);
    }

    75% {
        transform: rotate(0.5deg) scale(1.01);
    }
}

/* Terminal Title Bar */
.terminal-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(13, 14, 19, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: grab;
    user-select: none;
}

.terminal-titlebar:active {
    cursor: grabbing;
}

.terminal-title {
    font-family: var(--font-chrome);
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-title::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--terminal-green);
    border-radius: 50%;
    animation: terminalPulse 2s ease-in-out infinite;
}

@keyframes terminalPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.terminal-controls {
    display: flex;
    gap: 6px;
}

.terminal-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s var(--motion-spring);
}

.terminal-btn:hover {
    background: var(--state-hover);
    color: var(--md-sys-color-on-surface);
}

.terminal-btn:active {
    transform: scale(0.95);
}

/* Terminal Body */
.terminal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    overflow: hidden;
}

.terminal-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid rgba(187, 195, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    transition: all 0.2s var(--motion-spring);
}

.terminal-input-wrapper:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(187, 195, 255, 0.15);
}

.terminal-prompt {
    display: flex;
    gap: 0;
    font-weight: 500;
    white-space: nowrap;
    font-size: 13px;
}

.prompt-user {
    color: var(--terminal-green);
}

.prompt-at {
    color: var(--md-sys-color-on-surface-variant);
}

.prompt-host {
    color: var(--terminal-cyan);
}

.prompt-path {
    color: var(--terminal-blue);
    margin-left: 4px;
}

.prompt-symbol {
    color: var(--md-sys-color-primary);
    margin-left: 4px;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-terminal);
    font-size: 13px;
    caret-color: var(--md-sys-color-primary);
}

.terminal-input::placeholder {
    color: var(--md-sys-color-outline);
}

.terminal-output {
    flex: 1;
    margin-top: 12px;
    padding: 12px;
    background: rgba(13, 14, 19, 0.4);
    border-radius: var(--radius-md);
    font-size: 12px;
    overflow-y: auto;
    line-height: 1.6;
}

.terminal-output:empty {
    display: none;
}

/* Progress Bar */
.terminal-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(187, 195, 255, 0.1);
    overflow: hidden;
}

.terminal-progress-bar {
    width: 100%;
    height: 0%;
    background: var(--md-sys-color-primary);
    transition: height 0.3s var(--motion-spring);
}

/* ============================================
   6. MAIN LAYOUT
   ============================================ */
.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ============================================
   7. SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--md-sys-color-surface-dim);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    transition: width 0.25s var(--motion-spring-expressive);
}

.sidebar.collapsed {
    width: 48px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--motion-spring);
}

.sidebar-toggle:hover {
    background: var(--state-hover);
    color: var(--md-sys-color-on-surface);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-title {
    font-family: var(--font-chrome);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-on-surface-variant);
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

/* File Tree */
.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s var(--motion-spring);
    font-size: 13px;
    color: var(--md-sys-color-on-surface);
}

.tree-item:hover {
    background: var(--state-hover);
}

.tree-item.active {
    background: rgba(187, 195, 255, 0.15);
    color: var(--md-sys-color-primary);
}

.tree-item.folder {
    color: var(--terminal-blue);
    font-weight: 500;
}

.tree-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
    opacity: 0.7;
}

.tree-item.folder .tree-icon {
    fill: var(--terminal-blue);
}

.tree-item.active .tree-icon {
    fill: var(--md-sys-color-primary);
    opacity: 1;
}

.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Folder chevron */
.tree-chevron {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform 0.2s var(--motion-spring);
}

.tree-item.expanded .tree-chevron {
    transform: rotate(90deg);
}

/* Loading indicator */
.tree-loading {
    padding: 6px 12px 6px 44px;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.tree-error {
    padding: 6px 12px 6px 44px;
    font-size: 12px;
    color: var(--terminal-red);
}

.tree-children.collapsed {
    display: none;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(187, 195, 255, 0.1);
    border: 1px solid rgba(187, 195, 255, 0.3);
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-chrome);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s var(--motion-spring);
}

.sidebar-btn:hover {
    background: rgba(187, 195, 255, 0.2);
    border-color: var(--md-sys-color-primary);
}

.sidebar-btn:active {
    transform: scale(0.95);
}

/* ============================================
   8. CONTENT VIEWER
   ============================================ */
.content-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--terminal-cyan);
}

.breadcrumb-item.clickable {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s var(--motion-spring);
}

.breadcrumb-item.clickable:hover {
    background: rgba(187, 195, 255, 0.2);
    color: var(--md-sys-color-primary);
}

.breadcrumb-item.current {
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
}

.breadcrumb-item::after {
    content: '/';
    margin-left: 8px;
    color: var(--md-sys-color-outline);
}

.breadcrumb-item:last-child::after {
    display: none;
}

.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px 48px;
}

/* Welcome Content */
.welcome-content h1 {
    font-family: var(--font-chrome);
    font-size: 2rem;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin-bottom: 8px;
}

.welcome-content .muted {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 32px;
}

.welcome-content h2 {
    font-family: var(--font-chrome);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin: 24px 0 12px;
}

.quick-start ul {
    list-style: none;
    padding: 0;
}

.quick-start li {
    padding: 8px 0;
    color: var(--md-sys-color-on-surface-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.quick-start code {
    background: rgba(187, 195, 255, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--terminal-cyan);
}

/* Folder View (for breadcrumb navigation) */
.folder-view h2 {
    font-family: var(--font-chrome);
    font-size: 1.5rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
}

.folder-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--motion-spring);
}

.folder-item:hover {
    background: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
    transform: translateY(-2px);
}

.folder-item:active {
    transform: scale(0.98);
}

.folder-item.folder {
    border-left: 3px solid var(--terminal-blue);
}

.folder-item.file {
    border-left: 3px solid var(--terminal-cyan);
}

.folder-item-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    opacity: 0.7;
}

.folder-item.folder .folder-item-icon {
    fill: var(--terminal-blue);
}

.folder-item-name {
    font-size: 13px;
    color: var(--md-sys-color-on-surface);
}

/* Featured Note Cards */
.note-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.note-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s var(--motion-spring);
}

.note-card:hover {
    background: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
    transform: translateY(-4px) scale(1.02);
}

.note-card:active {
    transform: scale(0.95);
}

.note-icon {
    width: 24px;
    height: 24px;
    fill: var(--md-sys-color-primary);
    flex-shrink: 0;
}

.note-title {
    font-size: 13px;
    font-weight: 500;
}

/* Rendered Markdown Content */
.markdown-content {
    font-size: 15px;
    line-height: 1.7;
}

.markdown-content h1 {
    font-family: var(--font-chrome);
    font-size: 2rem;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.markdown-content h2 {
    font-family: var(--font-chrome);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    margin: 32px 0 12px;
}

.markdown-content h3 {
    font-family: var(--font-chrome);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin: 24px 0 8px;
}

.markdown-content p {
    margin: 12px 0;
    color: var(--md-sys-color-on-surface);
}

.markdown-content a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content code {
    background: rgba(187, 195, 255, 0.15);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.markdown-content pre {
    background: var(--md-sys-color-surface-container-lowest);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.markdown-content li {
    margin: 6px 0;
}

.markdown-content blockquote {
    border-left: 3px solid var(--md-sys-color-primary);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--md-sys-color-on-surface-variant);
}

/* ============================================
   9. STATUS BAR
   ============================================ */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 24px;
    padding: 0 12px;
    background: var(--md-sys-color-primary-container);
    font-family: var(--font-terminal);
    font-size: 11px;
    color: var(--md-sys-color-on-primary-container);
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-item {
    opacity: 0.9;
}

/* ============================================
   10. GRAPH VIEW
   ============================================ */
.graph-container {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: rgba(13, 14, 19, 0.98);
    backdrop-filter: blur(20px);
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.graph-title {
    font-family: var(--font-chrome);
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
}

.graph-controls {
    display: flex;
    gap: 8px;
}

.graph-control-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-chrome);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s var(--motion-spring);
}

.graph-control-btn:hover {
    background: rgba(187, 195, 255, 0.2);
    border-color: var(--md-sys-color-primary);
}

.graph-control-btn:active {
    transform: scale(0.95);
}

.graph-canvas {
    flex: 1;
    position: relative;
}

/* Graph tooltip */
.graph-tooltip {
    position: fixed;
    padding: 8px 12px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid rgba(187, 195, 255, 0.3);
    border-radius: var(--radius-sm);
    font-family: var(--font-chrome);
    font-size: 12px;
    pointer-events: none;
    z-index: 200;
}

/* Graph legend */
.graph-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(13, 14, 19, 0.9);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.legend-title {
    font-family: var(--font-chrome);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-label {
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
}

.legend-stats {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
}

/* ============================================
   11. RESPONSIVE
   ============================================ */

/* Mobile menu button - hidden on desktop */
.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* Tablet - 1024px */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

    .content-body {
        padding: 24px;
    }

    .note-cards {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

/* Mobile - 768px */
@media (max-width: 768px) {

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

    /* Hide desktop sidebar toggle */
    .sidebar-toggle {
        display: none;
    }

    /* Sidebar as slide-out drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s var(--motion-spring-expressive);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Collapse state doesn't apply on mobile */
    .sidebar.collapsed {
        width: 280px;
        transform: translateX(-100%);
    }

    .sidebar.collapsed.open {
        transform: translateX(0);
    }

    /* Content viewer full width */
    .content-viewer {
        width: 100%;
    }

    .content-body {
        padding: 16px;
    }

    /* Spotlight adjustments */
    .spotlight-wrapper {
        padding: 8px 12px;
        gap: 8px;
    }

    .spotlight-prompt {
        display: none;
    }

    .spotlight-input {
        font-size: 14px;
    }

    .spotlight-hint {
        display: none;
    }

    /* Note cards single column */
    .note-cards {
        grid-template-columns: 1fr;
    }

    /* Folder view adjustments */
    .folder-items {
        grid-template-columns: 1fr;
    }

    /* Breadcrumb horizontal scroll */
    .content-breadcrumb {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }

    /* Graph container */
    #graphContainer {
        padding: 0;
    }

    /* Graph header */
    .graph-header {
        padding: 12px 16px;
    }

    /* Graph legend */
    .graph-legend {
        bottom: 10px;
        left: 10px;
        padding: 8px 12px;
        font-size: 11px;
        max-height: 200px;
    }

    /* Graph controls */
    .graph-controls {
        top: auto;
        bottom: 10px;
        right: 10px;
    }
}

/* Small mobile - 480px */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }

    .content-body {
        padding: 12px;
    }

    .welcome-content h1 {
        font-size: 1.5rem;
    }

    .note-title h1,
    .note-title h2 {
        font-size: 1.25rem;
    }

    /* Touch-friendly tree items */
    .tree-item {
        padding: 12px 16px;
        min-height: 44px;
    }

    /* Status bar compact */
    .status-bar {
        padding: 6px 12px;
        font-size: 10px;
    }
}

/* ============================================
   12. REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   13. FLOATING TERMINAL MOBILE
   ============================================ */
@media (max-width: 768px) {
    .floating-terminal {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        bottom: 10px;
        height: 200px;
    }

    .floating-terminal.maximized {
        width: calc(100% - 20px) !important;
        height: 60vh !important;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
}
