/* DSP v2 — Odoo-style Layout */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Theme Variables ─── */
:root {
    --bg-page: #f3f4f6;
    --bg-surface: #fff;
    --bg-muted: #f3f4f6;
    --bg-hover: #f8f5ff;
    --text: #333;
    --text-muted: #666;
    --text-faint: #999;
    --border: #ddd;
    --border-light: #eee;
    --border-faint: #f0f0f0;
    --input-bg: #fff;
    --shadow: rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --bg-page: #111827;
    --bg-surface: #1f2937;
    --bg-muted: #374151;
    --bg-hover: #2d2545;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-faint: #6b7280;
    --border: #374151;
    --border-light: #2a2f3a;
    --border-faint: #1f2937;
    --input-bg: #1f2937;
    --shadow: rgba(0,0,0,0.3);
    color-scheme: dark;
}

/* ─── Command Palette (ninja-keys) ─── */
ninja-keys {
    --ninja-accent-color: #7c3aed;
    --ninja-z-index: 10000;
    --ninja-icon-size: 20px;
}

/* ─── Navbar Search Trigger ─── */
.nav-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid #495057;
    border-radius: 6px;
    background: #343a40;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
}
.nav-search-trigger:hover {
    border-color: #7c3aed;
    background: #3a3f44;
    color: #ccc;
}
.nav-search-label { pointer-events: none; }
.nav-search-kbd {
    display: flex;
    gap: 2px;
    margin-left: 4px;
}
.nav-search-kbd kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #2a2e33;
    color: #aaa;
    font-family: inherit;
    font-size: 10px;
    line-height: 1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace;
    background: var(--bg-page);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Monospace utility — seq IDs, project codes, numbers, dates */
.mono,
.issue-seq-prefix,
.kanban-card-seq,
.pivot-cell-val,
.kanban-card-footer {
    font-family: var(--font-mono);
}
.seq-id,
.kanban-card-seq {
    color: var(--text-muted);
}

/* ─── Main Navbar ─── */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    background: #212529;
    color: #fff;
    padding: 0 16px;
    flex-shrink: 0;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* IE/Edge */
}
.nav-left::-webkit-scrollbar {
    display: none;                   /* Chrome/Safari */
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.client-selector select {
    padding: 4px 8px;
    border: 1px solid #495057;
    border-radius: 4px;
    font-size: 12px;
    background: #343a40;
    color: #fff;
    cursor: pointer;
}

.client-selector select:focus {
    outline: none;
    border-color: #7c3aed;
}

.nav-modules {
    display: flex;
    align-items: center;
    gap: 1px;
}

.nav-module {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    color: #adb5bd;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-module:hover {
    background: #343a40;
    color: #fff;
}

.nav-module.active {
    background: #495057;
    color: #fff;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
}

/* ─── Sub-navigation ─── */
.sub-nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    height: 38px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    flex-shrink: 0;
}

.sub-nav-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.sub-nav-tab {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 100%;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

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

.sub-nav-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

/* Sub-nav dropdown */
.sub-nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.sub-nav-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 16px;
    height: 100%;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.sub-nav-dropdown-btn:hover {
    color: var(--text);
    background: var(--bg-page);
}

.sub-nav-dropdown.active .sub-nav-dropdown-btn {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.sub-nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 180px;
    z-index: 100;
}

.sub-nav-dropdown-menu.open { display: block; }

.sub-nav-dropdown-item {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
}

.sub-nav-dropdown-item:hover { background: var(--bg-page); }

.sub-nav-dropdown-item.active {
    font-weight: 600;
    color: #7c3aed;
}

/* ─── Content ─── */
.main {
    flex: 1;
    padding: 20px;
    overflow: auto;
}
.main.has-control-panel {
    padding-top: 10px;
}

/* ─── View header ─── */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.view-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

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

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

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── List View ─── */
.list-view {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.list-view-scroll {
    overflow-x: auto;
}

.list-view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
}

.list-view-filters {
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-view-filters select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    background: var(--input-bg);
    color: var(--text);
}

.list-view-filters select:focus {
    outline: none;
    border-color: #7c3aed;
}

.list-view-count {
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
}

.list-view table {
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.list-view th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.list-view th:hover {
    color: var(--text);
}

.list-view td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-faint);
    vertical-align: middle;
}

.list-view tr:last-child td {
    border-bottom: none;
}

.list-view tbody tr:hover {
    background: var(--bg-page);
}

/* Sort indicators on column headers */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable .sort-indicator::after { content: '\21C5'; opacity: 0.25; margin-left: 4px; font-size: 11px; }
th.sorted-asc .sort-indicator::after { content: '\25B2'; opacity: 0.7; }
th.sorted-desc .sort-indicator::after { content: '\25BC'; opacity: 0.7; }

/* Column resize handle */
.col-resize-handle {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 5px;
    cursor: col-resize;
}
.col-resize-handle:hover {
    border-right: 2px solid #aaa;
}

.list-view .col-actions {
    width: 70px;
    text-align: right;
    white-space: nowrap;
}

.list-view .col-num {
    text-align: right;
}

/* Inline edit input in list view */
.list-view .inline-input {
    width: 60px;
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    text-align: right;
    background: var(--input-bg);
    color: var(--text);
}

