/* ============================================
   Cowork Dash - Minimal Professional Design
   Clean, elegant, distraction-free interface
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   CSS Variables - Neutral Palette
   ============================================ */
:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --border-subtle: #e5e5e5;
    --border-muted: #ebebeb;
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.06);
    --radius-sm: 4px;
    --radius-md: 6px;
    --transition-fast: 0.1s ease;
}

[data-mantine-color-scheme="dark"] {
    --bg-primary: #1a1b1e;
    --bg-secondary: #25262b;
    --bg-tertiary: #2c2e33;
    --border-subtle: #373a40;
    --border-muted: #2e3035;
    --text-primary: #f1f3f5;
    --text-secondary: #a6a7ab;
    --text-muted: #5c5f66;
    --accent-blue: #74c0fc;
    --accent-green: #69db7c;
    --accent-amber: #ffd43b;
    --accent-red: #ff8787;
    --accent-purple: #b197fc;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.35);
}

/* ============================================
   Base Reset & Typography
   ============================================ */
* {
    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.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code, pre, .mono {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
    font-size: 13px;
}

/* ============================================
   Animations - Subtle & Fast
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.message-enter { animation: fadeIn 0.15s ease forwards; }
.thinking-pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ============================================
   Chat Panel
   ============================================ */
#chat-panel {
    background: var(--bg-primary);
}

#chat-messages {
    background: var(--bg-primary);
}

/* ============================================
   Chat Messages - Clean Cards
   ============================================ */
.chat-message {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.chat-message-user {
    background: var(--bg-tertiary);
    border-left: 2px solid var(--accent-blue);
}

.chat-message-agent {
    background: var(--bg-secondary);
    border-left: 2px solid var(--accent-green);
}

.chat-message-loading {
    background: var(--bg-secondary);
    border-left: 2px solid var(--accent-purple);
    padding: 12px 14px;
}

/* Message Labels */
.message-role-user { color: var(--accent-blue); font-weight: 500; }
.message-role-agent { color: var(--accent-green); font-weight: 500; }
.message-time { color: var(--text-muted); font-size: 12px; }
.thinking-text { color: var(--accent-purple); }

/* ============================================
   Markdown Content
   ============================================ */
#chat-messages .markdown {
    padding: 4px 0;
}

#chat-messages h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 12px 0 6px;
    color: var(--text-primary);
}

#chat-messages h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0 4px;
    color: var(--text-primary);
}

#chat-messages p {
    margin: 6px 0;
    line-height: 1.6;
}

#chat-messages ul, #chat-messages ol {
    margin: 6px 0;
    padding-left: 20px;
}

#chat-messages li {
    margin: 3px 0;
}

#chat-messages strong {
    font-weight: 600;
    color: var(--text-primary);
}

#chat-messages code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

#chat-messages pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}

#chat-messages pre code {
    background: none;
    padding: 0;
}

/* ============================================
   Details/Summary - Minimal Style
   ============================================ */
details {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 4px;
}

