:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1a1f2c;
    --muted: #5c6678;
    --border: #d8dee8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --radius: 10px;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    /* Bootstrap 5 breakpoint alignment */
    --breakpoint-lg: 992px;
    --layout-inline-padding: clamp(0.625rem, 1.25vw, 1.75rem);
    /* Workflow status palette - shared by dashboard tiles, badges, pickers, and charts */
    --status-open-bg: #eff6ff;
    --status-open-border: #bfdbfe;
    --status-open-accent: #2563eb;
    --status-open-text: #1e40af;
    --status-reopen-bg: #FAEEDA;
    --status-reopen-border: #ECD7AE;
    --status-reopen-accent: #9A6212;
    --status-reopen-text: #633806;
    --status-inprogress-bg: #fffbeb;
    --status-inprogress-border: #fde68a;
    --status-inprogress-accent: #d97706;
    --status-inprogress-text: #92400e;
    --status-onhold-bg: #eef2ff;
    --status-onhold-border: #c7d2fe;
    --status-onhold-accent: #6366f1;
    --status-onhold-text: #3730a3;
    --status-resume-bg: #ecfeff;
    --status-resume-border: #a5f3fc;
    --status-resume-accent: #0891b2;
    --status-resume-text: #0e7490;
    --status-futurephase-bg: #f0fdfa;
    --status-futurephase-border: #99f6e4;
    --status-futurephase-accent: #0d9488;
    --status-futurephase-text: #115e59;
    --status-inspec-bg: #fdf4ff;
    --status-inspec-border: #f5d0fe;
    --status-inspec-accent: #c026d3;
    --status-inspec-text: #86198f;
    --status-pendingplan-bg: #fff7ed;
    --status-pendingplan-border: #fed7aa;
    --status-pendingplan-accent: #ea580c;
    --status-pendingplan-text: #9a3412;
    --status-planned-bg: #f0f9ff;
    --status-planned-border: #bae6fd;
    --status-planned-accent: #0284c7;
    --status-planned-text: #075985;
    --status-parked-bg: #f5f5f4;
    --status-parked-border: #d6d3d1;
    --status-parked-accent: #78716c;
    --status-parked-text: #44403c;
    --status-resolved-bg: #f0fdf4;
    --status-resolved-border: #bbf7d0;
    --status-resolved-accent: #16a34a;
    --status-resolved-text: #166534;
    --status-softclose-bg: #fafaf9;
    --status-softclose-border: #d6d3d1;
    --status-softclose-accent: #a8a29e;
    --status-softclose-text: #44403c;
    --status-canceled-bg: #f8fafc;
    --status-canceled-border: #cbd5e1;
    --status-canceled-accent: #94a3b8;
    --status-canceled-text: #475569;
    /* Bootstrap 5 surfaces inherit Dev-Tracker theme tokens (loaded after Bootstrap). */
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--border);
    --bs-link-color: var(--primary);
    --bs-card-bg: var(--surface);
    --bs-card-color: var(--text);
}

* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: auto;
}

body {
    margin: 0;
    /* The one system font stack (spec Dot.Cy Brand Theme R5), so a change of face is made once, in the token. */
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--accent-text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* App layout shell - not Bootstrap's .container (avoids gutter/max-width conflicts). */
.site-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding-inline: var(--layout-inline-padding);
}

#main-content {
    position: relative;
    z-index: 0;
    width: 100%;
    max-width: none;
    padding-inline: var(--layout-inline-padding);
    overflow: visible;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1200;
    overflow: visible;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.header-inner,
.site-nav,
.nav-dropdown {
    overflow: visible;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 1rem;
    overflow: visible;
}

.brand-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 0;
}

.brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    line-height: 1.2;
}

.brand-user-name {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.page-lead {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    max-width: 42rem;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: var(--on-accent);
    border-radius: 0 0 8px 8px;
}

.skip-link:focus {
    left: 1rem;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}

.site-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    overflow: visible;
}

.api-docs-intro {
    margin-bottom: 1.5rem;
}

.api-docs-dl {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: 0.5rem 1rem;
    margin: 0 0 1rem;
}

.api-docs-dl dt {
    font-weight: 600;
    color: var(--muted);
}

.api-docs-dl dd {
    margin: 0;
}

.api-docs-rules {
    margin: 0;
}

.api-docs-toc {
    margin-bottom: 1.5rem;
}

