/* ==================== VARIABLES ==================== */
:root[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #151515;
    --bg-tertiary: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --accent: #0ea5e9;
    --accent-secondary: #0284c7;
    --accent-hover: #38bdf8;
    --border: #262626;
    --card-bg: #151515;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: rgba(14, 165, 233, 0.15);
    --shadow-hover: rgba(14, 165, 233, 0.25);
}

:root[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --accent: #0ea5e9;
    --accent-secondary: #0284c7;
    --accent-hover: #38bdf8;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: rgba(15, 23, 42, 0.08);
    --shadow-hover: rgba(15, 23, 42, 0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== HEADER ==================== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    max-width: 100%;
}

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

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.header-date,
.header-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s;
}

.header-date:hover,
.header-clock:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 4px var(--shadow);
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sidebar-toggle,
.theme-toggle,
.menu-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-toggle {
    font-size: 0.9375rem;
    padding: 6px 10px;
}

.theme-toggle {
    font-size: 1.125rem;
}

.menu-toggle {
    font-size: 1.25rem;
}

.sidebar-toggle:hover,
.theme-toggle:hover,
.menu-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
    border-color: var(--accent);
}

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 0;
    height: calc(100vh - 70px);
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
}

.dashboard-layout.left-collapsed {
    grid-template-columns: 0 1fr 300px;
}

.dashboard-layout.right-collapsed {
    grid-template-columns: 250px 1fr 0;
}

.dashboard-layout.both-collapsed {
    grid-template-columns: 0 1fr 0;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    transition: all 0.3s ease;
}

.dashboard-layout.left-collapsed .sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 16px;
}

.nav-title {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding: 4px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent);
}

.nav-item.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 4px var(--shadow);
}

.nav-icon {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 30px;
}

.content-view {
    display: none;
}

.content-view.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

#notesView.content-view.active {
    display: flex;
    flex-direction: column;
}

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

/* ==================== SECTIONS ==================== */
.section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow);
}

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

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* ==================== CARDS GRID ==================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.card-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.card-content p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 0.6875rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.card-badge.online {
    background: var(--success);
    color: #ffffff;
}

/* ==================== MISSION CARD ==================== */
.mission-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 6px;
}

.mission-code {
    background: var(--accent);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8125rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.05em;
}

.mission-table {
    width: 100%;
    border-collapse: collapse;
}

