/* Wally. Direction: a warm, quiet writing desk (brief 13h: the Claude app's calm, in Wally's own name and mark).
   Job: talk to your assistant fast, from a phone, and see what it did.
   Character: warm ivory paper by day, warm charcoal by night, one coral accent spent on the send button,
   the new-chat mark, Mac mode and focus. A bookish serif (Wally Serif, Source Serif 4 under the OFL) for the
   greeting, titles and headings; the system sans for everything you read fast.
   References: the Claude app (sidebar of chats a shade darker than the page, centered reading column,
   a plain rounded composer), Linear's agent panel (a collapsed "worked for" block),
   Apple Messages (safe areas, keyboard behaviour). */

@font-face { font-family: "Wally Serif"; src: url("/fonts/wally-serif.woff2") format("woff2");
  font-weight: 400 650; font-style: normal; font-display: swap; }
:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --serif: "Wally Serif", ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --r-sm: 8px; --r: 12px; --r-lg: 20px;
  --bg: #262624; --sidebar: #1f1e1d; --surface: #30302e; --raised: #3a3a37; --raised-2: #4a4945;
  --line: rgba(240,238,230,.09); --line-2: rgba(240,238,230,.16);
  --text: #f4f3ee; --muted: #c2bfb5; --faint: #a9a69c;
  --accent: #ba5733; --accent-ink: #eb9472; --on-accent: #ffffff;
  --danger: #ff8095; --danger-bg: rgba(255,110,135,.12);
  --scrim: rgba(12,11,10,.55); --shadow: 0 10px 40px rgba(0,0,0,.45);
  --code-bg: #1f1e1d;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #faf9f5; --sidebar: #f3f1ea; --surface: #ffffff; --raised: #ecebe3; --raised-2: #e0ddd2;
  --line: rgba(31,30,29,.09); --line-2: rgba(31,30,29,.16);
  --text: #1f1e1d; --muted: #5f5d57; --faint: #6b6963;
  --accent: #ba5733; --accent-ink: #a8482a; --on-accent: #ffffff;
  --danger: #b8203a; --danger-bg: rgba(184,32,58,.08);
  --scrim: rgba(31,30,29,.35); --shadow: 0 10px 40px rgba(60,45,30,.14);
  --code-bg: #f3f1ea;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf9f5; --sidebar: #f3f1ea; --surface: #ffffff; --raised: #ecebe3; --raised-2: #e0ddd2;
    --line: rgba(31,30,29,.09); --line-2: rgba(31,30,29,.16);
    --text: #1f1e1d; --muted: #5f5d57; --faint: #6b6963;
    --accent: #ba5733; --accent-ink: #a8482a; --on-accent: #ffffff;
    --danger: #b8203a; --danger-bg: rgba(184,32,58,.08);
    --scrim: rgba(31,30,29,.35); --shadow: 0 10px 40px rgba(60,45,30,.14);
    --code-bg: #f3f1ea;
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------- shell ---------- */
#app { height: var(--app-h, 100dvh); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; width: 100%; }
.main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; position: relative; }

.topbar { display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px; min-height: calc(52px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 5; }
.iconbtn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--text); }
.iconbtn:active { background: var(--raised); }
@media (hover: hover) { .iconbtn:hover { background: var(--raised); } }
.title { flex: 1; min-width: 0; text-align: center; padding: 6px 8px; border-radius: 10px; }
.title b { display: block; font: 600 16px/1.2 var(--sans); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; min-height: 15px; }
.title small .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-ink); margin-right: 5px; vertical-align: 1px; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0 auto 0 0; width: min(86vw, 340px); background: var(--surface); border-right: 1px solid var(--line); z-index: 30;
  transform: translateX(-102%); transition: transform .38s var(--ease); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.drawer.open { transform: none; box-shadow: var(--shadow); }
.scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 20; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 19px/1 var(--serif); letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.newchat { display: flex; align-items: center; gap: 10px; margin: 6px 12px 10px; padding: 11px 12px; border-radius: 12px; background: var(--raised); font-weight: 500; min-height: 44px; }
.newchat svg { color: var(--accent-ink); }
.chatlist { flex: 1; overflow-y: auto; padding: 0 8px 12px; overscroll-behavior: contain; }
.chatlist .label { font-size: 12px; color: var(--muted); padding: 10px 10px 6px; }
.chatrow { display: flex; align-items: center; border-radius: 12px; min-height: 52px; position: relative; }
.chatrow .open { flex: 1; min-width: 0; text-align: left; padding: 8px 4px 8px 10px; border-radius: 12px; }
.chatrow .t { display: block; font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.005em; }
.chatrow .p { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatrow.active { background: var(--raised); }
.chatrow.active::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--accent-ink); }
.chatrow .more { width: 40px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 10px; flex: none; }
@media (hover: hover) { .chatrow:hover { background: var(--raised); } }
.drawer-foot { border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.footbtn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 12px; min-height: 48px; text-align: left; }
.footbtn:active { background: var(--raised); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--raised-2); display: grid; place-items: center; font: 600 13px var(--sans); }
.footbtn span.sub { display: block; font-size: 12px; color: var(--muted); }

