/* Vessel Dashboard - Dark Grey/Green Material Design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Mobile touch polish — suppress tap highlight and remove 300ms click delay */
button, a, [role="button"],
.btn-primary, .btn-secondary, .btn-danger, .btn-icon,
.btn-upload, .nav-tab, .drawer-nav-tab,
.mobile-menu-btn, .modal-close, .nav-drawer-close {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Color Variables */
:root {
    /* Base Colors */
    --bg-primary: #121212;
    --bg-surface: #1e1e1e;
    --bg-card: #252525;
    --bg-hover: #2d2d2d;
    --bg-elevated: #2a2a2a;

    /* Green Accent */
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-dark: #059669;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-disabled: #6b6b6b;
    --text-muted: #888888;

    /* Borders */
    --border: #3d3d3d;
    --border-light: #4a4a4a;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-focus: 0 0 0 2px rgba(16,185,129,0.3);

    /* Spacing scale (4px base) — use these instead of ad-hoc px values */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* Radius scale — sm: chips/inputs, md: buttons, lg: cards/modals, pill: badges */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 999px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Accessible keyboard focus — visible ring for keyboard users only (not on
   mouse click). Applies to every interactive element; inputs keep their own
   :focus styles below. */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
button:focus-visible,
.nav-tab:focus-visible,
.drawer-nav-tab:focus-visible,
.stat-card:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}
/* Suppress the default ring for pointer interactions only. */
:focus:not(:focus-visible) {
    outline: none;
}

/* Respect the OS "reduce motion" setting: keep functional opacity/color
   transitions but drop movement and looping animations. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .btn-primary:hover,
    .btn-danger:hover,
    .stat-card:hover {
        transform: none !important;
    }
}

/* Monospace utility for code/IDs */
.mono, .mono * {
    font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', 'Consolas', monospace !important;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main Header */
.main-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo h1 {
    font-size: 1.5em;
    color: var(--primary);
    font-weight: 600;
}

.logo .version {
    font-size: 0.75em;
    color: var(--text-disabled);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: var(--radius-lg);
}

.header-clock {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    color: var(--primary-light);
    padding: 8px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-left: auto;
    margin-right: 20px;
}

/* Navigation Tabs */
.main-nav {
    display: flex;
    gap: var(--space-1);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: var(--radius-md);
    position: relative;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-tab.active {
    color: var(--primary);
    background: rgba(16,185,129,0.15);
}

.nav-icon {
    font-size: 1.1em;
}

/* Badge Styles */
.badge {
    background: var(--error);
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: var(--radius-lg);
    margin-left: 4px;
    min-width: 18px;
    text-align: center;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: var(--space-5);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    height: 100%;
    overflow: hidden;
}

.tab-content.active {
    display: block;
    height: 100%;
    overflow: hidden;
}

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

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

.tab-header h2 {
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: 600;
}

.tab-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

/* =====================
   Buttons (Material Design)
   ===================== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95em;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger, #ef4444) 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95em;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, var(--danger, #ef4444) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-elevated);
    color: var(--text-disabled);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

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

.btn-secondary.archive-completed {
    background: var(--bg-primary);
    color: var(--success);
    border-color: var(--success);
}

.btn-secondary.archive-completed:hover {
    background: rgba(16, 185, 129, 0.12);
}

.btn-secondary.archive-failed,
.btn-secondary.archive-ended {
    background: var(--bg-primary);
    color: #ef4444;
    border-color: #ef4444;
}

.btn-secondary.archive-failed:hover,
.btn-secondary.archive-ended:hover {
    background: rgba(239, 68, 68, 0.12);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 1.1em;
    transition: all 0.15s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

/* =====================
   Status Badges
   ===================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8em;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.status-badge.running, .status-badge.active {
    background: rgba(59,130,246,0.15);
    color: #3b82f6;
    position: relative;
}

.status-badge.running::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

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

.status-badge.idle {
    background: rgba(100,116,139,0.12);
    color: #64748b;
}

.status-badge.busy {
    background: rgba(59,130,246,0.15);
    color: #3b82f6;
    position: relative;
}

.status-badge.busy::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

.status-badge.pending {
    background: rgba(245,158,11,0.15);
    color: var(--warning);
}

.status-badge.stopped {
    background: rgba(239,68,68,0.15);
    color: var(--error);
}

.status-badge.awaiting-input {
    background: rgba(234,179,8,0.2);
    color: #eab308;
    position: relative;
}

.status-badge.awaiting-input::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #eab308;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

/* =====================
   Agents Grid
   ===================== */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.agent-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.agent-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.agent-header .agent-icon {
    display: inline-flex;
    width: 1.5em;
    height: 1.5em;
    margin-right: 8px;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.agent-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05em;
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.85em;
    color: var(--text-muted);
}

.agent-id {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.agent-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* =====================
   Tasks List
   ===================== */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.task-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.task-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.task-item.failed {
    opacity: 0.6;
    background: var(--bg-elevated);
}

.task-item.failed:hover {
    opacity: 0.8;
}

.task-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.task-id {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--primary);
    font-size: 0.9em;
}

.task-info {
    flex: 1;
    margin: 0 20px;
    display: flex;
    align-items: baseline;
    min-width: 0;
}

/* Schedule, Agent and Depends-on stay intact on the first line — nothing
   wraps beneath them. Only the project/name column (.task-meta) wraps. */
.task-agent {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-right: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Project + task name + Depends-on: take the remaining width and wrap within
   their own column, so continuation lines align under the text (not under
   Schedule/Agent). */
.task-meta {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Depends-on can hold a long task name — keep the pill look but allow it to
   wrap with the rest of the meta column (unlike the short Schedule pill). */
.task-depends {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-right: 8px;
    overflow-wrap: anywhere;
}

.task-description {
    color: var(--text-secondary);
}

.task-clarifications {
    margin-top: 6px;
    font-size: 0.85em;
}

.task-clarifications summary {
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}

.task-clarifications summary:hover {
    color: var(--text-secondary);
}

.task-clarifications-body {
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: pre-wrap;
    font-family: inherit;
}

.task-schedule {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-left: 8px;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.task-actions {
    display: flex;
    gap: var(--space-2);
}

/* =====================
   Mail Items
   ===================== */
.mail-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.mail-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.mail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.mail-subject {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05em;
}

.mail-meta {
    display: flex;
    gap: var(--space-4);
    font-size: 0.85em;
    color: var(--text-muted);
    align-items: center;
}

.unread-indicator {
    color: var(--primary);
    font-size: 1.2em;
    line-height: 1;
}

.mail-agent {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.mail-date {
    color: var(--text-secondary);
}

.mail-body {
    margin-bottom: 12px;
}

.mail-body .task-result {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    font-size: 0.9em;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.rendered-markdown img {
    max-width: 220px;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
    margin: 8px 0;
    cursor: zoom-in;
    border: 1px solid var(--border);
    transition: transform 0.1s ease;
}

.rendered-markdown img:hover {
    transform: scale(1.02);
}

.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: zoom-out;
    padding: var(--space-5);
}

.image-lightbox.hidden {
    display: none;
}

.image-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.rendered-markdown pre {
    background: #0f172a;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.9em;
    white-space: pre-wrap;
}

.rendered-markdown p { margin: 0.4em 0; }
.rendered-markdown p:first-child { margin-top: 0; }
.rendered-markdown p:last-child { margin-bottom: 0; }

.mail-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Warning button state */
.btn-primary.warning-state {
    background: var(--warning);
    color: var(--bg-primary);
}

.btn-primary.warning-state:hover {
    background: #d97706;
}

/* Disabled button state */
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-elevated);
    color: var(--text-disabled);
    border-color: var(--border);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-elevated);
    color: var(--text-disabled);
}

/* =====================
   SVG Icon System
   ===================== */
:root {
    --icon-color: var(--text-secondary);
    --icon-size: 1.2em;
}

.icon {
    width: var(--icon-size);
    height: var(--icon-size);
    fill: currentColor;
    vertical-align: middle;
}

.icon-menu { /* Hamburger menu */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b0'%3E%3Cpath d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z'/%3E%3C/svg%3E");
}

.icon-check { /* Checkmark */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2310b981'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

.icon-folder { /* Folder/Project */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b0'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E");
}

.icon-bolt { /* Lightning/Skills */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f59e0b'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z'/%3E%3C/svg%3E");
}

.icon-lock { /* Lock/System Tool */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b0'%3E%3Cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/%3E%3C/svg%3E");
}

.icon-globe { /* Globe/MCP Tool */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233b82f6'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z'/%3E%3C/svg%3E");
}

.icon-chat { /* Chat/Meeting */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b0'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
}

.icon-mail { /* Mail */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b0'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
}

.icon-settings { /* Settings */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b0'%3E%3Cpath d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/%3E%3C/svg%3E");
}

/* Icon replacement classes */
.nav-icon {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.nav-icon.menu {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.check {
    background-color: var(--success);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.folder {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.bolt {
    background-color: var(--warning);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.chat {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.mail {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.dashboard,
.stat-icon.dashboard {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z' fill='black'/%3E%3C/svg%3E");
}

/* Stat icon classes - same as nav icons */
.stat-icon.check {
    background-color: var(--success);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
}

.stat-icon.folder {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z' fill='black'/%3E%3C/svg%3E");
}

.stat-icon.bolt {
    background-color: var(--warning);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
}

.stat-icon.chat {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
}

.stat-icon.mail {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
}

.stat-icon.settings {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z' fill='black'/%3E%3C/svg%3E");
}

/* Close icon for failures/errors */
.nav-icon.close,
.stat-icon.close,
.activity-icon.close {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z' fill='black'/%3E%3C/svg%3E");
}

.agent-icon.person,
.nav-icon.person,
.stat-icon.person,
.agent-icon.person {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z' fill='black'/%3E%3C/svg%3E");
}

.nav-icon.settings {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z' fill='black'/%3E%3C/svg%3E");
}

/* Button icon classes */
.btn-icon.edit,
.btn-icon.delete,
.btn-icon.view,
.btn-icon.restart,
.btn-icon.copy,
.btn-icon.logs,
.btn-icon.link,
.btn-icon.download {
    display: inline-flex;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.btn-icon.edit {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.delete {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.view {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.restart {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.download {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.link {
    color: var(--primary);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.copy {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.logs {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z' fill='black'/%3E%3C/svg%3E");
}

/* Brief confirmation after a copy: tint green and swap to a check glyph */
.btn-icon.copy.copied {
    background-color: var(--success);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
}

/* Copy button on chat bubbles: tucked top-right, revealed on hover */
.message {
    position: relative;
}

.message-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0;
    color: inherit;
    transition: opacity 0.15s ease;
}

.message:hover .message-copy-btn,
.message-copy-btn.copied {
    opacity: 0.85;
}

.message-copy-btn:hover {
    opacity: 1;
}

/* Log peek modal */
.log-peek-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.log-peek-wrap #log-peek-refresh {
    align-self: flex-start;
}

#log-peek-pre {
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    line-height: 1.4;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0;
}

/* Live (public share) toggle on project cards */
.project-actions-spacer { flex: 1; }

.live-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
}

.live-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.live-switch-track {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: var(--radius-pill);
    background: var(--border);
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.live-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.live-switch input:checked + .live-switch-track {
    background: var(--primary);
}

.live-switch input:checked + .live-switch-track .live-switch-thumb {
    transform: translateX(16px);
}

.live-switch input:focus-visible + .live-switch-track {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.live-switch-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
}

.live-switch input:checked ~ .live-switch-label {
    color: var(--primary);
}

/* Globe icon — project preview/serve */
.btn-icon.serve {
    display: inline-flex;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.btn-icon.serve {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z' fill='black'/%3E%3C/svg%3E");
}


.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

    /* Warning text for modals */
    .warning-text {
        color: var(--danger, #ef4444);
        font-size: 0.9em;
        margin-top: 8px;
    }

    /* =====================
       Dashboard Grid
       ===================== */
    .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-top: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 2em;
    height: 2em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.stat-card .stat-icon {
    margin-right: 8px;
}

.stat-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 2em;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-card .stat-subtitle {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 8px;
}

.stat-card {
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
}

.dashboard-section {
    margin-top: 30px;
}

.dashboard-section h3 {
    color: var(--text-secondary);
    font-size: 1em;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Custom scrollbar for activity list */
.activity-list::-webkit-scrollbar {
    width: 6px;
}

.activity-list::-webkit-scrollbar-track {
    background: var(--bg-surface);
    border-radius: 3px;
}

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

.activity-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.activity-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.activity-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.activity-item {
    cursor: pointer;
}

.activity-tools-list {
    display: none;
    grid-column: 2 / 4;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 6px;
}

.activity-item.expanded .activity-tools-list {
    display: flex;
}

.activity-item.expanded .activity-tools-toggle {
    transform: rotate(90deg);
}

/* Expanded: un-clamp the title so the full text is readable */
.activity-item.expanded .activity-description {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.activity-tool-chip {
    font-size: 0.78rem;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    white-space: nowrap;
}

.activity-tools-toggle {
    display: inline-block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0 2px;
    line-height: 1;
    transition: transform 0.15s ease;
    vertical-align: middle;
}

.activity-icon {
    width: 1.5em;
    height: 1.5em;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* Activity icon classes - use same masks as nav icons */
.activity-icon.person {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z' fill='black'/%3E%3C/svg%3E");
}

.activity-icon.check {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
}

.activity-icon.close {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z' fill='black'/%3E%3C/svg%3E");
}

.activity-icon.chat {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
}

.activity-icon.mail {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
}

.activity-icon.bolt {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
}

/* Activity icon colors — match the badge color for each event type */
.activity-item.task-created .activity-icon    { color: #64748b; }
.activity-item.task-started .activity-icon    { color: #3b82f6; }
.activity-item.task-completed .activity-icon  { color: #10b981; }
.activity-item.task-succeeded .activity-icon  { color: #10b981; }
.activity-item.task-failed .activity-icon     { color: #ef4444; }
.activity-item.task-scheduled .activity-icon  { color: #6366f1; }
.activity-item.meeting-created .activity-icon { color: #8b5cf6; }
.activity-item.meeting-started .activity-icon { color: #a855f7; }
.activity-item.meeting-ended .activity-icon   { color: #f59e0b; }
.activity-item.agent-created .activity-icon   { color: #64748b; }
.activity-item.project-created .activity-icon { color: #64748b; }
.activity-item.tool-created .activity-icon    { color: var(--warning); }

/* Activity badge types */
.activity-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    font-size: 0.75em;
    font-weight: 500;
    margin-left: 8px;
    text-transform: capitalize;
}

.activity-badge.task-created {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

.activity-badge.task-succeeded {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.activity-badge.task-failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.activity-badge.meeting-created {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.activity-badge.meeting-ended {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.activity-badge.task-started {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.activity-badge.task-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.activity-badge.task-scheduled {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.activity-badge.meeting-started {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.activity-badge.agent-created,
.activity-badge.project-created,
.activity-badge.tool-created {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

.activity-description {
    color: var(--text-primary);
    font-size: 0.9em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.8em;
    white-space: nowrap;
}

/* Progress bar for concurrent tasks */
.progress-container {
    margin-top: 15px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Agent status indicator */
.agent-status {
    display: flex;
    gap: var(--space-4);
    margin-top: 10px;
}

.agent-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.agent-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.agent-status-dot.idle {
    background: var(--text-disabled);
}

.agent-status-dot.busy {
    background: var(--warning);
}

.agent-status-dot.in-progress {
    background: var(--success);
}

/* =====================
    Tools Grid
    ===================== */
 .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
    width: 75vw;
    max-width: 100%;
}

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.tool-card.read-only {
    opacity: 0.8;
    cursor: default;
}

.tool-card.read-only:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.tool-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

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

.tool-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.lock-icon {
    font-size: 0.8em;
    opacity: 0.7;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    margin-right: 6px;
}

.tool-badge.system {
    background-color: #4a5568;
    color: white;
}

.tool-badge.mcp {
    background-color: #3182ce;
    color: white;
}

.tool-badge-icon {
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.tool-badge.system .tool-badge-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/%3E%3C/svg%3E");
}

.tool-badge.mcp .tool-badge-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z'/%3E%3C/svg%3E");
}

.tool-name {
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-info {
    font-size: 0.8em;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.tool-actions {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

.tool-actions .btn-icon {
    padding: 6px;
    width: 36px;
    height: 36px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.tool-actions .btn-icon:hover {
    opacity: 1;
}

/* =====================
   Meetings - Split View
   ===================== */
.meetings-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 400px;
    overflow: hidden;
}

.meetings-list {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-y: auto;
    height: 100%;
    border: 1px solid var(--border);
}

.meeting-item {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: var(--bg-card);
}

.meeting-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.meeting-item.active {
    background: rgba(16,185,129,0.15);
    border-color: var(--primary);
}

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

.meeting-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.meeting-actions {
    display: flex;
    gap: var(--space-1);
}

.meeting-actions .btn-icon {
    padding: 6px;
    width: 36px;
    height: 36px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.meeting-actions .btn-icon:hover {
    opacity: 1;
}

.meeting-id {
    font-weight: 500;
    color: var(--primary);
    font-size: 0.9em;
}

.meeting-agent-count {
    font-size: 0.75em;
    color: var(--text-muted);
}

.meeting-agents {
    font-size: 0.85em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.meeting-time {
    font-size: 0.75em;
    color: var(--text-disabled);
}

.meeting-tools-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: 6px;
}

.meeting-tool-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    font-size: 0.75em;
    background: rgba(100,116,139,0.12);
    color: #64748b;
}


.meeting-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8em;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.meeting-status.active {
    background: rgba(16,185,129,0.15);
    color: var(--success);
    position: relative;
}

.meeting-status.active::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

.meeting-status.ended {
    background: rgba(100,116,139,0.15);
    color: var(--text-secondary);
}

.meeting-status.processing {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    position: relative;
}

.meeting-status.processing::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--info);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

/* Chat Area */
.meeting-chat {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    height: 100%;
    overflow: hidden;
}

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

.chat-header span {
    font-weight: 500;
    color: var(--text-primary);
}

.chat-agents {
    font-size: 0.85em;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

.chat-messages {
    height: calc(100vh - 320px);
    min-height: 300px;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.no-messages {
    text-align: center;
    color: var(--text-disabled);
    padding: 40px;
}

/* Message styling */
.message {
    max-width: 72%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    line-height: 1.4;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

.message:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message.agent {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-sender {
    font-weight: 600;
    font-size: 0.85em;
    margin-right: 8px;
    opacity: 0.9;
}

.message-time {
    font-size: 0.75em;
    color: inherit;
    opacity: 0.7;
    margin-left: 8px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
    animation: typing-pulse 2s infinite ease-in-out;
    flex-shrink: 0;
}

.typing-indicator.hidden {
    display: none;
}

.typing-dots {
    display: flex;
    gap: 6px;
}

.typing-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing-bounce 1.5s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.3s; }
.typing-dots span:nth-child(2) { animation-delay: -0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes typing-pulse {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 1;
    }
}



/* Typing indicator agent name */
.typing-agent-name {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--primary);
}

/* Typing indicator text */
.typing-text {
    font-size: 0.85em;
    color: var(--text-disabled);
    font-style: italic;
}

.chat-input-container {
    display: flex;
    padding: 16px 20px;
    gap: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    align-items: center;
}

/* Wrapper provides the stacking context for backdrop + input */
.chat-input-wrapper {
    flex: 1;
    position: relative;
}

/* Backdrop mirrors input text; only the mention-tag backgrounds are visible */
.chat-input-backdrop {
    position: absolute;
    inset: 0;
    padding: 12px 16px;
    font-size: 0.95em;
    font-family: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    color: transparent;
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    z-index: 0;
    line-height: normal;
}

.chat-input-container {
    align-items: flex-end;
}

.chat-input-container textarea {
    position: relative;
    z-index: 1;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.95em;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: none;
    overflow-y: hidden;
    line-height: 1.5;
    max-height: 160px;
    overflow-y: auto;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.chat-input-container textarea::placeholder {
    color: var(--text-disabled);
}

.chat-input-container button {
    padding: 12px 24px;
    flex-shrink: 0;
}

/* @mention pill — agent bubbles (dark bg): green text, subtle tint */
.mention-tag {
    background: rgba(16, 185, 129, 0.18);
    color: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    font-weight: 700;
    font-size: 0.92em;
}

/* User (green) bubbles: vessel-grey background so it pops against the green */
.message.user .mention-tag {
    background: var(--bg-hover);
    color: #ffffff;
}

/* Input backdrop: only backgrounds are visible (text is transparent); use the chat-bubble green */
.chat-input-backdrop .mention-tag {
    background: var(--primary);
    color: transparent;
    border-radius: var(--radius-sm);
    padding: 1px 5px;
}

/* System agent card */
.agent-card.system-agent {
    border-color: rgba(16, 185, 129, 0.3);
}

.system-agent-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.default-agent-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.agent-card.default-agent {
    border-color: rgba(245, 158, 11, 0.4);
}

/* Notetaker badge in meeting chat header */
.notetaker-badge {
    font-size: 0.72em;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2px 10px;
    white-space: nowrap;
}

.notetaker-badge.hidden {
    display: none;
}

/* =====================
   Settings
   ===================== */
.settings-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

/* Each column stacks its sections with a consistent gap, independent of the
   other column's height (so the short left column doesn't get stretched). */
.settings-column {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.settings-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.settings-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.llm-provider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.llm-provider:last-child {
    border-bottom: none;
}

.provider-name {
    font-weight: 500;
    color: var(--text-secondary);
}

.provider-status {
    color: var(--success);
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.provider-status::before {
    content: '●';
    font-size: 0.7em;
}

.env-item {
    margin-bottom: 18px;
}

.env-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: 500;
}

.env-item input {
    width: 100%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.env-item input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.env-note {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-bottom: 16px;
    line-height: 1.5;
}

.env-note code {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

.env-secrets-heading {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 600;
    margin: 20px 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.env-secret {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.env-secret label {
    margin-bottom: 0;
    flex: 1;
}

.env-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.8em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    border: 1px solid var(--border);
}

.env-badge-set {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.4);
    color: rgb(74, 222, 128);
}

.env-badge-empty {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.env-badge-inherited {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.4);
    color: rgb(250, 204, 21);
    cursor: help;
}

/* =====================
   Task creation — card-based type picker, collapsed tools
   ===================== */

.task-type-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-bottom: 4px;
}
@media (max-width: 720px) {
    .task-type-cards { grid-template-columns: repeat(2, 1fr); }
    .task-type-cards-3 .task-type-card:nth-child(3) { grid-column: 1 / -1; }
}

.task-type-card {
    background: var(--bg-2, #0d1117);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.05s;
    color: var(--text);
    text-align: center;
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    position: relative;
}
.task-type-card:hover {
    background: var(--bg-hover, #1c2128);
    border-color: rgba(16, 185, 129, 0.4);
}
.task-type-card.selected {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3) inset;
}
.task-type-card.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 8px;
    color: #10b981;
    font-size: 12px;
    font-weight: 700;
}
.task-type-icon {
    font-size: 22px;
    line-height: 1;
}
.task-type-name {
    font-weight: 600;
    font-size: 13px;
}
.task-type-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Tools collapsed/expanded */
.tools-collapsed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px 12px;
    background: var(--bg-2, #0d1117);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.tools-summary {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tools-edit-btn {
    flex-shrink: 0;
    padding: 4px 12px;
    font-size: 12px;
}
.tools-expanded {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: var(--bg-2, #0d1117);
}
.tools-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
}
.tools-search:focus {
    outline: none;
    border-color: #10b981;
}
.tool-group + .tool-group { margin-top: 14px; }
.tool-group-title {
    margin: 0 0 6px 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.tool-group-count {
    font-size: 11px;
    background: var(--bg-hover, #1c2128);
    border-radius: var(--radius-lg);
    padding: 1px 7px;
    margin-left: 4px;
    color: var(--text-muted);
}
.tool-entry {
    cursor: pointer;
}
.tools-expanded-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Clarification hint */
.clarification-hint {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-left: 2px solid rgba(99, 102, 241, 0.5);
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

/* Info tooltip in labels */
.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-hover, #1c2128);
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 6px;
    cursor: help;
    border: 1px solid var(--border);
}
.info-tooltip:hover {
    color: var(--text);
    border-color: rgba(16, 185, 129, 0.4);
}

/* =====================
   Agent creation — grouped form + live preview
   ===================== */
.agent-create-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 18px;
    align-items: start;
}
@media (max-width: 720px) {
    .agent-create-layout { grid-template-columns: 1fr; }
}
.agent-form-pane { min-width: 0; }

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px 6px;
    margin: 0 0 14px 0;
    background: var(--bg-2, #0d1117);
}
.form-section legend {
    padding: 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}
.form-group-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
@media (max-width: 480px) {
    .form-group-inline { grid-template-columns: 1fr; }
}

/* Auto-ID display under Role */
.auto-id-display {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.auto-id-display code {
    color: var(--text);
    background: var(--bg-hover, #1c2128);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}
.auto-id-change {
    background: none;
    border: none;
    color: #10b981;
    cursor: pointer;
    font-size: 12px;
    padding: 0 0 0 6px;
    text-decoration: underline;
}
.auto-id-change:hover { color: #34d399; }

/* Backstory guidance */
.backstory-guidance {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.backstory-guidance em {
    color: var(--text);
    font-style: italic;
    background: var(--bg-hover, #1c2128);
    padding: 1px 5px;
    border-radius: 3px;
    margin: 0 1px;
}

/* Live preview card */
.agent-preview-pane {
    position: sticky;
    top: 0;
}
.agent-preview-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.agent-preview-card {
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: border-color 0.2s;
}
.agent-preview-card:has(.agent-preview-card-role:not(:empty)) {
    border-color: rgba(16, 185, 129, 0.3);
}
.agent-preview-card-role {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}
.agent-preview-card-id {
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    color: var(--text-muted);
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}
.agent-preview-card-model {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}
.agent-preview-card-goal {
    font-size: 12px;
    color: var(--text);
    line-height: 1.5;
    font-style: italic;
}

/* =====================
   Chained tasks — multi-step builder in the New Task modal
   ===================== */
#chain-steps:not(:empty) {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.chain-step {
    border: 1px solid var(--border);
    border-left: 3px solid #10b981;
    border-radius: var(--radius-md);
    padding: 14px 16px 6px;
    background: var(--bg-2, #0d1117);
    position: relative;
}

.chain-step-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}

.chain-step-num {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}

.chain-step-type-tag {
    background: rgba(99, 102, 241, 0.12);
    color: rgb(165, 180, 252);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.chain-step-remove {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.chain-step-remove:hover {
    color: #ef4444;
    border-color: #ef4444;
}

.chain-step-tools {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: 6px 0;
}

.chain-step-cof {
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
}

.chain-add-btn {
    margin-top: 14px;
    width: 100%;
    padding: var(--space-3);
    background: transparent;
    border: 1.5px dashed var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chain-add-btn:hover {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.04);
}
.chain-add-icon {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    margin-right: 4px;
    vertical-align: -2px;
}

.chain-helper-text {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 6px 0 0 0;
    text-align: center;
    font-style: italic;
}

/* Tasks list — chained task marker (legacy, for non-chain-card contexts) */
.task-chain-marker {
    display: inline-block;
    color: var(--text-muted);
    font-size: 11px;
    margin-right: 4px;
    cursor: help;
}

/* =====================
   Tasks tab — chain card (collapsed multi-step chain)
   ===================== */
.chain-card {
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border);
    border-left: 3px solid #10b981;
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.chain-card.status-failed { border-left-color: #ef4444; }
.chain-card.status-running { border-left-color: #3b82f6; }
.chain-card.status-awaiting-input { border-left-color: #f59e0b; }
.chain-card.status-pending { border-left-color: #6b7280; }

.chain-card-header {
    display: grid;
    /* icon | headline-wrap | steps-badge | status-badge | toggle | actions */
    grid-template-columns: auto 1fr auto auto auto auto;
    gap: var(--space-3);
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

/* Recreate + delete grouped as one cell so they stay together (like
   .task-actions on standalone tasks) instead of being split by the
   flexible column when the header wraps on narrow screens. */
.chain-card-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: flex-end;
}
.chain-card-header:hover {
    background: var(--bg-hover, #1c2128);
}

.chain-card-icon {
    font-size: 20px;
    line-height: 1;
}

.chain-card-headline-wrap {
    min-width: 0;
}

.chain-card-headline {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chain-card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chain-card-steps-badge {
    background: var(--bg-hover, #1c2128);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-lg);
    white-space: nowrap;
}

.chain-card-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.chain-card-toggle:hover {
    color: var(--text);
    background: var(--bg-2, #0d1117);
}

.chain-card-body {
    border-top: 1px dashed var(--border);
    background: var(--bg-2, #0d1117);
    padding: 8px 16px;
}

.chain-card-step {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    gap: var(--space-3);
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.chain-card-step:last-child { border-bottom: none; }

.chain-card-step-num {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.chain-card-step-agent {
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
}

.chain-card-step-title {
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chain-card-step-actions {
    display: flex;
    gap: var(--space-1);
}

@media (max-width: 720px) {
    .chain-card-header {
        grid-template-columns: auto 1fr auto;
    }
    .chain-card-steps-badge,
    .chain-card-subtitle { display: none; }
    /* Keep the action icons grouped in the bottom-right corner, mirroring
       standalone task cards, rather than spread across the wrapped header. */
    .chain-card-actions {
        grid-column: 2 / -1;
    }
    .chain-card-step {
        grid-template-columns: 1fr auto;
        gap: 6px;
    }
    .chain-card-step-num,
    .chain-card-step-agent,
    .chain-card-step-title { grid-column: 1 / -1; }
}

/* API Keys & MCP — editable Settings rows, laid out as a clean aligned table.
   The 1fr input track absorbs the slack so the action buttons + status badge
   line up in a tidy right-hand column across every row. */
.api-key-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) auto auto auto auto;
    gap: var(--space-3);
    align-items: center;
    padding: 12px var(--space-3);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}
.api-key-row:last-child { border-bottom: none; }
.api-key-row:hover { background: var(--bg-hover); }
.api-key-row .provider-name {
    font-weight: 500;
    color: var(--text);
}
.api-key-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-2, #0d1117);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    min-width: 0;
}
.api-key-input:focus {
    outline: none;
    border-color: #10b981;
}
/* Compact, consistent action buttons within a settings row */
.api-key-row .btn-secondary {
    padding: 6px 14px;
    font-size: 13px;
    white-space: nowrap;
}
.api-key-status {
    white-space: nowrap;
    justify-self: end;
}
/* The save/test result message drops onto its own full-width line and only
   takes up space when it actually has something to report. */
.api-key-result {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.api-key-result:empty { display: none; }
.muted { color: var(--text-muted); font-size: 12px; }

@media (max-width: 720px) {
    .api-key-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .api-key-row .provider-name { grid-column: 1 / -1; }
    .api-key-input { grid-column: 1 / -1; }
    .api-key-result { grid-column: 1 / -1; }
}

/* =====================
   Modal
   ===================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 75vw;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    width: 75vw;
    max-width: 1200px;
}

.summary-section {
    margin-bottom: 24px;
}

.summary-content img {
    max-width: 220px;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.summary-content img:hover {
    transform: scale(1.02);
}

.summary-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 0.95em;
}

.summary-content {
    background: var(--bg-elevated);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

.tasks-section {
    margin-bottom: 16px;
}

.tasks-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 0.95em;
}

.task-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.task-suggestion-item {
    background: var(--bg-elevated);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.task-suggestion-checkbox {
    /* Remove default appearance */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    /* Dimensions */
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    
    /* Border & Background */
    border: 2px solid var(--border-color, #4a5568);
    border-radius: var(--radius-sm);
    background-color: var(--bg-card, #1a202c);
    cursor: pointer;
    
    /* Transition */
    transition: all 0.2s ease;
    
    /* Positioning */
    margin-top: 4px;
    flex-shrink: 0;
}

.task-suggestion-checkbox:hover {
    border-color: var(--primary-light, #48bb78);
    background-color: var(--bg-elevated, #2d3748);
}

.task-suggestion-checkbox:checked {
    background-color: var(--primary, #38a169);
    border-color: var(--primary, #38a169);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

.task-suggestion-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-dark, #2f855a);
}

.task-suggestion-content {
    flex: 1;
}

.task-suggestion-description {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Markdown styling for task descriptions */
.task-suggestion-description code {
    background: var(--bg-elevated);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.9em;
}

.task-suggestion-description strong {
    font-weight: 600;
}

.task-suggestion-description em {
    font-style: italic;
}

.task-suggestion-description a {
    color: var(--primary);
    text-decoration: none;
}

.task-suggestion-description a:hover {
    text-decoration: underline;
}

.task-suggestion-meta {
    display: flex;
    gap: var(--space-3);
    font-size: 0.85em;
    color: var(--text-secondary);
}

.task-suggestion-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6em;
    cursor: pointer;
    padding: var(--space-2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
    max-width: 100%;
    box-sizing: border-box;
}

.modal-body pre,
.modal-body code {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* =====================
   Markdown Styling
   ===================== */
.message-text code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.9em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-text pre {
    background: var(--bg-elevated);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 8px 0;
    max-width: 100%;
}

.message-text pre code {
    background: none;
    padding: 0;
    overflow-wrap: normal;
    word-break: normal;
    white-space: pre;
}

.message-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-text em {
    font-style: italic;
}

.message-text a {
    color: var(--primary);
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.message-text ul, .message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin: 4px 0;
}

.message-text blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.message-text h1, .message-text h2, .message-text h3 {
    margin: 12px 0 8px 0;
    color: var(--text-primary);
}

.message-text h1 {
    font-size: 1.4em;
}

.message-text h2 {
    font-size: 1.3em;
}

.message-text h3 {
    font-size: 1.2em;
}

/* =====================
   Form Styles
   ===================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    line-height: 1.5;
}

/* Code Editor Container */
.code-editor-container {
    position: relative;
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    overflow: hidden;
}

.code-editor-line-numbers {
    width: 40px;
    background: var(--bg-card);
    color: var(--text-disabled);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    padding: 12px 8px;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.code-editor-container textarea {
    flex: 1;
    background: var(--bg-hover);
    border: none;
    border-radius: 0;
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    resize: none;
    white-space: pre;
    overflow: auto;
    tab-size: 4;
    caret-color: var(--primary);
}

.code-editor-container textarea:focus {
    outline: none;
    box-shadow: none;
}

/* Syntax highlight overlay - only shown in read-only mode */
.code-editor-container.read-only textarea {
    background: var(--bg-card);
    color: transparent; /* Hide textarea text in read-only mode */
    caret-color: transparent; /* Hide cursor in read-only mode */
}

.code-editor-container.read-only .syntax-highlight {
    display: block;
}

.code-editor-container:not(.read-only) .syntax-highlight {
    display: none;
}

.syntax-highlight {
    position: absolute;
    top: 0;
    left: 40px;
    right: 0;
    bottom: 0;
    padding: 12px 14px;
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-primary); /* Base color for unhighlighted text */
    pointer-events: none;
    white-space: pre;
    overflow: hidden;
    tab-size: 4;
}

/* Python Syntax Colors */
.syntax-highlight .keyword { color: #ff79c6; }
.syntax-highlight .function { color: #50fa7b; }
.syntax-highlight .string { color: #f1fa8c; }
.syntax-highlight .comment { color: #6272a4; font-style: italic; }
.syntax-highlight .class-name { color: #8be9fd; }
.syntax-highlight .decorator { color: #ffb86c; }
.syntax-highlight .number { color: #bd93f9; }
.syntax-highlight .operator { color: #ff79c6; }
.syntax-highlight .builtin { color: #8be9fd; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 0;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    border-radius: var(--radius-lg);
    background: var(--border);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--primary);
}

.checkbox-label input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.checkbox-label input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

.agent-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* =====================
   Empty State
   ===================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-disabled);
    padding: 64px 24px;
    grid-column: 1 / -1;
    font-size: 0.95em;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    background-color: var(--text-disabled);
    opacity: 0.55;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.empty-state-icon.menu {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z' fill='black'/%3E%3C/svg%3E");
}
.empty-state-icon.check {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='black'/%3E%3C/svg%3E");
}
.empty-state-icon.folder {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z' fill='black'/%3E%3C/svg%3E");
}
.empty-state-icon.bolt {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21z' fill='black'/%3E%3C/svg%3E");
}
.empty-state-icon.chat {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z' fill='black'/%3E%3C/svg%3E");
}
.empty-state-icon.mail {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z' fill='black'/%3E%3C/svg%3E");
}

.empty-state-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state-text {
    max-width: 340px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.empty-state .btn-primary {
    text-decoration: none;
    display: inline-block;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* =====================
   Mobile Menu Button
   ===================== */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-3);
    width: 44px;
    height: 44px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}
.mobile-menu-btn:hover {
    background: var(--bg-hover);
}
.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: background 0.15s ease;
}
.mobile-menu-btn:hover span {
    background: var(--text-primary);
}

/* =====================
   Nav Drawer
   ===================== */
.nav-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.nav-drawer-overlay.open {
    opacity: 1;
}

.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
}
.nav-drawer.open {
    transform: translateX(0);
}

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

.nav-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5em;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}
.nav-drawer-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
}

.drawer-nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.95em;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
}
.drawer-nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.drawer-nav-tab.active {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.15);
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 1350px) and (min-width: 1025px) {
    .nav-tab {
        padding: 12px 10px;
        font-size: 0.88em;
        gap: 5px;
    }
}

@media (max-width: 1024px) {
    .meetings-container {
        grid-template-columns: 280px 1fr;
    }

    /* Hide desktop nav, show hamburger + drawer */
    .main-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-drawer-overlay {
        display: block;
        pointer-events: none;
    }
    .nav-drawer-overlay.open {
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    /* iOS Safari auto-zooms any input with a computed font-size below 16px.
       Pin form elements to 16px on mobile to suppress that without disabling
       pinch-zoom via viewport meta. */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .header-content {
        height: 56px;
        padding: 0 12px;
    }

    .meetings-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .settings-content {
        grid-template-columns: 1fr;
    }

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

    .modal {
        width: 95vw;
        max-height: 92vh;
    }

    .modal-large {
        width: 95vw;
        max-height: 92vh;
    }

    .header-clock {
        margin-right: 8px;
        padding: 6px 10px;
    }

    .logo h1 {
        font-size: 1.2em;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 14px 16px;
    }

    .modal-footer {
        padding: 14px 16px;
        flex-wrap: wrap;
    }

    /* Task detail table: switch to block/stacked layout */
    .modal-body table {
        display: block;
    }
    .modal-body table tbody,
    .modal-body table tr {
        display: block;
    }
    .modal-body table tr {
        margin-bottom: 6px;
    }
    .modal-body table td {
        display: block;
        width: 100% !important;
        white-space: normal !important;
        padding: 1px 0 !important;
    }
    .modal-body table td:first-child {
        font-size: 0.78rem;
        padding-bottom: 0 !important;
    }

    /* Main content padding */
    .main-content {
        padding: var(--space-3);
    }

    /* Task items: stack vertically */
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
        padding: 12px 14px;
    }

    .task-header {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .task-info {
        margin: 0;
        width: 100%;
        /* Stack each piece on its own line on narrow screens — a row with
           nowrap Schedule/Agent would overflow sideways instead of wrapping. */
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
    }

    .task-info .task-meta {
        width: 100%;
    }

    .task-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    /* Dashboard stat cards: 2-column grid */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--space-2);
    }

    .main-header {
        padding: 0 8px;
    }

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
        margin-bottom: 16px;
    }

    .tab-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .modal {
        width: 100vw;
        max-height: 95vh;
        border-radius: var(--radius-md) 8px 0 0;
    }

    .modal-large {
        width: 100vw;
        max-height: 95vh;
        border-radius: var(--radius-md) 8px 0 0;
    }

    .logo .version {
        display: none;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: var(--space-2);
    }

    .modal-footer .btn-primary,
    .modal-footer .btn-secondary,
    .modal-footer .btn-danger {
        width: 100%;
        justify-content: center;
    }

    .summary-content {
        max-height: 120px;
    }

    .task-suggestions-list {
        max-height: 200px;
        overflow-y: auto;
    }

    .modal-overlay {
        align-items: flex-end;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        padding: var(--space-3);
    }

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

    .task-id {
        font-size: 0.75em;
    }

    .main-nav .nav-tab {
        font-size: 0.8em;
        padding: 6px 10px;
    }

    .chat-input-container {
        padding: 10px 12px;
        gap: var(--space-2);
    }

    .chat-input-container input {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .chat-input-container button {
        padding: 10px 14px;
    }

    .chat-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .chat-messages {
        padding: var(--space-4);
    }

    .message {
        max-width: 88%;
    }
}

/* =====================
   Projects
   ===================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all 0.2s ease;
}

.project-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

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

.project-name {
    font-weight: 600;
    color: var(--text-primary);
}

.project-id {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.project-info {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.project-description {
    display: block;
    margin-bottom: 8px;
}

.project-path {
    font-family: var(--mono-font);
    font-size: 0.8em;
}

.project-paths {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: 8px;
}

.project-host-path,
.project-container-path {
    font-family: var(--mono-font);
    font-size: 0.75em;
    color: var(--text-secondary);
    display: block;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.project-host-path {
    color: var(--primary);
}

.project-container-path {
    color: var(--text-tertiary);
}

.project-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    justify-content: flex-end;
}

.project-files {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.project-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.project-files-label {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-upload {
    font-size: 0.78em;
    padding: 3px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--primary);
    cursor: pointer;
    transition: background 0.15s;
}

.btn-upload:hover {
    background: var(--bg-card);
}

.project-files-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    max-height: 160px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.project-file-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    font-size: 0.82em;
}

.project-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: monospace;
}

.project-file-size {
    color: var(--text-disabled);
    white-space: nowrap;
    flex-shrink: 0;
}

.project-file-delete {
    background: none;
    border: none;
    color: var(--text-disabled);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.85em;
    flex-shrink: 0;
    line-height: 1.4;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-file-delete:hover {
    color: var(--danger);
}

.files-empty, .files-loading {
    font-size: 0.82em;
    color: var(--text-disabled);
    font-style: italic;
    padding: 2px 0;
}

.files-toggle-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.78em;
    cursor: pointer;
    padding: 8px 0;
    text-align: left;
    min-height: 36px;
}

.files-toggle-btn:hover {
    text-decoration: underline;
}

/* =====================
   Task Sections
   ===================== */
.task-section {
    margin-bottom: 24px;
}

.task-section-header {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.task-subsection {
    margin-bottom: 16px;
}

.task-subsection-header {
    font-size: 0.95em;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-left: 12px;
}

.task-type-badge {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    margin-left: 8px;
}

.task-project {
    color: var(--primary);
    margin-left: 12px;
}

/* Pending Approval Section Styling */
.task-section.pending-approval-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: 24px;
}

.task-section.pending-approval-section .task-section-header {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.task-item.pending-approval {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-left: 3px solid var(--primary);
}

/* Action Button Styles */
.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Approve Button (Play Icon) */
.btn-icon.approve-task-btn.approve {
    color: var(--success);
    display: inline-flex;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.approve-task-btn.approve:hover {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

/* Reject Button (Delete/Trash Icon) */
.btn-icon.reject-task-btn.reject {
    color: var(--error);
    display: inline-flex;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z' fill='black'/%3E%3C/svg%3E");
}

.btn-icon.reject-task-btn.reject:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* =====================
   Notifications / Alerts
   ===================== */
.notification-container {
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-3);
    max-width: 400px;
}

.notification {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    min-width: 300px;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

.notification.info {
    border-left: 4px solid var(--info);
}

.notification-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.notification.success .notification-icon {
    color: var(--success);
}

.notification.error .notification-icon {
    color: var(--error);
}

.notification.warning .notification-icon {
    color: var(--warning);
}

.notification.info .notification-icon {
    color: var(--info);
}

.notification-content {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.95em;
    line-height: 1.4;
}

.notification-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.notification-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

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

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

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-large {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-text {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Processing Status */
.status-badge.processing {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    position: relative;
}

.status-badge.processing::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--info);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}
