/* The /chat page: sign-in and the conversation workspace. */

/* Sign-in: the form beside a dark tile where the product shows itself working. */
.login-screen { display: grid; grid-template-columns: minmax(0, 1fr); min-block-size: 100dvh; }
.login-panel { display: flex; flex-direction: column; min-inline-size: 0; padding: var(--space-4) var(--gutter) var(--space-6); }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.locale-row { position: relative; flex: none; }
.locale-selector { inline-size: auto; min-inline-size: 96px; min-block-size: 36px; padding-block: 0; padding-inline-start: var(--space-3); border-radius: var(--radius-full); box-shadow: none; background-color: var(--color-fill); font-size: var(--text-footnote); }
.locale-selector:hover { box-shadow: none; background-color: var(--color-fill-strong); }
.locale-status { position: absolute; inset-block-start: 100%; inset-inline-end: 0; inline-size: max-content; max-inline-size: 240px; margin-block-start: var(--space-1); font-size: var(--text-caption); }
:root[data-login-returning] .login-card { visibility: hidden; }
.login-card { display: grid; gap: var(--space-3); inline-size: min(100%, 400px); margin: clamp(var(--space-8), 10dvh, 96px) auto auto; padding-block: var(--space-8); animation: rise var(--motion-slow) var(--ease-out); }

/* Steps push like iOS views: the next one comes in from the trailing side and the height follows. */
/* Clipped so waiting steps add no scroll; the padding keeps room for focus rings and the shake. */
.login-steps { --travel: -32px; --room: 12px; position: relative; margin: calc(-1 * var(--room)); padding: var(--room); overflow: clip; transition: block-size var(--motion-slow) var(--spring); }
[dir="ltr"] .login-steps { --travel: 32px; }
.login-step {
  display: grid; align-content: start; gap: var(--space-3); inline-size: 100%;
  transition: opacity var(--motion-base) ease, transform var(--motion-slow) var(--spring), visibility 0s;
}
.login-step:not(.is-active) {
  position: absolute; inset-block-start: var(--room); inset-inline: var(--room); inline-size: auto; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--motion-fast) ease, transform var(--motion-base) var(--ease-out), visibility var(--motion-base);
}
.login-step.is-after { transform: translateX(var(--travel)); }
.login-step.is-before { transform: translateX(calc(var(--travel) * -1)); }
.login-step h1 { font-size: var(--text-large); }
.login-step h2 { font-size: var(--text-title1); font-weight: var(--weight-bold); }
.subtitle { color: var(--color-muted); }
.login-card .button:not(.resend) { min-block-size: 50px; font-size: var(--text-body); }
.login-card input:not([type="checkbox"]) { min-block-size: 50px; }
#otp-fields.hidden, #email-code-fields.hidden { display: grid !important; }
.code-fields { display: grid; gap: var(--space-3); margin-block-start: var(--space-2); }
.code-target { display: inline-block; color: var(--color-ink); font-weight: var(--weight-medium); font-variant-numeric: var(--numeric); unicode-bidi: isolate; overflow-wrap: anywhere; }
.code-back {
  display: inline-flex; align-items: center; gap: var(--space-1); justify-self: start; min-block-size: 36px; padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2); margin-inline-start: calc(-1 * var(--space-2)); border: 0; border-radius: var(--radius-full); background: transparent; color: var(--color-accent); font-size: var(--text-subhead);
  transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.code-back:hover { background: var(--color-accent-soft); }
[dir="ltr"] .code-back .icon { transform: scaleX(-1); }
@media (hover: hover) and (pointer: fine) {
  .code-back:hover .icon { transform: translateX(2px); }
  [dir="ltr"] .code-back:hover .icon { transform: scaleX(-1) translateX(2px); }
}
.code-back:active { transform: scale(.96); }
/* On the code steps the send button turns into a quiet link. */
.resend-slot:empty { display: none; }
.resend-slot { justify-self: center; }
.resend-slot .button, .resend-slot .button:hover:not(:disabled) { inline-size: auto; min-block-size: 40px; background: transparent; box-shadow: none; color: var(--color-accent); font-size: var(--text-subhead); font-weight: var(--weight-regular); transform: none; }
@media (pointer: coarse) { .locale-selector, .code-back, .resend-slot .button, .resend-slot .button:hover:not(:disabled) { min-block-size: 44px; } }
.resend-slot .button:active:not(:disabled) { transform: scale(.96); }
.resend-slot .button:disabled { color: var(--color-muted); }
.code-timer { display: grid; gap: var(--space-1); justify-items: center; color: var(--color-muted); font-size: var(--text-caption); font-variant-numeric: var(--numeric); }
.code-timer-bar { display: block; inline-size: 100%; block-size: 3px; overflow: hidden; border-radius: var(--radius-full); background: var(--color-fill); }
.code-timer-bar i { display: block; block-size: 100%; border-radius: inherit; background: var(--color-accent-fill); transform-origin: right; transition: transform 1s linear; }
[dir="ltr"] .code-timer-bar i { transform-origin: left; }
.code-timer.is-expired { color: var(--color-danger); }
.code-timer.is-expired .code-timer-bar { display: none; }
/* "Code sent" is already what this step says; screen readers still hear it. */
.login-card[data-step="phone-code"] #login-status.success { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }

