/* ═════════ AI Assistant chat (js/views/chat.js, #/ai/chat) ═════════ Tokens only; reuses .ph / .btn / .bdg / .errbox / .lnk. Logical properties where text direction matters (Arabic replies). */
.chat { display: grid; gap: 14px; max-width: 920px; margin-inline: auto; min-height: 100%; grid-template-rows: auto auto 1fr auto auto; }
.chat .ph { margin-bottom: 0; }
.chat .btn--s { padding: 9px 14px; font-size: 11px; }
.chat .btn[disabled] { opacity: .45; pointer-events: none; }
.chat__ban { margin: 0; } .chat__ban code { font: 600 12px var(--font-mono); }

/* conversation */
.chat__log { display: flex; flex-direction: column; gap: 14px; padding: 6px 2px 8px; min-height: 240px; outline: none; }
.chat__m { max-width: min(86%, 720px); display: grid; gap: 6px; min-width: 0; }
.chat__m--u { align-self: flex-end; } .chat__m--a { align-self: flex-start; }
.chat__t { border: 1.5px solid var(--line-strong); background: var(--bg-2); padding: 11px 14px; line-height: 1.6; font-size: 14.5px; overflow-wrap: anywhere; text-align: start; unicode-bidi: plaintext; }
.chat__m--u .chat__t { background: var(--hit); border-color: var(--hit); color: var(--on-hit); white-space: pre-wrap; font-weight: 500; }
.chat__m--a .chat__t { border-inline-start: 4px solid var(--hit); }
.chat__t > * { margin: 0; } .chat__t > * + * { margin-top: .6em; }
.chat__t p, .chat__t li { unicode-bidi: plaintext; }
.chat__ul, .chat__ol { padding-inline-start: 1.4em; display: grid; gap: 4px; } .chat__ul { list-style: square; }
.chat__h { font-size: 15px; } .chat__t strong { font-weight: 800; } .chat__t em { font-style: italic; }
.chat__t code { font: 600 12.5px var(--font-mono); background: var(--bg-3); padding: 1px 5px; border: 1px solid var(--line); direction: ltr; unicode-bidi: isolate; }
.chat__pre { overflow-x: auto; background: var(--bg-3); border: 1px solid var(--line); padding: 10px 12px; max-width: 100%; } .chat__pre code { background: none; border: 0; padding: 0; white-space: pre; }
.chat__n { font-variant-numeric: tabular-nums; font-weight: 700; }
.chat__f { display: flex; align-items: center; gap: 12px; min-height: 26px; color: var(--ink-3); }
.chat__b { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 6px; margin-inline-start: -6px; color: var(--ink-2); font: 700 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: color var(--dur-1), background var(--dur-1); }
.chat__b svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat__b:hover, .chat__b:focus-visible { color: var(--ink); background: var(--bg-3); outline: none; } .chat__b:focus-visible { box-shadow: 0 0 0 2px var(--hit); } .chat__b.is-done { color: var(--ok); }
.chat__c { font-size: 10.5px; }

/* message enter + typing dots */
.chat__m.is-new { animation: chat-in .26s var(--ease-out) both; }
.chat__m--u.is-new { transform-origin: bottom right; }
@keyframes chat-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.chat__m--typing { border: 1.5px solid var(--line-strong); border-inline-start: 4px solid var(--hit); padding: 13px 16px; width: max-content; background: var(--bg-2); animation: chat-in .2s var(--ease-out) both; }
.chat__dots { display: inline-flex; gap: 5px; } .chat__dots i { width: 7px; height: 7px; background: var(--ink-3); animation: chat-dot 1.1s infinite ease-in-out both; } .chat__dots i:nth-child(2) { animation-delay: .16s; } .chat__dots i:nth-child(3) { animation-delay: .32s; }
@keyframes chat-dot { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }

/* empty state + suggestions */
.chat__empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 14px 8px 8px; animation: chat-in .4s var(--ease-out) both; }
.chat__spark { width: 52px; height: 52px; display: grid; place-items: center; border: 1.5px solid var(--hit); color: var(--hit); } .chat__spark svg { width: 26px; height: 26px; fill: currentColor; }
.chat__hi { font: 900 clamp(22px, 4vw, 32px)/1.05 var(--font-display); letter-spacing: -.04em; margin: 4px 0 0; }
.chat__sub { color: var(--ink-2); max-width: 56ch; line-height: 1.55; margin: 0 0 6px; }
.chat__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 760px; }
.chat__chip { font: 600 13px/1.3 var(--font-body); padding: 9px 14px; border: 1.5px solid var(--line-strong); background: var(--bg-2); color: var(--ink); cursor: pointer; text-align: start; transition: transform .2s var(--ease-out), border-color var(--dur-1), background var(--dur-1); }
.chat__chip:hover { border-color: var(--hit); transform: translateY(-2px); background: var(--bg-3); } .chat__chip:active { transform: none; } .chat__chip:focus-visible { outline: 2px solid var(--hit); outline-offset: 2px; }

/* errors and notes */
.chat__err { border: 1.5px solid var(--alert); padding: 12px 14px; display: grid; gap: 6px; max-width: min(100%, 640px); align-self: flex-start; animation: chat-in .22s var(--ease-out) both; } .chat__err p { margin: 0; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.chat__err--config { border-color: var(--hit); } .chat__erra { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chat__note { align-self: center; color: var(--ink-3); font-size: 11px; text-align: center; margin: 0; }

/* composer: stays at the bottom of the page while the log grows */
.chat__form { position: sticky; bottom: 0; z-index: 3; border: 1.5px solid var(--line-strong); background: var(--bg-2); padding: 10px 12px 8px; display: grid; gap: 8px; transition: border-color var(--dur-1), box-shadow var(--dur-1); box-shadow: 0 -14px 14px -10px var(--bg); }
.chat__form:focus-within { border-color: var(--hit); }
.chat__form textarea { width: 100%; resize: none; border: 0; background: transparent; color: var(--ink); font: 500 15px/1.5 var(--font-body); min-height: 28px; max-height: 180px; padding: 2px 0; outline: none; text-align: start; unicode-bidi: plaintext; } .chat__form textarea::placeholder { color: var(--ink-3); } .chat__form textarea:disabled { opacity: .5; cursor: not-allowed; }
.chat__bar { display: flex; align-items: center; gap: 10px; }
.chat__hint { margin-inline-end: auto; font-size: 10.5px; color: var(--ink-3); } .chat__cnt { font-size: 10.5px; color: var(--ink-3); }
.chat__foot { margin: 0; font-size: 10.5px; color: var(--ink-3); text-align: center; line-height: 1.5; }

/* the rail entry: a hint of accent so the Assistant reads as its own place */
.mode--ai .mode__i { color: var(--hit); } .mode--ai.is-on .mode__i { color: inherit; }

@media (max-width: 760px) {
  .chat { gap: 10px; } .chat__m { max-width: 94%; } .chat__hint { display: none; } .chat__bar { justify-content: flex-end; } .chat__t { font-size: 14px; padding: 10px 12px; }
  .chat__form { bottom: 0; } .chat__chip { font-size: 12.5px; padding: 8px 11px; } .chat .ph__r { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .chat__m.is-new, .chat__m--typing, .chat__empty, .chat__err { animation: none; } .chat__dots i { animation: none; opacity: .7; } .chat__chip, .chat__form, .chat__b { transition: none; } .chat__chip:hover { transform: none; }
}
@media (max-width: 480px) { .rail .mode span { font-size: 8.5px; letter-spacing: -.04em; padding-inline: 0; } }          /* six sections share the phone bar: keep "Overview" whole */