.list-view .inline-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* Inline row editing */
.list-view table.editable tbody tr:not(.editing):not(.list-view-group-header) { cursor: pointer; }
.list-view tr.editing td { background: #eff6ff; }
.list-view .inline-edit {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}
.list-view .inline-edit:focus {
    border-color: #7c3aed;
    outline: none;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
.list-view .lv-save-row { color: #059669; font-size: 16px; }
.list-view .lv-cancel-row { color: #dc2626; font-size: 14px; }
.inline-multiselect { display: flex; flex-wrap: wrap; gap: 4px; min-width: 120px; }
.inline-multi-opt { display: flex; align-items: center; gap: 3px; font-size: 12px; white-space: nowrap; cursor: pointer; padding: 2px 6px; border-radius: 3px; background: var(--bg-muted); }
.inline-multi-opt:hover { background: #e5e7eb; }
.inline-multi-opt input { margin: 0; }
.form-multiselect { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; }

/* Pagination bar */
.list-view-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-page);
    font-size: 13px;
    color: var(--text-muted);
}
.list-view-pagination .btn[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* ─── Cards (kept for specific views) ─── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
}

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

.card-body {
    padding: 10px 14px;
}

.card-description {
    padding: 6px 14px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.card-footer {
    padding: 6px 14px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
}

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--border-faint);
    color: var(--text-muted);
}

.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-grey { background: var(--border-faint); color: var(--text-faint); }

/* Outline badges — border only, no fill */
.badge-outline {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: transparent;
    border: 1px solid;
}
.badge-outline-blue { border-color: #2563eb; color: #2563eb; }
.badge-outline-green { border-color: #16a34a; color: #16a34a; }
.badge-outline-yellow { border-color: #d97706; color: #92400e; }
.badge-outline-red { border-color: #dc2626; color: #dc2626; }
.badge-outline-purple { border-color: #7c3aed; color: #7c3aed; }
.badge-outline-grey { border-color: var(--text-faint); color: var(--text-faint); }
.badge-outline-cyan { border-color: #0891b2; color: #0891b2; }
.badge-outline-teal { border-color: #0d9488; color: #0d9488; }

/* ─── Buttons ─── */
.btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn:hover {
    background: var(--bg-muted);
    border-color: var(--text-faint);
}

.btn-primary {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.btn-primary:hover {
    background: #6d28d9;
}

.btn-sm {
    padding: 3px 8px;
    font-size: 12px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.15s;
}

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

.btn-danger {
    color: #dc2626;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 12px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--bg-surface);
    border-radius: 8px;
    width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px var(--shadow);
    color: var(--text);
}

.modal-wide { width: 640px; }

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

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
}

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

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

/* ─── Participants ─── */
.participants-add {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.participants-add select { flex: 1; }
.participants-add .m2o-wrap { flex: 1; }
.participants-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.participant-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-page);
    border-radius: 4px;
    font-size: 13px;
}
.participant-name { flex: 1; }
.participant-required {
    font-size: 12px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fff;
}
.participant-remove {
    color: #999;
    font-size: 16px;
    cursor: pointer;
    border: none;
    background: none;
}
.participant-remove:hover { color: #dc3545; }

/* ─── Data Tables (legacy) ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-faint);
}

.data-table th {
    font-weight: 500;
    color: #999;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Calendar month grid ─── */
.month-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 8px;
}

.month-cell {
    text-align: center;
}

.month-label {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    margin-bottom: 4px;
}

.month-input {
    width: 50px !important;
    text-align: center;
    padding: 6px !important;
    font-size: 14px !important;
    font-weight: 500;
}

.month-total .month-value {
    font-size: 16px;
    font-weight: 700;
    color: #7c3aed;
    padding-top: 4px;
}

/* ─── Scenario bar ─── */
.scenario-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.plan-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

/* ─── Timeline table ─── */
.grid-container {
    overflow-x: auto;
    margin-bottom: 12px;
}

.grid-container table {
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.grid-container th,
.grid-container td {
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #e0e0e0;
    min-width: 34px;
}

.grid-container th {
    background: #f5f5f5;
    color: #333;
    font-weight: 500;
}

.quarter-header {
    background: #fff !important;
    color: #333;
    font-weight: bold;
    font-size: 13px;
    border-bottom: 2px solid #333 !important;
}

.month-header {
    background: #f9f9f9 !important;
    color: #7c3aed;
    font-weight: 600;
    font-size: 11px;
}

.week-header {
    font-size: 10px;
    color: #999;
}

th.resource,
td.resource {
    text-align: left;
    min-width: 120px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 12px;
}

th.resource { z-index: 3; background: #f5f5f5; }
td.resource.external { color: #7c3aed; }

/* Heatmap */
.days-0 { background: #fff; color: #ccc; }
.days-low { background: var(--border-faint); color: #666; }
.days-med { background: #d0d0d0; color: #333; }
.days-high { background: #a0a0a0; color: #fff; }
.days-full { background: #333; color: #fff; font-weight: bold; }
.days-over { background: #dc2626; color: #fff; font-weight: bold; }
.absence { background: #fef3c7 !important; color: #92400e !important; font-style: italic; }

tr.group-row td {
    background: #f5f5f5 !important;
    color: #333;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 8px;
    border-top: 2px solid #333;
    text-align: left;
}

/* ─── Legend ─── */
.legend {
    display: flex;
    gap: 15px;
    font-size: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.legend-box {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

/* ─── View toggle ─── */
.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.view-toggle button {
    padding: 4px 10px;
    border: none;
    background: var(--bg-surface);
    font-size: 12px;
    cursor: pointer;
    color: var(--text-muted);
}

.view-toggle button:not(:last-child) {
    border-right: 1px solid var(--border);
}

.view-toggle button.active {
    background: #7c3aed;
    color: #fff;
}

/* ─── Utility ─── */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-faint);
    font-size: 14px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #dc2626;
}

.text-muted { color: var(--text-faint); font-size: 12px; }

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
    background: #333;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-error { background: #dc2626; }
.toast-info { background: #333; }

/* ─── Calendar Month Grid ─── */
.cal-month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.cal-month-label {
    font-size: 16px;
    font-weight: 600;
    min-width: 180px;
    text-align: center;
}

.cal-grid {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.cal-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.cal-dow {
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-day {
    min-height: 100px;
    border-right: 1px solid var(--border-faint);
    border-bottom: 1px solid var(--border-faint);
    padding: 4px;
    cursor: pointer;
    transition: background 0.1s;
    overflow: hidden;
}

.cal-day:hover {
    background: #faf8ff;
}

.cal-day:nth-child(7n) {
    border-right: none;
}

.cal-day-empty {
    background: #fafafa;
    cursor: default;
}

.cal-day-empty:hover {
    background: #fafafa;
}

.cal-day-today {
    background: #f5f0ff;
}

.cal-day-today:hover {
    background: #ede5ff;
}

.cal-day-num {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 2px 4px;
}

.today-num {
    display: inline-block;
    background: #7c3aed;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    padding: 0;
}

.cal-event {
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.1s;
}

.cal-event:hover {
    opacity: 0.8;
}

.cal-event-meeting {
    background: #ede9fe;
    color: #6d28d9;
    border-left: 3px solid #7c3aed;
}

.cal-event-task {
    background: #dbeafe;
    color: #1e40af;
    border-left: 3px solid #3b82f6;
}

.cal-event-timeoff-public {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #ef4444;
}

.cal-event-timeoff-company {
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

.cal-event-timeoff-resource {
    background: #ffedd5;
    color: #9a3412;
    border-left: 3px solid #f97316;
}

.cal-event-timeoff-public,
.cal-event-timeoff-company,
.cal-event-timeoff-resource {
    cursor: default;
}

.cal-event-time {
    font-weight: 600;
    font-size: 10px;
}

/* ─── Multi-day event spans ─── */
.cal-event-span-start {
    border-radius: 4px 0 0 4px;
    margin-right: 0;
    border-right: none;
    position: relative;
    z-index: 1;
}

.cal-event-span-mid {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-left: 0;
    margin-right: 0;
    min-height: 20px;
    opacity: 0.85;
    position: relative;
}

.cal-event-span-end {
    border-radius: 0 4px 4px 0;
    border-left: none;
    margin-left: 0;
    min-height: 20px;
    opacity: 0.85;
    position: relative;
}

.cal-event-span-start::after,
.cal-event-span-mid::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 25%;
    bottom: 25%;
    width: 2px;
    background: inherit;
    filter: brightness(0.9);
    z-index: 2;
}

/* ─── Calendar grouped view ─── */
.cal-group {
    margin-bottom: 16px;
}
.cal-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}
.cal-group-header:hover {
    background: #f0f0f5;
}
.cal-group-toggle {
    font-size: 10px;
    color: #666;
    width: 14px;
    text-align: center;
}
.cal-group-count {
    margin-left: auto;
    font-size: 12px;
    color: #888;
    font-weight: normal;
}
.cal-group-body {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}
.cal-group.collapsed .cal-group-body {
    display: none;
}
.cal-group.collapsed .cal-group-header {
    border-radius: 6px;
}

/* ─── Org Chart ─── */
/* ─── Org Chart ─── */
.org-chart {
    padding: 20px 24px;
    max-width: 800px;
}

/* Boss section */
.org-boss-section {
    display: flex;
    align-items: center;
    gap: 12px;
}
.org-boss-dept {
    font-size: 11px;
    padding: 2px 10px;
    background: #343a40;
    color: #fff;
    border-radius: 3px;
}
.org-divider {
    border: none;
    border-top: 2px solid #ede9fe;
    margin: 16px 0;
}

/* Card — horizontal inline style */
.org-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: box-shadow 0.15s;
}
.org-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,0.08); }
.org-card-boss {
    padding: 10px 16px;
    border: 2px solid #c4b5fd;
    background: #faf5ff;
}
.org-card-ext { border-left: 3px solid #3b82f6; }

.org-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.org-card-boss .org-avatar { width: 42px; height: 42px; font-size: 18px; }
.org-card-body { min-width: 0; }
.org-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.2;
}
.org-card-boss .org-card-name { font-size: 15px; }
.org-card-job {
    font-size: 11px;
    color: #6b7280;
}
.org-badge-ext {
    font-size: 9px;
    padding: 1px 5px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 3px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

/* Split layout — internal left, external right */
.org-split-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}
.org-split-internal {
    flex: 1;
    min-width: 0;
}
.org-split-external {
    flex: 0 0 280px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 12px 16px;
}
.org-split-external-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 8px;
}

/* Department grid — top-level depts side by side */
.org-dept-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    align-items: flex-start;
}
.org-dept-grid > .org-dept-section {
    flex: 1;
    min-width: 240px;
    max-width: 420px;
}
/* Inside external panel, depts stack vertically */
.org-split-external .org-dept-grid {
    flex-direction: column;
}
.org-split-external .org-dept-grid > .org-dept-section {
    max-width: none;
}

/* Department sections */
.org-dept-section {
    margin-bottom: 4px;
}
/* Nested sub-departments indent */
.org-dept-body > .org-dept-section {
    margin-left: 16px;
    border-left: 2px solid #ede9fe;
    padding-left: 8px;
}
.org-dept-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    cursor: pointer;
    user-select: none;
    border-radius: 4px;
}
.org-dept-header:hover { background: var(--bg-page); }
.org-dept-toggle {
    font-size: 10px;
    color: #9ca3af;
    width: 14px;
    text-align: center;
}
.org-dept-name {
    font-size: 13px;
    font-weight: 600;
    color: #6b21a8;
}
.org-dept-count {
    font-size: 11px;
    color: #9ca3af;
    background: var(--bg-muted);
    padding: 0 6px;
    border-radius: 10px;
}
.org-dept-body {
    padding: 2px 0 8px;
}

/* Person row inside department */
.org-person {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0 3px;
}

/* Fold button for person sub-reports */
.org-fold {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 11px;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.org-fold:hover { background: var(--bg-muted); border-color: #d1d5db; }

/* View toggle */
.org-view-toggle { display: flex; gap: 4px; }

/* Dept badge shown in hierarchy view */
.org-tree-dept {
    font-size: 10px;
    padding: 1px 8px;
    background: #343a40;
    color: #fff;
    border-radius: 3px;
    flex-shrink: 0;
    align-self: center;
}

/* ─── Search Bar ─── */
.search-bar {
    background: var(--bg-page);
    padding: 10px 20px 0;
    flex-shrink: 0;
}

.search-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Control Panel (inside search bar) ─── */
.cp-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cp-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.cp-count {
    font-weight: 400;
    color: var(--text-faint);
    font-size: 13px;
}

.cp-new-btn {
    white-space: nowrap;
}

.cp-view-switcher {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.cp-view-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-faint);
    line-height: 1;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
}

.cp-view-btn:hover {
    color: var(--text);
    border-color: var(--text-faint);
}

.cp-view-btn.active {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.cp-extras {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.search-bar-input-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    flex: 1;
    gap: 4px;
    background: var(--input-bg);
    min-height: 34px;
    cursor: text;
}

.search-bar-icon {
    display: inline-flex;
    align-items: center;
    opacity: 0.5;
    flex-shrink: 0;
}

.search-bar-input {
    border: none;
    outline: none;
    font-size: 13px;
    padding: 3px 0;
    min-width: 80px;
    flex: 1;
    font-family: inherit;
    background: transparent;
    color: var(--text);
}

.search-bar-input-wrap:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* ─── Search Panel (combined Filters / Group By / Favorites) ─── */
.search-panel {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 16px var(--shadow);
    margin-top: -1px;
    z-index: 50;
    overflow: hidden;
}
.search-panel.open {
    display: grid;
}
.search-panel-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light);
    min-width: 0;
}
.search-panel-col:last-child {
    border-right: none;
}
.search-panel-col-header {
    padding: 10px 12px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.search-panel-icon-filter { color: #e74c3c; display: inline-flex; }
.search-panel-icon-groupby { color: #2ecc71; display: inline-flex; }
.search-panel-icon-fav { color: #f59e0b; display: inline-flex; }
.search-panel-col-body {
    padding: 6px 0;
    overflow-y: auto;
    max-height: 350px;
    flex: 1;
}
.search-panel-group-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-faint);
    padding: 6px 12px 3px;
    font-weight: 600;
}
.search-panel-sep {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 4px 12px;
}
.search-panel-item {
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 0;
    transition: background .1s;
}
.search-panel-item:hover {
    background: var(--bg-hover);
}
.search-panel-item.active {
    background: #ede9fe;
    color: #7c3aed;
    font-weight: 500;
}
.search-panel-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    font-size: 11px;
    font-weight: 700;
    color: #7c3aed;
    flex-shrink: 0;
}
.search-panel-gb-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}
.search-panel-gb-clear {
    padding: 6px 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-faint);
    cursor: pointer;
    text-align: center;
}
.search-panel-gb-clear:hover {
    color: #7c3aed;
}
.search-panel-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-faint);
    padding: 2px 6px;
    flex-shrink: 0;
    line-height: 1;
    transition: color .15s;
    display: inline-flex;
    align-items: center;
}
.search-panel-toggle:hover {
    color: var(--text);
}

/* Responsive: stack panel columns vertically on mobile */
@media (max-width: 768px) {
    .search-panel {
        grid-template-columns: 1fr;
    }
    .search-panel-col {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    .search-panel-col:last-child {
        border-bottom: none;
    }
    .search-panel-col-body {
        max-height: 200px;
    }
}

.search-bar-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px 1px 8px;
    background: #ede9fe;
    color: #7c3aed;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-bar-pill-x {
    background: none;
    border: none;
    cursor: pointer;
    color: #7c3aed;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
}

.search-bar-pill-x:hover {
    opacity: 1;
}

.search-bar-clear-all {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-faint);
    padding: 2px 4px;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.search-bar-clear-all:hover {
    color: var(--text);
}

/* ─── List View Group Headers ─── */
.list-view-group-header td {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 12px;
    color: #333;
    padding: 8px 12px;
    border-top: 2px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.list-view-group-header td:hover {
    background: #eee;
}

.list-view-group-toggle {
    display: inline-block;
    width: 16px;
    font-size: 10px;
    transition: transform 0.15s;
}

.list-view-group-toggle.collapsed {
    transform: rotate(-90deg);
}

.list-view-group-count {
    font-weight: 400;
    color: #999;
    font-size: 11px;
    margin-left: 6px;
}

/* Nested group depth styling */
.list-view-group-depth-1 td {
    background: #fafafa;
    border-top: 1px solid #e5e5e5;
    font-size: 11px;
}
.list-view-group-depth-2 td {
    background: #fff;
    border-top: 1px solid #eee;
    font-size: 11px;
    font-weight: 500;
}

/* ─── Search Bar: Saved Views (used inside Favorites panel col) ─── */

.search-bar-views-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    padding: 8px 12px 4px;
}

.search-bar-view-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 0 4px;
}

.search-bar-view-item:hover {
    background: #f5f5f5;
}

.search-bar-view-item.active {
    background: #ede9fe;
}

.search-bar-view-name {
    flex: 1;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-bar-view-default {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    color: #7c3aed;
    background: #ede9fe;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.search-bar-view-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.search-bar-view-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .15s;
    display: inline-flex;
    align-items: center;
}

.search-bar-view-item:hover .search-bar-view-action-btn {
    opacity: 1;
}

/* Keep favorited star always visible + fill SVG */
.search-bar-view-action-btn.active {
    opacity: 1;
    color: #f59e0b;
}
.search-bar-view-action-btn.active svg {
    fill: #f59e0b;
}

.search-bar-view-action-btn:hover {
    color: #333;
    background: #e5e5e5;
}

.search-bar-views-save-btn {
    padding: 8px 12px;
    border-top: 1px solid #eee;
    font-size: 13px;
    font-weight: 500;
    color: #7c3aed;
    cursor: pointer;
    text-align: center;
}

.search-bar-views-save-btn:hover {
    background: #faf5ff;
}

.search-bar-views-empty {
    padding: 16px 12px;
    text-align: center;
    font-size: 12px;
    color: #999;
}

/* ─── Gantt Grid ─── */
.gantt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.gantt-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gantt-container {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px var(--shadow);
}

.gantt-sidebar {
    flex-shrink: 0;
    border-right: 2px solid var(--border);
    background: var(--bg-surface);
    z-index: 2;
    overflow: hidden;
}

.gantt-sidebar-header {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    padding: 0 12px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gantt-sidebar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-faint);
    overflow: hidden;
    transition: background 0.1s;
}

.gantt-sidebar-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.gantt-sidebar-sublabel {
    font-size: 10px;
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--bg-page);
    padding: 1px 6px;
    border-radius: 3px;
    line-height: 1.3;
}

.gantt-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-page);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border);
    border-top: 2px solid var(--border);
    transition: background 0.1s;
}

.gantt-group-header:first-child {
    border-top: none;
}

.gantt-group-header:hover {
    background: var(--bg-hover);
}

.gantt-group-header.collapsed {
    opacity: 0.7;
}

.gantt-group-toggle {
    font-size: 10px;
    color: var(--text-faint);
    width: 14px;
    text-align: center;
    transition: transform 0.15s ease;
}

.gantt-group-header.collapsed .gantt-group-toggle {
    transform: rotate(-90deg);
}

.gantt-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
}

.gantt-grid {
    position: relative;
}

.gantt-header-row {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.gantt-header-top {
    border-bottom: 1px solid var(--border);
}

.gantt-scale-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #7c3aed;
    border-right: 1px solid var(--border-faint);
    letter-spacing: 0.3px;
}

.gantt-scale-top {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    border-right-color: var(--border);
}

.gantt-day-labels {
    border-bottom: 1px solid var(--border);
}

.gantt-day-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-faint);
    border-right: 1px solid var(--border-faint);
    font-variant-numeric: tabular-nums;
}

.gantt-today-col {
    background: rgba(124, 58, 237, 0.08);
    font-weight: 700;
    color: #7c3aed;
}

.gantt-weekend-col {
    background: rgba(0,0,0,0.03);
    color: #bbb;
}

.gantt-weekend-cell {
    background: repeating-linear-gradient(
        90deg,
        rgba(0,0,0,0.025) 0px,
        rgba(0,0,0,0.025) 1px,
        transparent 1px,
        transparent 4px
    );
}

.gantt-grid-group {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    border-top: 2px solid var(--border);
}

.gantt-grid-row {
    border-bottom: 1px solid var(--border-faint);
}

.gantt-day-cell {
    position: absolute;
    top: 0;
    height: 100%;
    border-right: 1px solid rgba(0,0,0,0.04);
}

.gantt-day-cell-monday {
    border-left: 1px solid rgba(0,0,0,0.1);
}

.gantt-timeoff-cell {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(249, 115, 22, 0.06) 4px,
        rgba(249, 115, 22, 0.06) 8px
    );
}

.gantt-timeoff-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(249, 115, 22, 0.03);
}

.gantt-bar {
    position: absolute;
    top: 5px;
    height: 26px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    cursor: pointer;
    z-index: 1;
    overflow: hidden;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    background-image: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.05) 100%);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.gantt-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    z-index: 2;
}

.gantt-bar:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Left accent stripe */
.gantt-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 5px 0 0 5px;
    background: rgba(0,0,0,0.2);
}

.gantt-bar-label {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    padding-left: 4px;
    line-height: 1;
}

