/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide scrollbars globally while keeping scroll functionality */
* {
    -ms-overflow-style: none;  /* IE/Edge */
    scrollbar-width: none;     /* Firefox */
}
*::-webkit-scrollbar {
    display: none;             /* Chrome, Safari, Opera */
}

:root {
    --black: #0a0a0a;
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #ca8a04;
    --bg: var(--gray-50);
    --bg-card: var(--white);
    --surface: var(--white);
    --border: var(--black);
    --border-light: var(--gray-200);
    --text: var(--black);
    --text-muted: var(--gray-500);

    /* Status colors */
    --status-unassigned-bg: #f3f4f6;
    --status-unassigned-text: #6b7280;
    --status-unassigned-border: #9ca3af;
    --status-pending-bg: #e5e7eb;
    --status-pending-text: #4b5563;
    --status-pending-border: #9ca3af;
    --status-ongoing-bg: #dbeafe;
    --status-ongoing-text: #1e40af;
    --status-ongoing-border: #60a5fa;
    --status-on-hold-bg: #fef3c7;
    --status-on-hold-text: #92400e;
    --status-on-hold-border: #f59e0b;
    --status-completed-bg: #d1fae5;
    --status-completed-text: #065f46;
    --status-completed-border: #34d399;
    --status-manager-bg: #ede9fe;
    --status-manager-text: #5b21b6;
    --status-manager-border: #8b5cf6;
    --status-client-bg: #fef3e2;
    --status-client-text: #9a3412;
    --status-client-border: #f97316;
    --font-sans: "Roboto Slab", "Georgia", serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Consolas", monospace;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    text-decoration: none;
}

::selection {
    background: var(--black);
    color: var(--white);
}

/* === Layout === */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

main.container {
    padding-bottom: 80px;
}

/* === Navbar === */
.navbar {
    background: var(--black);
    color: var(--white);
    padding: 0;
    margin-bottom: 48px;
    border-bottom: none;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.nav-brand:hover {
    text-decoration: none;
    color: var(--white);
    opacity: 0.7;
}

.navbar-inner {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    height: 100%;
}

.nav-actions form {
    display: flex;
    align-items: center;
    height: 100%;
}

/* === Navbar Section Tabs === */
.nav-section-tabs {
    display: flex;
    align-items: stretch;
    position: relative;
    margin-left: 32px;
    flex: 1;
    max-width: 600px;
}

.nav-section-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
    height: 100%;
    min-height: 48px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
    z-index: 1;
}

.nav-section-btn:hover {
    color: var(--gray-300);
}

.nav-beta-tag {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-500);
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 1px 4px;
    line-height: 1.4;
    opacity: 0.7;
}

.nav-section-btn.active .nav-beta-tag,
.nav-section-btn:hover .nav-beta-tag {
    color: inherit;
}

.nav-section-btn.active {
    color: var(--white);
    border-bottom-color: var(--white);
}

.nav-section-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--white);
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2;
}

/* === App Sections === */
.app-section {
    display: block;
}

.nav-section-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.nav-section-link:hover {
    text-decoration: none;
    color: var(--gray-300);
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.1s;
    line-height: 1;
    vertical-align: middle;
}

.nav-link:hover {
    color: var(--white);
    text-decoration: none;
}

.nav-user {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.nav-logout {
    color: var(--gray-500);
}

.nav-logout:hover {
    color: var(--danger);
}

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 3px solid var(--black);
    padding: 40px 32px;
    box-shadow: 8px 8px 0 var(--black);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
}

.login-error {
    background: color-mix(in srgb, var(--danger) 10%, var(--white));
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-family: var(--font-mono);
}

/* === Filter Tabs === */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--black);
    padding-bottom: 0;
}

.filter-tab {
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: none;
    border: 2px solid transparent;
    border-bottom: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 0;
    transition: color 0.15s, background 0.15s;
    margin-bottom: -2px;
}

.filter-tab:hover {
    color: var(--black);
    background: var(--surface);
}

.filter-tab.active {
    color: var(--black);
    background: var(--bg);
    border-color: var(--black);
    border-bottom-color: var(--bg);
}

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--black);
}

.page-header h1 {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-transform: uppercase;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 0.9rem;
}

/* === Breadcrumb === */
.breadcrumb {
    margin-bottom: 20px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.breadcrumb a {
    color: var(--text-muted);
    border-bottom: 1px solid var(--gray-300);
    padding-bottom: 1px;
}

.breadcrumb a:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--white);
    color: var(--text);
    transition: all 0.1s ease;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn:hover {
    background: var(--black);
    color: var(--white);
}

.btn-primary {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

.btn-primary:hover {
    background: var(--white);
    color: var(--black);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    border-color: var(--black);
    background: var(--black);
    color: var(--white);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.7rem;
    border-width: 1.5px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.65rem;
    border-width: 1px;
}

/* === Cards === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0;
}

.card {
    background: var(--surface);
    border: 2px solid var(--black);
    border-radius: 0;
    box-shadow: none;
    transition: transform 0.1s ease;
    margin: -1px;
}

.card:hover {
    box-shadow: none;
    position: relative;
    z-index: 1;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
}

.card-body {
    padding: 24px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.card-clickable {
    cursor: pointer;
}

.card-title a {
    color: var(--text);
}

.card-title a:hover {
    text-decoration: none;
    border-bottom: 2px solid var(--black);
}

.card-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Markdown content on project page */
.project-desc-md {
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.project-desc-md p { margin: 0 0 6px; }
.project-desc-md p:last-child { margin-bottom: 0; }
.project-desc-md strong { font-weight: 700; color: var(--text); }
.project-desc-md em { font-style: italic; }
.project-desc-md code {
    font-family: var(--font-mono);
    font-size: 0.8em;
    background: var(--gray-100);
    padding: 1px 5px;
    border: 1px solid var(--gray-200);
}
.project-desc-md ul, .project-desc-md ol {
    margin: 4px 0 6px 1.2rem;
    padding: 0;
}
.project-desc-md li { margin-bottom: 2px; }

.card-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card-actions {
    padding: 14px 24px;
    border-top: 2px solid var(--black);
    display: flex;
    gap: 8px;
}

/* === Tasks === */
.task-grid {
    display: grid;
    gap: 0;
}

.task-card {
    background: var(--surface);
    border: 2px solid var(--black);
    border-radius: 0;
    padding: 20px 24px;
    box-shadow: none;
    margin-top: -2px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.task-card:first-child {
    margin-top: 0;
}

.task-card[data-status="unassigned"] {
    border-left: 4px solid var(--status-unassigned-border);
    background: color-mix(in srgb, var(--status-unassigned-bg) 20%, var(--surface));
}

.task-card[data-status="pending"] {
    border-left: 4px solid var(--status-pending-border);
    background: color-mix(in srgb, var(--status-pending-bg) 20%, var(--surface));
}

.task-card[data-status="ongoing"] {
    border-left: 4px solid var(--status-ongoing-border);
    background: color-mix(in srgb, var(--status-ongoing-bg) 20%, var(--surface));
}

.task-card[data-status="on_hold"] {
    border-left: 4px solid var(--status-on-hold-border);
    background: color-mix(in srgb, var(--status-on-hold-bg) 20%, var(--surface));
}

.task-card[data-status="completed"] {
    border-left: 4px solid var(--status-completed-border);
    background: color-mix(in srgb, var(--status-completed-bg) 20%, var(--surface));
}

.task-card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-assignee-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
}

.kanban-card-assignee {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    display: inline-block;
    margin-bottom: 4px;
}

.task-card-clickable {
    cursor: pointer;
}

.task-card:hover {
    position: relative;
    z-index: 1;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
}

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

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

.task-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.task-title a {
    color: var(--text);
}

.task-title a:hover {
    border-bottom: 2px solid var(--black);
    text-decoration: none;
}

.task-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.task-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.task-status-actions {
    display: flex;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-200);
}

.task-filters-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

/* === Filter Row Right Side === */
.task-filters-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* === View Toggle === */
.view-toggle {
    display: flex;
    border: 2px solid var(--black);
    flex-shrink: 0;
}

.view-toggle-opt {
    background: var(--surface);
    border: none;
    border-left: 2px solid var(--black);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text);
}

