/* ===========================================
   Feature Request Styles
   =========================================== */

/* -------------------------------------------
   1. Topbar Dropdown
   (text button + caret, dropdown panel)
   Reference: .product-selector in dashboard.css
   ------------------------------------------- */

.fr-topbar-dropdown {
    position: relative;
    align-self: center;
    margin-left: var(--space-1);
}

.fr-topbar-dropdown__trigger {
    display: flex;
    align-items: center;
    gap: var(--space-1\.5);
    background: none;
    border: none;
    padding: var(--space-1) var(--space-2);
    cursor: pointer;
    font-family: inherit;
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    font-weight: 500;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.fr-topbar-dropdown__trigger:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

.fr-topbar-dropdown__trigger i {
    font-size: var(--text-2xs);
    transition: transform 0.15s ease;
}

.fr-topbar-dropdown.open .fr-topbar-dropdown__trigger {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

.fr-topbar-dropdown.open .fr-topbar-dropdown__trigger i {
    transform: rotate(180deg);
}

.fr-topbar-dropdown__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 260px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 99999;
    opacity: 0;
    transform: translateY(-6px);
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    padding: var(--space-1\.5) 0;
}

.fr-topbar-dropdown__panel.open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.fr-topbar-dropdown__header {
    padding: var(--space-2\.5) var(--space-2\.5) var(--space-1) var(--space-2\.5);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fr-topbar-dropdown__list {
    list-style: none;
    margin: 0;
    padding: var(--space-0\.5) var(--space-1\.5);
}

.fr-topbar-dropdown__item {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-2\.5);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--color-text-secondary);
    transition: background 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    gap: var(--space-2);
}

.fr-topbar-dropdown__item:hover {
    background: var(--color-surface-hover);
}

.fr-topbar-dropdown__item.active {
    background: var(--color-surface-active);
    color: var(--color-text);
    font-weight: 500;
}

.fr-topbar-dropdown__divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-1) var(--space-2\.5);
}

/* -------------------------------------------
   2. Creation Modal
   (overlay + content)
   Reference: .modal / .settings-modal-content
   in sidebar.html, project-browser.css modals
   ------------------------------------------- */

.fr-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: 10000;
    backdrop-filter: blur(2px);
}

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

.fr-modal {
    background: var(--color-surface);
    border-radius: 12px;
    width: clamp(400px, 60vw, 640px);
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: fr-modal-pop 0.22s ease-out;
}

