/*
  hearth, on the watr style (public/watr/watr.css, copied from watr.lol/styleguide).
  watr.css is all @layer, so everything here wins without !important.
  knobs: hue 50 is ember orange, a long way from watrfiles (196), watrlabs (237/232) and the socials (158).
  a touch louder and a touch flatter than the others.
*/
:root {
  --watr-hue: 50;
  --watr-chroma: 1.15;
  --watr-lift: 4px;
  --watr-head-weight: 700;
  --watr-sidebar-w: 270px;

  --side-w: var(--watr-sidebar-w);
  --line: var(--watr-field);
  --line-strong: var(--watr-field-over);
  --text-3: color-mix(in oklch, var(--watr-muted) 75%, var(--watr-page));
  --link: var(--watr-fill);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --hl-kw: #a8401f; --hl-str: #3f7a3a; --hl-num: #8a5a00; --hl-com: #7d7670; --hl-fn: #2f5f9c; --hl-type: #7a4a9c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --link: var(--watr-bright);
    --hl-kw: #f0937a; --hl-str: #a5d18f; --hl-num: #f0c070; --hl-com: #9a958f; --hl-fn: #8fbbef; --hl-type: #cfa6ea;
  }
}
:root[data-theme="dark"] {
  --link: var(--watr-bright);
  --hl-kw: #f0937a; --hl-str: #a5d18f; --hl-num: #f0c070; --hl-com: #9a958f; --hl-fn: #8fbbef; --hl-type: #cfa6ea;
}

/* generic resets live in a layer declared before watr.css (see index.html), so the kit's components beat them */
@layer hearth-reset {
  * { box-sizing: border-box; }
  button, input, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; background-color: transparent; border: 0; padding: 0; }
  button:disabled { cursor: default; opacity: .45; }
  a { text-decoration: none; }
  h1, h2, h3, p { margin: 0; }
}
html, body { height: 100%; margin: 0; }
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; }
#app { height: calc(100dvh - var(--watrhub-h, 0px)); /* the watr.lol bar (hub.js) sits above */ display: flex; flex-direction: column; }
h1, h2, h3 { margin: 0; font-weight: var(--watr-head-weight); }
[hidden] { display: none !important; }
/* everything moves at 0.2s, but not text that is streaming in */
.md *, pre, pre *, .composer textarea, .thinking-text { transition: none; }
.icon { display: inline-flex; flex: none; }
.logo { display: inline-flex; color: var(--watr-fill); flex: none; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--watr-muted); }
.small { font-size: 13px; }
.boot { height: 100vh; display: grid; place-items: center; color: var(--watr-muted); }