.mission-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.mission-table td.label {
    font-weight: 600;
    width: 140px;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mission-table td:not(.label) {
    font-family: 'JetBrains Mono', monospace;
}

.status-badge {
    background: var(--warning);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== OBJECTIVES ==================== */
.objectives-list {
    list-style: none;
    padding: 0;
}

.objective-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.objective-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 4px var(--shadow);
}

.objective-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.objective-item span {
    flex: 1;
}

.objective-actions {
    display: flex;
    gap: 6px;
}

.objective-actions button {
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.objective-actions button:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* ==================== LOG ==================== */
.operations-log {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.log-entry {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-left: 2px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.8125rem;
}

.log-timestamp {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-right: 8px;
}

/* ==================== WIDGETS SIDEBAR ==================== */
.widgets-sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    transition: all 0.3s ease;
}

.dashboard-layout.right-collapsed .widgets-sidebar {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.widget {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.widget-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ==================== PROGRESS ==================== */
.progress-item {
    margin-bottom: 16px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.progress-label span:last-child {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease;
    border-radius: 3px;
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
}

.quick-action:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* ==================== SYSTEM INFO ==================== */
.system-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

/* ==================== BUTTONS ==================== */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    box-shadow: 0 2px 4px var(--shadow);
}

.btn-danger {
    background: var(--error);
    color: #ffffff;
    border-color: var(--error);
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 8px;
    min-width: 400px;
    position: relative;
    z-index: 1001;
    animation: modalSlideIn 0.3s ease-out;
    box-shadow: 0 8px 24px var(--shadow-hover);
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.modal-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    border-radius: 6px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-style: italic;
}

/* ==================== DEBUG PANEL ==================== */
.debug-panel {
    position: fixed;
    bottom: -400px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    height: 350px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 12px var(--shadow);
    transition: bottom 0.3s ease;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.debug-panel.active {
    bottom: 0;
}

.debug-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.debug-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: all 0.2s;
    font-weight: 500;
}

.debug-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

.debug-logs {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.debug-log-entry {
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: var(--text-primary);
}

.debug-log-entry pre {
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    width: 100%;
    margin-top: 4px;
}

.debug-footer {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.debug-footer kbd {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1400px) {
    .dashboard-layout {
        grid-template-columns: 250px 1fr;
    }

    .widgets-sidebar {
        display: none;
    }
}

@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -250px;
        top: 70px;
        height: calc(100vh - 70px);
        z-index: 99;
        transition: left 0.3s;
    }

    .sidebar.active {
        left: 0;
    }

    .header-center {
        display: none;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 600px) {
    .header-content {
        padding: 10px 15px;
    }

    .header-left h1 {
        font-size: 1.3rem;
    }

    .header-subtitle {
        display: none;
    }

    .main-content {
        padding: 15px;
    }

    .modal-box {
        min-width: 90%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ==================== AI ASSISTANT FLOATING ==================== */
.ai-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--shadow-hover);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-floating-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-hover);
    background: var(--accent-hover);
}

.ai-floating-btn:active {
    transform: translateY(-2px);
}

.ai-icon {
    font-size: 1.75rem;
    position: relative;
    z-index: 2;
}

.ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* AI Panel */
.ai-panel {
    position: fixed;
    right: -450px;
    bottom: 24px;
    width: 420px;
    height: calc(100vh - 120px);
    max-height: 700px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: -4px 0 24px var(--shadow);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-panel.open {
    right: 24px;
}

.ai-panel.minimized {
    height: 60px;
}

/* Panel Header */
.ai-panel-header {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-header-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-avatar {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-panel-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 2px 0;
    color: var(--text-primary);
}

.ai-status {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--error);
    border-radius: 50%;
    display: inline-block;
}

.ai-status.online::before {
    background: var(--success);
    animation: pulse 2s infinite;
}

.ai-header-actions {
    display: flex;
    gap: 6px;
}

.ai-header-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 0.875rem;
}

.ai-header-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Messages Area */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
    scroll-behavior: smooth;
}

.ai-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

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

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message.system {
    flex-direction: column;
    align-items: center;
}

.ai-message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.ai-message.user .ai-message-bubble {
    background: var(--accent);
    color: #fff;
    border-radius: 12px 12px 4px 12px;
}

.ai-message.assistant .ai-message-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 12px 12px 12px 4px;
}

.ai-message.system .ai-message-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 90%;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.ai-message-bubble code {
    background: var(--bg-tertiary);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
}

.ai-message-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 10px;
}

.ai-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.4s infinite ease-in-out;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Quick Actions */
.ai-quick-actions {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    flex-shrink: 0;
}

.ai-quick-btn {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.8125rem;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.ai-quick-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Input Area */
.ai-input-area {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#aiInput {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    resize: none;
    max-height: 100px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: border-color 0.2s;
}

#aiInput:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
}

#aiInput::placeholder {
    color: var(--text-tertiary);
}

.ai-send-btn {
    padding: 10px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

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

/* Settings Panel */
.ai-settings-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 10;
    display: none;
    flex-direction: column;
}

.ai-settings-panel.active {
    display: flex;
}

.ai-settings-header {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-settings-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.ai-settings-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.ai-setting-group {
    margin-bottom: 20px;
}

.ai-setting-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.ai-setting-group input,
.ai-setting-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.ai-setting-group input:focus,
.ai-setting-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.ai-setting-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.ai-test-btn,
.ai-clear-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.ai-test-btn {
    background: var(--success);
    color: #ffffff;
}

.ai-test-btn:hover {
    opacity: 0.9;
}

.ai-clear-btn {
    background: var(--error);
    color: #ffffff;
}

.ai-clear-btn:hover {
    opacity: 0.9;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-panel {
        right: -100%;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        border-radius: 0;
    }

    .ai-panel.open {
        right: 0;
    }

    .ai-floating-btn {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .ai-icon {
        font-size: 1.5rem;
    }

    .ai-message-bubble {
        max-width: 85%;
    }

    .ai-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .ai-quick-btn {
        white-space: normal;
        font-size: 0.75rem;
    }
}

/* ==================== AI TOOL EXECUTION FEEDBACK ==================== */
.tool-execution {
    background: var(--bg-tertiary) !important;
    border-left: 3px solid var(--accent) !important;
}

.tool-execution .ai-message-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    max-width: 95%;
}

.tool-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    font-size: 0.875rem;
}