@keyframes fr-modal-pop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fr-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.fr-modal__header h3 {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.fr-modal__header h3 i {
    color: var(--color-accent);
}

.fr-modal__close {
    background: transparent;
    border: none;
    font-size: var(--text-2xl);
    color: var(--color-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: var(--space-8);
    height: var(--space-8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.fr-modal__close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.fr-modal__body {
    padding: var(--space-5);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* --- Inline form row (Title + Category side by side) --- */

.fr-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.fr-form-row .fr-form-group {
    margin-bottom: 0;
}

.fr-form-group--title {
    flex: 1;
    min-width: 0;
}

.fr-form-group--category {
    flex: 1;
    min-width: 0;
}

/* --- Scoped form fields (immune to global .form-group overrides) --- */

.fr-form-group {
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: stretch;
    justify-content: flex-start;
    margin-bottom: var(--space-5);
    border-radius: 0;
    outline: none;
    gap: 0;
}

.fr-form-group label {
    display: block;
    position: static;
    top: auto;
    left: auto;
    transform: none;
    pointer-events: auto;
    margin-bottom: var(--space-2);
    padding: 0;
    font-size: var(--text-base);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    background: transparent;
}

.fr-form-group input[type="text"],
.fr-form-group textarea,
.fr-form-group select {
    width: 100%;
    padding: var(--space-2\.5) var(--space-3);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: var(--text-base);
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    margin: 0;
    text-align: left;
    outline: none;
}

.fr-form-group input[type="text"]:focus,
.fr-form-group textarea:focus,
.fr-form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: none;
}

.fr-form-group input[type="text"]::placeholder,
.fr-form-group textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.8;
}

/* --- SimpleMDE / CodeMirror inside the modal --- */

.fr-modal .CodeMirror {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    min-height: 150px;
    height: auto;
    font-size: var(--text-base);
    font-family: inherit;
    padding: var(--space-1) 0;
}

.fr-modal .CodeMirror-focused {
    border-color: var(--color-accent);
    box-shadow: none;
}

.fr-modal .CodeMirror-cursor {
    border-left-color: var(--color-text);
}

.fr-modal .CodeMirror-selected {
    background: rgba(59, 130, 246, 0.25);
}

.fr-modal .CodeMirror-gutters {
    background: transparent;
    border-right: none;
}

.fr-modal .CodeMirror pre.CodeMirror-placeholder {
    color: var(--color-text-muted);
    opacity: 0.8;
}

.fr-modal .editor-toolbar {
    background: var(--color-background) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid var(--color-border) !important;
    opacity: 1 !important;
    padding: var(--space-1) var(--space-2) !important;
    min-height: 0 !important;
}

.fr-modal .editor-toolbar::before,
.fr-modal .editor-toolbar::after {
    display: none !important;
}

.fr-modal .editor-toolbar a,
.fr-modal .editor-toolbar button {
    color: var(--color-accent) !important;
    border: none !important;
    background: transparent !important;
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    border-radius: 4px;
    padding: 0 !important;
    margin: 0 1px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: color 0.15s ease, background 0.15s ease;
    opacity: 0.75;
    font-size: 13px !important;
    vertical-align: middle;
}

.fr-modal .editor-toolbar a:hover,
.fr-modal .editor-toolbar button:hover {
    opacity: 1;
    background: transparent !important;
    color: var(--color-accent) !important;
}

.fr-modal .editor-toolbar a.active,
.fr-modal .editor-toolbar button.active {
    opacity: 1;
    color: var(--color-accent) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.fr-modal .editor-toolbar i.separator {
    border-left: 1px solid var(--color-border) !important;
    border-right: none !important;
    margin: 0 var(--space-1) !important;
    height: 16px;
    vertical-align: middle;
}

.fr-modal .editor-preview {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.fr-modal .editor-preview-side {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border-color: var(--color-border);
}

/* Ensure SimpleMDE wrapper fills the CodeMirror height */
.fr-form-group .CodeMirror-scroll {
    min-height: 180px;
}

.fr-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.fr-modal__footer button {
    padding: var(--space-2\.5) var(--space-5);
    border: none;
    border-radius: 6px;
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-1\.5);
}

.fr-modal__footer .btn-cancel {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.fr-modal__footer .btn-cancel:hover {
    background: var(--color-surface);
}

.fr-modal__footer .btn-submit {
    background: var(--color-accent);
    color: white;
}

.fr-modal__footer .btn-submit:hover {
    opacity: 0.9;
}

.fr-modal__footer .btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -------------------------------------------
   3. Browser — Two-pane layout
   Reference: .project-browser in
   project-browser.css
   ------------------------------------------- */

.fr-browser {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
}

.fr-browser__header {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-surface-hover);
    border-bottom: 1px solid var(--color-border);
    align-items: center;
}

.fr-browser__header input[type="search"] {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: var(--text-base);
}

.fr-browser__header input[type="search"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

.fr-browser__header select {
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: var(--text-base);
    cursor: pointer;
}

.fr-browser__content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* -------------------------------------------
   4. List / List Items (left pane)
   Reference: .project-browser-sidebar,
   .project-browser-item
   ------------------------------------------- */

.fr-list {
    position: relative;
    width: 340px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.15s ease;
}

/* Disable transition during active resize drag */
.browser--resizing .fr-list {
    transition: none;
}

/* Collapsed state for FR list sidebar */
.fr-list.browser__sidebar--collapsed {
    width: var(--height-input) !important;
    min-width: var(--height-input) !important;
    overflow: hidden;
}

.fr-list.browser__sidebar--collapsed .browser__sidebar-content {
    display: none;
}

.fr-list__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-hover);
    border-bottom: 1px solid var(--color-border);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--color-text);
}

.fr-list__items {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.fr-list-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: all 0.2s;
}

.fr-list-item:hover {
    background: var(--color-surface);
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fr-list-item.active {
    border-color: var(--color-accent);
    background: var(--color-surface-active);
}

.fr-list-item__votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-0\.5);
    flex-shrink: 0;
    min-width: var(--space-8);
}

.fr-list-item__vote-count {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
}

.fr-list-item__vote-icon {
    font-size: var(--text-2xs);
    color: var(--color-text-muted);
}

.fr-list-item__vote-icon.voted {
    color: var(--color-accent);
}

.fr-list-item__content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.fr-list-item__title {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fr-list-item__meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.fr-list-item__meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.fr-list-item__meta i {
    font-size: var(--text-xs);
}

/* Scrollbar for list */
.fr-list__items::-webkit-scrollbar {
    width: var(--space-2);
}

.fr-list__items::-webkit-scrollbar-track {
    background: var(--color-surface);
}

.fr-list__items::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.fr-list__items::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Empty state */
.fr-list__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-2);
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--space-5);
}