details summary {
    list-style: none;
    cursor: pointer;
    padding: 4px 8px 4px 18px;
    position: relative;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

details summary::-webkit-details-marker { display: none; }

details summary::before {
    content: '›';
    position: absolute;
    left: 6px;
    font-size: 12px;
    transition: transform 0.15s;
    color: var(--text-muted);
}

details[open] summary::before {
    transform: rotate(90deg);
}

details summary:hover {
    background: var(--bg-tertiary) !important;
}

/* Details Variants */
.details-summary {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px 4px 18px;
    color: var(--text-secondary);
}

.details-summary-thinking {
    color: var(--accent-purple);
}

.details-summary-todo {
    color: #0891b2;
}

.details-summary-warning {
    color: var(--accent-amber);
    padding-left: 8px;
}

.details-summary-warning::before {
    content: none;
}

.details-summary-success {
    color: var(--accent-green);
    padding-left: 8px;
}

.details-summary-success::before {
    content: none;
}

.details-summary-muted {
    color: var(--text-muted);
}

.details-content {
    font-size: 13px;
    padding: 8px 10px;
    color: var(--text-primary);
}

.details-content-thinking {
    border-left: 2px solid var(--accent-purple);
    margin-left: 8px;
    padding-left: 10px;
}

.details-content-todo {
    border-left: 2px solid #06b6d4;
    margin-left: 8px;
    padding-left: 10px;
}

/* Chat Details Wrapper */
.chat-details {
    margin-bottom: 4px;
}

/* ============================================
   Tool Calls - Clean Compact Design
   ============================================ */
.tool-call {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    font-size: 12px;
    padding: 0;
    overflow: hidden;
}

.tool-call > summary.tool-call-header {
    list-style: none;
    cursor: pointer;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background var(--transition-fast);
}

.tool-call > summary.tool-call-header::-webkit-details-marker { display: none; }
.tool-call > summary.tool-call-header::before { content: none; }

.tool-call > summary.tool-call-header:hover {
    background: var(--bg-tertiary);
}

.tool-call-body {
    padding: 8px 10px 10px;
    border-top: 1px solid var(--border-muted);
}

.tool-call-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tool-call-success .tool-call-status-dot { background: var(--accent-green); }
.tool-call-error .tool-call-status-dot { background: var(--accent-red); }
.tool-call-running .tool-call-status-dot { background: var(--accent-amber); animation: pulse 1.5s ease-in-out infinite; }
.tool-call-pending .tool-call-status-dot { background: var(--text-muted); }

.tool-call-icon-success,
.tool-call-icon-error,
.tool-call-icon-running,
.tool-call-icon-pending { display: none; }

.tool-call-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.tool-call-label {
    font-size: 11px;
    color: var(--text-muted);
}

.tool-call details {
    margin-top: 6px;
    background: transparent;
    border: none;
    padding: 0;
}

.tool-call-summary {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tool-call-summary::before { content: none; }

.tool-call-summary:hover {
    background: var(--border-subtle) !important;
}

.tool-call-args,
.tool-call-result {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-top: 4px;
    overflow: auto;
    max-height: 120px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   Todo Items
   ============================================ */
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 3px 0;
}

/* ============================================
   Input Area
   ============================================ */
.chat-input {
    border: 1px solid var(--border-subtle) !important;
    background: var(--bg-secondary) !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important;
}

.chat-input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

.send-btn:hover:not(:disabled) {
    background: #2563eb !important;
}

/* ============================================
   Resize Handle
   ============================================ */
.resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background var(--transition-fast);
}

.resize-handle:hover { background: var(--border-subtle); }
.resize-handle:active { background: var(--text-muted); }

/* ============================================
   File Browser
   ============================================ */
.file-tree-item {
    background: transparent;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-muted);
    transition: background var(--transition-fast);
}

.file-tree-item:hover {
    background: var(--bg-tertiary) !important;
}

.folder-icon { color: var(--text-muted); }
.folder-name { color: var(--text-primary); font-size: 13px; }
.file-item { color: var(--text-secondary); font-size: 13px; }
.file-item:hover { background: var(--bg-tertiary); }
.folder-header:hover { background: var(--bg-tertiary); }

.file-tree-empty,
.file-tree-loading {
    color: var(--text-muted);
    font-size: 12px;
}

/* Breadcrumb */
.breadcrumb-bar { background: var(--bg-tertiary); }
.breadcrumb-item { transition: background var(--transition-fast); }
.breadcrumb-clickable:hover { background: var(--bg-secondary) !important; }
.breadcrumb-separator { user-select: none; }
.folder-select-target { transition: background var(--transition-fast); }
.folder-expand-toggle { opacity: 0.5; transition: opacity var(--transition-fast); }
.folder-expand-toggle:hover { opacity: 1; }

/* ============================================
   Canvas
   ============================================ */
.canvas-empty { color: var(--text-muted); }
.canvas-empty-text { color: var(--text-muted); }
.canvas-item-title { color: var(--text-primary); font-size: 13px; }

.canvas-item {
    margin-bottom: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    max-width: 100%;
    overflow: hidden;
}

.canvas-item-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}

.canvas-item-container:hover {
    box-shadow: var(--shadow-md);
}

.canvas-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-muted);
    background: var(--bg-tertiary);
}

.canvas-item-title-text { color: var(--text-primary); }
.canvas-item-time { font-size: 11px; color: var(--text-muted); }
.canvas-item-content { padding: 12px; }

.canvas-collapse-btn {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}
.canvas-collapse-btn:hover { opacity: 1; }

.canvas-delete-btn {
    opacity: 0.3;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}
.canvas-delete-btn:hover {
    opacity: 1;
    color: var(--accent-red) !important;
}