@media (min-width: 900px) {
  #app { grid-template-columns: 300px minmax(0, 1fr); }
  .drawer { position: static; transform: none; width: auto; box-shadow: none; z-index: 1; }
  .scrim { display: none; }
  #btn-menu, #btn-close-drawer { display: none; }
  .topbar { padding-left: 16px; }
  .title { text-align: left; padding-left: 4px; }
}

/* ---------- messages ---------- */
.scroller { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-behavior: auto; position: relative; }
.thread { max-width: 760px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 22px; min-height: 100%; }
.msg.user { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bubble { background: var(--raised); border-radius: 20px 20px 6px 20px; padding: 10px 15px; font-size: 16px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user.failed .bubble { box-shadow: inset 0 0 0 1px var(--danger); }
.mstate { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; padding-right: 4px; }
.mstate.bad { color: var(--danger); }
.mstate button { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 28px; }
.mstate .spin { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--muted); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.atts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.att-img { width: 104px; height: 104px; border-radius: 14px; object-fit: cover; display: block; background: var(--raised-2); border: 1px solid var(--line); }
.msg.user .atts + .bubble { margin-top: 0; }
.att-file { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--raised); font-size: 13.5px; max-width: 240px; }
.att-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg.assistant { max-width: 100%; }
.prose { font-size: 16.5px; line-height: 1.58; overflow-wrap: anywhere; letter-spacing: -.003em; }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose p { margin: .65em 0; }
.prose h2, .prose h3, .prose h4, .prose h5 { font-family: var(--sans); letter-spacing: -.015em; line-height: 1.25; margin: 1.3em 0 .4em; }
.prose h2 { font-size: 1.28em; font-weight: 650; } .prose h3 { font-size: 1.12em; font-weight: 650; } .prose h4, .prose h5 { font-size: 1em; font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.3em; margin: .6em 0; } .prose li { margin: .25em 0; padding-left: .15em; }
.prose li::marker { color: var(--faint); }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.prose a:hover { text-decoration-color: var(--accent-ink); }
.prose code { font: 500 .88em var(--mono); background: var(--raised); padding: .12em .38em; border-radius: 6px; }
.prose pre { position: relative; margin: .9em 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.55; white-space: pre; display: block; }
.prose pre .codehead { position: sticky; left: 0; display: flex; justify-content: space-between; align-items: center; margin: -6px 0 6px; font: 12px var(--sans); color: var(--muted); }
.prose pre .copy { color: var(--muted); font-size: 12.5px; padding: 4px 8px; border-radius: 8px; min-height: 28px; }
.prose pre .copy:active { background: var(--raised); }
.prose blockquote { margin: .8em 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--line-2); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.tablewrap { overflow-x: auto; margin: .9em 0; border: 1px solid var(--line); border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.prose th { font-weight: 600; color: var(--muted); font-size: 13px; } .prose tr:last-child td { border-bottom: 0; }

.note { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; margin: 4px 0; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.prose.caret > :last-child::after, .caret:empty::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-ink); margin-left: 6px; vertical-align: 1px; animation: pulse 1.2s ease-in-out infinite; }

.mfoot { display: flex; align-items: center; gap: 2px; margin: 8px 0 0 -8px; color: var(--muted); }
.mfoot .iconbtn { width: 38px; height: 34px; border-radius: 10px; }
.mfoot svg { width: 18px; height: 18px; }
.mfoot .tag { font-size: 12.5px; padding: 0 8px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sources a { font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; text-decoration: none; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.errbox { margin: 8px 0; padding: 12px 14px; border-radius: 14px; background: var(--danger-bg); color: var(--text); font-size: 15px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.errbox b { color: var(--danger); font-weight: 600; }
.errbox button, .btn { min-height: 38px; padding: 0 16px; border-radius: 12px; background: var(--raised); font-weight: 600; font-size: 14.5px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); }
.btn.danger { background: var(--danger); color: #fff; }

/* Mac task block */
.steps { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.steps-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: 48px; text-align: left; }
.steps-head .t { font-weight: 600; font-size: 14.5px; }
.steps-head .c { color: var(--muted); font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }
.steps-head svg { width: 16px; height: 16px; color: var(--muted); transition: transform .25s var(--ease); }
.steps.open .steps-head svg.chev { transform: rotate(90deg); }
.steps-body { display: none; border-top: 1px solid var(--line); }
.steps.open .steps-body { display: block; }
.steps ol { list-style: none; margin: 0; padding: 6px 0; }
.steps li { display: flex; gap: 12px; padding: 7px 14px; font-size: 14.5px; align-items: baseline; }
.steps li .n { color: var(--faint); font-size: 12.5px; width: 16px; text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.steps li.err { color: var(--danger); }
.steps li.ask .n { color: var(--accent-ink); }
.shotbtn { display: block; width: calc(100% - 28px); margin: 4px 14px 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--raised); }
.shotbtn img { display: block; width: 100%; height: auto; }
.confirm { margin: 10px 0; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.confirm .q { font-size: 15.5px; line-height: 1.45; margin: 0 0 14px; }
.confirm .lbl { font-size: 12.5px; color: var(--accent-ink); font-weight: 600; margin-bottom: 6px; }
.confirm .row { display: flex; gap: 10px; }
.confirm .btn { flex: 1; min-height: 46px; }

/* ---------- empty ---------- */
.empty { margin: auto 0; padding: 8vh 0 2vh; }
.empty h1 { font: 500 clamp(34px, 9vw, 46px)/1.08 var(--serif); letter-spacing: -.025em; margin: 0 0 8px; text-wrap: balance; }
.empty p { color: var(--muted); margin: 0 0 26px; font-size: 16px; }
.starters { border-top: 1px solid var(--line); }
.starters button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 16px; text-align: left; padding: 15px 2px; border-bottom: 1px solid var(--line); font-size: 15.5px; min-height: 54px; }
.starters button svg { color: var(--faint); width: 18px; height: 18px; }
@media (hover: hover) { .starters button:hover svg { color: var(--accent-ink); } }

.jump { position: absolute; right: 16px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; background: var(--raised-2); box-shadow: var(--shadow); display: none; place-items: center; }
.jump.on { display: grid; }

/* ---------- composer ---------- */
.dock { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 78%, transparent); }
.macbar { max-width: 760px; margin: 0 auto 8px; display: none; }
.macbar.on { display: block; }
.macbar .btn { width: 100%; min-height: 48px; font-size: 15.5px; }
.composer { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; padding: 8px 8px 8px 10px; transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent-ink) 60%, var(--line-2)); }
.composer.mac { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.tray { display: flex; gap: 8px; padding: 4px 4px 8px; overflow-x: auto; }
.tray:empty { display: none; }
.chip { position: relative; flex: none; }
.chip img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; display: block; border: 1px solid var(--line); }
.chip .doc { height: 64px; min-width: 120px; max-width: 170px; border-radius: 12px; background: var(--raised); display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 13px; }
.chip .doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .x { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; background: var(--raised-2); border: 2px solid var(--surface); display: grid; place-items: center; }
.chip .x svg { width: 12px; height: 12px; stroke-width: 2.4; }
.chip.up img, .chip.up .doc { opacity: .5; }
.chip.bad img, .chip.bad .doc { outline: 2px solid var(--danger); }
textarea#input { display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: 400 16px/1.4 var(--sans);
  padding: 6px 8px; max-height: 38vh; min-height: 34px; }