.fr-list__empty i {
    font-size: var(--text-3xl);
    opacity: 0.5;
}

.fr-list__empty p {
    margin: 0;
    font-size: var(--text-base);
}

/* -------------------------------------------
   5. Detail View (right pane)
   ------------------------------------------- */

.fr-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface);
}

.fr-detail__scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
}

.fr-detail__header {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.fr-detail__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.fr-detail__title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--space-3) 0;
}

.fr-detail__meta {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    flex-wrap: wrap;
    align-items: center;
}

.fr-detail__meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.fr-detail__meta i {
    margin-right: var(--space-1);
}

.fr-detail__description {
    margin-bottom: var(--space-6);
}

.fr-detail__description h4 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-base);
    color: var(--color-text);
    font-weight: 600;
}

/* Unified section heading (uppercase accent label, like modal headings) */
.fr-section-heading {
    display: flex;
    align-items: center;
    gap: var(--space-1\.5);
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    margin: 0 0 var(--space-2\.5) 0;
}

.fr-section-heading i {
    font-size: var(--text-xs);
}

.fr-section-heading__count {
    font-weight: 500;
    opacity: 0.7;
}

.fr-section-heading .fr-edit-btn {
    margin-left: auto;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}

.fr-detail__description h4.fr-section-heading {
    font-size: var(--text-sm);
    color: var(--color-accent);
}

.fr-detail__description .markdown-content {
    padding: var(--space-3);
    background: var(--color-surface-hover);
    border-radius: 6px;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text-muted);
}

/* Edit button for description */
.fr-edit-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 12px;
    margin-left: 8px;
    padding: 2px 8px;
    transition: color 0.15s ease, border-color 0.15s ease;
    vertical-align: middle;
}

.fr-edit-btn:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* --- SimpleMDE in the FR browser (description edit) --- */

.fr-detail__description .editor-toolbar {
    background: var(--color-background) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid var(--color-border) !important;
    opacity: 1 !important;
    padding: 2px 6px !important;
    min-height: 0 !important;
}

.fr-detail__description .editor-toolbar::before,
.fr-detail__description .editor-toolbar::after {
    display: none !important;
}

.fr-detail__description .editor-toolbar a,
.fr-detail__description .editor-toolbar button {
    color: var(--color-accent) !important;
    border: none !important;
    background: transparent !important;
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    border-radius: 4px;
    padding: 0 !important;
    margin: 0 1px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 13px !important;
    opacity: 0.75;
}

.fr-detail__description .editor-toolbar a:hover,
.fr-detail__description .editor-toolbar button:hover {
    opacity: 1;
    background: transparent !important;
    color: var(--color-accent) !important;
}

.fr-detail__description .editor-toolbar a.active,
.fr-detail__description .editor-toolbar button.active {
    opacity: 1;
    color: var(--color-accent) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.fr-detail__description .editor-toolbar i.separator {
    border-left: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-right: none !important;
    margin: 0 4px !important;
    height: 16px;
}

.fr-detail__description .CodeMirror {
    background: var(--color-surface-hover) !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border) !important;
    border-top: none !important;
    border-radius: 0 0 6px 6px;
    min-height: 150px;
    height: auto;
    font-size: 14px;
    font-family: inherit;
}

.fr-detail__description .CodeMirror-cursor {
    border-left-color: var(--color-text) !important;
}

.fr-detail__description .CodeMirror-selected {
    background: rgba(59, 130, 246, 0.25) !important;
}

.fr-detail__description .editor-preview,
.fr-detail__description .editor-preview-side {
    background: var(--color-surface-hover) !important;
    color: var(--color-text) !important;
}

.fr-detail__section {
    margin-bottom: var(--space-6);
}

.fr-detail__section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--space-3) 0;
}

.fr-detail__section-title i {
    color: var(--color-accent);
}

/* Empty detail state */
.fr-detail__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-3);
    color: var(--color-text-muted);
    text-align: center;
}

.fr-detail__empty i {
    font-size: 48px;
    opacity: 0.3;
}

.fr-detail__empty p {
    margin: 0;
    font-size: var(--text-md);
}

/* Scrollbar for detail */
.fr-detail__scroll::-webkit-scrollbar {
    width: var(--space-2);
}