/* Method tabs and panes */
.method-tabs { margin-block-end: var(--space-1); animation: rise var(--motion-base) var(--spring); }
.method-pane { display: none; gap: var(--space-2); }
.method-pane.is-active { display: grid; animation: pane-in var(--motion-base) var(--ease-out); }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } }
/* With tabs the field's name is already on screen; the label stays for assistive tech. */
.login-card:has(#method-tabs:not([hidden])) .method-pane > label { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.send-slot { display: block; margin-block-start: var(--space-1); }
.field-box { position: relative; display: block; }
.field-check {
  position: absolute; inset-block-start: 50%; right: var(--space-3); display: grid; place-items: center; inline-size: 24px; block-size: 24px; margin-block-start: -12px; border-radius: 50%; background: var(--color-switch-on); color: #fff; pointer-events: none;
  opacity: 0; transform: scale(.4); transition: opacity var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.field-check .icon { stroke-width: 3; }
.field-box.is-valid .field-check { opacity: 1; transform: none; }
.field-box.is-valid input { padding-inline-end: 44px; }
[dir="rtl"] .field-box.is-valid input { padding-inline: var(--space-4) 44px; }
.field-box.is-shaking { animation: shake .44s var(--ease-out); }
.email-suggestions { display: flex; flex-wrap: wrap; gap: var(--space-1); min-block-size: 32px; direction: ltr; }
[dir="rtl"] .email-suggestions { justify-content: flex-end; }
.email-chip {
  min-block-size: 32px; padding: var(--space-1) var(--space-3); border: 0; border-radius: var(--radius-full); background: var(--color-fill); color: var(--color-ink); font-size: var(--text-caption);
  transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
  animation: pop var(--motion-base) var(--spring-bouncy) calc(var(--i) * 30ms) backwards;
}
.email-chip:hover { background: var(--color-fill-strong); }
.email-chip:active { transform: scale(.94); }
.email-chip.is-fix { background: var(--color-warning-soft); color: var(--color-warning); }

/* Other ways in */
.alt-sign-in { display: grid; gap: var(--space-3); margin-block-start: var(--space-2); animation: rise var(--motion-base) var(--spring); }
.alt-sign-in:not(:has(#google-login-btn:not([hidden]))) { display: none; }
.alt-divider { display: flex; align-items: center; gap: var(--space-3); color: var(--color-muted); font-size: var(--text-caption); }
.alt-divider::before, .alt-divider::after { content: ""; flex: 1; block-size: 1px; background: var(--color-separator); }
.button.google-button { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-separator); font-weight: var(--weight-medium); }
.button.google-button:hover:not(:disabled) { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-muted), var(--shadow-float); }
.google-g { flex: none; transition: transform var(--motion-base) var(--spring-bouncy); }
@media (hover: hover) and (pointer: fine) { .google-button:hover .google-g { transform: rotate(-12deg) scale(1.1); } }
.step-finishing { justify-items: center; gap: var(--space-4); padding-block: var(--space-12); color: var(--color-muted); }
.finishing-spinner { inline-size: 36px; block-size: 36px; }
.login-links { display: grid; gap: var(--space-1); padding: var(--space-1); margin-block-start: var(--space-2); border-radius: var(--radius-lg); background: var(--color-fill); }
.login-links .nav-row { min-block-size: 48px; padding: var(--space-3); font-size: var(--text-subhead); line-height: 1.6; }
.login-link-label { flex: 1; min-inline-size: 0; }
.login-link-symbol, .login-link-chevron { display: inline-flex; flex: none; color: var(--color-muted); }
.login-link-symbol .icon { inline-size: 20px; block-size: 20px; }
[dir="ltr"] .login-link-chevron { transform: scaleX(-1); }
#otp-retry-status { text-align: center; }
.login-card[data-step="finishing"] #login-status:not(.error) { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }

.login-stage { display: none; }
@media (min-width: 900px) {
  .login-screen { grid-template-columns: minmax(420px, 1fr) minmax(0, 1.25fr); }
  /* After dark the stage has a few stars; they are painted once and never move. */
  :root[data-daypart="night"] .login-stage::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .8;
    background-image: radial-gradient(1.5px 1.5px at 12% 22%, #fff, transparent), radial-gradient(1px 1px at 28% 48%, #fff, transparent), radial-gradient(1.5px 1.5px at 44% 14%, #fff, transparent), radial-gradient(1px 1px at 63% 36%, #fff, transparent), radial-gradient(1.5px 1.5px at 78% 58%, #fff, transparent), radial-gradient(1px 1px at 91% 19%, #fff, transparent), radial-gradient(1px 1px at 18% 72%, #fff, transparent), radial-gradient(1.5px 1.5px at 56% 66%, #fff, transparent); /* taste-skill-ignore */
  }
  .login-panel { padding: var(--space-6) var(--space-12); }
  .login-card { margin-block: auto; }
  .login-stage {
    display: flex; flex-direction: column; justify-content: center; gap: var(--space-8); min-inline-size: 0; margin: var(--float-gap); margin-inline-start: 0; padding: var(--space-12);
    position: relative; overflow: hidden; border-radius: var(--radius-xl); background: var(--stage); color: #fff;
    animation: fade var(--motion-slow) ease;
  }
}
.login-statement { font-size: var(--text-display); font-weight: var(--weight-bold); line-height: 1.2; text-wrap: balance; animation: rise var(--motion-slow) var(--ease-out) calc(var(--motion-slow) * .8) backwards; }
/* The brand mark leads the stage in white: it arrives once, then the statement rises under it. */
.stage-mark { display: block; inline-size: 56px; block-size: 56px; margin-block-end: calc(var(--space-4) * -1); }
.stage-mark .brand-logo { display: none; }
.stage-mark .brand-svg { inline-size: 100%; block-size: 100%; }
.stage-mark .nuqta-half path { fill: #fff; }
/* With a mouse, the stage's tile catches the light where the pointer is, as if lit by a lamp. Nothing moves by itself. */
.login-stage { isolation: isolate; }
.stage-light {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: var(--tile), var(--tile), var(--tile); /* taste-skill-ignore */
  -webkit-mask: radial-gradient(260px circle at var(--light-x, 50%) var(--light-y, 50%), #000, transparent 72%); /* taste-skill-ignore */
  mask: radial-gradient(260px circle at var(--light-x, 50%) var(--light-y, 50%), #000, transparent 72%); /* taste-skill-ignore */
  transition: opacity var(--motion-slow) var(--ease-out);
}
.login-stage.is-lit .stage-light { opacity: 1; }
@media (prefers-contrast: more) { .stage-light { display: none; } }
.demo-chat { display: flex; flex-direction: column; justify-content: flex-start; gap: var(--space-3); min-block-size: 280px; max-inline-size: 560px; inline-size: 100%; margin-inline-end: auto; font-size: var(--text-body); line-height: 1.7; }
.demo-bubble { align-self: flex-start; max-inline-size: 86%; padding: var(--space-2) var(--space-4); border-radius: 20px; border-end-start-radius: 6px; background: rgb(255 255 255 / 92%); color: #1d1d1f; transform-origin: bottom; animation: bubble-in var(--motion-slow) var(--spring); }
.demo-bubble.is-user { align-self: flex-end; border-end-start-radius: 20px; border-end-end-radius: 6px; background: var(--fill-accent); color: #fff; }
.demo-typing { inline-size: 62px; block-size: 42px; padding: 0; }
.demo-typing::before {
  content: ""; display: block; inline-size: 30px; block-size: 100%; margin-inline: auto; color: currentColor; opacity: .7;
  background: currentColor; /* three brand nuqtas, drawn by the mask */
  -webkit-mask: var(--nuqta-dot) 0 50% / 8px 9px no-repeat, var(--nuqta-dot) 50% 50% / 8px 9px no-repeat, var(--nuqta-dot) 100% 50% / 8px 9px no-repeat;
  mask: var(--nuqta-dot) 0 50% / 8px 9px no-repeat, var(--nuqta-dot) 50% 50% / 8px 9px no-repeat, var(--nuqta-dot) 100% 50% / 8px 9px no-repeat;
  animation: typing 1.1s var(--ease-in-out) infinite;
}
@keyframes typing {
  0%, 100% { -webkit-mask-position: 0 50%, 50% 50%, 100% 50%; mask-position: 0 50%, 50% 50%, 100% 50%; }
  20% { -webkit-mask-position: 0 25%, 50% 50%, 100% 50%; mask-position: 0 25%, 50% 50%, 100% 50%; }
  40% { -webkit-mask-position: 0 50%, 50% 25%, 100% 50%; mask-position: 0 50%, 50% 25%, 100% 50%; }
  60% { -webkit-mask-position: 0 50%, 50% 50%, 100% 25%; mask-position: 0 50%, 50% 50%, 100% 25%; }
}

/* Workspace: the sidebar floats; the conversation runs edge to edge beneath the controls. */
.app-shell { block-size: var(--chat-viewport-height, 100dvh); overflow: hidden; }
.app-shell:not(.hidden) { animation: app-in var(--motion-slow) var(--ease-out); }
/* Entry opacity leaves viewport-positioned composer menus in viewport coordinates. */
@keyframes app-in { from { opacity: 0; } }
.workspace { position: relative; block-size: 100%; }

.sidebar { visibility: hidden; transform: translateX(var(--off)); touch-action: pan-y; transition: transform var(--motion-base) var(--ease-out), visibility var(--motion-base); }
/* Visibility flips at once on open: state.js moves focus into the drawer in the same tick. */
.sidebar.is-open { visibility: visible; transform: none; transition: transform var(--motion-slow) var(--spring), visibility 0s; }
.workspace::after {
  content: ""; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); visibility: hidden; opacity: 0; pointer-events: none;
  background: var(--color-scrim); transition: opacity var(--motion-base) var(--ease-out), visibility 0s var(--motion-base);
}
.workspace:has(.sidebar.is-open)::after { visibility: visible; opacity: 1; pointer-events: auto; transition: opacity var(--motion-slow) var(--ease-out), visibility 0s; }
/* While the drawer follows a finger, its scrim follows too (ui/workspace-live.js sets --scrim). */
.workspace.is-dragging::after, .workspace.is-dragging:has(.sidebar.is-open)::after { visibility: visible; opacity: var(--scrim, 0); transition: none; }
/* Matches MOBILE_SIDEBAR_QUERY in state.js. */
@media (min-width: 900px) {
  .sidebar { visibility: visible; transform: none; transition: transform var(--motion-slow) var(--spring), visibility 0s; }
  .workspace.is-sidebar-collapsed .sidebar { visibility: hidden; transform: translateX(var(--off)); transition: transform var(--motion-base) var(--ease-out), visibility var(--motion-base); }
  .sidebar-close { display: none !important; }
  .chat-panel { --drop-offset: calc(var(--sidebar-width) + var(--float-gap)); padding-inline-start: var(--drop-offset); }
  .workspace.is-sidebar-collapsed .chat-panel { --drop-offset: 0px; padding-inline-start: 0; }
  .workspace::after { display: none; }
}
.sidebar-keys { display: grid; gap: 2px; flex: none; }
.history-pull {
  position: absolute; inset-inline-start: calc(50% - 11px); z-index: 1; inline-size: 22px; block-size: 22px; border-radius: 50%; opacity: 0; pointer-events: none; background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--nuqta-wait); mask: var(--nuqta-wait); /* taste-skill-ignore */
}
.sidebar.is-refreshing .history-pull { opacity: 1; animation: nuqta-wait 1.1s var(--ease-in-out) infinite; }
/* No specificity, so a row's own press scale still wins while it is held. */
:where(#conversation-list) > * { transform: translateY(var(--pull, 0)); transition: transform var(--motion-base) var(--ease-out), background-color var(--motion-fast) ease; }
#conversation-list.is-pulling > * { transition: none; }
.sidebar.is-refreshing #conversation-list { --pull: 36px; }
.sidebar.is-refreshing #history-load-status:not(.error) { display: none; }
.history-search { display: grid; gap: var(--space-1); flex: none; margin-block: var(--space-2) var(--space-1); }
.history-search > .text-button, #more-conversations-btn { inline-size: 100%; min-block-size: var(--control-height); border-radius: var(--radius-full); background: var(--color-accent-soft); color: var(--color-accent); font-size: var(--text-caption); font-weight: var(--weight-medium); }
#history-archive-toggle { align-self: stretch; justify-content: start; gap: var(--space-2); margin-block: var(--space-1); padding-inline: var(--space-3); border-radius: var(--radius-sm); background: transparent; color: var(--color-muted); font-size: var(--text-caption); }
#history-archive-toggle::before { content: ""; inline-size: 16px; block-size: 16px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 9h16v11H4zM3 4h18v5H3zM9 13h6'/%3E%3C/svg%3E") center / contain no-repeat; }
#history-archive-toggle[aria-pressed="true"] { background: var(--color-accent-soft); }
.history-search-controls { position: relative; display: flex; align-items: center; color: var(--color-muted); }
.history-search-controls > .icon { position: absolute; inset-inline-start: var(--space-3); pointer-events: none; }
#history-search { min-block-size: 36px; padding-inline: 36px; border-radius: var(--radius-sm); box-shadow: none; background: var(--color-fill); font-size: var(--text-subhead); }
#history-search::-webkit-search-cancel-button { display: none; }
@media (pointer: coarse) { #history-search { min-block-size: 44px; } }
#history-search:focus-visible { background: var(--color-surface); box-shadow: 0 0 0 1.5px var(--color-accent), 0 0 0 4px var(--color-accent-soft); }
/* The shortcut, for those who can use it, until they start typing. */
.history-search-controls:has(#history-search:focus, #history-search:not(:placeholder-shown))::after { display: none; }
.history-search-controls .button.icon-button { position: absolute; inset-inline-end: 2px; inline-size: 32px; min-block-size: 32px; }
/* An empty list carries its own note: no second copy under it, and the retry sits right beside it. */
.conversation-list:has(> .history-empty) { flex: none; }
.conversation-list:has(> .history-empty) + #history-load-status { display: none; }
@media (pointer: coarse) { .context-more summary { min-block-size: 44px; } }
#sidebar-status:not(.error, .success, .warning) { padding-inline: var(--space-2); color: var(--color-muted); font-size: var(--text-caption); }
.conversation-list { flex: 1; min-block-size: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 1px; margin-inline: calc(-1 * var(--space-1)); padding: 0 var(--space-1) var(--space-3); }
.conversation-list > .history-group:first-child { padding-block-start: var(--space-2); }
.conversation-list {
  scrollbar-color: transparent transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); /* taste-skill-ignore */
}
/* The list has a fixed height, so auto rows would stop at each row's min-block-size and a wrapped title would draw over the next row. */
.conversation-list { grid-auto-rows: max-content; }
.conversation-list:hover, .conversation-list:focus-within { scrollbar-color: var(--color-fill-strong) transparent; }
.history-group { padding: var(--space-4) var(--space-2) var(--space-1); color: var(--color-muted); font-size: var(--text-caption); font-weight: var(--weight-medium); }
.conversation-item {
  display: block; inline-size: 100%; min-inline-size: 0; min-block-size: 36px; padding: var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-ink); text-align: start; transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.conversation-item:hover { background: var(--color-fill); }
.conversation-item:active { transform: scale(.98); }
.conversation-item.active { background: color-mix(in srgb, var(--color-accent) 13%, transparent); }
.conversation-item strong { display: block; overflow: hidden; font-size: var(--text-footnote); font-weight: var(--weight-regular); line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; text-align: match-parent; }
.conversation-item.active strong { font-weight: var(--weight-strong); }
/* In the phone drawer a title takes up to two lines, then an ellipsis; the row's tooltip keeps it whole. */
@media (max-width: 899px) {
  .conversation-item strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; text-wrap: pretty; }
  /* Chrome drops the clamp's ellipsis when right-to-left lines are aligned left, so a Persian title in the English panel aligns to its own start inside a box that still sits on the left. */
  :root[dir="ltr"] .conversation-item strong:dir(rtl) { flex: 0 1 auto; inline-size: fit-content; max-inline-size: 100%; text-align: start; }
}
.conversation-item small { display: none; }
/* A reply is still being written in this conversation, here or in the background; the dot leads so the row menu never covers it. */
.conversation-item.is-writing { display: flex; align-items: center; gap: var(--space-2); }
.conversation-item.is-writing strong { flex: 1; min-inline-size: 0; }
.conversation-writing { order: -1; flex: none; inline-size: 8px; block-size: 8px; border-radius: var(--radius-full); background: var(--color-accent); animation: writing-pulse 1.1s ease-in-out infinite alternate; }
@keyframes writing-pulse { from { opacity: .35; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .conversation-writing { animation: none; } }
:root[data-motion="reduce"] .conversation-writing { animation: none; }
@media (pointer: coarse) {
  .nav-row { min-block-size: 44px; display: flex; align-items: center; }
  /* One column, so a search excerpt sits under the title instead of squeezing it to nothing. */
  .conversation-item { min-block-size: 44px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; }
}
.history-empty { padding: var(--space-2); }
.history-load-status { padding-inline: var(--space-2); }
#more-conversations-btn { align-self: flex-start; }

.chat-panel { position: relative; display: flex; flex-direction: column; block-size: 100%; min-inline-size: 0; }
/* The toolbar floats; replies scroll beneath it and fade out before they reach it. */
.chat-toolbar {
  position: absolute; inset-block-start: 0; inset-inline: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--space-2);
  padding: max(var(--space-3), env(safe-area-inset-top)) var(--space-3) var(--space-2); pointer-events: none;
}
@media (min-width: 900px) {
  .chat-toolbar { inset-inline-start: calc(var(--sidebar-width) + var(--float-gap)); }
  .workspace.is-sidebar-collapsed .chat-toolbar { inset-inline-start: 0; }
}
.chat-toolbar > * { pointer-events: auto; }
/* Floating controls look the same over any sky: near-solid material with a hairline. */
.chat-toolbar .button.glass { flex: none; inline-size: var(--disc); min-block-size: var(--disc); border-radius: 50%; background: var(--material-solid); box-shadow: var(--hairline), var(--shadow-card); }
#conversation-title {
  flex: 0 1 auto; min-inline-size: 0; margin-inline: auto; padding: var(--space-2) var(--space-4); overflow: hidden; border-radius: var(--radius-full);
  font-size: var(--text-footnote); font-weight: var(--weight-medium); white-space: nowrap; text-overflow: ellipsis; animation: fade var(--motion-base) ease;
}
/* On a phone the title may take two lines, so most titles read whole between the two buttons. */
@media (max-width: 599px) {
  #conversation-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; text-align: center; text-wrap: balance; line-height: 1.4; padding-block: var(--space-1); border-radius: var(--radius-lg); }
}

.chat-panel:has(.empty-conversation) #conversation-title { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); box-shadow: none; }
.chat-panel:has(.empty-conversation) #conversation-actions { display: none; }

/* Conversation column; a new chat centres its greeting and composer. */
.conversation-column { flex: 1; display: flex; flex-direction: column; min-block-size: 0; min-inline-size: 0; }
.conversation-column:has(.empty-conversation) { position: relative; isolation: isolate; justify-content: center; justify-content: safe center; overflow-y: auto; padding-block-start: 64px; }
.conversation-column:has(.empty-conversation)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(36% 34% at 60% 42%, var(--sky-a), transparent 72%), radial-gradient(32% 30% at 40% 58%, var(--sky-b), transparent 72%); /* taste-skill-ignore */
  animation: sky-breathe 11s ease-in-out infinite alternate;
}
/* A dome of Persian tile rising behind the composer, in the assistant's light. Painted once; it only brightens as you write. It stays clear of the words: an open middle above, nothing below. */
.conversation-column:has(.empty-conversation)::after {
  --dome-y: 50%; --dome-size: min(88%, 800px); --dome-r: min(44vw, 400px);
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .28;
  background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--medallion) 50% var(--dome-y) / var(--dome-size) auto no-repeat, radial-gradient(circle var(--dome-r) at 50% var(--dome-y), transparent 63%, #000 67%), linear-gradient(#000 var(--dome-y), transparent calc(var(--dome-y) + 2%)); /* taste-skill-ignore */
  mask: var(--medallion) 50% var(--dome-y) / var(--dome-size) auto no-repeat, radial-gradient(circle var(--dome-r) at 50% var(--dome-y), transparent 63%, #000 67%), linear-gradient(#000 var(--dome-y), transparent calc(var(--dome-y) + 2%)); /* taste-skill-ignore */
  -webkit-mask-composite: source-in; mask-composite: intersect;
  transition: opacity var(--motion-slow) var(--ease-out);
}
.conversation-column:has(.empty-conversation):has(#message-input:not(:placeholder-shown))::after { opacity: .45; }
@media (max-width: 899px) { .conversation-column:has(.empty-conversation)::after { --dome-y: 42%; --dome-size: 150%; --dome-r: 75vw; } }
:root[data-theme="dark"] .conversation-column:has(.empty-conversation)::after { opacity: .42; }
:root[data-theme="dark"] .conversation-column:has(.empty-conversation):has(#message-input:not(:placeholder-shown))::after { opacity: .75; }
@media (prefers-contrast: more) { .conversation-column:has(.empty-conversation)::after { display: none; } }
@keyframes sky-breathe { from { opacity: .6; transform: scale(.92); } to { opacity: 1; transform: none; } }
.message-stage { position: relative; flex: 1; display: flex; flex-direction: column; min-block-size: 0; }
.conversation-column:has(.empty-conversation) .message-stage { flex: none; }
.older-messages { position: absolute; inset-block-start: 68px; inset-inline-start: 50%; z-index: 1; translate: 50% 0; opacity: 0; pointer-events: none; }
.older-messages:focus-visible, .older-messages.is-failed { opacity: 1; pointer-events: auto; }
.older-messages.is-loading { opacity: 1; inline-size: 40px; padding: 0; font-size: 0; background: var(--material-solid); box-shadow: var(--hairline), var(--shadow-float); }
.older-messages.is-loading::before {
  content: ""; position: static; inline-size: 20px; block-size: 20px; margin: 0; border: 0; border-radius: 50%; background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--nuqta-wait); mask: var(--nuqta-wait); /* taste-skill-ignore */
  animation: nuqta-wait 1.1s var(--ease-in-out) infinite;
}
[dir="ltr"] .older-messages { translate: -50% 0; }
.messages {
  flex: 1; min-block-size: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 76px max(var(--gutter), calc((100% - var(--measure)) / 2)) var(--space-6);
  -webkit-mask-image: linear-gradient(to bottom, transparent 40px, #000 88px, #000 calc(100% - 20px), transparent); /* taste-skill-ignore */
  mask-image: linear-gradient(to bottom, transparent 40px, #000 88px, #000 calc(100% - 20px), transparent); /* taste-skill-ignore */
}
@media (pointer: coarse) { .messages { scrollbar-width: none; } }
.conversation-column:has(.empty-conversation) .messages { flex: none; overflow: visible; padding-block: 0 var(--space-8); -webkit-mask-image: none; mask-image: none; }

.empty-conversation { text-align: center; }
/* The mark leads a new chat, as the assistant's own face: the brand nuqta in the assistant's light. It joins as the
   screen opens; while you write its halves part a little and its light turns, listening. Owner request, 15 Nov 2026. */
.empty-conversation::before {
  content: ""; display: block; inline-size: 64px; block-size: 64px; margin: 0 auto var(--space-4);
  background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--nuqta-wait); mask: var(--nuqta-wait); /* taste-skill-ignore */
  transition: -webkit-mask-position var(--motion-slow) var(--spring), mask-position var(--motion-slow) var(--spring);
  animation: nuqta-join calc(var(--motion-slow) * 2) var(--ease-out) backwards, glow-turn 6s linear infinite paused;
}
.conversation-column:has(#message-input:not(:placeholder-shown)) .empty-conversation::before {
  -webkit-mask-position: 36% 51%, 64% 49%; mask-position: 36% 51%, 64% 49%; animation-play-state: running;
}
.workspace-kicker { margin-block-end: var(--space-2); color: var(--sky-ink); font-size: var(--text-title3); font-weight: var(--weight-medium); line-height: var(--leading-tight); text-wrap: balance; unicode-bidi: plaintext; animation: ink-in calc(var(--motion-slow) * 1.6) var(--ease-out) backwards; }
.empty-conversation h2 { font-size: var(--text-large); font-weight: var(--weight-strong); line-height: 1.2; animation: rise var(--motion-slow) var(--ease-out) 60ms backwards; }
.empty-conversation p { display: none; }
@media (max-width: 599px) {
  .empty-conversation::before { inline-size: 52px; block-size: 52px; margin-block-end: var(--space-3); }
  .empty-conversation h2 { font-size: var(--text-title1); text-wrap: balance; }
}
@media (forced-colors: active) { .empty-conversation::before { background: CanvasText; } }
@media (min-width: 900px) {
  .workspace-kicker { font-size: 1.375rem; }
  .empty-conversation h2 { font-size: clamp(2.125rem, 2.8vw, 2.625rem); }
  .conversation-column:has(.empty-conversation) .messages { padding-block-end: var(--space-12); }
}
/* A short screen (most phones, a laptop window) keeps the whole new chat in view without scrolling (owner, 17 Nov
   2026): the same parts, closer together and a little smaller, never cut. */
@media (max-height: 820px) and (max-width: 899px) {
  .conversation-column:has(.empty-conversation) { padding-block-start: 56px; }
  .empty-conversation::before { inline-size: 44px; block-size: 44px; margin-block-end: var(--space-2); }
  .workspace-kicker { margin-block-end: var(--space-1); }
  .conversation-column:has(.empty-conversation) .messages { padding-block-end: var(--space-4); }
  .conversation-column:has(.empty-conversation) .starter-suggestions { padding-block: var(--space-2); }
  .conversation-column:has(.empty-conversation) .day-verse { margin-block-start: var(--space-1); gap: 0; }
}
@media (max-height: 820px) and (max-width: 599px) {
  .empty-conversation h2 { font-size: var(--text-title2); }
  /* The tabs already say what the starters are; the heading stays for screen readers. */
  .conversation-column:has(.empty-conversation) .starter-suggestions > h2 { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-height: 820px) and (min-width: 600px) and (max-width: 899px) { .empty-conversation h2 { font-size: var(--text-title1); } }
/* The shortest phones (iPhone SE) drop only the day's date beside the verse, so its actions keep one line, and set
   the disclaimer and starters a little tighter. */
@media (max-height: 700px) and (max-width: 480px) {
  .starter-suggestions .day-verse figcaption > span { display: none; }
  .conversation-column:has(.empty-conversation) { padding-block-start: 52px; }
  .conversation-column:has(.empty-conversation) .composer-hint { font-size: .75rem; }
  .conversation-column:has(.empty-conversation) .starter-suggestions { gap: var(--space-1); }
  .suggestion { gap: var(--space-1); padding-inline: var(--space-2); }
}
/* A short laptop window keeps the same layout with the mark and the gap under the composer a step smaller. */
@media (max-height: 760px) and (min-width: 900px) {
  .empty-conversation::before { inline-size: 52px; block-size: 52px; margin-block-end: var(--space-3); }
  .conversation-column:has(.empty-conversation) .messages { padding-block-end: var(--space-6); }
}
/* On a phone a starter's label may wrap to two lines, so it sits a little tighter and a step smaller. */
@media (max-width: 480px) { .suggestion { gap: var(--space-1); padding-inline: var(--space-2); font-size: var(--text-footnote); } }

/* The verse of the day, set as a Persian book sets it: two hemistichs side by side with a star between, stepped on a phone. */
.day-verse { display: grid; justify-items: center; gap: var(--space-2); margin: var(--space-3) 0 0; color: var(--color-muted); animation: rise var(--motion-slow) var(--ease-out) 120ms backwards; }
.day-verse[hidden], :root[data-verse="off"] .day-verse { display: none; }
.day-verse-lines { display: inline-grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); margin: 0; color: var(--color-ink); font-size: var(--text-subhead); font-weight: var(--weight-medium); line-height: 1.9; }
.day-verse-lines.is-drawn { animation: rise var(--motion-slow) var(--ease-out); }
.day-verse-lines > :first-child { order: 1; }
.day-verse-lines > :last-child { order: 3; }
.day-verse-lines > :first-child { text-align: end; }
.day-verse-lines > :last-child { text-align: start; }
@media (min-width: 900px) { .day-verse-lines { font-size: var(--text-body); } }
.day-verse-lines::before { content: ""; order: 2; inline-size: 9px; block-size: 9px; background: var(--sky-ink); -webkit-mask: var(--star) center / contain no-repeat; mask: var(--star) center / contain no-repeat; }
.day-verse figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 var(--space-3); font-size: var(--text-caption); }
.day-verse cite { color: var(--color-ink); font-style: normal; font-weight: var(--weight-medium); }
.day-verse-action { min-block-size: 28px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-accent); font: inherit; font-weight: var(--weight-medium); transition: transform var(--motion-fast) var(--spring); }
.day-verse-action:active { transform: scale(.96); transition-duration: 80ms; }
@media (hover: hover) and (pointer: fine) { .day-verse-action:hover { background: var(--color-accent-soft); } }
@media (pointer: coarse) { .day-verse-action { min-block-size: 44px; } }
@media (max-width: 599px) {
  .day-verse-lines { grid-template-columns: 1fr; gap: 0; inline-size: min(100%, 22rem); line-height: 1.8; }
  .day-verse-lines::before { display: none; }
  .day-verse-lines > :first-child { text-align: start; }
  .day-verse-lines > :last-child { text-align: end; }
}
/* A phone with its keyboard up needs the room for the conversation. */
@media (max-height: 640px) { .starter-suggestions .day-verse { display: none; } }
.stage-verse { position: absolute; inset-block-end: var(--space-8); inset-inline: var(--space-12); justify-items: start; margin: 0; color: rgb(255 255 255 / 78%); }
.stage-verse .day-verse-lines { grid-template-columns: auto auto auto; color: #fff; }
.stage-verse .day-verse-lines::before { background: #fff; }
.stage-verse cite { color: #fff; }
@media (max-height: 820px) { .stage-verse { display: none; } }

/* Typed with the wrong keyboard: the fix is offered, never applied. */
.layout-fix { justify-self: start; align-self: flex-start; max-inline-size: calc(100% - var(--space-6)); margin: var(--space-2) var(--space-3) 0; padding: var(--space-1) var(--space-3); overflow: hidden; border: 0; border-radius: var(--radius-full); font-family: inherit; background: var(--color-accent-soft); color: var(--color-accent); font-size: var(--text-caption); font-weight: var(--weight-medium); text-overflow: ellipsis; white-space: nowrap; transition: transform var(--motion-fast) var(--spring); }
.layout-fix[hidden] { display: none; }
.layout-fix:active { transform: scale(.96); transition-duration: 80ms; }

.message { position: relative; margin-block-end: var(--space-4); min-inline-size: 0; }
.message.assistant { margin-block-end: var(--space-5); }
.message .role { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.message .content { overflow-wrap: anywhere; font-size: var(--text-body); line-height: 1.85; }
@media (max-width: 599px) { .message .content { line-height: 1.75; } }
:root[data-reading-size="large"] .message .content { font-size: var(--text-title3); }

/* Sent messages are bubbles in the accent colour; replies are plain reading text. */
.message.user { display: flex; flex-direction: column; align-items: flex-end; }
.message.user .content {
  max-inline-size: min(82%, 560px); padding: var(--space-2) var(--space-4); border-radius: 22px; border-end-end-radius: 6px;
  background: var(--fill-accent); color: var(--color-on-accent); line-height: 1.65; white-space: pre-wrap;
}
.message.user:not([data-message-id]) .content { transform-origin: bottom; animation: bubble-in var(--motion-slow) var(--spring); }
.message.assistant:not([data-message-id]) { animation: rise var(--motion-base) var(--ease-out); }
.message.assistant .content:empty { display: none; }
/* Waiting: the brand nuqta in the light that runs around the composer, its halves parting and meeting. */
.message.assistant[data-status="pending"] .content:empty, .message.assistant[data-status="streaming"] .content:empty, .message.user[data-status="pending"]:last-child::after {
  display: block; inline-size: 24px; block-size: 24px; border-radius: 50%; background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--nuqta-wait); mask: var(--nuqta-wait); /* taste-skill-ignore */
  animation: nuqta-wait 1.6s var(--ease-in-out) infinite;
}
.message.user[data-status="pending"]:last-child::after { content: ""; align-self: flex-start; margin-block-start: var(--space-5); }

.message-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-block-start: var(--space-1); min-block-size: 30px; }
.message.user .message-actions { min-block-size: 0; }
.message.user .message-actions:empty { display: none; }
/* With a pointer, a sent message's actions wait beside its bubble instead of leaving a gap under it. */
@media (hover: hover) and (pointer: fine) {
  .message.user { flex-flow: row wrap; align-items: center; justify-content: flex-end; column-gap: var(--space-2); }
  .message.user .message-actions { order: -1; margin: 0; }
  .message.user .message-editor, .message.user > .field-hint, .message.user > .message-operation-hint { flex-basis: 100%; }
  /* While the reply hasn't started, the waiting ring needs its own line under the bubble. */
  .message.user[data-status="pending"]:last-child { flex-direction: column; align-items: flex-end; }
  .message.user[data-status="pending"]:last-child .message-actions { order: 0; }
}
.message-action {
  display: inline-flex; align-items: center; gap: var(--space-1); min-block-size: 30px; padding: 2px var(--space-2); border: 0; border-radius: var(--radius-full); background: transparent;
  color: var(--color-muted); font-size: var(--text-caption);
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, opacity var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
@media (pointer: coarse) { .message-action { min-block-size: 44px; padding-inline: var(--space-3); } }
.message-action:hover:not(:disabled) { background: var(--color-fill); color: var(--color-ink); }
.message-action:active:not(:disabled) { transform: scale(.92); }
.message-action:disabled { opacity: .5; }
.message-action::before { content: ""; display: none; inline-size: 14px; block-size: 14px; flex: none; background: currentColor; -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.message-action[data-i18n="user.copy"]::before { display: block; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2.5'/%3E%3Cpath d='M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5'/%3E%3C/svg%3E"); }
.message-action[data-i18n="user.copied"] { color: var(--color-success); }
.message-action[data-i18n="user.copied"]::before { display: block; animation: pop var(--motion-base) var(--spring-bouncy); --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.regenerate-message::before { display: block; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 11a8 8 0 1 0-2.3 6.3M20 5v6h-6'/%3E%3C/svg%3E"); }
.branch-message::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 4v16M6 13c0-3.5 2.5-6 6-6h6M15 4l3 3-3 3'/%3E%3C/svg%3E"); }
.edit-message::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4L16.5 4.5a2.1 2.1 0 0 1 3 3L8 19l-4 1zM14.5 6.5l3 3'/%3E%3C/svg%3E"); }
.feedback-up::before, .feedback-down::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10h3v10H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1z'/%3E%3Cpath d='M7 10l3.4-6.3A1.4 1.4 0 0 1 11.6 3 2.4 2.4 0 0 1 14 5.4V9h4.5a2 2 0 0 1 2 2.4l-1.2 6.9A2 2 0 0 1 17.3 20H7'/%3E%3C/svg%3E"); }
.feedback-down::before { transform: scaleY(-1); }
.share-reply::before { display: block; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M8 8l4-4 4 4'/%3E%3Cpath d='M8 11H6.5A1.5 1.5 0 0 0 5 12.5v6A1.5 1.5 0 0 0 6.5 20h11a1.5 1.5 0 0 0 1.5-1.5v-6a1.5 1.5 0 0 0-1.5-1.5H16'/%3E%3C/svg%3E"); }
/* Sharing waits for the whole reply. */
.message:not([data-status="completed"]) .share-reply { display: none; }
/* The image card: the preview keeps its shape inside the dialog; the canvas holds the full-size image. */
#reply-card-dialog .reply-card-preview { display: block; inline-size: auto; max-inline-size: 100%; block-size: auto; max-block-size: 42dvh; margin-inline: auto; border-radius: var(--radius-md); background: #1a1150; }
#reply-card-dialog .reply-card-preview[data-format="story"] { max-block-size: 52dvh; }
#reply-card-dialog textarea { inline-size: 100%; resize: vertical; }
#reply-card-dialog .dialog-actions { flex-wrap: wrap; }
/* A given rating is a filled thumb as well as the accent, so it never rests on colour alone. */
.message-action[aria-pressed="true"] { color: var(--color-accent); }
.message-action[aria-pressed="true"]::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10h3v10H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1z'/%3E%3Cpath d='M7 10l3.4-6.3A1.4 1.4 0 0 1 11.6 3 2.4 2.4 0 0 1 14 5.4V9h4.5a2 2 0 0 1 2 2.4l-1.2 6.9A2 2 0 0 1 17.3 20H7'/%3E%3C/svg%3E"); }
/* Under a message the actions are icons: the label stays as the accessible name and the tooltip, not a row of words. */
.message > .message-actions > .message-action { justify-content: center; min-inline-size: 32px; min-block-size: 32px; padding: 0; font-size: 0; }
.message > .message-actions > .message-action::before { display: block; inline-size: 16px; block-size: 16px; }
@media (pointer: coarse) {
  .message > .message-actions > .message-action { min-inline-size: 44px; min-block-size: 44px; }
  .message > .message-actions > .message-action::before { inline-size: 18px; block-size: 18px; }
}
/* Eight touch icons and their gaps need 366px: on phones narrower than that-plus-margins they stand 40px wide (still 44px tall)
   and close up, so the row stays one line. */
@media (pointer: coarse) and (max-width: 419px) {
  .message:not(.user) > .message-actions { gap: 0; }
  .message > .message-actions > .message-action { min-inline-size: 40px; }
}
.feedback-reasons { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-block-start: var(--space-2); }
.feedback-reasons-prompt { flex-basis: 100%; color: var(--color-muted); font-size: var(--text-caption); }
.feedback-reason {
  min-block-size: 32px; padding: 2px var(--space-3); border: 0; border-radius: var(--radius-full); background: var(--color-fill);
  color: var(--color-ink); font-size: var(--text-caption);
  transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.feedback-reason:hover { background: var(--color-fill-strong); }
.feedback-reason:active { transform: scale(.96); }
@media (pointer: coarse) { .feedback-reason { min-block-size: 44px; padding-inline: var(--space-4); } }
.message-state { color: var(--color-muted); font-size: var(--text-caption); }
.message-state:empty { display: none; }
.message-version { padding-inline: var(--space-2); }
.message-operation-hint { margin-block-start: var(--space-1); }
.message:not(:last-child) > .message-operation-hint { display: none; }
.cost-info::before { display: block; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v6M12 7.5h.01'/%3E%3C/svg%3E"); }
.cost-info[aria-expanded="true"] { background: var(--color-accent-soft); color: var(--color-accent); }
/* With a mouse the note floats on hover (below), so the tap target is not needed. */
@media (hover: hover) and (pointer: fine) { .cost-info { display: none; } }
/* On touch the note waits behind the ⓘ action and opens as a quiet card, in full and in reading size. */
@media (hover: none), (pointer: coarse) {
  :is(.message, .message-editor) > .message-operation-hint:not(.is-open) { display: none; }
  :is(.message, .message-editor) > .message-operation-hint.is-open {
    margin-block-start: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
    background: var(--color-fill); color: var(--color-ink); font-size: var(--text-subhead); line-height: 1.75;
    animation: rise var(--motion-base) var(--ease-out);
  }
}
@media (hover: hover) and (pointer: fine) {
  /* Quiet until needed; the keyboard reveals them too. */
  .message-action, .message-operation-hint { opacity: 0; transition: opacity var(--motion-fast) ease, background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy); }
  .message:hover .message-action, .message:focus-within .message-action, .message:last-child .message-action,
  .message-editor .message-action { opacity: 1; }
  /* The cost note floats over the reply when an action is in reach, so it holds no empty line open below it. */
  .message-operation-hint { position: absolute; inset-inline: 0; inset-block-end: 36px; z-index: 1; margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-elevated); box-shadow: var(--shadow-float); pointer-events: none; }
  .message:has(.message-action:hover, .message-action:focus-visible) .message-operation-hint { opacity: 1; }
  /* A disabled action stays as hidden as its neighbours until its message is in reach. */
  .message > .message-actions > .message-action:disabled { opacity: 0; }
  .message:hover .message-action:disabled, .message:focus-within .message-action:disabled, .message:last-child .message-action:disabled { opacity: .5; }
}
.message[data-status="failed"] .message-state { color: var(--color-danger); }
/* While work is under way the status line shimmers, light passing through the words; plain text under forced colours. */
.message[data-status="pending"] .message-state, .message[data-status="streaming"] .message-state {
  color: transparent; font-size: var(--text-footnote); font-weight: var(--weight-medium);
  background: linear-gradient(90deg, var(--color-muted) 0 38%, var(--color-ink) 50%, var(--color-muted) 62% 100%) 0 0 / 250% 100%; /* taste-skill-ignore */
  -webkit-background-clip: text; background-clip: text; /* taste-skill-ignore */
  animation: shimmer 1.8s linear infinite;
}
[dir="rtl"] .message[data-status="pending"] .message-state, [dir="rtl"] .message[data-status="streaming"] .message-state { animation-direction: reverse; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (forced-colors: active) { .message .message-state { color: CanvasText; background: none; } }
/* Nothing to copy until the first words arrive. */
.message.assistant:has(.content:empty) .message-action { display: none; }
/* The latest reply signs with the mark, as Claude signs with its spark: the halves part and meet while the words arrive
   (the waiting nuqta owns the time before the first word), and join once, with a spring, when a live reply is done. */
.message.assistant:not(:has(~ .message.assistant)):has(.content:not(:empty)) > .message-actions::before {
  content: ""; flex: none; inline-size: 24px; block-size: 24px; margin-inline-end: var(--space-2);
  background: var(--iridescence); /* taste-skill-ignore */
  -webkit-mask: var(--nuqta-wait); mask: var(--nuqta-wait); /* taste-skill-ignore */
}
.message.assistant[data-status="streaming"]:not(:has(~ .message.assistant)) > .message-actions::before { animation: nuqta-wait 1.6s var(--ease-in-out) infinite, glow-turn 3s linear infinite; }
.message.assistant.just-finished:not(:has(~ .message.assistant)) > .message-actions::before { animation: nuqta-settle calc(var(--motion-slow) * 1.6) var(--spring) var(--settle-delay, 0ms) backwards; }
@media (forced-colors: active) { .message.assistant > .message-actions::before { background: CanvasText; } }
.read-aloud::before { display: block; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5v5h3.5L12 18.5v-13L7.5 9.5z'/%3E%3Cpath d='M15.5 9a4 4 0 0 1 0 6M18.5 6.5a7.5 7.5 0 0 1 0 11'/%3E%3C/svg%3E"); }
.read-aloud[aria-pressed="true"]::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='7' y='7' width='10' height='10' rx='2'/%3E%3C/svg%3E"); }
.message.user .message-editor .message-actions { order: 1; }
.message-editor .message-actions { margin: 0; min-block-size: 0; gap: var(--space-2); }
.message-editor .message-operation-hint { position: static; opacity: 1; padding: 0; background: none; box-shadow: none; }
.message-editor .message-action { min-block-size: 36px; padding-inline: var(--space-4); border-radius: var(--radius-full); background: var(--color-fill); color: var(--color-ink); font-weight: var(--weight-medium); }
.message-editor .message-action[type="submit"] { background: var(--color-accent-fill); color: var(--color-on-accent); }
.message-editor { display: grid; gap: var(--space-2); inline-size: 100%; margin-block-start: var(--space-2); animation: rise var(--motion-base) var(--spring); }

/* Reply formatting: paragraphs breathe, headings belong to what follows them. */
.message .content > * + * { margin-block-start: var(--space-4); }
/* Headings step down in size as well as weight, so an explanation reads as sections at a glance (owner, 15 Nov 2026). */
.message .content > :is(h1, h2, h3, h4) { margin-block-start: var(--space-8); font-weight: var(--weight-bold); line-height: 1.4; text-wrap: balance; }
.message .content > h1 { font-size: 1.375rem; }
.message .content > h2 { font-size: var(--text-title3); }
.message .content > h3 { font-size: 1.0625rem; }
.message .content > h4 { margin-block-start: var(--space-6); font-size: var(--text-body); font-weight: var(--weight-strong); color: var(--color-muted); }
.message .content > :is(h1, h2, h3, h4) + * { margin-block-start: var(--space-2); }
.message .content > :first-child { margin-block-start: 0; }
.message .content ul, .message .content ol { padding-inline-start: var(--space-5); }
.message .content ul { list-style: none; }
.message .content ul > li { position: relative; }
.message .content ul > li::before { content: ""; position: absolute; inset-inline-start: calc(var(--space-4) * -1); inset-block-start: .78em; inline-size: 6px; block-size: 6px; border-radius: 50%; background: var(--color-accent); opacity: .7; }
/* Numbered items are steps: each number sits in a soft accent disc, in the reading language's digits. */
.message .content ol { list-style: none; padding-inline-start: 0; }
/* Each item carries its own number (--n), so the disc is right in every engine, iPhone included. */
.message .content ol > li { position: relative; padding-inline-start: calc(26px + var(--space-3)); counter-reset: step var(--n, 1); }
.message .content ol > li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; inset-block-start: .2em;
  display: grid; place-items: center; inline-size: 26px; block-size: 26px; border-radius: 50%;
  background: var(--color-accent-soft); color: var(--color-accent); font-size: var(--text-caption); font-weight: var(--weight-bold); line-height: 1;
}
:root[lang="fa"] .message .content ol > li::before { content: counter(step, persian); }
.message .content li + li { margin-block-start: var(--space-3); }
.message .content hr { block-size: 1px; margin-block: var(--space-8); border: 0; background: var(--color-separator); }
.message .content blockquote { margin-inline: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-fill); color: var(--color-ink); }
.message .content code { padding: .1em .4em; border-radius: 6px; background: var(--color-fill); unicode-bidi: isolate; }
/* Callouts (`> [!TIP]` and kin): a soft card in the kind's own tint, title and glyph in its ink. Status colours carry the
   kind with a word as well, never colour alone. */
.callout { --callout: var(--color-accent); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: color-mix(in srgb, var(--callout) 10%, var(--color-surface)); }
.callout[data-kind="tip"] { --callout: var(--color-success); }
.callout[data-kind="important"] { --callout: #8e44c9; }
.callout[data-kind="warning"] { --callout: var(--color-warning); }
.callout[data-kind="caution"] { --callout: var(--color-danger); }
.callout-title { display: flex; align-items: center; gap: var(--space-2); margin-block-end: var(--space-1); color: var(--callout); font-weight: var(--weight-bold); }
.callout-title::before {
  content: ""; inline-size: 18px; block-size: 18px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.callout[data-kind="tip"] .callout-title::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
}
.callout:is([data-kind="warning"], [data-kind="caution"]) .callout-title::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.5 20h19z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.5 20h19z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
}
.callout > p + p { margin-block-start: 0; }
@media (forced-colors: active) { .callout { border: 1px solid CanvasText; } .callout-title::before { background: CanvasText; } }
/* Tables show whole: cells wrap instead of hiding columns off the edge; only a table too wide to wrap scrolls. The header
   sits on a tone step in full ink, rows part with hairlines, and figures align on their edge. */
.markdown-table { overflow-x: auto; border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--hairline), var(--shadow-card); }
.markdown-table table { inline-size: 100%; border-collapse: collapse; font-size: var(--text-subhead); line-height: 1.6; font-variant-numeric: var(--numeric); }
.markdown-table th, .markdown-table td { padding: var(--space-3) var(--space-4); min-inline-size: 7ch; text-align: start; vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.markdown-table th { background: var(--color-fill); color: var(--color-ink); font-size: var(--text-footnote); font-weight: var(--weight-bold); }
.markdown-table td { border-block-start: 1px solid var(--color-separator); }
.markdown-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--color-fill) 45%, transparent); }
.markdown-table td:first-child { font-weight: var(--weight-medium); }
.markdown-table [data-align="end"] { text-align: end; }
.markdown-table [data-align="center"] { text-align: center; }
/* A code block is a frame: a quiet head with the language and the copy control, then the code, which scrolls by itself. */
.code-frame { overflow: hidden; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--hairline); }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-block-size: 40px;
  padding-inline: var(--space-4) var(--space-1); background: var(--color-fill); color: var(--color-muted);
  font-family: var(--font-sans); font-size: var(--text-caption);
}
/* The label comes from the reply, so it can be any length: it is cut short and never pushes the copy control out. */
.code-language { min-inline-size: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.code-head .copy-code { flex: none; }
.code-block { overflow-x: auto; margin: 0; padding: var(--space-4); font-size: var(--text-footnote); line-height: 1.7; text-align: start; }
.message .content .code-block code { padding: 0; background: none; font-size: 1em; white-space: pre; }
.copy-code {
  display: inline-flex; align-items: center; gap: var(--space-1); min-block-size: 32px; padding: 2px var(--space-3); border: 0;
  border-radius: var(--radius-full); background: transparent; color: var(--color-muted); font-family: var(--font-sans); font-size: var(--text-caption);
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.copy-code::before { content: ""; inline-size: 14px; block-size: 14px; flex: none; background: currentColor; -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2.5'/%3E%3Cpath d='M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5'/%3E%3C/svg%3E"); }
.copy-code[data-i18n="user.copied"] { color: var(--color-success); }
.copy-code[data-i18n="user.copied"]::before { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.copy-code:hover { background: var(--color-fill-strong); color: var(--color-ink); }
.copy-code:active { transform: scale(.92); }
@media (pointer: coarse) { .code-head { min-block-size: 44px; } .copy-code { min-block-size: 44px; } }
/* Forced colours repaint backgrounds, which would blank a masked glyph; draw the icons in the system's button text instead. */
@media (forced-colors: active) { .message-action::before, .copy-code::before { forced-color-adjust: none; background: ButtonText; } }
/* The arriving-reply dot belongs to running text, not inside a frame. */
.message[data-status="streaming"] .content > :is(.code-frame, .markdown-table):last-child::after { display: none; }

.scroll-bottom {
  position: absolute; inset-block-end: var(--space-3); inset-inline-start: 50%; translate: 50% 0;
  display: inline-flex; align-items: center; gap: var(--space-1); min-block-size: 36px; padding: var(--space-1) var(--space-4); border: 0; border-radius: var(--radius-full);
  background: var(--color-elevated); color: var(--color-ink); box-shadow: var(--hairline), var(--shadow-float); font-size: var(--text-caption);
  animation: bubble-in var(--motion-base) var(--spring); transition: transform var(--motion-base) var(--spring-bouncy);
}
.scroll-bottom:active { transform: scale(.94); }
[dir="ltr"] .scroll-bottom { translate: -50% 0; }

/* Composer: a floating capsule holding the message, the + menu, the model and the send button. */
/* minmax(0, 1fr) down the chain: on the narrowest phone the model's name gives way, never the edge of the screen. */
.composer-area { position: relative; flex: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: 0 max(var(--gutter), calc((100% - var(--measure)) / 2)) max(var(--space-2), env(safe-area-inset-bottom)); }
.composer-feedback { display: grid; gap: var(--space-1); }
.subscription-cap { display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); font-size: var(--text-subhead); overflow-wrap: anywhere; }
.subscription-cap[hidden], .subscription-meter[hidden], .low-balance-link[hidden] { display: none; }
.subscription-cap .text-button { justify-self: start; min-block-size: 44px; }
.subscription-meter { font-variant-numeric: var(--numeric); }
#workspace-sidebar .sidebar-foot { flex-wrap: wrap; }
.low-balance-link { display: flex; flex: 1 1 100%; order: 1; align-items: center; min-block-size: 44px; padding-inline: var(--space-2); color: var(--color-muted); font-size: var(--text-caption); }
#chat-status:not(.error, .success, .warning) { color: var(--color-muted); font-size: var(--text-caption); }
.composer-feedback:not(:has(.status:not(:empty), button:not(.hidden))) { display: none; }
.connection-status { padding: var(--space-1) var(--space-3); border-radius: var(--radius-md); background: var(--color-warning-soft); color: var(--color-warning); font-size: var(--text-caption); }
.connection-status[data-tone="success"] { background: var(--color-success-soft); color: var(--color-success); }
.connection-status[hidden] { display: none; }
@property --glow-angle { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
.message-form {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-2); border-radius: var(--radius-xl);
  background: var(--color-surface); box-shadow: var(--hairline), var(--shadow-float);
  transition: box-shadow var(--motion-base) ease;
}
.message-form:focus-within { box-shadow: var(--shadow-float); }
.message-form:focus-within::before { opacity: .85; }
.message-form:focus-within::after { opacity: .28; }
/* While a reply is on its way an edge of light runs around the composer, in both delivery modes. */
.message-form::before, .message-form::after {
  content: ""; position: absolute; inset: -1.5px; z-index: -2; border-radius: inherit; opacity: 0; pointer-events: none;
  background: var(--iridescence); /* taste-skill-ignore */
  transition: opacity var(--motion-slow) ease;
}
.message-form::after { inset: -3px; filter: blur(12px); }
/* The blurred halo repaints every frame; phones keep the sharp edge alone. */
@media (max-width: 899px) { .message-form::after { display: none; } }
.composer-fill { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--color-surface); }
.conversation-column:has(.message[data-status="pending"], .message[data-status="streaming"], .message-form[data-sending="true"]) .message-form { animation: glow-turn 3.2s linear infinite; }
.conversation-column:has(.message[data-status="pending"], .message[data-status="streaming"], .message-form[data-sending="true"]) .message-form::before { opacity: 1; }
.conversation-column:has(.message[data-status="pending"], .message[data-status="streaming"], .message-form[data-sending="true"]) .message-form::after { opacity: .55; }
@keyframes glow-turn { from { --glow-angle: 0deg; } to { --glow-angle: 360deg; } }
/* An empty dir="auto" field resolves to LTR; its placeholder belongs on the page's reading edge. */
[dir="rtl"] .message-form #message-input:placeholder-shown { direction: rtl; unicode-bidi: normal; text-align: start; }
.composer-label { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.message-form #message-input, .message-form #message-input:focus-visible, .message-form #message-input:hover {
  min-block-size: calc(1lh + var(--space-1)); max-block-size: 38dvh; padding: 2px var(--space-2); border: 0; border-radius: 0; box-shadow: none; background: transparent;
  line-height: 1.6; resize: none; overflow-y: auto;
}
.composer-attachments { display: flex; flex-wrap: wrap; gap: var(--space-1); padding-inline: var(--space-1); }
.composer-chip { display: inline-flex; align-items: center; gap: var(--space-1); max-inline-size: 240px; min-block-size: 30px; padding-inline: var(--space-3) var(--space-1); border-radius: var(--radius-full); background: var(--color-accent-soft); color: var(--color-accent); font-size: var(--text-caption); animation: pop var(--motion-base) var(--spring); }
.composer-chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer-chip-remove { position: relative; inline-size: 22px; block-size: 22px; flex: none; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.composer-chip-remove::before { content: ""; position: absolute; inset: 4px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; }
@media (hover: hover) and (pointer: fine) { .composer-chip-remove:hover { background: var(--color-accent-soft); } }
.composer-count { flex: none; padding-inline: var(--space-2); color: var(--color-warning); font-size: var(--text-caption); font-variant-numeric: var(--numeric); }
.composer-toolbar { display: flex; align-items: center; gap: var(--space-1); min-block-size: 40px; }
.composer-state { padding-inline: var(--space-2); }
.composer-shortcut { display: none; flex: none; padding-inline: var(--space-2); color: var(--color-muted); font-size: var(--text-caption); }
@media (hover: hover) and (pointer: fine) and (min-width: 1100px) {
  .composer-shortcut { display: inline; opacity: 0; transition: opacity var(--motion-base) ease; }
  .message-form:focus-within .composer-shortcut { opacity: 1; }
}
.send-actions { display: flex; align-items: center; flex: none; }
.composer-spacer { flex: 1; min-inline-size: 0; }
.model-control { min-inline-size: 0; flex: 0 1 auto; }
.model-picker-trigger {
  display: inline-flex; align-items: center; gap: var(--space-1); max-inline-size: 100%; min-block-size: 36px; padding: var(--space-1) var(--space-3); border: 0; border-radius: var(--radius-full); background: transparent;
  color: var(--color-ink); font-size: var(--text-footnote); font-weight: var(--weight-medium);
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.model-picker-trigger > span:last-child { color: var(--color-muted); }
.model-picker-trigger:hover:not(:disabled) { background: var(--color-fill); color: var(--color-ink); }
.model-picker-trigger:active:not(:disabled) { transform: scale(.96); }
.model-picker-trigger > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.model-picker-trigger > span:last-child { inline-size: 14px; block-size: 14px; flex: none; font-size: 0; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
/* The composer's round controls share one size: 36px with a mouse, 44px on touch. */
.button.send-button {
  --composer-control: 36px;
  inline-size: var(--composer-control); block-size: var(--composer-control); min-block-size: var(--composer-control); padding: 0; gap: 0; border-radius: var(--radius-full); font-size: 0; line-height: 0;
  background: var(--fill-accent); color: var(--color-on-accent); --color-glow: rgb(255 255 255 / 30%);
}
@media (hover: hover) and (pointer: fine) { .button.send-button:hover:not(:disabled) { background: var(--color-accent-press); transform: scale(1.06); } }
.button.send-button:active:not(:disabled) { transform: scale(.9); }
.send-button::before {
  content: ""; position: absolute; inset: 0; margin: auto; inline-size: 18px; block-size: 18px; background: currentColor; transition: transform var(--motion-base) var(--spring-bouncy);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M6 11l6-6 6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M6 11l6-6 6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (hover: hover) and (pointer: fine) { .send-button:hover:not(:disabled)::before { transform: scale(1.08); } }
.button.send-button[data-action="stop"] { background: var(--color-ink); color: var(--color-surface); }
.button.send-button[data-action="stop"]:hover:not(:disabled) { background: var(--color-ink); }
.send-button[data-action="stop"]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6.5' y='6.5' width='11' height='11' rx='2.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6.5' y='6.5' width='11' height='11' rx='2.5'/%3E%3C/svg%3E");
  animation: pop var(--motion-base) var(--spring-bouncy);
}
@media (hover: hover) and (pointer: fine) { .send-button[data-action="stop"]:hover:not(:disabled)::before { transform: scale(.9); } }
.send-button[data-action="waiting"]::before {
  -webkit-mask: none; mask: none; background: transparent; inline-size: 18px; block-size: 18px; border: 2px solid currentColor; border-block-start-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
.button.send-button:disabled { background: var(--color-fill); color: var(--color-muted); opacity: 1; }
/* Resting to ready: the fill eases over and the disc springs in once. */
.button.send-button[data-action="send"]:not(:disabled) { animation: send-ready var(--motion-base) var(--spring); }
@keyframes send-ready { from { transform: scale(.92); } }

/* Attachment and reasoning menus share available-space positioning. */
.context-tools { display: flex; flex: none; }
.composer-area:has(.context-tools > details[open]) { z-index: var(--z-menu); }
.composer-plus {
  display: grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 50%; background: var(--color-fill); color: var(--color-ink);
  transition: background-color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
@media (hover: hover) and (pointer: fine) { .composer-plus:hover { background: var(--color-fill-strong); transform: scale(1.06); } }
.composer-plus:active { transform: scale(.92); }
/* Voice typing (ui/voice-input.js): a quiet round control beside Send; while it listens it takes the accent and a ring
   breathes out from it, so the open microphone is never missed. */
.composer-mic {
  position: relative; display: grid; place-items: center; inline-size: 36px; block-size: 36px; flex: none; margin-inline-end: var(--space-1);
  border: 0; border-radius: 50%; background: transparent; color: var(--color-muted); cursor: pointer;
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.composer-mic::before {
  content: ""; inline-size: 20px; block-size: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (hover: hover) and (pointer: fine) { .composer-mic:hover { background: var(--color-fill); color: var(--color-ink); } }
.composer-mic:active { transform: scale(.92); }
.composer-mic.is-listening { background: var(--color-accent-soft); color: var(--color-accent); }
.composer-mic.is-listening::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--color-accent); animation: mic-ring 1.4s var(--ease-out) infinite; pointer-events: none; }
@keyframes mic-ring { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.45); } }
@media (forced-colors: active) { .composer-mic::before { background: ButtonText; } }
/* Touch: attach and send are drawn at --disc and reach a 44px hit area. The microphone's box is the hit area itself;
   its listening disc and ring are drawn at --disc inside it, like the others. */
@media (pointer: coarse) {
  .button.send-button { --composer-control: var(--disc); }
  .composer-plus { inline-size: var(--disc); block-size: var(--disc); }
  .composer-mic { --inset: calc((var(--tap) - var(--disc)) / 2); inline-size: var(--tap); block-size: var(--tap); padding: var(--inset); }
  .composer-mic, .composer-mic.is-listening { background-clip: content-box; }
  .composer-mic.is-listening::after { inset: var(--inset); }
}
.context-panel {
  position: fixed; inset-block-start: var(--panel-top); inset-inline-start: var(--panel-inline); z-index: var(--z-menu);
  display: grid; gap: var(--space-1); inline-size: min(300px, calc(100vw - var(--space-6))); max-block-size: var(--panel-space, 62dvh); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-2);
  border-radius: var(--radius-lg); font-size: var(--text-subhead); scrollbar-width: thin;
}
[data-direction="up"] > .context-panel { transform: translateY(-100%); }
/* An up menu is drawn a full height above its box, so its foot, by the trigger, is the box's top edge. */
details[open] > .context-panel { transform-origin: top left; animation: menu-in var(--motion-base) var(--spring); }
[dir="rtl"] details[open] > .context-panel { transform-origin: top right; }
.context-panel > .nav-row { min-block-size: 44px; inline-size: 100%; }
.context-panel > .nav-row > .icon { flex: none; inline-size: var(--space-5); block-size: var(--space-5); padding: 0; border-radius: 0; background: none; box-shadow: none; color: var(--color-muted); }
.context-panel > p, .context-panel > .context-more { padding-inline: var(--space-3); }
/* A disc drawn smaller than a fingertip reaches out invisibly to --tap: + through a spare layer, toolbar and send
   through their glow layer, which a touch screen never lights. */
@media (pointer: coarse) {
  .composer-plus { position: relative; }
  .composer-plus::before { content: ""; position: absolute; inset: min(0px, (100% - var(--tap)) / 2); }
  .chat-toolbar .button.glass, .button.send-button { overflow: visible; }
  .chat-toolbar .button.glass::after, .button.send-button::after { inset: min(0px, (100% - var(--tap)) / 2); pointer-events: auto; }
}
@media (max-width: 899px) {
  .context-panel { inset-block-start: auto; inset-block-end: max(var(--panel-bottom, var(--space-3)), env(safe-area-inset-bottom)); inset-inline: var(--space-3); inline-size: auto; max-block-size: min(var(--panel-space, 62dvh), 62dvh); transform: none; }
  details[open] > .context-panel { animation: sheet-in var(--motion-slow) var(--spring); }
}
.context-panel h2 { font-size: var(--text-subhead); }
#attachment-hint { color: var(--color-muted); font-size: var(--text-caption); line-height: 1.6; }
.context-more { display: grid; gap: var(--space-2); }
.context-more > summary { display: flex; align-items: center; gap: var(--space-1); min-block-size: 44px; color: var(--color-muted); font-size: var(--text-caption); cursor: pointer; }
.context-more > :not(summary) { margin-block-start: var(--space-2); }
.context-panel [role="status"]:empty, .context-panel > div:empty { display: none; }
.file-drop {
  justify-content: flex-start; background: transparent; color: var(--color-ink); text-align: start;
}
.file-drop > span:last-child, #image-mode-open > span:last-child { display: grid; gap: var(--space-1); }
.file-drop:has(+ input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.context-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-block: var(--space-2); border-block-start: 1px solid var(--color-separator); }
.context-row > span { flex: 1; min-inline-size: 0; overflow-wrap: anywhere; }
.context-row .text-button { min-block-size: 44px; }
.context-row progress { inline-size: 100%; accent-color: var(--color-accent-fill); }
.attachment-preview { max-block-size: 96px; border-radius: var(--radius-sm); }
.composer-hint { color: var(--color-muted); font-size: var(--text-caption); text-align: center; text-wrap: balance; }
#sms-readonly-note { text-align: center; }

.starter-suggestions { display: grid; gap: var(--space-2); flex: none; padding: var(--space-3) max(var(--gutter), calc((100% - var(--measure)) / 2)) var(--space-4); }
.starter-suggestions > h2 { font-size: var(--text-subhead); font-weight: var(--weight-strong); text-align: center; }
.starter-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1); }
/* A new person's first empty chat asks one question in place of the hint (BACKLOG «رشد-۱۱»): no dialog, no extra height. */
/* A message held while offline (BACKLOG «رشد-۱۲»): its line and a way to not send it. */
.held-message:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.starter-intro { display: grid; gap: var(--space-2); justify-items: center; text-align: center; }
.starter-intro > p { margin: 0; color: var(--color-ink); font-size: var(--text-subhead); font-weight: var(--weight-medium); text-wrap: balance; }
.starter-filter { min-block-size: 44px; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-full); background: transparent; color: var(--color-muted); font-size: var(--text-footnote); }
.starter-filter[aria-pressed="true"] { background: var(--color-fill); color: var(--color-ink); font-weight: var(--weight-strong); }
@media (hover: hover) and (pointer: fine) { .starter-filter:hover { background: var(--color-fill); color: var(--color-ink); } }
@media (max-width: 480px) { .starter-filters { gap: 0; } .starter-filter { padding-inline: var(--space-2); } }
/* With the assistants tab there are six: on phones they stay on one line with tighter tabs, and scroll sideways only where
   even that does not fit (320px). Without it the five tabs keep their old look. */
@media (max-width: 480px) {
  .starter-filters:has(> [data-category="assistants"]) { flex-wrap: nowrap; justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
  .starter-filters:has(> [data-category="assistants"]) > .starter-filter { flex: none; min-inline-size: var(--tap); padding-inline: var(--space-1); }
  .starter-filters:has(> [data-category="assistants"]) > .starter-filter:focus-visible { outline-offset: -2px; }
  .starter-filters:has(> [data-category="assistants"]) > .starter-filter[aria-pressed="true"]::after { inset-inline: var(--space-1); }
}
/* Where the strip scrolls, its ends fade so a cut tab reads as "more this way", as the account strip does. */
@media (max-width: 359px) {
  .starter-filters:has(> [data-category="assistants"]) {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--space-3), #000 calc(100% - var(--space-3)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--space-3), #000 calc(100% - var(--space-3)), transparent); /* taste-skill-ignore */
  }
}
/* Starters are an aligned, centred grid with every label whole (owner, 17 Nov 2026). Columns are only as wide as
   their longest label, so a chip never carries a long empty side; chips in one column share its width, and the
   content sits centred. Two columns, three when a wider screen has exactly three; an odd last one is centred at its
   own width. A phone keeps two equal halves, where labels wrap and fill them. */
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); justify-content: center; gap: var(--space-2); }
.suggestions > :last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; }
@media (min-width: 600px) {
  .suggestions:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, max-content)); }
  .suggestions:has(> :nth-child(3):last-child) > :last-child { grid-column: auto; justify-self: stretch; }
}
/* With room for three labels on one line, five sit three over two, each row centred at the chips' own widths. */
@media (min-width: 900px) {
  .suggestions:has(> :nth-child(5):last-child) { display: flex; flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 480px) { .suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* A phone keeps four, two by two, so the new chat fits its screen: of the two personal starters only the first, so
   the day's own starter (an occasion's, for one) always stays. */
@media (max-width: 480px) {
  .suggestions > [data-starter="knowledge:next"] { display: none; }
  .suggestions:has(> [data-starter="knowledge:next"]) > :last-child { grid-column: auto; justify-self: stretch; }
}
.suggestion {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-inline-size: 0; min-block-size: 44px; padding: var(--space-2) var(--space-4); border: 0; border-radius: var(--radius-lg); text-align: center; line-height: 1.45; text-wrap: pretty; background: color-mix(in srgb, var(--color-surface) 88%, transparent); box-shadow: var(--hairline);
  font-size: var(--text-subhead); transition: background-color var(--motion-fast) ease, box-shadow var(--motion-base) ease, transform var(--motion-base) var(--spring-bouncy);
  animation: rise var(--motion-slow) var(--spring) backwards;
}
.suggestion:nth-child(2) { animation-delay: 60ms; }
.suggestion:nth-child(3) { animation-delay: 120ms; }
.suggestion:nth-child(n + 4) { animation-delay: 180ms; }
@media (hover: hover) and (pointer: fine) { .suggestion:hover { background: color-mix(in srgb, var(--chip) 12%, var(--color-surface)); transform: translateY(-2px); box-shadow: var(--hairline), var(--shadow-float); } }
.suggestion:active { transform: scale(.96); transition-duration: 80ms; }
.suggestion { --chip: var(--color-accent); }
.suggestion[data-kind="learn"] { --chip: #0e8f7e; }
.suggestion[data-kind="idea"], .suggestion[data-kind="plan"] { --chip: #c26a00; }
:root[data-theme="dark"] .suggestion[data-kind="learn"] { --chip: #4fd1bd; }
:root[data-theme="dark"] .suggestion[data-kind="idea"], :root[data-theme="dark"] .suggestion[data-kind="plan"] { --chip: #ffb340; }
.suggestion::before { content: ""; inline-size: 18px; block-size: 18px; flex: none; background: var(--chip); -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; transition: transform var(--motion-base) var(--spring-bouncy); }
@media (hover: hover) and (pointer: fine) { .suggestion:hover::before { transform: rotate(-8deg) scale(1.12); } }
.suggestion[data-kind="write"], .suggestion[data-kind="code"] { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 4 5 5M4 20l5-1L21 7a2 2 0 0 0-5-5L4 14l-1 7Z'/%3E%3C/svg%3E"); }
.suggestion[data-kind="learn"] { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5C8 2 3 4 3 4v15s5-2 9 1c4-3 9-1 9-1V4s-5-2-9 1Zm0 0v15'/%3E%3C/svg%3E"); }
.suggestion[data-kind="idea"], .suggestion[data-kind="plan"] { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6m-5 3h4M8 14a6 6 0 1 1 8 0c-1 1-1 2-1 2H9s0-1-1-2Z'/%3E%3C/svg%3E"); }
.suggestion > span:last-child { display: none; }
.starter-hint { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:root[data-suggestions="off"] .starter-suggestions > :not(.day-verse) { display: none; }
:root[data-suggestions="off"][data-verse="off"] .starter-suggestions { display: none; }

.chat-panel.is-dropping::after {
  content: attr(data-drop); position: absolute; inset: var(--space-3); inset-inline-start: calc(var(--space-3) + var(--drop-offset, 0px)); z-index: var(--z-menu); display: grid; place-items: center; border-radius: var(--radius-xl); pointer-events: none;
  background: var(--material-solid); box-shadow: inset 0 0 0 2px var(--color-accent); color: var(--color-accent); font-size: var(--text-title3); font-weight: var(--weight-strong); animation: fade var(--motion-fast) ease;
}

/* Hides the composer and its tools on read-only SMS conversations whatever their display value. */
#message-form[hidden], #chat-context-tools[hidden], #composer-hint[hidden] { display:none !important; }

#conversation-dialog-form { display: grid; gap: var(--space-3); }
#dialog-description { font-size: var(--text-subhead); }

/* One catalogue sheet: category navigation and aligned quotes, with no result animations. */
#model-dialog { inline-size: min(580px, calc(100vw - var(--space-8))); gap: var(--space-3); scrollbar-width: thin; scrollbar-color: var(--color-fill-strong) transparent; }
.model-dialog .dialog-heading h2 { flex: 1; min-inline-size: 0; }
.model-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-1); padding: var(--space-1); border-radius: var(--radius-full); background: var(--color-fill); }
.model-tabs > button { min-inline-size: 0; min-block-size: 44px; padding: var(--space-2); border: 0; border-radius: var(--radius-full); background: transparent; color: var(--color-muted); font-size: var(--text-subhead); }
.model-tabs > button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-ink); font-weight: var(--weight-strong); box-shadow: var(--shadow-card); }
.model-tabs > button:disabled { cursor: default; }
.model-tabs > button:focus-visible { outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .model-tabs > button:not(:disabled):hover { color: var(--color-ink); } }
.model-list-heading { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-block-start: var(--space-1); }
/* Heading to hint --space-1, hint to tabs --space-4, inside the dialog's --space-3 gap. */
#model-dialog .dialog-heading { margin-block-end: calc(var(--space-1) - var(--space-3)); }
#model-dialog-hint { margin-block-end: calc(var(--space-4) - var(--space-3)); }
.model-list-heading:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
.model-list-heading > h3 { margin: 0; color: var(--color-ink); }
#model-rate-heading { color: var(--color-muted); font-size: var(--text-caption); white-space: nowrap; }
.model-search-form { display: grid; gap: var(--space-2); }
.model-search-form > label { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.model-search-controls { display: flex; align-items: center; gap: var(--space-2); }
.model-search-controls input { flex: 1; min-inline-size: 0; }
.model-search-controls button { flex: none; }
#model-clear-search-btn:disabled { display: none; }
/* The first load keeps the frame: three quiet rows, and the words stay for screen readers only. */
.model-skeleton { display: grid; overflow: hidden; border-radius: var(--radius-md); background: var(--color-fill); animation: breathe 1.6s ease-in-out infinite; }
.model-skeleton li { display: flex; align-items: center; gap: var(--space-3); min-block-size: 56px; padding: var(--space-3) var(--space-4); }
.model-skeleton li + li { box-shadow: inset 0 1px 0 var(--color-separator); }
.model-skeleton li::before { content: ""; inline-size: 36px; block-size: 36px; flex: none; border-radius: var(--radius-sm); background: var(--color-fill-strong); }
.model-skeleton li::after { content: ""; inline-size: 40%; block-size: 12px; border-radius: var(--radius-full); background: var(--color-fill-strong); }
#model-dialog:has(.model-skeleton:not([hidden])) #model-status { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.model-phone { display: grid; justify-items: start; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-fill); }
/* The default is the large row: an accent tile, what it does, and a badge when it is the automatic choice. */
.model-default {
  display: flex; align-items: center; gap: var(--space-3); inline-size: 100%; min-block-size: 68px; padding: var(--space-3) var(--space-4); border: 0; border-radius: var(--radius-md);
  background: var(--color-window); color: var(--color-ink); text-align: start; cursor: pointer; transition: background-color var(--motion-fast) ease;
}
.model-default:disabled { color: var(--color-ink); cursor: default; }
.model-default.is-current { background: var(--color-accent-soft); }
.model-default .model-tile { display: grid; place-items: center; inline-size: 44px; block-size: 44px; flex: none; border-radius: var(--radius-md); background: var(--fill-accent); color: var(--color-on-accent); }
.model-default.is-current .model-tile { background: var(--fill-accent); }
.model-default-text { display: grid; flex: 1; gap: 2px; min-inline-size: 0; }
.model-default-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.model-default-head > strong { font-size: var(--text-body); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
[dir="rtl"] .model-default-head > strong { text-align: right; }
.model-default-text > span:last-child { color: var(--color-muted); font-size: var(--text-caption); line-height: 1.5; }
.model-badge { flex: none; padding: 2px var(--space-3); border-radius: var(--radius-full); background: var(--color-accent-soft); color: var(--color-accent); font-size: var(--text-caption); font-weight: var(--weight-medium); }
.model-default.is-current .model-badge { background: var(--color-surface); }
.model-default.is-current::after, .model-results li.is-current::after, .effort-option.is-current::after {
  content: ""; flex: none; inline-size: 20px; block-size: 20px; background: var(--color-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.model-popular-more { justify-self: center; min-block-size: 44px; }
.model-results { display: grid; align-content: start; gap: var(--space-1); }
@media (min-width: 600px) { .model-results { min-block-size: 240px; } }
.model-results li {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 112px; align-items: center; column-gap: var(--space-3); row-gap: var(--space-1);
  min-block-size: 80px; padding: var(--space-3); border-radius: var(--radius-md); transition: background-color var(--motion-fast) ease;
}
.model-results li + li::after { content: ""; position: absolute; inset-block-start: calc(-1 * var(--space-1) / 2); inset-inline: var(--space-3); block-size: 1px; background: var(--color-separator); }
.model-results li.is-current { background: var(--color-accent-soft); }
.model-results li.is-unavailable { color: var(--color-muted); }
/* Authored initials identify the public name; they are not provider brand marks. */
.model-results li::before {
  content: attr(data-monogram); grid-column: 1; grid-row: 1 / span 2; display: grid; place-items: center; inline-size: 40px; block-size: 40px; border-radius: var(--radius-md);
  background: var(--color-window); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-separator); font-size: var(--text-subhead); font-weight: var(--weight-strong); direction: ltr;
}
.model-results li > strong { grid-column: 2; grid-row: 1; font-size: var(--text-subhead); font-weight: var(--weight-strong); overflow-wrap: anywhere; }
[dir="rtl"] .model-results li > strong { text-align: right; }
.model-results li > p { grid-column: 2 / span 2; grid-row: 2; color: var(--color-muted); font-size: var(--text-caption); line-height: 1.6; }
.model-results li > .model-price-badge { grid-column: 3; grid-row: 1; justify-self: end; white-space: nowrap; border-radius: var(--radius-full); padding: 2px var(--space-2); background: var(--color-fill); color: var(--color-muted); font-size: var(--text-caption); font-weight: var(--weight-medium); }
.model-results li > .model-price-badge.is-free { color: color-mix(in srgb, var(--color-success) 80%, var(--color-ink)); background: var(--color-success-soft); }
.model-rates { grid-column: 4; grid-row: 1 / span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); color: var(--color-muted); font-size: var(--text-caption); text-align: center; }
.model-rates:not(:has(> span)) { display: block; }
.model-rates > span { display: grid; gap: 2px; }
.model-rates strong { color: var(--color-ink); font-size: var(--text-subhead); font-weight: var(--weight-medium); font-variant-numeric: var(--numeric); overflow-wrap: anywhere; }
.model-results li.is-current::after { position: static; grid-column: 1; grid-row: 1 / span 2; justify-self: center; z-index: 1; }
.model-results li.is-current::before { content: ""; background: var(--color-surface); box-shadow: none; }
@media (max-width: 480px) {
  #model-dialog { inline-size: calc(100vw - var(--space-4)); }
  .model-tabs > button { font-size: var(--text-footnote); }
  .model-results li { grid-template-columns: 32px minmax(0, 1fr) 92px; column-gap: var(--space-2); padding-inline: var(--space-2); }
  .model-results li::before { inline-size: 32px; block-size: 36px; border-radius: var(--radius-sm); font-size: var(--text-caption); }
  .model-results li > p { grid-column: 2; }
  .model-results li > .model-price-badge { grid-column: 2; grid-row: 3; justify-self: start; }
  .model-rates { grid-column: 3; grid-row: 1 / span 3; gap: var(--space-2); }
  .model-results li.is-current::after { grid-row: 1 / span 3; }
}
/* The real button covers the row; its name comes from aria-label. */
.model-results li > button { position: absolute; inset: 0; padding: 0; border: 0; border-radius: var(--radius-md); background: transparent; color: transparent; font-size: 0; cursor: pointer; }
.model-results li > button:disabled { cursor: default; }
.model-results li > button:focus-visible { outline-offset: -2px; }
.model-results li.model-group-start { margin-block-start: var(--space-8); }
.model-results .model-group-label { position: absolute; inset-inline-start: var(--space-3); inset-block-end: calc(100% + var(--space-2)); color: var(--color-muted); font-size: var(--text-caption); font-weight: var(--weight-strong); }
/* A verified maker mark from /shared/model-logos sits in the tile; it follows the ink, so both themes read. */
.model-results li.has-mark::before { content: ""; }
.model-mark {
  grid-column: 1; grid-row: 1 / span 2; place-self: center; inline-size: 22px; block-size: 22px; background: var(--color-ink);
  -webkit-mask: var(--model-mark) center / contain no-repeat; mask: var(--model-mark) center / contain no-repeat;
}
.model-results li.is-current > .model-mark { display: none; }
@media (max-width: 480px) { .model-mark { inline-size: 18px; block-size: 18px; } }
/* Fine print behind one tap; it sits above the row's whole-row target so reading it never chooses the model. */
.model-details { grid-column: 2 / -1; position: relative; z-index: 1; justify-self: start; max-inline-size: 100%; color: var(--color-muted); font-size: var(--text-caption); line-height: 1.7; }
.model-details[open] { justify-self: stretch; }
.model-details > summary { display: inline-flex; align-items: center; min-block-size: 32px; cursor: pointer; font-weight: var(--weight-medium); }
@media (pointer: coarse) { .model-details > summary { min-block-size: 44px; } }
.model-details > p { margin-block-start: var(--space-1); overflow-wrap: anywhere; }
.model-details > p > strong { color: var(--color-ink); font-weight: var(--weight-strong); }
.model-details-note { color: color-mix(in srgb, var(--color-warning) 70%, var(--color-ink)); }
.model-locked-group { display: grid; gap: var(--space-2); margin-block-start: var(--space-6); }
.model-locked-group .model-list-heading .text-button { min-block-size: 44px; }
.model-results li > a.model-row-link { position: absolute; inset: 0; border-radius: var(--radius-md); }
.model-results li > a.model-row-link:focus-visible { outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) {
  .model-results li:has(> button:not(:disabled)):hover, .model-results li:has(> a.model-row-link):hover, .model-default:not(:disabled):hover { background: var(--color-fill); }
  .model-results li:has(> button:not(:disabled)):hover > p { color: var(--color-ink); }
}
.model-results li:has(> button:focus-visible) > p { color: var(--color-ink); }
.model-results li:has(> button:active:not(:disabled)), .model-default:active:not(:disabled) { background: var(--color-fill-strong); }
.model-pages { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); color: var(--color-muted); font-size: var(--text-caption); }
.model-pages .button:disabled { visibility: hidden; }
.model-pages p:empty { display: none; }
.model-cost { margin-inline: calc(-1 * var(--space-6)); padding-inline: var(--space-6); border-block-start: 1px solid var(--color-separator); color: var(--color-muted); font-size: var(--text-caption); }
.model-cost > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-block-size: var(--control-height); padding-block: var(--space-3); font-size: var(--text-subhead); cursor: pointer; }
.model-cost > summary::after { content: ""; flex: none; inline-size: 18px; block-size: 18px; background: currentColor; transition: transform var(--motion-fast) var(--ease-out); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.model-cost[open] > summary::after { transform: rotate(180deg); }
.model-cost > p { margin-block-end: var(--space-3); }

/* Reasoning depth: a capsule beside the model trigger that opens the + menu's panel. */
.effort-control { flex: none; }
.effort-trigger {
  display: inline-flex; align-items: center; gap: var(--space-1); min-block-size: 36px; padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); background: var(--color-fill);
  color: var(--color-muted); font-size: var(--text-footnote); font-weight: var(--weight-medium); white-space: nowrap;
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-base) var(--spring-bouncy);
}
.effort-trigger .icon { inline-size: 14px; block-size: 14px; }
@media (hover: hover) and (pointer: fine) { .effort-trigger:hover { background: var(--color-fill-strong); color: var(--color-ink); } }
.effort-trigger:active { transform: scale(.96); }
.effort-trigger[aria-disabled="true"] { cursor: default; transform: none; }
.effort-panel { gap: var(--space-1); }
.effort-option { justify-content: flex-start; min-block-size: 44px; padding-inline: var(--space-3); }
@media (pointer: coarse) { .effort-option, .effort-trigger, .model-picker-trigger { min-block-size: 44px; } }
.effort-option.is-current { background: var(--color-accent-soft); }
/* .nav-row keeps its pointer highlight on ::after; here the same box is the check. */
.effort-option.is-current::after { position: static; opacity: 1; margin-inline-start: auto; }
.effort-hint { padding-inline: var(--space-3); margin-block-start: var(--space-1); }
.auto-section-option > span { display: grid; gap: var(--space-1); text-align: start; }
.auto-section-option { min-block-size: 44px; }
.model-section-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.auto-section-chip { min-block-size: 44px; padding-inline: var(--space-3); background: var(--color-fill); color: var(--color-ink); font-size: var(--text-caption); }
.auto-section-chip[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent); }
.answer-attribution { margin-block-start: var(--space-1); color: var(--color-muted); font-size: var(--text-caption); overflow-wrap: anywhere; }
/* What a finished reply cost («رشد-۲۰»): one quiet caption, like the attribution above it. */
.reply-cost { margin-block-start: 2px; color: var(--color-muted); font-size: var(--text-caption); font-variant-numeric: tabular-nums; }

/* Making an image (js/image-compose.js, DESIGN.md Components). Image mode swaps the model capsule for the image maker
   and its price; files, effort and the chat estimate step aside because a description is all that is sent. */
.image-mode-bar { display: flex; padding-inline: var(--space-1); }
.image-mode-bar[hidden], .image-model-control[hidden] { display: none; }
.image-mode-chip { border: 0; font: inherit; font-size: var(--text-caption); font-weight: var(--weight-medium); padding-inline: var(--space-2) var(--space-1); cursor: pointer; }
.image-mode-chip .icon { inline-size: 16px; block-size: 16px; flex: none; }
.image-mode-chip:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.message-form.image-mode :is(.model-control, #effort-control, #chat-context-tools, .composer-attachments),
.composer-area:has(.message-form.image-mode) #message-estimate { display: none; }
.image-model-control:not([hidden]) { display: flex; align-items: center; gap: var(--space-1); min-inline-size: 0; flex: 0 1 auto; }
.image-model-select {
  min-inline-size: 0; max-inline-size: 100%; min-block-size: 36px; padding: var(--space-1) var(--space-3); border: 0; border-radius: var(--radius-full);
  background: transparent; box-shadow: none; color: var(--color-ink); font: inherit; font-size: var(--text-footnote); font-weight: var(--weight-medium);
  text-overflow: ellipsis; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.image-model-select[data-single="false"] {
  padding-inline-end: calc(var(--space-3) + 18px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366666b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right var(--space-2) center / 14px no-repeat;
}
[dir="rtl"] .image-model-select[data-single="false"] { background-position: left var(--space-2) center; }
.image-model-select[data-single="true"] { pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .image-model-select[data-single="false"]:hover { background-color: var(--color-fill); } }
.image-model-select:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.image-price { flex: none; color: var(--color-muted); font-size: var(--text-caption); font-variant-numeric: var(--numeric); white-space: nowrap; }
@media (pointer: coarse) { .image-model-select, .image-mode-chip { min-block-size: 44px; } }
/* A ready-made assistant (ui/assistants.js) rides in the composer as the same chip: removable on a new chat, a plain fact inside
   its conversation. A new chat must not scroll, so it lists the first four assistants on a phone and six from 600px.
   shortcut: later assistants are not reachable from a new chat; add a sheet when more than six are active. */
span.assistant-chip { cursor: default; padding-inline-end: var(--space-3); animation: none; }
.suggestion[data-kind="assistant"] { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4.5 20.5a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E"); }
.suggestion[data-kind="assistant"][aria-pressed="true"] { background: color-mix(in srgb, var(--color-accent-fill) 12%, var(--color-surface)); box-shadow: inset 0 0 0 1.5px var(--color-accent); }
/* An admin may write a 60-character name or a 200-character starter: two lines at most, so a new chat still fits. The whole
   starter goes into the composer, and the name stays whole in the tooltip and the composer chip. */
.suggestion:is([data-kind="assistant"], [data-kind="assistant-starter"]) > span:first-child {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.suggestion[data-kind="assistant-starter"] { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 4 5 5M4 20l5-1L21 7a2 2 0 0 0-5-5L4 14l-1 7Z'/%3E%3C/svg%3E"); }
.suggestions[data-kind="assistants"] > .suggestion:nth-child(n+7) { display: none; }
@media (max-width: 599px) { .suggestions[data-kind="assistants"] > .suggestion:nth-child(n+5) { display: none; } }

/* The picture is the reply. Before it arrives a square holds its place, so nothing jumps when it lands. */
.image-pending, .generated-image-frame { display: grid; place-items: center; border-radius: var(--radius-lg); background: var(--color-fill); overflow: hidden; }
.image-pending { inline-size: min(100%, 400px); }
.image-pending { aspect-ratio: 1; padding: var(--space-4); color: var(--color-muted); font-size: var(--text-footnote); text-align: center; animation: breathe 2.4s ease-in-out infinite; }
.generated-image { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); inline-size: min(100%, 400px); margin: 0; }
.generated-image-frame { grid-column: 1 / -1; min-block-size: 120px; }
.generated-image-frame:is([data-state="loading"], [data-state="failed"]), .generated-image-frame:not([data-state]) { aspect-ratio: 1; }
.generated-image-frame[data-state="ready"] { background: transparent; }
.generated-image-frame[data-state="failed"] { gap: var(--space-2); align-content: center; }
.generated-image-open { display: block; inline-size: 100%; padding: 0; border: 0; border-radius: inherit; background: none; cursor: zoom-in; }
.generated-image-open img { display: block; inline-size: 100%; block-size: auto; border-radius: inherit; }
.generated-image-open:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.generated-image-note { margin: 0; padding: var(--space-4); color: var(--color-muted); font-size: var(--text-footnote); text-align: center; }
.generated-image-caption { color: var(--color-muted); font-size: var(--text-caption); font-variant-numeric: var(--numeric); }
.generated-image-actions { display: flex; grid-column: -2; gap: var(--space-2); }
.generated-image-download { text-decoration: none; }
.image-viewer { padding: var(--space-3); }
@media (min-width: 600px) { .image-viewer { inline-size: min(100% - 48px, 860px); } }
.image-viewer[open] { gap: var(--space-3); }
.image-viewer img { display: block; inline-size: 100%; block-size: auto; max-block-size: calc(92dvh - 6rem); border-radius: var(--radius-md); object-fit: contain; }
.image-viewer-actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--space-2); }
@media (prefers-reduced-motion: reduce) { .image-pending { animation: none; } }
