/* ARK-RAPID Agent Studio — Ark-Lumen tokens shared with the blog: night navy, cyan light, rapid blue, AI violet. */
:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-2: #eef2f9;
    --border: #dde4f0;
    --text: #0b1533;
    --muted: #5e6782;
    --heading: #081338;
    --link: #1d5bd8;
    --primary: #2563eb;
    --on-primary: #ffffff;
    --violet: #5b2bd9;
    --cyan: #0a6cb0;
    --ok: #0f7b4b;
    --ok-bg: #e6f6ee;
    --warn: #9a5b00;
    --warn-bg: #fff4dc;
    --bad: #b42318;
    --bad-bg: #fdecea;
    --live-bg: #e8f1ff;
    --code-bg: #040b24;
    --code-text: #e3e8f0;
    --shadow: 0 1px 2px rgba(8, 19, 56, .06), 0 8px 24px rgba(8, 19, 56, .06);
    --lumen: linear-gradient(90deg, #0acefb, #2e71ec 45%, #6b28f4);
    /* Chart series, validated for colour-blind separation against --surface (light and dark). */
    --series-1: #2563eb;
    --series-2: #eb6834;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #060d24;
        --surface: #0b1430;
        --surface-2: #101b3d;
        --border: #1f2b52;
        --text: #e3e8f0;
        --muted: #9aa5c2;
        --heading: #f2f5fb;
        --link: #6ea8ff;
        --primary: #3b82f6;
        --violet: #a78bfa;
        --cyan: #5fd4ff;
        --ok: #4ade80;
        --ok-bg: rgba(74, 222, 128, .12);
        --warn: #fbbf24;
        --warn-bg: rgba(251, 191, 36, .12);
        --bad: #f87171;
        --bad-bg: rgba(248, 113, 113, .12);
        --live-bg: rgba(59, 130, 246, .14);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
        --series-1: #3b82f6;
        --series-2: #d95926;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    border-top: 3px solid transparent;
    border-image: var(--lumen) 1;
}
a { color: var(--link); }
h1, h2, h3 { color: var(--heading); line-height: 1.25; }
h1 { font-size: 1.55rem; margin: 0 0 .4rem; }
h2 { font-size: 1.1rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.top {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .04em; color: var(--heading); text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 7px; }
.brand-sub { font-weight: 500; color: var(--muted); letter-spacing: 0; }
.top nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.badge {
    display: inline-block; min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary);
    font-size: .72rem; font-weight: 700; line-height: 1.5; text-align: center; vertical-align: 1px;
}
.signout { display: flex; gap: 8px; align-items: center; margin: 0; }
.signout .small-btn { margin-top: 0; }
.top nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--link); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 40px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 28px; }
.foot-mark { vertical-align: -4px; border-radius: 4px; margin-right: 4px; }