.fr-detail__scroll::-webkit-scrollbar-track {
    background: var(--color-surface);
}

.fr-detail__scroll::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.fr-detail__scroll::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* -------------------------------------------
   6. Status Badges
   (open=green, in_progress=blue,
    implemented=purple, closed=gray)
   Reference: .status-badge in project-browser.css
   ------------------------------------------- */

.fr-status-badge {
    padding: var(--space-1) var(--space-2);
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    white-space: nowrap;
}

.fr-status-badge.status-open {
    background: #22c55e;
    color: white;
}

.fr-status-badge.status-in_progress {
    background: #3b82f6;
    color: white;
}

.fr-status-badge.status-implemented {
    background: #8b5cf6;
    color: white;
}

.fr-status-badge.status-closed {
    background: #6b7280;
    color: white;
}

/* -------------------------------------------
   7. Vote Button
   (toggleable upvote with count)
   ------------------------------------------- */

.fr-vote-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-0\.5);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text-muted);
}

.fr-vote-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-surface);
}

.fr-vote-btn.voted {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-surface-active);
}

.fr-vote-btn__icon {
    font-size: var(--text-md);
    transition: transform 0.15s ease;
}

.fr-vote-btn:hover .fr-vote-btn__icon {
    transform: translateY(-1px);
}

.fr-vote-btn.voted .fr-vote-btn__icon {
    transform: translateY(-1px);
}

.fr-vote-btn__count {
    font-size: var(--text-sm);
    font-weight: 600;
}

/* -------------------------------------------
   8. History Timeline
   (vertical line with dots for status changes)
   ------------------------------------------- */

.fr-history {
    position: relative;
    padding-left: var(--space-6);
}

.fr-history::before {
    content: '';
    position: absolute;
    left: 7px;
    top: var(--space-1);
    bottom: var(--space-1);
    width: var(--space-0\.5);
    background: var(--color-border);
    border-radius: 1px;
}

.fr-history__entry {
    position: relative;
    padding-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-0\.5);
}

.fr-history__entry:last-child {
    padding-bottom: 0;
}

.fr-history__entry::before {
    content: '';
    position: absolute;
    left: -21px;
    top: var(--space-1\.5);
    width: var(--space-2\.5);
    height: var(--space-2\.5);
    border-radius: 50%;
    background: var(--color-border);
    border: 2px solid var(--color-surface);
    z-index: 1;
}

/* Color-coded dots per status */
.fr-history__entry.status-open::before {
    background: #22c55e;
}

.fr-history__entry.status-in_progress::before {
    background: #3b82f6;
}

.fr-history__entry.status-implemented::before {
    background: #8b5cf6;
}

.fr-history__entry.status-closed::before {
    background: #6b7280;
}

.fr-history__status {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

.fr-history__meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.fr-history__meta i {
    font-size: var(--text-xs);
}

/* -------------------------------------------
   9. Comments (threaded)
   Individual comment styles in components/comments.css.
   FR-specific container styles kept here.
   ------------------------------------------- */

.fr-comments {
    margin-top: var(--space-3);
}

.fr-comments__empty {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--space-5);
}

/* Add comment form (FR-specific container) */
.fr-comments__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.fr-comments__form textarea {
    width: 100%;
    padding: var(--space-3);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: var(--text-base);
    resize: vertical;
    font-family: inherit;
}

.fr-comments__form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.fr-comments__form button {
    align-self: flex-start;
    padding: var(--space-2\.5) var(--space-4);
    background: var(--color-accent);
    border: none;
    color: white;
    font-size: var(--text-base);
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.fr-comments__form button:hover {
    opacity: 0.9;
}

/* -------------------------------------------
   10. Attachments
   Reference: task-detail.css lines 2080-2270
   ------------------------------------------- */

.fr-attachments {
    background: var(--color-surface-hover);
    padding: var(--space-5);
    border-radius: 8px;
    margin-bottom: var(--space-5);
    border: 1px solid var(--color-border);
}

.fr-attachments__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-size: var(--text-md);
    color: var(--color-text);
}

.fr-attachments__title i {
    color: var(--color-accent);
}

.fr-attachments__count {
    color: var(--color-text-muted);
    font-weight: normal;
    font-size: var(--text-base);
}

.fr-attachments__content {
    margin-top: var(--space-3);
}

.fr-attachments__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.fr-attachment-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2\.5) var(--space-3);
    background: var(--color-surface);
    border-radius: 6px;
    border: 1px solid var(--color-border);
    transition: all 0.2s;
}

