/* chat.albastov.com */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: calc(100vh - 32px); height: calc(100dvh - 32px); }
.app.collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.collapsed .side { visibility: hidden; }
.side { display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--bg-sunk); border-right: 1px solid var(--line); min-width: 0; overflow: hidden; }
.side-top { display: flex; align-items: center; justify-content: space-between; height: 32px; padding-left: 8px; }
.new { width: 100%; justify-content: flex-start; }
.chats { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.grp { font: var(--t-meta); color: var(--fg-3); padding: 16px 8px 6px; }
.grp:first-child { padding-top: 4px; }
.chat-i { position: relative; display: flex; align-items: center; height: 32px; padding: 0 8px; border-radius: var(--r-2); color: var(--fg-2); cursor: pointer; }
.chat-i:hover { background: var(--bg-hover); color: var(--fg-1); }
.chat-i[aria-current=true] { background: var(--bg-active); color: var(--fg-1); }
.chat-i .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-i .dot { margin-left: 8px; }
.chat-i .acts { display: none; gap: 0; margin-left: 4px; }
.chat-i:hover .acts, .chat-i:focus-within .acts { display: flex; }
.chat-i:hover .dot { display: none; }
.chat-i .acts .ico { width: 24px; height: 24px; }
.chat-i input { flex: 1; min-width: 0; height: 24px; background: var(--bg-sunk); border: 1px solid var(--accent-line); border-radius: var(--r-2); padding: 0 6px; outline: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); margin: 0 -12px -12px; padding: 12px 20px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-active); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { position: relative; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0; border-bottom: 1px solid var(--line); flex: none; }
.app:not(.collapsed) #openSide { display: none; }
#openSide { position: absolute; left: 12px; top: 12px; }
.top-col { display: flex; align-items: center; min-width: 0; }
.top-title { font: var(--t-title); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.col { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 24px; }
.visitor { flex: none; border-bottom: 1px solid var(--line); background: var(--bg-raised); }
.visitor-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }

.scroll { flex: 1; overflow-y: auto; min-height: 0; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 56px, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to bottom, transparent 0, #000 56px, #000 calc(100% - 16px), transparent); }
.thread { padding-top: 40px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 40px; }

.msg-u { align-self: flex-end; max-width: 80%; background: var(--bg-user); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg-a { position: relative; min-width: 0; }
.msg-a .body code { white-space: nowrap; }
.msg-a .body > * + * { margin-top: 12px; }
.msg-a .body h3 { font: var(--t-body); font-weight: 600; margin-top: 20px; }
.msg-a .body ul, .msg-a .body ol { padding-left: 20px; }
.msg-a .body li + li { margin-top: 4px; }
/* inline code: 13px mono, no vertical padding, line-height inherited from the 22px line so rows never grow */
.msg-a .body code { font-family: var(--mono); font-size: 13px; line-height: inherit; vertical-align: baseline; background: var(--bg-chip); color: var(--fg-1); padding: 0 3px; border-radius: var(--r-1); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.msg-a .body strong { font-weight: 600; }
.think-d { margin-bottom: 10px; color: var(--fg-2); font: var(--t-meta); }
.think-d summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.think-d summary::-webkit-details-marker { display: none; }
.think-d summary::before { content: ''; width: 0; height: 0; border-left: 4px solid currentColor; border-top: 3px solid transparent; border-bottom: 3px solid transparent; transition: transform var(--dur-1); }
.think-d[open] summary::before { transform: rotate(90deg); }
.think-d p { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line-strong); }
.picker-btn:disabled, .think.off { opacity: .45; pointer-events: none; }
.body.caret:empty::after, .caret > :last-child::after { content: ''; display: inline-block; width: 2px; height: 16px; margin-left: 3px; vertical-align: -3px; background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.code { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-code); overflow: hidden; }
.code-h { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 4px 0 12px; border-bottom: 1px solid var(--line); font: var(--t-meta); color: var(--fg-2); }
.code-h button { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-2); color: var(--fg-2); font: var(--t-meta); }
.code-h button:hover { background: var(--bg-hover); color: var(--fg-1); }
.code-h svg { width: 14px; height: 14px; }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 400 13px/20px var(--mono); color: var(--fg-1); }
.code .k { color: var(--accent); }
.code .c { color: var(--fg-3); }

/* meta row floats in the gap under the reply, so hidden or shown it never changes the rhythm between turns */
.m-foot { position: absolute; top: 100%; left: 0; right: 0; display: flex; align-items: center; gap: 12px; margin-top: 6px; height: 24px; opacity: 0; transition: opacity var(--dur-2); }
.msg-a:hover .m-foot, .msg-a:focus-within .m-foot, .m-foot.live { opacity: 1; }
@media (hover: none) { .m-foot { opacity: 1; } }
/* icon glyph left edge sits exactly on the prose left edge; hover plate drawn outside the glyph */
.m-foot .ico { position: relative; width: 16px; height: 24px; border-radius: 0; color: var(--fg-2); background: none !important; }
.m-foot .ico svg { width: 16px; height: 16px; }
.m-foot .ico:first-child { margin-left: -2px; }
.m-foot .ico::before { content: ''; position: absolute; inset: 0 -4px; border-radius: var(--r-2); background: var(--bg-hover); opacity: 0; transition: opacity var(--dur-1); }
.m-foot .ico:hover::before { opacity: 1; }
.m-foot .ico svg { position: relative; }
.m-foot .ico:hover { color: var(--fg-1); }
.m-foot .stat { margin-left: 8px; display: flex; gap: 12px; color: var(--fg-2); }
.m-foot .stat span { white-space: nowrap; }
.m-foot.live .ico { display: none; }
.m-foot.live .stat { margin-left: 0; }
.ico.ok { color: var(--accent); }