.view-toggle-opt:first-child {
    border-left: none;
}

.view-toggle-opt.active {
    background: var(--black);
    color: var(--white);
}

.view-toggle-opt:hover:not(.active) {
    background: var(--gray-100);
}

/* === Bulk Action Bar === */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface);
    border: 2px solid var(--black);
    margin-bottom: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.bulk-selected-names {
    flex: 1;
    min-width: 0;
    font-size: 0.72rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.bulk-selected-names strong {
    font-weight: 700;
    color: var(--text);
}

.bulk-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-300);
    flex-shrink: 0;
}

.bulk-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border: 2px solid var(--black);
    background: var(--surface);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    color: var(--text);
}

.bulk-icon-btn:hover {
    background: var(--gray-100);
}

.bulk-icon-btn.active {
    background: var(--black);
    color: var(--white);
}

.bulk-icon-btn-primary {
    background: var(--black);
    color: var(--white);
}

.bulk-icon-btn-primary:hover {
    opacity: 0.85;
}

.bulk-icon-btn-danger {
    color: #e53e3e;
    border-color: #e53e3e;
}

.bulk-icon-btn-danger:hover {
    background: #e53e3e;
    color: var(--white);
}

.bulk-select,
.bulk-date-input {
    padding: 5px 8px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
}

.bulk-select:focus,
.bulk-date-input:focus {
    outline: none;
    box-shadow: 3px 3px 0 var(--black);
}

/* === Task Select Checkbox === */
.task-select-cb {
    display: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--black);
}

.task-grid.select-mode .task-select-cb {
    display: block;
}

.task-grid.select-mode .task-card.task-selected {
    outline: 2px solid var(--black);
    outline-offset: -2px;
    box-shadow: 3px 3px 0 var(--black);
}

/* === Task List View === */
.task-grid.list-view .task-card {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    min-height: 0;
}

.task-grid.list-view .task-card:hover {
    transform: translate(-2px, 0);
    box-shadow: 4px 0 0 var(--black);
}

.task-grid.list-view .task-select-cb {
    order: 0;
}

.task-grid.list-view .task-card-header {
    display: contents;
}

.task-grid.list-view .task-card-header-left {
    order: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.task-grid.list-view .task-title {
    order: 2;
    flex: 1;
    margin-bottom: 0;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.task-grid.list-view .task-meta {
    order: 3;
    margin-bottom: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.task-grid.list-view .task-meta-created {
    display: none;
}

.task-grid.list-view .task-card-actions {
    order: 4;
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.task-grid.list-view .task-description,
.task-grid.list-view .task-status-actions,
.task-grid.list-view .task-card-files {
    display: none !important;
}

.task-filters {
    display: flex;
    gap: 0;
}

.filter-btn {
    background: var(--surface);
    border: 2px solid var(--black);
    margin-left: -2px;
    border-radius: 0;
}

.filter-btn:first-child {
    margin-left: 0;
}

.filter-btn.active {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
    position: relative;
    z-index: 1;
}

.filter-btn:hover {
    background: var(--black);
    color: var(--white);
    position: relative;
    z-index: 1;
}

/* === Status Badges === */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1.5px solid;
}

.status-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending-text);
    border-color: var(--status-pending-border);
}

.status-ongoing {
    background: var(--status-ongoing-bg);
    color: var(--status-ongoing-text);
    border-color: var(--status-ongoing-border);
}

.status-on_hold {
    background: var(--status-on-hold-bg);
    color: var(--status-on-hold-text);
    border-color: var(--status-on-hold-border);
}

.status-completed {
    background: var(--status-completed-bg);
    color: var(--status-completed-text);
    border-color: var(--status-completed-border);
}

.status-unassigned {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #9ca3af;
}

.status-manager {
    background: var(--status-manager-bg);
    color: var(--status-manager-text);
    border-color: var(--status-manager-border);
}

.status-client {
    background: var(--status-client-bg);
    color: var(--status-client-text);
    border-color: var(--status-client-border);
}

.team-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    min-height: 32px;
}

.team-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--status-manager-bg);
    border: 1.5px solid var(--status-manager-border);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--status-manager-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.team-chip-remove {
    background: none;
    border: none;
    color: var(--status-manager-text);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    font-weight: 700;
    opacity: 0.6;
}

.team-chip-remove:hover {
    opacity: 1;
}

.team-search-dropdown {
    border: 2px solid var(--black);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.team-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.1s;
}

.team-search-item:last-child {
    border-bottom: none;
}

.team-search-item:hover {
    background: var(--gray-100);
}

.team-search-item.selected {
    background: var(--status-manager-bg);
}

.team-search-item-check {
    font-weight: 700;
    color: var(--status-manager-text);
}

/* === Task Detail === */
.task-detail-description {
    background: var(--surface);
    border: 2px solid var(--black);
    border-radius: 0;
    padding: 20px 24px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.task-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 40px;
    border: 2px solid var(--black);
}

.task-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 2px solid var(--black);
}

.task-meta-row:last-child {
    border-bottom: none;
}

.task-meta-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 20px;
    border-right: 2px solid var(--black);
    min-width: 0;
}

.task-meta-item:last-child {
    border-right: none;
}

.task-meta-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.task-meta-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.task-meta-empty {
    color: var(--text-muted);
    font-weight: 400;
}

/* === Sections === */
.section {
    margin-bottom: 48px;
}

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

.section-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* === Image Gallery === */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0;
}

.image-card {
    background: var(--surface);
    border: 2px solid var(--black);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    margin: -1px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.image-card:hover {
    position: relative;
    z-index: 1;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
}

.image-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    filter: grayscale(20%);
    transition: filter 0.2s;
}

.image-card:hover img {
    filter: grayscale(0%);
}

.image-info {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border-top: 2px solid var(--black);
}

.image-name {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-btn {
    cursor: pointer;
}

/* === Comments === */
.comment-form {
    margin-bottom: 24px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.comment-row {
    margin-top: -2px;
}

.comment-row:first-child {
    margin-top: 0;
}

.comment-card {
    background: var(--surface);
    border: 2px solid var(--black);
    border-radius: 0;
    padding: 16px 20px;
}

.comment-row-mine .comment-card {
    text-align: right;
}

.comment-row-mine .comment-author {
    justify-content: flex-end;
}

.comment-row-mine .comment-footer {
    flex-direction: row-reverse;
    justify-content: space-between;
}

.scroll-to-bottom-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--black);
    color: var(--white);
    border: none;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    z-index: 100;
    letter-spacing: 0.02em;
}

.scroll-to-bottom-btn:hover {
    background: var(--gray-700);
}