.canvas-item-content-wrapper {
    transition: max-height 0.2s ease-out;
    overflow: hidden;
}

/* Canvas Markdown */
.canvas-markdown {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.canvas-markdown h1,
.canvas-markdown h2,
.canvas-markdown h3,
.canvas-markdown h4 {
    color: var(--text-primary);
    margin: 10px 0 6px;
}

.canvas-markdown h1 { font-size: 18px; }
.canvas-markdown h2 { font-size: 16px; }
.canvas-markdown h3 { font-size: 15px; }
.canvas-markdown h4 { font-size: 14px; }

.canvas-markdown p { color: var(--text-primary); margin: 6px 0; }
.canvas-markdown ul, .canvas-markdown ol { margin: 6px 0; padding-left: 20px; }
.canvas-markdown li { margin: 3px 0; color: var(--text-primary); }
.canvas-markdown strong { color: var(--text-primary); font-weight: 600; }

.canvas-markdown code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.canvas-markdown pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.canvas-code { color: var(--text-secondary); font-size: 13px; }

/* ============================================
   Data Tables
   ============================================ */
.dataframe-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dataframe-table th {
    background: var(--bg-tertiary);
    font-weight: 500;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.dataframe-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-muted);
}

/* CSV Preview */
.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.csv-preview-table th {
    background: var(--bg-tertiary);
    font-weight: 500;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.csv-preview-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-muted);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csv-preview-table tr:hover td {
    background: var(--bg-tertiary);
}

/* CSV Pagination */
#csv-prev-page:disabled,
#csv-next-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#csv-prev-page:not(:disabled):hover,
#csv-next-page:not(:disabled):hover {
    background: var(--bg-tertiary) !important;
}

/* ============================================
   Display Inline
   ============================================ */
.display-inline-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.display-inline-title {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-muted);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.display-inline-error { color: var(--accent-red); }
.display-inline-image { display: block; margin: 0 auto; }

.display-inline-dataframe table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.display-inline-dataframe th,
.display-inline-dataframe td {
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.display-inline-dataframe th {
    background: var(--bg-tertiary);
    font-weight: 500;
}

.display-inline-df-summary { color: var(--text-muted); }

.display-inline-json,
.display-inline-text {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    font-family: 'JetBrains Mono', monospace;
}

.display-inline-filename { color: var(--text-muted); }
.display-inline-html iframe { background: white; }

/* ============================================
   Mermaid Diagrams
   ============================================ */
.mermaid-diagram {
    max-height: 60vh;
    overflow: auto;
}

.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
    max-height: 60vh;
}

/* ============================================
   Scrollbars - Minimal
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.csv-table-container {
    scrollbar-width: thin;
}

.csv-table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.csv-table-container::-webkit-scrollbar-track {
    background: transparent;
}

.csv-table-container::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

/* ============================================
   Interrupt/Approval Dialog
   ============================================ */
