:root {
  /* near-black with no panels: regions are split by space and hairlines, one green for what's on */
  color-scheme: dark;
  --bg: #171717;
  --bg-side: #171717;
  --bg-sunk: #212121;
  --selected: #262626;
  --field: #212121;
  --surface: #1f1f1f;
  --ink: #ededed;
  --ink-2: #b5b5b5;
  --muted: #8e8e8e;
  --faint: #666666;
  --line: #2b2b2b;
  --line-2: #262626;
  --line-strong: #3a3a3a;
  --brand: #ededed;
  --primary: #2a2a2a;
  --primary-hover: #333333;
  --primary-ink: #ededed;
  --primary-line: #3a3a3a;
  --danger: #e8776d;
  --bad-bg: #3a1f1d;
  --bad-ink: #e8a29b;
  --accent: #4d9a70;
  --accent-soft: #1f3329;
  --accent-ink: #8fd0ab;
  --focus: #7fb896;
  --nav-width: 220px;
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
  --font-head: "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --bg-side: #fafafa;
  --bg-sunk: #f0f0f0;
  --selected: #ebebeb;
  --field: #f0f0f0;
  --surface: #ffffff;
  --ink: #171717;
  --ink-2: #4a4a4a;
  --muted: #6e6e6e;
  --faint: #a0a0a0;
  --line: #e6e6e6;
  --line-2: #eeeeee;
  --line-strong: #d0d0d0;
  --brand: #171717;
  --primary: #171717;
  --primary-hover: #333333;
  --primary-ink: #ffffff;
  --primary-line: #171717;
  --accent: #2f8a5b;
  --accent-soft: #e3f3ea;
  --accent-ink: #23704d;
  --focus: #23704d;
  --danger: #b3261e;
  --bad-bg: #fbe4e2;
  --bad-ink: #9b2c22;
  --shadow-pop: 0 16px 40px -12px rgba(23, 23, 23, .2), 0 2px 6px rgba(23, 23, 23, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45;
       -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
.icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.25; fill: none;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 16px; height: 16px; }

/* The shell: a side menu beside the page */
.app { height: 100vh; }
.shell { position: relative; display: flex; height: 100%; }
.page { flex: 1; min-width: 0; height: 100%; overflow: hidden; display: flex; }
.page > .main { flex: 1; }
.layout { flex: 1; display: flex; justify-content: center; min-width: 0; min-height: 0; }
.column { flex: 1 1 0; max-width: 840px; }

/* The left column */
.nav { position: relative; z-index: 12; flex: none; width: var(--nav-width); display: flex; flex-direction: column; border-right: 1px solid var(--line);
       transition: width .15s ease; }
.nav-content { flex: 1; min-height: 0; padding: 0 12px 16px; display: flex; flex-direction: column; gap: 2px; overflow: hidden auto; }
.wordmark { flex: none; padding: 16px 22px 14px; font-family: var(--font-head); font-weight: 700; font-size: 24px; line-height: 1.2; letter-spacing: -.01em;
            color: var(--brand); text-decoration: none; }
.profile { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; font-weight: 600; }
.profile .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ink-2); color: var(--bg); display: grid; place-items: center;
          font-weight: 700; font-size: 12px; }
.profile:hover .avatar { background: var(--ink); }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px;
            background: transparent; color: var(--ink-2); font-weight: 500; text-align: left; white-space: nowrap; }
.nav-item:hover:not(:disabled) { background: var(--bg-sunk); }
.nav-item:disabled { color: var(--faint); cursor: not-allowed; }
.nav-item.active { background: var(--selected); color: var(--ink); font-weight: 600; }
.nav-item .icon { color: var(--muted); }
.nav-item:disabled .icon { color: var(--faint); }
.nav-item .n { margin-left: auto; color: var(--faint); font-size: 12px; font-weight: 600; }
.nav-none { color: var(--faint); }
.nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-group summary { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 10px; border-radius: 8px; cursor: pointer;
                     list-style: none; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: var(--bg-sunk); }