.comment-card-deleted {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.comment-deleted-notice {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 6px;
}

.comment-author-name {
    font-weight: 700;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.comment-author-role {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 6px;
    border: 1px solid var(--border);
}

.comment-body {
    margin-bottom: 10px;
    word-break: break-word;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

.comment-body ul,
.comment-body ol {
    padding-left: 1.4em;
    margin: 0.4em 0;
}

.comment-body code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: var(--gray-100);
    padding: 1px 4px;
}

.comment-body pre {
    background: var(--gray-100);
    padding: 0.6em 0.8em;
    overflow-x: auto;
    font-size: 0.82em;
}

.mention-tag {
    color: var(--primary, #2563eb);
    font-weight: 700;
    font-style: normal;
}

/* Contenteditable comment input */
.comment-input {
    width: 100%;
    min-height: 2.5rem;
    max-height: 12rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0px;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text, #111827);
    background: var(--surface, #fff);
    outline: none;
    box-sizing: border-box;
    word-break: break-word;
}
.comment-input:focus {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.comment-input:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted, #9ca3af);
    pointer-events: none;
}

/* FM file chip inside comment editor and rendered comments */
.fm-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    border-radius: 0px;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    border: 1px solid #6ee7b7;
}
.fm-chip:hover { background: #a7f3d0; text-decoration: none; }

.fm-file-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    border-radius: 0px;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #6ee7b7;
}
.fm-file-link:hover { background: #a7f3d0; text-decoration: none; }

.fm-folder-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    border-radius: 0px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    border: 1px solid #93c5fd;
}
.fm-folder-chip:hover { background: #bfdbfe; text-decoration: none; }

.fm-folder-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    border-radius: 0px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #93c5fd;
}
.fm-folder-link:hover { background: #bfdbfe; text-decoration: none; }

.comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === File List === */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.file-item {
    background: var(--surface);
    border: 2px solid var(--black);
    border-radius: 0;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: -2px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.file-item:first-child {
    margin-top: 0;
}

.file-item:hover {
    position: relative;
    z-index: 1;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.file-name {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-300);
    padding-bottom: 1px;
}

.file-name:hover {
    color: var(--text);
    border-bottom-color: var(--black);
    text-decoration: none;
}

.file-size {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.file-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.file-list-compact .file-item {
    padding: 8px 12px;
    border-width: 1px;
}

.task-card-files {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-200);
}

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

.task-card-files-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* === Dropzone === */
.dropzone {
    position: relative;
    border: 2px dashed var(--gray-300);
    background: var(--gray-50);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover {
    border-color: var(--black);
    background: var(--gray-100);
}

.dropzone.dropzone-drag {
    border-color: var(--black);
    background: var(--gray-100);
    box-shadow: inset 0 0 0 2px var(--black);
}

.dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.dropzone-icon {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--gray-400);
}

.dropzone-text {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dropzone-link {
    color: var(--black);
    border-bottom: 1.5px solid var(--black);
}

.dropzone-hint {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.file-input-preview {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.file-input-item {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text);
    padding: 6px 10px;
    background: var(--surface);
    border: 1.5px solid var(--black);
    margin-top: -1.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.file-input-item:first-child {
    margin-top: 0;
}

.file-input-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-input-item-size {
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.file-input-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
    font-weight: 700;
}

.file-input-item-remove:hover {
    color: var(--danger-hover);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-600);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    background: var(--surface);
    color: var(--text);
    transition: box-shadow 0.1s;
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

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

/* === Modal === */
body:has(.modal[style*="display: flex"]),
body:has(.modal[style*="display:flex"]) {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fm-picker-modal {
    z-index: 1010;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border: 3px solid var(--black);
    border-radius: 0;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 8px 8px 0 var(--black);
    scale: 0.9;
}

.modal-sm {
    max-width: 400px;
}

.modal-lg {
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
}

/* === Task Detail Modal === */
.task-detail-modal-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-detail-description {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.task-detail-meta-row {
    display: flex;
    gap: 24px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 24px;
}

.task-detail-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--black);
}

.task-detail-section {
    margin-bottom: 24px;
}

.task-detail-comment {
    border: 1.5px solid var(--black);
    padding: 12px 16px;
    margin-top: -1.5px;
    background: var(--surface);
}

.task-detail-comment:first-child {
    margin-top: 0;
}

.task-detail-comment-body {
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 8px;
}

.task-detail-comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-detail-comment-date {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.task-detail-comment-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.task-detail-comment-form textarea {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    resize: vertical;
    min-height: 38px;
}

.task-detail-comment-form textarea:focus {
    outline: none;
    box-shadow: 3px 3px 0 var(--black);
}

.task-detail-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.task-detail-open-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--gray-300);
    padding-bottom: 1px;
}

.task-detail-open-link:hover {
    color: var(--text);
    border-bottom-color: var(--black);
}

.file-item-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}

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

.modal-header h2 {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0;
    line-height: 1;
    transition: opacity 0.1s;
}

.modal-close:hover {
    opacity: 0.5;
}

/* === Toast === */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 24px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    box-shadow: 4px 4px 0 var(--black);
    animation: slideIn 0.2s ease;
    max-width: 400px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.toast-success {
    background: var(--white);
    color: var(--success);
}

.toast-error {
    background: var(--white);
    color: var(--danger);
}

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

@keyframes fmSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.fm-spin {
    animation: fmSpin 0.7s linear infinite;
    display: inline-block;
}

/* === Tab Navigation === */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--black);
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--gray-100);
    color: var(--text-muted);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-left: -2px;
    margin-bottom: -2px;
}

.tab-btn:first-child {
    margin-left: 0;
}

.tab-nav-spacer {
    flex: 1;
    border-bottom: 2px solid var(--black);
    margin-bottom: -2px;
}

.tab-btn:hover {
    background: var(--gray-200);
    color: var(--text);
}

.tab-btn.active {
    background: var(--white);
    color: var(--black);
    border-bottom: none;
    position: relative;
    z-index: 1;
}

/* === Kanban Board === */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}

.kanban-column {
    border: 2px solid var(--black);
    margin-left: -2px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.kanban-column:first-child {
    margin-left: 0;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--black);
    background: var(--black);
    color: var(--white);
}

.kanban-column[data-status="unassigned"] .kanban-column-header {
    background: var(--status-unassigned-text);
}

.kanban-column[data-status="pending"] .kanban-column-header {
    background: var(--status-pending-text);
}

.kanban-column[data-status="ongoing"] .kanban-column-header {
    background: var(--status-ongoing-text);
}

.kanban-column[data-status="on_hold"] .kanban-column-header {
    background: var(--status-on-hold-text);
}

.kanban-column[data-status="completed"] .kanban-column-header {
    background: var(--status-completed-text);
}

.kanban-column-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kanban-column-count {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.9);
    color: var(--black);
    padding: 2px 8px;
    min-width: 24px;
    text-align: center;
}

.kanban-column-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--gray-50);
}

.kanban-column[data-status="unassigned"] .kanban-column-body {
    background: color-mix(in srgb, var(--status-unassigned-bg) 40%, var(--white));
}

.kanban-column[data-status="pending"] .kanban-column-body {
    background: color-mix(in srgb, var(--status-pending-bg) 40%, var(--white));
}

.kanban-column[data-status="ongoing"] .kanban-column-body {
    background: color-mix(in srgb, var(--status-ongoing-bg) 40%, var(--white));
}

.kanban-column[data-status="on_hold"] .kanban-column-body {
    background: color-mix(in srgb, var(--status-on-hold-bg) 40%, var(--white));
}

.kanban-column[data-status="completed"] .kanban-column-body {
    background: color-mix(in srgb, var(--status-completed-bg) 40%, var(--white));
}

.kanban-card {
    background: var(--surface);
    border: 2px solid var(--black);
    padding: 14px 16px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.kanban-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
    position: relative;
    z-index: 1;
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: none;
    box-shadow: none;
}

.kanban-column-body.drag-over {
    outline: 2px dashed var(--black);
    outline-offset: -4px;
}

.kanban-column[data-status="unassigned"] .kanban-column-body.drag-over {
    background: var(--status-unassigned-bg);
}