/* Plan bars: solid fill (default) */
.gantt-bar-plan {
    /* Solid color — already handled by inline background + gradient overlay */
}

/* Task bars: subtle diagonal hash to distinguish from plans */
.gantt-bar-task {
    background-image:
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 4px,
            rgba(255,255,255,0.1) 4px,
            rgba(255,255,255,0.1) 8px
        ),
        linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.05) 100%);
}

/* Priority indicators */
.gantt-bar-priority {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}
.gantt-bar-priority--high { background: #ef4444; }
.gantt-bar-priority--medium { background: #f59e0b; }
.gantt-bar-priority--low { background: #22c55e; }

/* Status dot inside task bars */
.gantt-bar-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
    background: #9ca3af; /* default: grey */
}

/* Per-status dot colors */
.gantt-bar-status-new .gantt-bar-status-dot,
.gantt-bar-status-assigned .gantt-bar-status-dot { background: #9ca3af; }
.gantt-bar-status-in_progress .gantt-bar-status-dot { background: #facc15; }
.gantt-bar-status-review .gantt-bar-status-dot { background: #c084fc; }
.gantt-bar-status-closed .gantt-bar-status-dot { background: #4ade80; }
.gantt-bar-status-rejected .gantt-bar-status-dot { background: #f87171; }

/* Closed tasks: reduced opacity + strikethrough pattern */
.gantt-bar-status-closed {
    opacity: 0.6;
}

.gantt-bar-status-closed::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(255,255,255,0.15) 3px,
        rgba(255,255,255,0.15) 6px
    );
}

.gantt-meeting-dot {
    position: absolute;
    top: 10px;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #7c3aed;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 1px #7c3aed, 0 1px 3px rgba(124,58,237,0.3);
    cursor: pointer;
    z-index: 2;
    transform: rotate(45deg);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gantt-meeting-dot:hover {
    transform: rotate(45deg) scale(1.2);
    box-shadow: 0 0 0 2px #7c3aed, 0 2px 8px rgba(124,58,237,0.4);
}

.gantt-today-line {
    position: absolute;
    width: 2px;
    background: linear-gradient(180deg, #dc2626, rgba(220,38,38,0.3));
    z-index: 3;
    pointer-events: none;
}

.gantt-today-line::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -3px;
    width: 8px;
    height: 8px;
    background: #dc2626;
    border-radius: 50%;
}

/* ─── Gantt Row Hover & Alternating Rows ─── */
.gantt-grid-row:nth-child(even) {
    background: rgba(0,0,0,0.015);
}

.gantt-sidebar-row:nth-child(even) {
    background: rgba(0,0,0,0.015);
}

.gantt-grid-row:hover {
    background: rgba(124, 58, 237, 0.04);
}

.gantt-sidebar-row:hover {
    background: rgba(124, 58, 237, 0.04);
}

/* ─── Gantt Tooltip ─── */
.gantt-tooltip {
    position: fixed;
    z-index: 1000;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    pointer-events: none;
    font-size: 12px;
    max-width: 240px;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gantt-tooltip.visible {
    opacity: 1;
}

.gantt-tooltip-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.gantt-tooltip-meta {
    color: var(--text-muted);
    font-size: 11px;
}

.gantt-tooltip-color {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ─── Gantt Collapse Animation ─── */
.gantt-sidebar-row,
.gantt-grid-row {
    transition: max-height 0.2s ease, opacity 0.2s ease;
    max-height: 200px; /* accommodate stacked bar lanes */
    overflow: hidden;
}

.gantt-sidebar-row.collapsed-row,
.gantt-grid-row.collapsed-row {
    max-height: 0;
    opacity: 0;
    border: none;
}

/* ─── Gantt Toolbar Refinements ─── */
.gantt-nav .btn-sm {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
}

.gantt-nav .btn-sm[data-dir="0"] {
    min-width: auto;
    padding: 3px 12px;
    font-weight: 500;
}

.gantt-scale-toggle button.active {
    background: #7c3aed;
    color: #fff;
    font-weight: 600;
}

/* ─── Gantt Responsive ─── */
@media (max-width: 768px) {
    .gantt-sidebar {
        width: 120px !important;
    }

    .gantt-sidebar-sublabel {
        display: none;
    }

    .gantt-sidebar-label {
        font-size: 11px;
    }

    .gantt-scale-cell {
        font-size: 10px;
    }

    .gantt-bar-label {
        font-size: 9px;
    }

    .gantt-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .gantt-sidebar {
        width: 80px !important;
    }

    .gantt-group-header {
        font-size: 10px;
        padding: 5px 8px;
    }

    .gantt-sidebar-label {
        font-size: 10px;
    }

    .gantt-nav {
        order: 2;
    }

    .gantt-scale-toggle {
        order: 1;
        width: 100%;
        justify-content: center;
    }
}

/* ─── Gantt Touch-Friendly ─── */
@media (hover: none) and (pointer: coarse) {
    .gantt-bar {
        min-height: 32px;
        top: 2px;
    }

    .gantt-meeting-dot {
        width: 18px;
        height: 18px;
        top: 8px;
    }

    .gantt-group-header {
        padding: 10px 12px;
        min-height: 44px;
    }
}

/* ═══════════════════════════════════════════════════════════
   Tracker Gantt (Odoo-style) — tg-* prefix
   Flat design: no gradients, no shadows on bars, solid colors
   ═══════════════════════════════════════════════════════════ */

/* ─── TG Design Tokens ─── */
:root {
    --tg-sidebar-width: 220px;
    --tg-row-height: 36px;
    --tg-lane-height: 30px;
    --tg-bar-height: 24px;
    --tg-bar-radius: 4px;
    --tg-header-height: 56px;
    --tg-header-day-height: 84px;
    --tg-today-bg: rgba(245, 158, 11, 0.06);
    --tg-today-line: #f59e0b;
    --tg-weekend-bg: rgba(0, 0, 0, 0.02);
    --tg-grid-line: rgba(0, 0, 0, 0.04);
    --tg-grid-line-strong: rgba(0, 0, 0, 0.08);
    --tg-popover-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --tg-draft-stripe: repeating-linear-gradient(
        -45deg, transparent, transparent 3px,
        rgba(255,255,255,0.25) 3px, rgba(255,255,255,0.25) 6px
    );
}

[data-theme="dark"] {
    --tg-today-bg: rgba(245, 158, 11, 0.08);
    --tg-weekend-bg: rgba(255, 255, 255, 0.02);
    --tg-grid-line: rgba(255, 255, 255, 0.04);
    --tg-grid-line-strong: rgba(255, 255, 255, 0.08);
    --tg-popover-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --tg-draft-stripe: repeating-linear-gradient(
        -45deg, transparent, transparent 3px,
        rgba(255,255,255,0.15) 3px, rgba(255,255,255,0.15) 6px
    );
}

/* ─── TG Container ─── */
.tg-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

[data-theme="dark"] .tg-container {
    background: var(--bg-surface);
    border-color: var(--border);
}

/* ─── TG Toolbar ─── */
.tg-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}

[data-theme="dark"] .tg-toolbar {
    background: var(--bg-surface);
    border-color: var(--border);
}

.tg-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tg-nav button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.tg-nav button:hover {
    background: var(--bg-muted);
    border-color: var(--border);
}

[data-theme="dark"] .tg-nav button {
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] .tg-nav button:hover {
    background: var(--bg-muted);
}

.tg-date-range {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0 8px;
    white-space: nowrap;
}

[data-theme="dark"] .tg-date-range {
    color: var(--text);
}

.tg-scale-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: var(--bg-muted);
    border-radius: 6px;
    padding: 2px;
}

.tg-scale-toggle button {
    background: none;
    border: none;
    border-radius: 4px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.tg-scale-toggle button:hover {
    color: var(--text);
}

.tg-scale-toggle button.active {
    background: #7c3aed;
    color: #fff;
    font-weight: 600;
}

[data-theme="dark"] .tg-scale-toggle {
    background: #1e293b;
}

[data-theme="dark"] .tg-scale-toggle button {
    color: #94a3b8;
}

[data-theme="dark"] .tg-scale-toggle button:hover {
    color: #e5e7eb;
}

[data-theme="dark"] .tg-scale-toggle button.active {
    background: #7c3aed;
    color: #fff;
}

/* ─── TG Body (sidebar + grid wrapper) ─── */
.tg-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ─── TG Sidebar ─── */
.tg-sidebar {
    width: var(--tg-sidebar-width);
    min-width: 120px;
    border-right: none;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-surface);
    flex-shrink: 0;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge */
    position: relative;
}
.tg-sidebar::-webkit-scrollbar {
    display: none;                  /* Chrome/Safari */
}
.tg-sidebar-resize {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    background: var(--border);
    z-index: 5;
    transition: background 0.15s;
}
.tg-sidebar-resize:hover,
.tg-sidebar-resize.tg-resizing {
    background: var(--primary, #2563eb);
}

[data-theme="dark"] .tg-sidebar {
    background: var(--bg-surface);
    border-color: var(--border);
}

.tg-sidebar-header {
    height: var(--tg-header-height);
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-muted);
    position: sticky;
    top: 0;
    z-index: 2;
}

.tg-sidebar-header.tg-header-day {
    height: var(--tg-header-day-height);
}

[data-theme="dark"] .tg-sidebar-header {
    background: #1e293b;
    color: #94a3b8;
    border-color: var(--border);
}

.tg-group-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: var(--tg-row-height);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--tg-grid-line);
    user-select: none;
    transition: background 0.1s;
}

.tg-group-row:hover {
    background: var(--bg-muted);
}

[data-theme="dark"] .tg-group-row {
    color: var(--text);
    border-color: var(--tg-grid-line);
}

[data-theme="dark"] .tg-group-row:hover {
    background: var(--bg-muted);
}

.tg-group-toggle {
    font-size: 10px;
    color: var(--text-muted);
    width: 12px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.tg-group-row.collapsed .tg-group-toggle {
    transform: rotate(-90deg);
}

.tg-group-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.tg-group-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tg-group-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-group-count {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    flex-shrink: 0;
}

[data-theme="dark"] .tg-group-count {
    color: var(--text-muted);
}

.tg-issue-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px 0 32px;
    height: var(--tg-row-height);
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--tg-grid-line);
    cursor: pointer;
    transition: background 0.1s;
    overflow: hidden;
}

.tg-issue-row:hover {
    background: var(--bg-hover);
    color: var(--text);
}

[data-theme="dark"] .tg-issue-row {
    color: var(--text-muted);
    border-color: var(--tg-grid-line);
}

[data-theme="dark"] .tg-issue-row:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.tg-issue-row.tg-subtask {
    padding-left: 48px;
}

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

.tg-issue-code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-faint);
    flex-shrink: 0;
}

[data-theme="dark"] .tg-issue-code {
    color: var(--text-faint);
}

/* ─── TG Grid Wrapper ─── */
.tg-grid-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* ─── TG Header ─── */
.tg-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .tg-header {
    background: #1e293b;
    border-color: var(--border);
}

.tg-header-tier {
    display: flex;
    border-bottom: 1px solid var(--tg-grid-line);
}

.tg-header-tier:last-child {
    border-bottom: none;
}

.tg-header-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    border-right: 1px solid var(--tg-grid-line);
    height: 28px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.tg-header-cell.tg-month-cell {
    font-weight: 600;
    color: var(--text);
    border-right-color: var(--tg-grid-line-strong);
}

.tg-header-cell.tg-week-cell {
    font-size: 10px;
    color: var(--text-faint);
}

.tg-header-cell.tg-today-header {
    color: var(--tg-today-line);
    font-weight: 700;
}

[data-theme="dark"] .tg-header-cell {
    color: #94a3b8;
    border-color: var(--tg-grid-line);
}

[data-theme="dark"] .tg-header-cell.tg-month-cell {
    color: var(--text);
    border-right-color: var(--tg-grid-line-strong);
}

[data-theme="dark"] .tg-header-cell.tg-week-cell {
    color: var(--text-faint);
}

[data-theme="dark"] .tg-header-cell.tg-today-header {
    color: var(--tg-today-line);
}

/* ─── TG Grid Area ─── */
.tg-grid {
    position: relative;
    min-height: 100%;
}

.tg-grid-row {
    display: flex;
    position: relative;
    height: var(--tg-row-height);
    border-bottom: 1px solid var(--tg-grid-line);
    overflow: hidden;
}

[data-theme="dark"] .tg-grid-row {
    border-color: var(--tg-grid-line);
}

.tg-grid-group-row {
    display: flex;
    position: relative;
    height: var(--tg-row-height);
    border-bottom: 1px solid var(--tg-grid-line);
    background: var(--bg-muted);
}

[data-theme="dark"] .tg-grid-group-row {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--tg-grid-line);
}

.tg-grid-cell {
    height: 100%;
    border-right: 1px solid var(--tg-grid-line);
    flex-shrink: 0;
}

.tg-grid-cell.tg-weekend {
    background: var(--tg-weekend-bg);
}

[data-theme="dark"] .tg-grid-cell.tg-weekend {
    background: var(--tg-weekend-bg);
}

.tg-grid-cell.tg-week-boundary {
    border-right-color: var(--tg-grid-line-strong);
}

