:root {
    --bg: #f7f7f9;
    --surface: #ffffff;
    --border: #d4d4d8;
    --text: #18181b;
    --text-muted: #71717a;
    --accent: #2563eb;
    --warn: #d97706;
    --danger: #dc2626;
    --ok: #16a34a;
    --code-bg: #f3f4f6;
    --prio-0: #be185d;
    --prio-1: #dc2626;
    --prio-2: #d97706;
    --prio-3: #71717a;
    --prio-4: #a1a1aa;
    --prio-5: #d4d4d8;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #18181b;
        --surface: #27272a;
        --border: #3f3f46;
        --text: #f4f4f5;
        --text-muted: #a1a1aa;
        --accent: #60a5fa;
        --warn: #fbbf24;
        --danger: #f87171;
        --ok: #4ade80;
        --code-bg: #18181b;
    }
    .badge.status-open { background: #1e3a8a; border-color: #1e40af; color: #bfdbfe; }
    .badge.status-wip { background: #78350f; border-color: #92400e; color: #fed7aa; }
    .badge.status-blocked { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
    .badge.status-completed { background: #14532d; border-color: #166534; color: #bbf7d0; }
    .badge.status-wontfix { background: #3f3f46; border-color: #52525b; color: #d4d4d8; }
    .badge.status-draft { background: #4c1d95; border-color: #5b21b6; color: #ddd6fe; }
    .badge.effort-30 { background: #064e3b; border-color: #065f46; color: #a7f3d0; }
    .badge.effort-90 { background: #365314; border-color: #3f6212; color: #d9f99d; }
    .badge.effort-240 { background: #78350f; border-color: #92400e; color: #fde68a; }
    .badge.effort-480 { background: #7c2d12; border-color: #9a3412; color: #fed7aa; }
    .badge.effort-960 { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
    .activity del { background: #7f1d1d; color: #fecaca; }
    .activity ins { background: #14532d; color: #bbf7d0; }
    .heat-cell.tier-0 { background: #3f3f46; }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@media (prefers-reduced-motion: no-preference) {
    :root { scroll-behavior: smooth; }
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
iframe { border: 0; }
summary { cursor: pointer; }
b, strong { font-weight: bolder; }
h1, h2, h3, h4, h5, h6, p { overflow-wrap: break-word; }
table, time { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: #fff; text-shadow: none; }

html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-size-adjust: none;
    text-decoration-skip-ink: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
nav.site {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: none;
}
nav.site a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
nav.site a:hover, nav.site a.active { color: var(--text); }
nav.site .brand { color: var(--accent); font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 0.5rem; }
nav.site .brand-logo { height: 1.5rem; width: 1.5rem; }
nav.site .right { margin-left: auto; display: flex; gap: 1.25rem; align-items: center; }
nav.site form.logout { display: inline; }
nav.site form.logout button {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
}
nav.site form.logout button:hover { color: var(--text); text-decoration: underline; }
nav.site form.deploy-form { display: inline; margin: 0; }
nav.site form.deploy-form button.btn-deploy {
    background: var(--warn);
    border-color: var(--warn);
    color: #fff;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}
nav.site form.deploy-form button.btn-deploy:hover { filter: brightness(1.05); }
.site-nav-deploying {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--warn);
    animation: site-nav-deploying-pulse 1.4s ease-in-out infinite;
}
.site-nav-deploying-dots { display: inline-block; width: 1.2em; text-align: left; }
.site-nav-deploying-dots::after { content: "…"; }
@keyframes site-nav-deploying-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}
main { max-width: none; margin: 0; padding: 1.25rem 1.5rem; min-width: 0; }
.app-body {
    display: block;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.app-body:has(.issue-sidebar:not(:empty)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(40rem, 42vw);
    grid-template-rows: 100%;
    overflow: hidden;
}
.app-body:has(.issue-sidebar:not(:empty)) > main {
    padding-right: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
h1 { font-size: 1.4rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
h2.spaced { margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.45rem 0.5rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: top; }
th { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.badge.status-open { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.badge.status-wip { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.badge.status-blocked { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.badge.status-completed { background: #dcfce7; border-color: #86efac; color: #166534; }
.badge.status-wontfix { background: #f3f4f6; border-color: #d1d5db; color: #4b5563; }
.badge.status-draft { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.badge.effort-30 { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.badge.effort-90 { background: #ecfccb; border-color: #bef264; color: #3f6212; }
.badge.effort-240 { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.badge.effort-480 { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.badge.effort-960 { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.star { color: var(--warn); }
.meta { color: var(--text-muted); font-size: 0.85rem; }
.empty { color: var(--text-muted); padding: 1rem; text-align: center; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
dl.kv dt { color: var(--text-muted); font-size: 0.8rem; }
button, input, select, textarea { font: inherit; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); }
button { background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer; }
button:hover { filter: brightness(1.05); }
button.secondary:hover, .form-actions a.secondary:hover { border-color: var(--accent); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-card { max-width: 360px; margin: 4rem auto; text-align: center; }
.login-card .login-logo { width: 4rem; height: 4rem; margin: 0 auto 0.75rem; }
.login-card h1 { margin-bottom: 1rem; }
.login-card form { display: grid; gap: 0.75rem; text-align: left; }
.login-card label { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.25rem; }
.login-card input { width: 100%; }
.error { color: var(--danger); font-size: 0.85rem; }
.prose { white-space: normal; font-family: inherit; }
.prose p { margin: 0.25rem 0; }
.prose pre { background: var(--code-bg); padding: 0.5rem; border-radius: 4px; overflow-x: auto; }
.prose code { background: var(--code-bg); padding: 0 0.2rem; border-radius: 3px; }
.prose pre code { padding: 0; background: none; }
.prose ul, .prose ol { padding-inline-start: 1.5rem; margin: 0.25rem 0; }
.prose li { margin: 0.1rem 0; }
.prose li::marker { color: var(--text-muted); }
.comment { border-bottom: 1px solid var(--border); padding: 0.5rem 0; }
.comment:last-of-type { border-bottom: none; }
.comment .prose { margin-top: 0.25rem; }

nav.site a.new-issue { color: var(--accent); }

.quick-filters { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.quick-filter {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
}
.quick-filter:hover { text-decoration: none; border-color: var(--accent); }
.quick-filter.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.quick-filter.active:hover { color: #fff; }
.quick-filter-count {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}
.quick-filter.active .quick-filter-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.issue-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}
.filter-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.filter-row label { display: flex; flex-direction: column; gap: 0.2rem; padding-top: 0.5rem; font-size: 0.8rem; color: var(--text-muted); min-width: 12rem; flex: 1 1 12rem; }
.filter-row label.wide { flex: 1; }
.filter-row label.wide input { width: 100%; }

.search-wrap { position: relative; display: block; }
.search-wrap input { padding-right: 1.8rem; }
.search-clear {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    padding: 0 0.35rem;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}
.search-clear:hover { color: var(--text); }
.search-wrap input:placeholder-shown ~ .search-clear { display: none; }

/* Choices.js: match the rest of the UI (colors, radii, density). */
.choices { margin-bottom: 0; font-size: 0.85rem; }
.choices__inner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    min-height: 2.1rem;
    padding: 2px 4px;
    font-size: 0.85rem;
}
.choices[data-type*="select-one"] .choices__inner { padding-bottom: 2px; }
.choices__list--dropdown, .choices__list[aria-expanded] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    z-index: 5;
}
.choices__list--dropdown .choices__item--selectable,
.choices__list[aria-expanded] .choices__item--selectable { padding-right: 0.6rem; }
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background: var(--bg);
    color: var(--text);
}
.choices__list--multiple .choices__item {
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 3px;
    color: #fff;
    font-size: 0.8rem;
    padding: 1px 6px;
    margin: 2px 2px 2px 0;
}
.choices__list--multiple .choices__item.is-highlighted {
    background: var(--accent);
    border-color: var(--accent);
    filter: brightness(1.1);
}
.choices__input {
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    padding: 2px 4px;
    margin-bottom: 0;
}
.choices[data-type*="select-one"]::after { border-color: var(--text-muted) transparent transparent; }
.choices[data-type*="select-one"].is-open::after { border-color: transparent transparent var(--text-muted); }
.choices__placeholder { opacity: 0.7; }
.choices.is-focused .choices__inner,
.choices.is-open .choices__inner { border-color: var(--accent); }
/* The "×" on selected chips needs to read as a chip action, not a page button. */
.choices__list--multiple .choices__item .choices__button {
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    margin: 0 -4px 0 6px;
    padding: 0 0 0 10px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 21'><path fill='%23fff' d='M2.59 2.59a2 2 0 0 1 2.82 0L10.5 7.67l5.09-5.08a2 2 0 1 1 2.82 2.82L13.33 10.5l5.08 5.09a2 2 0 1 1-2.82 2.82l-5.09-5.08-5.09 5.08a2 2 0 1 1-2.82-2.82L7.67 10.5 2.59 5.41a2 2 0 0 1 0-2.82z'/></svg>");
    opacity: 0.85;
}
.choices__list--multiple .choices__item .choices__button:hover { opacity: 1; }

.issue-table td.meta { white-space: nowrap; }
.issue-table .comment-col { white-space: nowrap; text-align: center; color: var(--text-muted); width: 1px; }
.issue-table .refs-col { white-space: nowrap; text-align: center; color: var(--text-muted); width: 1px; }
.issue-table .refs-col .ref-count { display: inline-flex; align-items: center; gap: 0.2rem; }
.issue-table .refs-col .ref-count + .ref-count { margin-left: 0.4rem; }
.issue-table .refs-col .github-icon { flex: none; }
.issue-table tr[data-issue-href] { cursor: pointer; }
.issue-table tr[data-issue-href]:hover td:not(.edit-cell) { background: var(--bg); }
/* The whole row is the click target; the title/number anchors are there for
   middle-click and copy-link, so don't render them as visible links. */
.issue-table .row-link { color: inherit; }
.issue-table .row-link:hover { text-decoration: none; }
.issue-table .edit-cell { cursor: pointer; }
.issue-table .edit-cell:hover { background: var(--bg); }
.issue-table .edit-cell.editing { padding: 0.2rem 0.3rem; cursor: default; }
.issue-table .edit-cell.editing:hover { background: inherit; }
.issue-table .edit-cell select.inline-edit {
    font-size: 0.8rem;
    padding: 0.15rem 0.3rem;
    background: var(--surface);
    color: var(--text);
    border-color: var(--accent);
}
/* Choices.js inside an inline-edit cell: strip the default chrome down so
   only the badge/prio label + a dropdown arrow show inside the table cell,
   and let the dropdown list render each choice as its real badge. */
.issue-table .edit-cell.editing .choices { margin: 0; font-size: 0.8rem; min-width: 7rem; }
.issue-table .edit-cell.editing .choices__inner {
    min-height: 0;
    padding: 1px 1.5rem 1px 4px;
    background: transparent;
}
.issue-table .edit-cell.editing .choices__list--single { padding: 0; }
.issue-table .edit-cell.editing .choices__list--single .choices__item { padding: 0; }
.issue-table .edit-cell.editing .choices__list--dropdown .choices__item,
.issue-table .edit-cell.editing .choices__list[aria-expanded] .choices__item { padding: 0.25rem 0.5rem; }

.issue-table .drag-col {
    width: 1.5rem;
    padding: 0.25rem 0.4rem;
    color: var(--text-muted);
    font-family: ui-monospace, Menlo, monospace;
    user-select: none;
    cursor: grab;
    text-align: center;
}
.issue-table .drag-col:active { cursor: grabbing; }
.issue-table.reorderable tr.sortable-ghost { opacity: 0.35; }
.issue-table.reorderable tr.sortable-chosen { box-shadow: inset 0 0 0 2px var(--accent); }
.issue-table thead th { user-select: none; }
.issue-table .sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
}
.issue-table .sort-link:hover { color: var(--accent); }
.issue-table .sort-link.active { color: var(--text); }
.issue-table .sort-indicator { font-size: 0.7rem; }

.issue-form, .milestone-form { max-width: 900px; }
.issue-form .form-field, .milestone-form .form-field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.75rem; }
.issue-form .form-field.wide, .milestone-form .form-field.wide { width: 100%; }
.issue-form .form-field.inline { flex-direction: row; align-items: center; }
.issue-form .form-field label, .milestone-form .form-field label { font-size: 0.85rem; color: var(--text-muted); }
.issue-form .form-row, .milestone-form .form-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.issue-form .form-row .form-field, .milestone-form .form-row .form-field { flex: 1 1 12rem; }
.issue-form textarea, .milestone-form textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; }
.issue-form input[type=text], .issue-form select,
.milestone-form input[type=text], .milestone-form input[type=date], .milestone-form select { width: 100%; }
.issue-form label.inline { display: inline-flex; align-items: center; gap: 0.4rem; }
.issue-form .hidden { display: none; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.form-actions button.secondary, .form-actions a.secondary,
button.secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}
.layout-detail { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .layout-detail { grid-template-columns: 1fr; } }
.description-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.description-form textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; }
.comment-form { margin-top: 0.75rem; }
.comment-form textarea { width: 100%; font-family: inherit; }

.highlight-toggle {
    background: none;
    border: none;
    color: var(--warn);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.25rem;
}
.link-button {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    cursor: pointer;
    font-size: inherit;
}
.edit-link { float: right; font-size: 0.9rem; }

.issue-header { margin-bottom: 1rem; }
.issue-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.issue-header-top .px { font-family: ui-monospace, Menlo, monospace; color: var(--text-muted); }
.issue-header-top .chip { color: var(--text); text-decoration: none; }
.issue-header-top .chip:hover { border-color: var(--accent); color: var(--accent); }
.issue-header-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
.issue-title { font-size: 1.5rem; line-height: 1.25; margin: 0; }

.action-label {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 0.8rem;
    color: var(--text);
}

.activity { list-style: none; }
.activity li { border-bottom: 1px solid var(--border); padding: 0.25rem 0; }
.activity li:last-child { border-bottom: none; }
.activity summary { cursor: pointer; font-size: 0.85rem; }
.activity dl.diff { margin-top: 0.25rem; font-size: 0.8rem; }
.activity dl.diff dt { color: var(--text-muted); }
.activity dl.diff dd { margin-bottom: 0.25rem; }
.activity del { background: #fee2e2; color: #991b1b; text-decoration: line-through; padding: 0 0.2rem; }
.activity ins { background: #dcfce7; color: #166534; text-decoration: none; padding: 0 0.2rem; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-top: 0.5rem; }
@media (max-width: 900px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kanban { grid-template-columns: 1fr; } }
.kanban-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    min-height: 8rem;
}
.kanban-col > h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.kanban-col > h3 .count { font-size: 0.75rem; color: var(--text-muted); font-weight: normal; }
.kanban-cards { display: flex; flex-direction: column; gap: 0.35rem; min-height: 3rem; flex: 1; }
.kanban-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card .head { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.kanban-card .head a { font-weight: 500; }
.kanban-card .px { color: var(--text-muted); font-size: 0.75rem; font-family: ui-monospace, Menlo, monospace; }
.kanban-card .card-meta { color: var(--text-muted); font-size: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.kanban-card.sortable-ghost { opacity: 0.35; }
.kanban-card.sortable-chosen { box-shadow: 0 0 0 2px var(--accent); }
.kanban-card.wontfix { opacity: 0.6; }
.kanban-card.wontfix .head a { text-decoration: line-through; }
.kanban-empty { color: var(--text-muted); font-size: 0.75rem; padding: 0.4rem; text-align: center; font-style: italic; }

.heatmap-summary { font-size: 0.9rem; margin-bottom: 0.4rem; }
.heatmap-summary strong { font-weight: 600; }
.heatmap {
    display: grid;
    grid-template-rows: repeat(7, 0.85rem);
    grid-auto-flow: column;
    grid-auto-columns: 0.85rem;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.heat-cell { width: 0.85rem; height: 0.85rem; border-radius: 2px; }
.heat-cell.empty { background: transparent; }
.heat-cell.tier-0 { background: #ebedf0; }
.heat-cell.tier-1 { background: #9be9a8; }
.heat-cell.tier-2 { background: #40c463; }
.heat-cell.tier-3 { background: #30a14e; }
.heat-cell.tier-4 { background: #216e39; }
.heat-legend { display: flex; gap: 2px; align-items: center; margin-top: 0.5rem; font-size: 0.8rem; }
.heat-legend .meta { margin: 0 0.3rem; }

.pagination { display: flex; gap: 1rem; align-items: center; margin-top: 0.75rem; }

.chip { font-size: 0.7rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }

.prio { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }
.prio::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--prio-3); display: inline-block; }
.prio.prio-0::before { background: var(--prio-0); animation: prio-pulse 1.4s ease-in-out infinite; }
.prio.prio-1::before { background: var(--prio-1); }
.prio.prio-2::before { background: var(--prio-2); }
.prio.prio-3::before { background: var(--prio-3); }
.prio.prio-4::before { background: var(--prio-4); }
.prio.prio-5::before { background: var(--prio-5); }

@keyframes prio-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--prio-0); }
    50% { transform: scale(1.25); box-shadow: 0 0 0 3px rgba(190, 24, 93, 0); }
}

kbd {
    display: inline-block; padding: 0.05rem 0.4rem;
    border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 3px; background: var(--surface); color: var(--text);
    font: 0.8em ui-monospace, Menlo, monospace;
}
.help-dialog {
    border: 1px solid var(--border); border-radius: 8px;
    padding: 1.25rem; max-width: 26rem; margin: auto;
    background: var(--surface); color: var(--text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.help-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.help-dialog h2 { margin-bottom: 0.75rem; }
.help-dialog dl.kv { grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.help-dialog dl.kv dt { color: var(--text); display: flex; gap: 0.25rem; align-items: center; }

.issue-modal {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    width: min(920px, 95vw);
    max-height: 92vh;
    margin: auto;
    background: var(--surface);
    color: var(--text);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.issue-modal::backdrop { background: rgba(0, 0, 0, 0.45); }
/* Shared between the dialog (.issue-modal) and the list sidebar
   (.issue-sidebar); both render the same _issue_modal_form fragment. */
.modal-shell { display: flex; flex-direction: column; }
.issue-modal .modal-shell { max-height: 92vh; }
.modal-shell .modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.modal-shell .modal-title {
    display: flex;
    gap: 0.4rem 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 0.3rem;
}
.modal-shell .modal-title .px { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; color: var(--text-muted); }
.modal-shell .modal-title .modal-new-title { font-weight: 600; font-size: 1rem; }
.modal-shell .modal-title .star { font-size: 1rem; }
.modal-shell .modal-head-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.modal-shell .modal-head-actions .secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}
.modal-shell .modal-head-actions .secondary:hover { border-color: var(--accent); color: var(--accent); }
.modal-shell .modal-form { padding: 1rem; overflow-y: auto; display: grid; gap: 1rem; }
.modal-shell .issue-title { font-size: 1.35rem; line-height: 1.3; margin: 0; }
.modal-shell .modal-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.6rem 0.9rem;
    padding: 0.75rem 0.9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.modal-shell .modal-meta .form-field { margin-bottom: 0; flex: none; }
.modal-shell .modal-meta .modal-meta-highlight { align-self: end; }
.modal-shell .modal-actions { margin-top: 0.25rem; }

.issue-sidebar {
    border-left: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    min-width: 0;
}
.issue-sidebar:empty { display: none; }
.issue-sidebar .modal-shell { min-height: 100%; }
.issue-sidebar .modal-head { position: sticky; top: 0; z-index: 1; }
.issue-sidebar .modal-form { padding: 1rem 1.25rem; }
.issue-sidebar .modal-meta { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
.issue-sidebar .modal-sections { padding: 0 1.25rem 1rem; }
.issue-sidebar .modal-sections .card { background: var(--bg); }

.inline-edit .inline-edit-field { display: none; }
.inline-edit.editing .inline-edit-view { display: none; }
.inline-edit.editing .inline-edit-field { display: block; }
.inline-edit [data-inline-edit-view] {
    cursor: text;
    padding: 0.4rem 0.55rem;
    border: 1px dashed transparent;
    border-radius: 4px;
    transition: background-color 0.12s, border-color 0.12s;
}
.inline-edit [data-inline-edit-view]:hover {
    border-color: var(--border);
    background: var(--bg);
}
.inline-edit-title [data-inline-edit-view] { margin: 0 -0.55rem; }
.inline-edit-description { display: flex; flex-direction: column; gap: 0.25rem; }
.inline-edit-description .prose { min-height: 2rem; }
.inline-edit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.inline-edit-hint { font-size: 0.75rem; opacity: 0; transition: opacity 0.12s; }
.inline-edit:hover .inline-edit-hint { opacity: 0.8; }
.inline-edit.editing .inline-edit-hint { opacity: 0; }
.inline-edit-field label.meta { display: block; margin-bottom: 0.2rem; }
body[data-g-prefix]::after {
    content: "g…";
    position: fixed; bottom: 1rem; right: 1rem;
    background: var(--text); color: var(--surface);
    padding: 0.3rem 0.6rem; border-radius: 4px;
    font: 0.8rem ui-monospace, Menlo, monospace;
    pointer-events: none; z-index: 10;
}
.help-toggle {
    color: var(--text-muted); font-family: ui-monospace, Menlo, monospace;
    width: 1.6rem; height: 1.6rem; border-radius: 50%;
    border: 1px solid var(--border); display: inline-flex;
    align-items: center; justify-content: center;
}
.help-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Add/remove sidebar sections (links, parties, github refs, related issues) */
.sidebar-section ul.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-section ul.sidebar-list li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.sidebar-section ul.sidebar-list li:last-child { border-bottom: none; }
.sidebar-section .empty-row { color: var(--text-muted); font-size: 0.85rem; padding: 0.25rem 0; }
.sidebar-section .row-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.3rem;
    cursor: pointer;
}
.sidebar-section .row-delete:hover { color: var(--danger); }
.sidebar-section .add-toggle {
    margin-top: 0.5rem;
    background: none;
    border: 1px dashed var(--border);
    color: var(--accent);
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
}
.sidebar-section .add-toggle:hover { border-color: var(--accent); background: var(--bg); }
.sidebar-section .add-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.sidebar-section .add-field { display: flex; flex-direction: column; gap: 0.2rem; }
.sidebar-section .add-field input,
.sidebar-section .add-field select { width: 100%; }
.sidebar-section .add-field .meta { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-section .add-actions { display: flex; gap: 0.5rem; }
.sidebar-section .add-actions button { font-size: 0.85rem; padding: 0.3rem 0.6rem; }