.kanban-column[data-status="pending"] .kanban-column-body.drag-over {
    background: var(--status-pending-bg);
}

.kanban-column[data-status="ongoing"] .kanban-column-body.drag-over {
    background: var(--status-ongoing-bg);
}

.kanban-column[data-status="on_hold"] .kanban-column-body.drag-over {
    background: var(--status-on-hold-bg);
}

.kanban-column[data-status="completed"] .kanban-column-body.drag-over {
    background: var(--status-completed-bg);
}

.kanban-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.kanban-card-project {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    padding: 2px 6px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    display: inline-block;
}

.kanban-card-date {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === Board Filters === */
.board-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.board-filter-select {
    padding: 8px 14px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%230a0a0a' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.board-filter-select:focus {
    outline: none;
    box-shadow: 3px 3px 0 var(--black);
}

/* === User Search Filter (typeahead) === */
.user-search-filter {
    position: relative;
    min-width: 220px;
}

.user-search-input {
    width: 100%;
    padding: 8px 32px 8px 14px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--white);
    color: var(--text);
    cursor: text;
}

.user-search-input::placeholder {
    color: var(--gray-500);
}

.user-search-input:focus {
    outline: none;
    box-shadow: 3px 3px 0 var(--black);
}

.user-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0 2px;
    font-weight: 700;
}

.user-search-clear:hover {
    color: var(--black);
}

.user-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--white);
    border: 2px solid var(--black);
    border-top: none;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 4px 4px 0 var(--black);
}

.user-search-dropdown-item {
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
}

.user-search-dropdown-item:last-child {
    border-bottom: none;
}

.user-search-dropdown-item:hover,
.user-search-dropdown-item.highlighted {
    background: var(--black);
    color: var(--white);
}

.user-search-dropdown-item[style*="display: none"] + .user-search-dropdown-item {
    border-top: none;
}

/* === Board Multi-Select Dropdowns === */
.board-multiselect {
    position: relative;
}

.board-ms-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--black);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.board-ms-trigger:focus {
    outline: none;
    box-shadow: 3px 3px 0 var(--black);
}

.board-ms-trigger:hover {
    background: var(--gray-50);
}

.board-ms-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 200;
    background: var(--white);
    border: 2px solid var(--black);
    border-top: none;
    min-width: 180px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 4px 4px 0 var(--black);
}

.board-ms-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    user-select: none;
}

.board-ms-item:last-child {
    border-bottom: none;
}

.board-ms-item:hover {
    background: var(--gray-50);
}

.board-ms-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--black);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.board-ms-all {
    font-weight: 700;
}

.board-ms-divider {
    border-bottom: 2px solid var(--black);
    margin: 0;
}

/* === Board Date Range Filter === */
.board-date-range {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 2px solid var(--black);
    padding: 0 8px;
    background: var(--white);
}

.board-date-input {
    border: none;
    padding: 6px 2px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    outline: none;
    width: 120px;
}

.board-date-input:focus {
    outline: none;
}

.board-date-sep {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0 2px;
}

/* === Kanban History Button === */
.kanban-history-btn {
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-radius: 0;
    margin-left: auto;
    margin-right: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.kanban-history-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === History Drawer === */
.history-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.history-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.history-drawer-panel {
    position: relative;
    z-index: 1;
    width: 380px;
    max-width: 90vw;
    background: var(--surface);
    border-left: 2px solid var(--black);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 0 var(--black);
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.history-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 2px solid var(--black);
    background: var(--black);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.history-drawer-header button {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    font-weight: 700;
}

.history-drawer-header button:hover {
    opacity: 0.7;
}

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

.history-item {
    padding: 12px 14px;
    border: 2px solid var(--black);
    background: var(--white);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.history-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
}

.history-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
}

.history-item-meta {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.empty-state-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: center;
    padding: 32px 16px;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    grid-column: 1 / -1;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 2px dashed var(--gray-300);
}

/* === Deadline === */
.deadline-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 4px;
}

.deadline-overdue {
    color: var(--danger);
    font-weight: 700;
}

.kanban-card-deadline {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 4px;
}

.kanban-card-deadline.deadline-overdue {
    color: var(--danger);
    font-weight: 700;
}

/* === Client Dashboard === */
.client-project-managers {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.client-managers-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.client-manager-chip {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--status-manager-text);
    background: var(--status-manager-bg);
    border: 1px solid var(--status-manager-border);
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === Responsive === */
@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

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

    .task-meta-row {
        grid-template-columns: 1fr 1fr;
    }

    .task-filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .task-filters-right {
        flex-wrap: wrap;
    }

    .task-filters {
        flex-wrap: wrap;
    }

    .modal-content {
        width: 95%;
        padding: 24px;
        box-shadow: 4px 4px 0 var(--black);
    }

    .tab-nav {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.65rem;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .kanban-column {
        margin-left: 0;
        margin-top: -2px;
        min-height: auto;
    }

    .kanban-column:first-child {
        margin-top: 0;
    }

    .board-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .board-filters {
        width: 100%;
    }
}

/* === Public Sharing === */

.public-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
    border-radius: 0px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.share-panel {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 0px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.share-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.share-panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share-panel-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.share-panel-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.share-panel-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.share-link-input {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border-light);
    border-radius: 0px;
    background: var(--gray-100);
    color: var(--text);
    cursor: text;
}

img.public-image {
    pointer-events: none;
    user-select: none;
}

/* ==========================================
   NOTIFICATION BELL
   ========================================== */

.nav-notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 0px;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
}

.nav-notification-bell:hover {
    background: var(--gray-100);
}

.notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 0px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

/* ==========================================
   DASHBOARD STATS
   ========================================== */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 2rem;
    border: 2px solid var(--black);
}

@media (max-width: 700px) {
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}

.dashboard-stat-card {
    background: var(--surface);
    border-right: 2px solid var(--black);
    border-bottom: 2px solid var(--black);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.1s;
}

/* Remove redundant right border on last column */
.dashboard-stat-card:nth-child(3n) {
    border-right: none;
}

/* Remove bottom border on last row (items 4-6) */
.dashboard-stat-card:nth-last-child(-n+3):nth-child(3n+1),
.dashboard-stat-card:nth-last-child(-n+3):nth-child(3n+2),
.dashboard-stat-card:nth-last-child(-n+3):nth-child(3n) {
    border-bottom: none;
}

.dashboard-stat-card:hover {
    background: var(--gray-50);
}

.dashboard-stat-icon {
    width: 36px;
    height: 36px;
    border: 2px solid var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: var(--white);
}

.dashboard-stat-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.dashboard-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
    letter-spacing: -0.03em;
}

.dashboard-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Accent text color for key stats */
.dashboard-stat-overdue .dashboard-stat-value { color: var(--danger); }
.dashboard-stat-unread  .dashboard-stat-value { color: var(--warning); }

/* Section divider above notifications */
.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 0.75rem 0;
    border-bottom: 2px solid var(--black);
}

.dashboard-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

/* ==========================================
   NOTIFICATION CARDS
   ========================================== */

.notif-card {
    background: var(--surface);
    border: 2px solid var(--black);
    border-top: none;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0.25rem 1rem;
    transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
    cursor: default;
    position: relative;
}

.notif-card:first-child {
    border-top: 2px solid var(--black);
}

.notif-card:hover {
    background: var(--gray-50);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--black);
    z-index: 1;
}

.notif-card.read {
    background: var(--gray-50);
    opacity: 0.6;
}

.notif-card.read:hover {
    opacity: 0.85;
}

.notif-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    grid-column: 1;
    grid-row: 1;
}

.notif-card-actions {
    grid-column: 2;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    align-self: center;
}

