/* The conversation (views/chat.js, activity.js, attachments.js, md.js): the glass bar on top that the messages slide under, the owner's coral bubble, Claude's answer as plain text with the
   block of what it did, the floating glass composer with the queue, the tray and the box, the rendered markdown. Orbita's own classes (.mu .mc .mfoot .act .code .comp .typing .thumb .rm .prog)
   do the drawing; this file lays them out in a real, scrolling page. */
.chat { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; --top-h: 56px; --comp-h: 72px; }
.topfade { position: absolute; left: 0; right: 0; top: 0; z-index: 2; height: calc(var(--top) + var(--top-h) + 22px); pointer-events: none; background: linear-gradient(var(--bg) 35%, transparent); }
.chat-top { position: absolute; z-index: 3; left: 16px; right: 16px; top: calc(var(--top) - 4px); max-width: 760px; margin: 0 auto; display: grid; gap: 8px; }
.bar { position: relative; display: flex; align-items: center; gap: 6px; height: 56px; padding: 6px; border-radius: 28px; }
.bar .titles { flex: 1; min-width: 0; display: grid; text-align: center; position: relative; }
.bar h2 { font-size: 16px; line-height: 20px; }
.status { display: flex; align-items: center; justify-content: center; justify-content: safe center; gap: 6px; min-height: 17px; font-weight: 600; color: var(--tx3); min-width: 0; white-space: nowrap; overflow: hidden; }
.status.working { color: var(--acc-tx); }
.status .live { width: 6px; height: 6px; }
.status .sep { opacity: .5; }
.optchip { position: relative; color: inherit; font: inherit; padding: 0; text-decoration: none; }
.optchip::after { content: ""; position: absolute; inset: -14px -6px; }
.btn-ic.flat { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn-ic.sm { width: 40px; height: 40px; }
.bar .page-lbl, .bar .more { display: none; }
@media (min-width: 900px) {
  .chat-top { left: 20px; right: 20px; }
  .bar { height: 64px; padding: 8px 8px 8px 20px; }
  .bar .titles { text-align: left; }
  .status { justify-content: flex-start; }
  .bar .back, .bar .page-btn { display: none; }
  .bar .page-lbl { display: inline-flex; }
  .bar .more { display: inline-grid; }
}
.chat-banner:empty { display: none; }
.chat-banner .banner { position: relative; }
.chat-banner .banner.warn .banner-i, .chat-banner .banner-i.warn { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroller { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(var(--top) + var(--top-h) + 12px) 0 calc(var(--comp-h) + var(--sab) + 12px + 16px); }
.thread { max-width: var(--read-w); margin: 0 auto; padding: 0 20px; display: grid; gap: 14px; }
.day { justify-self: center; }
.thread .older { justify-self: center; }
.jump { position: absolute; z-index: 4; right: 16px; bottom: calc(var(--comp-h) + var(--sab) + 12px + 12px); }
.jump[hidden] { display: none; }
.jump .dot { position: absolute; top: 8px; right: 8px; }
/* the owner's words */
.turn.user { justify-self: end; max-width: 92%; display: grid; justify-items: end; gap: 4px; animation: msgin 340ms var(--ease); }
.turn.user .mu { max-width: min(100%, 520px); white-space: pre-wrap; overflow-wrap: anywhere; }
.turn.user .mby { max-width: 100%; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }          /* who wrote it, when it was not you */
/* Claude's answer */
.turn.assistant { display: grid; gap: 10px; min-width: 0; animation: msgin 340ms var(--ease); }
.turn.old { animation: none; }                                                   /* what was already said when the conversation was opened does not slide in */
.turn.assistant > * { min-width: 0; }
.mfoot { gap: 8px; min-height: 28px; }
.mfoot .copy { margin-left: auto; color: var(--tx3); }
.mfoot .tag { padding: 0 8px; border-radius: 999px; background: var(--field); font-weight: 600; line-height: 18px; color: var(--tx2); }
.thinking { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.thinking[hidden] { display: none; }
.tnote { justify-self: center; display: flex; align-items: center; gap: 8px; max-width: 94%; padding: 8px 14px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); color: var(--tx2); font: 500 13px/17px var(--f); text-align: left; }
.tnote.error { align-items: flex-start; border-color: transparent; border-radius: 18px; background: var(--crit-soft); color: var(--crit); }
.tnote button { margin-left: 8px; font-weight: 700; text-decoration: underline; white-space: nowrap; color: inherit; }
.start { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 16px 0 0; }
.start-nuc { width: 140px; height: 140px; }
.start p { max-width: 420px; text-wrap: pretty; }
.ideas { width: 100%; max-width: 420px; margin-top: 8px; text-align: left; }
/* what the agent did, behind each answer */
.act-h { width: 100%; border: 0; background: transparent; text-align: left; }
.act-h .act-lbl { flex: 1; min-width: 0; font-weight: 600; }
.act-h .act-n { margin-left: auto; flex: none; }
.act-h .chev { flex: none; transition: transform 200ms var(--ease); }
.act[data-open] .chev { transform: rotate(180deg); }
.act.working { border-color: var(--acc-line); }
.act-list { border-top: 1px solid var(--line); max-height: 280px; overflow: auto; }
.act-i.acc { background: var(--acc-soft); color: var(--acc-tx); }
.step-t { flex: 1; min-width: 0; align-self: center; overflow-wrap: anywhere; }
.step.run .step-t { color: var(--tx); }
.step-st { align-self: center; flex: none; }
.step-d { margin-top: 2px; }
.act-r code { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
/* the composer */
.comp { position: absolute; z-index: 5; left: 12px; right: 12px; bottom: calc(12px + var(--sab)); max-width: 760px; margin: 0 auto; padding: 8px; border-radius: 30px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }          /* one column as wide as the composer: a long word in the queue or the tray never widens it past the screen */
.comp .box { display: flex; align-items: flex-end; gap: 6px; }
.comp .box .btn-ic { flex: none; }
.comp .fld { flex: 1; min-width: 0; min-height: 44px; border-radius: 22px; padding: 0 16px; }
.comp textarea { padding: 10px 0; max-height: 168px; line-height: 22px; }
.send:disabled { opacity: .45; }
.send.stop .ic { fill: currentColor; stroke: none; }
.queue { display: grid; gap: 6px; padding: 4px 4px 0; min-width: 0; }
.queue[hidden] { display: none; }
.queue-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px 0; }
.queue-r { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 2px 0 12px; border-radius: 16px; background: var(--field); color: var(--tx2); min-width: 0; }
.queue-r .truncate { flex: 1; min-width: 0; color: var(--tx); }
.queue-r .btn-ic, .queue-r > .ic { flex: none; }
.queue-more { padding: 0 12px 2px; }
.kbd { display: none; text-align: center; font: 500 12px/16px var(--f); color: var(--tx3); }
@media (pointer: fine) { .kbd { display: block; } }
/* Plan mode (claude_app/planmode.py): the switch above the box (Sviluppo | Piano), the steel-blue ring and the words of the composer while the project is in it, and what says so elsewhere
   (the word in the status line, the tag under an answer, the buttons under a plan). Steel, not the coral of the work: Plan mode is the calm one, and the word is always there beside the colour. */
.modebar { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 4px; }
.modebar[hidden], .modehint[hidden] { display: none; }
.modebar .seg { flex: none; padding: 3px; border-radius: 16px; }
.modebar .seg > * { height: 32px; padding: 0 14px; border-radius: 13px; font-size: 13px; gap: 5px; }
.modebar .seg .ic { width: 16px; height: 16px; flex: none; }
.modehint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 380px) { .modehint { display: none; } }          /* (on the narrowest phones the switch, the ring and the words of the box already say it) */
.comp textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp.plan { box-shadow: var(--sh2), 0 0 0 1.5px var(--steel), inset 0 1px 0 var(--glass-hi); }
.comp.plan .modebar .seg > .on { color: var(--steel); }
.planmark { color: var(--steel); font-weight: 600; }
.mfoot .tag.plan { background: var(--steel-soft); color: var(--steel); }
.plan-ask { display: grid; gap: 10px; margin: 2px 0 4px; padding: 12px 14px; border-radius: 18px; background: var(--steel-soft); animation: msgin 340ms var(--ease); }
.plan-q { color: var(--tx); font-weight: 600; }
.plan-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.chat.dropping::after { content: 'Rilascia qui per allegare'; position: absolute; inset: 8px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--acc); border-radius: 20px; background: var(--acc-soft); color: var(--acc-tx); font-weight: 700; pointer-events: none; opacity: .94; }
/* the files of a message: the tray above the box ... */
.tray { display: flex; gap: 12px; overflow-x: auto; padding: 12px 8px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tray::-webkit-scrollbar { display: none; }
.tray[hidden] { display: none; }
/* the row scrolls sideways by finger, wheel, drag and arrows (js/trayscroll.js); where something is hidden at an edge the row fades there, and says «continues» on a phone too */
.trayw { min-width: 0; }
.trayw[hidden] { display: none; }
.trayrow { position: relative; min-width: 0; }
.tray.can-l.can-r { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 30px, #000 calc(100% - 30px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 30px, #000 calc(100% - 30px), transparent 100%); }
.tray.can-l:not(.can-r) { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 30px); mask-image: linear-gradient(to right, transparent 0, #000 30px); }
.tray.can-r:not(.can-l) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent 100%); mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent 100%); }
.tray.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.tray-nav { position: absolute; top: 50%; z-index: 2; width: 32px; height: 32px; margin-top: -16px; display: none; place-items: center; padding: 0; border-radius: 50%; background: var(--surf); color: var(--tx); border: 1px solid var(--line2); box-shadow: var(--sh1); cursor: pointer; }
.tray-nav.l { left: 2px; }
.tray-nav.r { right: 2px; }
.tray-nav:hover { background: var(--surf2); }
.tray-nav[hidden] { display: none !important; }
@media (hover: hover) and (pointer: fine) {                            /* the arrows and the hand are for a mouse: on a phone they would cover the tiles, and the finger already scrolls */
  .tray-nav { display: grid; }
  .tray.overflows { cursor: grab; }
}
/* ... the line under the tiles: how all the files are doing together (js/attachments.js, attach.js overallLine) */
.att-all { display: grid; gap: 5px; padding: 0 12px 8px; }
.att-all[hidden] { display: none; }
.att-all-line { display: flex; justify-content: space-between; gap: 12px; color: var(--tx3); }
.att-all-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-all-r { flex: none; }
.att-all.error .att-all-l { color: var(--crit); }
.att-all-bar { display: block; height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.att-all-bar[hidden] { display: none; }
.att-all-bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .2s linear; }
@media (max-width: 359px) { .att-all-r { display: none; } }
.att { position: relative; flex: none; }
.att-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-pic .att-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.att-pic .att-bar i { display: block; height: 100%; width: 0; background: #fff; transition: width .2s linear; }
.att-wide { width: 150px; display: flex; align-items: center; padding: 0 12px 0 10px; background: var(--field); }
.att-file { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.att-file .cell-i { width: 34px; height: 34px; }
.att-txt { min-width: 0; flex: 1; }
.att-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-wide .att-bar { display: block; height: 4px; margin-top: 5px; border-radius: 2px; background: var(--track); overflow: hidden; }
.att-wide .att-bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .2s linear; }
.att-bar[hidden] { display: none; }
.att-retry { display: none; }
.att[data-status="queued"] .att-img, .att[data-status="uploading"] .att-img { opacity: .6; }
.att[data-status="error"] { background: var(--crit-soft); box-shadow: 0 0 0 1.5px var(--crit-f); cursor: pointer; }
.att[data-status="error"] .att-img { opacity: .25; }
.att[data-status="error"] .att-retry { position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px/1 var(--f); color: var(--crit); }
.att[data-status="error"] .att-file { visibility: hidden; }
/* ... and what a sent message shows */
.ftiles { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: 6px; margin-bottom: 6px; white-space: normal; }
.ftiles:last-child { margin-bottom: 0; }
.ftile.image { position: relative; flex: none; width: 132px; height: 132px; padding: 0; border-radius: 14px; overflow: hidden; background: var(--bg2); }
.ftile.image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ftile.image.broken::after { content: ''; position: absolute; inset: 0; background: var(--track); }
.ftile.file { min-height: 0; display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px; border-radius: 14px; background: var(--surf); border: 1px solid var(--line); color: var(--tx2); }
.ftxt { display: grid; min-width: 0; text-align: left; }
.fname { color: var(--tx); font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { font-size: 13px; color: var(--tx2); }
/* Claude's text: rendered markdown (the paragraph, code and bold of Orbita's .mc, and the rest here) */
.md { overflow-wrap: anywhere; }
/* What was said can be selected and copied (a long press on the phone). Telegram's own web view on iOS turns text selection off for the whole page (every element, not only the body), so the words turn it
   back on, on every element of theirs (!important: how the host writes its rule is not known, and these selectors are the more specific); the buttons and pictures inside stay plain taps. */
.thread .turn .md, .thread .turn .md *, .thread .turn .mu, .thread .turn .mu *, .thread .tnote, .thread .tnote * { -webkit-user-select: text !important; user-select: text !important; -webkit-touch-callout: default; }
.thread .turn .md button, .thread .turn .md button *, .thread .turn .md [role="button"], .thread .turn .md [role="button"] *, .thread .turn .md .code-h, .thread .turn .md .code-h *,
.thread .turn .mu button, .thread .turn .mu button *, .thread .tnote button, .thread .tnote button * { -webkit-user-select: none !important; user-select: none !important; }
.md > * + * { margin-top: .75em; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; font-weight: 700; margin-top: 1.25em; letter-spacing: -.005em; }
.md h1 { font-size: 1.28em; } .md h2 { font-size: 1.16em; } .md h3 { font-size: 1.05em; } .md h4 { font-size: 1em; color: var(--tx2); }
.md ul, .md ol { padding-left: 1.45em; display: grid; gap: .3em; margin-bottom: 0; }
.md li > ul, .md li > ol { margin-top: .3em; }
.md li::marker { color: var(--tx3); }
.md blockquote { margin-left: 0; padding: .1em 0 .1em 1em; border-left: 3px solid var(--acc-line); color: var(--tx2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.md a { word-break: break-word; }
/* the name of a file of the project in an answer: a tap downloads it (js/filechip.js). In the accent colour, with the arrow of a download; one that was written as code keeps the look of code */
.fref { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 26px; padding: 1px 8px 1px 6px; border-radius: 8px; background: var(--acc-soft); color: var(--acc-tx); box-shadow: inset 0 0 0 1px var(--acc-line);
  font: inherit; text-align: left; overflow-wrap: anywhere; vertical-align: baseline; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fref .ic { flex: none; width: 14px; height: 14px; }
.fref.code { font: 500 13.5px/1.35 var(--m); }
.fref.quiet { background: var(--field); box-shadow: inset 0 0 0 1px var(--line); color: var(--tx); }
.fref.quiet .ic { color: var(--acc-tx); }
.fref:active { filter: brightness(.94); }
.code.codeblock pre { overflow: auto; tab-size: 2; }
.code.codeblock pre code { font: inherit; padding: 0; border: 0; background: none; border-radius: 0; }
.code-h { text-transform: uppercase; }
.code-h .btn-ic { width: 40px; height: 40px; margin: 0; }
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
.md table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 15px; overflow-wrap: normal; word-break: normal; }
.md th, .md td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { background: var(--field); font-weight: 700; white-space: nowrap; }
.md td { min-width: 6em; }
.md tr:last-child td { border-bottom: 0; }
/* A picture of an answer: the box has the picture's shape (--w and --h, its size in pixels, from the server) before the picture arrives, so nothing moves when it does; no taller than 440 px,
   no wider than the column or than the picture itself. Without a size (the answer being written) it is 4:3 until the picture is there. */
.fig { margin: 0; display: grid; gap: 6px; justify-items: start; }
.fig .figbox { position: relative; overflow: hidden; width: min(100%, calc(var(--w) * 1px), calc(440px * var(--w) / var(--h))); aspect-ratio: var(--w) / var(--h); border-radius: 18px; cursor: zoom-in; background: var(--field); box-shadow: 0 0 0 1px var(--line2), var(--sh1); }
.fig .figbox.guess { width: min(100%, 380px); aspect-ratio: 4 / 3; }
.fig .figbox.loading { background: var(--bg2); }
.fig .figbox img { display: block; width: 100%; height: 100%; object-fit: contain; }
.md.streaming > :last-child:not(.codeblock):not(.tablewrap)::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--acc); vertical-align: middle; animation: pulse 1.8s var(--ease) infinite; }