.tg-grid-cell.tg-month-boundary {
    border-right-color: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .tg-grid-cell.tg-month-boundary {
    border-right-color: rgba(255, 255, 255, 0.12);
}

/* ─── TG Today Highlight ─── */
.tg-today-col {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--tg-today-bg);
    z-index: 0;
    pointer-events: none;
}

.tg-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--tg-today-line);
    z-index: 2;
    pointer-events: none;
}

/* ─── TG Bars ─── */
.tg-bar {
    position: absolute;
    height: var(--tg-bar-height);
    border-radius: var(--tg-bar-radius);
    background: var(--bar-color);
    z-index: 1;
    overflow: hidden;
    transition: opacity 0.15s ease;
    /* cursor set by JS (grab / col-resize) and CSS drag classes */
}

.tg-bar:hover {
    opacity: 0.85;
    /* No translateY, no box-shadow — flat */
}

.tg-bar:focus-visible {
    outline: 2px solid var(--tg-today-line);
    outline-offset: 1px;
}

.tg-bar-label {
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
    line-height: var(--tg-bar-height);
    /* No text-shadow — flat */
}

/* ─── TG Bar Status Variants ─── */
.tg-bar.tg-status-new {
    background-image: var(--tg-draft-stripe);
}

.tg-bar.tg-status-resolved::before {
    content: '\2713';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: var(--tg-bar-height);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
    margin-left: 4px;
}

.tg-bar.tg-status-closed {
    opacity: 0.5;
}

.tg-bar.tg-status-closed .tg-bar-label {
    text-decoration: line-through;
}

.tg-bar.tg-status-rejected {
    opacity: 0.4;
}

.tg-bar.tg-status-rejected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(220, 38, 38, 0.2);
    border-radius: var(--tg-bar-radius);
    pointer-events: none;
}

/* ─── TG Drag Interactions ─── */
.tg-bar { cursor: grab; }
.tg-bar.tg-dragging { cursor: grabbing; opacity: 0.7; z-index: 10; }
.tg-bar.tg-resizing { cursor: col-resize; z-index: 10; }

.tg-drag-tooltip {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 20;
    pointer-events: none;
    box-shadow: 0 2px 8px var(--shadow);
}

.tg-grid-group-row.tg-drop-target {
    background: rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .tg-grid-group-row.tg-drop-target {
    background: rgba(37, 99, 235, 0.15);
}

/* ─── TG Summary Bar (group header row) ─── */
.tg-summary-bar {
    position: absolute;
    height: 18px;
    border-radius: 3px;
    background: var(--bar-color);
    opacity: 0.3;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.tg-summary-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

[data-theme="dark"] .tg-summary-label {
    color: var(--text);
}

/* ─── TG Popover ─── */
.tg-popover {
    position: absolute;
    z-index: 100;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--tg-popover-shadow);
    min-width: 260px;
    max-width: 340px;
    padding: 0;
    animation: tg-popover-in 0.15s ease;
}

@keyframes tg-popover-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .tg-popover {
    background: var(--bg-surface);
    border-color: var(--border);
    box-shadow: var(--tg-popover-shadow);
}

.tg-popover-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    line-height: 1.4;
}

[data-theme="dark"] .tg-popover-title {
    color: var(--text);
    border-color: var(--border-light);
}

.tg-popover-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tg-popover-fields {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-popover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.tg-popover-label {
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

[data-theme="dark"] .tg-popover-label {
    color: var(--text-muted);
}

.tg-popover-value {
    color: var(--text);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .tg-popover-value {
    color: var(--text);
}

.tg-popover-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-light);
}

[data-theme="dark"] .tg-popover-actions {
    border-color: var(--border-light);
}

.tg-popover-actions .btn {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text);
    transition: background 0.15s;
}

.tg-popover-actions .btn:hover {
    background: var(--bg-muted);
}

.tg-popover-actions .btn-primary {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.tg-popover-actions .btn-primary:hover {
    background: #6d28d9;
    border-color: #6d28d9;
}

[data-theme="dark"] .tg-popover-actions .btn {
    background: var(--bg-muted);
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] .tg-popover-actions .btn:hover {
    background: #374151;
}

[data-theme="dark"] .tg-popover-actions .btn-primary {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

[data-theme="dark"] .tg-popover-actions .btn-primary:hover {
    background: #6d28d9;
}

/* ─── TG Undated Banner ─── */
.tg-undated-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.08);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

[data-theme="dark"] .tg-undated-banner {
    background: rgba(245, 158, 11, 0.06);
    border-color: var(--border);
    color: var(--text-muted);
}

.tg-undated-banner svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.tg-undated-link {
    color: #7c3aed;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
}

.tg-undated-link:hover {
    text-decoration: underline;
}

[data-theme="dark"] .tg-undated-link {
    color: #a78bfa;
}

/* ─── TG Responsive ─── */
@media (max-width: 768px) {
    .tg-sidebar {
        width: 140px !important;
        min-width: 140px !important;
    }

    .tg-issue-row {
        padding-left: 20px;
        font-size: 11px;
    }

    .tg-issue-row.tg-subtask {
        padding-left: 32px;
    }

    .tg-issue-code {
        display: none;
    }

    .tg-group-avatar {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }

    .tg-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }

    .tg-date-range {
        font-size: 12px;
    }

    .tg-scale-toggle {
        margin-left: 0;
    }

    .tg-popover {
        min-width: 220px;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .tg-sidebar {
        width: 100px !important;
        min-width: 100px !important;
    }

    .tg-group-row {
        font-size: 11px;
        padding: 0 8px;
    }

    .tg-group-avatar {
        display: none;
    }

    .tg-nav {
        order: 2;
    }

    .tg-scale-toggle {
        order: 1;
        width: 100%;
        justify-content: center;
    }
}

/* ─── TG Touch-Friendly ─── */
@media (hover: none) and (pointer: coarse) {
    .tg-bar {
        min-height: 30px;
        --tg-bar-height: 30px;
    }

    .tg-bar-label {
        line-height: 30px;
    }

    .tg-group-row {
        min-height: 44px;
    }

    .tg-issue-row {
        min-height: 44px;
    }
}

/* ─── Login Screen ─── */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 380px;
    width: 100%;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #7c3aed;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    border-radius: 12px;
    margin-bottom: 16px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: #888;
    margin-bottom: 32px;
}

.login-btn {
    width: 100%;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
}

/* ─── Navbar User ─── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.nav-user-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #adb5bd;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.nav-user-btn:hover {
    color: #fff;
    background: #343a40;
}

.nav-user-name {
    font-size: 12px;
    color: inherit;
}

.nav-user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
    z-index: 200;
    color: var(--text);
    padding: 12px 14px;
}

.nav-user-dropdown.open { display: block; }

.nav-user-email {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 4px;
}

.nav-user-role-label {
    font-size: 11px;
    font-weight: 600;
    color: #7c3aed;
    margin-bottom: 8px;
}

.nav-user-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 0 0 8px;
}

.nav-user-logout {
    display: block;
    width: 100%;
    padding: 6px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #dc2626;
    text-align: left;
}

.nav-user-logout:hover {
    text-decoration: underline;
}

/* ─── No Access Screen ─── */
.no-access-screen {
    position: fixed;
    inset: 0;
    top: 44px;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    color: var(--text);
}

.no-access-card {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

.no-access-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-access-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.no-access-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ─── Role Badge ─── */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.role-badge-admin { background: #ede9fe; color: #7c3aed; }
.role-badge-user { background: var(--border-faint); color: #999; }

/* ─── Issue Tracker ─── */

/* Standalone detail header */
.issue-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #7c3aed;
    padding: 4px 0;
    margin-bottom: 4px;
}

.issue-back-btn:hover {
    text-decoration: underline;
}

.issue-detail-header {
    display: none;
}

.issue-detail-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    margin: 0 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.issue-detail-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* ─── Issue Nav Arrows ─── */
.issue-nav-arrows {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.issue-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    font-size: 18px;
    line-height: 1;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.issue-nav-btn:hover:not(:disabled) {
    background: #f5f0ff;
    border-color: #7c3aed;
    color: #7c3aed;
}

.issue-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ─── Save Indicator ─── */
.issue-save-indicator {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.issue-save-indicator.dirty,
.issue-save-indicator.saved {
    opacity: 1;
    pointer-events: auto;
}

.save-indicator-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    background: none;
    font-size: 15px;
}

.save-indicator-btn.save-btn {
    color: #7c3aed;
}

.save-indicator-btn.save-btn:hover {
    background: #ede9fe;
}

.save-indicator-btn.revert-btn {
    color: #999;
    font-size: 14px;
    font-weight: 600;
}

.save-indicator-btn.revert-btn:hover {
    color: #dc2626;
    background: #fee2e2;
}

.issue-save-indicator.saved .save-indicator-btn {
    display: none;
}

.save-indicator-status {
    font-size: 12px;
    font-weight: 500;
    color: #16a34a;
    white-space: nowrap;
}

.issue-detail {
    display: flex;
    gap: 20px;
}

.issue-detail-main {
    flex: 3;
    min-width: 0;
}

.issue-detail-sidebar {
    flex: 2;
    min-width: 0;
    border-left: 1px solid var(--border-light);
    padding-left: 20px;
}

/* ─── Checkbox Column ─── */
.list-view-checkbox {
    width: 36px;
    text-align: center;
    padding: 8px 4px !important;
}

.list-view-checkbox input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #7c3aed;
}

/* ─── Inline Bulk Edit ─── */
.list-view table.has-selection td.bulk-editable {
    cursor: pointer;
    position: relative;
}

.list-view table.has-selection td.bulk-editable:hover {
    background: #f5f0ff;
}

.list-view table.has-selection td.bulk-editable:hover .badge {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.bulk-edit-select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #7c3aed;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.bulk-edit-select:focus {
    outline: none;
}

.bulk-edit-date {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #7c3aed;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.bulk-edit-date:focus {
    outline: none;
}

/* ─── Bulk Actions Gear Menu ─── */
.bulk-actions-wrap { position: relative; }
.bulk-actions-btn { white-space: nowrap; }
.bulk-actions-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 160px;
    padding: 4px 0;
    margin-top: 4px;
}
.bulk-actions-dropdown.open { display: block; }
.bulk-action-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    color: #374151;
}
.bulk-action-item:hover { background: var(--bg-muted); }
.bulk-action-item.danger { color: #dc2626; }
.bulk-action-item.danger:hover { background: #fef2f2; }

/* ─── Column Picker ─── */
.col-picker-th { width: 32px; min-width: 32px; padding: 0 !important; text-align: center; }
.col-picker-td { width: 32px; min-width: 32px; padding: 0 !important; }
.col-picker-wrap { position: relative; }
.col-picker-btn {
    font-size: 14px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-faint);
    line-height: 1;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
}
.col-picker-btn:hover { color: var(--text); border-color: var(--text-faint); }
.col-picker-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 20;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 180px;
    padding: 4px 0;
    margin-top: 4px;
}
.col-picker-dropdown.open { display: block; }
.col-picker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.col-picker-item:hover { background: var(--bg-muted); }
.col-picker-divider { height: 1px; background: var(--border-light); margin: 4px 0; }
.col-picker-reset {
    display: block;
    width: 100%;
    border: none;
    background: none;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}
.col-picker-reset:hover { background: var(--bg-muted); color: var(--text); }

/* Column header drag reorder */
th.col-dragging { opacity: 0.4; }
th.col-drag-over { background: var(--bg-hover) !important; box-shadow: inset 0 -2px 0 #7c3aed; }
th.sortable[draggable] { cursor: grab; }
th.sortable[draggable]:active { cursor: grabbing; }

.issue-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.issue-title-display {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    padding: 4px 0;
    cursor: default;
}

.title-pencil-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: none;
    color: #999;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}
.title-pencil-btn:hover {
    color: #7c3aed;
}

.title-row-spacer {
    flex: 1;
}

.meeting-notes-textarea {
    width: 100%;
    min-height: 200px;
    font-family: inherit;
    font-size: 13px;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    resize: vertical;
}
.meeting-notes-textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.meeting-participants-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.meeting-participants-section h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
}
.meeting-participants-section .participants-list {
    gap: 2px;
    margin-bottom: 8px;
}
.meeting-participants-section .participant-row {
    padding: 3px 6px;
    font-size: 12px;
    gap: 6px;
}
.meeting-participants-section .participant-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.meeting-participants-section .participant-required {
    font-size: 11px;
    padding: 1px 4px;
}
.meeting-participants-section .participant-remove {
    font-size: 14px;
    padding: 0;
    line-height: 1;
}
.meeting-participants-section .participants-add {
    margin-bottom: 0;
}
.meeting-participants-section .participants-add .m2o-input {
    font-size: 12px;
    padding: 4px 8px;
}

.participant-type-icon {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    flex-shrink: 0;
}

/* ─── Issue Links Section ─── */
.issue-links-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.issue-links-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.issue-links-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.issue-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 10px;
    background: var(--bg-page);
    border-radius: 4px;
    font-size: 13px;
}
.issue-link-url {
    color: #7c3aed;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.issue-link-url:hover { text-decoration: underline; }
.issue-link-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    padding: 0 2px;
    flex-shrink: 0;
}
.issue-link-remove-btn:hover { color: #ef4444; }
.issue-link-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.link-input {
    font-size: 12px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-page);
    color: var(--text);
}
.link-label-input { width: 100px; flex-shrink: 0; }
.link-url-input { flex: 1; min-width: 0; }