.notif-escalation-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border: 1.5px solid var(--black);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
    background: var(--white);
}

/* Level accent — just the badge background, keeps borders black */
.notif-level-badge-0 { background: var(--gray-100); }
.notif-level-badge-1 { background: #fef9c3; }
.notif-level-badge-2 { background: #ffedd5; }
.notif-level-badge-3 { background: #fee2e2; }
.notif-mention-badge { background: #dbeafe; color: #1d4ed8; }

/* Mention autocomplete dropdown */
.mention-dropdown {
    position: fixed;
    background: var(--surface, #fff);
    border: 2px solid var(--black, #000);
    border-radius: 0px;
    box-shadow: 4px 4px 0 var(--black, #000);
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    min-width: 220px;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.mention-item:last-child { border-bottom: none; }

.mention-item:hover,
.mention-item-selected {
    background: var(--gray-100, #f3f4f6);
}

.mention-fullname {
    font-weight: 600;
    color: var(--text, #111827);
    flex: 1;
}

.mention-username {
    font-size: 0.75rem;
    color: var(--primary, #2563eb);
    margin-left: auto;
}

.notif-type-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notif-meta-overdue {
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--danger);
    margin-left: auto;
}

.notif-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    grid-column: 1;
    grid-row: 2;
    letter-spacing: -0.01em;
}

.notif-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
    font-size: 12px;
    color: var(--text-muted);
    grid-column: 1;
    grid-row: 3;
}

.notif-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.notif-pagination-info {
    font-size: 0.82rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-muted);
}

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

/* status badge for assignee name */
.status-badge.status-user {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-400);
    font-size: 12px;
}

/* File Manager animated segmented toggle */
.fm-toggle {
    position: relative;
    display: flex;
    width: 280px;
    background: var(--surface);
    border: 2px solid var(--black);
    overflow: hidden;
    height: 34px;
    flex-shrink: 0;
}
.fm-toggle-pill {
    position: absolute;
    top: 0; bottom: 0; width: 50%;
    background: var(--black);
    transition: left 0.2s ease;
    left: 0;
    pointer-events: none;
}
.fm-toggle-btn {
    position: relative; z-index: 1;
    flex: 1; text-align: center;
    background: transparent; border: none;
    padding: 0; font-size: 0.85rem;
    font-weight: 500; cursor: pointer;
    font-family: var(--font-sans);
    color: var(--text);
    transition: color 0.15s; white-space: nowrap;
}
.fm-toggle-btn.active { color: var(--white); }

/* File Manager list view */
.fm-list {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--black);
    border-radius: 0px;
    overflow: hidden;
}
.fm-list-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--gray-200);
    min-height: 48px;
    background: var(--surface);
    transition: background 0.1s;
}
.fm-list-row:last-child { border-bottom: none; }
.fm-list-row:hover { background: var(--gray-50); }
.fm-list-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}
.fm-list-thumb {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 0px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}
.fm-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fm-list-name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fm-list-name span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fm-list-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}
.fm-list-meta-item {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.fm-list-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* File Manager image thumbnail card */
.fm-img-thumb {
    position: relative;
    height: 170px;
    background: var(--gray-100);
    overflow: hidden;
    border-bottom: 2px solid var(--black);
    cursor: zoom-in;
    flex-shrink: 0;
}
.fm-img-thumb img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.15s;
}
.fm-img-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    pointer-events: none;
}
.fm-img-thumb-overlay svg {
    opacity: 0;
    transition: opacity 0.15s;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}
.fm-img-thumb:hover .fm-img-thumb-overlay { background: rgba(0,0,0,0.28); }
.fm-img-thumb:hover .fm-img-thumb-overlay svg { opacity: 1; }

/* File Manager icon action buttons */
.fm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1.5px solid var(--gray-300);
    border-radius: 0px;
    cursor: pointer;
    color: var(--gray-600);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    flex-shrink: 0;
    text-decoration: none;
    padding: 0;
}
.fm-icon-btn:hover { background: var(--gray-100); border-color: var(--black); color: var(--black); }
.fm-icon-btn-danger { color: var(--danger); border-color: #fca5a5; }
.fm-icon-btn-danger:hover { background: #fee2e2; border-color: var(--danger); color: var(--danger); }

/* File Manager lightbox */
.fm-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.92);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.fm-lightbox.open { display: flex; }
.fm-lightbox-img-wrap {
    position: relative;
    max-width: calc(100vw - 8rem);
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fm-lightbox-img-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border: 2px solid rgba(255,255,255,0.12);
}
.fm-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 1.6rem;
    width: 44px;
    height: 56px;
    cursor: pointer;
    border-radius: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}
.fm-lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.fm-lightbox-nav.prev { left: 1rem; }
.fm-lightbox-nav.next { right: 1rem; }
.fm-lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.12s;
}
.fm-lightbox-close:hover { opacity: 1; }
.fm-lightbox-meta {
    margin-top: 0.85rem;
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
    text-align: center;
    max-width: 600px;
    padding: 0 1rem;
}
.fm-lightbox-meta strong { color: #fff; font-size: 0.95rem; display: block; margin-bottom: 0.25rem; }

/* File Manager search dropdown items */
.fm-search-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
}
.fm-search-item:last-child { border-bottom: none; }
.fm-search-item:hover { filter: brightness(0.96); }
.fm-search-folder { background: #fefce8; }

/* === Error Pages (404, 403, etc.) === */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    text-align: center;
    padding: 48px 24px;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 7rem;
    font-weight: 700;
    line-height: 1;
    color: var(--black);
    letter-spacing: -0.04em;
    margin-bottom: 8px;
}

.error-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.error-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 380px;
    margin-bottom: 32px;
    line-height: 1.65;
}

.error-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.fm-search-file   { background: var(--surface); }

/* === Task Parent Link Chips & Typeahead === */
.task-link-chips          { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; margin-bottom: 6px; }
.task-link-chip           { display: flex; align-items: center; gap: 4px; padding: 3px 8px;
                            border: 1.5px solid var(--black); font-size: 0.72rem; font-weight: 600;
                            font-family: var(--font-mono); background: var(--gray-100); max-width: 220px; }
.task-link-chip-title     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-link-chip-remove    { background: none; border: none; cursor: pointer; font-size: 0.9rem;
                            color: var(--text-muted); padding: 0; line-height: 1; }
.task-link-chip-remove:hover { color: var(--danger); }

.task-link-search-wrap    { position: relative; }
.task-link-search-input   { width: 100%; padding: 8px 14px;
                            border: 2px solid var(--black); font-family: var(--font-mono);
                            font-size: 0.7rem; font-weight: 600; background: var(--white); }
.task-link-dropdown       { position: absolute; top: 100%; left: 0; right: 0; z-index: 300;
                            background: var(--white); border: 2px solid var(--black); border-top: none;
                            max-height: 220px; overflow-y: auto; box-shadow: 4px 4px 0 var(--black); }
.task-link-dropdown-item  { display: flex; justify-content: space-between; align-items: center;
                            padding: 8px 14px; font-family: var(--font-mono); font-size: 0.7rem;
                            font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--gray-100); }
.task-link-dropdown-item:hover { background: var(--black); color: var(--white); }
.task-link-dropdown-item:hover .status-badge { filter: invert(1); }

.label-hint               { font-size: 0.65rem; color: var(--text-muted); font-weight: 400;
                            text-transform: none; letter-spacing: 0; font-family: var(--font-sans); }
.task-detail-parents-section { margin-bottom: 0.75rem; }

/* ===== Agent Chat ===== */
#section-agent {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: var(--bg);
    z-index: 10;
    padding: 0 8rem;
    box-sizing: border-box;
}