.nav-group summary .icon { transition: transform .15s ease; }
.nav-group[open] summary .icon { transform: rotate(180deg); }
.ldot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; margin: 0 6px; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.page-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 8px; }
.page-head .spacer { flex: 1; }
.page-head .search { flex: 0 1 280px; width: auto; min-width: 0; }
.page-title { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 24px; }

/* A page's heading: a way back, then what it is */
.post-head { display: flex; align-items: flex-start; gap: 12px; }
.back { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-sunk); color: var(--ink); }
.back:hover { background: var(--selected); }
.post-title { flex: 1; min-width: 0; }
.post-title small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-title small a { color: var(--ink-2); text-decoration: none; }
.post-title small a:hover { text-decoration: underline; }
.post-title h1 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 20px; line-height: 1.25; }

.search { width: 360px; height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line);
          border-radius: 999px; background: var(--surface); color: var(--faint); }
.search:focus-within { border-color: var(--line-strong); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); }
.kbd { flex: none; font-size: 11px; color: var(--faint); font-weight: 600; }

.btn { height: 34px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
       background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px; }
.btn:hover { border-color: var(--line-strong); color: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover, .btn.ghost.on { background: var(--bg-sunk); color: var(--ink); }
.btn.icon-only { width: 34px; padding: 0; justify-content: center; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.btn.wide { width: 100%; justify-content: center; height: 38px; }

/* Popovers */
.anchor { position: relative; }
.pop { position: absolute; right: 0; top: 42px; z-index: 10; width: 260px; display: none; padding: 6px;
       background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); }
.pop.open { display: block; }
.pop-label { padding: 8px 10px 4px; color: var(--faint); font-size: 11.5px; font-weight: 600; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px;
            background: transparent; text-align: left; color: var(--ink); }
.pop-item:hover, .pop-item.hover { background: var(--bg-sunk); }
.pop-item .icon { color: var(--muted); }
.pop-item b { display: block; font-weight: 600; }
.pop-item small { color: var(--muted); font-size: 12px; }
.pop-item .tick { margin-left: auto; color: var(--ink); visibility: hidden; }
.pop-item.on .tick { visibility: visible; }
.pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 4px; }

/* Grouped list, rows in the two-line style of the first draft */
.list { flex: 1; overflow: auto; padding: 0 24px 32px; }
.group-head { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px; margin-top: 8px; border-radius: 7px;
              cursor: pointer; user-select: none; color: var(--ink-2); }