.tool-icon {
    font-size: 1.125rem;
}

.tool-name {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8125rem;
}

.tool-reason {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.tool-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    padding: 6px 0;
}

.tool-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.tool-success {
    color: var(--success);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-error {
    color: var(--error);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================
   TOOL MODAL FULLSCREEN
   ========================================== */

.tool-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.tool-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tool-modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 1;
}

/* Modal Header */
.tool-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-shrink: 0;
}

.tool-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-back-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateX(-2px);
}

.tool-back-icon {
    font-size: 1.25rem;
    font-weight: bold;
}

.tool-back-text {
    font-family: 'Inter', sans-serif;
}

.tool-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.tool-modal-icon {
    font-size: 1.5rem;
}

.tool-modal-title span:last-child {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tool-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-header-btn,
.tool-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-header-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: scale(1.05);
}

.tool-close-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Loading State */
.tool-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 2;
}

.tool-loading.active {
    display: flex;
}

.tool-loading .tool-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.tool-loading p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Iframe */
.tool-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
}

/* Fullscreen Mode */
.tool-modal-container.fullscreen .tool-modal-header {
    display: none;
}

.tool-modal-container.fullscreen .tool-iframe {
    height: 100vh;
}

/* Responsive */
@media (max-width: 768px) {
    .tool-modal-header {
        padding: 12px 16px;
    }

    .tool-back-text {
        display: none;
    }

    .tool-back-btn {
        padding: 8px 12px;
    }

    .tool-modal-icon {
        font-size: 1.25rem;
    }

    .tool-modal-title span:last-child {
        font-size: 1rem;
    }

    .tool-header-btn,
    .tool-close-btn {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

/* Animation */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tool-modal.active .tool-modal-container {
    animation: slideUp 0.3s ease;
}

/* ==========================================
   TODO PANEL FLOATING
   ========================================== */

/* Floating Button */
.todo-floating-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    background: var(--success);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-floating-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
    background: #059669;
}

.todo-floating-btn:active {
    transform: translateY(-2px);
}

.todo-icon {
    font-size: 1.75rem;
    position: relative;
    z-index: 2;
}

.todo-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
}

.todo-badge.active {
    display: block;
    animation: badgePop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.todo-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--success);
    opacity: 0.6;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Panel Container */
.todo-panel {
    position: fixed;
    left: -430px;
    bottom: 24px;
    width: 380px;
    height: calc(100vh - 120px);
    max-height: 700px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-hover);
    z-index: 999;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.todo-panel.open {
    left: 24px;
}

.todo-panel.minimized {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Panel Header */
.todo-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.todo-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.todo-avatar {
    font-size: 1.5rem;
}

.todo-header-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.todo-stats {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.2;
}

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

.todo-header-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.todo-header-btn:hover {
    background: var(--bg-primary);
    border-color: var(--success);
    color: var(--success);
}

/* Tasks List */
.todo-tasks-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.todo-tasks-list::-webkit-scrollbar {
    width: 6px;
}

.todo-tasks-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.todo-tasks-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.todo-tasks-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.todo-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-style: italic;
}

/* Task Item */
.todo-task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);
    border-radius: 6px;
    transition: all 0.2s ease;
    animation: taskSlideIn 0.3s ease;
}

.todo-task-item:hover {
    border-color: var(--success);
    box-shadow: 0 2px 8px var(--shadow);
    transform: translateX(2px);
}

.todo-task-item.completed {
    opacity: 0.6;
    border-left-color: var(--text-tertiary);
}

.todo-task-item.completed .todo-task-text {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

@keyframes taskSlideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Checkbox */
.todo-task-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.todo-task-checkbox:hover {
    border-color: var(--success);
    background: var(--bg-secondary);
}

.todo-task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.todo-task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
}

/* Task Text */
.todo-task-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

/* Delete Button */
.todo-task-delete {
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.todo-task-item:hover .todo-task-delete {
    opacity: 1;
}

.todo-task-delete:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
    transform: scale(1.1);
}