.agent-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100%;
    gap: 0;
    overflow: hidden;
    border-left: 2px solid var(--black);
    border-right: 2px solid var(--black);
}

.agent-sidebar {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    overflow: hidden;
}

.agent-sidebar-header {
    padding: 0.75rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-sidebar-header .btn,
.agent-sidebar-header input {
    height: 30px;
    box-sizing: border-box;
    width: 100%;
    font-size: 0.8rem;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
}

.agent-sidebar-header input {
    border: 1.5px solid var(--black);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-sans, inherit);
    outline: none;
}

.agent-sidebar-header input:focus {
    border-color: var(--black);
    background: var(--bg);
}

.agent-quota-bar {
    padding: 0.45rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    text-align: center;
    letter-spacing: 0.01em;
}
.agent-quota-bar--low      { color: #d97706; }
.agent-quota-bar--empty    { color: var(--danger); font-weight: 600; }
.agent-quota-bar--unlimited { color: var(--gray-400); }

.agent-sidebar-footer {
    border-top: 1px solid var(--border-light);
    padding: 0.5rem 0.75rem;
    margin-top: auto;
}
.agent-admin-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    transition: color 0.1s, background 0.1s;
}
.agent-admin-link:hover { color: var(--black); background: var(--gray-100); }

.agent-session-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.agent-session-item {
    position: relative;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
    border: 1px solid transparent;
    margin-bottom: 0.45rem;
    background: rgba(255, 255, 255, 0.72);
}

.agent-session-open {
    width: 100%;
    text-align: left;
    padding: 0.8rem 0.9rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: var(--font-sans);
}
.agent-session-item:not(.agent-session-item--active):hover {
    background: rgba(17, 17, 17, 0.04);
    color: var(--black);
    border-color: rgba(17, 17, 17, 0.08);
    transform: translateY(-1px);
}
.agent-session-item--active {
    background: linear-gradient(135deg, #111111, #232323);
    color: var(--white);
    box-shadow: 0 14px 28px rgba(17, 17, 17, 0.16);
}
.agent-session-item--active:hover { background: linear-gradient(135deg, #111111, #232323); }
.agent-session-item--active .agent-session-date { color: var(--gray-400); }

.agent-session-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.35;
    padding-right: 4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.agent-session-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.agent-session-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
    padding-right: 2rem;
}

.agent-session-item--active .agent-session-preview {
    color: rgba(255, 255, 255, 0.72);
}

.agent-session-delete {
    position: absolute;
    top: 0.7rem;
    right: 0.4rem;
    transform: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--danger);
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0.2rem 0.35rem;
    line-height: 1;
}
.agent-session-item:not(.agent-session-item--active):hover .agent-session-delete { opacity: 0.7; }
.agent-session-item:not(.agent-session-item--active):hover .agent-session-delete:hover { opacity: 1; }
.agent-session-item--active .agent-session-delete { color: var(--white); opacity: 0.5; }
.agent-session-item--active .agent-session-delete:hover { opacity: 1; }

.agent-session-rename {
    position: absolute;
    top: 0.7rem;
    right: 2rem;
    transform: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0.22rem 0.35rem;
    line-height: 1;
}
.agent-session-item:not(.agent-session-item--active):hover .agent-session-rename { opacity: 0.7; }
.agent-session-item:not(.agent-session-item--active):hover .agent-session-rename:hover { opacity: 1; color: var(--black); }
.agent-session-item--active .agent-session-rename { color: var(--white); opacity: 0.5; }
.agent-session-item--active .agent-session-rename:hover { opacity: 1; }

.agent-attach-btn {
    align-self: stretch;
    flex-shrink: 0;
    padding: 0 0.65rem;
    line-height: 0;
}

.agent-file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem 0;
}
.agent-file-chip {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--gray-100);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    padding: 0.15rem 0.4rem;
    font-size: 0.78rem;
    max-width: 200px;
}
.agent-file-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.agent-file-chip button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0;
    flex-shrink: 0;
}
.agent-file-chip button:hover { color: var(--danger); }
.agent-file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.agent-file-chip-status {
    font-size: 0.7rem;
    flex-shrink: 0;
    color: var(--text-muted);
}
.agent-file-chip-status--ok { color: var(--success, #16a34a); }
.agent-file-chip-status--error { color: var(--danger); cursor: help; }
.agent-file-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    color: var(--text-muted);
    padding: 0;
    flex-shrink: 0;
}
.agent-file-chip-remove:hover { color: var(--danger); }
.agent-file-chip--uploading {
    opacity: 0.65;
    background: var(--gray-50, #f9fafb);
    border-style: dashed;
}
.agent-file-chip--error {
    background: #fff0f0;
    border-color: var(--danger);
    color: var(--danger);
}

.agent-confirm-panel {
    border: 2px solid var(--black);
    border-radius: 0;
    background: var(--surface);
    overflow: hidden;
}
.agent-confirm-header {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.85rem;
    background: var(--black);
    color: var(--white, #fff);
}
.agent-confirm-body {
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.agent-confirm-action {
    padding: 0.45rem 0.6rem;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.agent-confirm-action-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
}
.agent-confirm-args {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.agent-confirm-arg-key {
    font-weight: 600;
    color: var(--text);
}
.agent-confirm-arg-val {
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
}
.agent-confirm-reason {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}
.agent-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--gray-50);
}
.agent-confirm-executing {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.3rem 0;
}
.agent-message--confirm .agent-message-bubble {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
.agent-message--confirm {
    opacity: 1;
    transition: opacity 0.2s;
}
.agent-confirm-pending {
    opacity: 0.6;
    pointer-events: none;
}

.agent-clarify-question {
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.55rem;
}
.agent-clarify-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.agent-clarify-chip {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1.5px solid var(--black);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    border-radius: 0;
    transition: background 0.12s, color 0.12s;
    line-height: 1.4;
}
.agent-clarify-chip:hover {
    background: var(--black);
    color: var(--white, #fff);
}
.agent-message--clarify .agent-message-bubble {
    background: var(--gray-50);
    border: 1.5px solid var(--border);
}

.agent-token-usage {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    opacity: 0.7;
}

/* ── Agent Steps Bubble ───────────────────────────────────── */
.agent-message--steps .agent-message-meta {
    display: none;
}

.agent-message--steps .agent-message-bubble {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.agent-steps-bubble {
    overflow: hidden;
}

.agent-steps-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.1rem 0;
    cursor: pointer;
    user-select: none;
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
}

.agent-steps-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.agent-steps-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border, #e2e8f0);
    border-top-color: var(--black, #0f172a);
    animation: agent-spin 0.7s linear infinite;
}

.agent-steps-check {
    font-size: 0.8rem;
    color: var(--success, #16a34a);
    font-weight: 600;
}

.agent-steps-title {
    flex: 1;
    font-size: 0.81rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-steps-title .wave-char {
    display: inline-block;
    animation: agent-wave 1.6s ease-in-out infinite;
}

.agent-steps-toggle {
    display: flex;
    align-items: center;
    color: var(--text-muted, #64748b);
    flex-shrink: 0;
}
.agent-steps-chevron {
    transition: transform 0.2s;
}
.agent-steps-bubble--open .agent-steps-chevron {
    transform: rotate(180deg);
}

.agent-steps-body {
    display: none;
    padding: 0.3rem 0 0.1rem 1.2rem;
}
.agent-steps-bubble--open .agent-steps-body {
    display: block;
}

.agent-step-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.28rem 0.35rem;
    font-size: 0.79rem;
    border-radius: 4px;
    transition: background 0.1s;
}

.agent-step-item .step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    font-size: 0.72rem;
}

.agent-step-item .step-label {
    flex: 1;
}

.agent-step-item--active {
    color: var(--text, #0f172a);
}

.agent-step-item--active .step-icon {
    width: 8px;
    height: 8px;
    background: var(--text-muted, #64748b);
    border-radius: 50%;
    display: inline-block;
    animation: agent-pulse 1.2s ease-in-out infinite;
    font-size: 0;
}

.agent-step-item--done {
    color: var(--text-muted, #64748b);
    opacity: 0.75;
}

.agent-step-item--error {
    color: var(--danger, #dc2626);
}

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

@keyframes agent-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.7); }
}

@keyframes agent-wave {
    0%, 60%, 100% { transform: translateY(0);   opacity: 1; }
    30%           { transform: translateY(-4px); opacity: 0.5; }
}

/* Welcome stats card */
.agent-welcome-card {
    align-self: flex-start;
    width: min(560px, 100%);
    margin-bottom: 0.25rem;
    border: 2px solid var(--black);
    background: var(--surface);
}
.agent-welcome-greeting {
    font-size: 0.875rem;
    color: var(--text);
    padding: 0.65rem 1rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    background: var(--gray-50);
}
.agent-welcome-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}
.agent-stat {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0.9rem;
}
.agent-stat:nth-child(3n) { border-right: none; }
.agent-stat:nth-last-child(-n+3) { border-bottom: none; }
.agent-stat--danger { background: #fef2f2; }
.agent-stat--warn  { background: #fffbeb; }
.agent-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--black);
    letter-spacing: -0.03em;
}
.agent-stat--danger .agent-stat-value { color: var(--danger); }
.agent-stat--warn  .agent-stat-value  { color: #d97706; }
.agent-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.agent-files-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.agent-chat-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.agent-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    position: relative;
    overflow: auto;
}

.agent-overview-shell {
    width: min(600px, 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.agent-overview-card {
    width: 100%;
    padding: 2rem 2rem 1.75rem;
    border: 2px solid var(--black);
    background: var(--white);
    box-shadow: 4px 4px 0 var(--black);
}

.agent-overview-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.agent-overview-title {
    margin: 0;
    font-size: clamp(1.3rem, 2.2vw, 1.75rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 700;
    color: var(--black);
}

.agent-overview-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 0;
    padding: 0.4rem 0.75rem;
    border: 2px solid var(--black);
    border-bottom: none;
    background: var(--gray-50);
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

.agent-overview-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 2px solid var(--black);
    margin-bottom: 1.5rem;
}

.agent-overview-stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 0.9rem 1.1rem;
    border-right: 2px solid var(--black);
    border-bottom: 2px solid var(--black);
    background: var(--white);
}

.agent-overview-stat--overdue { background: #fef2f2; }

.agent-overview-stat-value {
    font-size: clamp(1.8rem, 2.6vw, 2.4rem);
    line-height: 1;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--black);
}

.agent-overview-stat--overdue .agent-overview-stat-value { color: var(--danger); }

.agent-overview-stat-label {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.agent-overview-meta-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.7rem 0.9rem 0.8rem;
    border-right: 2px solid var(--black);
    background: var(--gray-50);
}

.agent-overview-meta-cell:last-child { border-right: none; }
.agent-overview-meta-cell--span2 { grid-column: span 2; }
.agent-overview-meta-cell--alert { background: #fef3c7; }

.agent-overview-meta-val {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--black);
    line-height: 1;
}

.agent-overview-meta-cell--alert .agent-overview-meta-val { color: #92400e; }

.agent-overview-meta-key {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.agent-overview-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.agent-overview-actions .btn {
    min-width: 160px;
    height: 40px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

#agent-chat-main {
    flex-direction: column;
    height: 100%;
    background:
        radial-gradient(circle at top left, rgba(93, 139, 255, 0.08), transparent 24%),
        linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,249,252,0.98));
}

.agent-new-chat-placeholder {
    flex: 1;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    user-select: none;
}

.agent-new-chat-placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0.28;
}

.agent-new-chat-placeholder-icon {
    color: var(--gray-500);
}

.agent-new-chat-placeholder-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
    letter-spacing: 0.01em;
    text-align: center;
    margin: 0;
}

.agent-chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem 0.6rem;
}

.agent-chat-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--black);
}

.agent-chat-subtitle {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agent-message {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: min(760px, 82%);
}
.agent-message--user { align-self: flex-end; }
.agent-message--assistant { align-self: flex-start; }
.agent-message--error { align-self: flex-start; }

.agent-message-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.agent-message--user .agent-message-actions { justify-content: flex-end; }
.agent-message:hover .agent-message-actions { opacity: 1; }

.agent-msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 7px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    transition: color 0.12s, border-color 0.12s, background 0.12s;
    white-space: nowrap;
}
.agent-msg-action-btn:hover {
    color: var(--text);
    border-color: var(--gray-500);
    background: var(--surface);
}
.agent-msg-action-btn--send {
    color: var(--white);
    background: var(--black);
    border-color: var(--black);
}
.agent-msg-action-btn--send:hover {
    opacity: 0.85;
    color: var(--white);
}

.agent-edit-textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem 0.65rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    resize: vertical;
    line-height: 1.5;
    box-sizing: border-box;
}
.agent-edit-textarea:focus {
    outline: none;
    border-color: var(--gray-500);
}

.agent-message-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.69rem;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.agent-message-meta::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.6;
}