.group-head:hover { background: var(--bg-sunk); }
.group-head .chev { color: var(--muted); display: grid; transition: transform .15s ease; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .rows { display: none; }
.group-head .name { font-family: var(--font-head); font-weight: 600; font-size: 14px; color: var(--ink); }
.count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px; background: var(--selected); color: var(--muted);
         font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.group-head .hint { color: var(--faint); font-size: 12.5px; }

.rows { border-top: 1px solid var(--line-2); }
.task { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 12px;
        border-bottom: 1px solid var(--line-2); cursor: pointer; }
.task:hover { background: var(--bg-sunk); }
.task-title { display: flex; gap: 10px; align-items: baseline; font-size: 15px; font-weight: 600; min-width: 0; }
.task-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key { font-weight: 700; color: var(--muted); font-size: 13px; letter-spacing: .01em; font-variant-numeric: tabular-nums; flex: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta .open { color: var(--ink-2); font-weight: 600; }
.meta .none { color: var(--faint); }
.task-side { display: flex; align-items: center; gap: 8px; }
.chip { height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px;
        border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.chip.hot { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.when { min-width: 74px; text-align: right; color: var(--muted); font-size: 12.5px; }

/* Import modal: white, in front, with a soft lift */
.scrim { position: fixed; inset: 0; z-index: 20; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh;
         background: rgba(29, 29, 27, .18); }
.scrim.open { display: flex; }
.modal { width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop);
         display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; }
.modal-head .eyebrow { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.modal-head h3 { font-family: var(--font-head); font-weight: 600; font-size: 22px; margin: 2px 0 0; }
.modal-head .spacer { flex: 1; }
.modal .search { width: auto; margin: 0 22px 6px; border-radius: 9px; }
.results-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 22px 6px; color: var(--muted);
                font-size: 12px; font-weight: 600; }
.link { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 600; font-size: 12px; text-decoration: underline;
        text-underline-offset: 3px; text-decoration-color: var(--faint); }
.results { list-style: none; margin: 0; padding: 0 10px 10px; max-height: 340px; overflow: auto; }
.result { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 9px; cursor: pointer; }
.result:hover { background: var(--bg); }
.result.checked { background: var(--bg-sunk); }
.result input { position: absolute; opacity: 0; pointer-events: none; }
.box { width: 18px; height: 18px; margin-top: 2px; border: 1px solid var(--line-strong); border-radius: 5px; display: grid; place-items: center;
       background: var(--surface); flex: none; }
.box .icon { width: 13px; height: 13px; stroke-width: 2; opacity: 0; }
.result.checked .box { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.result.checked .box .icon { opacity: 1; }
.result .meta { margin-top: 3px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg); }
.modal-foot .note { flex: 1; color: var(--muted); font-size: 13px; font-weight: 600; }

/* Beyond the wireframes: empty and error states, forms, the task drawer */
[hidden] { display: none !important; }
.empty { padding: 48px 8px; color: var(--muted); text-align: center; }
.empty b { display: block; font-family: var(--font-head); font-size: 16px; color: var(--ink-2); margin-bottom: 4px; }
.banner { margin: 0 24px 8px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.result.loading, .result.error { cursor: default; color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 14px; padding: 4px 22px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.field small { color: var(--faint); font-size: 12px; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 10px;
         font: inherit; color: var(--ink); outline: 0; }
.input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(45, 91, 227, .12); }
textarea.input { resize: vertical; min-height: 96px; }
input.input.title { font-family: var(--font-head); font-size: 18px; font-weight: 600; }

.drawer-scrim { position: fixed; inset: 0; z-index: 15; background: rgba(29, 29, 27, .10); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 16; width: min(560px, 100vw); display: flex; flex-direction: column;
          background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head .eyebrow { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.drawer-head .spacer { flex: 1; }
.drawer-body { flex: 1; overflow: auto; padding-top: 16px; }
.drawer .section-title { display: flex; align-items: center; justify-content: space-between; padding: 6px 22px; margin-top: 6px;
                         font-family: var(--font-head); font-weight: 600; font-size: 14px; }
.threads { list-style: none; margin: 0; padding: 0 12px 24px; }
.thread { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; }
.thread:hover { background: var(--bg); }
.thread .t { flex: 1; min-width: 0; }
.thread .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .t small { color: var(--muted); font-size: 12px; }
.thread.closed b { color: var(--muted); font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fa37a; flex: none; }
.thread.closed .status-dot { background: var(--faint); }
.new-thread { display: flex; gap: 8px; padding: 0 22px 12px; }
.links { display: flex; flex-direction: column; gap: 4px; }
.links a { color: var(--ink-2); font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.danger { color: var(--danger) !important; }
.file-icon { color: var(--muted); display: grid; }
.section-title label.btn { height: 30px; font-family: var(--font-body); }
.signin { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--bg); }
.signin-card { width: 360px; padding: 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
               box-shadow: var(--shadow-pop); text-align: center; }
.signin-card .brand { margin: 0 auto 12px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
                      font-family: var(--font-head); font-weight: 700; font-size: 16px; background: var(--brand); color: #fff; }
.signin-card h1 { font-family: var(--font-head); font-weight: 600; font-size: 24px; margin: 0; }
.signin-card p { color: var(--muted); margin: 6px 0 18px; }
.signin-card .banner { margin: 0 0 14px; text-align: left; }
.signin-providers { display: flex; flex-direction: column; gap: 8px; }
.signin-providers .btn { justify-content: center; height: 40px; text-decoration: none; }
.new-thread { flex-direction: column; }
.new-thread-row { display: flex; gap: 8px; }
.new-thread-row .input { flex: 1; }
.thread { cursor: default; }
.thread[data-open] { cursor: pointer; }
.thread.running .status-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.code { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; background: var(--bg-sunk); font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.note-text { margin: 4px 0; color: var(--muted); font-size: 13px; }

/* Shared rows */
.rows-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.row:hover { background: var(--bg-sunk); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t small { color: var(--muted); font-size: 12px; }
.row-icon { color: var(--muted); display: grid; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: #3fa37a; }
.dot.busy { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.turn-right { transform: rotate(-90deg); color: var(--faint); }
.empty.small { padding: 8px 10px; text-align: left; font-size: 13px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.task-side .anchor .pop { right: 0; }
.task-side .btn.icon-only { width: 28px; height: 28px; }
.pop a.pop-item { text-decoration: none; }

/* Task details */
.detail { flex: 1; overflow: auto; padding: 20px 24px 48px; }
.detail-title { flex: 1; min-width: 0; font-family: var(--font-head); font-weight: 600; font-size: 26px; line-height: 1.25; margin: 0; }
.detail-title .key { font-size: 16px; margin-right: 10px; }
.meta.big { font-size: 13.5px; gap: 6px 18px; margin: 10px 0 18px 44px; }
.detail > .prose, .detail > .links, .detail > .detail-section { margin-left: 44px; }
.prose { line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.prose code { background: var(--bg-sunk); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.prose .code { white-space: pre-wrap; }
.prose a { color: var(--focus); overflow-wrap: anywhere; }
.detail .prose { margin-bottom: 14px; color: var(--ink-2); }
.detail .links { margin-bottom: 8px; }
.detail-section { margin-top: 26px; }
.detail-section h2 { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 600; font-size: 16px; margin: 0 0 8px; }
.detail-section h2 .icon { color: var(--muted); }

/* Thread */
/* The chat sits in the centre, with what the session made to its right; a document opened from it
   takes that panel's place. */
.thread-body { overflow-x: auto; }
.chat { flex: 1 1 0; min-width: 420px; max-width: 840px; display: flex; flex-direction: column; min-height: 0; }
.thread-body.viewing .chat { flex: 0 1 560px; }
.thread-body.viewing .side { display: none; }
.chat .post-head { padding: 14px 24px; border-bottom: 1px solid var(--line-2); }
.transcript { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 0; }
.entry { display: flex; flex-direction: column; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; word-wrap: break-word; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--selected); color: var(--ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: transparent; padding-left: 0; max-width: 100%; }
.msg small { display: block; margin-bottom: 4px; opacity: .7; font-size: 11.5px; font-weight: 600; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.card.asking { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.card-head .icon { color: var(--muted); }
.card-head .pill { margin-left: auto; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-foot { color: var(--muted); font-size: 12.5px; }
.card-error { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.card .code { margin: 0; max-height: 240px; overflow: auto; }
.pill { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-sunk); color: var(--muted); white-space: nowrap; }
.pill.awaiting_approval { background: var(--accent-soft); color: var(--accent-ink); }
.pill.completed { background: #e3f3ea; color: #23704d; }
.pill.denied, .pill.failed, .pill.timed_out { background: #fbe4e2; color: #9b2c22; }
.card.tool:not(.asking) { padding: 8px 12px; }
.q-list { display: flex; flex-direction: column; gap: 10px; }
.q-head { font-size: 13.5px; }
.q-options { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.q-option { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.q-option:hover { background: var(--bg-sunk); }
.q-option small { display: block; color: var(--muted); font-size: 12px; }
.q-answers { list-style: none; margin: 4px 0 0; padding: 0; color: var(--ink-2); font-size: 13px; }
.q-answers li { display: flex; gap: 6px; align-items: center; }
.sign-in { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 8px 12px; border-radius: 10px; background: var(--bg-sunk); }
.sign-in .icon { color: var(--muted); }
.sign-in.success { background: #e3f3ea; color: #23704d; }
.sign-in.success .icon { color: #23704d; }
.sign-in.failed, .sign-in.timed_out, .sign-in.cancelled, .sign-in.denied { background: #fbe4e2; color: #9b2c22; }
.sign-in .link { margin-left: auto; }
.sign-in .link + .link { margin-left: 8px; }
.notice { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.err { font-size: 13px; color: var(--danger); }
.ended { text-align: center; font-size: 12px; color: var(--faint); }
.status-line { padding: 0 24px 4px; min-height: 18px; color: var(--danger); font-size: 12.5px; }
.status-line:empty { display: none; }
.composer { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 24px 20px;
            padding: 12px 10px 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.composer > .input { flex: 0 0 100%; min-height: 0; }
.composer .input { resize: none; border: 0; padding: 4px 0; box-shadow: none; }
.composer-side { flex: 0 0 100%; display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.composer-side select { flex: none; width: auto; max-width: 200px; font-size: 12.5px; padding: 4px 8px; }
.composer .send { border-radius: 10px; }
.composer-note { margin: 0 auto 20px; color: var(--muted); font-size: 13px; }
/* The right bar: a card floating beside the page that fits what it holds. The main action stays
   outside the scrolling part, so its menu can open over the rest. */
.side { flex: none; align-self: flex-start; width: 312px; max-height: calc(100% - 32px); margin: 16px 16px 16px 8px; border-radius: 16px;
        background: var(--bg-side); display: flex; flex-direction: column; }
.side-rest { flex: 1; min-height: 0; overflow: auto; border-radius: 0 0 16px 16px; }
.side section { padding: 16px; border-bottom: 1px solid var(--line); }
.side section:last-child { border-bottom: 0; }
.side > section:only-child { border-radius: 16px; }
.split { display: flex; }
.split > .btn:first-child { flex: 1; justify-content: center; height: 38px; border-radius: 999px 0 0 999px; }
.split > .btn.primary:nth-child(2) { flex: none; width: 40px; height: 38px; padding: 0; justify-content: center; border-radius: 0 999px 999px 0; border-left-color: rgba(255, 255, 255, .28); }
.side h3 { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.side .empty.small { padding: 0; color: var(--muted); }
.side .rows-list { gap: 2px; margin: 0 -8px; }
.side .row { padding: 6px 8px; }
.side .row .btn.icon-only { width: 26px; height: 26px; }
.side .status-line { padding: 6px 0 0; margin: 0; }
.side .pop { left: 0; right: 0; width: auto; }
.artifact-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; margin: -6px -8px; border: 0; border-radius: 7px;
                background: transparent; text-align: left; color: var(--ink-2); font-size: 13px; text-decoration: none; }
.artifact-row:hover { background: var(--bg-sunk); color: var(--ink); }
.artifact-row.on { background: var(--selected); color: var(--ink); font-weight: 600; }
.artifact-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-row .icon { color: var(--muted); }

/* What the agent is doing now, and how long a finished turn took */
.activity { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 2px 24px 10px; }
.activity .spin { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; flex: none; }
.thinking::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
.worked { color: var(--faint); font-size: 12.5px; }
.steps { color: var(--muted); font-size: 12.5px; }
.steps summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.steps summary::-webkit-details-marker { display: none; }
.steps summary::after { content: "›"; transition: transform .15s ease; }
.steps[open] summary::after { transform: rotate(90deg); }
.steps ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 2px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.steps li { display: flex; gap: 6px; align-items: center; }
.steps li.failed, .steps li.denied, .steps li.timed_out { color: var(--bad-ink); }

/* The agent's Markdown in the conversation */
.md { line-height: 1.6; word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.3; margin: 1em 0 .4em; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3, .md h4 { font-size: 15px; }
.md p { margin: 0 0 .7em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.4em; }
.md li { margin: .15em 0; }
.md code { background: var(--bg-sunk); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.md pre { background: var(--bg-sunk); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12.5px; margin: 0 0 .7em; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .7em; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.md table { border-collapse: collapse; margin: 0 0 .7em; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--bg-sunk); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md a { color: var(--focus); }
.msg a, .queued a, .notice a, .err a { overflow-wrap: anywhere; }
.msg.user a, .queued a, .err a { color: inherit; }
.entry:empty { display: none; }

/* Messages waiting for the agent, above the composer */
.queue { margin: 0 24px 8px; display: flex; flex-direction: column; gap: 6px; }
.queued { align-self: flex-end; max-width: 75%; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--line-strong); color: var(--ink-2);
          white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; }
.queued small { display: block; color: var(--faint); font-size: 11.5px; font-weight: 600; margin-bottom: 2px; }
.msg.user.unsent { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.composer .stop { background: #c4321f; border-color: #c4321f; color: #fff; border-radius: 10px; }
.composer .stop:hover { background: #a82a1a; }
.stop-square { width: 11px; height: 11px; border-radius: 2px; background: currentColor; }

/* An artifact in the conversation */
.artifact { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
            background: var(--surface); text-align: left; max-width: 420px; color: inherit; text-decoration: none; }
button.artifact:hover, a.artifact:hover { border-color: var(--line-strong); }
.artifact .icon { color: var(--muted); }
.artifact b { display: block; font-weight: 600; }
.artifact small { color: var(--muted); font-size: 12px; }

/* An image the agent made, in a dialog */
.image-scrim { align-items: center; padding: 4vh 4vw; z-index: 30; background: rgba(29, 29, 27, .55); }
.image-modal { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; background: var(--surface);
               border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-pop); }
.image-modal figcaption { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.image-modal figcaption b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.image-modal img { display: block; max-width: 92vw; max-height: calc(92vh - 50px); object-fit: contain; background: var(--bg-sunk); }

/* A knowledge document, opened beside the chat */
.viewer { flex: 1 1 0; min-width: 420px; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); }
.viewer-head { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line); }
.viewer-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-head); font-weight: 600; }
.viewer iframe { flex: 1; width: 100%; border: 0; }
.viewer-body { flex: 1; display: flex; min-height: 0; }
.viewer-tree { flex: none; width: 200px; overflow: auto; padding: 14px 12px; border-right: 1px solid var(--line);
               display: flex; flex-direction: column; gap: 4px; }
.viewer-tree .artifact-row { margin: 0; }

/* A document opened over the task page */
.doc-scrim { align-items: center; padding: 4vh 4vw; z-index: 30; background: rgba(29, 29, 27, .55); }
.doc-modal { width: min(1100px, 92vw); height: 88vh; min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
             flex: none; box-shadow: var(--shadow-pop); }

/* Files on the task page and in a thread */
.file-row[data-open], .file-row[data-image] { cursor: pointer; }
.file-row .t small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .t small.sub { color: var(--faint); }
.file-item { display: flex; align-items: center; gap: 6px; }
.file-item .artifact-row { flex: 1; min-width: 0; }
.btn.icon-only.xs { width: 24px; height: 24px; flex: none; }
.on-task { flex: none; color: var(--faint); font-size: 11px; }
.composer-buttons { display: flex; gap: 6px; align-items: center; }
.composer.drop { border-color: var(--focus); background: var(--bg-sunk); }
.composer-files { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.composer-files[hidden] { display: none; }
.chip-file { position: relative; display: flex; align-items: center; gap: 10px; width: 240px; padding: 8px 12px 8px 8px; border: 1px solid var(--line);
             border-radius: 12px; background: var(--surface); }
.chip-tile { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; overflow: hidden;
             border-radius: 8px; background: var(--ink); color: var(--bg); }
.chip-tile img { width: 100%; height: 100%; object-fit: cover; }
.chip-file.uploading .chip-tile { background: var(--bg-sunk); }
.chip-text { min-width: 0; line-height: 1.3; }
.chip-text b, .chip-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-text b { font-weight: 600; font-size: 13.5px; }
.chip-text small { color: var(--muted); font-size: 12px; }
.chip-file button { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
                    background: var(--surface); opacity: 0; }
.chip-file:hover button, .chip-file button:focus-visible { opacity: 1; }
.dropzone { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; padding: 14px 10px;
            border: 1px dashed var(--line-strong); border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px;
            text-align: center; cursor: pointer; }
.dropzone[hidden] { display: none; }
.dropzone:hover, .drop > .dropzone { border-color: var(--focus); background: var(--bg-sunk); color: var(--ink); }
.msg-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; white-space: normal; }
.msg.user .msg-files .artifact { color: var(--ink); }
.queued-file { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; }
.step { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.step .icon { flex: none; color: var(--faint); margin-top: 1px; }
.step.completed { color: var(--muted); }
.step.completed .icon { color: #3fa37a; }
.step.in_progress { font-weight: 600; }
.step.in_progress .icon { color: var(--accent); }
a.btn { text-decoration: none; }
#authBody a.btn.primary { justify-content: center; height: 40px; }

/* Settings: sections on the left; each setting a row with its words on the left and its control on the right */
a.nav-item { text-decoration: none; }
.nav .settings-search { flex: none; width: auto; height: 34px; margin: 0 2px 10px; }
.settings { flex: 1; overflow: auto; padding: 28px 40px 48px; }
.settings-body { max-width: 760px; margin: 0 auto; }
.settings-title { font-family: var(--font-head); font-weight: 600; font-size: 24px; margin: 0 0 4px; }
.settings-lede { margin: 0 0 8px; color: var(--muted); max-width: 600px; }
.settings-group { margin-top: 26px; }
.settings-group h2 { margin: 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--muted);
                     font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.setting { display: flex; align-items: center; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.setting-text { flex: 1; min-width: 0; }
.setting-text b { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.setting-text small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.setting-control { display: flex; align-items: center; gap: 8px; flex: none; }
.setting-control .input { width: 220px; height: 34px; padding: 6px 10px; }
.setting.minted { display: block; }
.setting.block { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.setting-text .pill { font-weight: 700; }
.setting-text code { background: var(--bg-sunk); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.prompt-input { min-height: 200px; font-size: 13.5px; line-height: 1.55; }
.setting-actions { display: flex; align-items: center; gap: 8px; }
.settings-group .empty.small { padding: 14px 0; }
.settings-group .err { margin: 8px 0 0; }
.settings-group .err:empty { display: none; }

/* A top bar of plain text, a railed left column and nothing floating */
.app { display: flex; flex-direction: column; }
.appbar { flex: none; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 48px; }
.appbar .spacer { flex: 1; }
.wordmark { display: flex; align-items: center; gap: 8px; padding: 0; font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: 0; }
.mark { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ink-2); background: linear-gradient(90deg, var(--ink-2) 50%, transparent 50%); }
.slash { color: var(--line-strong); font-size: 20px; font-weight: 300; }
.appbar > .anchor { flex: none; }
.appbar .pop { top: 42px; left: 0; right: auto; width: 200px; z-index: 13; }
.profile { width: auto; font-size: 14px; color: var(--ink); }
.profile .icon { color: var(--faint); }
.avatar { width: 24px; height: 24px; border-radius: 6px; background: var(--line-strong); color: var(--ink); font-size: 10px; }
.profile:hover .avatar { background: var(--faint); }
.topnav { display: flex; align-items: center; gap: 24px; font-weight: 500; }
.topnav a, .topnav span { color: var(--muted); text-decoration: none; }
.topnav span { color: var(--faint); cursor: not-allowed; }
.topnav a:hover, .topnav a.active { color: var(--ink); }
.shell { flex: 1; min-height: 0; height: auto; padding: 0 48px; gap: 36px; }

.nav { border-right: 0; z-index: auto; }
.nav-content { padding: 12px 0 16px; gap: 0; }
.nav-title, .nav-group summary { height: auto; padding: 0 0 12px; color: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; border-radius: 0; }
.nav-group { margin-top: 22px; padding-top: 0; border-top: 0; }
.nav-group summary:hover { background: transparent; color: var(--ink-2); }
.nav-item { min-height: 34px; padding: 0 12px; border-left: 1px solid var(--line); border-radius: 0; color: var(--muted); }
.nav-item > .icon, .nav-item > .ldot { display: none; }
.nav-item:hover:not(:disabled) { background: transparent; color: var(--ink); }
.nav-item.active { background: transparent; color: var(--ink); font-weight: 500; box-shadow: inset 2px 0 0 var(--accent); border-left-color: transparent; }
.nav-item .n { color: var(--faint); font-weight: 500; }
.nav .settings-search { height: 32px; margin: 0 0 14px; border-radius: 8px; }

.layout { justify-content: flex-start; }
.column { max-width: none; }
.chat { max-width: 900px; margin: 0 auto; }
.page-head { padding: 12px 0 18px; }
.page-title { font-size: 18px; font-weight: 500; }
.page-head .search { border-radius: 8px; background: var(--bg-sunk); border-color: var(--line); }
.list { padding: 0 0 32px; }
.group-head { padding: 0; margin-top: 18px; }
.group-head:hover { background: transparent; }
.group-head .name { font-size: 13px; font-weight: 500; }
.count { background: transparent; color: var(--faint); }
.rows { border-top: 1px solid var(--line); }
.task { padding: 16px 0; border-bottom: 1px solid var(--line); }
.task:hover { background: transparent; }
.task:hover .task-title { color: var(--ink); }
.task-title { font-size: 14px; font-weight: 400; color: var(--ink-2); }
.chip { background: transparent; border-color: var(--line-strong); color: var(--muted); font-weight: 500; }

.btn { height: 36px; border-radius: 8px; font-weight: 500; }
.btn.primary { background: var(--primary); border-color: var(--primary-line); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-line); color: var(--primary-ink); }
.composer .send { border-radius: 8px; }
.pop { border-color: var(--line-strong); }

.contextual .nav { display: none; }
.contextual { gap: 0; }
.side { order: -1; align-self: stretch; width: 280px; max-height: none; margin: 0 36px 0 0; padding-top: 12px; border-radius: 0; background: transparent; }
.side-rest { border-radius: 0; }
.side section { padding: 0 0 24px; border-bottom: 0; }
.side h3 { color: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.side .empty.small { color: var(--faint); }
.split > .btn:first-child { border-radius: 8px 0 0 8px; }
.split > .btn.primary:nth-child(2) { border-radius: 0 8px 8px 0; border-left-color: var(--line-strong); margin-left: -1px; }
.artifact-row { color: var(--muted); }
.chat .post-head { padding: 12px 0 18px; border-bottom-color: var(--line); }
.transcript { padding: 24px 0; }
.composer { margin: 0 0 24px; border-radius: 12px; }
.status-line, .activity { padding-left: 0; padding-right: 0; }
.queue { margin: 0 0 8px; }
.detail { padding: 12px 0 48px; }
.detail-title { font-size: 20px; font-weight: 500; }
.detail-section h2 { font-size: 13px; font-weight: 500; }
.detail-section h2 .icon { display: none; }
.detail-section .rows-list { border-top: 1px solid var(--line); }
.row { border-radius: 0; border-bottom: 1px solid var(--line); }
.side .row { border-bottom: 0; border-radius: 8px; }
.row:hover { background: transparent; }
.dot.on, .status-dot { background: var(--accent); }
.step.completed .icon { color: var(--accent); }
.settings { padding: 12px 0 48px; }
.settings-body { max-width: none; margin: 0; }
.settings-title { font-size: 18px; font-weight: 500; }
.settings-group h2 { color: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.setting { border-bottom-color: var(--line); padding: 18px 0; }
.setting-text b { font-weight: 400; color: var(--ink-2); }
.pill.completed, .sign-in.success { background: var(--accent-soft); color: var(--accent-ink); }
.pill.denied, .pill.failed, .pill.timed_out, .sign-in.failed, .sign-in.timed_out, .sign-in.cancelled, .sign-in.denied { background: var(--bad-bg); color: var(--bad-ink); }
.viewer { border-left-color: var(--line); background: var(--bg); }
.thread-body.viewing .chat { flex: 0 1 520px; margin: 0 24px 0 0; }
.signin-card .brand { background: var(--line-strong); color: var(--ink); }
.segmented { gap: 0; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-sunk); }
.segmented button { height: 30px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 500; }
.segmented button:hover { color: var(--ink); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