.hero { margin-bottom: 18px; }
.hero p { max-width: 900px; margin: 0 0 .6rem; }
.flow { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 10px 0 0; counter-reset: step; }
.flow li {
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: 3px 12px 3px 8px; font-size: .82rem; color: var(--muted); counter-increment: step;
}
.flow li::before { content: counter(step); display: inline-block; width: 1.3em; color: var(--cyan); font-weight: 700; }
.flow li b { color: var(--text); font-weight: 600; }
.flow li.loop { border-color: var(--violet); }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; min-width: 0;
}
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2.tight { gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-bottom: 14px; }
.cards .card { margin: 0; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
textarea, input, select {
    width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; margin-top: 4px;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; resize: vertical; min-height: 220px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin-top: 12px; }
.check input { width: auto; margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.actions form { margin: 0; }
form.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

button, .button {
    font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 14px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; display: inline-block;
}
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
button.ghost, .button.ghost { background: transparent; }
button:hover, .button:hover { filter: brightness(1.06); }

.alert { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 8px 12px; }
.alert.info { background: var(--live-bg); color: var(--text); }
.pill {
    display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .02em; border-radius: 999px;
    padding: 2px 9px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.ready { background: var(--live-bg); color: var(--link); border-color: transparent; }
.pill.live { background: var(--live-bg); color: var(--link); border-color: transparent; animation: pulse 1.6s ease-in-out infinite; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.ghost-pill { font-family: ui-monospace, Menlo, monospace; font-weight: 500; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }

.runs { list-style: none; margin: 0; padding: 0; }
.runs li a {
    display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 9px 4px; text-decoration: none; color: var(--text);
    border-bottom: 1px solid var(--border);
}
.runs li a .small { grid-column: 2; }
.runs .run-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd p { margin: 0 0 .5rem; }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 7px; margin: 0 4px 3px 0; font-size: .82rem; }

/* Run page */
.run-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.run-head .actions { margin-top: 0; align-self: flex-start; }
.meta-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.note { margin: .5rem 0 0; overflow-wrap: anywhere; }
.run-grid { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.timeline-card { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.timeline { list-style: none; margin: 0; padding: 0; overflow-y: auto; font-size: .82rem; flex: 1; }
.timeline li { padding: 5px 0; border-bottom: 1px dashed var(--border); overflow-wrap: anywhere; }
.timeline time { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: .74rem; margin-right: 6px; }
.timeline .actor { margin-right: 6px; color: var(--heading); }
.timeline .k-memory .actor { color: var(--cyan); }
.timeline .k-note .actor { color: var(--violet); }
.timeline .k-warning span { color: var(--warn); }
.timeline .k-status span { font-weight: 700; }
.timeline .k-llm span { color: var(--muted); }
.live { background: var(--live-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.live-head { font-size: .82rem; overflow-wrap: anywhere; }
#live-text { margin: 6px 0 0; max-height: 150px; overflow-y: auto; white-space: pre-wrap; font-size: .78rem; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 12px; color: var(--muted); }
.tab.active { background: var(--surface); border-color: var(--border); color: var(--heading); box-shadow: var(--shadow); }
.tab .count { font-size: .74rem; color: var(--muted); margin-left: 2px; }
.pane { display: none; }
.pane.active { display: block; }

details.card > summary { cursor: pointer; overflow-wrap: anywhere; }
details.card[open] > summary { margin-bottom: 10px; }
pre.code, pre.chunk, pre.prompt-body {
    white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 10px; padding: 12px; border-radius: 8px; max-height: 480px; overflow-y: auto;
}
pre.code { background: var(--code-bg); color: var(--code-text); }
pre.chunk, pre.prompt-body { background: var(--surface-2); border: 1px solid var(--border); }
.preview { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin: 12px 0; }
.lede { border-left: 3px solid var(--cyan); padding-left: 10px; }
.ok-card { border-color: var(--ok); background: var(--ok-bg); }
.bad-card { border-color: var(--bad); background: var(--bad-bg); }
.ok-text { color: var(--ok); }
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { padding: 4px 0; overflow-wrap: anywhere; }
.issues .sev { display: inline-block; min-width: 3.4em; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.sev-hard .sev { color: var(--bad); }
.sev-soft .sev { color: var(--warn); }
.sev-info .sev { color: var(--muted); }
table.facts { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.facts td { border-bottom: 1px solid var(--border); padding: 5px 6px; vertical-align: top; overflow-wrap: anywhere; }
.kind { font-size: .74rem; text-transform: uppercase; color: var(--violet); font-weight: 700; }
.notes { margin: 0; padding-left: 18px; }
.notes li { margin-bottom: 4px; overflow-wrap: anywhere; }
.decision ul { margin: 0; padding-left: 18px; }
.decision li { overflow-wrap: anywhere; }
.call summary { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.prompt h2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Learning */
.timeline .k-learning .actor { color: var(--violet); }
.bad-text { color: var(--bad); }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tiles .tile { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-value { font-size: 1.9rem; font-weight: 650; color: var(--heading); line-height: 1.2; }
.tile-delta { font-size: .8rem; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis, .chart .end-label { fill: var(--muted); font-size: 11px; }
.chart .end-label { fill: var(--text); font-weight: 600; }
.chart .avg { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .dot.test { fill: var(--surface); stroke: var(--series-1); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .pt { cursor: default; outline: none; }
.chart .pt:hover .dot, .chart .pt:focus .dot { r: 6; }
.chart-tip {
    position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
    box-shadow: var(--shadow); border-radius: 8px; padding: 5px 9px; font-size: .78rem; max-width: 320px;
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: .85rem; margin: 8px 0 0; }
.key { display: inline-block; vertical-align: middle; margin-right: 4px; }
.dot-key { width: 9px; height: 9px; border-radius: 50%; background: var(--series-1); }
.test-key { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--series-1); }
.line-key { width: 18px; height: 2px; background: var(--series-2); border-radius: 1px; }
.changes { margin: 4px 0 0; padding-left: 18px; font-size: .84rem; }
.challenger { padding: 4px 0 8px; border-bottom: 1px dashed var(--border); }
.challenger:last-child { border-bottom: 0; }
.small-btn { padding: 3px 9px; font-size: .8rem; margin-top: 4px; }
details.cycle { border-top: 1px solid var(--border); padding: 8px 0; }
details.cycle > summary { cursor: pointer; overflow-wrap: anywhere; }
details.cycle h3 { margin-top: 10px; }
.cycle-note { display: block; margin-top: 6px; }
fieldset.rating { border: 0; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
fieldset.rating legend { color: var(--muted); padding: 0; margin-bottom: 2px; }
fieldset.rating .check { margin-top: 6px; }
textarea.comment { min-height: 80px; font-family: inherit; font-size: .9rem; }

/* Sign-in */
.login { max-width: 400px; margin: 4vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.login-logo img { display: block; width: 240px; height: 240px; border-radius: 16px; box-shadow: var(--shadow); }
.login-card { width: 100%; }
.login-card h1 { margin-bottom: .2rem; }

/* Feedback inbox */
a.tile-link { text-decoration: none; color: inherit; }
a.tile-link:hover { border-color: var(--primary); }
.tabs a.tab { text-decoration: none; }
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li a { display: flex; flex-direction: column; gap: 3px; padding: 10px 4px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.inbox li a:hover .run-title { color: var(--link); }
.inbox-head { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.comment-quote { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--violet); background: var(--surface-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-timeline { max-height: 460px; flex: none; }
.inbox-timeline .kind { font-size: .7rem; text-transform: uppercase; color: var(--violet); font-weight: 700; margin-right: 4px; }
.inbox-timeline .k-promoted span, .inbox-timeline .k-status span { font-weight: 600; }
.status-form { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 4px; }
h3.spaced { margin-top: 14px; }
table.compare td:first-child { white-space: nowrap; }
pre.diff { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 480px; overflow-y: auto; font-size: .8rem; }
pre.diff span { display: block; }
pre.diff .dadd { background: var(--ok-bg); color: var(--ok); }
pre.diff .ddel { background: var(--bad-bg); color: var(--bad); }
pre.diff .deq { color: var(--muted); }
textarea.issue { min-height: 260px; font-size: .82rem; }

@media (max-width: 960px) {
    .grid-2, .grid-2.tight, .run-grid { grid-template-columns: minmax(0, 1fr); }
    .timeline-card { position: static; max-height: 420px; }
}
.table-scroll table.wide { min-width: 680px; }

@media (max-width: 560px) {
    /* The chart scales with its width; its text is set in chart units, so it needs to be larger on a phone. */
    .chart .axis, .chart .end-label { font-size: 21px; }
    .wrap { padding: 16px 16px 32px; }
    .top { padding: 10px 16px; }
    .row { grid-template-columns: 1fr; }
    .kv { grid-template-columns: minmax(0, 1fr); }
    .kv dt { margin-top: 6px; }
}