.interrupt-container {
    padding: 16px;
    background: #fffbeb;
    border: 1px solid var(--accent-amber);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.interrupt-title { color: #92400e; font-weight: 600; }
.interrupt-message { color: var(--text-primary); }
.interrupt-tool-label { color: var(--text-muted); }
.interrupt-tool-name { color: #b45309; font-weight: 500; }

.interrupt-command,
.interrupt-args {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.interrupt-input {
    border: 1px solid #fcd34d;
    background: #ffffff;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.interrupt-btn {
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.interrupt-btn-approve {
    background: var(--accent-green);
    color: #ffffff;
}
.interrupt-btn-approve:hover { background: #16a34a; }

.interrupt-btn-reject {
    background: var(--accent-red);
    color: #ffffff;
}
.interrupt-btn-reject:hover { background: #dc2626; }

.interrupt-btn-edit {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.interrupt-btn-edit:hover { background: var(--border-subtle); }

/* Dark mode interrupt */
[data-mantine-color-scheme="dark"] .interrupt-container {
    background: #422006;
    border-color: #a16207;
}

[data-mantine-color-scheme="dark"] .interrupt-title { color: #fcd34d; }
[data-mantine-color-scheme="dark"] .interrupt-tool-name { color: #fbbf24; }

[data-mantine-color-scheme="dark"] .interrupt-command,
[data-mantine-color-scheme="dark"] .interrupt-args {
    background: #451a03;
    border-color: #78350f;
}

[data-mantine-color-scheme="dark"] .interrupt-input {
    border-color: #78350f;
    background: var(--bg-secondary);
}

/* ============================================
   Code Blocks
   ============================================ */
code, pre {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    background: var(--bg-tertiary);
    font-size: 13px;
}

pre {
    padding: 12px;
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

code {
    padding: 2px 6px;
    border-radius: 3px;
}

/* ============================================
   Dark Mode - Explicit Overrides
   ============================================ */

/* Body and panels */
[data-mantine-color-scheme="dark"] body {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-mantine-color-scheme="dark"] #chat-panel,
[data-mantine-color-scheme="dark"] #chat-messages {
    background: var(--bg-primary);
}

/* Chat messages */
[data-mantine-color-scheme="dark"] .chat-message {
    background: var(--bg-secondary);
}

[data-mantine-color-scheme="dark"] .chat-message-user {
    background: #2d3748;
    border-left-color: var(--accent-blue);
}

[data-mantine-color-scheme="dark"] .chat-message-agent {
    background: var(--bg-secondary);
    border-left-color: var(--accent-green);
}

[data-mantine-color-scheme="dark"] .chat-message-loading {
    background: var(--bg-secondary);
    border-left-color: var(--accent-purple);
}

/* Message role labels - brighter in dark mode */
[data-mantine-color-scheme="dark"] .message-role-user { color: #a5d8ff; }
[data-mantine-color-scheme="dark"] .message-role-agent { color: #8ce99a; }
[data-mantine-color-scheme="dark"] .thinking-text { color: #d0bfff; }
[data-mantine-color-scheme="dark"] .message-time { color: #5c5f66; }

/* Details/Summary */
[data-mantine-color-scheme="dark"] .details-summary-thinking { color: #d0bfff; }
[data-mantine-color-scheme="dark"] .details-summary-todo { color: #99e9f2; }
[data-mantine-color-scheme="dark"] .details-summary-warning { color: #ffe066; }
[data-mantine-color-scheme="dark"] .details-summary-success { color: #8ce99a; }

[data-mantine-color-scheme="dark"] .details-content-thinking {
    border-left-color: var(--accent-purple);
}

[data-mantine-color-scheme="dark"] .details-content-todo {
    border-left-color: #3bc9db;
}

/* Tool calls */
[data-mantine-color-scheme="dark"] .tool-call {
    background: var(--bg-secondary);
    border-color: var(--border-subtle);
}

[data-mantine-color-scheme="dark"] .tool-call > summary.tool-call-header:hover {
    background: var(--bg-tertiary);
}

[data-mantine-color-scheme="dark"] .tool-call-body {
    border-top-color: var(--border-muted);
}

[data-mantine-color-scheme="dark"] .tool-call-success .tool-call-status-dot { background: #69db7c; }
[data-mantine-color-scheme="dark"] .tool-call-error .tool-call-status-dot { background: #ff8787; }
[data-mantine-color-scheme="dark"] .tool-call-running .tool-call-status-dot { background: #ffd43b; }
[data-mantine-color-scheme="dark"] .tool-call-pending .tool-call-status-dot { background: #5c5f66; }

[data-mantine-color-scheme="dark"] .tool-call-name { color: var(--text-primary); }
[data-mantine-color-scheme="dark"] .tool-call-label { color: var(--text-muted); }

[data-mantine-color-scheme="dark"] .tool-call-summary {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

[data-mantine-color-scheme="dark"] .tool-call-summary:hover {
    background: var(--border-subtle) !important;
}

[data-mantine-color-scheme="dark"] .tool-call-args,
[data-mantine-color-scheme="dark"] .tool-call-result {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Input area */
[data-mantine-color-scheme="dark"] .chat-input {
    border-color: var(--border-subtle) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-mantine-color-scheme="dark"] .chat-input:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 2px rgba(116, 192, 252, 0.15) !important;
}

[data-mantine-color-scheme="dark"] .chat-input::placeholder {
    color: var(--text-muted);
}

[data-mantine-color-scheme="dark"] .send-btn:hover:not(:disabled) {
    background: #3b82f6 !important;
}

/* File browser */
[data-mantine-color-scheme="dark"] .file-tree-item {
    border-bottom-color: var(--border-muted);
}

[data-mantine-color-scheme="dark"] .file-tree-item:hover {
    background: var(--bg-tertiary) !important;
}

[data-mantine-color-scheme="dark"] .file-item:hover,
[data-mantine-color-scheme="dark"] .folder-header:hover {
    background: var(--bg-tertiary) !important;
}

[data-mantine-color-scheme="dark"] .breadcrumb-bar {
    background: var(--bg-tertiary);
}

[data-mantine-color-scheme="dark"] .breadcrumb-clickable:hover {
    background: var(--bg-secondary) !important;
}

/* Canvas */
[data-mantine-color-scheme="dark"] .canvas-item,
[data-mantine-color-scheme="dark"] .canvas-item-container {
    background: var(--bg-secondary);
    border-color: var(--border-subtle);
}

[data-mantine-color-scheme="dark"] .canvas-item-container:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-mantine-color-scheme="dark"] .canvas-item-header {
    background: var(--bg-tertiary);
    border-bottom-color: var(--border-muted);
}

[data-mantine-color-scheme="dark"] .canvas-delete-btn:hover {
    color: #ff8787 !important;
}

/* Data tables */
[data-mantine-color-scheme="dark"] .dataframe-table th,
[data-mantine-color-scheme="dark"] .csv-preview-table th {
    background: var(--bg-tertiary);
    border-color: var(--border-subtle);
}

[data-mantine-color-scheme="dark"] .dataframe-table td,
[data-mantine-color-scheme="dark"] .csv-preview-table td {
    border-color: var(--border-muted);
}

[data-mantine-color-scheme="dark"] .csv-preview-table tr:hover td {
    background: var(--bg-tertiary);
}

/* Display inline */
[data-mantine-color-scheme="dark"] .display-inline-container {
    background: var(--bg-secondary);
    border-color: var(--border-subtle);
}

[data-mantine-color-scheme="dark"] .display-inline-title {
    border-color: var(--border-muted);
}

[data-mantine-color-scheme="dark"] .display-inline-dataframe th {
    background: var(--bg-tertiary);
}

[data-mantine-color-scheme="dark"] .display-inline-dataframe th,
[data-mantine-color-scheme="dark"] .display-inline-dataframe td {
    border-color: var(--border-subtle);
}

[data-mantine-color-scheme="dark"] .display-inline-json,
[data-mantine-color-scheme="dark"] .display-inline-text {
    background: var(--bg-tertiary);
    border-color: var(--border-subtle);
}

/* Code blocks */
[data-mantine-color-scheme="dark"] code,
[data-mantine-color-scheme="dark"] pre {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Scrollbars */
[data-mantine-color-scheme="dark"] ::-webkit-scrollbar-thumb {
    background: #4a4d55;
}

[data-mantine-color-scheme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #5c5f66;
}

/* Resize handle */
[data-mantine-color-scheme="dark"] .resize-handle:hover {
    background: #4a4d55;
}

[data-mantine-color-scheme="dark"] .resize-handle:active {
    background: #5c5f66;
}

/* Summary hover in dark mode */
[data-mantine-color-scheme="dark"] details summary:hover {
    background: var(--bg-tertiary) !important;
}

/* Display inline collapsible styles */
.display-inline-container {
    border: 1px solid var(--mantine-color-default-border);
    background: var(--mantine-color-body);
}

.display-inline-summary {
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 10px;
    padding-left: 24px;
    border-radius: 5px;
    list-style: none;
    position: relative;
    user-select: none;
    transition: background 0.15s ease;
}

.display-inline-summary::-webkit-details-marker {
    display: none;
}

.display-inline-summary::before {
    content: "▶";
    font-size: 9px;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.15s ease;
    color: var(--mantine-color-dimmed);
}

details.display-inline-container[open] > .display-inline-summary::before {
    transform: translateY(-50%) rotate(90deg);
}

.display-inline-summary:hover {
    background: var(--mantine-color-gray-1);
}

[data-mantine-color-scheme="dark"] .display-inline-summary:hover {
    background: var(--mantine-color-dark-5);
}

.display-inline-content {
    padding: 0 10px 5px 10px;
}

.display-inline-image {
    display: block;
    margin: 0 auto;
}

/* Add to Canvas button in display inline header */
.add-to-canvas-btn {
    opacity: 0.5;
    transition: opacity 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.add-to-canvas-btn:hover {
    opacity: 1;
    color: var(--mantine-color-blue-6);
}

.display-inline-summary-row {
    padding-right: 4px;
}

.display-inline-summary-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