.sidebar-delete-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.issue-seq-prefix {
    font-size: 16px;
    font-weight: 600;
    color: #7c3aed;
    flex-shrink: 0;
}

.issue-title-input {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    background: #fff;
}
.issue-title-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.issue-status-pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
}

.status-pip-btn {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
}
.status-pip-btn:hover:not(.active) {
    border-color: #aaa;
    background: #f5f5f5;
}
.status-pip-btn.active {
    cursor: default;
    font-weight: 600;
    color: #fff;
}
.status-pip-btn.active.status-pip-grey   { background: #6b7280; border-color: #6b7280; }
.status-pip-btn.active.status-pip-blue   { background: #3b82f6; border-color: #3b82f6; }
.status-pip-btn.active.status-pip-yellow { background: #d97706; border-color: #d97706; }
.status-pip-btn.active.status-pip-purple { background: #7c3aed; border-color: #7c3aed; }
.status-pip-btn.active.status-pip-green  { background: #16a34a; border-color: #16a34a; }
.status-pip-btn.active.status-pip-red    { background: #dc2626; border-color: #dc2626; }
.status-pip-btn.active.status-pip-cyan   { background: #0891b2; border-color: #0891b2; }
.status-pip-btn.active.status-pip-orange { background: #ea580c; border-color: #ea580c; }

/* Type badges */
.badge-type-task { background: #dbeafe; color: #2563eb; }
.badge-type-bug { background: #fee2e2; color: #dc2626; }
.badge-type-feature_request { background: #dcfce7; color: #16a34a; }
.badge-type-requirement { background: #dcfce7; color: #16a34a; }
.badge-type-configuration { background: #ede9fe; color: #7c3aed; }
.badge-type-data_migration { background: #fef3c7; color: #92400e; }
.badge-type-testing { background: #cffafe; color: #0891b2; }
.badge-type-training { background: #ccfbf1; color: #0d9488; }

/* Badge color variants for new priorities/statuses */
.badge-cyan { background: #cffafe; color: #0891b2; }
.badge-orange { background: #fff7ed; color: #ea580c; }
.badge-teal { background: #ccfbf1; color: #0d9488; }

/* Comments */
.comments-section {
    margin-bottom: 16px;
}

.comments-section h4,
.activity-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.comment-item {
    background: var(--bg-page);
    border-radius: 6px;
    padding: 8px 12px;
}

.comment-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
}

.comment-card-reply {
    background: var(--bg-page);
    border-color: #e9ecef;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
}

.comment-time {
    color: var(--text-faint);
}

.comment-body {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
    word-break: break-word;
    margin-bottom: 8px;
}

.comment-input {
    display: flex;
    gap: 8px;
}

/* Legacy textarea styles kept for fallback */
.comment-input textarea {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 36px;
}

.comment-input textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.comment-input .btn {
    align-self: flex-end;
}

/* Activity log */
.activity-section {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-item {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.activity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-text {
    flex: 1;
}

.activity-actor {
    font-weight: 600;
    color: var(--text);
}

.activity-time {
    color: var(--text-faint);
    font-size: 11px;
    white-space: nowrap;
}

/* ─── Issue Meta Grid ─── */
.issue-meta-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.issue-meta-grid .form-group {
    margin-bottom: 0;
}

.issue-meta-grid .form-group label {
    font-size: 11px;
    margin-bottom: 2px;
}

.issue-meta-grid .form-group select,
.issue-meta-grid .form-group input {
    padding: 5px 8px;
    font-size: 12px;
}

/* Sidebar meta grid — 2-column reflow */
.issue-detail-sidebar .issue-meta-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

/* ─── Issue Description Section ─── */
.issue-description-section {
    background: #fefdf6;
    border: 1px solid #ece8d4;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

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

.issue-description-header h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.issue-description-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.description-display {
    font-size: 13px;
    color: #444;
    line-height: 1.6;
    min-height: 80px;
}

.description-display img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 8px 0;
}

/* ─── Tiptap Description Editor ─── */
.tiptap-editor-wrap {
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.tiptap-editor-wrap:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.tiptap-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border: none;
    background: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    min-width: 26px;
    height: 26px;
}

.toolbar-btn:hover {
    background: #e9ecef;
    color: #333;
}

.toolbar-btn.active {
    background: #ede9fe;
    color: #7c3aed;
}

.toolbar-separator {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 3px;
}

.tiptap-editor {
    min-height: 80px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 13px;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    resize: vertical;
}

.tiptap-editor .ProseMirror {
    padding: 8px 10px;
    flex: 1;
    cursor: text;
}

/* Remove browser default contenteditable focus outlines */
.tiptap-editor .ProseMirror:focus,
.tiptap-editor .tiptap:focus,
.tiptap-editor [contenteditable]:focus {
    outline: none;
}

.comment-tiptap-editor .ProseMirror:focus,
.comment-tiptap-editor .tiptap:focus,
.comment-tiptap-editor [contenteditable]:focus {
    outline: none;
}

/* ProseMirror node selection (blue outline) */
.ProseMirror-selectednode {
    outline: 2px solid #c4b5fd;
}

/* ─── Tiptap & Rendered Content Styles (editor + display) ─── */

/* Shared typography for .tiptap (editor) and .rendered-content (display) */
.tiptap p, .rendered-content p { margin: 0 0 0.5em 0; line-height: 1.6; }
.tiptap p:last-child, .rendered-content p:last-child { margin-bottom: 0; }
.tiptap h1, .rendered-content h1 { font-size: 1.5em; font-weight: 700; margin: 0.8em 0 0.4em; line-height: 1.3; }
.tiptap h2, .rendered-content h2 { font-size: 1.25em; font-weight: 600; margin: 0.7em 0 0.35em; line-height: 1.3; }
.tiptap h3, .rendered-content h3 { font-size: 1.1em; font-weight: 600; margin: 0.6em 0 0.25em; line-height: 1.4; }
.tiptap ul, .tiptap ol, .rendered-content ul, .rendered-content ol { margin: 0.4em 0; padding-left: 1.5em; }
.tiptap li, .rendered-content li { margin-bottom: 0.2em; line-height: 1.6; }

/* Blockquotes */
.tiptap blockquote, .rendered-content blockquote {
    border-left: 3px solid #7c3aed;
    padding: 8px 14px;
    margin: 0.6em 0;
    background: #f5f3ff;
    border-radius: 0 6px 6px 0;
    color: #4b5563;
}
.tiptap blockquote p:last-child, .rendered-content blockquote p:last-child { margin-bottom: 0; }

/* Code blocks (pre > code) */
.tiptap pre, .rendered-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 8px;
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0.6em 0;
    border: 1px solid #313244;
    position: relative;
    -webkit-overflow-scrolling: touch;
}
.tiptap pre code, .rendered-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
    border: none;
}

/* Language label in code blocks */
.code-lang-label {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 11px;
    font-family: inherit;
    color: #6c7086;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    user-select: none;
}

/* Inline code (backticks) */
.tiptap code, .rendered-content code {
    background: #e8eaed;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', ui-monospace, monospace;
    font-size: 0.875em;
    color: #d63384;
    border: 1px solid #d1d5db;
}

/* Links */
.tiptap a, .rendered-content a { color: #7c3aed; text-decoration: underline; text-underline-offset: 2px; }
.tiptap a:hover, .rendered-content a:hover { color: #6d28d9; }

/* Mentions */
.tiptap .mention, .rendered-content .mention {
    color: #7c3aed;
    font-weight: 600;
    background: #ede9fe;
    padding: 0 3px;
    border-radius: 3px;
}

/* Tables */
.tiptap table, .rendered-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75em 0;
    table-layout: auto;
    overflow: hidden;
}
.tiptap th, .rendered-content th,
.tiptap td, .rendered-content td {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    vertical-align: top;
    text-align: left;
    min-width: 60px;
}
.tiptap th, .rendered-content th {
    background: #f3f4f6;
    font-weight: 600;
    font-size: 0.9em;
}
.tiptap tr:nth-child(even) td, .rendered-content tr:nth-child(even) td {
    background: #f9fafb;
}
/* Editor: selected cell highlight */
.tiptap .selectedCell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(124, 58, 237, 0.12);
    pointer-events: none;
    z-index: 2;
}
.tiptap td, .tiptap th { position: relative; }
/* Responsive table wrapper */
.rendered-content .tableWrapper,
.tiptap .tableWrapper {
    overflow-x: auto;
    margin: 0.75em 0;
    -webkit-overflow-scrolling: touch;
}
.rendered-content .tableWrapper table,
.tiptap .tableWrapper table {
    margin: 0;
}

/* Task lists (checkboxes) */
.tiptap ul[data-type="taskList"],
.rendered-content ul[data-type="taskList"] {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0.5em 0;
}
.tiptap ul[data-type="taskList"] > li,
.rendered-content ul[data-type="taskList"] > li {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 3px 0;
    list-style: none;
}
.tiptap ul[data-type="taskList"] li > label,
.rendered-content ul[data-type="taskList"] li > label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 8px;
    margin-top: 2px;
}
/* Text content next to the checkbox (Tiptap wraps in <div>) */
.tiptap ul[data-type="taskList"] li > div,
.rendered-content ul[data-type="taskList"] li > div {
    flex: 1;
    min-width: 0;
}
.tiptap ul[data-type="taskList"] li > div > p,
.rendered-content ul[data-type="taskList"] li > div > p {
    margin: 0;
}
.tiptap ul[data-type="taskList"] input[type="checkbox"],
.rendered-content ul[data-type="taskList"] input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-top: 1px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
}
.tiptap ul[data-type="taskList"] input[type="checkbox"]:hover,
.rendered-content ul[data-type="taskList"] input[type="checkbox"]:hover {
    border-color: #7c3aed;
}
.tiptap ul[data-type="taskList"] input[type="checkbox"]:checked,
.rendered-content ul[data-type="taskList"] input[type="checkbox"]:checked {
    background: #7c3aed;
    border-color: #7c3aed;
}
.tiptap ul[data-type="taskList"] input[type="checkbox"]:checked::after,
.rendered-content ul[data-type="taskList"] input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
/* Strikethrough + muted color for checked items */
.tiptap ul[data-type="taskList"] li[data-checked="true"] > div,
.rendered-content ul[data-type="taskList"] li[data-checked="true"] > div,
.tiptap ul[data-type="taskList"] li[data-checked="true"] > label > span,
.rendered-content ul[data-type="taskList"] li[data-checked="true"] > label > span {
    text-decoration: line-through;
    color: #9ca3af;
}
[data-theme="dark"] .tiptap ul[data-type="taskList"] input[type="checkbox"],
[data-theme="dark"] .rendered-content ul[data-type="taskList"] input[type="checkbox"] {
    border-color: #4b5563;
}
[data-theme="dark"] .tiptap ul[data-type="taskList"] li[data-checked="true"] > div,
[data-theme="dark"] .rendered-content ul[data-type="taskList"] li[data-checked="true"] > div,
[data-theme="dark"] .tiptap ul[data-type="taskList"] li[data-checked="true"] > label > span,
[data-theme="dark"] .rendered-content ul[data-type="taskList"] li[data-checked="true"] > label > span {
    color: #6b7280;
}

/* Mermaid diagrams */
.mermaid-diagram {
    margin: 0.75em 0;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
    text-align: center;
}
.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
}
pre.mermaid-error {
    border-left: 3px solid #ef4444;
}
[data-theme="dark"] .mermaid-diagram {
    background: #1a1d2e;
    border-color: #2a2f3a;
}

/* Table context toolbar */
.tiptap-table-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 8px;
    background: #f0edfe;
    border: 1px solid #e5e7eb;
    border-top: none;
    flex-wrap: wrap;
    font-size: 12px;
}
.tiptap-table-toolbar .table-action-btn {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
    cursor: pointer;
}
.tiptap-table-toolbar .table-action-btn:hover {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #7c3aed;
}
.tiptap-table-toolbar .table-action-btn.danger {
    color: #dc2626;
}
.tiptap-table-toolbar .table-action-btn.danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* Tiptap placeholder */
.tiptap p.is-editor-empty:first-child::before {
    color: #adb5bd;
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
}

/* ─── Comment Tiptap Editor (minimal, no toolbar) ─── */
.comment-tiptap-editor {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    min-height: 36px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.comment-tiptap-editor .ProseMirror {
    padding: 7px 10px;
    flex: 1;
    cursor: text;
}

.comment-tiptap-editor:focus-within {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.comment-tiptap-editor .tiptap p { margin: 0; }

/* ─── Rendered Comment Content (inherits from .rendered-content above) ─── */
.comment-html .mention {
    color: #7c3aed;
    font-weight: 600;
    background: #ede9fe;
    padding: 1px 4px;
    border-radius: 4px;
}

.comment-plain {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ─── Sidebar Tabs (Comments / Activity) ─── */
.sidebar-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: all 0.15s;
}

.sidebar-tab:hover {
    color: var(--text);
}

.sidebar-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.sidebar-panel {
    display: none;
}

.sidebar-panel.active {
    display: block;
}

/* ─── @Mention Dropdown ─── */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 -4px 16px var(--shadow);
    max-height: 180px;
    overflow-y: auto;
    z-index: 50;
    margin-bottom: 4px;
}

.mention-item {
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mention-item:hover,
.mention-item.active {
    background: #ede9fe;
    color: #7c3aed;
}

.mention-item-name {
    font-weight: 500;
}

/* Highlighted @mentions in comment bodies */
.mention {
    color: #7c3aed;
    font-weight: 600;
    background: #ede9fe;
    padding: 0 3px;
    border-radius: 3px;
}

/* ─── Notification Bell ─── */
.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
}

.notification-bell-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    color: #999;
    opacity: 0.8;
    transition: all 0.15s;
}

.notification-bell-btn:hover {
    color: #fff;
    opacity: 1;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: #dc2626;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 320px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
    z-index: 200;
    color: var(--text);
}

.notification-dropdown.open {
    display: block;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
}

.notification-mark-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: #7c3aed;
    padding: 2px 6px;
}

.notification-mark-all:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-faint);
    cursor: pointer;
    transition: background 0.1s;
}

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

.notification-item:hover {
    background: var(--bg-page);
}

.notification-item.unread {
    background: #faf5ff;
    border-left: 3px solid #7c3aed;
}

.notification-message {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.notification-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.notification-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ─── Issue Attachments Section ─── */
.issue-dates-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.issue-attachments-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.issue-attachments-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-page);
    border-radius: 4px;
    font-size: 13px;
}

.attachment-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.attachment-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.attachment-name a {
    color: #7c3aed;
    text-decoration: none;
}

.attachment-name a:hover {
    text-decoration: underline;
}

.attachment-size {
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
}

.attachment-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    padding: 0 2px;
    flex-shrink: 0;
}

.attachment-delete:hover {
    color: #dc2626;
}

.attachment-dropzone {
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.attachment-dropzone:hover,
.attachment-dropzone.dragover {
    border-color: #7c3aed;
    background: #faf5ff;
    color: #7c3aed;
}

.attachment-dropzone input[type="file"] {
    display: none;
}

/* ─── Attachment Preview Overlay ─── */
.attachment-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.85);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.attachment-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 90vw;
    max-width: 1200px;
    padding: 12px 0;
    color: #fff;
}

.attachment-preview-title {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.attachment-preview-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s;
}

.attachment-preview-btn:hover {
    background: rgba(255,255,255,0.25);
}

.attachment-preview-body {
    width: 90vw;
    max-width: 1200px;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.attachment-preview-body img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.attachment-preview-body iframe {
    width: 100%;
    height: 80vh;
    border: none;
    border-radius: 4px;
    background: #fff;
}

/* ─── Comment Input with @mention (relative wrapper) ─── */
.comment-input-wrap {
    position: relative;
}

/* ─── Full Comment Editor Section (main column) ─── */
.comment-editor-section {
    margin-top: 0;
}

.comment-editor-section .tiptap-editor.comment-editor-body {
    min-height: 60px;
    max-height: 200px;
}

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

.issue-detail-main .comment-list {
    max-height: 500px;
    overflow-y: auto;
}

/* ─── Comment Actions (Reply button) ─── */
.comment-actions {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.comment-reply-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #7c3aed;
    padding: 0;
}

.comment-reply-btn:hover {
    text-decoration: underline;
}
.comment-edit-btn, .comment-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 0;
}
.comment-edit-btn { color: #6b7280; }
.comment-edit-btn:hover { color: #7c3aed; text-decoration: underline; }
.comment-delete-btn { color: #6b7280; }
.comment-delete-btn:hover { color: #ef4444; text-decoration: underline; }
.comment-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-bottom: 4px;
}

/* ─── Subtask Indent Icon (list view) ─── */
.subtask-indent-icon {
    color: #999;
    margin-right: 4px;
    font-size: 12px;
}

/* ─── Issue Parent Banner ─── */
.issue-parent-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #6d28d9;
}

.issue-parent-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6d28d9;
    text-decoration: none;
    font-weight: 500;
}

.issue-parent-link:hover {
    text-decoration: underline;
}

/* ─── Issue Subtasks Section ─── */
.issue-subtasks-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.issue-subtasks-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.subtask-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-page);
    border-radius: 4px;
    font-size: 13px;
}

.subtask-link {
    color: #7c3aed;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subtask-link:hover {
    text-decoration: underline;
}

.subtask-quick-create {
    display: flex;
    gap: 8px;
}

.subtask-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.subtask-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* ─── Issue Relations Section ─── */
.issue-relations-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.issue-relations-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.relation-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.relation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-page);
    border-radius: 4px;
    font-size: 13px;
}

.relation-label {
    font-weight: 500;
    color: #666;
    font-size: 12px;
    flex-shrink: 0;
    min-width: 80px;
}

.relation-issue-link {
    color: #7c3aed;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-issue-link:hover {
    text-decoration: underline;
}

.relation-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    padding: 0 2px;
    flex-shrink: 0;
}

.relation-remove-btn:hover {
    color: #dc2626;
}

.relation-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.relation-add-row select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
}

.relation-add-row select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

/* ─── Many2One (M2O) Autocomplete ─── */
.m2o-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.m2o-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.m2o-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.m2o-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.m2o-clear:hover { color: var(--text); }
.m2o-wrap:has(.m2o-clear) .m2o-input { padding-right: 24px; }

.m2o-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    margin-top: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px var(--shadow);
    z-index: 50;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}

.m2o-group-label {
    padding: 5px 12px 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-faint);
    pointer-events: none;
}

.m2o-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
}