.agent-message--user .agent-message-meta {
    align-self: flex-end;
}

.agent-message-bubble {
    padding: 0.9rem 1rem;
    border: 1px solid rgba(17, 17, 17, 0.08);
    font-size: 0.9rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.86);
    word-break: break-word;
    box-shadow: 0 14px 28px rgba(17, 17, 17, 0.06);
}

.agent-message-bubble > :first-child {
    margin-top: 0;
}

.agent-message-bubble > :last-child {
    margin-bottom: 0;
}

.agent-msg-file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(255,255,255,0.15);
    min-width: 0;
}
.agent-msg-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.55rem;
    border-radius: 3px;
    font-size: 0.78rem;
    font-weight: 500;
    background: rgba(255,255,255,0.12);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.25);
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
}
.agent-msg-file-chip:hover {
    background: rgba(255,255,255,0.22);
}
.agent-message--user .agent-message-bubble {
    background: linear-gradient(135deg, #111111, #242424);
    color: var(--white);
    border-color: #111111;
    box-shadow: 0 16px 30px rgba(17, 17, 17, 0.18);
}

.agent-message--error .agent-message-bubble {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

.agent-message--assistant .agent-message-bubble {
    border-color: rgba(17, 17, 17, 0.08);
}

.agent-message--assistant .agent-message-bubble p,
.agent-message--user .agent-message-bubble p { margin: 0 0 0.5rem 0; }
.agent-message--assistant .agent-message-bubble p:last-child,
.agent-message--user .agent-message-bubble p:last-child { margin-bottom: 0; }
.agent-message--assistant .agent-message-bubble ul,
.agent-message--assistant .agent-message-bubble ol { margin: 0.25rem 0 0.5rem 1.2rem; padding: 0; }
.agent-message--assistant .agent-message-bubble li { margin-bottom: 0.2rem; }
.agent-message--assistant .agent-message-bubble code,
.agent-message--user .agent-message-bubble code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    background: var(--gray-100);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}
.agent-message--user .agent-message-bubble code {
    background: rgba(255, 255, 255, 0.12);
}
.agent-message--assistant .agent-message-bubble pre,
.agent-message--user .agent-message-bubble pre {
    background: var(--gray-100);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}
.agent-message--user .agent-message-bubble pre {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}
.agent-message--assistant .agent-message-bubble pre code,
.agent-message--user .agent-message-bubble pre code {
    background: none;
    padding: 0;
    font-size: 0.82rem;
}
.agent-message--assistant .agent-message-bubble h1,
.agent-message--assistant .agent-message-bubble h2,
.agent-message--assistant .agent-message-bubble h3 { margin: 0.5rem 0 0.25rem; font-weight: 700; }
.agent-message--assistant .agent-message-bubble blockquote {
    margin: 0.5rem 0;
    padding-left: 0.75rem;
    border-left: 3px solid var(--border);
    color: var(--gray-600);
}
.agent-message--assistant .agent-message-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}
.agent-message--assistant .agent-message-bubble th,
.agent-message--assistant .agent-message-bubble td {
    border: 1px solid var(--border);
    padding: 0.3rem 0.5rem;
    text-align: left;
}
.agent-message--assistant .agent-message-bubble th { background: var(--gray-50); font-weight: 600; }