.fr-attachment-item:hover {
    border-color: var(--color-accent);
}

.fr-attachment-item__preview {
    flex-shrink: 0;
    text-decoration: none;
    color: var(--color-text-muted);
}

.fr-attachment-item__thumbnail {
    width: var(--space-12);
    height: var(--space-12);
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.fr-attachment-item__icon {
    width: var(--space-12);
    height: var(--space-12);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-hover);
    border-radius: 4px;
    font-size: var(--text-xl);
    color: var(--color-text-muted);
}

.fr-attachment-item__info {
    flex: 1;
    min-width: 0;
}

.fr-attachment-item__filename {
    display: block;
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.fr-attachment-item__filename:hover {
    color: var(--color-accent);
}

.fr-attachment-item__meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.fr-attachment-item__meta i {
    margin-right: 3px;
    font-size: var(--text-2xs);
}

.fr-attachment-item__delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-1\.5) var(--space-2);
    border-radius: 4px;
    transition: all 0.2s;
    font-size: var(--text-base);
}

.fr-attachment-item__delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.fr-attachments__empty {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--space-4);
    font-size: var(--text-base);
}

.fr-attachments__upload {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.fr-attachments__drop-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 2px dashed var(--color-border);
    border-radius: 6px;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    transition: all 0.2s;
    cursor: default;
}

.fr-attachments__drop-zone.drag-over {
    border-color: var(--color-accent);
    background: rgba(59, 130, 246, 0.05);
    color: var(--color-accent);
}

.fr-attachments__drop-zone i {
    font-size: var(--text-lg);
}

.fr-attachments__upload-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1\.5);
    padding: var(--space-2) var(--space-4);
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.fr-attachments__upload-btn:hover:not(:disabled) {
    filter: brightness(1.1);
}

.fr-attachments__upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* -------------------------------------------
   11. Category Tag
   ------------------------------------------- */

.fr-category-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-0\.5) var(--space-2);
    border-radius: 12px;
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--color-surface-active);
    color: var(--color-text);
    white-space: nowrap;
}

.fr-category-tag i {
    font-size: var(--text-2xs);
    opacity: 0.8;
}