/* ---------- buttons & fields: square buttons, soft fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 0; font-weight: 600; white-space: nowrap;
  background: var(--watr-field); color: var(--watr-text); }
.btn:hover:not(:disabled) { background: var(--watr-field-over); }
.btn:active:not(:disabled) { transform: translate(1px, 1px); }
.btn.primary { background: var(--watr-fill); color: var(--watr-on-fill); }
.btn.primary:hover:not(:disabled) { background: var(--watr-fill-over); }
.btn.primary:disabled { background: var(--watr-deep); color: color-mix(in oklch, var(--watr-deep), white 60%); opacity: 1; }
.btn.danger { background: var(--watr-danger); color: #fff; }
.btn.danger:hover:not(:disabled) { background: color-mix(in oklch, var(--watr-danger), black 20%); }
.btn.ghost { background: none; color: var(--watr-muted); }
.btn.ghost:hover:not(:disabled) { background: var(--watr-field); color: var(--watr-text); }
.btn.small { padding: 6px 10px; font-size: 13.5px; }
.btn.block { width: 100%; }
a.btn { text-decoration: none; }
.btn.danger-text { color: var(--watr-danger); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; color: var(--watr-muted); flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--watr-field); color: var(--watr-text); }
.icon-btn.tiny { width: 28px; height: 28px; }
.icon-btn.bordered { background: var(--watr-field); color: var(--watr-text); }
.icon-btn.bordered:hover:not(:disabled) { background: var(--watr-field-over); }
.icon-btn.starred { color: var(--watr-fill); }
.icon-btn.starred svg { fill: currentColor; }
.mini-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--watr-muted); padding: 3px 7px; }
.mini-btn:hover { background: var(--watr-field); color: var(--watr-text); }
.link-btn { color: var(--watr-muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }
.link-btn:hover { color: var(--watr-text); }
.input { width: 100%; padding: 10px 12px; border: 0; border-radius: var(--watr-field-radius); background: var(--watr-field); }
.input:hover { background: var(--watr-field-over); }
.input.short { max-width: 200px; }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.badge, .watr-tag { margin-left: 8px; vertical-align: 1px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; line-height: 1.4; padding: 2px 7px; background: var(--watr-field); }
.spinner { width: 9px; height: 9px; flex: none; background: var(--watr-bright); box-shadow: 2px 2px 2px var(--watr-shadow-color); animation: hop .5s infinite alternate; }
@keyframes hop { to { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13.5px; font-weight: 600; }
.field-hint { font-size: 13px; color: var(--watr-muted); font-weight: 400; display: block; }
.form-sep { font-size: 13.5px; font-weight: 700; color: var(--watr-muted); border-top: 1px solid var(--line-strong); padding-top: 16px; }
.form-error { color: var(--watr-danger); font-size: 14px; font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; font-size: 13.5px; font-weight: 600; background: var(--watr-field); color: var(--watr-text); }
.chip:hover { background: var(--watr-field-over); }
.chip.on { background: var(--watr-fill); color: var(--watr-on-fill); }

/* ---------- the frame: bar on top, sidebar down the left, one L-shaped drop */
.topbar { flex: none; flex-wrap: nowrap; padding-right: 0; }
.topbar .watr-bar__home { gap: 10px; margin-right: auto; }
.topbar .home-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .watr-bar__group { padding-inline: 10px; }
.topbar:has(+ .shell:not(.side-closed)) { box-shadow: none; }
.shell { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.shell.with-panel { grid-template-columns: var(--side-w) minmax(0, 1fr) minmax(0, 1fr); }
.shell.side-closed { grid-template-columns: 0 minmax(0, 1fr); }
.shell.side-closed.with-panel { grid-template-columns: 0 minmax(0, 1fr) minmax(0, 1.1fr); }
/* the drop of the L, drawn from its inside corner so the bar and sidebar arms join */
.shell::before { content: ""; position: absolute; top: 0; left: var(--side-w); right: 0; bottom: 0; z-index: 4; pointer-events: none; box-shadow: inset var(--watr-drop); }
.shell.side-closed::before { display: none; }
.sidebar { background: var(--watr-surface); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.shell.side-closed .sidebar { visibility: hidden; }
.scrim { display: none; }
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.strips { flex: none; }
.strips:empty { display: none; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

.side-nav { display: flex; flex-direction: column; padding: 14px 0 6px; }
.nav-item { display: flex; align-items: center; gap: 16px; min-height: 42px; padding: 0 20px; font-weight: 500; color: var(--watr-text); }
.nav-item:hover { background: var(--watr-field); }
.nav-item[aria-current="page"] { font-weight: 700; background: var(--watr-fill); color: var(--watr-on-fill); }
.nav-item[aria-current="page"]:hover { background: var(--watr-fill-over); }
.side-list { flex: 1; overflow-y: auto; padding: 0 0 12px; }
.side-label { font-size: .8rem; font-weight: 600; color: var(--watr-muted); padding: 16px 20px 4px; }
.side-empty { color: var(--watr-muted); font-size: 13.5px; padding: 16px 20px; }
.conv-item { position: relative; display: flex; align-items: center; }
.conv-item:hover { background: var(--watr-field); }
.conv-item.active { background: var(--watr-fill); color: var(--watr-on-fill); }
.conv-link { flex: 1; min-width: 0; padding: 8px 6px 8px 20px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.active .conv-link { font-weight: 600; }
.conv-more { width: 28px; height: 28px; margin-right: 8px; opacity: 0; color: inherit; }
.conv-item.active .conv-more:hover { background: rgb(0 0 0 / .15); color: inherit; }
.conv-item:hover .conv-more, .conv-more:focus-visible { opacity: 1; }
.dot { width: 7px; height: 7px; background: var(--watr-bright); margin-right: 6px; flex: none; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.side-foot { display: flex; flex-direction: column; gap: 12px; padding: 14px 20px 12px; border-top: 1px solid var(--line-strong); }
.side-usage { display: flex; flex-direction: column; gap: 10px; }
.side-usage:empty { display: none; }
.meter { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.meter-line { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.meter-line .muted { font-weight: 500; font-variant-numeric: tabular-nums; }
progress.watr-progress { height: 8px; display: block; }
progress.watr-progress.full::-webkit-progress-value { background-color: var(--watr-danger); }
progress.watr-progress.full::-moz-progress-bar { background-color: var(--watr-danger); }
.user-btn { display: flex; align-items: center; gap: 10px; margin: 0 -8px; padding: 6px 8px; text-align: left; }
.user-btn:hover { background: var(--watr-field); }
.user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.user-btn .watr-tag { margin: 0; }

.page-head { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 24px; flex: none; }
.page-head h1 { font-size: 1.35rem; }
.page { flex: 1; overflow-y: auto; padding: 8px 24px 60px; width: 100%; max-width: 920px; margin: 0 auto; }
.empty { text-align: center; padding: 72px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty h2 { font-size: 1.5rem; }
.empty p { max-width: 46ch; }
.empty.small { padding: 36px 16px; color: var(--watr-muted); gap: 4px; }
.state { padding: 56px 0; }
.state-words { display: flex; flex-direction: column; gap: 10px; max-width: 42ch; }
.state-words h2 { font-size: 1.6rem; }
.state-words .watr-row { margin-top: 8px; gap: 6px; }

/* ---------- chat */
.title-btn { display: inline-flex; align-items: center; gap: 6px; max-width: min(52vw, 520px); padding: 6px 10px; margin-left: -10px; font-weight: 700; }
.title-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn:hover { background: var(--watr-field); }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--watr-muted); font-size: 14px; font-weight: 600; padding: 6px 8px; }
.crumb:hover { background: var(--watr-field); color: var(--watr-text); }
.crumb-sep { color: var(--text-3); }
.home { flex: 1; overflow-y: auto; display: flex; padding: 24px 20px; }
.home-inner { margin: auto; width: 100%; max-width: 720px; display: flex; flex-direction: column; align-items: center; gap: 22px; padding-bottom: 8vh; }
.home-mark { display: grid; place-items: center; }
.greeting { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; font-weight: 800; letter-spacing: -.01em; text-align: center; text-wrap: balance; margin-top: -10px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.project-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 12px; background: var(--watr-panel); font-size: 13.5px; }
.project-chip .icon-btn { width: 24px; height: 24px; }
.scroller { flex: 1; overflow-y: auto; min-height: 0; }
.thread { max-width: 780px; margin: 0 auto; padding: 16px 24px 40px; display: flex; flex-direction: column; gap: 20px; }
.composer-dock { flex: none; padding: 0 20px 10px; max-width: 820px; width: 100%; margin: 0 auto; }
.fineprint { text-align: center; font-size: 12px; color: var(--text-3); padding-top: 8px; }

.composer { width: 100%; background: var(--watr-surface); padding: 12px 12px 10px; box-shadow: var(--watr-drop); }
.composer:focus-within { box-shadow: var(--watr-drop), inset 0 calc(var(--watr-rule-w) * -1) 0 var(--watr-bright); }
.composer.drag { outline: 2px dashed var(--watr-bright); outline-offset: -6px; }
.queue-state { display: flex; align-items: center; gap: 8px; padding: 2px 6px 10px; font-size: 13px; color: var(--watr-muted); }
.queue-state .spinner { flex: none; }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; resize: none; background: transparent; padding: 4px 6px 10px; line-height: 1.5; font-size: 16px; max-height: 40vh; border-radius: 0; }
.composer textarea:hover { background: transparent; }
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 6px; }
.flags { display: flex; gap: 5px; min-width: 0; overflow: hidden; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; background: var(--watr-panel); padding: 4px 8px; white-space: nowrap; }
.flag .icon { color: var(--watr-fill); }
.model-btn { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; font-size: 14px; font-weight: 600; color: var(--watr-muted); max-width: 46%; }
.model-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-btn:hover { background: var(--watr-field); color: var(--watr-text); }
.send { display: grid; place-items: center; width: 36px; height: 36px; background: var(--watr-fill); color: var(--watr-on-fill); flex: none; }
.send:hover:not(:disabled) { background: var(--watr-fill-over); }
.send:active:not(:disabled) { transform: translate(1px, 1px); }
.send:disabled { background: var(--watr-deep); color: color-mix(in oklch, var(--watr-deep), white 60%); opacity: 1; }
.send.stop { background: var(--watr-text); color: var(--watr-page); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; }
.composer .atts { padding: 2px 4px 10px; }
.att { position: relative; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 9px; background: var(--watr-page); max-width: 240px; box-shadow: 2px 2px 2px var(--watr-shadow-color); }
.att.img { padding: 0; }
.att.img img { display: block; width: 84px; height: 84px; object-fit: cover; }
.att-icon { display: grid; place-items: center; width: 34px; height: 34px; background: var(--watr-field); color: var(--watr-muted); flex: none; }
.att-meta { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { font-size: 12px; color: var(--text-3); }
.att-x { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--watr-text); color: var(--watr-page); }
.att.img .att-x { top: 4px; right: 4px; }

.msg { display: flex; flex-direction: column; min-width: 0; }
.msg.user { align-items: flex-end; gap: 6px; }
.bubble { background: var(--watr-panel); padding: 10px 16px; max-width: min(85%, 620px); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.msg-actions { display: flex; align-items: center; gap: 2px; min-height: 28px; color: var(--text-3); opacity: 0; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg.assistant:last-child .msg-actions, .msg-actions:has(.branch) { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }
.model-tag { font-size: 12px; font-weight: 600; margin-left: 8px; }
.branch { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; color: var(--watr-muted); font-variant-numeric: tabular-nums; }
.edit-box { width: 100%; background: var(--watr-surface); padding: 12px; box-shadow: var(--watr-drop); }
.edit-area { width: 100%; border: 0; outline: 0; resize: none; background: transparent; line-height: 1.55; font-size: 15px; padding: 0; }
.edit-area:hover { background: transparent; }
.edit-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.waiting { height: 30px; display: flex; align-items: center; padding-left: 2px; }
.note { font-size: 13px; color: var(--text-3); }
.notice { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--watr-muted); }
.error-box { padding: 10px 12px; background: var(--watr-surface); border-left: var(--watr-rule-w) solid var(--watr-danger); font-size: 14px; overflow-wrap: anywhere; }
.watr-msg { font-size: 14px; overflow-wrap: anywhere; }

/* ---------- markdown */
.md { font-size: 15.5px; line-height: 1.7; overflow-wrap: anywhere; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md .codeblock, .md .table-wrap, .md .artifact-card { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { font-weight: var(--watr-head-weight); line-height: 1.3; margin: 26px 0 10px; }
.md h1 { font-size: 1.45em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.1em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.5em; }
.md li { margin: 4px 0; }
.md li > p { margin-bottom: 6px; }
.md li::marker { color: var(--watr-fill); }
.md a { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.md blockquote { border-left: var(--watr-rule-w) solid var(--line-strong); padding-left: 14px; color: var(--watr-muted); }
.md hr { border: 0; border-top: var(--watr-waterline-w) solid var(--watr-waterline); margin: 22px 0; }
.md img { max-width: 100%; }
.md code { font: .86em var(--mono); background: var(--watr-field); padding: 1.5px 5px; border-radius: var(--watr-field-radius); }
.md pre code, pre code { background: none; padding: 0; font-size: 13px; border-radius: 0; }
pre { margin: 0; font: 13px/1.55 var(--mono); overflow-x: auto; padding: 12px 14px; tab-size: 4; }
.codeblock { background: var(--watr-surface); overflow: hidden; line-height: 1.5; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; font-size: 12.5px; font-weight: 600; color: var(--watr-muted); border-bottom: 1px solid var(--line-strong); }
.code-actions { display: flex; gap: 2px; }
.table-wrap { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; line-height: 1.45; min-width: 50%; }
.md th, .md td { padding: 8px 12px; text-align: left; vertical-align: top; }
.md th { font-weight: 600; color: var(--watr-muted); box-shadow: inset 0 calc(var(--watr-waterline-w) * -1) 0 var(--watr-waterline); }
.md tbody tr + tr { border-top: 1px solid var(--line); }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-tag .hljs-name, .hljs-meta .hljs-keyword { color: var(--hl-kw); }
.hljs-string, .hljs-regexp, .hljs-attr-value, .hljs-addition, .hljs-symbol { color: var(--hl-str); }
.hljs-number, .hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--hl-num); }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--hl-com); font-style: italic; }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-selector-id, .hljs-selector-class { color: var(--hl-fn); }
.hljs-built_in, .hljs-type, .hljs-class .hljs-title, .hljs-params .hljs-type { color: var(--hl-type); }
.hljs-deletion { color: var(--watr-danger); }

/* ---------- thinking, tools, artifacts */
.thinking { background: var(--watr-surface); font-size: 14px; }
.thinking summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; color: var(--watr-muted); font-weight: 600; list-style: none; user-select: none; }
.thinking summary:hover { background: var(--watr-field); color: var(--watr-text); }
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary .icon:first-child { color: var(--watr-fill); }
.thinking summary .icon:last-child { margin-left: auto; }
.thinking[open] summary .icon:last-child, .tool.open .tool-head > .icon:last-child { transform: rotate(180deg); }
.thinking-text { padding: 2px 14px 12px 36px; color: var(--watr-muted); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; max-height: 360px; overflow-y: auto; }
.shimmer { background: linear-gradient(90deg, var(--watr-muted) 30%, var(--watr-text) 50%, var(--watr-muted) 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.tool-group { display: flex; flex-direction: column; gap: 8px; }
.tool { background: var(--watr-surface); overflow: hidden; }
.tool.error { border-left: var(--watr-rule-w) solid var(--watr-danger); }
.tool-head { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 12px; font-size: 14px; color: var(--watr-muted); text-align: left; }
.tool-head:hover { background: var(--watr-field); }
.tool-icon { color: var(--watr-fill); display: inline-flex; }
.tool-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--watr-text); }
.tool-flag { font-size: .72rem; font-weight: 700; padding: 1px 6px; background: var(--watr-danger); color: #fff; }
.tool-body { display: none; border-top: 1px solid var(--line-strong); }
.tool.open .tool-body { display: block; }
.tool-sec + .tool-sec { border-top: 1px solid var(--line-strong); }
.tool-sec-label { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--watr-muted); padding: 8px 8px 0 14px; min-height: 28px; }
.tool-sec pre { max-height: 340px; overflow: auto; padding-top: 6px; }
pre.output { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--watr-muted); }
.tool-images { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-images img { display: block; max-width: 100%; max-height: 460px; background: #fff; box-shadow: var(--watr-drop); }
.tool-files { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-query { font-weight: 400; color: var(--watr-muted); margin-left: .4em; }
.tool-count { font-size: .75rem; font-weight: 700; padding: 1px 6px; background: var(--watr-field); color: var(--watr-muted); white-space: nowrap; }
.sources { list-style: none; margin: 0; padding: 6px 0; counter-reset: src; }
.sources li { counter-increment: src; display: grid; grid-template-columns: 2.2em 1fr; padding: 5px 14px 5px 6px; font-size: 14px; line-height: 1.35; }
.sources li::before { content: counter(src); grid-row: span 2; color: var(--watr-muted); font-size: 12.5px; font-weight: 700; text-align: right; padding: 1px .7em 0 0; }
.sources a { color: var(--link); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a:hover { text-decoration: underline; }
.sources .muted { font-size: 12.5px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 0; font-size: 13.5px; background: var(--watr-field); max-width: 100%; vertical-align: middle; line-height: 1.4; }
.chip-main { display: inline-flex; align-items: center; gap: 7px; padding: 6px 4px 6px 11px; min-width: 0; font-weight: 600; color: var(--watr-text) !important; text-decoration: none !important; }
.chip-main span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-main:hover { color: var(--link) !important; }
.chip-dl { display: inline-grid; place-items: center; width: 26px; height: 26px; color: var(--watr-muted) !important; }
.chip-dl:hover { background: var(--watr-field-over); color: var(--watr-text) !important; }
.file-bar { padding: 8px 10px; border-bottom: 1px solid var(--line-strong); flex: none; }
.artifact-card { display: flex; align-items: center; gap: 12px; width: min(100%, 440px); padding: 10px 14px 10px 10px; background: var(--watr-surface); box-shadow: var(--watr-drop); text-align: left; line-height: 1.4; }
.artifact-card:hover { background: var(--watr-field); }
.artifact-card:active { transform: translate(1px, 1px); }
.artifact-icon { display: grid; place-items: center; width: 44px; height: 44px; background: var(--watr-fill); color: var(--watr-on-fill); flex: none; }
.artifact-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.artifact-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-sub { font-size: 13px; color: var(--watr-muted); }

/* ---------- side panel: the thing on the right, past the waterline */
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--watr-page); border-left: var(--watr-waterline-w) solid var(--watr-waterline); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; background: var(--watr-surface); min-height: var(--watr-bar-h); flex: none; }
.panel-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.panel-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.preview { flex: 1; width: 100%; border: 0; background: #fff; }
.panel-code { flex: 1; margin: 0; overflow: auto; background: var(--watr-page); min-height: 0; }
.panel-doc { padding: 24px 28px; }
.seg { display: inline-flex; gap: 2px; margin-right: 4px; }
.seg button { padding: 5px 11px; font-size: 13px; font-weight: 600; background: var(--watr-field); }
.seg button:hover:not(:disabled) { background: var(--watr-field-over); }
.seg button.on { background: var(--watr-fill); color: var(--watr-on-fill); }
.panel-body.files { overflow: hidden; }
.file-list { max-height: 42%; overflow-y: auto; padding: 6px 0; border-bottom: 1px solid var(--line-strong); flex: none; }
.file-row { display: flex; align-items: center; padding-right: 6px; }
.file-row:hover { background: var(--watr-field); }
.file-row.active { background: var(--watr-fill); color: var(--watr-on-fill); }
.file-row.active .muted, .file-row.active .icon-btn { color: inherit; }
.file-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 7px 14px; font-size: 14px; text-align: left; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-view { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.file-view img { max-width: 100%; margin: auto; display: block; padding: 12px; }
.file-view .note { padding: 10px 14px; }

/* ---------- lists, cards, project */
.search { margin-bottom: 14px; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 10px; }
.row-main:hover { background: var(--watr-field); }
.row-title { display: flex; align-items: center; gap: 6px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title .icon { color: var(--watr-fill); }
.row-sub { font-size: 13px; color: var(--text-3); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 18px; min-height: 130px; background: var(--watr-surface); box-shadow: var(--watr-drop); }
.card:hover { box-shadow: var(--watr-drop-big); transform: translate(-1px, -1px); }
.card h3 { font-size: 1.05rem; }
.card p { font-size: 14px; flex: 1; }
.card-foot { font-size: 12.5px; color: var(--text-3); }
.page.project { max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 32px; align-content: start; }
.project-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.project-main h1 { font-size: 1.9rem; }
.project-main .crumb { align-self: flex-start; margin-left: -8px; }
.start-chat { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--watr-surface); color: var(--watr-muted); font-weight: 600; box-shadow: var(--watr-drop); margin: 8px 0; }
.start-chat:hover { color: var(--watr-text); background: var(--watr-field); }
.project-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.box { background: var(--watr-surface); box-shadow: var(--watr-drop); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.box > h3 { font-size: 1rem; }
.box-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.box-head h3 { font-size: 1rem; flex: 1; }
.kfiles { display: flex; flex-direction: column; gap: 2px; }
.kfile { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; }

/* ---------- admin */
.page:has(.admin-tabs) { max-width: 1120px; }
.admin-tabs { margin-bottom: 22px; }
.admin-body { display: flex; flex-direction: column; gap: 20px; }
.admin-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-intro h2 { font-size: 1.35rem; margin-bottom: 4px; }
.admin-intro p { max-width: 70ch; font-size: 14.5px; }
.provider.off .table-wrap { opacity: .5; }
.provider h3 { display: inline-flex; align-items: center; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--watr-muted); padding: 6px 8px; white-space: nowrap; box-shadow: inset 0 calc(var(--watr-waterline-w) * -1) 0 var(--watr-waterline); }
.grid td { padding: 8px; vertical-align: middle; white-space: nowrap; }
.grid tbody tr + tr { border-top: 1px solid var(--line-strong); }
.grid tbody tr:hover { background: var(--watr-field); }
.grid tr.off .grow-cell { opacity: .5; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.num .muted { font-size: 12.5px; }
.grow-cell { width: 100%; min-width: 200px; }
.grow-cell .watr-tag { margin-left: 8px; }
.grid td.actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.cell-input { width: 100%; background: transparent; padding: 4px 6px; margin-left: -6px; font-weight: 600; }
.cell-input:hover, .cell-input:focus { background: var(--watr-field); }
.cell-input.num { width: 92px; font-weight: 400; margin: 0; background: var(--watr-field); }
.cell-input.num:hover { background: var(--watr-field-over); }
.cell-sub { font-size: 12.5px; color: var(--text-3); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; }
.cell-select { padding: 5px 6px; }
.watr-check { font-size: 13.5px; color: var(--watr-muted); }
.watr-check input { width: 18px; height: 18px; }
.watr-switch > span:empty { display: none; }
.toggle-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.toggle-row .watr-switch { margin-top: 2px; }
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-dot { width: 10px; height: 10px; background: var(--watr-danger); }
.status.ok .status-dot { background: var(--watr-bright); }
.status.bad { border-left: var(--watr-rule-w) solid var(--watr-danger); }

/* ---------- overlays: menus, dialogs, toasts */
#layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#layer > * { pointer-events: auto; }
#layer > .watr-toasts { pointer-events: none; }
.menu { position: fixed; min-width: 190px; max-width: min(340px, calc(100vw - 16px)); max-height: min(440px, calc(100vh - 16px)); overflow-y: auto; background: var(--watr-surface); box-shadow: var(--watr-drop); padding: 5px 0; z-index: 60; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; text-align: left; font-size: 14px; }
.menu-item:hover { background: var(--watr-field); }
.menu-item.danger { color: var(--watr-danger); }
.menu-item.danger:hover { background: var(--watr-danger); color: #fff; }
.menu-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-hint { font-size: 12.5px; color: var(--watr-muted); overflow: hidden; text-overflow: ellipsis; }
.menu-sep { height: 1px; background: var(--line-strong); margin: 5px 0; }
.menu-title { font-size: 12.5px; font-weight: 700; color: var(--watr-muted); padding: 6px 14px 2px; }
.modal-wrap { position: fixed; inset: 0; background: rgb(0 0 0 / .4); display: grid; place-items: center; padding: 16px; z-index: 55; animation: fade var(--watr-speed); }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--watr-page); box-shadow: var(--watr-drop-big); animation: drop-in var(--watr-speed) ease-out; }
.modal.wide { width: min(680px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--watr-bar-h); padding: 0 10px 0 16px; background: var(--watr-bar); color: var(--watr-on-bar); flex: none; }
.modal.danger .modal-head { background: var(--watr-danger); color: #fff; }
.modal-head h2 { font-size: 1rem; }
.modal-close { font-size: 1.4rem; line-height: 1; padding: 0 6px; color: inherit; }
.modal-body { padding: 20px; overflow-y: auto; line-height: 1.5; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; padding: 0 20px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes drop-in { from { opacity: 0; transform: translate(calc(var(--watr-lift) * -2), calc(var(--watr-lift) * -2)); } }
.watr-toast p { overflow-wrap: anywhere; }

/* ---------- sign in: the split, words on the left, the form past the waterline */
.auth { flex: 1; min-height: calc(100dvh - var(--watrhub-h, 0px)); padding: 32px 20px; overflow-y: auto; }
.auth-aside { max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.auth-aside h1 { font-size: 2.2rem; font-weight: 800; margin: 0; }
.auth-aside .watr-quote { margin-top: 18px; font-size: 14px; color: var(--watr-muted); }
.auth-aside .watr-quote p { margin: 0; }
.auth-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-card h2 { font-size: 1.35rem; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .shell.with-panel { grid-template-columns: var(--side-w) 0 minmax(0, 1fr); }
  .shell.with-panel .main-col { visibility: hidden; }
  .shell.side-closed.with-panel { grid-template-columns: 0 minmax(0, 1fr) minmax(0, 1fr); }
  .shell.side-closed.with-panel .main-col { visibility: visible; }
}
@media (max-width: 860px) {
  .shell, .shell.side-closed, .shell.with-panel, .shell.side-closed.with-panel { grid-template-columns: minmax(0, 1fr); }
  .shell::before { display: none; }
  .topbar, .topbar:has(+ .shell:not(.side-closed)) { box-shadow: var(--watr-drop); }
  .shell.with-panel .main-col { visibility: visible; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; visibility: visible !important; box-shadow: var(--watr-drop-big); }
  .shell.side-closed .sidebar { transform: translateX(-105%); box-shadow: none; }
  .shell:not(.side-closed) .scrim { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 25; }
  .panel { position: fixed; inset: 0; z-index: 20; border-left: 0; }
  .thread { padding: 8px 16px 32px; }
  .composer-dock { padding: 0 10px 8px; }
  .page, .page-head { padding-inline: 16px; }
  .page.project { grid-template-columns: minmax(0, 1fr); }
  .hide-narrow { display: none; }
  .two { grid-template-columns: 1fr; }
  .flags .flag { font-size: 0; gap: 0; padding: 5px 7px; }
  .conv-more { opacity: 1; }
  .md { font-size: 15px; }
}
@media (max-width: 600px) {
  .topbar .home-name { display: none; }
  .auth.watr-split { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .auth-aside { max-width: none; }
  .auth-aside .watr-quote { display: none; }
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }

/* Math (KaTeX) */
.math-block { overflow-x: auto; overflow-y: hidden; margin: 0.8em 0; padding: 2px 0; }
.math-block .katex-display { margin: 0; }
.katex { font-size: 1.08em; }

/* Ember, the mascot */
.ember svg { display: block; overflow: visible; image-rendering: pixelated; }
.ember--alive .ember-bob { animation: ember-bob 2.4s steps(2, jump-none) infinite; }
.ember--alive .ember-tip { animation: ember-flicker 0.9s steps(1) infinite; }
.ember--alive .ember-eye { transform-origin: 0 8.5px; transform-box: view-box; animation: ember-blink 4.8s steps(1) infinite; }
.ember--alive:hover .ember-bob { animation-duration: 0.5s; }
@keyframes ember-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.5px); } }
@keyframes ember-flicker { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(0.5px, -0.5px); } 66% { transform: translate(-0.5px, 0); } }
@keyframes ember-blink { 0%, 94%, 100% { transform: scaleY(1); } 95%, 97% { transform: scaleY(0.15); } }
@media (prefers-reduced-motion: reduce) { .ember--alive * { animation: none !important; } }

/* Model-written suggestions fade in when they arrive */
.suggest.is-loading .chip { opacity: 0.55; }
.suggest.is-fresh .chip { animation: suggest-in 0.35s ease-out both; }
.suggest.is-fresh .chip:nth-child(2) { animation-delay: 0.05s; }
.suggest.is-fresh .chip:nth-child(3) { animation-delay: 0.1s; }
.suggest.is-fresh .chip:nth-child(4) { animation-delay: 0.15s; }
@keyframes suggest-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .suggest.is-fresh .chip { animation: none; } }

/* Terminal sign-in (/cli) */
.cli-page { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.cli-code { font: 600 2rem/1.2 var(--mono); letter-spacing: 0.12em; padding: 12px 0; }
.cli-cmd { background: var(--watr-sunken, rgba(127,127,127,.08)); white-space: pre-wrap; overflow-wrap: anywhere; }
.cli-done { align-items: flex-start; }