.m2o-item:hover,
.m2o-item.active {
    background: #ede9fe;
    color: #7c3aed;
}

.m2o-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m2o-item-project {
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
}

.m2o-search-more {
    padding: 7px 12px;
    font-size: 13px;
    font-style: italic;
    color: #7c3aed;
    cursor: pointer;
    border-top: 1px solid #eee;
    transition: background 0.1s;
}

.m2o-search-more:hover {
    background: #faf5ff;
}

/* ─── M2O Lookup Modal ─── */
.m2o-modal-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 10px;
}

.m2o-modal-search:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.m2o-modal-list {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.m2o-modal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-faint);
    transition: background 0.1s;
}

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

.m2o-modal-item:hover {
    background: #ede9fe;
}

.m2o-modal-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m2o-modal-item-project {
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
}

/* ─── Profile Page ─── */
.profile-page {
    max-width: 720px;
    margin: 0 auto;
}

.profile-page-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
}

.profile-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
}

.profile-section-title {
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.profile-section-body {
    padding: 16px;
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.profile-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-avatar-info {
    min-width: 0;
}

.profile-display-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.profile-display-email {
    font-size: 13px;
    color: var(--text-muted);
}

.form-hint {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 2px;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profile-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.profile-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.profile-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.profile-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 0;
    cursor: pointer;
}

.profile-checkbox input[type="checkbox"] {
    accent-color: #7c3aed;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    margin-bottom: 20px;
}

/* Profile link in user dropdown */
.nav-user-profile-link {
    display: block;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

.nav-user-profile-link:hover {
    color: #7c3aed;
}

/* ─── Budget Tracking Dashboard ─── */
.tracking-dashboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tracking-quote {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.tracking-quote-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-page);
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    user-select: none;
}

.tracking-quote-header:hover {
    background: #f1f3f5;
}

.tracking-quote-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.tracking-quote-totals {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #666;
}

.tracking-quote-totals span {
    white-space: nowrap;
}

.tracking-quote-body {
    padding: 12px 20px 16px;
}

.tracking-quote-body.collapsed {
    display: none;
}

.tracking-category {
    margin-bottom: 12px;
}

.tracking-category:last-child {
    margin-bottom: 0;
}

.tracking-category-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    padding: 6px 0;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-faint);
}

.tracking-category-totals {
    font-weight: 400;
    color: #aaa;
}

.tracking-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
}

.tracking-line-desc {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #555;
}