.api-docs-toc ol {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.api-docs-section {
    margin-bottom: 2rem;
}

.api-docs-section h2 {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
}

.api-docs-section-intro {
    margin: 0 0 1rem;
    color: var(--muted);
    max-width: 52rem;
}

.api-docs-endpoint {
    margin-bottom: 1rem;
}

.api-docs-endpoint-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.api-docs-method {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: #e8eef8;
    color: #1e3a8a;
}

.api-docs-method-get { background: #dcfce7; color: #166534; }
.api-docs-method-post { background: #dbeafe; color: #1d4ed8; }
.api-docs-method-patch { background: #fef3c7; color: #92400e; }
.api-docs-method-header,
.api-docs-method-flow { background: #f3e8ff; color: #6b21a8; }

.api-docs-path {
    font-size: 0.9rem;
    word-break: break-all;
}

.api-docs-summary {
    margin: 0 0 0.75rem;
}

.api-docs-callout {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.api-docs-callout p {
    margin: 0.35rem 0 0;
}

.api-docs-endpoint h3 {
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
}

.api-docs-table code {
    font-size: 0.85em;
}

.api-docs-code {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    overflow: auto;
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0;
}

.api-docs-responses {
    margin: 0;
    color: var(--muted);
}

.items-list-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.items-list-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.items-mobile-list {
    display: none;
    gap: 0.75rem;
    /* Single full-width column. Without this the implicit grid track grows to
       the cards' max-content width and overflows narrow viewports. */
    grid-template-columns: minmax(0, 1fr);
}

.item-mobile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1rem;
}

.item-mobile-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.item-mobile-card-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.item-mobile-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.75rem;
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.item-mobile-meta dt {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.item-mobile-meta dd {
    margin: 0;
}

.item-mobile-fields {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.error-card {
    max-width: 40rem;
}

.error-detail {
    white-space: pre-wrap;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.error-request-id {
    font-size: 0.85rem;
}

.button-primary,
.button-secondary,
.button-danger {
    display: inline-block;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.button-primary {
    background: var(--primary);
    color: var(--on-accent);
}

.button-primary:hover:not(:disabled):not(.is-busy) {
    background: var(--primary-hover);
    text-decoration: none;
}

.button-primary:active:not(:disabled):not(.is-busy) {
    background: #1e40af;
    transform: translateY(1px);
}

.button-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.button-secondary:hover:not(:disabled):not(.is-busy) {
    background: #f8fafc;
    border-color: #94a3b8;
    text-decoration: none;
}

.button-secondary:active:not(:disabled):not(.is-busy) {
    background: #f1f5f9;
    transform: translateY(1px);
}

.button-danger {
    background: var(--danger);
    color: #fff;
}

.button-danger:hover:not(:disabled):not(.is-busy) {
    background: var(--danger-hover);
    text-decoration: none;
}

.button-danger:active:not(:disabled):not(.is-busy) {
    background: #991b1b;
    transform: translateY(1px);
}

.button-primary:disabled,
.button-secondary:disabled,
.button-danger:disabled,
.button-primary.is-busy,
.button-secondary.is-busy,
.button-danger.is-busy {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    color: var(--text);
}

.callout {
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
}

.callout strong {
    display: block;
    margin-bottom: 0.25rem;
}

.callout-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.danger-card {
    border-color: #fecaca;
    background: #fef2f2;
}

.manual-hero {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.manual-hero-main {
    display: grid;
    gap: 0.5rem;
}

.manual-hero-hint {
    margin: 0;
    color: var(--muted);
    max-width: 40rem;
}

.manual-status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.manual-status-ready {
    background: #d1fae5;
    color: #065f46;
}

.manual-status-stale {
    background: #ffedd5;
    color: #9a3412;
}

.manual-status-pending {
    background: #e0e7ff;
    color: #3730a3;
}

.manual-status-indexing {
    background: #dbeafe;
    color: #1d4ed8;
}

.manual-status-error {
    background: #fee2e2;
    color: #b91c1c;
}

.manual-status-disabled {
    background: #e5e7eb;
    color: #374151;
}

.manual-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.manual-stat {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.manual-stat dt {
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.manual-stat dd {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}

.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.25rem;
}

.dashboard-stat {
    position: relative;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.dashboard-stat dt {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-stat dd {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-stat-link {
    color: inherit;
    text-decoration: none;
}

.dashboard-stat-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.dashboard-stat:has(.dashboard-stat-link:hover) dd,
.dashboard-stat-link:hover {
    color: var(--accent-text);
}

.dashboard-stat-link:focus-visible {
    outline: 2px solid var(--accent-line);
    outline-offset: 2px;
}

.dashboard-stat-open {
    border-color: var(--status-open-border);
    background: var(--status-open-bg);
}

.dashboard-stat-reopen {
    border-color: var(--status-reopen-border);
    background: var(--status-reopen-bg);
}

.dashboard-stat-inprogress {
    border-color: var(--status-inprogress-border);
    background: var(--status-inprogress-bg);
}

.dashboard-stat-onhold {
    border-color: var(--status-onhold-border);
    background: var(--status-onhold-bg);
}

.dashboard-stat-resume {
    border-color: var(--status-resume-border);
    background: var(--status-resume-bg);
}

.dashboard-stat-futurephase {
    border-color: var(--status-futurephase-border);
    background: var(--status-futurephase-bg);
}

.dashboard-stat-resolved {
    border-color: var(--status-resolved-border);
    background: var(--status-resolved-bg);
}

.dashboard-stat-softclose {
    border-color: var(--status-softclose-border);
    background: var(--status-softclose-bg);
}

.dashboard-stat-workable {
    border-color: #86efac;
    background: #ecfdf5;
}

.dashboard-stat-critical {
    border-color: #fecaca;
    background: #fef2f2;
}

.dashboard-stat-pending {
    border-color: #e0a64e;
    background: #fdf3e0;
}

.dashboard-stat-unassigned {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.dashboard-stat-createdtoday {
    border-color: #93c5fd;
    background: #eff6ff;
}

.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-features-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-chart-lead {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    line-height: 1.35;
}

.dashboard-chart-empty {
    margin: 0.5rem 0 0;
}

.dashboard-chart-wrap-feature {
    min-height: 18rem;
}

.dashboard-trends-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-chart-card h2 {
    margin: 0;
    font-size: 1.05rem;
}

.dashboard-chart-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.dashboard-chart-card-header h2 {
    flex: 1;
    min-width: 0;
}

.dashboard-chart-expand-button {
    flex-shrink: 0;
}

.dashboard-chart-wrap {
    position: relative;
    height: 14rem;
}

.dashboard-chart-wrap-tall {
    height: 16rem;
}

.dashboard-chart-wrap-wide {
    height: 12rem;
}

.dashboard-activity-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.dashboard-activity-timeline a strong {
    color: var(--text);
}

.badge-activity-created {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-activity-updated,
.badge-activity-statuschanged,
.badge-activity-prioritychanged,
.badge-activity-categorychanged,
.badge-activity-featurechanged,
.badge-activity-ownerchanged,
.badge-activity-tagschanged,
.badge-activity-approvalchanged,
.badge-activity-linkadded,
.badge-activity-linkremoved,
.badge-activity-testcaseadded,
.badge-activity-testcaseupdated,
.badge-activity-testcaseremoved,
.badge-activity-attachmentadded,
.badge-activity-attachmentremoved,
.badge-activity-comment {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-activity-deleted {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-activity-bulkaction {
    background: #f3f4f6;
    color: #374151;
}

.manual-detail-grid .card h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.manual-detail-list {
    grid-template-columns: 9rem 1fr;
}

.path-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hash-chip {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: #f1f5f9;
    font-size: 0.85rem;
}

.manual-inline-yes {
    color: #047857;
    font-weight: 600;
}

.manual-inline-no {
    color: #c2410c;
    font-weight: 600;
}

.manual-advanced-card {
    grid-column: 1 / -1;
}

.manual-advanced {
    margin: 0;
}

.manual-advanced summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
    user-select: none;
}

.manual-advanced[open] summary {
    margin-bottom: 1rem;
}

.manual-empty-state h2 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    color: var(--text);
}

.detail-grid {
    display: grid;
    gap: 1rem;
}

.item-details-header {
    align-items: flex-start;
}

.item-details-header-main h1 {
    margin: 0.15rem 0 0.5rem;
}

.item-details-id {
    margin: 0;
    font-size: 0.85rem;
}

.item-details-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.item-details-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.item-details-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.item-details-summary-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

.item-details-summary-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.item-details-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.item-details-panel-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    user-select: none;
    flex-wrap: wrap;
}

.item-details-panel-title {
    font-weight: 700;
}

.item-details-panel-hint {
    font-size: 0.82rem;
    font-weight: 500;
}

.item-details-panel-accent {
    border-left: 4px solid var(--accent-line);
}

.item-details-panel-test-cases {
    border-left: 4px solid #2f9e6b;
}

.item-details-meta-grid {
    margin-top: 0;
}

.item-details-panel-summary::-webkit-details-marker {
    display: none;
}

.item-details-panel-summary::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.item-details-panel[open] > .item-details-panel-summary::before {
    transform: rotate(45deg);
}

.item-details-panel-count {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--bg);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-left: auto;
}

.item-details-header-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.work-plan-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.work-plan-field-header label {
    margin-bottom: 0;
}

.button-compact {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.item-preview-pop-work-plan {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
    white-space: pre-wrap;
    font-size: 0.9rem;
    color: var(--text);
    max-height: 16rem;
    overflow-y: auto;
}

.item-details-panel-body {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
}

.item-details-subheading {
    margin: 1rem 0 0.35rem;
    font-size: 0.95rem;
}

.item-details-subheading:first-child {
    margin-top: 0;
}

.item-details-prose {
    color: var(--text);
}

.detail-list-compact {
    margin-top: 0;
}

.item-details-stack > * + * {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.item-details-stack-section:first-child .item-details-subheading {
    margin-top: 0;
}

.test-cases-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.test-cases-lead {
    margin: 0;
    max-width: 42rem;
}

.test-cases-table-wrap {
    margin-top: 0.15rem;
}

.test-cases-table .test-case-expand-column {
    width: 2.5rem;
    padding-right: 0;
}

.test-cases-table .test-case-index-cell {
    width: 4.5rem;
    white-space: nowrap;
}

.test-cases-table .test-case-actions-cell {
    width: 9.5rem;
    white-space: nowrap;
    text-align: right;
}

.test-cases-table .test-case-title-cell {
    font-weight: 600;
}

.test-case-summary-row.is-expanded {
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.test-case-detail-row > td {
    padding: 0;
    border-top: none;
    background: var(--bg);
}

.test-case-detail-cell {
    border-top: 1px solid var(--border);
}

.test-case-detail-body {
    padding: 0.85rem 1rem 0.75rem 2.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.test-case-detail-meta {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
}

.test-case-index {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2f9e6b;
    background: color-mix(in srgb, #2f9e6b 12%, transparent);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.test-case-field-label {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

.test-case-field-body {
    font-size: 0.92rem;
}

.test-cases-readonly-table-wrap {
    margin-top: 0.35rem;
}

.test-cases-readonly-table .test-case-detail-body {
    padding-left: 2.25rem;
}

#item-test-cases-readonly-loading {
    margin: 0.5rem 0 0;
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.detail-list dt {
    font-weight: 600;
    color: var(--muted);
}

.detail-list dd {
    margin: 0;
}

.pre-wrap {
    white-space: pre-wrap;
}

.muted {
    color: var(--muted);
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.table-wrap {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* Scrolling-shadow edge-fade hint (background-attachment: local pins the
       cover layers to the edges while the shadow layers reveal when more
       content exists to the side). Stays put while the table scrolls. */
    background:
        linear-gradient(to right, var(--surface) 30%, transparent),
        linear-gradient(to left, var(--surface) 30%, transparent),
        linear-gradient(to right, rgba(0, 0, 0, 0.10), transparent 1.25rem),
        linear-gradient(to left, rgba(0, 0, 0, 0.10), transparent 1.25rem);
    background-color: var(--surface);
    background-repeat: no-repeat;
    background-size: 2.5rem 100%, 2.5rem 100%, 1.25rem 100%, 1.25rem 100%;
    background-position: left center, right center, left center, right center;
    background-attachment: local, local, scroll, scroll;
}

/* Give the shared data tables a sensible min-width inside the scroller so the
   Actions column stays reachable on mobile/tablet instead of being clipped. */
.table-wrap > .data-table:not(#items-table):not(#features-table) {
    min-width: 44rem;
}

/* Page-level horizontal scroll - not a scrollbar on the table container (overrides Bootstrap .table-responsive). */
.table-responsive,
.table-wrap.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

#items-list {
    overflow: visible;
    max-height: none;
}

/* Tracker items table uses the page scrollbar - no nested scroll container. */
.items-list-desktop {
    display: block;
    width: 100%;
    max-width: none;
    overflow: visible;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.items-list-desktop,
#items-list {
    overflow-x: visible;
    overflow-y: visible;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table-fluid {
    table-layout: auto;
    width: 100%;
    min-width: 100%;
}

#items-table.data-table-fluid {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#items-table {
    table-layout: fixed;
}

#items-table col.col-controls { width: 15rem; }
#items-table col.col-id { width: 7.5rem; }
#items-table col.col-project { width: 4.5rem; }
#items-table col.col-title { width: 32%; }
#items-table col.col-type { width: 4.5rem; }
#items-table col.col-owner { width: 6.5rem; }
#items-table col.col-status { width: 7rem; }
#items-table col.col-priority { width: 5rem; }
#items-table col.col-created { width: 9.5rem; }
#items-table col.col-updated { width: 9.5rem; }

.features-list-desktop {
    display: block;
    width: 100%;
    max-width: none;
    overflow: visible;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.features-list-desktop .items-table-pager {
    padding: 0 1rem 1rem;
    margin-top: 0;
    border-top: 1px solid var(--border);
}

#features-table.data-table-fluid {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#features-table col.col-controls { width: 6.75rem; }
#features-table col.col-code { width: 7rem; }
#features-table col.col-name { width: 14%; }
#features-table col.col-project { width: 9%; }
#features-table col.col-parent { width: 12%; }
#features-table col.col-description { width: 20%; }
#features-table col.col-count { width: 4.5rem; }
#features-table col.col-created { width: 9.5rem; }
#features-table col.col-updated { width: 9.5rem; }

#features-table .features-row-controls,
#features-table .features-row-controls-header {
    width: 6.75rem;
    min-width: 6.75rem;
    max-width: 6.75rem;
    padding: 0.35rem 0.15rem 0.35rem 0.3rem;
    overflow: hidden;
    box-sizing: border-box;
}

.features-row-controls-bar {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
}

.features-row-controls-bar .action-bar {
    justify-content: flex-start;
    gap: 0.1rem;
    flex: 0 0 auto;
}

#features-table .features-code-cell {
    /* Feature codes (FE-000xxx) always show in full on a single line: never
       wrap, never clip, never ellipsize. col-code is sized to fit FE-000000. */
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Feature rows align to the top so multi-line description cells read cleanly
   next to the single-line code / audit columns (the base .data-table sets
   vertical-align: middle). The shared body typeface is pinned on every feature
   cell so no column reads as a different font than its neighbours. Sizes are
   not forced here, so the deliberately-smaller audit date / by lines (set
   elsewhere) are preserved. */
#features-table th,
#features-table td {
    vertical-align: top;
    font-family: var(--font-sans);
}

/* Every feature body cell uses the same font size as the created/updated columns. */
#features-table td {
    font-size: 0.76rem;
    line-height: 1.2;
}

#features-table .features-item-count-cell {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

#features-table .feature-description-cell {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}

#features-table .feature-description-cell .feature-description-preview {
    margin-top: 0;
    max-height: none;
    overflow: visible;
    padding: 0.35rem 0.5rem;
    /* Match the base body font and size of the other feature columns so the
       description does not read as a different typeface or size than its
       neighbours. The deliberately-smaller audit columns are left untouched. */
    font-family: var(--font-sans);
    font-size: 0.76rem;
    line-height: 1.4;
}

#features-table .feature-description-cell .md-preview pre {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: visible;
}

#features-table .feature-description-cell .md-preview pre code {
    white-space: pre-wrap;
    word-break: break-word;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.data-table .col-select { width: 2.5rem; }
.data-table .cell-select { text-align: center; }
.data-table .col-expand { width: 2.5rem; }
.data-table .col-id { width: 6%; }
.data-table .col-project { width: 6%; }
.data-table .col-parent { width: 10%; }
.data-table .col-title { width: 16%; }
.data-table .col-type { width: 6%; }
.data-table .col-category { width: 11%; }
.data-table .col-owner { width: 10%; }
.data-table .col-status { width: 10%; }
.data-table .col-attach { width: 3.25rem; }
.data-table .col-priority { width: 8%; }
.data-table .col-created { width: 10%; }
.data-table .col-updated { width: 10%; }
.data-table .col-approve { width: 6.25rem; }
.data-table .col-actions { width: 10rem; }
.data-table .col-name { width: 18%; }
.data-table .col-description { width: 34%; }
.data-table .col-count { width: 8%; }
.data-table .col-sort { width: 8%; }

.cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-by {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.tag-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0;
}

.tag-checkbox-item {
    font-weight: 500;
}

.tag-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.tag-chip-list-compact {
    margin-top: 0.15rem;
}

.tag-chip {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-form.is-saving select,
.status-form.is-saving .approve-pill {
    opacity: 0.65;
    pointer-events: none;
}

.inline-update-flash {
    animation: inline-update-flash 0.9s ease-out;
}

@keyframes inline-update-flash {
    0% { background-color: rgba(37, 99, 235, 0.14); }
    100% { background-color: transparent; }
}

.item-activity-row td {
    background: #f8fafc;
    font-size: 0.9rem;
}

.item-activity-detail {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.item-id-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    max-width: 100%;
}

/* The ID column carries the record code, which must never be clipped. The td
   reuses the shared .cell-ellipsis helper for layout, so re-enable overflow on
   the code cell specifically; the col-id width is sized to fit code + (i) icon. */
#items-table td.cell-ellipsis:has(.item-id-cell) {
    overflow: visible;
    text-overflow: clip;
}

.item-id-cell > span:first-child {
    /* Record codes (WI-000xxx) must always render in full on a single line:
       keep nowrap, but never clip or ellipsize the code text. */
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.item-expand-detail {
    display: grid;
    gap: 0.65rem;
}

.item-expand-section {
    display: grid;
    gap: 0.25rem;
}

.item-status-milestones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.item-status-milestone {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
}

.item-status-milestone-label {
    font-weight: 600;
}

.item-status-milestone-value {
    color: var(--text-muted, #6c757d);
}

.item-expand-category-form {
    max-width: 20rem;
}

.item-expand-activity-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.item-expand-text {
    white-space: pre-wrap;
    line-height: 1.45;
}

.item-expand-activity-detail {
    padding-left: 0.5rem;
    border-left: 2px solid var(--border);
}

.item-expand-meta {
    font-size: 0.82rem;
}

.item-mobile-last-activity {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
}

.item-links-panel {
    margin-top: 1rem;
}

.item-links-list,
.item-links-readonly-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.item-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.item-link-label {
    flex: 1;
    min-width: 0;
}

.item-link-add-grid {
    align-items: end;
}

.item-link-search-wrap {
    position: relative;
}

.item-link-search-results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.item-link-search-option {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    color: var(--text);
}

.item-link-search-option:hover,
.item-link-search-option:focus {
    background: #eff6ff;
}

.item-link-search-empty {
    padding: 0.6rem 0.75rem;
}

.feature-search-wrap {
    position: relative;
}

.feature-search-results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.feature-search-option {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
}

.feature-search-option:hover,
.feature-search-option:focus {
    background: var(--surface-muted);
}

.feature-search-empty {
    padding: 0.6rem 0.75rem;
}

.item-link-selected {
    margin-top: 0.35rem;
}

#items-table tbody tr.item-row-striped td {
    background: #f8fafc;
}

.data-table th {
    background: #f8fafc;
    font-size: 0.9rem;
    color: var(--muted);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.actions {
    white-space: nowrap;
    overflow: visible;
}

.actions-header {
    text-align: center;
}

.action-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

#items-table .items-row-controls,
#items-table .items-row-controls-header {
    width: 15rem;
    min-width: 15rem;
    max-width: 15rem;
    padding: 0.45rem 0.35rem;
    overflow: hidden;
    box-sizing: border-box;
}

.items-row-controls-bar {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.items-row-controls-bar .item-select {
    flex: 0 0 auto;
    margin: 0;
}

.items-row-controls-bar .action-bar {
    justify-content: flex-start;
    gap: 0.1rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.items-row-controls-bar .action-bar .inline-form {
    display: inline-flex;
    margin: 0;
}

/* Compact icon buttons so the full inline action cluster fits in the controls
   column without an overflow menu. Scoped to the items row controls so other
   icon-button instances keep their default 2rem size. ~8 buttons + the select
   checkbox fit on one line at a typical desktop width; flex-wrap is the safety
   net so the bar never spills over the ID / title columns. */
.items-row-controls-bar .icon-button {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 6px;
}

.items-row-controls-bar .icon-button .icon,
.items-row-controls-bar .icon-button svg {
    width: 0.95rem;
    height: 0.95rem;
}

/* Compact rows make the cluster a touch denser still. */
#items-list.is-compact .items-row-controls-bar .icon-button {
    width: 1.5rem;
    height: 1.5rem;
}

/* On smaller-width desktop screens the fixed 15rem controls column squeezes the
   data columns (the title most of all). Narrow it and let the action cluster wrap
   onto a second row instead, freeing horizontal space for the other fields. Large
   screens (>= 1600px) keep the spacious single-row layout. The mobile card view
   takes over below 992px, so this only applies to the desktop table. */
@media (min-width: 992px) and (max-width: 1599.98px) {
    #items-table col.col-controls { width: 9rem; }

    #items-table .items-row-controls,
    #items-table .items-row-controls-header {
        width: 9rem;
        min-width: 9rem;
        max-width: 9rem;
    }

    /* Keep the title column readable (>= ~200px) on smaller-width desktops. The two
       date columns are content-locked (~150px of un-wrappable timestamp each) and
       every other column is already content-sized, so the title is the only flexible
       column and was being squeezed to ~120px near 1280px. Reserve a 200px title by
       giving the table a min-width (sum of the fixed columns + the title floor) and
       let the list scroll horizontally only when the viewport is genuinely too narrow
       to show everything, rather than shrinking the title below 200px. */
    #items-table.data-table-fluid { min-width: 75.5rem; }
    .items-list-desktop { overflow-x: auto; }

    /* Flatten the nested action-bar so every control (checkbox, expand, edit,
       approve, favorite, ... delete) flows as one flex cluster and wraps uniformly
       onto a single second row, instead of the inner action-bar wrapping on its own. */
    .items-row-controls-bar .action-bar {
        display: contents;
    }

    .items-row-controls-bar .icon-button {
        width: 1.4rem;
        height: 1.4rem;
    }

    .items-row-controls-bar .icon-button .icon,
    .items-row-controls-bar .icon-button svg {
        width: 0.85rem;
        height: 0.85rem;
    }
}

.items-attach-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
    border-radius: 4px;
    background: color-mix(in srgb, var(--primary) 14%, var(--surface));
    color: var(--accent-text);
    pointer-events: none;
}

.items-attach-indicator .icon {
    width: 0.75rem;
    height: 0.75rem;
}

#items-table .items-type-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

#items-table .items-audit-cell,
#features-table .items-audit-cell {
    font-size: 0.76rem;
    line-height: 1.2;
    padding: 0.45rem 0.35rem;
}

#items-table .items-audit-cell .items-audit-date,
#features-table .items-audit-cell .items-audit-date {
    display: block;
    white-space: nowrap;
}

#items-table .items-audit-cell .audit-by,
#features-table .items-audit-cell .audit-by {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.05rem;
    white-space: nowrap;
}

#items-table .item-approval-button.is-approved {
    color: #166534;
}

#items-table .item-approval-button.is-pending {
    color: var(--muted);
}

.item-favorite-button.is-favorite {
    color: #dc2626;
}

.item-favorite-button.is-not-favorite {
    color: var(--muted);
}

.item-favorite-button.is-favorite:hover,
.item-favorite-button.is-favorite:focus-visible {
    color: #b91c1c;
}

.kanban-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.kanban-card-head .favorite-form {
    flex-shrink: 0;
}

#items-table .items-table-title-cell {
    overflow: hidden;
    max-width: 0;
}

#items-table .items-table-title-link {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.items-table-title-links {
    display: grid;
    gap: 0.15rem;
    margin-top: 0.25rem;
}

.items-table-title-link-row {
    font-size: 0.82rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.items-table-title-link-role {
    color: var(--muted);
    font-weight: 600;
    margin-right: 0.35rem;
}

.items-table-title-link-row a {
    color: var(--accent-text);
    font-weight: 600;
    text-decoration: none;
}

.items-table-title-link-row a:hover {
    text-decoration: underline;
}

.items-table-title-link-text {
    color: var(--muted);
}

.item-mobile-card-title .items-table-title-links {
    margin-top: 0.35rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-status-open {
    background: var(--status-open-bg);
    color: var(--status-open-text);
    border-color: var(--status-open-border);
}

.badge-status-reopen {
    background: var(--status-reopen-bg);
    color: var(--status-reopen-text);
    border-color: var(--status-reopen-border);
}

.badge-status-resume {
    background: var(--status-resume-bg);
    color: var(--status-resume-text);
    border-color: var(--status-resume-border);
}

.badge-status-inprogress {
    background: var(--status-inprogress-bg);
    color: var(--status-inprogress-text);
    border-color: var(--status-inprogress-border);
}

.badge-status-onhold {
    background: var(--status-onhold-bg);
    color: var(--status-onhold-text);
    border-color: var(--status-onhold-border);
}

.badge-status-futurephase {
    background: var(--status-futurephase-bg);
    color: var(--status-futurephase-text);
    border-color: var(--status-futurephase-border);
}

.badge-status-inspec {
    background: var(--status-inspec-bg);
    color: var(--status-inspec-text);
    border-color: var(--status-inspec-border);
}

.badge-status-pendingplan {
    background: var(--status-pendingplan-bg);
    color: var(--status-pendingplan-text);
    border-color: var(--status-pendingplan-border);
}

.badge-status-planned {
    background: var(--status-planned-bg);
    color: var(--status-planned-text);
    border-color: var(--status-planned-border);
}

.badge-status-parked {
    background: var(--status-parked-bg);
    color: var(--status-parked-text);
    border-color: var(--status-parked-border);
}

.badge-status-resolved {
    background: var(--status-resolved-bg);
    color: var(--status-resolved-text);
    border-color: var(--status-resolved-border);
}

.badge-status-canceled {
    background: var(--status-canceled-bg);
    color: var(--status-canceled-text);
    border-color: var(--status-canceled-border);
}

.badge-status-softclose {
    background: var(--status-softclose-bg);
    color: var(--status-softclose-text);
    border-color: var(--status-softclose-border);
}

.badge[class*="badge-status-"] {
    border: 1px solid transparent;
}

/* Work stage (Central Work Hub spec R5): derived, never stored, so it reads as a quiet outline beside the status. */
.badge-stage {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 500;
}

.badge-stage-compact {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

/* Claims (Central Work Hub spec 7.5.3): a live claim warns that someone is working on the item. */
.badge-claim {
    background: transparent;
    color: var(--text);
    border: 1px dashed var(--border);
    font-weight: 500;
    margin-left: 0.35rem;
}

/* Batches (spec 7.5): the state reads like the status badges, quietly; members are dragged into order. */
.badge-batch-state {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.batch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.batch-member-row[draggable="true"] {
    cursor: grab;
}

.batch-member-row.is-dragging {
    opacity: 0.5;
}

.batch-member-row.is-drop-target {
    outline: 2px dashed var(--border);
}

/* Register fields on the item page (spec 7.1). */
.register-field-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.5rem 1rem;
    margin: 0 0 0.75rem;
}

.register-field dt {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
}

.register-field dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.register-summary {
    margin: 0 0 0.75rem;
}

.register-links-title {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
    margin: 0.5rem 0 0.35rem;
}

.register-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.register-crm-chip {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.register-crm-chip-plain {
    color: var(--muted);
}

.register-link-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.register-link-kind-label {
    display: inline-block;
    min-width: 5.5rem;
    color: var(--muted);
    font-size: 0.8rem;
}

/* Repeatable link rows on the item form. */
.register-links {
    margin-top: 1rem;
}

.register-link-row {
    display: grid;
    grid-template-columns: 8rem 1fr 1fr 1.5fr 1.5fr auto;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    align-items: center;
}

@media (max-width: 900px) {
    .register-link-row {
        grid-template-columns: 1fr 1fr;
    }
}

.form-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem 1rem;
    margin-top: 1rem;
}

.status-swatch {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 3px;
    flex: 0 0 auto;
    border: 1px solid rgba(15, 23, 42, 0.18);
}

.status-swatch-neutral {
    background: #cbd5e1;
}

.status-swatch-open { background: var(--status-open-accent); }
.status-swatch-reopen { background: var(--status-reopen-accent); }
.status-swatch-resume { background: var(--status-resume-accent); }
.status-swatch-inprogress { background: var(--status-inprogress-accent); }
.status-swatch-onhold { background: var(--status-onhold-accent); }
.status-swatch-futurephase { background: var(--status-futurephase-accent); }
.status-swatch-inspec { background: var(--status-inspec-accent); }
.status-swatch-pendingplan { background: var(--status-pendingplan-accent); }
.status-swatch-planned { background: var(--status-planned-accent); }
.status-swatch-parked { background: var(--status-parked-accent); }
.status-swatch-resolved { background: var(--status-resolved-accent); }
.status-swatch-canceled { background: var(--status-canceled-accent); }
.status-swatch-softclose { background: var(--status-softclose-accent); }

.status-picker {
    position: relative;
    width: 100%;
}

.status-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.status-picker-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
}

.status-picker-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-picker-option-label {
    flex: 1 1 auto;
    white-space: nowrap;
}

.status-picker-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 40;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 16rem;
    overflow-y: auto;
}

.status-picker-menu.status-picker-menu-open {
    display: block;
}

.status-picker-menu-floating {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    width: max-content;
    min-width: 11.5rem;
    z-index: 1200;
}

.status-picker-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    font-weight: 600;
}

.status-picker-option:hover,
.status-picker-option.is-selected {
    background: #f1f5f9;
}

.status-picker-option.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.status-picker-compact .status-picker-trigger,
.status-picker-compact .status-picker-option {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.badge-priority-low { background: #f1f5f9; color: #475569; }
.badge-priority-medium { background: #dbeafe; color: #1d4ed8; }
.badge-priority-high { background: #ffedd5; color: #c2410c; }
.badge-priority-critical { background: #fee2e2; color: #b91c1c; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field.span-2 {
    grid-column: span 2;
}

.form-field.is-hidden {
    display: none !important;
}

label.required-field-label::after,
.field-label.required-field-label::after,
.form-field.field-requires-selection > .field-label::after,
.form-field:has(> input[required]:not([type="checkbox"]):not([type="hidden"])):not(:has(> label.checkbox-label)) > label:not(.checkbox-label)::after,
.form-field:has(> select[required]) > label:not(.checkbox-label)::after,
.form-field:has(> textarea[required]) > label:not(.checkbox-label)::after,
.form-field:has(> input[data-val-required]:not([type="checkbox"]):not([type="hidden"])):not(:has(> label.checkbox-label)) > label:not(.checkbox-label)::after,
.form-field:has(> select[data-val-required]) > label:not(.checkbox-label)::after,
.form-field:has(> textarea[data-val-required]) > label:not(.checkbox-label)::after,
label[for]:not(.checkbox-label):has(+ input[required]:not([type="checkbox"]):not([type="hidden"]))::after,
label[for]:not(.checkbox-label):has(+ select[required])::after,
label[for]:not(.checkbox-label):has(+ textarea[required])::after,
label[for]:not(.checkbox-label):has(+ input[data-val-required]:not([type="checkbox"]):not([type="hidden"]))::after,
label[for]:not(.checkbox-label):has(+ select[data-val-required])::after,
label[for]:not(.checkbox-label):has(+ textarea[data-val-required])::after {
    content: " *";
    color: var(--danger);
    font-weight: 600;
}

.form-field-approved .checkbox-label {
    min-height: 2.25rem;
}

.date-range-filter {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.date-range-filter-custom-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.date-range-filter-custom-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

.form-control:focus {
    outline: 2px solid #bfdbfe;
    border-color: var(--accent-line);
}

.validation-summary {
    color: var(--danger);
    margin-bottom: 1rem;
}

.field-error {
    color: var(--danger);
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-actions .button-secondary,
.form-actions .button-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.item-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.attachment-panel {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.paste-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    margin: 1rem 0;
    cursor: pointer;
}

.paste-zone:focus {
    outline: 2px solid #bfdbfe;
    border-color: var(--accent-line);
}

.paste-zone.drag-over {
    border-color: var(--accent-line);
    background: #eff6ff;
}

.pending-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pending-attachment {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    background: #fff;
}

.pending-attachment img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
}

.pending-attachment .name {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    word-break: break-word;
}

.pending-attachment button {
    margin-top: 0.35rem;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    font-size: 0.8rem;
}

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
}

.attachment-list.compact {
    gap: 0.35rem;
}

.attachment-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.attachment-thumb {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.attachment-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-expand-attachment-group {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.item-expand-attachment-label {
    font-size: 0.82rem;
}

.item-mobile-item-images {
    margin-top: 0.5rem;
}

.activity-attachment-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0;
}

.activity-attachment-thumb-item {
    display: grid;
    gap: 0.25rem;
    justify-items: start;
    max-width: 11rem;
}

.activity-attachment-thumb-button {
    display: block;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    line-height: 0;
}

.activity-attachment-thumb-button:hover,
.activity-attachment-thumb-button:focus-visible {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-line) 25%, transparent);
}

.activity-attachment-thumb {
    width: 88px;
    height: 66px;
    object-fit: cover;
    display: block;
}

.activity-attachment-name-link {
    border: 0;
    background: transparent;
    color: var(--accent-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    padding: 0;
    text-align: left;
    text-decoration: underline;
    word-break: break-word;
}

.activity-attachment-name-link:hover,
.activity-attachment-name-link:focus-visible {
    color: color-mix(in srgb, var(--primary) 80%, var(--text));
}


.image-preview-nav {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
}

.image-preview-nav:hover:not(:disabled),
.image-preview-nav:focus-visible {
    border-color: var(--accent-line);
    color: var(--accent-text);
}

.image-preview-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.image-preview-counter {
    margin: 0;
    font-size: 0.85rem;
    text-align: center;
    min-width: 3.5rem;
}

/* The prev / counter / next cluster now sits in the modal footer (not over the
   image), so the image never shares its row and the body can never overflow
   sideways. The cluster is pushed to the left while Open / Close stay on the
   right, and it is hidden entirely for a single-image preview. */
.image-preview-actions {
    align-items: center;
    flex-wrap: wrap;
}

.image-preview-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

.image-preview-nav-group[hidden] {
    display: none;
}


.image-preview-caption {
    margin: 0 0 1rem;
    word-break: break-word;
}

.inline-form {
    display: inline;
}

.login-body .site-header {
    margin-bottom: 0;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 5rem);
    padding-block: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    margin: 0;
}

.login-card-title {
    margin: 0 0 1.25rem;
    text-align: center;
    font-size: 1.5rem;
}

.login-form-actions {
    margin-top: 0.25rem;
}

.button-primary-block {
    width: 100%;
}

.filter-panel {
    margin-bottom: 0.5rem;
}

.filter-active-hint {
    margin: 0 0 1rem;
    font-size: 0.88rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem 1rem;
    align-items: end;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.form-control-compact {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 0.3rem 0.35rem;
    font-size: 0.82rem;
}

.status-form {
    display: inline-block;
}

.ai-queue-text {
    min-height: 18rem;
    font-family: Consolas, "Courier New", monospace;
    white-space: pre-wrap;
}

.link-button {
    background: none;
    border: none;
    color: var(--accent-text);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.link-button:hover:not(:disabled):not(.is-busy) {
    text-decoration: underline;
    color: var(--accent-text-hover);
}

.link-button:active:not(:disabled):not(.is-busy) {
    color: #1e40af;
}

.link-button:disabled,
.link-button.is-busy {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.link-button.danger {
    color: var(--danger);
}

.link-button.danger:hover:not(:disabled):not(.is-busy) {
    color: var(--danger-hover);
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.sort-link:hover {
    color: var(--accent-text);
    text-decoration: none;
}

.sort-link .icon {
    width: 0.85rem;
    height: 0.85rem;
    opacity: 0.65;
}

.sort-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon {
    width: 1rem;
    height: 1rem;
    display: block;
}

.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
}

.icon-button:hover:not(:disabled) {
    border-color: var(--accent-line);
    color: var(--accent-text);
    text-decoration: none;
}

.icon-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.icon-button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-accent);
}

.icon-button-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--on-accent);
}

.icon-button-danger {
    color: var(--danger);
}

.icon-button-danger:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}

.icon-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.2rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--on-accent);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
}

.select-column {
    width: 1.75rem;
    text-align: center;
}

.expand-column {
    width: 1.75rem;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}

/* Reserve the scrollbar gutter so locking the page for a modal does not shift
   the layout, and lock page scroll while any modal overlay is open (the
   scrolling element is <html>; modal-escape.js toggles .modal-open). */
html {
    scrollbar-gutter: stable;
}

html.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 10000;
    overscroll-behavior: contain;
}

.modal-overlay-primary {
    z-index: 10000;
}

.modal-overlay-stacked {
    z-index: 10100;
}

.modal-overlay-stacked.is-front {
    z-index: 10150;
}

.modal-overlay-image-preview {
    z-index: 10200;
    padding: 0.5rem;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    width: min(480px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    color: var(--text);
}

.modal-card.image-preview-card {
    width: min(96vw, 90rem);
    max-width: 96vw;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    padding: 0.85rem 1rem;
}

.image-preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex: 1 1 auto;
    min-height: min(72vh, calc(96vh - 11rem));
    max-height: calc(96vh - 9rem);
    overflow: hidden;
    min-width: 0;
    margin-bottom: 0.35rem;
}

.image-preview-full {
    display: block;
    flex: 0 1 auto;
    max-width: 100%;
    max-height: min(calc(96vh - 10rem), 85vh);
    width: auto;
    height: auto;
    margin-inline: auto;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.modal-card-wide {
    width: min(720px, 100%);
}

.modal-card-lg {
    width: min(800px, calc(100vw - 2rem));
}

.modal-card-xl {
    width: min(1100px, calc(100vw - 2rem));
}

.modal-card.modal-card-wide,
.modal-card.modal-card-lg,
.modal-card.modal-card-xl {
    max-width: calc(100vw - 2rem);
}

.modal-overlay.modal-overlay-chart-expanded {
    z-index: 10300;
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
}

.modal-card.modal-card-chart-expanded {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem 0.75rem;
    margin: 0;
}

.dashboard-chart-expanded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    margin-bottom: 0.35rem;
}

.dashboard-chart-expanded-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.dashboard-chart-expanded-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.dashboard-chart-expanded-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.activity-browser-modal-card {
    max-height: calc(100vh - 1.5rem);
    width: min(96vw, 1500px);
    border: 1px solid color-mix(in srgb, var(--accent-line) 18%, var(--border));
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.activity-browser-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.activity-browser-modal-heading h2 {
    margin: 0 0 0.1rem;
    font-size: 1.2rem;
}

.activity-browser-header-toolbar {
    display: grid;
    grid-template-columns: auto minmax(14rem, 1fr) minmax(9rem, 12rem) auto;
    align-items: end;
    gap: 0.75rem 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.7rem;
    background: color-mix(in srgb, var(--primary) 5%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent-line) 14%, var(--border));
    border-radius: var(--radius);
    flex-shrink: 0;
}

.activity-browser-toolbar-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
}

.activity-browser-toolbar-field {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.activity-browser-toolbar-field-search {
    min-width: 0;
}

.activity-browser-toolbar-field-filter {
    min-width: 0;
}

.activity-browser-toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.activity-browser-search-input {
    min-width: 0;
}

.activity-browser-type-filter {
    min-width: 10.5rem;
}

.activity-browser-result-count {
    margin: 0 0 0.15rem;
    font-size: 0.85rem;
    white-space: nowrap;
    justify-self: end;
    text-align: right;
}

.activity-browser-modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    flex: 1 1 auto;
}

.activity-browser-empty-state {
    padding: 1.25rem;
    text-align: center;
}

.activity-browser-split {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: min(86vh, 1200px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.activity-browser-panels {
    display: grid;
    /* Give the preview (detail) pane more height than the activity list, per
       the outlook-style reading layout. Shorter list rows + this ratio mean
       the bottom preview area is the larger of the two. */
    grid-template-rows: minmax(0, 1fr) minmax(0, 1.4fr);
    grid-template-columns: 1fr;
    min-height: 0;
    flex: 1 1 auto;
    height: 100%;
}

.activity-browser-list-pane,
.activity-browser-detail-pane {
    display: grid;
    min-height: 0;
    overflow: hidden;
}

.activity-browser-list-pane {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-alt) 82%, var(--surface));
}

.activity-browser-detail-pane {
    grid-template-rows: auto minmax(0, 1fr);
    background: color-mix(in srgb, var(--surface-alt) 35%, var(--surface));
}

.activity-browser-pane-header {
    padding: 0.35rem 0.9rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.activity-browser-table-head-wrap {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary) 6%, var(--surface-alt));
}

.activity-browser-created-row-wrap {
    flex-shrink: 0;
    border-top: 2px solid color-mix(in srgb, var(--accent-line) 22%, var(--border));
    background: color-mix(in srgb, #f59e0b 10%, var(--surface));
    position: relative;
    z-index: 1;
}

.activity-browser-pane-header h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.activity-browser-list-scroll,
.activity-browser-detail-scroll {
    overflow: auto;
    min-height: 0;
}

.activity-browser-detail-scroll {
    padding: 1rem 1.1rem;
}

.activity-browser-filter-empty {
    padding: 1.25rem 1rem;
    text-align: center;
}

.activity-browser-col-when {
    width: 10.5rem;
}

.activity-browser-col-type {
    width: 8.5rem;
}

.activity-browser-col-from {
    width: 8rem;
}

.activity-browser-col-actions {
    width: 5.5rem;
}

.activity-browser-actions .action-bar {
    justify-content: flex-end;
}

.activities-table-wrap {
    margin-top: 1rem;
}

.activities-col-actions {
    width: 5.5rem;
}

.activities-col-when {
    width: 10.5rem;
}

.activities-col-type {
    width: 8.5rem;
}

.activities-col-work-item {
    width: 7rem;
}

.activities-col-project {
    width: 6rem;
}

.activities-col-from {
    width: 8rem;
}

.activity-browser-table {
    margin: 0;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.activity-browser-table-head thead th {
    padding: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.activity-browser-table-body td,
.activity-browser-table-created td {
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.activity-browser-sort-button {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    margin: 0;
    padding: 0.4rem 0.65rem;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    cursor: pointer;
}

.activity-browser-sort-button:hover,
.activity-browser-sort-button:focus-visible {
    color: var(--accent-text);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.activity-browser-sort-button.is-sorted {
    color: var(--text);
}

.activity-browser-sort-indicator {
    flex-shrink: 0;
    width: 0.85rem;
    font-size: 0.7rem;
    line-height: 1;
    opacity: 0.75;
}

.activity-browser-sort-button:not(.is-sorted) .activity-browser-sort-indicator {
    opacity: 0.35;
}

.activity-browser-table td {
    padding: 0.3rem 0.6rem;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-browser-row {
    cursor: pointer;
}

.activity-browser-row:nth-child(even) {
    background: color-mix(in srgb, var(--surface-alt) 35%, transparent);
}

.activity-browser-row:hover {
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.activity-browser-row.is-selected {
    background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}

.activity-browser-row.is-selected td {
    font-weight: 600;
}

.activity-browser-row-created {
    background: color-mix(in srgb, #f59e0b 14%, var(--surface)) !important;
}

.activity-browser-row-created:hover {
    background: color-mix(in srgb, #f59e0b 22%, var(--surface)) !important;
}

.activity-browser-row-created.is-selected {
    background: color-mix(in srgb, #f59e0b 28%, var(--surface)) !important;
}

.activity-browser-summary-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    line-height: 1.35;
}

.activity-browser-summary-preview p,
.activity-browser-summary-preview ul,
.activity-browser-summary-preview ol {
    display: inline;
    margin: 0;
}

.activity-browser-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.55rem 1rem;
}

.activity-browser-item-field {
    display: grid;
    gap: 0.15rem;
}

.activity-browser-item-field-wide {
    grid-column: 1 / -1;
}

.activity-browser-item-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.activity-browser-item-value {
    font-size: 0.9rem;
    line-height: 1.35;
}

.activity-browser-tag-badge {
    margin-right: 0.25rem;
}

.activity-browser-item-snapshot .activity-browser-detail-header h4 {
    color: color-mix(in srgb, #b45309 70%, var(--text));
}

.activity-browser-when {
    font-size: 0.84rem;
}

.activity-browser-type .badge {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.72rem;
}

.activity-browser-from,
.activity-browser-summary {
    font-size: 0.88rem;
}

.activity-browser-detail {
    display: grid;
    gap: 1rem;
}

.activity-browser-detail-header {
    display: grid;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.activity-browser-detail-header h4 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
}

.activity-browser-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.activity-browser-detail-section {
    display: grid;
    gap: 0.45rem;
}

.activity-browser-detail-section h5 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.activity-browser-detail-body {
    margin: 0;
}

.activity-browser-detail-attachments,
.activity-browser-detail-questions {
    gap: 0.55rem;
}

.activity-browser-detail-empty,
.activity-browser-detail-placeholder {
    margin: 0;
}

@media (max-width: 720px) {
    .activity-browser-modal-card {
        width: calc(100vw - 1rem);
    }

    .activity-browser-header-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .activity-browser-result-count {
        justify-self: start;
        text-align: left;
    }
}

.modal-card-scrollable {
    position: relative;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-scroll-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 0.15rem;
    overscroll-behavior: contain;
}

.modal-card.is-busy .modal-scroll-body,
.modal-card.is-busy .modal-actions {
    pointer-events: none;
    opacity: 0.55;
}

.modal-busy-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.88);
    border-radius: var(--radius);
}

.modal-busy-overlay[hidden] {
    display: none;
}

.modal-busy-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.modal-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: modal-spin 0.8s linear infinite;
}

@keyframes modal-spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-actions-inline {
    justify-content: flex-start;
    margin-top: 0;
    margin-bottom: 1rem;
}

.form-control-readonly {
    background: #f8fafc;
    color: #334155;
}

.ai-suggestions-form .form-field {
    margin-bottom: 0;
}

.modal-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

.app-dialog-message {
    margin: 0 0 1rem;
    line-height: 1.5;
}

.app-copy-textarea {
    width: 100%;
    min-height: 12rem;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
}

.modal-card .form-field {
    margin-bottom: 1rem;
}

.ai-suggestions-grid {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.ai-suggestion-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.ai-suggestion-field .suggestion-value {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.ai-improvement-list {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.ai-improvement-list li {
    margin-bottom: 0.35rem;
}

.ai-status-message {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.ai-error-banner {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.saved-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.saved-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9rem;
}

.saved-filter-chip a {
    color: inherit;
    text-decoration: none;
}

.saved-filter-chip a:hover {
    text-decoration: underline;
}

/* System views: a distinct, built-in group rendered before the user's saved
   views. Accent-tinted pills with a small system glyph and no remove control,
   so they read as fixed entry points rather than deletable saved filters. */
.system-views-row {
    margin-bottom: 0.5rem;
}

.system-views-label {
    font-weight: 600;
}

.system-view-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border: 0.5px solid var(--accent-line);
    border-radius: var(--radius-pill);
    background: var(--accent-subtle);
    color: var(--accent-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.1;
}

.system-view-chip:hover,
.system-view-chip:focus-visible {
    background: var(--accent);
    color: var(--on-accent);
    text-decoration: none;
    outline: none;
}

.system-view-chip.is-active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}

.system-view-chip-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.system-view-chip-glyph .icon,
.system-view-chip-glyph svg {
    width: 0.85rem;
    height: 0.85rem;
}

.bulk-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
}

.bulk-assign-results {
    margin-top: 1rem;
}

.bulk-assign-summary {
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.bulk-assign-result-list {
    margin: 0;
    padding-left: 1.25rem;
    max-height: 14rem;
    overflow-y: auto;
}

.bulk-assign-result-success {
    color: #166534;
}

.bulk-assign-result-failure {
    color: #b91c1c;
}

.bulk-actions-bar[hidden] {
    display: none !important;
}

.activity-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-timeline > li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.activity-timeline > li:last-child {
    border-bottom: none;
}

.activity-timeline .md-preview li,
.activity-timeline .activity-entry-detail li {
    padding: 0;
    border-bottom: none;
}

.activity-timeline-user {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-timeline-user > li {
    padding: 0;
    border-bottom: none;
}

.activity-timeline-user > li.activity-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-line);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
}

.activity-entry-summary {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

.activity-entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.activity-entry-meta .activity-time {
    margin-top: 0;
}

.activity-entry-actor::before {
    content: "·";
    margin-right: 0.6rem;
    color: var(--border);
}

.activity-ai-metrics {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
}

.activity-ai-metrics span + span::before {
    content: "·";
    margin-right: 0.6rem;
    color: var(--border);
}

.activity-effort-hours {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
}

.activity-effort-hours span + span::before {
    content: "·";
    margin-right: 0.6rem;
    color: var(--border);
}

.effort-hours-readonly-panel {
    margin: 0 0 1rem;
}

.feature-filter-effort {
    display: inline-block;
    margin-left: 0.35rem;
}

.feature-filter-effort span + span::before {
    content: " · ";
}

#features-table .features-effort-cell {
    min-width: 6.5rem;
    white-space: nowrap;
}

.features-effort-linked {
    display: block;
    font-size: 0.85em;
}

.ai-usage-readonly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem 1.25rem;
    margin: 0;
}

.ai-usage-readonly-field {
    margin: 0;
}

.ai-usage-readonly-field dt {
    margin: 0 0 0.2rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
}

.ai-usage-readonly-field dd {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    word-break: break-word;
}

.activity-browser-detail-meta .activity-ai-metrics {
    width: 100%;
    flex-basis: 100%;
}

.activity-entry-detail.md-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.65rem 0.85rem;
    margin: 0.65rem 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.activity-entry-detail.md-preview p {
    margin: 0 0 0.4rem;
}

.activity-entry-detail.md-preview p:last-child {
    margin-bottom: 0;
}

.activity-entry-detail.md-preview ul,
.activity-entry-detail.md-preview ol {
    margin: 0 0 0.4rem;
}

.activity-entry-detail.md-preview hr {
    margin: 0.4rem 0;
}

.activity-entry-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.activity-edit-form {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.activity-questions-panel {
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.activity-questions-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.activity-questions-title {
    margin: 0;
    font-size: 1rem;
}

.activity-questions-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.activity-questions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.activity-question-card,
.activity-question-readonly-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    background: var(--bg);
}

.activity-question-card.activity-question-card-answer {
    padding: 0.55rem 0.65rem;
}

.activity-question-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.activity-question-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.activity-question-option {
    padding: 0.75rem;
    border: 1px dashed var(--border);
    border-radius: calc(var(--radius) - 2px);
}

.activity-question-answer-prompt {
    margin: 0 0 0.4rem;
    font-size: 0.92rem;
    line-height: 1.35;
}

.activity-question-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.activity-question-choice-option {
    display: block;
    margin: 0;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--surface);
    cursor: pointer;
    line-height: 1.3;
    font-size: 0.88rem;
}

.activity-question-choice-option:has(input:checked) {
    border-color: var(--accent-line);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.activity-question-choice-row {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.activity-question-choice-row input {
    margin: 0.15rem 0 0;
    flex-shrink: 0;
}

.activity-question-choice-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.activity-question-option-description {
    margin: 0.2rem 0 0 1.2rem;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.35;
}

.activity-question-option-description p {
    margin: 0;
}

.activity-question-choice-other {
    grid-column: 1 / -1;
    display: block;
    border-style: dashed;
}

.activity-question-choice-other .form-control {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.88rem;
}

.activity-questions-readonly {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.activity-question-readonly-prompt {
    display: block;
    margin-bottom: 0.35rem;
}

.activity-question-readonly-choices {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.3rem;
}

.activity-question-readonly-choices > li {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    font-size: 0.88rem;
    line-height: 1.3;
}

.activity-question-readonly-choices > li.is-selected {
    border-color: var(--accent-line);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.activity-question-readonly-marker {
    flex-shrink: 0;
    width: 0.9rem;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.35;
}

.activity-question-readonly-choices > li.is-selected .activity-question-readonly-marker {
    color: var(--accent-text);
    font-weight: 700;
}

.activity-question-readonly-choice-body {
    min-width: 0;
}

.activity-question-readonly-card {
    padding: 0.55rem 0.65rem;
}

.activity-question-readonly-prompt {
    font-size: 0.92rem;
    line-height: 1.35;
}

.activity-question-readonly-answer,
.activity-question-readonly-other {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
}

.activity-entry-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.activity-entry-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.activity-delete-button {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.activity-delete-button:hover:not(:disabled):not(.is-busy) {
    color: var(--danger-hover);
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}

.activity-reply-badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.activity-replies {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0 0 0 1.15rem;
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.activity-entry-reply {
    margin-left: calc((var(--activity-depth, 2) - 1) * 0.65rem);
}

.activity-modal-reply-lead {
    margin: 0.35rem 0 0;
    font-weight: 600;
}

.activity-time {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.audit-log-wrap {
    box-shadow: none;
    border: none;
    background: transparent;
}

.audit-log-table {
    font-size: 0.85rem;
}

.audit-log-table th,
.audit-log-table td {
    padding: 0.35rem 0.6rem;
    vertical-align: top;
}

.audit-log-time {
    white-space: nowrap;
    color: var(--muted);
}

.audit-log-summary {
    word-break: break-word;
}

.similar-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.similar-items-list li {
    padding: 0.5rem 0;
}

.list-attachment-preview {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.list-attachment-thumb {
    width: 36px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.shortcuts-list {
    margin: 0;
    padding-left: 1.25rem;
}

.shortcuts-list li {
    margin-bottom: 0.5rem;
}

.form-actions-inline {
    margin-top: 0.75rem;
}

.ai-triage-results {
    margin-top: 0.75rem;
}

.ai-triage-results[hidden] {
    display: none !important;
}

.md-preview {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
}

.md-preview.md-preview-loading {
    color: var(--muted);
    font-style: italic;
}

.ai-summary-output {
    max-height: 28rem;
    overflow: auto;
}

.md-preview h1,
.md-preview h2,
.md-preview h3,
.md-preview h4 {
    margin: 0 0 0.6rem;
    line-height: 1.3;
    color: var(--text);
}

.md-preview h1 { font-size: 1.35rem; }
.md-preview h2 { font-size: 1.15rem; }
.md-preview h3 { font-size: 1.02rem; }

.md-preview p {
    margin: 0 0 0.75rem;
}

.md-preview p:last-child {
    margin-bottom: 0;
}

.md-preview ul,
.md-preview ol {
    margin: 0 0 0.75rem;
    padding-left: 1.35rem;
}

.md-preview li {
    margin-bottom: 0.35rem;
}

.md-preview li:last-child {
    margin-bottom: 0;
}

.md-preview strong {
    font-weight: 700;
}

.md-preview code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.88em;
    background: #e2e8f0;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.md-preview pre {
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.9rem;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 8px;
    overflow-x: auto;
}

.md-preview pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.md-preview blockquote {
    margin: 0 0 0.75rem;
    padding: 0.35rem 0 0.35rem 0.9rem;
    border-left: 3px solid var(--accent-line);
    color: var(--muted);
}

.md-preview hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.75rem 0;
}

.md-preview a {
    color: var(--accent-text);
    text-decoration: underline;
}

.md-preview-compact {
    margin-top: 0.35rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.feature-description-cell .feature-description-preview {
    margin-top: 0;
    overflow: visible;
}

.feature-description-cell .feature-description-preview > :last-child {
    margin-bottom: 0;
}

.activity-md-readonly {
    background: transparent;
    border: none;
    padding-left: 0;
    padding-right: 0;
}

.item-activity-fields-grid {
    margin-top: 0.5rem;
}

.markdown-editor-field + .EasyMDEContainer,
.form-field .EasyMDEContainer {
    margin-top: 0.25rem;
}

.item-form .form-field.markdown-attached > textarea.markdown-editor-field {
    display: none;
}

.item-form .form-field .EasyMDEContainer {
    width: 100%;
    max-width: 100%;
}

.EasyMDEContainer .CodeMirror {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    min-height: 8rem;
}

.EasyMDEContainer .CodeMirror-scroll {
    min-height: 8rem;
}

.EasyMDEContainer .editor-toolbar {
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: #f8fafc;
}

.EasyMDEContainer .editor-toolbar button {
    color: var(--text);
}

.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
    background: #e2e8f0;
    border-color: var(--border);
}

.EasyMDEContainer .editor-statusbar {
    color: var(--muted);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.fix-prompt-output {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 24rem;
    overflow: auto;
}

@media (max-width: 991.98px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }

    .site-header.site-nav-open .site-nav {
        display: flex;
    }

    .site-nav .button-primary,
    .site-nav a,
    .site-nav .inline-form,
    .site-nav .link-button {
        width: 100%;
        text-align: left;
    }

    .site-nav .inline-form {
        margin: 0;
    }

    .site-nav .nav-dropdown {
        width: 100%;
    }

    .site-nav .nav-dropdown-toggle {
        width: 100%;
        text-align: left;
        padding-inline: 0;
    }

    .site-nav .nav-dropdown-menu {
        position: static;
        top: auto;
        left: auto;
        max-height: none;
        overflow-y: visible;
        margin-top: 0.35rem;
        margin-bottom: 0.25rem;
        margin-left: 0.75rem;
        box-shadow: none;
        border: 0;
        border-left: 2px solid var(--border);
        border-radius: 0;
        padding: 0.15rem 0 0.15rem 0.75rem;
    }

    .site-nav .nav-dropdown:hover .nav-dropdown-menu {
        display: none;
    }

    .site-nav .nav-dropdown.is-open .nav-dropdown-menu {
        display: flex;
    }

    .dashboard-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-charts-grid,
    .dashboard-features-grid,
    .dashboard-trends-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 992px) {
    .data-table-fluid:not(#items-table) .col-title {
        width: 22%;
    }

    .data-table-fluid .col-description {
        width: 28%;
    }
}

@media (max-width: 900px) {
    .data-table-fluid:not(#items-table):not(#features-table) {
        min-width: 48rem;
    }

    .header-inner {
        gap: 0.75rem;
    }
}

@media (max-width: 720px) {
    .site-header {
        margin-bottom: 1.25rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field.span-2 {
        grid-column: span 1;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .button-secondary,
    .header-actions .icon-button {
        flex: 1 1 auto;
    }

    .activity-entry-header {
        flex-direction: column;
        align-items: stretch;
    }

    .activity-entry-actions {
        width: 100%;
    }

    .activity-entry-actions .button-secondary {
        flex: 1 1 auto;
    }

    .activity-replies {
        padding-left: 0.65rem;
    }

    .activity-questions-toolbar {
        width: 100%;
    }

    .activity-questions-toolbar .button-secondary {
        flex: 1 1 calc(50% - 0.25rem);
    }

    .activity-question-choices,
    .activity-question-readonly-choices {
        grid-template-columns: 1fr;
    }

    .bulk-actions-bar {
        padding: 0.65rem 0.75rem;
    }

    .bulk-actions-bar .button-secondary,
    .bulk-actions-bar .button-danger {
        flex: 1 1 calc(50% - 0.5rem);
        text-align: center;
    }

    .detail-list {
        grid-template-columns: 1fr;
        gap: 0.15rem 0;
    }

    .manual-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-stat dd {
        font-size: 1.25rem;
    }

    .manual-detail-list {
        grid-template-columns: 1fr;
    }

    .detail-list dt {
        margin-top: 0.5rem;
    }

    .attachment-item {
        flex-direction: column;
    }

    .attachment-thumb {
        width: 100%;
        max-width: 16rem;
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .login-card {
        max-width: none;
    }

    .items-list-desktop {
        display: none;
    }

    .items-mobile-list {
        display: grid;
    }

    .items-list-toolbar {
        margin-bottom: 0.75rem;
    }

    .saved-filters-row {
        flex-direction: column;
        align-items: flex-start;
    }

    /* System views stay a wrapping row of pills on mobile (they have no inline
       delete form, so they read fine side by side). */
    .system-views-row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .modal-card {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }

    .modal-card.image-preview-card {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
        max-height: calc(100vh - 0.5rem);
    }

    .image-preview-body {
        min-height: min(68vh, calc(100vh - 11rem));
        max-height: calc(100vh - 9rem);
    }

    .image-preview-full {
        max-width: calc(100vw - 5rem);
        max-height: min(calc(100vh - 10rem), 82vh);
    }
}

/* Inline approval toggle pill on the items list */
.approve-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.12s ease, box-shadow 0.12s ease;
}

.approve-pill:hover {
    filter: brightness(0.96);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.approve-pill.is-approved {
    background: #e7f6ec;
    border-color: #57b87a;
    color: #1c6b3c;
}

.approve-pill.is-pending {
    background: #fdf3e0;
    border-color: #e0a64e;
    color: #8a5a12;
}

/* Title/description preview icon + popover on the items list */
.item-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.35rem;
    padding: 0;
    width: 1.25rem;
    height: 1.25rem;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    vertical-align: middle;
    border-radius: 50%;
}

.item-preview:hover,
.item-preview:focus {
    color: var(--accent-text);
    background: rgba(37, 99, 235, 0.1);
    outline: none;
}

.item-preview-pop {
    position: absolute;
    z-index: 1000;
    width: min(42rem, calc(100vw - 1.5rem));
    min-width: min(28rem, calc(100vw - 1.5rem));
    max-width: min(42rem, calc(100vw - 1.5rem));
    padding: 0.75rem 0.9rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    line-height: 1.45;
    pointer-events: none;
    box-sizing: border-box;
}

.item-preview-pop-title {
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.item-preview-pop-meta {
    color: var(--muted);
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
}

.item-preview-pop-desc {
    white-space: pre-wrap;
    max-height: 20rem;
    overflow-y: auto;
}

/* Work item counter under the list */
.items-count {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Add-activity form on the details page */
.add-activity-form {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Theme toggle button in the header */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    margin-right: 0.75rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.theme-toggle:hover {
    border-color: var(--accent-line);
    color: var(--accent-text);
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Dark theme - overrides the core design tokens plus the high-traffic light surfaces. */
html[data-theme="dark"] {
    --bg: #0f141b;
    --surface: #182029;
    --text: #e6eaf0;
    --muted: #9aa6b6;
    --border: #2b3744;
    --primary: #5b9bff;
    --primary-hover: #7cb0ff;
    --danger: #f87171;
    --danger-hover: #fca5a5;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
    --status-open-bg: #14233c;
    --status-open-border: #2b4a7a;
    --status-open-accent: #60a5fa;
    --status-open-text: #93c5fd;
    --status-reopen-bg: #352608;
    --status-reopen-border: #5C461A;
    --status-reopen-accent: #C9952F;
    --status-reopen-text: #E7C489;
    --status-inprogress-bg: #2a2410;
    --status-inprogress-border: #6b5a1e;
    --status-inprogress-accent: #f59e0b;
    --status-inprogress-text: #fdba74;
    --status-onhold-bg: #1e1b3a;
    --status-onhold-border: #4338ca;
    --status-onhold-accent: #818cf8;
    --status-onhold-text: #a5b4fc;
    --status-resume-bg: #0f2a30;
    --status-resume-border: #0e7490;
    --status-resume-accent: #22d3ee;
    --status-resume-text: #67e8f9;
    --status-futurephase-bg: #0f2a26;
    --status-futurephase-border: #0f766e;
    --status-futurephase-accent: #2dd4bf;
    --status-futurephase-text: #5eead4;
    --status-inspec-bg: #2a1430;
    --status-inspec-border: #86198f;
    --status-inspec-accent: #e879f9;
    --status-inspec-text: #f0abfc;
    --status-pendingplan-bg: #2a1a0e;
    --status-pendingplan-border: #9a3412;
    --status-pendingplan-accent: #fb923c;
    --status-pendingplan-text: #fdba74;
    --status-planned-bg: #0c2233;
    --status-planned-border: #075985;
    --status-planned-accent: #38bdf8;
    --status-planned-text: #7dd3fc;
    --status-parked-bg: #1c1917;
    --status-parked-border: #57534e;
    --status-parked-accent: #a8a29e;
    --status-parked-text: #d6d3d1;
    --status-resolved-bg: #11271a;
    --status-resolved-border: #2f6b40;
    --status-resolved-accent: #34d399;
    --status-resolved-text: #6ee7b7;
    --status-softclose-bg: #1c1917;
    --status-softclose-border: #57534e;
    --status-softclose-accent: #a8a29e;
    --status-softclose-text: #d6d3d1;
    --status-canceled-bg: #1a212b;
    --status-canceled-border: #3a485a;
    --status-canceled-accent: #94a3b8;
    --status-canceled-text: #cbd5e1;
}

html[data-theme="dark"] .data-table th,
html[data-theme="dark"] .item-activity-row td {
    background: #131a22;
}

html[data-theme="dark"] #items-table tbody tr.item-row-striped td {
    background: #151d27;
}

html[data-theme="dark"] .tag-chip {
    background: #2b3744;
    color: #cbd5e1;
}

html[data-theme="dark"] .badge:not([class*="badge-status-"]) {
    background: #2b3744;
    color: #e6eaf0;
}

html[data-theme="dark"] .form-control {
    background: #0f141b;
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .form-control-readonly {
    background: #131a22;
}

html[data-theme="dark"] .status-swatch-neutral {
    background: #475569;
}

html[data-theme="dark"] .status-picker-menu {
    background: #182029;
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .status-picker-option:hover,
html[data-theme="dark"] .status-picker-option.is-selected {
    background: #243041;
}

html[data-theme="dark"] .callout {
    background: #11261b;
    border-color: #2f6b48;
}

html[data-theme="dark"] .dashboard-stat-workable { background: #11271a; border-color: #2f6b40; }
html[data-theme="dark"] .dashboard-stat-critical { background: #2a1414; border-color: #7a2b2b; }
html[data-theme="dark"] .dashboard-stat-pending { background: #2a2410; border-color: #6b5a1e; }
html[data-theme="dark"] .dashboard-stat-unassigned { background: #1a212b; border-color: #3a485a; }
html[data-theme="dark"] .dashboard-stat-createdtoday { background: #10243a; border-color: #2a4f73; }

html[data-theme="dark"] .approve-pill.is-approved { background: #11271a; border-color: #2f6b48; color: #7fd6a0; }
html[data-theme="dark"] .approve-pill.is-pending { background: #2a2410; border-color: #6b5a1e; color: #e6c578; }

html[data-theme="dark"] .md-preview {
    background: #131a22;
    color: var(--text);
}

html[data-theme="dark"] .badge-activity-created {
    background: #14233c;
    color: #93c5fd;
}

html[data-theme="dark"] .badge-activity-updated,
html[data-theme="dark"] .badge-activity-statuschanged,
html[data-theme="dark"] .badge-activity-prioritychanged,
html[data-theme="dark"] .badge-activity-categorychanged,
html[data-theme="dark"] .badge-activity-featurechanged,
html[data-theme="dark"] .badge-activity-ownerchanged,
html[data-theme="dark"] .badge-activity-tagschanged,
html[data-theme="dark"] .badge-activity-approvalchanged,
html[data-theme="dark"] .badge-activity-linkadded,
html[data-theme="dark"] .badge-activity-linkremoved,
html[data-theme="dark"] .badge-activity-testcaseadded,
html[data-theme="dark"] .badge-activity-testcaseupdated,
html[data-theme="dark"] .badge-activity-testcaseremoved,
html[data-theme="dark"] .badge-activity-attachmentadded,
html[data-theme="dark"] .badge-activity-attachmentremoved,
html[data-theme="dark"] .badge-activity-comment {
    background: #1e1b3a;
    color: #a5b4fc;
}

html[data-theme="dark"] .badge-activity-deleted {
    background: #2a1414;
    color: #fca5a5;
}

html[data-theme="dark"] .badge-activity-bulkaction {
    background: #1a212b;
    color: #cbd5e1;
}

html[data-theme="dark"] .md-preview code {
    background: #1e293b;
}

html[data-theme="dark"] .activity-md-readonly {
    background: transparent;
}

html[data-theme="dark"] .item-link-search-option:hover,
html[data-theme="dark"] .item-link-search-option:focus {
    background: #1e293b;
}

html[data-theme="dark"] .EasyMDEContainer .editor-toolbar {
    background: #131a22;
    border-color: var(--border);
}

html[data-theme="dark"] .EasyMDEContainer .editor-toolbar button:hover,
html[data-theme="dark"] .EasyMDEContainer .editor-toolbar button.active {
    background: #1e293b;
    border-color: var(--border);
}

html[data-theme="dark"] .EasyMDEContainer .CodeMirror {
    background: #0f141b;
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .EasyMDEContainer .editor-preview,
html[data-theme="dark"] .EasyMDEContainer .editor-preview-side {
    background: #131a22;
    border-color: var(--border);
}

.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    overflow: visible;
}

.nav-dropdown-toggle {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0.5rem 0.75rem;
}

.nav-dropdown-menu {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 11rem;
    position: absolute;
    top: calc(100% + 0.15rem);
    left: 0;
    z-index: 1201;
    max-height: min(24rem, calc(100vh - 5rem));
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: var(--shadow);
}

.nav-dropdown.is-open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
    display: flex;
}

@media (min-width: 992px) {
    #admin-nav-dropdown:not(.is-open) .nav-dropdown-menu {
        display: none;
    }

    #admin-nav-dropdown.is-open .nav-dropdown-menu {
        display: flex;
        position: fixed;
        top: auto;
        left: auto;
        z-index: 1300;
    }
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.35rem 0.5rem;
    border-radius: 0.35rem;
    white-space: nowrap;
}

.nav-dropdown-divider {
    height: 1px;
    margin: 0.35rem 0.25rem;
    background: var(--border);
}

.project-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.project-filter label {
    margin: 0;
    white-space: nowrap;
}

.project-filter select {
    min-width: 12rem;
}

.dashboard-filters {
    margin-bottom: 1.25rem;
}

.dashboard-filters .filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

/* Application log viewer */
.logs-index-page .log-file-path {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.log-filter-form {
    margin-bottom: 1.25rem;
}

.log-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.log-result-summary {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.log-table .col-log-time {
    width: 12rem;
}

.log-table .col-log-level {
    width: 7rem;
}

.log-table .col-log-category {
    width: 18rem;
}

.log-row {
    cursor: pointer;
    border-left: 4px solid transparent;
}

.log-row:hover,
.log-row:focus-visible {
    filter: brightness(0.98);
    outline: none;
}

.log-row-level-trace,
.log-row-level-debug {
    background: color-mix(in srgb, var(--text-muted) 8%, var(--surface));
    border-left-color: color-mix(in srgb, var(--text-muted) 55%, transparent);
}

.log-row-level-info {
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    border-left-color: color-mix(in srgb, var(--accent-line) 65%, transparent);
}

.log-row-level-warning {
    background: color-mix(in srgb, #d97706 12%, var(--surface));
    border-left-color: #d97706;
}

.log-row-level-error {
    background: color-mix(in srgb, var(--danger) 12%, var(--surface));
    border-left-color: var(--danger);
}

.log-row-level-critical {
    background: color-mix(in srgb, #7f1d1d 18%, var(--surface));
    border-left-color: #7f1d1d;
}

.log-category-cell {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.85rem;
    word-break: break-word;
}

.log-message-cell {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-level-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.log-level-trace {
    background: color-mix(in srgb, #94a3b8 24%, transparent);
    color: #64748b;
}

.log-level-debug {
    background: color-mix(in srgb, #64748b 24%, transparent);
    color: #475569;
}

.log-level-info {
    background: color-mix(in srgb, #2563eb 22%, transparent);
    color: #1d4ed8;
}

.log-level-warning {
    background: color-mix(in srgb, #d97706 24%, transparent);
    color: #b45309;
}

.log-level-error {
    background: color-mix(in srgb, #dc2626 24%, transparent);
    color: #b91c1c;
}

.log-level-critical {
    background: color-mix(in srgb, #7f1d1d 28%, transparent);
    color: #7f1d1d;
}

.log-entry-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem 1.25rem;
    margin: 0 0 1rem;
}

.log-entry-meta dt {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.log-entry-meta dd {
    margin: 0.15rem 0 0;
    word-break: break-word;
}

.log-entry-section-title {
    margin: 1rem 0 0.5rem;
    font-size: 0.9rem;
}

.log-entry-full-text {
    margin: 0;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 24rem;
    overflow: auto;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.pagination-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.items-table-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
}

.items-pager-summary {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.items-pager-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.items-pager-status {
    font-size: 0.9rem;
    color: var(--muted);
    padding-inline: 0.35rem;
    white-space: nowrap;
}

.filter-grid-primary {
    grid-template-columns: 1.2fr 1.5fr 1fr 0.7fr auto;
}

.filter-grid-advanced {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 0.75rem;
}

.filter-advanced {
    margin-top: 0.75rem;
}

.filter-advanced-summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}

.items-result-summary {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.callout-warning {
    border-color: #fde68a;
    background: #fffbeb;
}

.duplicate-warning-callout p {
    margin: 0.35rem 0 0.5rem;
}

.duplicate-warning-list {
    margin: 0;
    padding-left: 1.25rem;
}

.similar-item-score {
    font-size: 0.82rem;
}

.similar-item-likely-duplicate {
    font-weight: 600;
}

.command-palette-card {
    width: min(34rem, calc(100vw - 2rem));
    padding-top: 1rem;
}

.command-palette-search {
    margin-bottom: 0.75rem;
}

.command-palette-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 18rem;
    overflow: auto;
}

.command-palette-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.command-palette-item.is-active,
.command-palette-item:hover {
    background: var(--surface-alt);
}

.command-palette-item-label {
    flex: 1 1 auto;
}

.command-palette-item-hint {
    font-size: 0.75rem;
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-muted);
}

.command-palette-empty {
    padding: 0.55rem 0.65rem;
}

.command-palette-hint {
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
}

.command-palette-section-title {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.command-palette-shortcuts {
    margin-top: 0.5rem;
}

.kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(16rem, 1fr);
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.kanban-column {
    display: flex;
    flex-direction: column;
    min-height: 12rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.kanban-column.is-drop-target {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-line) 25%, transparent);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.kanban-column-title {
    margin: 0;
    font-size: 0.92rem;
}

.kanban-column-body {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.65rem;
    min-height: 8rem;
    flex: 1 1 auto;
}

.kanban-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    padding: 0.55rem 0.65rem;
    cursor: grab;
    min-width: 0;
    overflow-wrap: anywhere;
}

.kanban-card.is-dragging {
    opacity: 0.55;
}

.kanban-card.is-saving {
    opacity: 0.7;
}

.kanban-card-id {
    margin: 0 0 0.15rem;
    font-size: 0.78rem;
}

.kanban-card-title {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
}

.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.kanban-card-category {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.kanban-card-approved {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.filter-field-checkbox .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding-top: 0.35rem;
}

.kanban-card-owner {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
}

.kanban-canceled-panel {
    margin-top: 1rem;
}

.kanban-board-canceled {
    grid-auto-columns: minmax(16rem, 24rem);
}

/* Empty status columns are hidden at rest to keep the board uncluttered, then
   revealed the instant a card is picked up (mouse drag or keyboard) so every
   status stays a valid drop target. The body.kanban-card-moving flag is set by
   items-kanban.js for the duration of a move. */
.kanban-column.is-empty {
    display: none;
}

body.kanban-card-moving .kanban-column.is-empty {
    display: flex;
}

@media (max-width: 900px) {
    .filter-grid-primary,
    .filter-grid-advanced {
        grid-template-columns: 1fr;
    }
}

.project-rag-sources {
    margin-top: 1rem;
}

.project-rag-source-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.project-rag-source-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--surface-muted);
}

.project-rag-source-main {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.project-rag-source-main strong {
    word-break: break-word;
}

.app-layout {
    --chat-dock-width-rail: 3rem;
    --chat-dock-width-expanded-default: min(28rem, 42vw);
    --chat-dock-width-expanded: var(--chat-dock-width-user, var(--chat-dock-width-expanded-default));
    --chat-dock-width: var(--chat-dock-width-rail);
    --chat-surface: #f3f8ff;
    --chat-surface-strong: #e8f1fc;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--chat-dock-width);
    min-height: 100vh;
    align-items: stretch;
}

.app-layout[data-chat-mode="expanded"] {
    --chat-dock-width: var(--chat-dock-width-expanded);
}

.app-layout[data-chat-mode="rail"] {
    --chat-dock-width: var(--chat-dock-width-rail);
}

.app-primary {
    min-width: 0;
}

.ai-chat-dock {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    min-width: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    z-index: 1100;
}

.ai-chat-dock-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0.35rem;
    cursor: col-resize;
    z-index: 2;
    touch-action: none;
    background: transparent;
}

.ai-chat-dock-resize-handle:hover,
.ai-chat-dock-resize-handle:focus-visible,
body.ai-chat-dock-resizing .ai-chat-dock-resize-handle {
    background: color-mix(in srgb, var(--accent) 35%, transparent);
}

body.ai-chat-dock-resizing {
    cursor: col-resize;
    user-select: none;
}

.ai-chat-record-link {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.ai-chat-dock-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--chat-dock-width-rail);
    flex: 0 0 var(--chat-dock-width-rail);
    padding-top: 0.75rem;
}

.app-layout[data-chat-mode="expanded"] .ai-chat-dock-rail {
    display: none;
}

.app-layout[data-chat-mode="expanded"] .ai-chat-dock {
    display: flex;
    flex-direction: column;
}

.app-layout[data-chat-mode="expanded"] .ai-chat-dock-panel {
    flex: 1 1 auto;
    width: 100%;
}

.ai-chat-rail-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 2.25rem;
    padding: 0.5rem 0.25rem;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.ai-chat-rail-button:hover,
.ai-chat-rail-button:focus-visible {
    background: var(--bg);
}

.ai-chat-rail-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.ai-chat-dock-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.ai-chat-dock-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
    background: var(--surface);
}

.ai-chat-dock-title {
    margin: 0;
    font-size: 1.05rem;
}

.ai-chat-dock-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
}

.ai-chat-dock-toolbar {
    display: inline-flex;
    gap: 0.25rem;
}

.ai-chat-dock-controls {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
    background: var(--surface);
}

.ai-chat-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.ai-chat-control-field {
    min-width: 0;
}

.ai-chat-session-select {
    width: 100%;
}

.ai-chat-field-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.ai-chat-dock-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: var(--chat-surface);
}

.ai-chat-transcript {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--chat-surface);
}

.ai-chat-message {
    display: grid;
    gap: 0.25rem;
}

.ai-chat-message-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

.ai-chat-message-user .ai-chat-message-body {
    background: var(--chat-surface-strong);
    border: 1px solid #d5e4f7;
    border-radius: 0.65rem;
    padding: 0.65rem 0.75rem;
}

.ai-chat-message-assistant .ai-chat-message-body {
    padding: 0.1rem 0;
}

.ai-chat-message-assistant.is-streaming .ai-chat-message-body::after {
    content: "▋";
    display: inline-block;
    margin-left: 0.15rem;
    color: var(--accent-text);
    animation: ai-chat-caret-blink 1s step-end infinite;
}

@keyframes ai-chat-caret-blink {
    50% {
        opacity: 0;
    }
}

.ai-chat-composer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex: 0 0 auto;
}

.ai-chat-composer-shell {
    position: relative;
}

.ai-chat-composer-input {
    width: 100%;
    resize: vertical;
    min-height: 3rem;
    max-height: 12rem;
    padding: 0.65rem 2.85rem 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.ai-chat-send-button {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--on-accent);
}

.ai-chat-send-button:hover,
.ai-chat-send-button:focus-visible {
    background: var(--primary-dark, #1d4ed8);
    color: #fff;
}

.ai-chat-send-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ai-chat-send-button .icon {
    width: 1rem;
    height: 1rem;
}

.ai-chat-session-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ai-chat-session-row .ai-chat-session-select {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-chat-status {
    margin: 0;
    padding: 0 1rem 0.75rem;
    font-size: 0.82rem;
    flex: 0 0 auto;
    background: var(--surface);
}

.ai-chat-empty {
    margin: 0;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
}

.nav-chat-toggle {
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
}

.nav-chat-toggle:hover,
.nav-chat-toggle:focus-visible {
    color: var(--accent-text);
}

.site-nav .nav-chat-toggle {
    text-decoration: none;
}

@media (max-width: 991.98px) {
    .app-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .ai-chat-dock {
        position: fixed;
        top: 0;
        right: 0;
        width: min(100vw, 24rem);
        transform: translateX(100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow);
    }

    .app-layout[data-chat-mode="expanded"] .ai-chat-dock {
        transform: translateX(0);
        display: flex;
        flex-direction: column;
    }

    .app-layout[data-chat-mode="expanded"] {
        --chat-dock-width: 0;
    }

    .app-layout[data-chat-mode="rail"] .ai-chat-dock-rail {
        position: fixed;
        top: 5.5rem;
        right: 0.5rem;
        width: auto;
        z-index: 1100;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    .ai-chat-control-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

html[data-theme="dark"] .app-layout {
    --chat-surface: #152433;
    --chat-surface-strong: #1b2f42;
}

html[data-theme="dark"] .ai-chat-dock-body,
html[data-theme="dark"] .ai-chat-transcript {
    background: var(--chat-surface);
}

html[data-theme="dark"] .ai-chat-message-user .ai-chat-message-body {
    background: var(--chat-surface-strong);
    border-color: #2a4560;
}

.field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.project-access-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    max-width: 32rem;
    padding: 0.1rem 0;
}

.project-access-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.project-access-select {
    width: auto;
    min-width: 11rem;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 1.9rem;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.8rem;
}

html[data-theme="dark"] .project-access-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aab4c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.8rem;
}

.assigned-projects-field.is-hidden,
#assigned-projects-field.is-hidden {
    display: none;
}