/* Semantic category colors */
.fr-category-tag.category-bug {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.fr-category-tag.category-ui {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.fr-category-tag.category-performance {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.fr-category-tag.category-integration {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.fr-category-tag.category-documentation {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.fr-category-tag.category-feature {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.fr-category-tag.category-other {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

/* -------------------------------------------
   12. Mobile back button (hidden on desktop)
   ------------------------------------------- */

.fr-mobile-back-btn {
    display: none;
}

.fr-header-back-btn {
    display: none;
}

/* -------------------------------------------
   13. Responsive
   ------------------------------------------- */

@media (max-width: 768px) {
    /* Modal fills screen on mobile — full-screen within overlay */
    .fr-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .fr-modal__header {
        padding: 14px 16px;
    }

    .fr-modal__header h3 {
        font-size: 15px;
    }

    .fr-modal__header h3 i {
        font-size: 14px;
    }

    .fr-modal__body {
        padding: 14px 16px;
    }

    .fr-form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .fr-form-group input[type="text"],
    .fr-form-group textarea,
    .fr-form-group select {
        font-size: 12px;
        padding: 7px 10px;
    }

    .fr-form-group select {
        font-size: 12px !important; /* override mobile.css global select 16px !important */
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23999' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
        padding-right: 26px;
    }

    .fr-form-group input[type="text"]::placeholder,
    .fr-form-group textarea::placeholder {
        font-size: 12px;
    }

    .fr-form-group {
        margin-bottom: 14px;
    }

    .fr-modal__footer {
        padding: 10px 16px;
        gap: 8px;
    }

    .fr-modal__footer button {
        flex: 1;
        padding: 8px 0;
        font-size: 13px;
        justify-content: center;
    }

    .fr-modal__footer button .btn-label {
        display: none;
    }

    .fr-form-group .CodeMirror-scroll {
        min-height: 120px;
    }

    .fr-form-group label {
        font-size: 11px;
        margin-bottom: 8px;
    }

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

    /* Stack Title + Category vertically so the select doesn't render off-screen */
    .fr-form-row {
        flex-direction: column;
        gap: 12px;
    }

    .fr-browser__header {
        flex-wrap: nowrap;
        padding: 6px 8px;
        gap: 6px;
    }

    /* Single row: action button + search + sort dropdown */
    .fr-browser__header input[type="search"] {
        flex: 1 1 0;
        min-width: 0;
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .fr-browser__header .fr-header-action-btn {
        flex: 0 0 auto;
        width: auto !important;
        padding: 4px 8px;
        min-width: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        order: -1;
    }

    .fr-browser__header .fr-create-btn__label {
        display: none;
    }

    /* Back button hidden by default on mobile; shown inline when detail open */
    .fr-browser__header .fr-header-back-btn {
        display: none;
    }

    .fr-browser--detail-open .fr-browser__header #fr-create-btn {
        display: none !important;
    }

    .fr-browser--detail-open .fr-browser__header .fr-header-back-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Hide old full-width detail-pane back button on mobile (header inline one replaces it) */
    .fr-browser--detail-open .fr-mobile-back-btn {
        display: none !important;
    }

    /* Sort dropdown: compact, auto-width */
    .fr-browser__header select {
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        font-size: 0.75rem !important;
        padding: 4px 6px;
    }

    /* --- Single-pane mobile pattern --- */
    .fr-browser__content {
        flex-direction: column;
    }

    /* Default: list visible, detail hidden */
    .fr-list {
        width: 100%;
        border-right: none;
        border-bottom: none;
        max-height: none;
        flex: 1;
    }

    .fr-detail {
        display: none;
    }

    /* Detail open: list hidden, detail full-screen */
    .fr-browser--detail-open .fr-list {
        display: none;
    }

    .fr-browser--detail-open .fr-detail {
        display: flex;
        flex: 1;
        flex-direction: column;
    }

    /* Mobile back button */
    .fr-mobile-back-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        background: var(--color-surface-hover);
        border-bottom: 1px solid var(--color-border);
        color: var(--color-accent);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        flex-shrink: 0;
    }

    .fr-mobile-back-btn:active {
        opacity: 0.7;
    }

    .fr-detail__title {
        font-size: var(--text-lg);
        margin-bottom: var(--space-2);
    }

    /* Compact vote button: horizontal layout, smaller, inline with title */
    .fr-detail__title-row .fr-vote-btn {
        flex-direction: row;
        flex-shrink: 0;
        padding: 4px 8px;
        gap: 4px;
        font-size: var(--text-xs);
    }

    .fr-detail__title-row .fr-vote-btn__icon {
        font-size: var(--text-sm);
    }

    .fr-detail__title-row .fr-vote-btn__count {
        font-size: var(--text-xs);
    }

    .fr-detail__meta {
        gap: var(--space-2);
        font-size: var(--text-xs);
    }

    /* Cap markdown heading sizes in FR detail pane on mobile --
       !important on everything to beat mobile.css global rules */
    .fr-detail__description .markdown-content {
        font-size: var(--text-sm) !important;
        word-break: break-word;
    }

    .fr-detail__description .markdown-content h1 {
        font-size: 17px !important;
        margin: 6px 0 !important;
    }

    .fr-detail__description .markdown-content h2 {
        font-size: 15px !important;
        margin: 5px 0 !important;
    }

    .fr-detail__description .markdown-content h3,
    .fr-detail__description .markdown-content h4,
    .fr-detail__description .markdown-content h5,
    .fr-detail__description .markdown-content h6 {
        font-size: 14px !important;
        margin: 4px 0 !important;
    }

    /* --- Compact attachment section on mobile --- */
    .fr-attachments {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
    }

    .fr-attachments__content {
        margin-top: var(--space-2);
    }

    /* Hide drag & drop zone -- not useful on mobile */
    .fr-attachments__drop-zone {
        display: none;
    }

    /* Upload button takes full width when drop zone is hidden */
    .fr-attachments__upload {
        margin-top: var(--space-1);
    }

    /* Shrink attachment item icon/thumbnail */
    .fr-attachment-item__icon {
        width: var(--space-8);
        height: var(--space-8);
        font-size: var(--text-sm);
    }

    .fr-attachment-item__thumbnail {
        width: var(--space-8);
        height: var(--space-8);
    }

    .fr-attachment-item {
        gap: var(--space-2);
        padding: var(--space-2);
    }

    .fr-attachment-item__filename {
        font-size: var(--text-sm);
    }

    .fr-attachment-item__meta {
        gap: var(--space-1\.5);
        flex-wrap: wrap;
        font-size: var(--text-2xs);
    }

    .fr-attachments__empty {
        padding: var(--space-2);
        font-size: var(--text-sm);
    }

    .fr-attachments__list {
        margin-bottom: var(--space-2);
    }
}