textarea#input::placeholder { color: var(--faint); }
.tools { display: flex; align-items: center; gap: 6px; padding-top: 2px; }
.tools .iconbtn { width: 40px; height: 40px; border-radius: 50%; color: var(--muted); }
.macchip { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px 0 11px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14.5px; border: 1px solid var(--line-2); }
.macchip svg { width: 18px; height: 18px; }
.macchip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.macchip:disabled { opacity: .45; }
.macchip[aria-pressed="true"]:disabled { opacity: 1; }
.send { margin-left: auto; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; transition: transform .15s var(--ease), opacity .15s; }
.send:active { transform: scale(.92); }
.send:disabled { background: var(--raised-2); color: var(--faint); }
.send.stop { background: var(--text); color: var(--bg); }
.send svg { width: 20px; height: 20px; stroke-width: 2.2; }
.hint { max-width: 760px; margin: 6px auto 0; text-align: center; font-size: 12px; color: var(--faint); min-height: 16px; }

/* ---------- popovers, sheets, dialogs ---------- */
.pop { position: fixed; z-index: 50; background: var(--raised); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; min-width: 190px; animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.pop button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 11px; font-size: 15.5px; min-height: 46px; text-align: left; }
.pop button:active { background: var(--raised-2); }
@media (hover: hover) { .pop button:hover { background: var(--raised-2); } }
.pop button svg { width: 20px; height: 20px; color: var(--muted); }
.pop button.danger { color: var(--danger); } .pop button.danger svg { color: var(--danger); }
.sheetwrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 480px; background: var(--surface); border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line); animation: rise .42s var(--ease); max-height: 88dvh; overflow: auto; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px) { .sheetwrap { align-items: center; } .sheet { border-radius: 24px; } }
.sheet h3 { margin: 0 0 4px; font: 600 20px/1.2 var(--serif); letter-spacing: -.01em; }
.sheet p.sub { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.sheet input[type=text] { width: 100%; font: 400 16px var(--sans); color: var(--text); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: 0; margin-bottom: 16px; }
.sheet input[type=text]:focus { border-color: var(--accent-ink); }
.sheet .row { display: flex; gap: 10px; } .sheet .row .btn { flex: 1; min-height: 46px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); min-height: 52px; }
.setrow:first-of-type { border-top: 0; }
.setrow .l b { display: block; font-weight: 500; font-size: 15.5px; } .setrow .l span { color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; background: var(--raised); border-radius: 11px; padding: 3px; }
.seg button { padding: 7px 12px; border-radius: 9px; font-size: 14px; color: var(--muted); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--raised-2); color: var(--text); font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--raised-2); overflow: hidden; margin: 8px 0 0; width: 100%; }
.meter i { display: block; height: 100%; background: var(--accent-ink); border-radius: 3px; }
.meter.hot i { background: var(--danger); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.lightbox img { max-width: 100vw; max-height: 86dvh; object-fit: contain; }
.lightbox button { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 10px; color: #fff; }
.toast { position: fixed; pointer-events: none; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; z-index: 90; animation: pop .2s var(--ease); max-width: 90vw; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 24px calc(28px + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; }
.login .mark { width: 56px; height: 56px; border-radius: 15px; margin-bottom: 30px; display: block; }
.login h1 { font: 500 clamp(36px, 10vw, 46px)/1.05 var(--serif); letter-spacing: -.03em; margin: 0 0 8px; }
.login p { color: var(--muted); margin: 0 0 28px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 2px; }
.login input { width: 100%; font: 400 17px var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 15px 16px; outline: 0; margin-bottom: 14px; }
.login input:focus { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.login .btn { width: 100%; min-height: 52px; font-size: 16px; margin-top: 6px; }
.login .err { color: var(--danger); font-size: 14.5px; min-height: 22px; margin: 4px 2px 0; }
.login .fine { margin-top: 28px; font-size: 12.5px; color: var(--faint); }

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

/* ---------- saved logins (Settings > Saved logins) ---------- */
.lgrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 52px; }
.lgrow:first-of-type { border-top: 0; }
.lgrow .l { min-width: 0; } .lgrow .l b { display: block; font-weight: 500; font-size: 15.5px; overflow-wrap: anywhere; } .lgrow .l span { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.lgrow .btn { min-height: 44px; min-width: 88px; flex: none; }
.lgempty { color: var(--muted); font-size: 14.5px; padding: 8px 0 12px; }
.lgform { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.lgform label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.lgform input { width: 100%; font: 400 16px var(--sans); color: var(--text); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: 0; margin-bottom: 14px; }
.lgform input:focus { border-color: var(--accent-ink); }
.lgform .note { color: var(--muted); font-size: 13px; margin: -4px 0 14px; }
.lgerr { color: var(--danger); font-size: 14px; margin: -4px 0 12px; }

/* ---------- Wally: changes under a reply, lessons list ---------- */
.wchanges { margin-top: 12px; border: 1px solid var(--line-2); border-radius: 14px; padding: 4px 14px; }
.wchange { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; }
.wchange + .wchange { border-top: 1px solid var(--line); }
.wchange .l b { display: block; font-weight: 500; font-size: 14.5px; } .wchange .l span { color: var(--muted); font-size: 13px; }
.wlist { margin-top: 4px; } .wlist .setrow .btn { flex: none; }
.setrow .btn, .wchange .btn { min-height: 44px; min-width: 88px; flex: none; }
@media (pointer: coarse) { .seg button { min-height: 44px; } }

/* ---------- live panel ---------- */
#btn-live { position: relative; }
#btn-live.on { background: var(--raised); }
#btn-live .ldot { position: absolute; top: 9px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s; }
#btn-live.working .ldot { opacity: 1; transform: none; animation: lpulse 1.4s ease-in-out infinite; }
@keyframes lpulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-ink) 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

.live { display: none; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); z-index: 25; }
.live[hidden] { display: none; }
#app.live-open .live { display: flex; }
.live-head { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px 16px; min-height: calc(52px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); flex: none; }
.live-title { flex: 1; min-width: 0; }
.live-title b { display: block; font: 600 16px/1.2 var(--sans); letter-spacing: -.01em; }
.live-title small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.live-stop { min-height: 44px; padding: 0 18px; }
.live-conn { font-size: 12.5px; color: var(--muted); padding: 6px 16px; background: var(--raised); flex: none; }
.live-screen { position: relative; margin: 12px 12px 0; border-radius: 14px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--line); aspect-ratio: 16 / 10; flex: none; }
.live-screen[hidden] { display: none; }
.live-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.live-screen img[hidden], .live-wait[hidden], .live-overlay[hidden] { display: none; }
.live-wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.live-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--code-bg); color: var(--text); font-size: 14px; font-weight: 500; text-align: center; padding: 12px; }
.live-overlay svg { color: var(--accent-ink); width: 26px; height: 26px; }
.live-screen + .live-feed { margin-top: 12px; border-top: 1px solid var(--line); }
.live-feed { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); }
.live-empty { color: var(--muted); font-size: 14px; line-height: 1.5; padding: 22px 16px; }
.lrow { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 12px; min-height: 44px; }
.lrow + .lrow { margin-top: 1px; }
.lrow.k-start { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); border-radius: 0; }
.lrow.k-start:first-child { margin-top: 0; border-top: 0; }
.lrow.k-start .ltext { color: var(--muted); font-size: 13px; }
.lrow.k-done .ltext, .lrow.k-error .ltext { font-weight: 600; }
.lrow.s-running { background: var(--raised); }
.lrow.k-start.s-running { background: none; }
.lmark { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.lic { width: 22px; height: 22px; display: grid; place-items: center; margin-top: 1px; color: var(--accent-ink); }
.lic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.s-error .lic { color: var(--danger); } .s-stopped .lic { color: var(--muted); }
.lspin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-ink); border-top-color: transparent; animation: spin .8s linear infinite; }
.lbody { min-width: 0; }
.ltext { font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
.lmeta { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.lmeta.bad { color: var(--danger); }
.lt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; white-space: nowrap; }
.lact { display: flex; gap: 8px; margin-top: 8px; }
.lact .btn { min-height: 44px; flex: 1; }

/* wide: a column beside the chat */
@media (min-width: 1100px) {
  #app.live-open { grid-template-columns: 300px minmax(0, 1fr) 380px; }
}
/* middle widths: slides over the chat from the right */
@media (min-width: 600px) and (max-width: 1099px) {
  #app.live-open .live { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw); box-shadow: var(--shadow); }
}
/* phone: a full-height sheet */
@media (max-width: 599px) {
  #app.live-open .live { position: fixed; inset: 0; width: 100%; border-left: 0; z-index: 40; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}
@media (prefers-reduced-motion: reduce) { #btn-live.working .ldot, .lspin { animation-duration: 3s; } }
/* A long Live feed scrolls inside the panel. Without an explicit row, Safari sized the one implicit grid row to the
   whole feed, so the page grew taller than the window: the Live header, the newest rows and the message box went
   off-screen and the chat column looked blank. Pin every column to the window height. */
#app > .main, #app > .drawer, #app > .live { min-height: 0; max-height: 100%; }
#app > .live { overflow: hidden; }

/* ---------- My info (emails, cards, personal info; logins keep their old lg* rules) ---------- */
.misec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.misec:first-of-type { margin-top: 6px; border-top: 0; padding-top: 0; }
.misec h4 { margin: 0 0 6px; font: 600 15px/1.3 var(--sans); letter-spacing: .01em; }
.mirow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 52px; }
.mirow:first-child { border-top: 0; }
.mirow .l { min-width: 0; flex: 1; } .mirow .l b { display: block; font-weight: 500; font-size: 15.5px; overflow-wrap: anywhere; } .mirow .l span { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.miacts { display: flex; gap: 8px; flex: none; }
.mirow .btn, .miadd { min-height: 44px; min-width: 72px; flex: none; }
.miempty { color: var(--muted); font-size: 14.5px; padding: 4px 0 10px; }
.miadd { width: 100%; margin-top: 6px; }
.miform label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.miform input { width: 100%; font: 400 16px var(--sans); color: var(--text); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: 0; margin-bottom: 14px; min-height: 46px; }
.miform input:focus { border-color: var(--accent-ink); }
.migrid, .miextra { display: flex; gap: 10px; }
.mifield { min-width: 0; }
.migrid .mifield, .miextra .mifield { flex: 1; }
.miextras .miextra { margin-top: 2px; }
.miform .miadd { margin: 0 0 14px; }

/* the Buy card (chat) and the Buy row (Live) */
.confirm.buy .lbl { margin-bottom: 10px; }
.bline { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.bline:first-of-type { border-top: 0; }
.bline .bk { color: var(--muted); font-size: 13px; flex: none; }
.bline .bv { text-align: right; overflow-wrap: anywhere; min-width: 0; font-weight: 500; }
.bline.btotal { padding: 12px 0 10px; }
.bline.btotal .bv { font: 700 30px/1.1 var(--sans); letter-spacing: -.02em; }
.confirm.buy .row { margin-top: 12px; }
.confirm .fine { margin: 10px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.lbuy { margin-top: 8px; padding: 6px 12px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2); }
.lbline { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.lbline .bk { color: var(--muted); font-size: 12.5px; flex: none; }
.lbline .bv { text-align: right; overflow-wrap: anywhere; min-width: 0; font-weight: 500; }
.lbline.tot .bv { font: 700 22px/1.15 var(--sans); letter-spacing: -.01em; }
.lfine { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Brain, Personality, Voice (talk mode) */
.tools .iconbtn.vbtn { width: 44px; height: 44px; }
.tools .iconbtn.vbtn[hidden] { display: none; }
.tools .iconbtn.vbtn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.tools .iconbtn.vbtn:disabled { opacity: .4; }
.tools .iconbtn#btn-mic.listening { background: var(--danger, #d33); color: #fff; animation: micpulse 1.2s ease-in-out infinite; }
.tools .iconbtn#btn-talk.speaking { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
@keyframes micpulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger, #d33) 22%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tools .iconbtn#btn-mic.listening { animation: none; } }
.vselect { min-height: 44px; max-width: 55%; padding: 0 10px; border-radius: 12px; background: var(--raised); color: var(--text); border: 1px solid var(--line-2); font-size: 15px; }
.setrow.vrow { flex-wrap: wrap; }
.ptext { width: 100%; min-height: 180px; padding: 12px 14px; border-radius: 14px; background: var(--raised); color: var(--text); border: 1px solid var(--line-2); font: inherit; font-size: 15.5px; line-height: 1.45; resize: vertical; margin-top: 6px; }
.pmeta { margin: 8px 0 0; }
.prow { display: flex; gap: 10px; margin-top: 10px; } .prow .btn { flex: 1; min-height: 46px; }
.bbox { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.bcard { padding: 12px 14px; border-radius: 14px; background: var(--raised); border: 1px solid transparent; }
.bcard.on { border-color: var(--accent); }
.bcard .bh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bcard .bh b { font-weight: 600; font-size: 15.5px; }
.bcard .bon { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.bcard .sub { margin: 4px 0 0; }
.bswitch { min-height: 46px; width: 100%; }
.errbox .offer { min-height: 44px; background: var(--accent); color: var(--on-accent); }
@media (max-width: 430px) {
  .tools { gap: 2px; }
  .macchip { font-size: 13.5px; padding: 0 10px 0 9px; gap: 5px; white-space: nowrap; }
}
.tools .iconbtn, .macchip { flex: none; }
.seg button { min-width: 48px; }
.bcard p.sub { margin: 4px 0 0; }
.bcard p.sub:empty { display: none; }

/* Settings > Computers */
.cprow { padding: 14px 0; border-top: 1px solid var(--line); }
.cprow:first-child { border-top: 0; }
.cptop { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cptop .l { min-width: 0; } .cptop .l b { display: block; font-weight: 500; font-size: 15.5px; overflow-wrap: anywhere; }
.cptop .l span { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.cptop .l span.cpbusy { color: var(--accent-ink); font-weight: 600; }
.cptop .btn { min-height: 44px; min-width: 104px; flex: none; }
.cpacts { display: flex; gap: 10px; margin-top: 10px; }
.cpacts .btn { min-height: 44px; flex: 1; }
.cppv { margin-top: 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--raised); padding: 10px; }
.cppv img { display: block; width: 100%; height: auto; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }
.cpmsg { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.cppv.ok .cpmsg { color: var(--text); font-weight: 500; }
.cppv.bad { border-color: var(--danger); } .cppv.bad .cpmsg { color: var(--danger); }
.cpseg { display: flex; margin-bottom: 14px; } .cpseg button { flex: 1; min-height: 44px; }
.cpkey { width: 100%; font: 400 13px/1.35 ui-monospace, Menlo, monospace; color: var(--text); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: 0; margin-bottom: 14px; resize: vertical; min-height: 96px; -webkit-text-security: disc; }
.cpkey:focus { border-color: var(--accent-ink); }
.cpmore { margin: 0 0 14px; } .cpmore summary { min-height: 44px; display: flex; align-items: center; color: var(--muted); font-size: 14.5px; cursor: pointer; }
.cphelp { margin: 14px 0 6px; font-size: 13.5px; }

/* phone: Settings > Phone and Calls and texts (public/phone.js) */
.ph-status { display: block; border: 1px solid var(--line); background: var(--raised); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; }
.ph-status b { display: block; font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.ph-status span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.ph-status.ok { border-color: var(--accent-ink); }
.ph-status.warn { border-color: var(--danger); background: var(--danger-bg); }
.ph-note { color: var(--danger); font-size: 13.5px; margin: 0 0 12px; }
.ph-h { margin: 0 0 8px; font: 600 16px/1.3 var(--sans); }
.ph-full { width: 100%; min-height: 46px; margin-top: 10px; }
.ph-back { width: 100%; min-height: 46px; margin-top: 14px; }
.ph-urls { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.ph-urls .note { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.ph-urls code { display: block; font: 500 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; margin-bottom: 4px; }
.ph-seg { display: flex; margin-bottom: 12px; } .ph-seg button { flex: 1; min-height: 44px; }
.ph-list { display: flex; flex-direction: column; }
.ph-row { display: block; width: 100%; text-align: left; padding: 12px 2px; border-top: 1px solid var(--line); min-height: 56px; background: none; color: inherit; font: inherit; }
.ph-row:first-child { border-top: 0; } .ph-row.static { cursor: default; }
.ph-row:active:not(.static) { background: var(--raised); }
.ph-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ph-top b { font-weight: 500; font-size: 15.5px; overflow-wrap: anywhere; min-width: 0; } .ph-top small { color: var(--muted); font-size: 12.5px; white-space: nowrap; flex: none; }
.ph-sum { color: var(--text); font-size: 14.5px; line-height: 1.4; margin-top: 4px; overflow-wrap: anywhere; }
.ph-row .ph-sum { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ph-tag { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; }
.ph-meta { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.ph-msg { border: 1px solid var(--accent-ink); border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ph-msg b { display: block; margin-bottom: 4px; }
.ph-tr { margin-top: 14px; } .ph-tr > b { display: block; margin-bottom: 8px; font-size: 14px; }
.ph-tr .note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.ph-turn { max-width: 88%; margin: 0 0 8px; padding: 8px 12px; border-radius: 16px; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; background: var(--raised); }
.ph-turn small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 1px; }
.ph-turn.w { margin-right: auto; border-bottom-left-radius: 5px; } .ph-turn.t { margin-left: auto; border-bottom-right-radius: 5px; background: var(--raised-2); }
.ph-list .ph-full + .ph-h { margin-top: 16px; }

/* ---------- steering a running task (public/steer.js) ---------- */
.macbar.runbar { display: none; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 6px 6px 6px 14px; }
.macbar.runbar.on { display: flex; }
.runbar .rb-status { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-size: 14px; color: var(--muted); }
.runbar .rb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runbar .rb-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); animation: rbpulse 1.4s ease-in-out infinite; }
.runbar.paused .rb-dot { animation: none; background: var(--faint); }
.runbar.paused .rb-status { color: var(--text); font-weight: 600; }
@keyframes rbpulse { 50% { opacity: .35; } }
.runbar .rb-btns { display: flex; gap: 6px; flex: none; }
.macbar.runbar .btn { width: auto; min-height: 44px; min-width: 64px; padding: 0 14px; font-size: 14.5px; }
.title .dot.paused { animation: none; background: var(--faint); }
.composer.steering { border-color: color-mix(in srgb, var(--accent-ink) 45%, var(--line-2)); }
.steerhint { max-width: 760px; margin: 0 auto 6px; display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px; font-size: 13px; color: var(--muted); }
.steerhint.on { display: flex; }
.linkbtn { min-height: 44px; padding: 0 4px; color: var(--accent-ink); font-weight: 600; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:disabled { opacity: .45; }
.queuebar { max-width: 760px; margin: 0 auto 8px; display: none; flex-direction: column; gap: 6px; }
.queuebar.on { display: flex; }
.qrow { display: flex; align-items: center; gap: 8px; background: var(--raised); border-radius: 14px; padding: 4px 4px 4px 12px; }
.qlab { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.qtag, .steermark .tag { flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--accent-ink); }
.qtext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .btn { min-height: 44px; min-width: 72px; padding: 0 12px; flex: none; }
.msg.user .steermark { justify-content: flex-end; }
.steermark .tag.q { color: var(--muted); }
.steermark.seen .tag::before { content: '✓ '; }
.live-ctl { display: flex; gap: 6px; }
.live-ctl .btn { min-height: 44px; padding: 0 14px; }
.lrow.k-steer .ltext { font-weight: 600; }
.lrow.k-control .ltext, .lrow.k-queue .ltext { color: var(--muted); }

/* tap targets: the send button is 44px like every other control (it steers while Wally works) */
.send { width: 44px; height: 44px; }
/* Stop: on the dark theme the red is light, so its label is dark (white on it read at about 2.5:1) */
.runbar .rb-stop, .live-ctl .live-stop { color: #1d0705; }
:root[data-theme="light"] .runbar .rb-stop, :root[data-theme="light"] .live-ctl .live-stop { color: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .runbar .rb-stop, :root:not([data-theme="dark"]) .live-ctl .live-stop { color: #fff; } }


/* Settings: Money this month and Phone notifications (public/money.js, public/notify.js) */
.wn-box { display: block; }
.wn-box .l b { display: block; font-weight: 500; font-size: 15.5px; } .wn-box .l span { color: var(--muted); font-size: 13px; }
.wn-seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.wn-seg button { flex: 1 1 auto; min-height: 44px; min-width: 56px; padding: 0 12px; border-radius: 12px; background: var(--raised); color: var(--muted); font-size: 14.5px; font-weight: 500; }
.wn-seg button[aria-pressed="true"] { background: var(--raised-2); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-ink); }
.wn-help { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.wn-warn { color: var(--text); background: var(--raised); border-radius: 10px; padding: 10px 12px; }
.wn-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wn-actions .btn { flex: 1 1 200px; min-height: 44px; }
.wn-cell { margin-top: 14px; } .wn-cell label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.wn-cellrow { display: flex; gap: 8px; }
.wn-cellrow input { flex: 1; min-width: 0; min-height: 44px; font: 400 16px var(--sans); color: var(--text); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 0 14px; outline: 0; }
.wn-cellrow input:focus { border-color: var(--accent-ink); }
.wn-cellrow .btn { min-height: 44px; min-width: 76px; flex: none; }
.wn-box button:disabled, .wn-row button:disabled { opacity: .5; }

/* ---------- Settings > Self-improvement (public/improve.js) ---------- */
.imp-sheet .imp-h { font: 600 16px/1.3 var(--serif); margin: 20px 0 8px; }
.imp-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px; border-radius: 16px; background: var(--raised); margin-bottom: 6px; }
.imp-status.on { box-shadow: inset 0 0 0 1px var(--accent-ink); }
.imp-status .l { min-width: 0; flex: 1 1 180px; } .imp-status .l b { display: block; font-size: 15.5px; } .imp-status .l span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.imp-actions .btn { min-height: 44px; padding: 0 18px; }
.imp-row { flex-wrap: wrap; } .imp-row .l { min-width: 0; flex: 1 1 140px; } .imp-row .l b { display: block; } .imp-row .l span { display: block; color: var(--muted); font-size: 13px; }
.imp-seg { margin-left: auto; } .imp-seg button { min-height: 44px; min-width: 56px; }
.imp-select { max-width: none; min-width: 120px; }
.imp-chart { margin-top: 4px; }
.imp-svg { display: block; width: 100%; height: auto; max-height: 200px; }
.imp-grid { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 4; }
.imp-ax { fill: var(--muted); font: 500 10.5px var(--sans); }
.imp-line { fill: none; stroke: var(--accent-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.imp-area { fill: var(--accent); opacity: .14; stroke: none; }
.imp-dot { fill: var(--surface); stroke: var(--accent-ink); stroke-width: 2.5; } .imp-dot.start { stroke: var(--muted); }
.imp-now { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.imp-empty { color: var(--muted); font-size: 14px; padding: 10px 0; }
.imp-entry { border-top: 1px solid var(--line); padding: 12px 0; }
.imp-entry:first-child { border-top: 0; }
.imp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.imp-top .l { min-width: 0; } .imp-top .l b { display: block; font-size: 15px; line-height: 1.35; margin-top: 4px; overflow-wrap: anywhere; }
.imp-top .btn { min-height: 44px; flex: none; } .imp-top .btn:disabled { opacity: .5; }
.imp-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--raised-2); color: var(--muted); }
.imp-badge.kept { background: var(--accent); color: var(--on-accent); }
.imp-badge.rolled-back, .imp-badge.error { background: var(--danger-bg); color: var(--danger); }
.imp-why { font-size: 14px; line-height: 1.45; margin-top: 6px; overflow-wrap: anywhere; }
.imp-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; overflow-wrap: anywhere; }
.imp-full { width: 100%; margin-top: 16px; min-height: 46px; }
.mfoot .iconbtn.imp-thumb { width: 44px; height: 44px; }
.imp-thumb[aria-pressed="true"] { color: var(--danger); }
.imp-thumb[aria-pressed="true"] svg path { fill: currentColor; fill-opacity: .18; }

/* ---- People accounts (item 13f): Settings > People, sign-up page, username on sign-in ---- */
.login .uhint { font-size: 13px; color: var(--faint); margin: -8px 2px 14px; }
.login .joinlink { display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 14px; color: var(--accent-ink); font-weight: 600; font-size: 15px; text-decoration: none; }
.login .joinback { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; font-size: 16px; text-decoration: none; color: var(--text); }
.ppsheet .setrow .seg { flex: none; }
.ppsheet .setrow .seg button { min-height: 44px; min-width: 56px; }
.pphead { margin: 18px 0 2px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.pphead[hidden] { display: none; }
.ppmade { margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--raised); display: flex; flex-direction: column; gap: 10px; }
.ppmade[hidden] { display: none; }
.ppmade b { font-weight: 600; font-size: 15px; }
.ppmade input { width: 100%; font: 400 14px var(--mono, ui-monospace, monospace); color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; outline: 0; min-height: 44px; }
.ppmade .btn { min-height: 46px; width: 100%; }
.ppmade .ppfine { font-size: 13px; color: var(--muted); }
.ppnone { margin: 8px 0 0 !important; }
.pprow .l { min-width: 0; } .pprow .l span { overflow-wrap: anywhere; }
.ppform input { min-height: 46px; }
.ppform .row { margin-top: 4px; }
.ppsheet .setrow .l span { display: block; line-height: 1.4; margin-top: 2px; }
.login .joinlink[hidden], .login .joinback[hidden] { display: none; }

/* ---------- Look (brief 13h): warm paper, coral accent, serif headings, Claude-like sidebar and composer ---------- */
.drawer { background: var(--sidebar); }
.drawer-foot { border-top-color: transparent; }
.chatrow.active::before { display: none; }
.newchat { background: transparent; padding-left: 8px; }
.newchat svg { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--accent); color: var(--on-accent); stroke-width: 2.2; }
@media (hover: hover) { .newchat:hover { background: var(--raised); } }
.newchat:active { background: var(--raised); }
.prose h2, .prose h3, .prose h4, .misec h4, .ph-h { font-family: var(--serif); letter-spacing: -.01em; font-weight: 600; }
.prose h2 { font-size: 1.36em; } .prose h3 { font-size: 1.18em; }
.empty h1, .login h1 { font-weight: 400; letter-spacing: -.02em; }
.sheet h3 { font-size: 22px; font-weight: 500; }
.brand { font-weight: 600; }
.bubble { border-radius: var(--r-lg); padding: 10px 16px; }
.composer { border-radius: var(--r-lg); box-shadow: 0 1px 2px rgba(40,30,20,.04), 0 6px 24px rgba(40,30,20,.06); }
.composer:focus-within { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(40,30,20,.05), 0 8px 28px rgba(40,30,20,.09); }
.send { border-radius: var(--r); }
.send:disabled { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); color: var(--on-accent); opacity: .7; }
.btn, .errbox button { border-radius: var(--r); }
.btn.danger { color: #fff; }
:root:not([data-theme="light"]) .btn.danger { color: #2a0610; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .btn.danger { color: #fff; } }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
textarea#input, .sheet input, .login input, .miform input, .lgform input { caret-color: var(--accent-ink); }
.scroller, .chatlist, .live-feed, .sheet { scrollbar-color: var(--raised-2) transparent; scrollbar-width: thin; }
.brand, .empty h1, .login h1, .sheet h3, .prose h2, .prose h3, .prose h4, .misec h4, .ph-h { text-rendering: geometricPrecision; }
:root:not([data-theme="light"]) .tools .iconbtn#btn-mic.listening { color: #2a0610; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .tools .iconbtn#btn-mic.listening { color: #fff; } }

/* My info secret boxes: a text box drawn as dots, so the browser never offers to save Wally's own vault values */
.secret-in { -webkit-text-security: disc; text-security: disc; }

/* Backlog (public/backlog.js): waiting tasks from every chat, and the waiting state in a chat's Queued list */
.bl-btn { margin-top: 8px; }
.bl-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--raised-2); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.bl-badge.on { background: var(--accent-ink); color: var(--surface); }
.bl-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.bl-row { background: var(--raised); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.bl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bl-chat { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bl-text { font-size: 15px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bl-why { font-size: 13px; color: var(--muted); }
.bl-detail { font-size: 12px; color: var(--muted); opacity: .8; overflow-wrap: anywhere; }
.bl-acts { display: flex; gap: 8px; margin-top: 4px; }
.bl-acts .btn { flex: 1; min-height: 44px; padding: 0 10px; }
.bl-empty { color: var(--muted); font-size: 14.5px; padding: 12px 2px; }
.bl-done { width: 100%; min-height: 46px; }
.bl-edit { width: 100%; font: 400 16px var(--sans); color: var(--text); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: 0; margin-bottom: 16px; resize: vertical; }
.qrow.qwait { flex-wrap: wrap; }
.qrow.qwait { padding: 8px 8px 8px 12px; row-gap: 6px; }
.qrow.qwait .qlab { flex: 1 1 100%; }
.qrow.qwait .qwhy { order: 1; flex: 1 0 100%; font-size: 12.5px; color: var(--muted); }
.qrow.qwait .btn { order: 2; flex: 1; }
