/* Catppuccin Mocha and Latte tokens. */

@property --accent {
    syntax: '<color>';
    inherits: true;
    initial-value: #cba6f7;
}


/* Catppuccin Mocha (dark) */
:root {
    --base: #1e1e2e;
    --mantle: #181825;
    --crust: #11111b;
    --text: #cdd6f4;
    --subtext1: #bac2de;
    --subtext0: #a6adc8;
    --overlay2: #9399b2;
    --overlay1: #7f849c;
    --overlay0: #6c7086;
    --surface2: #585b70;
    --surface1: #45475a;
    --surface0: #313244;
    --blue: #89b4fa;
    --lavender: #b4befe;
    --sapphire: #74c7ec;
    --sky: #89dceb;
    --teal: #94e2d5;
    --green: #a6e3a1;
    --yellow: #f9e2af;
    --peach: #fab387;
    --maroon: #eba0ac;
    --red: #f38ba8;
    --mauve: #cba6f7;
    --pink: #f5c2e7;
    --flamingo: #f2cdcd;
    --rosewater: #f5e0dc;
    animation: accent-dark 30s steps(1) infinite;
}

@keyframes accent-dark {
    0%, 100% { --accent: #cba6f7; }  /* mauve */
    8.3%     { --accent: #f5c2e7; }  /* pink */
    16.7%    { --accent: #f2cdcd; }  /* flamingo */
    25%      { --accent: #fab387; }  /* peach */
    33.3%    { --accent: #f9e2af; }  /* yellow */
    41.7%    { --accent: #a6e3a1; }  /* green */
    50%      { --accent: #94e2d5; }  /* teal */
    58.3%    { --accent: #89dceb; }  /* sky */
    66.7%    { --accent: #74c7ec; }  /* sapphire */
    75%      { --accent: #89b4fa; }  /* blue */
    83.3%    { --accent: #b4befe; }  /* lavender */
    91.7%    { --accent: #f5c2e7; }  /* pink (ease back) */
}

/* Catppuccin Latte (light) */
[data-theme="light"] {
    --base: #eff1f5;
    --mantle: #e6e9ef;
    --crust: #dce0e8;
    --text: #4c4f69;
    --subtext1: #5c5f77;
    --subtext0: #5f6278;
    --overlay2: #5f6171;
    --overlay1: #5f616d;
    --overlay0: #9ca0b0;
    --t-green: #2c6f1e;
    --t-blue: #1957d9;
    --t-sapphire: #156a79;
    --t-teal: #116c71;
    --t-mauve: #7d34db;
    --t-pink: #8e477b;
    --t-peach: #a74107;
    --t-yellow: #885611;
    --t-red: #c30d35;
    --t-lavender: #4d5bac;
    --surface2: #acb0be;
    --surface1: #bcc0cc;
    --surface0: #ccd0da;
    --blue: #1a5ae0;
    --lavender: #7287fd;
    --sapphire: #209fb5;
    --sky: #04a5e5;
    --teal: #179299;
    --green: #40a02b;
    --yellow: #df8e1d;
    --peach: #fe640b;
    --maroon: #e64553;
    --red: #d20f39;
    --mauve: #8839ef;
    --pink: #ea76cb;
    --flamingo: #dd7878;
    --rosewater: #dc8a78;
    animation: accent-light 30s steps(1) infinite;
}

@keyframes accent-light {
    0%, 100% { --accent: #8839ef; }  /* mauve */
    8.3%     { --accent: #ea76cb; }  /* pink */
    16.7%    { --accent: #dd7878; }  /* flamingo */
    25%      { --accent: #fe640b; }  /* peach */
    33.3%    { --accent: #df8e1d; }  /* yellow */
    41.7%    { --accent: #40a02b; }  /* green */
    50%      { --accent: #179299; }  /* teal */
    58.3%    { --accent: #04a5e5; }  /* sky */
    66.7%    { --accent: #209fb5; }  /* sapphire */
    75%      { --accent: #1e66f5; }  /* blue */
    83.3%    { --accent: #7287fd; }  /* lavender */
    91.7%    { --accent: #ea76cb; }  /* pink (ease back) */
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Per-kind colour, used for the row mark and the editor rule. */
.kind-commit        { --k: var(--green); }
.kind-pr            { --k: var(--blue); }
.kind-pr_comment    { --k: var(--sapphire); }
.kind-code_comment  { --k: var(--teal); }
.kind-odoo_log_note { --k: var(--mauve); }
.kind-odoo_message  { --k: var(--pink); }
.kind-email         { --k: var(--peach); }
.kind-chat          { --k: var(--yellow); }
.kind-other         { --k: var(--overlay2); }

html {
    background: var(--base);
}

body {
    font-family: 'Cascadia Code', ui-monospace, 'SF Mono', 'Source Code Pro',
        Menlo, Consolas, 'DejaVu Sans Mono', monospace;
    font-size: 15px;
    line-height: 1.6;
    background: var(--base);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover, a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

.slash {
    color: var(--accent);
}

.muted {
    color: var(--subtext0);
}

p a, .muted a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

p a.btn {
    text-decoration: none;
}

.fine {
    font-size: 0.85rem;
}

.site-footer {
    max-width: 880px;
    margin: 2rem auto 0;
    padding: 1rem;
    border-top: 1px solid var(--surface0);
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.2rem;
    font-size: 0.9rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Top bar */

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.5rem;
    max-width: 880px;
    margin: 0 auto;
    padding: 1.1rem 1rem;
}

.brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.brand:hover {
    text-decoration: none;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1.1rem;
}

.tabs a {
    color: var(--subtext0);
    padding: 0.15rem 0;
    border-bottom: 2px solid transparent;
}

.tabs a:hover {
    color: var(--text);
    text-decoration: none;
}

.tabs a[aria-current="page"] {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.count {
    display: inline-block;
    min-width: 1.4em;
    padding: 0 0.35em;
    border-radius: 999px;
    background: var(--surface0);
    color: var(--text);
    font-size: 0.8rem;
    text-align: center;
}

.tools {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.tools form {
    display: contents;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--subtext0);
    cursor: pointer;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--surface0);
}

.icon-btn[hidden] {
    display: none;
}

#theme-toggle .icon-moon,
[data-theme="light"] #theme-toggle .icon-sun {
    display: none;
}

[data-theme="light"] #theme-toggle .icon-moon {
    display: block;
}

main {
    max-width: 880px;
    margin: 0 auto;
    padding: 0.5rem 1rem 6rem;
}

h1, h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-title {
    font-size: 1.35rem;
    margin: 1rem 0 1.25rem;
}

/* Queue rows, read like `git log --oneline`. */

.rows {
    list-style: none;
    border-top: 1px solid var(--surface0);
}

.row {
    border-bottom: 1px solid var(--surface0);
}

.row a {
    display: grid;
    grid-template-columns: 3px 1fr;
    column-gap: 1rem;
    padding: 0.85rem 0.25rem;
    color: var(--text);
}

.row a::before {
    content: "";
    grid-row: 1 / span 2;
    border-radius: 2px;
    background: var(--k);
}

.row a:hover {
    text-decoration: none;
    background: var(--mantle);
}

.row-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
    font-size: 0.82rem;
    color: var(--subtext0);
}

.kind {
    color: var(--kt, var(--k));
}

[data-theme="light"] .kind-commit        { --kt: var(--t-green); }
[data-theme="light"] .kind-pr            { --kt: var(--t-blue); }
[data-theme="light"] .kind-pr_comment    { --kt: var(--t-sapphire); }
[data-theme="light"] .kind-code_comment  { --kt: var(--t-teal); }
[data-theme="light"] .kind-odoo_log_note { --kt: var(--t-mauve); }
[data-theme="light"] .kind-odoo_message  { --kt: var(--t-pink); }
[data-theme="light"] .kind-email         { --kt: var(--t-peach); }
[data-theme="light"] .kind-chat          { --kt: var(--t-yellow); }

.target {
    overflow-wrap: anywhere;
}

.status-approved { color: var(--green); }
.status-rejected { color: var(--red); }

.empty, .empty-state p {
    color: var(--subtext0);
    padding: 2rem 0;
    max-width: 60ch;
}

.ad-slot {
    max-width: 330px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Review page */

.editor {
    border-left: 3px solid var(--k);
    background: var(--mantle);
    border-radius: 0 10px 10px 0;
}

.editor textarea {
    display: block;
    width: 100%;
    min-height: 9rem;
    padding: 1rem 1.1rem;
    border: 0;
    border-radius: 0 10px 0 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    line-height: 1.65;
    resize: vertical;
    overflow: hidden;
}

.editor textarea[hidden] {
    display: none;
}

.editor textarea:focus-visible {
    outline: none;
    background: color-mix(in srgb, var(--mantle) 70%, var(--surface0));
}

/* Commit rulers at 50 and 72 columns. */
.editor textarea.ruled {
    background-image:
        linear-gradient(var(--surface1), var(--surface1)),
        linear-gradient(var(--surface1), var(--surface1));
    background-size: 1px 100%, 1px 100%;
    background-repeat: no-repeat;
    background-position: calc(1.1rem + 50ch) 0, calc(1.1rem + 72ch) 0;
}

.editor-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    align-items: baseline;
    padding: 0.5rem 1.1rem 0.7rem;
    border-top: 1px solid var(--surface0);
    font-size: 0.8rem;
    color: var(--overlay1);
}

.editor-meta .warn { color: var(--yellow); }
.editor-meta .over { color: var(--red); }

.edited {
    color: var(--peach);
}

.link-btn {
    border: 0;
    background: none;
    color: var(--blue);
    font: inherit;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-btn[hidden], .edited[hidden] {
    display: none;
}

.editor .diff {
    margin: 0 1.1rem 1rem;
}

.actionbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 2.5rem;
}

.actionbar .form-error {
    margin-right: auto;
}

.js .nojs-only {
    display: none;
}

.decide .nojs-only {
    margin: 0.75rem 0 0;
}

.decide .nojs-only label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--subtext0);
    font-size: 0.85rem;
}

.decide .nojs-only textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--surface1);
    border-radius: 8px;
    background: var(--mantle);
    color: var(--text);
    font: inherit;
}

.btn {
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--surface1);
    border-radius: 8px;
    background: var(--surface0);
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
}

.btn:hover {
    border-color: var(--overlay0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

.btn-approve {
    border-color: var(--green);
    background: var(--green);
    color: var(--crust);
    font-weight: 700;
}

.btn-approve:hover {
    border-color: var(--teal);
    background: var(--teal);
}

[data-theme="light"] .btn-approve {
    border-color: #2e7d1f;
    background: #2e7d1f;
    color: var(--base);
}

[data-theme="light"] .btn-approve:hover {
    border-color: #256a19;
    background: #256a19;
}

.btn-reject {
    border-color: var(--red);
    background: transparent;
    color: var(--red);
}

.btn-reject:hover {
    border-color: var(--red);
    background: color-mix(in srgb, var(--red) 12%, transparent);
}

kbd {
    margin-left: 0.4rem;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.75;
}

.form-error {
    color: var(--red);
    font-size: 0.85rem;
}

.form-error[hidden] {
    display: none;
}

.decided {
    border-left: 3px solid var(--k);
    background: var(--mantle);
    border-radius: 0 10px 10px 0;
    padding: 0.9rem 1.1rem 1rem;
    margin-bottom: 2.5rem;
}

.decided-label {
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}

.decided.status-approved .decided-label { color: var(--green); }
.decided.status-rejected .decided-label { color: var(--red); }

.decided.status-rejected .final {
    color: var(--subtext0);
    text-decoration: line-through;
    text-decoration-color: var(--surface2);
}

.final {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
    color: var(--text);
}

/* Markdown supplied by the agent. */

.md {
    color: var(--subtext1);
    max-width: 78ch;
    overflow-wrap: anywhere;
}

.md > * + * {
    margin-top: 0.75rem;
}

.md h1, .md h2, .md h3, .md h4 {
    color: var(--text);
    font-size: 0.95rem;
    margin-top: 1.25rem;
}

.md ul, .md ol {
    padding-left: 1.4rem;
}

.md blockquote {
    border-left: 2px solid var(--surface1);
    padding-left: 0.9rem;
    color: var(--subtext0);
}

.md code {
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    background: var(--surface0);
    font-size: 0.9em;
}

.md pre {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: var(--mantle);
    overflow-x: auto;
}

.md pre code {
    padding: 0;
    background: none;
}

.md table {
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.md th, .md td {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--surface0);
    text-align: left;
}

.md hr {
    border: 0;
    border-top: 1px solid var(--surface0);
}

/* Diffs, both the agent's and the editor's own. */

.diff {
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0.8rem 0;
    border-radius: 8px;
    background: var(--mantle);
    overflow-x: auto;
}

.diff[hidden] {
    display: none;
}

.dl {
    display: inline-block;
    min-width: 100%;
    padding: 0 1rem;
    white-space: pre;
}

.dl-add  { color: var(--green); background: color-mix(in srgb, var(--green) 9%, transparent); }
.dl-del  { color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }
.dl-hunk { color: var(--sapphire); }
.dl-meta { color: var(--overlay1); }
.dl-ctx  { color: var(--subtext0); }

/* Reject dialog */

.dialog {
    margin: auto;
    width: min(32rem, calc(100vw - 2rem));
    padding: 1.3rem 1.4rem;
    border: 1px solid var(--surface1);
    border-radius: 12px;
    background: var(--base);
    color: var(--text);
}

.dialog::backdrop {
    background: color-mix(in srgb, var(--crust) 70%, transparent);
}

.dialog h2 {
    font-size: 1.05rem;
    color: var(--red);
}

.dialog p {
    margin: 0.4rem 0 1rem;
    font-size: 0.88rem;
}

.dialog label, .login label {
    display: block;
    font-size: 0.85rem;
    color: var(--subtext0);
    margin-bottom: 0.35rem;
}

.dialog textarea, .login input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--surface1);
    border-radius: 8px;
    background: var(--mantle);
    color: var(--text);
    font: inherit;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Login */

.login {
    max-width: 24rem;
    margin: 3rem auto 0;
}

.login h1 {
    font-size: 1.35rem;
}

.login p.muted {
    margin: 0.5rem 0 1.5rem;
}

.login .form-error {
    margin-top: 0.6rem;
}

.login .btn {
    margin-top: 1.1rem;
    width: 100%;
}

/* Toast for new drafts while reading another one. */

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    padding: 0.6rem 1rem;
    border: 1px solid var(--surface1);
    border-radius: 10px;
    background: var(--mantle);
    color: var(--text);
    font-size: 0.88rem;
    z-index: 20;
}

/* Editor modes */

main:focus {
    outline: none;
}

.mode-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem 0;
    border-bottom: 1px solid var(--surface0);
}

.mode-tabs[hidden], .pane[hidden], .mode-tabs button[hidden] {
    display: none;
}

.mode-tabs button {
    padding: 0.35rem 0.8rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--overlay1);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.mode-tabs button:hover {
    color: var(--text);
}

.mode-tabs button[aria-selected="true"] {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.mode-tabs button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.cm-host .cm-editor {
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}

.cm-host .cm-editor.cm-focused {
    outline: none;
    background: color-mix(in srgb, var(--mantle) 70%, var(--surface0));
}

.cm-host .cm-scroller {
    font-family: inherit;
    line-height: 1.65;
}

.cm-host .cm-content {
    min-height: 9rem;
    padding: 1rem 0;
    caret-color: var(--text);
}

.cm-host .cm-line {
    padding: 0 1.1rem;
}

.cm-host .cm-cursor {
    border-left-color: var(--text);
}

.cm-host .cm-selectionBackground, .cm-host .cm-focused .cm-selectionBackground {
    background: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Commit rulers at 50 and 72 columns, drawn from the line padding. */
.cm-host .cm-ruled .cm-content {
    background-image:
        linear-gradient(var(--surface1), var(--surface1)),
        linear-gradient(var(--surface1), var(--surface1));
    background-size: 1px 100%, 1px 100%;
    background-repeat: no-repeat;
    background-position: calc(1.1rem + 50ch) 0, calc(1.1rem + 72ch) 0;
}

.rich-warning {
    margin: 0;
    padding: 0.6rem 1.1rem;
    border-bottom: 1px solid var(--surface0);
    background: color-mix(in srgb, var(--yellow) 10%, transparent);
    color: var(--yellow);
    font-size: 0.82rem;
}

.rich, .preview {
    max-width: none;
    padding: 1rem 1.1rem;
    min-height: 9rem;
    color: var(--text);
}

.rich .ProseMirror {
    outline: none;
    min-height: 7rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.rich .ProseMirror:focus-visible {
    outline: none;
}

.rich .ProseMirror li {
    margin: 0.15rem 0;
}

.rich .ProseMirror li > p {
    margin: 0;
}

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

.tok-keyword { color: var(--mauve); }
.tok-string { color: var(--green); }
.tok-number { color: var(--peach); }
.tok-comment { color: var(--overlay1); font-style: italic; }
.tok-function { color: var(--blue); }
.tok-type { color: var(--yellow); }
.tok-property { color: var(--sapphire); }
.tok-punct { color: var(--overlay2); }
.tok-meta { color: var(--overlay1); }
.tok-link { color: var(--blue); }
.tok-heading { color: var(--lavender); font-weight: 600; }
.tok-strong { font-weight: 700; }
.tok-emphasis { font-style: italic; }
.tok-strike { text-decoration: line-through; }
.tok-code { color: var(--teal); }
.tok-quote { color: var(--subtext0); }
.tok-deleted { color: var(--red); }
.tok-invalid { color: var(--red); }

.help-open {
    margin-left: auto;
}

#help-dialog h2 {
    color: var(--text);
}

.keys kbd {
    margin: 0 0.1rem;
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--surface1);
    border-radius: 4px;
    background: var(--mantle);
    font-size: 0.75rem;
    opacity: 1;
}

.keys {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.6rem 1rem;
    margin: 1rem 0 0;
    font-size: 0.88rem;
}

.keys dt {
    color: var(--text);
}

.keys dd {
    margin: 0;
    color: var(--subtext0);
}

@media (max-width: 640px) {
    .topbar {
        gap: 0.2rem 1rem;
        padding: 0.5rem 1rem;
    }

    .tools {
        order: 2;
    }

    .tabs {
        order: 3;
        flex-basis: 100%;
    }

    kbd {
        display: none;
    }

    .help-open {
        display: none;
    }

    .keys {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .keys dd {
        margin-bottom: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

[data-theme="light"] .status-approved,
[data-theme="light"] .decided.status-approved .decided-label { color: var(--t-green); }
[data-theme="light"] .status-rejected,
[data-theme="light"] .decided.status-rejected .decided-label,
[data-theme="light"] .editor-meta .over,
[data-theme="light"] .tok-deleted,
[data-theme="light"] .tok-invalid { color: var(--t-red); }
[data-theme="light"] .editor-meta .warn,
[data-theme="light"] .rich-warning,
[data-theme="light"] .tok-type { color: var(--t-yellow); }
[data-theme="light"] .tok-keyword { color: var(--t-mauve); }
[data-theme="light"] .tok-string { color: var(--t-green); }
[data-theme="light"] .tok-number { color: var(--t-peach); }
[data-theme="light"] .tok-function,
[data-theme="light"] .tok-link { color: var(--t-blue); }
[data-theme="light"] .tok-property { color: var(--t-sapphire); }
[data-theme="light"] .tok-heading { color: var(--t-lavender); }
[data-theme="light"] .tok-code { color: var(--t-teal); }
[data-theme="light"] .edited { color: var(--t-peach); }
[data-theme="light"] .form-error,
[data-theme="light"] .dialog h2,
[data-theme="light"] .dl-del { color: var(--t-red); }
[data-theme="light"] .dl-add { color: var(--t-green); }
[data-theme="light"] .dl-hunk { color: var(--t-sapphire); }
[data-theme="light"] .btn kbd { opacity: 1; }
[data-theme="light"] .btn-reject { color: var(--t-red); }

/* Who sent it: agent and run read like a path. */

.who {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0 0.3rem;
    min-width: 0;
}

.agent {
    color: var(--text);
    font-weight: 600;
}

.run {
    color: var(--subtext0);
    overflow-wrap: anywhere;
}

.agent + .run::before {
    content: "/";
    margin-right: 0.3rem;
    color: var(--accent);
}

/* Review header: labelled facts. */

.flow {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--subtext0);
}

.review-head {
    margin: 0.9rem 0 1rem;
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0;
}

.fact {
    min-width: 0;
    margin-right: 1.4rem;
    padding-right: 1.4rem;
    border-right: 1px solid var(--surface0);
}

.fact:last-child,
.fact:has(+ .fact-origin) {
    margin-right: 0;
    padding-right: 0;
    border-right: 0;
}

.fact dt {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--subtext0);
}

.fact dd {
    font-size: 0.92rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.fact-kind dd {
    font-weight: 700;
}

.fact-kind dd::before {
    content: "";
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 2px;
    background: var(--k);
}

.fact-origin {
    flex-basis: 100%;
    margin-right: 0;
    padding-right: 0;
    border-right: 0;
}

.fact-origin dd {
    color: var(--subtext1);
    font-size: 0.85rem;
}

/* Panes: text first, context beside it. */

.seg {
    display: flex;
    gap: 0.25rem;
    margin: 0 0 0.9rem;
    padding: 0.3rem;
    border: 1px solid var(--surface0);
    border-radius: 10px;
    background: var(--mantle);
    position: sticky;
    top: 0;
    z-index: 5;
}

.seg[hidden] {
    display: none;
}

.seg button {
    flex: 1;
    min-height: 44px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--subtext1);
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
}

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

.seg button[aria-pressed="true"] {
    background: var(--surface0);
    color: var(--text);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--accent);
}

.seg-n {
    margin-left: 0.3rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--subtext1);
}

.seg button[aria-pressed="true"] .seg-n {
    color: var(--text);
}

.col-side:focus-visible, .diff-body:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.panel + .panel {
    margin-top: 1.5rem;
}

.panel-title {
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}

.ctx-sec h3 {
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--subtext0);
}

.ctx-sec + .ctx-sec {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--surface0);
}

.ctx .md {
    max-width: none;
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.97rem;
    line-height: 1.6;
}

.ctx .md > * + * {
    margin-top: 0.5rem;
}

.ctx .md li + li {
    margin-top: 0.2rem;
}

.ctx .md code {
    font-family: 'Cascadia Code', ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
    font-size: 0.85em;
}

.ctx .md a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ctx.is-clamped {
    max-height: 26rem;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 4rem), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 4rem), transparent);
}

.ctx-more {
    margin-top: 0.4rem;
    padding: 0.3rem 0;
}

.ctx-none {
    font-size: 0.92rem;
    max-width: 44ch;
}

.diff-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.3rem 0;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.diff-toggle:disabled {
    cursor: default;
}

.chev {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s;
}

.diff-toggle[aria-expanded="true"] .chev {
    transform: rotate(45deg);
}

.diff-sum {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--subtext0);
}

.dfile {
    margin-top: 0.7rem;
    border: 1px solid var(--surface0);
    border-radius: 8px;
    overflow: hidden;
}

.dfile-head {
    display: flex;
    align-items: baseline;
    gap: 0.2rem 0.7rem;
    flex-wrap: wrap;
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid var(--surface0);
    background: var(--mantle);
    font-size: 0.8rem;
}

.dpath {
    color: var(--text);
    overflow-wrap: anywhere;
}

.dnote {
    color: var(--subtext0);
}

.dstat {
    margin-left: auto;
    white-space: nowrap;
}

.dadd { color: var(--green); }
.ddel { color: var(--red); }
[data-theme="light"] .dadd { color: var(--t-green); }
[data-theme="light"] .ddel { color: var(--t-red); }

.dfile .diff {
    margin: 0;
    padding: 0.35rem 0;
    border-radius: 0;
    background: var(--base);
    font-size: 0.82rem;
}

.dfile .diff code {
    font: inherit;
}

.dl-sign {
    display: inline-block;
    width: 1.6ch;
    user-select: none;
}

.dl-hunk {
    background: color-mix(in srgb, var(--sapphire) 8%, transparent);
}

.dl-hunk, .dl-meta, .dl-ctx {
    color: var(--subtext0);
}

[data-theme="light"] .dl-hunk { color: var(--t-sapphire); }

/* Queue: who sent what. */

.inbox-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
    margin: 0 0 1.1rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
}

.chips ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
}

.tool-label {
    font-size: 0.78rem;
    color: var(--subtext0);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    white-space: nowrap;
    padding: 0 0.85rem;
    border: 1px solid var(--surface1);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.86rem;
}

.chip:hover {
    border-color: var(--overlay0);
    text-decoration: none;
}

.chip .n {
    color: var(--text);
    font-size: 0.78rem;
}

.chip[aria-current="true"] {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, var(--base));
}

.selects {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem 1rem;
}

.selects label {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.selects select {
    min-height: 40px;
    max-width: 100%;
    padding: 0 0.6rem;
    border: 1px solid var(--surface1);
    border-radius: 8px;
    background: var(--mantle);
    color: var(--text);
    font: inherit;
    font-size: 0.86rem;
}

.js .selects .apply {
    display: none;
}

.inbox-count {
    margin: 0 0 0.8rem;
    font-size: 0.86rem;
    color: var(--subtext0);
}

.group {
    margin-top: 1.6rem;
}

.group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

/* Small screens: one pane at a time, decision bar fixed to the bottom. */

@media not all and (min-width: 960px) and (min-height: 560px) {
    html {
        scroll-padding-bottom: 7rem;
    }

    .page-review main {
        padding-bottom: 8rem;
    }

    .actionbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
        background: var(--base);
        border-top: 1px solid var(--surface0);
        z-index: 10;
    }

    .actionbar .btn {
        flex: 1;
    }

    .actionbar .form-error {
        flex-basis: 100%;
    }

    .toast {
        bottom: 6rem;
    }

    .review[data-panel="text"] .col-side,
    .review[data-panel="context"] .col-main,
    .review[data-panel="context"] #panel-diff,
    .review[data-panel="diff"] .col-main,
    .review[data-panel="diff"] #panel-context {
        display: none;
    }

    .panel-title {
        display: none;
    }

    .diff-section .panel-title {
        display: block;
    }

    .chev {
        display: none;
    }

    .fact {
        display: grid;
        grid-template-columns: 5.6rem minmax(0, 1fr);
        gap: 0 0.5rem;
        margin: 0;
        padding: 0.1rem 0;
        border: 0;
    }

    .fact dt, .fact dd {
        font-size: 0.85rem;
    }

    .facts {
        display: block;
    }

    .btn, .mode-tabs button, .link-btn, .selects select, .chip, .tabs a {
        min-height: 44px;
    }

    .tabs a, .link-btn:not(.help-open), .chip {
        display: inline-flex;
        align-items: center;
    }

    .tabs a {
        padding: 0 0.1rem;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
    }

    .selects {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .selects label:last-of-type {
        grid-column: 1 / -1;
    }

    .selects select {
        width: 100%;
    }

    .chips {
        display: block;
    }

    .chips .tool-label {
        display: none;
    }

    .chips ul {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.3rem;
        margin-inline: -1rem;
        padding-inline: 1rem;
        scrollbar-width: thin;
    }

    .chip {
        flex: none;
    }

    .review-head {
        margin: 0.4rem 0 0.7rem;
    }

    .row a {
        padding: 1rem 0.25rem;
    }
}

/* Wide screens: the text on the left, its context on the right, each scrolling on its own. */

@media (min-width: 960px) and (min-height: 560px) {
    body.page-review {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        overflow: hidden;
    }

    .page-review .topbar,
    .page-review main {
        width: 100%;
        max-width: 1320px;
    }

    .page-review .topbar {
        flex: none;
        padding-block: 0.6rem;
    }

    .page-review main {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding-bottom: 0;
    }

    .review {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 0;
    }

    .review-head {
        flex: none;
        margin: 0.4rem 0 0.9rem;
    }

    .seg {
        display: none;
    }

    .layout {
        display: grid;
        flex: 1;
        grid-template-columns: minmax(0, 3fr) minmax(23rem, 2fr);
        min-height: 0;
    }

    .col-main, .col-side {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .col-main {
        padding: 0.25rem 1.5rem 1.5rem 0.25rem;
    }

    .col-side {
        padding: 0.25rem 0.25rem 1.5rem 1.5rem;
        border-left: 1px solid var(--surface0);
    }

    .actionbar {
        flex: none;
        margin: 0;
        padding: 0.7rem 0;
        border-top: 1px solid var(--surface0);
    }

    .diff-section.is-closed .diff-body {
        display: none;
    }

    .col-main {
        display: flex;
        flex-direction: column;
    }

    .col-main > .editor {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 14rem;
    }

    .editor .pane:not([hidden]) {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .editor .cm-host {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .editor .cm-host .cm-editor {
        flex: 1;
    }

    .editor .editor-meta {
        flex: none;
    }

    .toast {
        bottom: 5rem;
    }
}