/* Input Area */
.todo-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.todo-input-area input {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.todo-input-area input:focus {
    outline: none;
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.todo-input-area input::placeholder {
    color: var(--text-tertiary);
}

.todo-add-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.todo-add-btn:hover {
    background: #059669;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

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

/* Footer Stats */
.todo-footer {
    padding: 12px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    text-align: center;
    flex-shrink: 0;
}

.todo-footer span {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .todo-floating-btn {
        bottom: 20px;
        left: 20px;
        width: 52px;
        height: 52px;
    }

    .todo-icon {
        font-size: 1.5rem;
    }

    .todo-panel {
        left: -100%;
        bottom: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .todo-panel.open {
        left: 0;
    }

    .todo-tasks-list {
        padding: 12px;
    }

    .todo-task-item {
        padding: 14px 12px;
    }

    .todo-task-text {
        font-size: 0.9375rem;
    }

    .todo-task-delete {
        opacity: 1;
    }

    .todo-input-area {
        padding: 14px 12px;
    }
}

/* Animation for panel opening */
.todo-panel.open {
    animation: slideInFromLeft 0.3s ease;
}

@keyframes slideInFromLeft {
    from {
        left: -430px;
        opacity: 0.8;
    }
    to {
        left: 24px;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    @keyframes slideInFromLeft {
        from {
            left: -100%;
            opacity: 0.8;
        }
        to {
            left: 0;
            opacity: 1;
        }
    }
}

/* ==================== PAGINATION SYSTEM ==================== */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    margin-top: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.pagination-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-page {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-page:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-1px);
}

.pagination-page.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

.pagination-ellipsis {
    color: var(--text-tertiary);
    padding: 0 4px;
    font-size: 0.875rem;
}

.pagination-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.pagination-per-page label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-select {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.pagination-select:hover {
    border-color: var(--accent);
}

.pagination-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--shadow);
}

/* Responsive */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 12px;
    }

    .pagination-controls {
        width: 100%;
        justify-content: space-between;
    }

    .pagination-pages {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination-per-page {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   NOTES VIEWER STYLES
   ============================================ */

.notes-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100%;
    gap: 0;
}

/* Notes Sidebar */
.notes-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.notes-sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notes-sidebar .search-box {
    padding: 0 20px 12px 20px;
    position: relative;
}

.notes-sidebar .search-box input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.notes-sidebar .search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.note-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-item:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.note-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.note-item.active .note-item-meta,
.note-item.active .note-item-date {
    color: rgba(255, 255, 255, 0.8);
}

.note-item-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.9375rem;
}

.note-item-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
}

.note-item-date {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

/* Notes Content Area */
.notes-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Note Editor */
#noteEditor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.note-editor-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.note-title-input {
    flex: 1;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.note-title-input:focus {
    outline: none;
    border-color: var(--accent);
}

.note-actions {
    display: flex;
    gap: 8px;
}

.note-textarea {
    flex: 1;
    padding: 24px;
    background: var(--bg-primary);
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: none;
}

.note-textarea:focus {
    outline: none;
}

/* Note Viewer */
#noteViewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.note-viewer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.note-viewer-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1;
}

.note-viewer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.note-info-bar {
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.note-info-bar .category-badge {
    background: var(--accent);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Markdown Content Styles */
.markdown-content {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.markdown-content h1 {
    font-size: 2rem;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.markdown-content h2 {
    font-size: 1.5rem;
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-content h3 {
    font-size: 1.25rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.markdown-content p {
    margin-bottom: 16px;
}

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

.markdown-content li {
    margin-bottom: 8px;
}

.markdown-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875em;
}

.markdown-content pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}

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

.markdown-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

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

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

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.markdown-content th,
.markdown-content td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

/* Notes Welcome Screen */
.notes-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-primary);
}

.welcome-content {
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
}

.welcome-content h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.welcome-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .notes-container {
        grid-template-columns: 1fr;
    }

    .notes-sidebar {
        display: none;
    }

    .note-editor-header,
    .note-viewer-header {
        flex-direction: column;
        align-items: stretch;
    }

    .note-actions {
        width: 100%;
        justify-content: stretch;
    }

    .note-actions button {
        flex: 1;
    }
}
