body { font: 16px/1.5 system-ui, sans-serif; margin: 0; padding: 16px; color: #1b1b1b; background: #fafafa; }
body.center { display: flex; min-height: 90vh; align-items: center; justify-content: center; }
header { display: flex; gap: 16px; align-items: center; border-bottom: 1px solid #ddd; padding-bottom: 8px; }
header form { margin-left: auto; }
main { max-width: 860px; margin: 0 auto; }
.box { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 24px; width: min(92vw, 360px); }
h1 { font-size: 1.4rem; margin-top: 0; }
form { margin: 8px 0; }
label { display: block; margin-bottom: 4px; }
input { font: inherit; padding: 8px; border: 1px solid #bbb; border-radius: 4px; max-width: 100%; }
button { font: inherit; padding: 8px 14px; border: 1px solid #1b1b1b; background: #1b1b1b; color: #fff; border-radius: 4px; cursor: pointer; }
button.link { background: none; border: none; color: #1b1b1b; text-decoration: underline; padding: 0; }
button.danger { background: #b00020; border-color: #b00020; }
a { color: #0b57d0; }
.actions { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; }
.crumbs { margin: 8px 0; }
.muted { color: #666; }
.error { color: #b00020; }
.notice { color: #1b6b2b; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee; }
.row-actions { white-space: nowrap; }
.row-actions a { margin-left: 12px; }

.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---- comments drawer */
.badge { background: #fff3c4; color: #5a4500; border-radius: 999px; padding: 0 6px; font-size: 0.8rem; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: #fff; border-left: 1px solid #ddd; box-shadow: -8px 0 24px rgba(0,0,0,0.12); overflow-y: auto; padding: 16px; z-index: 10; }
.drawer:empty { display: none; }
.drawer.static { position: static; width: auto; box-shadow: none; border: 1px solid #ddd; border-radius: 6px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.note-form { display: grid; gap: 6px; margin: 12px 0; }
.note-form textarea { font: inherit; padding: 8px; border: 1px solid #bbb; border-radius: 4px; width: 100%; box-sizing: border-box; }
.thread { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.note { border-top: 1px solid #eee; padding-top: 8px; }
.note-meta { font-size: 0.85rem; }
.note-actions { display: flex; gap: 12px; align-items: center; font-size: 0.85rem; }
.note.resolved p { opacity: 0.6; }
.inline { display: inline; margin: 0; }
.notes-page { max-width: 480px; margin: 16px auto; }

/* ---- global ashvek header & waffle menu */
.brand { display: flex; align-items: center; gap: 6px; font-size: 1.1rem; }
.brand .logo { color: #0b57d0; font-size: 1.3rem; }
.brand .product-tag { background: #e8f0fe; color: #0b57d0; font-size: 0.75rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.nav-links { display: flex; gap: 14px; margin-left: 8px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.waffle-menu { position: relative; }
.waffle-btn { background: none; border: 1px solid #ccc; color: #333; padding: 4px 10px; font-size: 0.9rem; border-radius: 4px; cursor: pointer; }
.waffle-btn:hover { background: #eee; }
.waffle-dropdown-content { display: none; position: absolute; right: 0; top: 110%; background: #fff; min-width: 200px; box-shadow: 0 4px 14px rgba(0,0,0,0.15); border: 1px solid #ddd; border-radius: 6px; z-index: 20; padding: 6px 0; }
.waffle-menu[open] .waffle-dropdown-content { display: block; }
.waffle-menu > summary { list-style: none; }
.waffle-menu > summary::-webkit-details-marker { display: none; }
.waffle-item.planned { opacity: 0.55; cursor: default; }
.waffle-header { padding: 6px 12px; font-size: 0.7rem; font-weight: bold; color: #888; letter-spacing: 0.5px; border-bottom: 1px solid #eee; }
.waffle-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: #222; text-decoration: none; font-size: 0.9rem; }
.waffle-item:hover { background: #f2f6fc; color: #0b57d0; }
.waffle-item.active { font-weight: bold; color: #0b57d0; }
.waffle-icon { font-size: 1rem; }

/* Diff view (Slice 42.3B): rows are classed by the server; colours come from these rules only. */
table.diff { border-collapse: collapse; width: 100%; font: 13px/1.4 ui-monospace, monospace; }
table.diff td { padding: 0 6px; vertical-align: top; white-space: pre-wrap; }
table.diff td.ln { color: #777; text-align: right; user-select: none; width: 3em; }
tr.diff-add { background: #e6ffec; }
tr.diff-del { background: #ffebe9; }
tr.diff-ctx { background: transparent; }
/* Syntax highlighting of diff lines (Q4). The server escapes every token; these only colour them. */
span.tok-kw { color: #cf222e; }
span.tok-type { color: #953800; }
span.tok-str { color: #0a3069; }
span.tok-num { color: #0550ae; }
span.tok-com { color: #6e7781; font-style: italic; }
span.tok-key { color: #0550ae; }
span.tok-head, span.tok-marker { color: #8250df; font-weight: 600; }

.mm-canvas { position: relative; height: 480px; overflow: hidden; border: 1px solid #bbb; }
.mm-node { position: absolute; cursor: grab; padding: 0.25rem 0.5rem; border: 1px solid #888; background: #fff; user-select: none; touch-action: none; }
.mm-node.mm-dragging { cursor: grabbing; }
/* Side-by-side diff (operator What Changed viewer). Cells are coloured by change; empty cells are blank. */
table.sbs td.code { width: 50%; }
td.sbs-del { background: #ffebe9; }
td.sbs-add { background: #e6ffec; }
td.sbs-empty { background: #f6f8fa; }