/* honest wait states, inline in the conversation */
.wait { border: 1px solid var(--line); border-radius: var(--r-3); padding: 12px 14px; background: var(--bg-raised); display: grid; gap: 10px; }
.wait-h { display: flex; align-items: center; gap: 10px; }
.wait-h .meta { margin-left: auto; }
.wait .steps { display: flex; gap: 16px; }
.wait .steps span { display: inline-flex; align-items: center; gap: 6px; font: var(--t-meta); color: var(--fg-3); }
.wait .steps span.on { color: var(--fg-1); }
.wait .steps span.done { color: var(--fg-2); }
.wait .steps span.done .dot { background: var(--mark); }
.wait .steps .dot { width: 6px; height: 6px; }

/* composer */
.composer-wrap { flex: none; padding: 8px 0 12px; }
.composer { position: relative; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-composer); padding: 12px 12px 8px; transition: border-color var(--dur-1), box-shadow var(--dur-1); box-shadow: 0 8px 24px oklch(0 0 0 / .25); }
.composer:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-subtle), 0 8px 24px oklch(0 0 0 / .25); }
.composer textarea { display: block; width: 100%; resize: none; border: 0; background: none; outline: none; padding: 0 8px; max-height: 200px; min-height: 22px; }
.composer textarea::placeholder { color: var(--fg-3); }
.c-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; }
.picker-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; margin-left: 0; border-radius: var(--r-2); color: var(--fg-1); white-space: nowrap; }
.picker-btn:hover, .picker-btn[aria-expanded=true] { background: var(--bg-hover); }
.picker-btn .meta { color: var(--fg-2); }
.picker-btn svg { width: 14px; height: 14px; color: var(--fg-2); }
.think { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--r-2); cursor: pointer; color: var(--fg-2); white-space: nowrap; }
.think:hover { background: var(--bg-hover); color: var(--fg-1); }
.think input { position: absolute; opacity: 0; pointer-events: none; }
.think .sw { width: 26px; height: 16px; border-radius: 8px; background: var(--bg-active); border: 1px solid var(--line-strong); position: relative; transition: background var(--dur-1); }
.think .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--fg-2); transition: transform var(--dur-2) var(--ease); }
.think input:checked + .sw { background: var(--accent-subtle); border-color: var(--accent-line); }
.think input:checked + .sw::after { transform: translateX(10px); background: var(--accent); }
.think input:checked ~ span:last-child { color: var(--fg-1); }
.think input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
/* instant tooltip above the toggle, only on hover/focus */
.think::after { content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: 280px; padding: 6px 10px; border-radius: var(--r-2); background: var(--bg-overlay); border: 1px solid var(--line-strong); color: var(--fg-1); font: var(--t-meta); white-space: normal; opacity: 0; pointer-events: none; transition: opacity var(--dur-1); z-index: 25; box-shadow: 0 8px 24px oklch(0 0 0 / .4); }
.think:hover::after, .think:focus-within::after { opacity: 1; }
.send { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-fill); color: var(--on-accent); flex: none; transition: background var(--dur-1), color var(--dur-1); }
.send:hover:not(:disabled) { background: var(--accent-fill-hover); }
.send:disabled { background: var(--bg-active); color: var(--fg-3); cursor: default; }
.send.stop { background: var(--fg-1); color: var(--bg-ground); }
.send svg { width: 16px; height: 16px; }
.foot { text-align: left; margin-top: 8px; color: var(--fg-2); }

/* model picker */
.picker { position: absolute; left: 8px; bottom: calc(100% + 8px); width: min(420px, calc(100vw - 32px)); background: var(--bg-overlay); border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; box-shadow: 0 16px 48px oklch(0 0 0 / .5); z-index: 20; }
.opt { display: grid; grid-template-columns: 16px 1fr auto; gap: 2px 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-2); }
.opt:hover:not(:disabled) { background: var(--bg-hover); }
.opt .dot { grid-row: 1; justify-self: center; }
.opt .n { font-weight: 500; }
.opt .s { grid-column: 2 / 4; font: var(--t-meta); color: var(--fg-2); }
.opt .r { font: var(--t-meta); color: var(--fg-2); }
.opt .chk { color: var(--accent); width: 16px; height: 16px; }
.opt:disabled { cursor: not-allowed; }
.opt:disabled .n, .opt:disabled .r { color: var(--fg-3); }
.opt:disabled .s { color: var(--fg-3); }
.pk-foot { font: var(--t-meta); color: var(--fg-3); padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 6px; }

.scrim { display: none; }
@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 288px; z-index: 40; transform: translateX(-100%); transition: transform var(--dur-2) var(--ease); visibility: visible !important; }
  .app.open .side { transform: none; }
  .app.open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: oklch(0 0 0 / .5); }
  #openSide { display: inline-grid !important; }
  .col { padding: 0 16px; }
  .top-col { padding-left: 52px; }
  #openSide { left: 8px; }
  .top-meta .sp { display: none; }
  .c-row { flex-wrap: wrap; }
  .msg-u { max-width: 88%; }
  .code pre { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 28px; }
  .chat-i .acts { display: flex; }
  .chat-i .dot { display: none; }
  .visitor-in { flex-direction: column; align-items: flex-start; gap: 2px; }
  .mock > .lbl { display: none; }
  .side { top: 32px; }
  .stat { flex-wrap: wrap; row-gap: 0; }
}