.tracking-bar {
    width: 140px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.tracking-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.tracking-bar-fill.green { background: #22c55e; }
.tracking-bar-fill.orange { background: #f59e0b; }
.tracking-bar-fill.red { background: #ef4444; }

.tracking-line-nums {
    width: 110px;
    text-align: right;
    font-size: 12px;
    color: #666;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.tracking-line-pct {
    width: 42px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.tracking-line-pct.green { color: #22c55e; }
.tracking-line-pct.orange { color: #f59e0b; }
.tracking-line-pct.red { color: #ef4444; }

.tracking-line-warn {
    width: 18px;
    font-size: 14px;
    flex-shrink: 0;
    text-align: center;
}

.tracking-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
}

.tracking-summary .ts-label {
    color: #888;
    font-size: 12px;
    margin-right: 4px;
}

.tracking-summary .ts-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.tracking-summary .ts-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
}

/* ─── CSV Import Modal ─── */
.csv-import-area {
    margin-bottom: 16px;
}

.csv-import-area textarea {
    width: 100%;
    min-height: 100px;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 12px;
}

.csv-preview-table th {
    background: var(--bg-page);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

.csv-preview-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-faint);
}

.csv-match {
    color: #22c55e;
}

.csv-nomatch {
    color: #ef4444;
    font-weight: 500;
}

.csv-preview-table select {
    font-size: 12px;
    padding: 2px 4px;
    border: 1px solid #ef4444;
    border-radius: 4px;
}

/* Inline progress bar in list-view cells */
.cell-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cell-progress .tracking-bar {
    width: 80px;
}

.cell-progress-pct {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ─── Scope Module ─── */
.scope-progress-summary {
    background: var(--bg-page);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
}

.scope-progress-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
}

.scope-progress-stats strong {
    color: #1a1a2e;
}

.scope-progress-sep {
    color: #ccc;
}

.scope-ref-badge {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: #7c3aed;
    background: #ede9fe;
    padding: 2px 10px;
    border-radius: 4px;
}

.scope-text-section {
    margin-bottom: 16px;
}

.scope-text-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.scope-text-block {
    background: var(--bg-page);
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 40px;
}

.scope-client-comments {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
}

.scope-client-comments:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.scope-linked-issues {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.scope-linked-issues h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* XLSX import preview */
.xlsx-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.xlsx-preview-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-page);
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #555;
}

.xlsx-preview-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-faint);
}

/* ─── View Switcher ─── */
.view-switcher {
    display: flex;
    gap: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
.view-switcher-btn {
    padding: 6px 10px;
    border: none;
    background: var(--bg-surface);
    cursor: pointer;
    font-size: 16px;
    color: #888;
    transition: background .15s, color .15s;
}
.view-switcher-btn:hover { background: #f3f0ff; color: #7c3aed; }
.view-switcher-btn.active { background: #7c3aed; color: #fff; }

/* ─── Pivot View ─── */
.pivot-config {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.pivot-config-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pivot-config-group label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pivot-config-group select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
}
.pivot-config-group select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
.pivot-table-wrap {
    overflow-x: auto;
}
.pivot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.pivot-table th {
    background: var(--bg-page);
    font-weight: 600;
    text-align: center;
    padding: 8px 12px;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    color: #555;
}
.pivot-table td {
    text-align: center;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-faint);
}
.pivot-table tbody tr:hover {
    background: #f8f5ff;
}
.pivot-corner {
    text-align: left !important;
    font-size: 11px;
    color: #999;
}
.pivot-row-label {
    text-align: left !important;
    font-weight: 500;
    white-space: nowrap;
}
.pivot-total {
    font-weight: 700;
    background: #f4f4f5 !important;
}
.pivot-grand {
    background: #eee !important;
}
.pivot-total-row td {
    border-top: 2px solid #e5e7eb;
}
.pivot-cell {
    position: relative;
}
.pivot-cell-bg {
    position: absolute;
    inset: 0;
    background: #7c3aed;
    pointer-events: none;
    border-radius: 2px;
}
.pivot-cell-val {
    position: relative;
    z-index: 1;
}
.pivot-pct {
    font-size: 11px;
    color: var(--text-faint);
}

/* ─── Kanban Board ─── */
.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    min-height: 400px;
}
.kanban-col {
    min-width: 260px;
    max-width: 300px;
    flex-shrink: 0;
    background: var(--bg-muted);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}
.kanban-col-header {
    padding: 10px 12px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 3px solid;
}
.kanban-col-count {
    background: var(--bg-surface);
    font-size: 11px;
    font-weight: 500;
    padding: 1px 7px;
    border-radius: 10px;
    color: var(--text-muted);
}
.kanban-col-body {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 60px;
}
.kanban-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: grab;
    transition: box-shadow .15s, opacity .15s;
}
.kanban-card:hover {
    box-shadow: 0 2px 8px var(--shadow);
}
.kanban-card-header {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.kanban-card-seq {
    font-size: 11px;
    color: var(--text-faint);
    font-weight: 600;
    flex-shrink: 0;
}
.kanban-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-card-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.kanban-card-footer {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}
/* Drag states */
.kanban-card.dragging {
    opacity: 0.4;
}
.kanban-col.drag-over {
    background: var(--bg-hover);
    outline: 2px dashed #7c3aed;
    outline-offset: -2px;
}

/* ─── Dark Mode Overrides ─── */
[data-theme="dark"] .main-nav { background: #0f172a; }
[data-theme="dark"] .main-nav .nav-brand { color: #6b7280; }
[data-theme="dark"] .nav-search-trigger { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .nav-search-trigger:hover { background: #293548; border-color: #7c3aed; }
[data-theme="dark"] .nav-search-kbd kbd { background: #0f172a; border-color: #475569; color: #94a3b8; }
[data-theme="dark"] .client-selector select { background: #1e293b; border-color: #334155; color: #e5e7eb; }
[data-theme="dark"] .nav-module { color: #94a3b8; }
[data-theme="dark"] .nav-module:hover { background: #1e293b; color: #e5e7eb; }
[data-theme="dark"] .nav-module.active { background: #334155; color: #fff; }
[data-theme="dark"] .nav-user-btn { color: #94a3b8; }
[data-theme="dark"] .nav-user-btn:hover { color: #e5e7eb; background: #1e293b; }

/* Sub-nav & search bar dark */
[data-theme="dark"] .sub-nav { background: var(--bg-surface); border-color: var(--border); }
[data-theme="dark"] .search-bar { background: var(--bg-page); }

/* Modal overlay */
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.6); }

/* Table headers & rows */
[data-theme="dark"] .list-view th { background: var(--bg-muted); color: #9ca3af; border-color: var(--border); }
[data-theme="dark"] .list-view td { border-color: var(--border-faint); }
[data-theme="dark"] .list-view tbody tr:hover { background: var(--bg-muted); }
[data-theme="dark"] .list-view tr.editing td { background: #1e2a40; }

/* ─── Gantt Dark Mode (comprehensive) ─── */
[data-theme="dark"] .gantt-container {
    border-color: var(--border);
}

[data-theme="dark"] .gantt-sidebar {
    background: var(--bg-surface);
    border-color: var(--border);
}

[data-theme="dark"] .gantt-header-row {
    background: var(--bg-muted);
}

[data-theme="dark"] .gantt-sidebar-header {
    background: var(--bg-muted);
    border-color: var(--border);
}

[data-theme="dark"] .gantt-scale-cell {
    border-color: var(--border);
    color: #a78bfa;
}

[data-theme="dark"] .gantt-scale-top {
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .gantt-day-label {
    border-color: var(--border-faint);
    color: var(--text-faint);
}

[data-theme="dark"] .gantt-day-cell {
    border-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .gantt-grid-row {
    border-color: var(--border-faint);
}

[data-theme="dark"] .gantt-grid-row:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

[data-theme="dark"] .gantt-grid-row:hover {
    background: rgba(124, 58, 237, 0.08);
}

[data-theme="dark"] .gantt-sidebar-row {
    border-color: var(--border-faint);
}

[data-theme="dark"] .gantt-sidebar-row:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

[data-theme="dark"] .gantt-sidebar-row:hover {
    background: rgba(124, 58, 237, 0.08);
}

[data-theme="dark"] .gantt-group-header {
    background: var(--bg-muted);
    color: var(--text-muted);
    border-color: var(--border);
}

[data-theme="dark"] .gantt-group-header:hover {
    background: rgba(124, 58, 237, 0.12);
}

[data-theme="dark"] .gantt-grid-group {
    background: var(--bg-muted);
    border-color: var(--border);
}

[data-theme="dark"] .gantt-weekend-col {
    background: rgba(255,255,255,0.04);
    color: var(--text-faint);
}

[data-theme="dark"] .gantt-weekend-cell {
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0.03) 0px,
        rgba(255,255,255,0.03) 1px,
        transparent 1px,
        transparent 4px
    );
}

[data-theme="dark"] .gantt-today-col {
    background: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
}

[data-theme="dark"] .gantt-today-line {
    background: linear-gradient(180deg, #f87171, rgba(248,113,113,0.3));
}

[data-theme="dark"] .gantt-today-line::before {
    background: #f87171;
}

[data-theme="dark"] .gantt-bar {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    background-image: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.15) 100%);
}

[data-theme="dark"] .gantt-bar:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}

[data-theme="dark"] .gantt-meeting-dot {
    border-color: var(--bg-surface);
    box-shadow: 0 0 0 1px #a78bfa, 0 1px 3px rgba(124,58,237,0.4);
}

[data-theme="dark"] .gantt-timeoff-cell {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(249, 115, 22, 0.1) 4px,
        rgba(249, 115, 22, 0.1) 8px
    );
}

[data-theme="dark"] .gantt-sidebar-sublabel {
    background: var(--bg-muted);
    color: var(--text-faint);
}

[data-theme="dark"] .gantt-tooltip {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

[data-theme="dark"] .gantt-scale-toggle button.active {
    background: #7c3aed;
    color: #fff;
}

/* Calendar dark */
[data-theme="dark"] .cal-grid-header { background: var(--bg-muted); }
[data-theme="dark"] .cal-day { border-color: var(--border-faint); }
[data-theme="dark"] .cal-day:hover { background: var(--bg-hover); }
[data-theme="dark"] .cal-day-empty { background: var(--bg-muted); }
[data-theme="dark"] .cal-day-empty:hover { background: var(--bg-muted); }
[data-theme="dark"] .cal-day-today { background: #2d2545; }
[data-theme="dark"] .cal-day-today:hover { background: #382d5c; }
[data-theme="dark"] .cal-group-header { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .cal-group-header:hover { background: #3b4557; }
[data-theme="dark"] .cal-group-body { border-color: var(--border); }

/* Grid container (timeline) dark */
[data-theme="dark"] .grid-container table { background: var(--bg-surface); border-color: var(--border); }
[data-theme="dark"] .grid-container th { background: var(--bg-muted); color: var(--text); }
[data-theme="dark"] .grid-container th,
[data-theme="dark"] .grid-container td { border-color: var(--border); }
[data-theme="dark"] .quarter-header { background: var(--bg-surface) !important; color: var(--text); border-color: var(--text) !important; }
[data-theme="dark"] .month-header { background: var(--bg-muted) !important; }
[data-theme="dark"] th.resource,
[data-theme="dark"] td.resource { background: var(--bg-surface); }
[data-theme="dark"] th.resource { background: var(--bg-muted); }
[data-theme="dark"] tr.group-row td { background: var(--bg-muted) !important; color: var(--text); border-color: var(--text); }

/* Heatmap dark */
[data-theme="dark"] .days-0 { background: var(--bg-surface); color: #4b5563; }
[data-theme="dark"] .days-low { background: #374151; color: #9ca3af; }
[data-theme="dark"] .days-med { background: #4b5563; color: #e5e7eb; }
[data-theme="dark"] .days-high { background: #6b7280; color: #fff; }
[data-theme="dark"] .days-full { background: #e5e7eb; color: #111827; }

/* Group headers in list view */
[data-theme="dark"] .list-view-group-header td { background: var(--bg-muted); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .list-view-group-header td:hover { background: #3b4557; }
[data-theme="dark"] .list-view-group-depth-1 td { background: #1a2234; border-color: var(--border); }
[data-theme="dark"] .list-view-group-depth-2 td { background: var(--bg-surface); border-color: var(--border-light); }

/* Issue detail dark */
[data-theme="dark"] .issue-title-display { color: var(--text); }
[data-theme="dark"] .issue-detail-header-title { color: var(--text); }
[data-theme="dark"] .issue-title-input { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .issue-nav-btn { background: var(--bg-surface); border-color: var(--border); color: #9ca3af; }
[data-theme="dark"] .issue-nav-btn:hover:not(:disabled) { background: var(--bg-hover); }
[data-theme="dark"] .status-pip-btn { background: var(--bg-surface); border-color: var(--border); color: #9ca3af; }
[data-theme="dark"] .status-pip-btn:hover:not(.active) { background: var(--bg-muted); border-color: var(--text-faint); }
[data-theme="dark"] .issue-status-pipeline { border-color: var(--border-light); }
[data-theme="dark"] .issue-title-row { border-color: var(--border); }
[data-theme="dark"] .sidebar-delete-section { border-color: var(--border-light); }
[data-theme="dark"] .meeting-notes-textarea { background: var(--bg-surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .meeting-notes-textarea:focus { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2); }
[data-theme="dark"] .meeting-participants-section { border-color: var(--border-light); }
[data-theme="dark"] .participant-type-icon { color: #9ca3af; }
[data-theme="dark"] .m2o-group-label { color: var(--text-faint); }

/* Issue description dark */
[data-theme="dark"] .issue-description-section { background: #1a1d2e; border-color: #2a2f3a; }
[data-theme="dark"] .description-display { color: var(--text-muted); }

/* Comment card reply dark */
[data-theme="dark"] .comment-card-reply { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .comment-item { background: var(--bg-muted); }
[data-theme="dark"] .comment-body { color: var(--text-muted); }

/* Tiptap editor dark */
[data-theme="dark"] .tiptap-editor-wrap { border-color: var(--border); }
[data-theme="dark"] .tiptap-toolbar { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .toolbar-btn { color: #9ca3af; }
[data-theme="dark"] .toolbar-btn:hover { background: var(--bg-surface); color: var(--text); }
[data-theme="dark"] .toolbar-separator { background: var(--border); }
[data-theme="dark"] .comment-tiptap-editor { border-color: var(--border); background: var(--input-bg); color: var(--text); }
/* Tiptap / rendered content dark overrides */
[data-theme="dark"] .tiptap pre,
[data-theme="dark"] .rendered-content pre { background: #1e1e2e; border-color: #313244; color: #cdd6f4; }
[data-theme="dark"] .tiptap code,
[data-theme="dark"] .rendered-content code { background: #2a2d3e; color: #f38ba8; border-color: #45475a; }
[data-theme="dark"] .tiptap pre code,
[data-theme="dark"] .rendered-content pre code { background: none; color: inherit; border: none; }
[data-theme="dark"] .tiptap blockquote,
[data-theme="dark"] .rendered-content blockquote { background: #1e1b2e; border-color: #7c3aed; color: var(--text-muted); }
[data-theme="dark"] .tiptap a,
[data-theme="dark"] .rendered-content a { color: #a78bfa; }
[data-theme="dark"] .code-lang-label { color: #585b70; }
[data-theme="dark"] .comment-html .mention { background: #2d2545; color: #a78bfa; }

/* Tables dark */
[data-theme="dark"] .tiptap th,
[data-theme="dark"] .rendered-content th,
[data-theme="dark"] .tiptap td,
[data-theme="dark"] .rendered-content td { border-color: #374151; }
[data-theme="dark"] .tiptap th,
[data-theme="dark"] .rendered-content th { background: #1e1b2e; color: var(--text); }
[data-theme="dark"] .tiptap tr:nth-child(even) td,
[data-theme="dark"] .rendered-content tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .tiptap .selectedCell::after { background: rgba(124, 58, 237, 0.2); }
[data-theme="dark"] .tiptap-table-toolbar { background: #1e1b2e; border-color: var(--border); }
[data-theme="dark"] .tiptap-table-toolbar .table-action-btn { background: var(--bg-surface); border-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .tiptap-table-toolbar .table-action-btn:hover { background: #2d2545; border-color: #7c3aed; color: #a78bfa; }
[data-theme="dark"] .tiptap-table-toolbar .table-action-btn.danger { color: #f87171; }
[data-theme="dark"] .tiptap-table-toolbar .table-action-btn.danger:hover { background: #2d1b1b; border-color: #f87171; }

/* Bulk actions / column pickers dark */
[data-theme="dark"] .bulk-action-item { color: var(--text); }
[data-theme="dark"] .bulk-action-item:hover { background: var(--bg-muted); }
[data-theme="dark"] .bulk-action-item.danger:hover { background: #2d1b1b; }
[data-theme="dark"] .col-picker-item:hover { background: var(--bg-muted); }
[data-theme="dark"] .bulk-edit-select,
[data-theme="dark"] .bulk-edit-date { background: var(--input-bg); color: var(--text); }

/* Inline multi-select dark */
[data-theme="dark"] .inline-multi-opt { background: var(--bg-muted); color: var(--text); }
[data-theme="dark"] .inline-multi-opt:hover { background: #4b5563; }

/* Control panel dark */
[data-theme="dark"] .cp-view-btn { border-color: var(--border); color: var(--text-faint); }
[data-theme="dark"] .cp-view-btn:hover { color: var(--text); border-color: var(--text-faint); }
[data-theme="dark"] .cp-view-btn.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }

/* Search bar dark */
[data-theme="dark"] .search-bar-pill { background: #2d2545; color: #a78bfa; }
[data-theme="dark"] .search-bar-pill-x { color: #a78bfa; }
[data-theme="dark"] .search-bar-view-item:hover { background: var(--bg-muted); }
[data-theme="dark"] .search-bar-view-action-btn:hover { background: var(--bg-muted); color: var(--text); }
[data-theme="dark"] .search-bar-views-save-btn { border-color: var(--border-light); }
[data-theme="dark"] .search-bar-views-save-btn:hover { background: var(--bg-hover); }
/* Search panel dark */
[data-theme="dark"] .search-panel { background: var(--bg-surface); border-color: var(--border); }
[data-theme="dark"] .search-panel-col { border-color: var(--border-light); }
[data-theme="dark"] .search-panel-col-header { border-color: var(--border-light); }
[data-theme="dark"] .search-panel-item.active { background: #2d2545; color: #a78bfa; }
[data-theme="dark"] .search-panel-check { color: #a78bfa; }
[data-theme="dark"] .search-panel-gb-clear { border-color: var(--border-light); color: var(--text-faint); }
[data-theme="dark"] .search-panel-gb-clear:hover { color: #a78bfa; }
[data-theme="dark"] .search-panel-sep { border-color: var(--border-light); }

/* Notification dark */
[data-theme="dark"] .notification-item { border-color: var(--border-faint); }
[data-theme="dark"] .notification-item:hover { background: var(--bg-muted); }
[data-theme="dark"] .notification-item.unread { background: #2d2545; }
[data-theme="dark"] .notification-message { color: var(--text); }
[data-theme="dark"] .notification-time { color: var(--text-faint); }
[data-theme="dark"] .notification-empty { color: var(--text-faint); }

/* Attachment/subtask/relation items dark */
[data-theme="dark"] .attachment-item,
[data-theme="dark"] .subtask-item,
[data-theme="dark"] .relation-item { background: var(--bg-muted); }
[data-theme="dark"] .attachment-name { color: var(--text); }
[data-theme="dark"] .attachment-size { color: var(--text-faint); }
[data-theme="dark"] .attachment-delete { color: var(--text-faint); }
[data-theme="dark"] .attachment-dropzone { border-color: var(--border); color: var(--text-faint); }
[data-theme="dark"] .attachment-dropzone:hover,
[data-theme="dark"] .attachment-dropzone.dragover { background: var(--bg-hover); }
[data-theme="dark"] .participant-row { background: var(--bg-muted); }
[data-theme="dark"] .participant-required { background: var(--bg-surface); border-color: var(--border); color: var(--text); }

/* Relation / M2O dark */
[data-theme="dark"] .relation-label { color: var(--text-muted); }
[data-theme="dark"] .relation-add-row select { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .m2o-input { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .m2o-item:hover,
[data-theme="dark"] .m2o-item.active { background: var(--bg-hover); }
[data-theme="dark"] .m2o-search-more { border-color: var(--border-light); }
[data-theme="dark"] .m2o-search-more:hover { background: var(--bg-hover); }
[data-theme="dark"] .m2o-modal-search { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .m2o-modal-list { border-color: var(--border); }
[data-theme="dark"] .m2o-modal-item { border-color: var(--border-faint); }
[data-theme="dark"] .m2o-modal-item:hover { background: var(--bg-hover); }

/* Mention dropdown dark */
[data-theme="dark"] .mention-item:hover,
[data-theme="dark"] .mention-item.active { background: var(--bg-hover); }

/* Org chart dark */
[data-theme="dark"] .org-card-boss { background: #2d2545; border-color: #5b21b6; }
[data-theme="dark"] .org-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,0.3); }
[data-theme="dark"] .org-card-name { color: var(--text); }
[data-theme="dark"] .org-dept-header:hover { background: var(--bg-muted); }
[data-theme="dark"] .org-split-external { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .org-divider { border-color: var(--border); }
[data-theme="dark"] .org-dept-body > .org-dept-section { border-color: var(--border); }

/* Scope module dark */
[data-theme="dark"] .scope-progress-summary { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .scope-text-block { background: var(--bg-muted); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .scope-client-comments { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .scope-linked-issues { border-color: var(--border-light); }

/* Tracking dark */
[data-theme="dark"] .tracking-quote-header { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .tracking-quote-header:hover { background: #3b4557; }
[data-theme="dark"] .tracking-quote-header h3 { color: var(--text); }
[data-theme="dark"] .tracking-quote-totals { color: var(--text-muted); }
[data-theme="dark"] .tracking-line-desc { color: var(--text-muted); }
[data-theme="dark"] .tracking-line-nums { color: var(--text-muted); }
[data-theme="dark"] .tracking-bar { background: var(--bg-muted); }
[data-theme="dark"] .tracking-category-header { border-color: var(--border-faint); }
[data-theme="dark"] .tracking-summary .ts-divider { background: var(--border); }

/* Pivot table dark */
[data-theme="dark"] .pivot-table th { background: var(--bg-muted); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .pivot-table td { border-color: var(--border-faint); }
[data-theme="dark"] .pivot-table tbody tr:hover { background: var(--bg-hover); }
[data-theme="dark"] .pivot-total { background: var(--bg-muted) !important; }
[data-theme="dark"] .pivot-grand { background: #2a2f3a !important; }
[data-theme="dark"] .pivot-corner { color: var(--text-faint); }
[data-theme="dark"] .pivot-row-label { color: var(--text); }
[data-theme="dark"] .pivot-pct { color: var(--text-faint); }

/* Kanban dark */
[data-theme="dark"] .kanban-col { background: var(--bg-muted); }
[data-theme="dark"] .kanban-card { border-color: var(--border); }
[data-theme="dark"] .kanban-col.drag-over { background: var(--bg-hover); outline-color: #7c3aed; }

/* CSV/XLSX import dark */
[data-theme="dark"] .csv-import-area textarea { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .csv-preview-table th,
[data-theme="dark"] .xlsx-preview-table th { background: var(--bg-muted); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .csv-preview-table td,
[data-theme="dark"] .xlsx-preview-table td { border-color: var(--border-faint); }

/* Login card dark — kept white on purpose, it overlays a dark gradient background */

/* Sidebar tabs border dark */
[data-theme="dark"] .sidebar-tabs { border-color: var(--border); }

/* Data table (legacy) dark */
[data-theme="dark"] .data-table th { color: var(--text-faint); }
[data-theme="dark"] .data-table th,
[data-theme="dark"] .data-table td { border-color: var(--border-faint); }

/* View toggle / switcher dark */
[data-theme="dark"] .view-toggle { border-color: var(--border); }
[data-theme="dark"] .view-toggle button { background: var(--bg-surface); color: var(--text-muted); }
[data-theme="dark"] .view-toggle button:not(:last-child) { border-color: var(--border); }
[data-theme="dark"] .view-switcher { border-color: var(--border); }
[data-theme="dark"] .view-switcher-btn:hover { background: var(--bg-hover); }

/* Col resize handle dark */
[data-theme="dark"] .col-resize-handle:hover { border-color: var(--text-faint); }

/* Role badge dark */
[data-theme="dark"] .role-badge-user { background: var(--bg-muted); color: var(--text-faint); }

/* Comment h4 sections */
[data-theme="dark"] .comments-section h4,
[data-theme="dark"] .activity-section h4,
[data-theme="dark"] .issue-attachments-section h4,
[data-theme="dark"] .issue-subtasks-section h4,
[data-theme="dark"] .issue-relations-section h4,
[data-theme="dark"] .issue-links-section h4,
[data-theme="dark"] .issue-description-section h4,
[data-theme="dark"] .issue-description-header h4 { color: var(--text-faint); }

/* ninja-keys dark */
[data-theme="dark"] ninja-keys {
    --ninja-accent-color: #7c3aed;
    --ninja-secondary: var(--bg-muted);
    --ninja-text-color: var(--text);
    --ninja-font-color: var(--text);
    --ninja-modal-background: var(--bg-surface);
    --ninja-footer-background: var(--bg-muted);
}

/* Theme toggle button in nav */
.nav-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    color: #999;
    line-height: 1;
    transition: color 0.15s;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}
.nav-theme-toggle:hover {
    color: #fff;
    background: #343a40;
}
[data-theme="dark"] .nav-theme-toggle:hover {
    background: #1e293b;
}

/* ─── Attachment Grid View ─── */
.attachment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.attachment-header h4 { margin: 0; }

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

.attachment-grid-item {
    background: var(--bg-page);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.15s;
    position: relative;
}
.attachment-grid-item:hover {
    box-shadow: 0 2px 8px var(--shadow);
}

.attachment-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
    border-radius: 6px 6px 0 0;
}

.attachment-thumb-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted);
    color: var(--text-faint);
    border-radius: 6px 6px 0 0;
}

.attachment-grid-name {
    padding: 6px 8px 2px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.attachment-grid-item > .version-badge {
    margin: 0 8px 6px;
}

.attachment-grid-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 2px;
}
.attachment-grid-item:hover .attachment-grid-actions {
    display: flex;
}

.attachment-grid-actions button {
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
}
.attachment-grid-actions button:hover {
    background: rgba(0,0,0,0.7);
}

/* ─── Version Badge ─── */
.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #7c3aed;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    user-select: none;
    flex-shrink: 0;
}
.version-badge:hover {
    background: #6d28d9;
}
.version-badge svg {
    width: 10px;
    height: 10px;
}

/* ─── Versions View (dedicated view mode) ─── */
.attachment-versions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.att-ver-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.att-ver-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-surface);
}
.att-ver-group-header .attachment-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.att-ver-count {
    font-size: 11px;
    color: #7c3aed;
    background: #f5f0ff;
    padding: 1px 7px;
    border-radius: 8px;
    flex-shrink: 0;
    font-weight: 500;
}
.att-ver-timeline {
    margin: 0 0 8px 28px;
    padding: 2px 0;
}
.att-ver-standalone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.att-ver-standalone .attachment-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Version Timeline (inline, below attachment item) ─── */
.version-timeline {
    margin: 0 0 6px 22px;
    padding: 2px 0;
}
.version-tl-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    font-size: 12px;
    position: relative;
    color: var(--text-muted);
}
.version-tl-item.current {
    color: var(--text);
}
.version-tl-node {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    color: var(--border);
}
.version-tl-node svg {
    display: block;
    fill: var(--bg-surface);
}
.version-tl-item.current .version-tl-node {
    color: #7c3aed;
}
.version-tl-item.current .version-tl-node svg {
    fill: var(--bg-surface);
}
/* Vertical connector line between nodes */
.version-tl-item:not(.last) .version-tl-node::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 8px);
    background: #7c3aed;
    z-index: 0;
}
.version-tl-item {
    padding: 4px 0;
}
.version-tl-ver {
    font-weight: 600;
    color: #7c3aed;
    font-size: 11px;
    flex-shrink: 0;
    min-width: 20px;
}
.version-tl-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #7c3aed;
    text-decoration: none;
}
.version-tl-name:hover {
    text-decoration: underline;
}
.version-tl-meta {
    font-size: 10px;
    color: #7c3aed;
    background: #f5f0ff;
    padding: 0 5px;
    border-radius: 8px;
    flex-shrink: 0;
}
.version-tl-meta:empty { display: none; }
.version-tl-ts {
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 10px;
    color: var(--text-faint);
    flex-shrink: 0;
    letter-spacing: -0.3px;
}
.version-tl-size {
    color: var(--text-faint);
    font-size: 11px;
    flex-shrink: 0;
}

.version-badge.open {
    background: #6d28d9;
}

/* ─── Attachment Context Menu ─── */
.attachment-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-faint);
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 4px;
}
.attachment-menu-btn:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.attachment-context-menu {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 180px;
    z-index: 200;
    padding: 4px 0;
}
.attachment-context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.attachment-context-menu-item:hover {
    background: var(--bg-hover);
}
.attachment-context-menu-item.danger {
    color: #dc2626;
}
.attachment-context-menu-item.danger:hover {
    background: #fef2f2;
}

/* ─── Version Suggest Modal ─── */
.version-suggest-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}
.version-suggest-modal {
    background: var(--bg-surface);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 380px;
    max-width: 90vw;
    padding: 20px;
}
.version-suggest-modal h3 {
    margin: 0 0 8px;
    font-size: 15px;
}
.version-suggest-modal p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.version-suggest-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.version-suggest-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.version-suggest-option:hover {
    border-color: #7c3aed;
    background: #faf5ff;
}
.version-suggest-option.selected {
    border-color: #7c3aed;
    background: #f5f0ff;
}
.version-suggest-option input[type="radio"] {
    accent-color: #7c3aed;
}
.version-suggest-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ─── Link-as-version Picker ─── */
.link-version-picker {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}
.link-version-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 4px;
}
.link-version-picker-item:hover {
    border-color: #7c3aed;
}
.link-version-picker-item.selected {
    border-color: #7c3aed;
    background: #f5f0ff;
}

/* ─── Link latest toggle ─── */
.link-latest-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-muted);
}
.link-latest-toggle input[type="checkbox"] {
    accent-color: #7c3aed;
}

/* ─── Dark mode for new attachment styles ─── */
[data-theme="dark"] .attachment-grid-item { background: var(--bg-muted); }
[data-theme="dark"] .attachment-thumb-placeholder { background: var(--bg-page); }
[data-theme="dark"] .attachment-grid-name { color: var(--text); }
[data-theme="dark"] .att-ver-count { background: #2d2545; }
[data-theme="dark"] .version-tl-node svg { fill: var(--bg-surface); }
[data-theme="dark"] .version-tl-meta { background: #2d2545; }
[data-theme="dark"] .attachment-context-menu { background: var(--bg-surface); border-color: var(--border); }
[data-theme="dark"] .attachment-context-menu-item:hover { background: var(--bg-hover); }
[data-theme="dark"] .attachment-context-menu-item.danger:hover { background: #451a1a; }
[data-theme="dark"] .version-suggest-modal { background: var(--bg-surface); }
[data-theme="dark"] .version-suggest-option:hover,
[data-theme="dark"] .version-suggest-option.selected { background: var(--bg-hover); border-color: #7c3aed; }
[data-theme="dark"] .link-version-picker-item:hover,
[data-theme="dark"] .link-version-picker-item.selected { background: var(--bg-hover); border-color: #7c3aed; }
