/* Catppuccin Mocha and Latte tokens, copied from paulorosario.com/style.css. */

@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: #6c6f85;
    --overlay2: #7c7f93;
    --overlay1: #8c8fa1;
    --overlay0: #9ca0b0;
    --surface2: #acb0be;
    --surface1: #bcc0cc;
    --surface0: #ccd0da;
    --blue: #1e66f5;
    --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);
}

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

/* Top bar */

.topbar {
    display: flex;
    align-items: center;
    gap: 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;
    gap: 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, .review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
    font-size: 0.82rem;
    color: var(--subtext0);
}

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

.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;
}

/* Review page */

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

.review-head .kind {
    font-weight: 700;
}

.origin {
    flex-basis: 100%;
    color: var(--overlay1);
    overflow-wrap: anywhere;
}

.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: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;
}

.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);
}

.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);
}

.context, .diff-section {
    margin-top: 2rem;
}

.context h2, .diff-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

/* 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;
}

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

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

    /* The decision stays in reach of the thumb. */
    .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%;
    }

    kbd {
        display: none;
    }

    .toast {
        bottom: 6rem;
    }
}

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