/* ============================================================================
   CHAOTIC DESIGN SYSTEM
   ============================================================================

   Table of Contents:
   ------------------
   1.  DESIGN TOKENS
   2.  RESET & BASE
   3.  LAYOUT
   4.  AUTH & ONBOARDING
   5.  FORMS & BUTTONS
   6.  NAVIGATION & DROPDOWNS
   7.  LISTS & GRIDS
   8.  MODALS & OVERLAYS
   9.  ISSUE VIEWS
   10. DOCUMENTS
   11. EPICS & SPRINTS
   12. SETTINGS & API KEYS
   13. COMMENTS & ACTIVITY
   14. FILTER BAR & CHIPS
   15. BADGES, LABELS & TOASTS
   16. COMMAND PALETTE
   17. GATE APPROVALS & RITUALS
   18. ANIMATIONS & TRANSITIONS
   19. UTILITIES
   20. RESPONSIVE BREAKPOINTS
   ============================================================================ */

/* ============================================================================
   1. DESIGN TOKENS
   ============================================================================ */

:root {
    /* Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --accent-color: #6366f1;
    --accent-hover: #5558e3;
    --success-color: #238636;
    --warning-color: #d29922;
    --error-color: #f85149;

    /* Spacing scale (4px base) */
    --space-xs: 4px;
    --space-sm: 6px;
    --space-md: 8px;
    --space-lg: 12px;
    --space-xl: 16px;
    --space-2xl: 24px;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-pill: 9999px;
    --radius-circle: 50%;

    /* Font sizes */
    --font-xs: 11px;
    --font-sm: 12px;
    --font-base: 13px;
    --font-md: 14px;
    --font-lg: 16px;
    --font-xl: 18px;
    --font-2xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Layout */
    --sidebar-width: 240px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
}

body.theme-light {
    --bg-primary: #f6f7fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f7;
    --bg-hover: #e6eaf2;
    --text-primary: #0f172a;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border-color: #d5d9e2;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --error-color: #dc2626;
}

/* ============================================================================
   2. RESET & BASE
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* View Transitions API — subtle crossfade between views */
::view-transition-old(root) {
    animation: fade-out 120ms ease-out;
}

