/*
 * One stylesheet, no framework, no build step.
 *
 * The UI is three things: a conversation, a diff and a change log, so the stylesheet is small
 * and needs no bundler. It uses system fonts, so the page loads nothing from other origins.
 */

:root {
    --ink: #16181d;
    --ink-soft: #5b616e;
    --line: #dcdfe6;
    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --accent: #1f4ed8;
    --add: #1b7f3b;
    --add-bg: #eaf7ee;
    --remove: #b42318;
    --remove-bg: #fdeceb;
    --radius: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e7e9ee;
        --ink-soft: #9aa1ae;
        --line: #2c3038;
        --bg: #14161a;
        --bg-soft: #1b1e24;
        --accent: #7fa0ff;
        --add: #5cc47f;
        --add-bg: #15291c;
        --remove: #f08b84;
        --remove-bg: #2a1716;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

code, pre, .diff {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
}

.top {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
}

.mark { font-weight: 650; letter-spacing: -0.01em; }
.sub { color: var(--ink-soft); }

main { padding: 24px 20px 48px; }

.card {
    max-width: 440px;
    margin: 48px auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
}

.card h1 { margin: 0 0 12px; font-size: 22px; }
.card p { color: var(--ink-soft); margin: 0 0 16px; }

label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 500;
}

input, textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 11px;
    font: inherit;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
}

input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button, .button {
    display: inline-block;
    padding: 9px 16px;
    font: inherit;
    font-weight: 500;
    color: var(--bg);
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.button.primary { background: var(--accent); border-color: var(--accent); }

.button.quiet {
    color: var(--ink-soft);
    background: transparent;
    border-color: var(--line);
}

.button.danger { color: var(--remove); background: transparent; border-color: var(--remove); }

.muted { color: var(--ink-soft); font-size: 14px; }
.error { color: var(--remove); font-size: 14px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.app {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

@media (max-width: 760px) {
    .app { grid-template-columns: 1fr; }
}

.rail h2 {
    margin: 24px 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
}

.list { list-style: none; margin: 12px 0; padding: 0; }

.list li {
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.list li:hover { background: var(--bg-soft); }
.list li[aria-current="true"] { border-color: var(--line); background: var(--bg-soft); }

.list .status { display: block; font-size: 12px; color: var(--ink-soft); }

.transcript { min-height: 180px; }

.turn {
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.turn.you { background: var(--bg); }
.turn .who { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.turn p { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Text that shows a path, a change summary or the agent's words must wrap, so that a long
   line cannot run off the screen and hide part of what it says. */
.list li, .file > summary, .banner, .review header, .path { overflow-wrap: anywhere; white-space: pre-wrap; }
.file > summary > span { min-width: 0; }

/* A hidden character shown as a visible token (see visibleText in app.js). */
.ctl {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85em;
    padding: 0 2px;
    border-radius: 3px;
    color: var(--remove);
    background: var(--remove-bg);
    white-space: nowrap;
}
.turn p:last-child { margin-bottom: 0; }

.review {
    margin: 16px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.review header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-soft);
}

.review .actions { display: flex; gap: 8px; }

.file { border-top: 1px solid var(--line); }
.file:first-of-type { border-top: 0; }

.file > summary {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.file .counts { color: var(--ink-soft); font-size: 12px; }
.file .counts .plus { color: var(--add); }
.file .counts .minus { color: var(--remove); }

.diff { margin: 0; padding: 0; overflow-x: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .row { display: block; padding: 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .row.add { color: var(--add); background: var(--add-bg); }
.diff .row.del { color: var(--remove); background: var(--remove-bg); }
.diff .row.hunk { color: var(--ink-soft); background: var(--bg-soft); }

.ask { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.ask button { align-self: flex-start; }

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

.banner {
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: 6px;
    font-size: 14px;
}

.banner.warn { border-left-color: var(--remove); }
.banner.ok { border-left-color: var(--add); }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
.claude { margin: 1.5rem 0; }
.claude form { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.claude input { flex: 1 1 12rem; min-width: 0; font: inherit; padding: .4rem .5rem; }
.claude .button { margin-top: .5rem; display: inline-block; }