/* Typing indicator */
.agent-typing { display: flex; gap: 4px; align-items: center; padding: 0.75rem 1rem !important; }
.agent-typing span {
    width: 6px; height: 6px; background: var(--gray-400);
    border-radius: 50%; animation: agentBounce 1.2s infinite;
}
.agent-typing span:nth-child(2) { animation-delay: 0.2s; }
.agent-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agentBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Tool logs */
.agent-tool-log {
    align-self: flex-start;
    max-width: 75%;
    font-size: 0.8rem;
    border: 1px solid var(--border-light);
    background: var(--surface);
    border-left: 3px solid var(--gray-400);
}
.agent-tool-summary {
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    user-select: none;
    font-family: var(--font-mono);
    color: var(--text-muted);
}
.agent-tool-detail {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: var(--gray-50);
    border-top: 1px solid var(--border-light);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Plan card */
.agent-plan-card {
    align-self: flex-start;
    max-width: min(520px, 100%);
    border: 2px solid var(--black);
    background: var(--surface);
    font-size: 0.875rem;
}
.agent-plan-header {
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--black);
    color: var(--white);
}
.agent-plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    color: var(--black);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 7px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.agent-plan-meta {
    padding: 0.45rem 1rem;
    font-size: 0.73rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--gray-50);
}
.agent-plan-items {
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}
.agent-plan-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    cursor: pointer;
}
.agent-plan-item:last-child { border-bottom: none; }
.agent-plan-item:hover { background: var(--gray-50); }
.agent-plan-item input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: var(--black);
}
.agent-plan-item-body { flex: 1; min-width: 0; }
.agent-plan-item-title {
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agent-plan-item-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agent-plan-item-deadline {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--gray-100);
    border: 1px solid var(--border);
    padding: 0 5px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 3px;
    align-self: flex-start;
    font-family: var(--font-mono, monospace);
}
.agent-plan-actions {
    padding: 0.6rem 1rem;
    display: flex;
    gap: 0.5rem;
    border-top: 2px solid var(--black);
    background: var(--gray-50);
}
.agent-plan-success {
    padding: 0.75rem 1rem;
    color: var(--success);
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.agent-plan-success::before { content: '✓'; font-size: 0.9rem; }

/* Input area */
.agent-input-area {
    padding: 0.75rem 2rem 1rem;
    background: var(--surface);
    flex-shrink: 0;
}
.agent-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.agent-textarea {
    flex: 1;
    resize: none;
    border: 2px solid var(--border);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.5;
    min-height: 40px;
    max-height: 160px;
    overflow-y: auto;
    background: var(--bg);
    color: var(--text);
    border-radius: 0;
    outline: none;
    transition: border-color 0.15s;
}
.agent-textarea:focus { border-color: var(--black); }

/* ===== Inline Agent (task page @agent) ===== */
#inline-agent-panel {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--black);
    padding: 0.75rem;
    background: var(--surface);
}

.ia-msg { display: flex; margin-bottom: 0.35rem; }
.ia-msg--user { justify-content: flex-end; }
.ia-msg--assistant { justify-content: flex-start; }

.ia-bubble {
    max-width: 85%;
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
    line-height: 1.55;
    border: 1px solid var(--border-light);
    word-break: break-word;
}
.ia-msg--user .ia-bubble {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
    font-size: 0.85rem;
}

.ia-tool-indicator {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 0.2rem 0;
}

.ia-plan-card {
    border: 1px solid var(--black);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.ia-plan-title { padding: 0.4rem 0.7rem; font-weight: 600; background: var(--gray-100); border-bottom: 1px solid var(--border-light); }
.ia-plan-items { padding: 0.4rem 0.7rem; max-height: 200px; overflow-y: auto; }
.ia-plan-item { padding: 0.2rem 0; }
.ia-plan-actions { padding: 0.4rem 0.7rem; display: flex; gap: 0.4rem; }

/* Status trail — shown while agent is processing */
.agent-status-trail {
    align-self: flex-start;
    max-width: min(380px, 90%);
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 0.25rem;
}
.agent-status-trail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid transparent;
    transition: background 0.1s;
}
.agent-status-trail-header:hover { background: var(--gray-50); }
.agent-status-current {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}
.agent-status-current-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78rem;
}
.agent-status-spinner {
    width: 7px;
    height: 7px;
    background: var(--black);
    border-radius: 50%;
    flex-shrink: 0;
    animation: agentPulse 1.4s ease-in-out infinite;
}
@keyframes agentPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.25; transform: scale(0.6); }
}
.agent-status-toggle {
    font-size: 0.55rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.agent-status-steps {
    display: none;
    flex-direction: column;
    border-top: 1px solid var(--border);
}
.agent-status-trail.expanded .agent-status-trail-header { border-bottom-color: var(--border); }
.agent-status-trail.expanded .agent-status-steps { display: flex; }
.agent-status-step-done {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.73rem;
    padding: 0.3rem 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agent-status-step-done:last-child { border-bottom: none; }
.agent-status-step-done::before {
    content: '✓';
    color: var(--success);
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Message action buttons (edit / copy / retry) */
.agent-msg-actions {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex-shrink: 0;
}
/* User messages: buttons on the left */
.agent-msg--user .agent-msg-actions { order: -1; }
.agent-msg-action-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1.5;
    transition: background 0.1s, color 0.1s;
}
.agent-msg-action-btn:hover {
    background: var(--gray-100);
    color: var(--text);
}

/* Inline edit textarea inside user bubble */
.agent-edit-textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.4rem 0.5rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.15);
    color: var(--white);
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    outline: none;
    box-sizing: border-box;
}
.agent-edit-textarea::placeholder { color: rgba(255,255,255,0.5); }
.agent-edit-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

/* Stop button state */
.agent-send-btn--stop {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: var(--white) !important;
}

@media (max-width: 1200px) {
    #section-agent { padding: 0 4rem; }
}
@media (max-width: 768px) {
    #section-agent { padding: 0; }
    .agent-layout { grid-template-columns: 1fr; border-left: none; border-right: none; }
    .agent-sidebar { display: none; }
    .agent-messages { padding: 1rem; }
    .agent-input-area { padding: 0.75rem 1rem; }
    .agent-chat-empty { padding: 1rem; }
    .agent-overview-card { padding: 1.25rem; box-shadow: 3px 3px 0 var(--black); }
    .agent-overview-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .agent-overview-stat:nth-child(2) { border-right: none; }
    .agent-overview-stat:nth-child(4) { border-right: none; }
    .agent-overview-meta-cell--span2 { grid-column: span 1; }
    .agent-overview-meta-cell:nth-child(even) { border-right: none; }
    .agent-chat-topbar { padding: 1rem 1rem 0.4rem; }
    .agent-message { max-width: 100%; }
}