::view-transition-new(root) {
    animation: fade-in 120ms ease-in;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Reduce motion: disable animations and transitions for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

/* ============================================================================
   3. LAYOUT
   ============================================================================ */
#app {
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ============================================================================
   4. AUTH & ONBOARDING
   ============================================================================ */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.auth-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-switch {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ============================================================================
   5. FORMS & BUTTONS
   ============================================================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 1.5rem;
}

.form-actions .btn {
    flex: 1;
}

.input-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
    cursor: pointer;
    margin: 0;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Condition builder */
.condition-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.condition-row select,
.condition-row input {
    width: auto;
    flex: 1;
    min-width: 100px;
}

.condition-row .condition-field {
    flex: 1.5;
    min-width: 110px;
}

.condition-row .condition-operator {
    min-width: 90px;
}

.condition-row .condition-value {
    flex: 2;
    min-width: 100px;
}

.condition-row button {
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Main Screen Layout */
#main-screen {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.team-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.team-selector:hover {
    background: var(--bg-hover);
}

/* CHT-1224: persistent WS-outage indicator, shown for as long as the
   reconnect loop is running (see ws.js's onclose/onopen). */
.ws-status-badge {
    display: inline-block;
    margin: 0 0.5rem 0.5rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--warning-color, #f59e0b);
    border: 1px solid var(--warning-color, #f59e0b);
    border-radius: var(--radius-md);
}

.ws-status-badge.hidden {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

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

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

/* CHT-1250: inbox unread-count badge in the sidebar nav item. */
.nav-badge {
    margin-left: auto;
    padding: 0.05rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent-color);
    border-radius: 999px;
    line-height: 1.4;
}

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--bg-hover);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-emoji {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================================================
   6. NAVIGATION & DROPDOWNS
   ============================================================================ */
.dropdown {
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.sidebar-header .dropdown {
    top: 100%;
    margin-top: 0.25rem;
}

.sidebar-footer .dropdown {
    bottom: 100%;
    margin-bottom: 0.25rem;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Mobile header + backdrop (hidden on desktop) */
.mobile-header {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

/* Mobile FAB - hidden on desktop, shown on mobile (CHT-873) */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 140;
    transition: background 0.15s ease, transform 0.15s ease;
}

.mobile-fab:hover {
    background: var(--accent-hover);
}

.mobile-fab:active {
    transform: scale(0.95);
}

.mobile-fab:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    min-height: 100vh;
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.view-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    flex-shrink: 0;
}

.view-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.view-actions select {
    width: auto;
    max-width: 150px;
}

.section-header {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.section-header h3 {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Icons */
.icon {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   7. LISTS & GRIDS
   ============================================================================ */
.list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

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

.list-item-content {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.list-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    flex-wrap: nowrap;
}

.list-item-meta > span {
    white-space: nowrap;
}

.list-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Document groups */
.doc-group {
    margin-bottom: 1.5rem;
}

.doc-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.doc-group-title {
    font-weight: 600;
    color: var(--text-primary);
}

.doc-group-count {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.doc-group-content {
    margin-top: 0.5rem;
}

.grid-item {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

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

.grid-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.grid-item-edit {
    margin-left: auto;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.grid-item:hover .grid-item-edit {
    opacity: 1;
}

.grid-item-edit:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.grid-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.grid-item-title {
    font-weight: 600;
    font-size: 1rem;
}

.grid-item-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.grid-item-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Grid item with checkbox for selection */
.grid-item-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.grid-item-checkbox:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.grid-item-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
    margin: 0;
}

.grid-item[data-doc-id] {
    position: relative;
}

.grid-item[data-doc-id] .grid-item-content {
    cursor: pointer;
}

.grid-item.selected {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}

/* Bulk actions bar */
.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.bulk-actions-bar .bulk-count {
    font-weight: 500;
    color: var(--text-primary);
}

/* View header controls */
.view-header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Filter select styling */
.filter-select {
    padding: 0.375rem 0.625rem;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.15s ease;
}

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

.filter-select:focus {
    /* outline: none removed (CHT-1215) — was beating the global
       *:focus-visible ring by CSS specificity, killing it for keyboard users */
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-status-backlog { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-status-todo { background: #1f2937; color: #9ca3af; }
.badge-status-in_progress { background: #1e3a5f; color: #60a5fa; }
.badge-status-in_review { background: #3b2f63; color: #a78bfa; }
.badge-status-done { background: #14532d; color: #4ade80; }
.badge-status-canceled { background: #450a0a; color: #fca5a5; }

.badge-priority-urgent { background: #7f1d1d; color: #fca5a5; }
.badge-priority-high { background: #713f12; color: #fcd34d; }
.badge-priority-medium { background: #1e3a5f; color: #60a5fa; }
.badge-priority-low { background: #14532d; color: #4ade80; }
.badge-priority-no_priority { background: var(--bg-tertiary); color: var(--text-secondary); }

.badge-sprint-planned { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-sprint-active { background: #1e3a5f; color: #60a5fa; }
.badge-sprint-completed { background: #14532d; color: #4ade80; }

/* ============================================================================
   8. MODALS & OVERLAYS
   ============================================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.modal-wide {
    max-width: 700px;
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

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

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body .btn {
    width: 100%;
    margin-top: 1rem;
}

/* ============================================================================
   9. ISSUE VIEWS
   ============================================================================ */
.issue-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.issue-identifier {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.issue-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.issue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.issue-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.issue-meta-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.issue-description {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
}

.issue-comments {
    margin-top: 2rem;
}

.issue-comments h4 {
    margin-bottom: 1rem;
}

.comment {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 500;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.comment-content {
    white-space: pre-wrap;
}

.mention {
    color: var(--accent-color);
    font-weight: 600;
}

.mention-suggestions {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mention-suggestions.hidden {
    display: none;
}

.mention-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    font-size: var(--font-base);
}

.mention-suggestion:hover,
.mention-suggestion.highlighted {
    border-color: var(--border-color);
    background: var(--bg-tertiary);
}

.mention-handle {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* ============================================================================
   10. DOCUMENTS
   ============================================================================ */
.document-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.document-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.document-detail-header {
    margin-bottom: 2rem;
}

.document-detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.document-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.document-content {
    line-height: 1.8;
    max-width: 65ch;
}

/* Markdown content styling */
.document-content.markdown-body h1,
.document-content.markdown-body h2,
.document-content.markdown-body h3,
.document-content.markdown-body h4,
.document-content.markdown-body h5,
.document-content.markdown-body h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.document-content.markdown-body h1 { font-size: 2em; }
.document-content.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.document-content.markdown-body h3 { font-size: 1.25em; }
.document-content.markdown-body h4 { font-size: 1em; }

.document-content.markdown-body p {
    margin-bottom: 1em;
}

.document-content.markdown-body ul,
.document-content.markdown-body ol {
    padding-left: 2em;
    margin-bottom: 1em;
}

.document-content.markdown-body li {
    margin-bottom: 0.25em;
}

.document-content.markdown-body code {
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.document-content.markdown-body pre {
    background: var(--bg-tertiary);
    padding: 1em;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 1em;
}

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

.document-content.markdown-body blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1em;
    margin-left: 0;
    margin-bottom: 1em;
    color: var(--text-secondary);
}

.document-content.markdown-body a {
    color: var(--accent-color);
}

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

.document-content.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
}

.document-content.markdown-body th,
.document-content.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 0.5em 1em;
    text-align: left;
}

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

.document-content.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5em 0;
}

.document-content.markdown-body img {
    max-width: 100%;
    height: auto;
}

/* Linked Items Section */
.linked-issues-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    max-width: 65ch;
}

.linked-issues-section h3 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.linked-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.linked-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.linked-item-id {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary);
}

.linked-item-title {
    flex: 1;
}

.btn-tiny {
    padding: 0.15rem 0.5rem;
    font-size: 0.8rem;
}

.empty-state-small {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* Link Results (for modal) */
.link-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
}

.link-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.link-result-item:hover {
    background: var(--bg-secondary);
}

.link-result-id {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary);
}

.link-result-title {
    flex: 1;
}

/* Selected issue display for relation modal */
.selected-issue-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
}

.selected-issue-label {
    font-weight: 600;
    color: var(--success);
}

#selected-issue-info {
    flex: 1;
    font-family: monospace;
}

/* Approvals explainer (CHT-766) */
.approvals-explainer {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.approvals-explainer h3 {
    text-align: center;
}

.approvals-explainer .explainer-details {
    margin: 1rem 0;
    line-height: 1.6;
}

.approvals-explainer .explainer-details ul {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
}

.approvals-explainer .explainer-details li {
    margin-bottom: 0.3rem;
}

.approvals-explainer .btn {
    display: block;
    margin: 1rem auto 0;
}

/* ============================================================================
   15. BADGES, LABELS & TOASTS
   ============================================================================ */

/* Toast */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2000;
}

.toast {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

.toast-error {
    border-color: var(--error-color);
}

.toast-warning {
    border-color: var(--warning-color, #f59e0b);
}

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.toast-exit {
    animation: slideOut 0.25s ease forwards;
}

/* ============================================================================
   16. COMMAND PALETTE
   ============================================================================ */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    z-index: 3000;
    animation: fadeIn 0.1s ease;
}

.command-palette {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 16px 70px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: scaleIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.command-input-wrapper {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.command-input-wrapper svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.command-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-lg);
    outline: none;
}

.command-input::placeholder {
    color: var(--text-muted);
}

.command-results {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}

.command-group {
    margin-bottom: 8px;
}

.command-group-title {
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.1s;
}

.command-item:hover,
.command-item.selected {
    background: var(--bg-hover);
}

.command-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.command-item-content {
    flex: 1;
    min-width: 0;
}

.command-item-title {
    font-size: var(--font-md);
    color: var(--text-primary);
}

.command-item-subtitle {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.command-item-shortcut {
    font-size: var(--font-xs);
    color: var(--text-muted);
    display: flex;
    gap: 4px;
}

.command-item-shortcut kbd {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.command-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}

/* ============================================================================
   18. ANIMATIONS & TRANSITIONS
   ============================================================================ */
* {
    transition-property: background-color, border-color, color, opacity;
    transition-duration: 0.15s;
    transition-timing-function: ease;
}

/* Override for elements that shouldn't animate */
input, textarea, select, .command-input {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Loading spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-tertiary);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Improved list item hover */
.list-item {
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.list-item:hover {
    border-left-color: var(--accent-color);
    transform: translateX(2px);
}

/* Quick action buttons on list items */
.list-item-actions {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.list-item:hover .list-item-actions {
    opacity: 1;
}

/* Inline status/priority selectors */
.inline-select {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-size: var(--font-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    width: auto;
    flex-shrink: 0;
}

.inline-select:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.inline-select:focus {
    /* outline: none removed (CHT-1215) — see .filter-select:focus above */
    border-color: var(--accent-color);
}

/* Gate approval modal */
.gate-approval-modal {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gate-approval-issue {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

.gate-approval-issue-header {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.gate-approval-issue-id {
    font-weight: 600;
    color: var(--accent-color);
}

.gate-approval-issue-title {
    color: var(--text-primary);
}

.gate-approval-view-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.gate-approval-view-link:hover {
    color: var(--accent-color);
}

.gate-approval-ritual {
    border-left: 3px solid var(--accent-color);
    padding-left: 1rem;
}

.gate-approval-prompt {
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.gate-approval-requested {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Better modal animations */
.modal-overlay {
    animation: fadeIn 0.15s ease;
}

.modal {
    animation: modalSlideIn 0.2s ease;
}

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

/* Focus visible styles */
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Keyboard shortcut hints */
.kbd-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-family: inherit;
    color: var(--text-muted);
}

/* Keyboard shortcuts help overlay (CHT-1145) */
.shortcuts-help {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.shortcut-group-title {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    padding: 0.2rem 0;
}

.shortcut-description {
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

.shortcut-separator {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin: 0 0.1rem;
}

@media (max-width: 600px) {
    .shortcuts-help {
        grid-template-columns: 1fr;
    }
}

/* Improved empty states (CHT-1146) */
.empty-state {
    animation: fadeIn 0.3s ease;
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    margin-bottom: 1rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-cta {
    margin-top: 1rem;
}

/* CHT-1224: error variant — visually distinguishes a failed load from a
   genuinely empty collection (previously identical-looking). */
.empty-state-error .empty-state-icon {
    color: var(--error-color);
    opacity: 0.8;
}

.empty-state-error h3 {
    color: var(--error-color);
}

/* CHT-1224 (PR #211 review finding 3): error-tinted inline failure markers
   for the small non-empty-state surfaces — dropdown options and sidebar
   slots — where a failed lookup must not look like genuinely-empty data. */
.dropdown-option-error {
    color: var(--error-color);
}

.sidebar-load-error {
    color: var(--error-color);
}

/* Quick create bar */
.quick-create {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    cursor: text;
    transition: all 0.15s ease;
}

.quick-create:hover,
.quick-create:focus-within {
    border-color: var(--accent-color);
}

.quick-create-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-md);
    outline: none;
}

.quick-create-input::placeholder {
    color: var(--text-muted);
}

.quick-create-hint {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* Back button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    cursor: pointer;
}

.back-button:hover {
    color: var(--text-primary);
}

/* Team member list */
.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.member-details {
    display: flex;
    flex-direction: column;
}

.member-name {
    font-weight: 500;
}

.member-email {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.member-role {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: capitalize;
}

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

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

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

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

/* ============================================
   LINEAR-LIKE ENHANCEMENTS
   ============================================ */

/* Loading skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-hover) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}

.skeleton-list-item .skeleton-title {
    height: 16px;
    width: 60%;
    margin-bottom: 8px;
}

.skeleton-list-item .skeleton-meta {
    height: 12px;
    width: 40%;
}

.skeleton-list-item .skeleton-badge {
    height: 20px;
    width: 70px;
    border-radius: var(--radius-pill);
}

/* List item enter animation */
.list-item {
    animation: listItemEnter 0.2s ease;
}

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

/* Staggered list animation */
.list-item:nth-child(1) { animation-delay: 0ms; }
.list-item:nth-child(2) { animation-delay: 20ms; }
.list-item:nth-child(3) { animation-delay: 40ms; }
.list-item:nth-child(4) { animation-delay: 60ms; }
.list-item:nth-child(5) { animation-delay: 80ms; }
.list-item:nth-child(6) { animation-delay: 100ms; }
.list-item:nth-child(7) { animation-delay: 120ms; }
.list-item:nth-child(8) { animation-delay: 140ms; }
.list-item:nth-child(9) { animation-delay: 160ms; }
.list-item:nth-child(10) { animation-delay: 180ms; }

/* Optimistic update feedback */
.list-item.updating {
    opacity: 0.7;
    pointer-events: none;
}

.list-item.updated {
    animation: flashSuccess 0.5s ease;
}

@keyframes flashSuccess {
    0% { background: var(--bg-secondary); }
    50% { background: rgba(34, 197, 94, 0.1); }
    100% { background: var(--bg-secondary); }
}

/* View transition */
.view {
    animation: viewEnter 0.2s ease;
}

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

/* Improved nav item with subtle indicator */
.nav-item {
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-color);
    border-radius: 0 2px 2px 0;
}

/* Snappy button press effect */
.btn:active {
    transform: scale(0.97);
}

/* Better focus ring */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Smooth hover for grid items */
.grid-item {
    transform: translateY(0);
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Search match highlighting (CHT-1212) */
.search-match {
    background: color-mix(in srgb, var(--accent-color) 30%, transparent);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.issue-search-snippet {
    color: var(--text-muted);
    font-weight: normal;
    font-size: var(--font-base);
}

/* Issue row highlighting for status changes */
.list-item[data-status="done"] {
    opacity: 0.7;
}

.list-item[data-status="done"] .list-item-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.list-item[data-status="canceled"] {
    opacity: 0.5;
}

.list-item[data-status="canceled"] .list-item-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Priority indicator bar */
.list-item[data-priority="urgent"] {
    border-left-color: #ef4444;
}

.list-item[data-priority="high"] {
    border-left-color: #f59e0b;
}

.list-item[data-priority="medium"] {
    border-left-color: #3b82f6;
}

/* Quick status pills - more compact */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot-backlog { background: var(--text-muted); }
.status-dot-todo { background: #9ca3af; }
.status-dot-in_progress { background: #3b82f6; }
.status-dot-in_review { background: #8b5cf6; }
.status-dot-done { background: #22c55e; }
.status-dot-canceled { background: #ef4444; }

/* Improved inline select appearance */
.inline-select {
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
}

/* Contextual actions that appear on hover */
.list-item-hover-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.list-item:hover .list-item-hover-actions {
    opacity: 1;
}

.hover-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

/* Toast improvements */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.toast-icon {
    flex-shrink: 0;
}

/* CHT-1224: message + manual dismiss button */
.toast-message {
    flex: 1;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0 0.25rem;
    margin: 0;
    line-height: 1;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-success .toast-icon::before {
    content: '✓';
    color: var(--success-color);
}

.toast-error .toast-icon::before {
    content: '✕';
    color: var(--error-color);
}

.toast-warning .toast-icon::before {
    content: '⚠';
    color: var(--warning-color, #f59e0b);
}

/* Dropdown animation */
.dropdown {
    animation: dropdownEnter 0.15s ease;
    transform-origin: top;
}

@keyframes dropdownEnter {
    from {
        opacity: 0;
        transform: scaleY(0.95);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Project color indicator */
.project-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Filter pills */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-pill:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.filter-pill-remove {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 10px;
}

/* Count badge */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-pill);
    font-size: var(--font-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

/* Subtle pulse for new items */
@keyframes subtlePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
    50% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }
}

.list-item.new {
    animation: listItemEnter 0.2s ease, subtlePulse 2s ease 0.2s;
}

/* Keyboard navigation highlight */
.list-item.keyboard-selected {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

/* Compact mode for lists */
.list.compact .list-item {
    padding: 0.625rem 1rem;
}

.list.compact .list-item-title {
    font-size: 0.875rem;
}

/* Better disabled state */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Micro-interactions for checkboxes/toggles */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

/* Tooltip styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

/* Search box in header */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 150px;
    max-width: 250px;
    flex-shrink: 1;
    transition: all 0.15s ease;
}

.search-box:focus-within {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-base);
    outline: none;
    min-width: 0;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-hint {
    padding: 2px 6px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    color: var(--text-muted);
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: calc(100vh - 150px);
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 150px);
}

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

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: var(--font-base);
}

.kanban-column-count {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.kanban-column-content {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card {
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.kanban-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.kanban-card.drag-over {
    border-color: var(--accent-color);
    background: var(--bg-hover);
}

/* Keyboard navigation highlight (CHT-1215), matching .issue-row.keyboard-selected */
.kanban-card.keyboard-selected {
    border-color: var(--accent-color);
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.kanban-card-title {
    font-size: var(--font-base);
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.kanban-card-identifier {
    color: var(--text-secondary);
}

.kanban-column-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-base);
}

/* Drag and drop visual feedback */
.kanban-column.drag-over {
    background: var(--bg-tertiary);
}

.kanban-column.drag-over .kanban-column-content {
    background: rgba(99, 102, 241, 0.05);
}

/* Column status colors */
.kanban-column[data-status="backlog"] .kanban-column-header { border-left: 3px solid var(--text-muted); }
.kanban-column[data-status="todo"] .kanban-column-header { border-left: 3px solid #9ca3af; }
.kanban-column[data-status="in_progress"] .kanban-column-header { border-left: 3px solid #3b82f6; }
.kanban-column[data-status="in_review"] .kanban-column-header { border-left: 3px solid #8b5cf6; }
.kanban-column[data-status="done"] .kanban-column-header { border-left: 3px solid #22c55e; }

/* Activity log styles */
.issue-activity {
    margin: 2rem 0;
}

.issue-activity h4 {
    margin-bottom: 1rem;
}

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

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-md);
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.activity-text {
    font-size: var(--font-base);
    color: var(--text-secondary);
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.activity-comment-link {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
}

.activity-comment-link:hover {
    text-decoration: underline;
}

.activity-attestation-link {
    cursor: help;
}

.activity-attestation-link:hover {
    text-decoration: underline;
}

.activity-issue-link {
    color: var(--accent-color);
    text-decoration: none;
}

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

.activity-issue-link strong {
    color: var(--accent-color);
}

.activity-actor {
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.activity-time {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.activity-empty,
.comments-empty {
    padding: 4px 0;
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-style: italic;
}

/* Comments-fetch failure state (CHT-1213): visible + retryable instead of
   the section silently disappearing with zero user-facing indication. */
.comments-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--warning-color, #f59e0b);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-sm);
}

/* ========================================
   Linear-style Issue List
   ======================================== */

.issue-list-linear {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.issue-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    min-height: 44px;
    height: auto;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s ease;
    flex-wrap: wrap;
    row-gap: 6px;
}

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

.issue-row:hover {
    background: var(--bg-tertiary);
}

.issue-row.keyboard-selected {
    background: var(--bg-tertiary);
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.issue-row.updating {
    opacity: 0.6;
    pointer-events: none;
}

.issue-row.updated {
    animation: rowFlash 0.4s ease;
}

@keyframes rowFlash {
    0% { background: var(--bg-tertiary); }
    50% { background: rgba(34, 197, 94, 0.1); }
    100% { background: var(--bg-tertiary); }
}

.issue-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    flex-wrap: wrap;
    min-width: 0;
    justify-content: flex-end;
}

/* Icon buttons for priority, status, assignee */
.issue-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.1s ease;
    flex-shrink: 0;
}

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

/* Estimate button and badge */
.estimate-btn {
    width: auto;
    padding: 0 6px;
    min-width: 24px;
}

.estimate-badge {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

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

.estimate-badge.out-of-scale,
.property-value.out-of-scale {
    color: var(--warning, #f59e0b);
    font-style: italic;
}

.sprint-btn {
    width: auto;
    padding: 0 6px;
    min-width: 24px;
}

.sprint-badge {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

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

/* Sprint budget bar (issues view) */
.sprint-budget-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin: 0 0 8px 0;
    font-size: var(--font-base);
    color: var(--text-secondary);
}

.sprint-budget-bar.hidden {
    display: none;
}

.sprint-budget-bar .budget-label {
    font-weight: 500;
    white-space: nowrap;
}

.sprint-budget-bar .budget-progress {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    max-width: 200px;
}

.sprint-budget-bar .budget-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.sprint-budget-bar .budget-progress-fill.budget-warning {
    background: #f59e0b;
}

.sprint-budget-bar .budget-progress-fill.budget-over {
    background: #ef4444;
}

.sprint-budget-bar .budget-text {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sprint-budget-bar.arrears {
    background: #7f1d1d20;
    border: 1px solid #ef444440;
}

.sprint-budget-bar.arrears .budget-text {
    color: #ef4444;
    font-weight: 600;
}

.sprint-budget-bar .arrears-badge {
    background: #78350f;
    color: #fcd34d;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Priority icon colors */
.priority-urgent { color: #ef4444; }
.priority-high { color: #f59e0b; }
.priority-medium { color: #3b82f6; }
.priority-low { color: #9ca3af; }
.priority-none { color: var(--text-muted); }

/* Status icon colors */
.status-backlog { color: var(--text-muted); }
.status-todo { color: #9ca3af; }
.status-in-progress { color: #f59e0b; }
.status-in-review { color: #8b5cf6; }
.status-done { color: #22c55e; }
.status-canceled { color: #ef4444; }

/* Issue identifier */
.issue-row .issue-identifier {
    font-size: var(--font-base);
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace;
    flex-shrink: 0;
    min-width: 65px;
    margin: 0;
}

/* Issue title */
.issue-row .issue-title {
    font-size: var(--font-md);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    margin: 0;
}

/* Ensure all row items align to center baseline */
.issue-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    min-height: 44px;
}

.issue-row .issue-title:hover {
    color: var(--accent-color);
}

/* Done/canceled states */
.issue-row[data-status="done"] .issue-title,
.issue-row[data-status="canceled"] .issue-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.issue-row[data-status="done"],
.issue-row[data-status="canceled"] {
    opacity: 0.7;
}

/* Labels inline */
.issue-labels {
    display: flex;
    gap: 4px;
    flex-shrink: 1;
    overflow: hidden;
}

.issue-label {
    font-size: var(--font-xs);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    white-space: nowrap;
}

.issue-type-badge {
    font-size: var(--font-xs);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    white-space: nowrap;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.issue-type-badge.type-task { background: #1f2937; color: #e5e7eb; }
.issue-type-badge.type-bug { background: #7f1d1d; color: #fecaca; }
.issue-type-badge.type-feature { background: #1e3a5f; color: #93c5fd; }
.issue-type-badge.type-chore { background: #3f3f46; color: #e4e4e7; }
.issue-type-badge.type-docs { background: #14532d; color: #86efac; }
.issue-type-badge.type-tech_debt { background: #4a1d96; color: #d8b4fe; }
.issue-type-badge.type-epic { background: #92400e; color: #fcd34d; }

.label-check {
    width: 16px;
    text-align: center;
    font-size: var(--font-sm);
    flex-shrink: 0;
}

.label-toggle {
    gap: 6px;
}

.label-create-row {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}

.label-create-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-sm);
}

.label-create-input:focus {
    /* outline: none removed (CHT-1215) — see .filter-select:focus above */
    border-color: var(--accent-color);
}

.property-labels-btn {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    text-align: left;
}

/* Date */
.issue-date {
    font-size: var(--font-sm);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Small avatar */
.avatar-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-small.avatar-emoji {
    font-size: var(--font-sm);
}

.assignee-btn svg {
    opacity: 0.5;
}

.assignee-btn:hover svg {
    opacity: 1;
}

/* ========================================
   Inline Dropdown Menu (Linear-style)
   ======================================== */

.inline-dropdown {
    position: fixed;
    z-index: 1000;
    min-width: 200px;
    max-width: min(280px, calc(100vw - 16px));
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: dropdownEnter 0.15s ease;
}

/* Hide dropdown during async positioning to prevent jump */
.inline-dropdown.dropdown-positioning {
    opacity: 0;
    animation: none;
    pointer-events: none;
}

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

.dropdown-header {
    padding: 8px 12px;
    font-size: var(--font-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-base);
    text-align: left;
    cursor: pointer;
    transition: background 0.1s ease;
}

.dropdown-option:hover {
    background: var(--bg-hover);
}

.dropdown-option svg {
    flex-shrink: 0;
}

.dropdown-option span {
    flex: 1;
}

.dropdown-shortcut {
    font-size: var(--font-xs);
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.dropdown-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-base);
}

/* ========================================
   Detail View Layout (Issues, Documents, Epics)
   ======================================== */

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 0;
    min-height: calc(100vh - 60px);
}

.detail-main {
    padding: 24px 40px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.detail-sidebar {
    padding: 24px;
    background: var(--bg-secondary);
    overflow-y: auto;
}

.issue-detail-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-base);
    cursor: pointer;
    padding: 4px 8px;
    margin-left: -8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.back-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.issue-nav-arrows {
    display: flex;
    align-items: center;
    gap: 2px;
}

.issue-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}

.issue-nav-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.issue-nav-counter {
    font-size: var(--font-sm);
    color: var(--text-muted);
    padding: 0 6px;
    min-width: 40px;
    text-align: center;
}

.issue-detail-breadcrumb {
    font-size: var(--font-base);
    color: var(--text-muted);
}

.issue-detail-title {
    font-size: var(--font-2xl);
    font-weight: 600;
    margin: 0 0 32px 0;
    line-height: 1.3;
}

.issue-detail-description {
    margin-bottom: 32px;
}

.issue-detail-description h3,
.issue-detail-section h3 {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.issue-detail-section > h3,
.issue-detail-section > .section-header-collapsible,
.issue-detail-description > h3 {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    padding: 8px 0;
    z-index: 5;
}

.issue-detail-section > .section-header-collapsible h3 {
    margin-bottom: 0;
}

.issue-detail-description .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.description-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    user-select: text;
}

.description-content .text-muted {
    color: var(--text-muted);
    font-style: italic;
}

/* Click-to-edit affordance (CHT-1214): the empty state is the only one
   with a visible cursor/hover cue — the populated state stays plain text
   (no pointer cursor) so it doesn't fight with selecting text to quote. */
.description-content.empty {
    cursor: pointer;
}

.description-content.empty:hover .add-description-link {
    color: var(--accent-color);
    text-decoration: underline;
}

.add-description-link {
    color: var(--text-muted);
}

/* Unsaved-draft cue on the description Edit button (CHT-1214) */
.draft-indicator {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--accent-color);
    color: var(--bg-color);
}

/* Stale-draft-vs-server conflict warning (CHT-1214) */
.description-draft-warning {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--warning-color, #f59e0b);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-sm);
}

/* Markdown styling for descriptions (matching comment-content) */
.description-content code {
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.description-content pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 8px 0;
}

.description-content pre code {
    background: none;
    padding: 0;
    font-size: var(--font-base);
    line-height: 1.4;
}

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

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

.description-content li {
    margin: 4px 0;
    line-height: 1.6;
}

.description-content ul ul,
.description-content ul ol,
.description-content ol ul,
.description-content ol ol {
    margin: 2px 0;
    padding-left: 20px;
}

.description-content p {
    margin: 0 0 8px 0;
}

.description-content p:last-child {
    margin-bottom: 0;
}

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

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

.description-content strong {
    font-weight: 600;
}

.description-content em {
    font-style: italic;
}

.description-content h1,
.description-content h2,
.description-content h3,
.description-content h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.description-content h1 { font-size: 1.3em; }
.description-content h2 { font-size: 1.2em; }
.description-content h3 { font-size: 1.1em; }
.description-content h4 { font-size: 1em; }

.description-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

.description-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

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

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

.description-inline-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.description-inline-editor textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    font-family: var(--font-mono, monospace);
    font-size: var(--font-base);
    line-height: 1.5;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.description-inline-editor textarea:focus {
    /* outline: none removed (CHT-1215) — see .filter-select:focus above */
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.description-inline-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.description-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4px;
    width: fit-content;
}

.editor-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-base);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

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

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

.editor-preview {
    min-height: 220px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.issue-detail-section {
    margin-bottom: 32px;
}

/* Sprint Status Section (CHT-1128) */
.dashboard-sprint-status {
    margin-bottom: 24px;
}

.dashboard-sprint-status .section-header {
    margin-bottom: 12px;
}

.sprint-status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.sprint-status-card {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.sprint-status-card.limbo {
    border-color: var(--warning, #f59e0b);
}

.sprint-status-card.arrears {
    border-color: var(--error, #ef4444);
}

.sprint-status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.sprint-status-project {
    font-size: var(--font-xs);
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sprint-status-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
}

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

.sprint-status-badge.arrears {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error, #ef4444);
}

.sprint-status-name {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.sprint-status-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sprint-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.sprint-progress-fill {
    height: 100%;
    background: var(--accent-color, #6366f1);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.sprint-progress-fill.arrears {
    background: var(--error, #ef4444);
}

.sprint-progress-fill.limbo {
    background: var(--warning, #f59e0b);
}

.sprint-status-points {
    font-size: var(--font-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
}

.sprint-issue-breakdown {
    margin-top: 6px;
}

.sprint-stacked-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-tertiary);
    margin-bottom: 4px;
}

.sprint-stacked-segment {
    height: 100%;
    min-width: 2px;
}

.sprint-stacked-segment.status-done { background: var(--success, #22c55e); }
.sprint-stacked-segment.status-in_review { background: #8b5cf6; }
.sprint-stacked-segment.status-in_progress { background: var(--accent-color, #6366f1); }
.sprint-stacked-segment.status-todo { background: var(--warning, #f59e0b); }
.sprint-stacked-segment.status-backlog { background: var(--text-quaternary, #6b7280); }

.sprint-status-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sprint-count-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.sprint-count-label.status-done { color: var(--success, #22c55e); }
.sprint-count-label.status-in_review { color: #8b5cf6; }
.sprint-count-label.status-in_progress { color: var(--accent-color, #6366f1); }
.sprint-count-label.status-todo { color: var(--warning, #f59e0b); }
.sprint-count-label.status-backlog { color: var(--text-quaternary, #6b7280); }

.dashboard-activity {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.dashboard-activity .section-header {
    margin-bottom: 12px;
}

/* Sidebar Properties */
.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h4 {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar-link-btn {
    margin-top: 8px;
}

.property-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin: 0 -8px;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

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

.property-row:hover {
    background: var(--bg-hover);
}

.property-label {
    font-size: var(--font-base);
    color: var(--text-secondary);
}

.property-value {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-base);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.property-value:hover {
    background: var(--bg-tertiary);
}

.property-value.updated {
    animation: propertyFlash 0.4s ease;
}

@keyframes propertyFlash {
    0% { background: var(--bg-secondary); }
    50% { background: rgba(34, 197, 94, 0.15); }
    100% { background: var(--bg-secondary); }
}

.property-value-static {
    font-size: var(--font-base);
    color: var(--text-primary);
}

.property-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Sidebar Actions */
.sidebar-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-overflow-menu {
    position: relative;
}

.overflow-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.overflow-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-base);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
}

.overflow-menu-item:hover {
    background: var(--bg-hover);
}

.overflow-menu-item.overflow-menu-danger {
    color: var(--error-color);
}

.overflow-menu-item.overflow-menu-danger:hover {
    background: rgba(248, 81, 73, 0.1);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.btn-danger-outline:hover {
    background: rgba(248, 81, 73, 0.1);
}

/* ============================================================================
   13. COMMENTS & ACTIVITY
   ============================================================================ */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 16px;
}

.comment {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-base);
    font-weight: 600;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
    max-width: 720px;
}

.comment + .comment {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-size: var(--font-base);
    font-weight: 500;
    color: var(--text-primary);
}

.comment-date {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.comment-content {
    font-size: var(--font-md);
    line-height: 1.5;
    color: var(--text-primary);
}

/* Markdown styling for comments */
.comment-content code {
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.comment-content pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 8px 0;
}

.comment-content pre code {
    background: none;
    padding: 0;
    font-size: var(--font-base);
    line-height: 1.4;
}

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

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

.comment-content li {
    margin: 4px 0;
    line-height: 1.6;
}

.comment-content ul ul,
.comment-content ul ol,
.comment-content ol ul,
.comment-content ol ol {
    margin: 2px 0;
    padding-left: 20px;
}

.comment-content p {
    margin: 0 0 8px 0;
}

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

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

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

.comment-content strong {
    font-weight: 600;
}

.comment-content em {
    font-style: italic;
}

.comment-content h1,
.comment-content h2,
.comment-content h3,
.comment-content h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.comment-content h1 { font-size: 1.3em; }
.comment-content h2 { font-size: 1.2em; }
.comment-content h3 { font-size: 1.1em; }
.comment-content h4 { font-size: 1em; }

.comment-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

.comment-content table {
    border-collapse: collapse;
    margin: 8px 0;
    font-size: var(--font-base);
}

.comment-content th,
.comment-content td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
}

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

/* Attestation comments styling */
.comment-attestation {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--success-color);
}

.comment-attestation .avatar-attestation {
    background: var(--success-color);
    font-size: var(--font-md);
}

.comment-ritual-badge {
    font-size: var(--font-xs);
    padding: 2px 6px;
    background: var(--success-color);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.issue-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    background-color: rgba(99, 102, 241, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
}

.issue-link:hover {
    background-color: rgba(99, 102, 241, 0.2);
    text-decoration: underline;
}

/* Issue tooltip preview */
.issue-tooltip {
    position: absolute;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    min-width: 250px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: var(--font-base);
}

.issue-tooltip-loading,
.issue-tooltip-error {
    color: var(--text-secondary);
    font-style: italic;
}

.issue-tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.issue-tooltip-id {
    font-weight: 600;
    color: var(--accent-color);
}

.issue-tooltip-type {
    font-size: var(--font-xs);
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
}

.issue-tooltip-estimate {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    margin-left: auto;
}

.issue-tooltip-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.issue-tooltip-meta {
    display: flex;
    gap: 12px;
    font-size: var(--font-sm);
}

.issue-tooltip-status,
.issue-tooltip-priority {
    font-weight: 500;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-form textarea {
    resize: vertical;
    min-height: 80px;
}

.comment-form .btn {
    align-self: flex-start;
}

/* Sticky comment form (bottom of issue detail viewport) */
.comment-form-sticky {
    position: sticky;
    position: -webkit-sticky;
    bottom: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    /* Extend background edge-to-edge, keep content aligned */
    margin: 0 -40px;
    padding: 12px 40px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    z-index: 5;
}

.comment-form-sticky .mention-suggestions {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 40px;
    right: 40px;
    z-index: 10;
}

.comment-form-sticky textarea {
    flex: 1;
    min-width: 0;
    min-height: 36px;
    max-height: 36px;
    padding: 8px 12px;
    font-size: var(--font-base);
    transition: min-height 0.15s ease, max-height 0.15s ease;
    overflow: hidden;
}

.comment-form-sticky textarea:focus {
    min-height: 80px;
    max-height: 200px;
    overflow: auto;
}

.comment-form-sticky .comment-submit-btn {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0;
}

/* Activity in detail view */
.issue-detail-section .activity-list {
    background: transparent;
    border: none;
}

.issue-detail-section .activity-item {
    padding: 8px 0;
    border-bottom: none;
}

/* Parent issue link */
.parent-issue-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-base);
    color: var(--text-muted);
    margin-bottom: 16px;
}

.parent-issue-link svg {
    opacity: 0.5;
}

.parent-issue-link a {
    color: var(--accent-color);
    text-decoration: none;
}

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

/* Sub-issues section */
.sub-issues-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sub-issues-section .section-header h3 {
    margin-bottom: 0;
}

.sub-issues-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-issues-empty {
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-style: italic;
    padding: 4px 0;
}

.sub-issue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease;
}

.sub-issue-item:hover {
    background: var(--bg-tertiary);
}

.sub-issue-status {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sub-issue-id {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sub-issue-title {
    font-size: var(--font-base);
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sub-issue-estimate {
    font-size: var(--font-xs);
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.btn-sm {
    padding: 4px 8px;
    font-size: var(--font-sm);
}

/* Relations section */
.relations-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.relations-section .section-header h3 {
    margin-bottom: 0;
}

.relations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.relations-empty {
    color: var(--text-muted);
    font-size: var(--font-base);
    padding: 8px 0;
}

.relation-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.relation-group-label {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.relation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

.relation-item:hover {
    background: var(--bg-tertiary);
}

.relation-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.relation-item.blocked-by svg {
    color: var(--priority-urgent);
}

.relation-item.blocks svg {
    color: var(--priority-high);
}

.relation-item.relates-to svg {
    color: var(--accent-color);
}

.relation-status {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.relation-link {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--accent-color);
    text-decoration: none;
    flex-shrink: 0;
}

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

.relation-title {
    font-size: var(--font-base);
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-delete {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.relation-item:hover .relation-delete {
    opacity: 1;
}

.relation-delete:hover {
    background: var(--bg-secondary);
    color: var(--priority-urgent);
}

.form-hint {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================================
   20. RESPONSIVE BREAKPOINTS
   ============================================================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }

    .main-content {
        padding: 1rem;
    }

    .kanban-column {
        flex: 0 0 240px;
    }

    .settings-content {
        max-width: 100%;
        padding: 16px;
    }

    .view-header {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .view-header h2 {
        font-size: 1.25rem;
    }

    .epic-table th,
    .epic-table td {
        padding: 8px 10px;
    }
}

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

    .detail-sidebar {
        border-top: 1px solid var(--border-color);
    }

    .detail-main {
        border-right: none;
    }
}

@media (max-width: 768px) {
    /* Hide less critical columns on narrow screens */
    .issue-labels,
    .issue-date,
    .epic-estimate {
        display: none;
    }

    .issue-row-right {
        gap: 4px;
    }

    /* Mobile sidebar: off-canvas drawer */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 0.75rem;
        padding-top: 0;
        padding-bottom: 5rem; /* Space for mobile FAB (CHT-873) */
    }

    /* Mobile header with hamburger */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 0;
        margin-bottom: 4px;
        position: sticky;
        top: 0;
        background: var(--bg-primary);
        z-index: 50;
    }

    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: none;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        color: var(--text-primary);
        cursor: pointer;
        flex-shrink: 0;
    }

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

    /* Touch targets: 44px minimum at tablet breakpoint (CHT-872) */
    .nav-item {
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
    }

    .btn-small {
        min-height: 36px;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    select {
        min-height: 44px;
    }

    /* Hide keyboard shortcut hints on mobile (CHT-873) */
    .search-hint,
    .quick-create-hint {
        display: none;
    }

    /* Mobile FAB for creating issues (CHT-873) */
    .mobile-fab {
        display: flex;
    }

    .mobile-header-title {
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-primary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Sidebar backdrop overlay */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* View header stacking on mobile */
    .view-header {
        flex-direction: column;
        gap: 8px;
    }

    .view-actions {
        width: 100%;
    }

    /* Filter bar stacking */
    .filter-bar-primary {
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-box {
        width: 100%;
    }

    /* Filter dropdown: bottom-sheet on mobile */
    .filter-menu-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        max-height: 70vh;
        border-radius: 12px 12px 0 0;
        flex-direction: column;
        z-index: 300;
    }

    .filter-menu-dropdown::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
    }

    .filter-menu-categories {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-wrap: wrap;
        padding: 6px;
        gap: 4px;
    }

    .filter-menu-category {
        padding: 6px 10px;
        border-radius: var(--radius-md);
        font-size: var(--font-sm);
    }

    .filter-menu-category.active {
        background: var(--accent-color);
        color: #fff;
    }

    .filter-menu-category-arrow {
        display: none;
    }

    .filter-menu-options {
        min-height: 0;
        max-height: 50vh;
    }

    /* Responsive epics: card layout on mobile */
    .epic-table thead {
        display: none;
    }

    .epic-table,
    .epic-table tbody,
    .epic-row,
    .epic-row td {
        display: block;
    }

    .epic-row {
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
    }

    .epic-row td {
        padding: 2px 0;
    }

    .epic-identifier {
        font-size: var(--font-sm);
        color: var(--text-muted);
    }

    .epic-title {
        font-size: 15px;
        font-weight: 500;
        margin-bottom: 4px;
    }

    .epic-status {
        display: inline-block;
    }

    /* Constrain filter selects on mobile */
    .filter-select {
        min-width: 0;
        max-width: 160px;
    }

    /* Issue rows: more breathing room */
    .issue-row {
        padding: 10px 8px;
    }

    /* Sticky comment form: stack vertically on mobile */
    .comment-form-sticky {
        flex-direction: column;
    }

    .comment-form-sticky .comment-submit-btn {
        align-self: flex-end;
    }
}

/* Phone-specific refinements */
@media (max-width: 640px) {
    .main-content {
        padding: 0.5rem;
        padding-top: 0;
    }

    .view-header h2 {
        font-size: 1.125rem;
    }

    /* Full-screen modals on phone */
    .modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-overlay {
        align-items: stretch;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Onboarding */
    .onboarding-container {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
    }

    .onboarding-overlay {
        padding: 12px;
    }

    .onboarding-step h2 {
        font-size: var(--font-xl);
    }

    /* Phone-specific touch refinements (augments 768px touch targets) */
    .btn {
        padding: 0.625rem 1rem;
    }

    .btn-small {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }

    .filter-menu-category {
        min-height: 44px;
        padding: 10px 12px;
    }

    /* Inputs: font-size 16px prevents iOS Safari zoom on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        padding: 0.875rem;
        font-size: 1rem;
    }

    /* Kanban: narrower columns for phone landscape */
    .kanban-column {
        flex: 0 0 220px;
    }

    .kanban-card {
        padding: 10px;
    }

    .kanban-column-header {
        padding: 10px 12px;
    }

    /* Issue rows */
    .issue-row {
        padding: 0 12px;
    }

    /* Create issue modal */
    .create-issue-body {
        padding: 16px;
    }

    .create-issue-title-input {
        font-size: var(--font-xl);
    }

    .create-issue-header {
        padding: 12px 16px;
    }

    /* Search box */
    .search-box {
        min-width: 0;
    }

    /* Sprint badge */
    .sprint-badge {
        font-size: var(--font-sm);
        padding: 3px 8px;
    }

    /* Settings */
    .settings-content {
        padding: 12px;
    }

    .settings-tab {
        padding: 10px 12px;
        font-size: var(--font-base);
    }

    /* Prevent overflow on very narrow screens */
    .view-actions {
        gap: 0.25rem;
    }

    .filter-bar-primary {
        gap: 4px;
    }

    .issue-row-right {
        gap: 2px;
    }
}

/* Text utilities */
.text-muted {
    color: var(--text-muted);
}

/* Linear-style Create Issue Modal */
.create-issue-modal {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: -20px;
}

.create-issue-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.project-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: var(--font-base);
    color: var(--text-primary);
    cursor: pointer;
    max-width: 200px;
    flex-shrink: 0;
}

.project-select:focus {
    /* outline: none removed (CHT-1215) — see .filter-select:focus above */
    border-color: var(--accent-color);
}

.create-issue-breadcrumb {
    color: var(--text-muted);
    font-size: var(--font-base);
    white-space: nowrap;
}

.create-issue-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.create-issue-title-input {
    border: none;
    background: transparent;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0;
    width: 100%;
}

/* .create-issue-title-input:focus { outline: none; } removed (CHT-1215) —
   was beating the global *:focus-visible ring for keyboard users; browser
   default focus indication + the global ring already cover this input. */

.create-issue-title-input::placeholder {
    color: var(--text-muted);
}

.create-issue-template {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.create-issue-template label {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.create-issue-template select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: var(--font-base);
    max-width: 260px;
}

.create-issue-template select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.create-issue-description-input {
    border: none;
    background: transparent;
    font-size: var(--font-md);
    color: var(--text-primary);
    padding: 0;
    width: 100%;
    resize: none;
    line-height: 1.6;
    font-family: inherit;
}

.create-issue-description-input:focus {
    outline: none;
}

.create-issue-description-input::placeholder {
    color: var(--text-muted);
}

.create-issue-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.create-issue-meta label {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.create-issue-date-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: var(--font-base);
    max-width: 220px;
}

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

.create-issue-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.toolbar-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-base);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

/* More options toggle for simplified create issue modal */
.more-options-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-base);
    cursor: pointer;
    padding: 8px 0;
    margin-top: 8px;
    transition: color 0.15s ease;
}

.more-options-toggle:hover {
    color: var(--text-primary);
}

.more-options-toggle .chevron-icon {
    transition: transform 0.2s ease;
}

.more-options-toggle.expanded .chevron-icon {
    transform: rotate(180deg);
}

/* Collapsible options panel */
.create-issue-options {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 500px;
    opacity: 1;
}

.create-issue-options.collapsed {
    max-height: 0;
    opacity: 0;
}

.create-issue-options-content {
    padding: 0 20px 12px;
}

/* Footer with action buttons */
.create-issue-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Sidebar create button */
.sidebar-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 24px);
    margin: 12px;
    padding: 8px 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sidebar-create-btn:hover {
    background: var(--accent-hover);
}

.sidebar-create-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================================================
   12. SETTINGS & API KEYS
   ============================================================================ */
.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    margin-bottom: 0;
}

.settings-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: var(--font-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.settings-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.settings-tab-content {
    display: block;
}

.settings-tab-content.hidden {
    display: none;
}

.settings-content {
    max-width: 800px;
    padding: 20px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: var(--font-lg);
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-description {
    color: var(--text-muted);
    font-size: var(--font-md);
    margin-bottom: 16px;
}

.settings-hint {
    color: var(--text-secondary);
    font-size: var(--font-md);
    margin: 0;
}

.settings-hint a {
    color: var(--accent);
}

.settings-hint a:hover {
    text-decoration: underline;
}

.team-description {
    color: var(--text-secondary);
    font-size: var(--font-md);
    margin: 4px 0 16px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: var(--font-md);
}

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

.api-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.api-key-item.revoked {
    opacity: 0.6;
}

.api-key-info {
    flex: 1;
    min-width: 0;
}

.api-key-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.api-key-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: var(--font-base);
    color: var(--text-muted);
}

.api-key-prefix {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: var(--font-sm);
}

.api-key-revoked {
    color: var(--danger-color);
    font-weight: 500;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--font-base);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

/* API Key Created Modal */
.api-key-created {
    text-align: center;
}

.warning-text {
    color: var(--warning-color, #f59e0b);
    font-weight: 500;
    margin-bottom: 16px;
}

.api-key-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.api-key-display code {
    font-family: monospace;
    font-size: var(--font-sm);
    word-break: break-all;
    text-align: left;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

.api-key-instructions {
    text-align: left;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.api-key-instructions p {
    margin-bottom: 8px;
    font-size: var(--font-base);
    color: var(--text-muted);
}

.api-key-instructions code {
    display: block;
    font-family: monospace;
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.form-help {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: 4px;
}

/* Issue group-by styles */
.issue-group {
    margin-bottom: 8px;
}

.issue-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

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

.group-toggle-icon {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.issue-group.collapsed .group-toggle-icon {
    transform: rotate(-90deg);
}

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

.group-title {
    font-weight: 500;
    font-size: var(--font-base);
    color: var(--text-primary);
}

.group-count {
    font-size: var(--font-sm);
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.group-points {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-left: 4px;
}

.issue-list-summary {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    font-size: var(--font-sm);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.issue-group-content {
    margin-top: 4px;
    margin-left: 12px;
    border-left: 2px solid var(--border-color);
    padding-left: 8px;
}

.issue-group.collapsed .issue-group-content {
    display: none;
}

/* Multi-select dropdown */
.multi-select-dropdown {
    position: relative;
    display: inline-block;
}

.multi-select-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-base);
    cursor: pointer;
    min-width: 130px;
    justify-content: space-between;
}

.multi-select-btn:hover {
    background: var(--bg-hover);
}

.multi-select-btn .icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.multi-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
}

.multi-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    padding: 6px 0;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--font-base);
    color: var(--text-primary);
}

.multi-select-option:hover {
    background: var(--bg-hover);
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.multi-select-option .status-icon,
.multi-select-option .priority-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.multi-select-actions {
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
}

.btn-small {
    padding: 4px 10px;
    font-size: var(--font-sm);
}

/* Status badge for selected count */
.multi-select-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-color);
    color: white;
    border-radius: 9px;
    font-size: var(--font-xs);
    font-weight: 600;
    margin-left: 4px;
}

/* ========================================
   Limbo & Rituals Styles
   ======================================== */

/* Limbo banner - fixed at top of main content */
.limbo-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    border: 1px solid #b91c1c;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.limbo-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.limbo-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.limbo-banner-content span {
    flex: 1;
    font-size: var(--font-md);
}

.limbo-banner-content strong {
    color: #fca5a5;
}

.limbo-banner .btn {
    flex-shrink: 0;
}

/* Limbo badge on sprint items */
.badge-limbo {
    background: #7f1d1d;
    color: #fca5a5;
    animation: pulse 2s infinite;
}

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

.list-item-limbo {
    border-left-color: #ef4444 !important;
    background: rgba(127, 29, 29, 0.1);
}

/* Limbo modal */
.limbo-modal {
    padding: 0;
}

.limbo-alert {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    padding: 16px 20px;
    margin: -20px -20px 20px -20px;
    border-bottom: 1px solid #b91c1c;
}

.limbo-alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.limbo-alert-header svg {
    width: 24px;
    height: 24px;
    color: #fca5a5;
}

.limbo-alert strong {
    font-size: var(--font-lg);
    color: #fca5a5;
}

.limbo-alert p {
    font-size: var(--font-md);
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* Limbo rituals list */
.limbo-rituals {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.limbo-ritual-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.ritual-status {
    flex-shrink: 0;
    font-size: var(--font-xl);
}

.ritual-done {
    color: #22c55e;
}

.ritual-pending {
    color: #f59e0b;
}

.ritual-todo {
    color: var(--text-muted);
}

.ritual-info {
    flex: 1;
    min-width: 0;
}

.ritual-name {
    font-weight: 500;
    font-size: var(--font-md);
    margin-bottom: 4px;
}

.ritual-mode {
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-weight: normal;
}

.ritual-prompt {
    font-size: var(--font-base);
    color: var(--text-secondary);
}

/* Limbo details modal */
.limbo-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.limbo-details > p {
    font-size: var(--font-md);
    color: var(--text-secondary);
    margin: 0;
}

.limbo-rituals-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.limbo-ritual-detail-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
}

.ritual-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ritual-status-icon {
    font-size: var(--font-lg);
}

.ritual-header strong {
    flex: 1;
    font-size: var(--font-md);
}

.ritual-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.completed-rituals-section h4 {
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.completed-rituals {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.completed-ritual {
    font-size: var(--font-base);
    color: var(--success-color);
    padding: 8px 0;
}

.completed-ritual-header {
    font-weight: 500;
}

/* Sprint ritual attestation notes */
.ritual-attestation-note {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--success-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-base);
}

.attestation-note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.attestation-note-header .attestation-by {
    color: var(--text-secondary);
    font-weight: 500;
}

.attestation-note-header .attestation-time {
    color: var(--text-tertiary);
    font-size: var(--font-sm);
}

.attestation-note-content {
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Ritual approval mode badges */
.badge-ritual-auto {
    background: #1e3a5f;
    color: #60a5fa;
}

.badge-ritual-review {
    background: #3b2f63;
    color: #a78bfa;
}

.badge-ritual-gate {
    background: #713f12;
    color: #fcd34d;
}

.badge-ritual-group {
    background: #134e4a;
    color: #5eead4;
}

.badge-no-note {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: var(--font-xs);
}

/* Rituals settings list */
.rituals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ritual-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius-md);
}

.ritual-item:hover {
    border-color: var(--accent-color);
    border-left-color: var(--accent-color);
}

.ritual-item.mode-auto {
    border-left-color: #60a5fa;
}

.ritual-item.mode-review {
    border-left-color: #a78bfa;
}

.ritual-item.mode-gate {
    border-left-color: #fcd34d;
}

.ritual-item-info {
    flex: 1;
    min-width: 0;
}

.ritual-item-name {
    font-weight: 600;
    font-size: var(--font-lg);
    margin-bottom: 8px;
}

.ritual-item-prompt {
    font-size: var(--font-base);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    max-height: 80px;
    overflow: hidden;
    position: relative;
}

.ritual-item-prompt-fade {
    position: relative;
    max-height: 80px;
    overflow: hidden;
}

.ritual-item-prompt-fade::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(transparent, var(--bg-secondary));
    pointer-events: none;
}

.ritual-item-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.ritual-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

/* Settings section header with controls */
.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-section-header select {
    width: auto;
    min-width: 200px;
}

.settings-section-header .btn {
    white-space: nowrap;
}

/* Sprint limbo view button */
.btn-limbo {
    background: #7f1d1d;
    border: 1px solid #b91c1c;
    color: #fca5a5;
}

.btn-limbo:hover {
    background: #991b1b;
}

/* Text utilities for rituals */
.text-success {
    color: #22c55e;
}

.text-warning {
    color: #f59e0b;
}

/* Ritual groups */
.ritual-group {
    margin-bottom: 24px;
}

.ritual-group:last-child {
    margin-bottom: 0;
}

.ritual-group-title {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.ritual-group-desc {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

/* Ticket rituals in issue detail */
.ticket-rituals-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-rituals-content.collapsed {
    display: none;
}

.section-header-collapsible {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 8px;
}

.section-header-collapsible .section-toggle {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 2px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.section-header-collapsible:hover .section-toggle {
    color: var(--text-primary);
}

.section-toggle-icon {
    transition: transform 0.15s ease;
}

.section-toggle-icon.rotated {
    transform: rotate(180deg);
}

.section-count {
    font-weight: 400;
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* Generic collapsible section content */
.section-collapsible-content.collapsed {
    display: none;
}

.ticket-rituals-warning {
    font-size: var(--font-base);
    color: #f59e0b;
    margin: 0 0 8px 0;
}

.ticket-ritual-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ticket-ritual-item.completed {
    opacity: 0.7;
}

.ticket-ritual-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ticket-ritual-status {
    font-size: var(--font-md);
}

.ticket-ritual-name {
    font-weight: 500;
    color: var(--text-primary);
}

.ticket-ritual-prompt {
    font-size: var(--font-base);
    color: var(--text-secondary);
    margin: 4px 0 8px 22px;
}

.ticket-ritual-actions {
    margin-left: 22px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.ticket-rituals-completed {
    margin-top: 8px;
}

.ticket-ritual-attestation {
    margin: 8px 0 0 22px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: var(--font-base);
}

.ticket-ritual-attestation .attestation-by {
    color: var(--text-secondary);
    font-weight: 500;
}

.ticket-ritual-attestation .attestation-time {
    color: var(--text-tertiary);
    margin-left: 8px;
    font-size: var(--font-sm);
}

.ticket-ritual-attestation .attestation-note {
    margin-top: 6px;
    color: var(--text-secondary);
}

.ticket-ritual-item.pending.attested {
    border-left: 3px solid var(--warning-color, #f59e0b);
}

.ticket-ritual-note {
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.ticket-ritual-meta {
    color: var(--text-tertiary);
    font-size: var(--font-sm);
    margin-top: 4px;
}

/* ============================================================================
   11. EPICS & SPRINTS
   ============================================================================ */

/* Sprint Cards - Now/Next Model */
.sprint-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.sprint-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sprint-card-label {
    font-size: var(--font-xs);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.sprint-now .sprint-card-label {
    color: #60a5fa;
}

.sprint-next .sprint-card-label {
    color: var(--text-secondary);
}

.sprint-card-title {
    font-size: var(--font-xl);
    font-weight: 600;
    margin-bottom: 8px;
}

.sprint-card-budget {
    color: var(--text-secondary);
    font-size: var(--font-md);
    margin-bottom: 16px;
}

.sprint-card-budget.budget-arrears {
    color: #f87171;
    font-weight: 500;
}

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

/* Sprint states */
.sprint-now {
    border-color: #3b82f6;
    border-left: 3px solid #3b82f6;
}

.sprint-limbo {
    border-color: #ef4444;
    border-left: 3px solid #ef4444;
    background: rgba(127, 29, 29, 0.1);
}

.sprint-arrears {
    border-color: #f59e0b;
}

.badge-arrears {
    background: #78350f;
    color: #fcd34d;
}

/* Sprint History */
.sprint-history {
    margin-top: 24px;
}

.sprint-history summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-base);
    padding: 8px 0;
}

.sprint-history summary:hover {
    color: var(--text-primary);
}

.sprint-history-list {
    padding-top: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.sprint-history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: var(--font-base);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.sprint-history-name {
    color: var(--text-primary);
}

.sprint-history-budget {
    color: var(--text-tertiary);
}

.sprint-burndown-card {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
}

.sprint-burndown-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.sprint-burndown-header h4 {
    font-size: var(--font-base);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.sprint-burndown-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.sprint-burndown-chart {
    width: 100%;
    height: 140px;
}

.burndown-ideal {
    stroke: var(--text-muted);
    stroke-width: 2;
    stroke-dasharray: 6 6;
}

.burndown-actual {
    stroke: var(--accent-color);
    stroke-width: 3;
}

.burndown-actual-point {
    fill: var(--accent-color);
}

/* Form hints */
.form-hint {
    display: block;
    margin-top: 4px;
    font-size: var(--font-sm);
    color: var(--text-tertiary);
}


/* ========================================
   Agent Styles
   ======================================== */

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    position: relative;
}

.agent-avatar-purple {
    background: #7c3aed;
}

.agent-avatar .agent-emoji {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: var(--font-sm);
}

.agent-avatar .agent-initial {
    color: white;
}

.agent-avatar-small {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.agent-avatar-small .agent-emoji {
    top: -3px;
    right: -3px;
    font-size: 8px;
}

/* Agent list in settings */
.agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.agent-info {
    flex: 1;
}

.agent-name {
    font-weight: 500;
    color: var(--text-primary);
}

.agent-meta {
    font-size: var(--font-sm);
    color: var(--text-tertiary);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.agent-scope {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* Agent badge for activity feeds */
.user-badge-agent {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.user-badge-agent::before {
    content: "🤖";
    font-size: var(--font-sm);
}

.user-badge-agent .name {
    color: #7c3aed;
}

/* ========================================
   Linear-Style Filter Bar
   ======================================== */

/* ============================================================================
   14. FILTER BAR & CHIPS
   ============================================================================ */

/* Hide original filter controls */
.hidden-filter-controls {
    display: none !important;
}

/* Primary filter bar container */
.filter-bar-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Filter/Display menu buttons */
.filter-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-base);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

.filter-menu-btn svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Filter count badge */
.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-color);
    color: white;
    border-radius: 9px;
    font-size: var(--font-xs);
    font-weight: 600;
    margin-left: 2px;
}

/* Menu containers */
.filter-menu-container,
.display-menu-container {
    position: relative;
}

/* Hierarchical filter menu dropdown */
.filter-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    display: flex;
    min-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
    overflow: hidden;
}

/* Left panel - categories */
.filter-menu-categories {
    width: 140px;
    border-right: 1px solid var(--border-color);
    padding: 6px 0;
    background: var(--bg-tertiary);
}

.filter-menu-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: var(--font-base);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-menu-category:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-menu-category.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-menu-category-count {
    font-size: var(--font-xs);
    color: var(--accent-color);
    font-weight: 600;
}

.filter-menu-category-arrow {
    color: var(--text-muted);
    font-size: 10px;
}

.filter-menu-category.disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.filter-options-empty {
    padding: 12px;
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-style: italic;
}

/* Right panel - options */
.filter-menu-options {
    flex: 1;
    padding: 6px 0;
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
}

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

.filter-options-title {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options-clear {
    font-size: var(--font-sm);
    color: var(--accent-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.filter-options-clear:hover {
    background: var(--bg-hover);
}

.filter-presets {
    display: flex;
    gap: 6px;
    padding: 4px 12px 8px;
}

.filter-preset-btn {
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.filter-preset-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--font-base);
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.filter-option:hover {
    background: var(--bg-hover);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
    cursor: pointer;
    flex-shrink: 0;
}

.filter-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.filter-option-label {
    flex: 1;
}

/* Display menu dropdown */
.display-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
    padding: 6px 0;
}

.display-section {
    padding: 6px 0;
}

.display-section:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.display-section-title {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px 8px;
}

.display-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--font-base);
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.display-option:hover {
    background: var(--bg-hover);
}

.display-option.active {
    color: var(--accent-color);
}

.display-option-check {
    color: var(--accent-color);
    font-size: var(--font-md);
}

/* Filter chips row */
.filter-chips-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0 4px;
    margin-bottom: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: var(--font-sm);
    color: var(--text-primary);
    max-width: 200px;
}

.filter-chip-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.filter-chip-value {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--font-md);
    line-height: 1;
    padding: 0;
    transition: all 0.15s ease;
}

.filter-chip-remove:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Simple chip clear button (for documents filter chips) */
.chip-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--font-md);
    padding: 0 2px;
    margin-left: 2px;
}

.chip-clear:hover {
    color: var(--text-primary);
}

.filter-chips-clear-all {
    font-size: var(--font-sm);
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.filter-chips-clear-all:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Empty state for filter options */
.filter-options-empty {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-base);
}

/* ============================================================================
   17. GATE APPROVALS & RITUALS
   ============================================================================ */
.view-subtitle {
    color: var(--text-muted);
    font-size: var(--font-md);
    margin-top: 4px;
}

#approvals-view #approvals-list {
    max-width: 900px;
}

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

.gate-section-title {
    font-size: var(--font-lg);
    font-weight: 600;
    margin-bottom: 8px;
}

.gate-section-desc {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-bottom: 16px;
}

.gate-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gate-issue-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.gate-issue-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.gate-issue-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.gate-issue-link:hover {
    color: var(--accent-color);
}

.gate-issue-id {
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.gate-issue-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gate-issue-project {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.gate-rituals {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gate-ritual {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.gate-ritual-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.gate-ritual-name {
    font-weight: 500;
    font-size: var(--font-base);
}

.gate-ritual-prompt {
    font-size: var(--font-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

.gate-waiting-info {
    font-size: var(--font-sm);
    color: var(--accent-color);
    margin-top: 4px;
}

.gate-waiting-info strong {
    font-weight: 600;
}

.gate-ritual .btn {
    flex-shrink: 0;
    align-self: center;
}

.gate-ritual-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-self: center;
}

.gate-attestation-note {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-color);
    line-height: 1.5;
}

.gate-approval-attestation-note {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-color);
    line-height: 1.5;
}

.badge-gate {
    background: #713f12;
    color: #fcd34d;
}

.badge-review {
    background: #3b2f63;
    color: #a78bfa;
}

/* ============================================================================
   Inbox (CHT-1250)
   ============================================================================ */

.inbox-row {
    align-items: flex-start;
    justify-content: space-between;
}

.inbox-row-main {
    flex: 1;
    min-width: 0;
}

.inbox-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.inbox-row-source {
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-weight: 500;
}

.inbox-row-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-color);
    flex-shrink: 0;
}

.inbox-row-title {
    font-weight: 500;
}

.inbox-row-unread .inbox-row-title {
    font-weight: 600;
}

.inbox-row-body {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inbox-row-meta {
    font-size: var(--font-sm);
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.badge-inbox-gate_pending {
    background: #713f12;
    color: #fcd34d;
}

.badge-inbox-review_requested {
    background: #3b2f63;
    color: #a78bfa;
}

.badge-inbox-assignment {
    background: #1e3a5f;
    color: #7dd3fc;
}

.badge-inbox-mention {
    background: #164e3f;
    color: #6ee7b7;
}

#inbox-unread-toggle.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

/* ============================================================================
   Sprint Detail View
   ============================================================================ */

.sprint-detail-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.sprint-detail-nav {
    margin-bottom: 16px;
}

.sprint-detail-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sprint-detail-title-row h2 {
    margin: 0;
    font-size: var(--font-2xl);
    font-weight: 600;
}

.sprint-detail-dates {
    color: var(--text-secondary);
    font-size: var(--font-md);
    margin-top: 8px;
}

.sprint-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.stat-card {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-value {
    font-size: var(--font-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sprint-detail-sections {
    padding: 24px;
}

.sprint-detail-section {
    margin-bottom: 32px;
}

.sprint-detail-section h3 {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 16px 0;
    display: inline;
}

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

.sprint-section-header h3 {
    margin-bottom: 0;
}

.sprint-detail-section summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 0;
}

.sprint-detail-section summary::-webkit-details-marker {
    display: none;
}

.sprint-detail-section summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.sprint-detail-section[open] summary::before {
    transform: rotate(90deg);
}

.sprint-issues-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sprint-issue-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease;
}

.sprint-issue-row:hover {
    background: var(--bg-hover);
}

.sprint-issue-identifier {
    font-family: var(--font-mono, monospace);
    font-size: var(--font-sm);
    color: var(--text-muted);
    flex-shrink: 0;
}

.sprint-issue-title {
    flex: 1;
    font-size: var(--font-md);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sprint-issue-meta {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.badge-estimate {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-status-active {
    background: var(--success-bg);
    color: var(--success-color);
}

.badge-status-planned {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.badge-status-completed {
    background: var(--success-bg);
    color: var(--success-color);
}

.badge-limbo {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.empty-state-small {
    color: var(--text-muted);
    font-size: var(--font-md);
    padding: 24px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.sprint-budget-section {
    margin-top: 1rem;
}

/* Budget Ledger styles */
.budget-ledger {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.budget-ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.budget-ledger-total {
    font-weight: 600;
    color: var(--text-primary);
}

.budget-ledger-list {
    max-height: 300px;
    overflow-y: auto;
}

.budget-ledger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

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

.ledger-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.ledger-item-identifier {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.ledger-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.ledger-item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.ledger-item-points {
    font-weight: 600;
    color: var(--error-color, #ef4444);
    font-family: monospace;
    white-space: nowrap;
}

.ledger-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Document list view styles */
/* Override parent .grid - let inner container handle its own layout */
#documents-list:has(.documents-list-view),
#documents-list:has(.documents-grid) {
    display: block;
}

.documents-list-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.document-list-item {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 1rem;
    padding: 0.75rem 1rem;
    align-items: center;
}

.document-list-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-list-main {
    min-width: 0;
    overflow: hidden;
}

.document-list-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.document-list-snippet {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-list-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.document-list-labels {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.document-list-badges {
    display: flex;
    gap: 0.25rem;
}

.document-list-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
    font-size: 0.75rem;
    white-space: nowrap;
    min-width: 100px;
}

/* Selection mode checkbox */
.document-list-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-list-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Update grid when checkbox is present */
.document-list-item:has(.document-list-checkbox) {
    grid-template-columns: 30px 40px 1fr auto auto;
}

.document-list-item.selected {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.badge-small {
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
}

/* Documents grid (renamed from default) */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Document labels section in detail view */
/* Document detail bottom sections — constrain to content width */
.document-labels-section {
    max-width: 65ch;
}

.linked-issues-section {
    max-width: 65ch;
}

.document-labels-section {
    margin: 1.5rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.comments-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#document-detail-content .comments-section {
    max-width: 65ch;
}

.comments-section h3 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.document-labels-section h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.document-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.label-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.btn-remove-label {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 0.25rem;
    opacity: 0.7;
    font-size: 1rem;
    line-height: 1;
}

.btn-remove-label:hover {
    opacity: 1;
}

.label-select-item:hover {
    background: var(--bg-tertiary);
}

/* Grid item labels */
.grid-item-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

/* View toggle buttons */
.view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.view-toggle-btn {
    background: var(--bg-secondary);
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    min-width: 36px;
    transition: all 0.15s ease;
}

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

.view-toggle-btn.active {
    background: var(--accent-color);
    color: white;
}

.view-toggle-btn:first-child {
    border-right: 1px solid var(--border-color);
}

/* Onboarding overlay */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.onboarding-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
}

.onboarding-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
}

.onboarding-dot.active {
    background: var(--accent-color);
    transform: scale(1.25);
}

.onboarding-dot.completed {
    background: var(--accent-color);
    opacity: 0.5;
}

.onboarding-step h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: var(--text-primary);
}

.onboarding-subtitle {
    color: var(--text-secondary);
    margin: 0 0 8px;
    font-size: var(--font-md);
}

.onboarding-description {
    color: var(--text-secondary);
    margin: 0 0 24px;
    font-size: var(--font-md);
}

.onboarding-step .form-group {
    margin-bottom: 16px;
}

.onboarding-step .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--font-base);
    font-weight: 500;
    color: var(--text-primary);
}

.onboarding-step .form-group .form-hint {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.onboarding-step .form-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-md);
    box-sizing: border-box;
}

.onboarding-step .form-input:focus {
    /* outline: none removed (CHT-1215) — see .filter-select:focus above */
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.onboarding-error {
    color: #ef4444;
    font-size: var(--font-base);
    margin-bottom: 12px;
}

.onboarding-actions {
    margin-top: 24px;
}

.onboarding-actions .btn-primary {
    width: 100%;
    padding: 10px;
    font-size: var(--font-md);
}

.onboarding-skip {
    text-align: center;
    margin-top: 16px;
}

.onboarding-skip a {
    color: var(--text-secondary);
    font-size: var(--font-base);
    text-decoration: none;
}

.onboarding-skip a:hover {
    color: var(--text-primary);
}

.onboarding-summary {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.onboarding-summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-md);
    color: var(--text-primary);
}

.onboarding-check {
    color: #22c55e;
    font-weight: bold;
}

.onboarding-tips {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
}

.onboarding-tips h3 {
    margin: 0 0 12px;
    font-size: var(--font-base);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.onboarding-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: var(--font-md);
    color: var(--text-primary);
}

.onboarding-tip kbd {
    display: inline-block;
    min-width: 28px;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    text-align: center;
    font-family: inherit;
}

.onboarding-tip code {
    font-size: var(--font-sm);
    color: var(--accent-color);
}

/* Epics view (CHT-831) */
.epic-table {
    width: 100%;
    border-collapse: collapse;
}

.epic-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.epic-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-md);
}

.epic-row:hover {
    background: var(--bg-secondary);
}

.epic-identifier {
    font-family: var(--font-mono, monospace);
    font-size: var(--font-base);
    color: var(--text-muted);
    white-space: nowrap;
    width: 80px;
}

.epic-title {
    font-weight: 500;
    color: var(--text-primary);
}

.epic-progress {
    width: 180px;
}

.epic-progress-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.epic-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.epic-progress-fill.epic-progress-complete {
    background: #22c55e;
}

.epic-progress-text {
    font-size: var(--font-sm);
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.epic-estimate {
    font-size: var(--font-base);
    color: var(--text-secondary);
    white-space: nowrap;
    width: 60px;
}

.epic-status {
    width: 100px;
}

/* ==========================================================================
   Mobile overrides (CHT-1118)
   Must come AFTER component definitions to win specificity cascade.
   ========================================================================== */

@media (max-width: 768px) {
    /* Fix #5: Filter dropdown bottom-sheet (was overridden by later desktop styles) */
    .filter-menu-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        max-height: 70vh;
        border-radius: 12px 12px 0 0;
        flex-direction: column;
        z-index: 300;
        margin-top: 0;
        overflow: hidden;
    }

    .filter-menu-dropdown::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
    }

    .filter-menu-categories {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-wrap: wrap;
        padding: 6px;
        gap: 4px;
        background: var(--bg-secondary);
    }

    .filter-menu-options {
        min-height: 0;
        max-height: 50vh;
        overflow-y: auto;
    }

    /* Fix #4: Display dropdown bottom-sheet on mobile */
    .display-menu-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        margin-top: 0;
        border-radius: 12px 12px 0 0;
        z-index: 300;
        max-height: 70vh;
        overflow-y: auto;
    }

    .display-menu-dropdown::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
    }

    /* Fix #2: Epics card layout — show less info */
    .epic-row td {
        padding: 2px 0;
    }

    .epic-row td:empty {
        display: none;
    }

    .epic-row .epic-estimate,
    .epic-row .epic-dates {
        display: inline-block;
        font-size: var(--font-sm);
        width: auto;
        margin-right: 8px;
    }

    .epic-status {
        width: auto;
    }

    .epic-title {
        font-size: var(--font-base);
        margin-bottom: 2px;
    }

    /* Fix #3: Button sizing — reduce bulk on mobile */
    .view-header .btn,
    .view-actions .btn {
        padding: 6px 12px;
        font-size: var(--font-sm);
    }

    /* Fix #6: Rituals — compact layout on mobile */
    .ritual-item {
        flex-direction: column;
        gap: 12px;
        padding: 12px 14px;
    }

    .ritual-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .ritual-item-actions .btn {
        padding: 6px 12px;
        font-size: var(--font-sm);
    }

    .ritual-item-name {
        font-size: var(--font-base);
    }

    .ritual-group-title {
        font-size: var(--font-lg);
    }

    /* Fix #7: Document readability — tighten margins */
    .document-content.markdown-body {
        font-size: 0.9375rem;
    }

    .document-content.markdown-body h1 { font-size: 1.5em; }
    .document-content.markdown-body h2 { font-size: 1.25em; }
    .document-content.markdown-body h3 { font-size: 1.1em; }

    .document-content.markdown-body ul,
    .document-content.markdown-body ol {
        padding-left: 1.5em;
    }
}

/* ============================================
   Quote-and-comment tooltip (CHT-1173)
   ============================================ */

.quote-tooltip {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 10px;
    font-size: var(--font-sm);
    color: var(--text-primary);
    cursor: pointer;
    z-index: 20;
    box-shadow: var(--shadow-md);
    display: none;
    align-items: center;
    gap: 4px;
    user-select: none;
    white-space: nowrap;
}

.quote-tooltip:hover {
    background: var(--accent-color);
    color: white;
}

.quote-tooltip:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}



/* ============================================
   Filter menu back navigation (CHT-1161)
   ============================================ */

/* Desktop shows both panes side by side; back button is mobile-only */
.filter-options-back {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 8px;
    margin-right: 4px;
    font-size: var(--font-base);
    border-radius: var(--radius-md);
}

.filter-options-back:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-options-back:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    /* One pane at a time: category list first, options after picking one */
    .filter-menu-dropdown .filter-menu-options {
        display: none;
    }

    .filter-menu-dropdown.show-options .filter-menu-options {
        display: block;
    }

    .filter-menu-dropdown.show-options .filter-menu-categories {
        display: none;
    }

    .filter-options-back {
        display: inline-flex;
    }

    .filter-options-header {
        justify-content: flex-start;
        gap: 4px;
    }

    .filter-options-header .filter-options-clear {
        margin-left: auto;
    }
}

/* ============================================
   Revision history viewer (CHT-1243)
   ============================================ */

.revision-viewer {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    min-height: 400px;
    max-height: 70vh;
}

.revision-list {
    border-right: 1px solid var(--border-color);
    padding-right: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.revision-list-header {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.revision-list-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.revision-list-item {
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: var(--font-sm);
}

.revision-list-item:hover {
    background: var(--bg-secondary);
}

.revision-list-item.is-selected {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

.revision-version {
    font-weight: 600;
}

.revision-meta {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.rev-tag {
    display: inline-block;
    font-size: 0.7em;
    background: var(--accent-color);
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.revision-panel {
    overflow-y: auto;
    padding-right: 8px;
}

.revision-panel-header {
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.revision-snapshot-title {
    margin: 0 0 12px 0;
    font-size: 1.2em;
}

.revision-title-change {
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-size: var(--font-sm);
}

.revision-title-change .diff-del,
.revision-title-change .diff-add {
    padding: 1px 4px;
    border-radius: 3px;
}

.revision-diff {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--font-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.diff-line {
    padding: 1px 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-context {
    color: var(--text-muted);
}

.diff-add {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success-color);
}

.diff-del {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error-color);
}
