/* Daily Life Doc, round 13 (zone F3), rebuilt in round 32 (zone AF): the Ask AI panel (js/ask/ask-panel.js), drawn as
   the page "Expert Plans" draws it: the head "Ask AI" with the switch This client · Knowledge base (.scope), ✕ and
   what Ask AI is about (.achg); the turns (.amsgs > .aent: the expert's words in pink on the right, .am.me; then Ask
   AI's part on the left, .am.ai: "Thinking…" (.work), the plan sentence (.akp), the checklist (.akl, one tinted row
   .akr per step, its mark .akm: a number, a spinner, a tick, "!" or a dashed ring), the answer (.aka) and the
   buttons (.acts)); the shortcuts above the box (.ashort); the box (.afield, pink) with the ⓘ
   and the round Send. Borderless tinted rows; a row whose state changed (.chg) eases into its new tint and its mark
   springs. On a client page it stands in the plan's place, on the knowledge base in the right column, on the Clients
   page (.clp, js/ask/ask-clients.js) in a column on the right; at 880 px and narrower it covers the page. */

.wask { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.wask .ah { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; row-gap: 4px; padding: 12px 10px 8px 14px; }
.wask .ah b { display: flex; flex-direction: column; min-width: 0; font-size: var(--t-s); margin-right: auto; color: var(--care-d); }
/* Round 16 (R4): under the head, what Ask AI is about ("Changing: Harman's copy of Breathing"); a long name wraps. */
.wask .achg { flex: 1 0 100%; min-width: 0; margin: 0; font-size: var(--t-xs); line-height: 1.35; color: var(--ink2); overflow-wrap: anywhere; }
.wask .achg:empty { display: none; }
.scope { flex: none; display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.scope button { font-size: var(--t-xs); font-weight: 500; color: var(--ink2); padding: 4px 9px; white-space: nowrap; border-radius: 999px; transition: background-color .3s, color .3s, box-shadow .3s; }
.scope button.on { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.scope button[disabled] { color: var(--ink3); opacity: .55; cursor: default; }
.askx { width: 28px; height: 28px; flex: none; background: var(--soft); }
.askx svg { width: 14px; height: 14px; }
.kbask .askx { display: none; }

/* ---------- The turns ---------- */
.amsgs { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 8px 12px 10px; overflow-y: auto; scrollbar-width: thin; }
.amsgs > :first-child { margin-top: auto; }
.aent { display: flex; flex-direction: column; gap: 8px; flex: none; }
.aent.in { animation: dd-rise var(--m-add) var(--ease-out) both; }
.am { display: flex; flex-direction: column; gap: 6px; flex: none; min-width: 0; }
.am.me { align-items: flex-end; }
.am.ai { align-items: stretch; }
.am p { margin: 0; }
.ab { max-width: 92%; padding: 7px 11px; border-radius: 16px; font-size: var(--t-s); line-height: 1.42; overflow-wrap: anywhere; }
.am.me .ab { background: var(--care); color: var(--ink); border-bottom-right-radius: 6px; white-space: pre-wrap; }
/* Round 40 (fixer FX-H): a turn the app started (an upload woke Ask AI) is one quiet line in the middle, not the expert's. */
.am.sys { align-items: center; }
.asys { max-width: 92%; font-size: var(--t-xs); color: var(--ink3); text-align: center; overflow-wrap: anywhere; }
/* A turn that came by Telegram or text says so under the words. */
.akc { font-size: var(--t-2xs); color: var(--ink3); margin-right: 4px; }
.akp, .aka { align-self: flex-start; max-width: 92%; padding: 8px 12px; border-radius: 16px; border-bottom-left-radius: 6px; background: var(--bubble); color: var(--ink);
  font-size: var(--t-s); line-height: 1.42; overflow-wrap: anywhere; animation: dd-fade 240ms ease both; }
/* The AI's answer with its few marks (js/ask/ask-text.js): paragraphs and lists with a small gap, no outer margin. */
.aka .amd, .aka ul.amd, .aka ol.amd { margin: 0; }
.aka .amd + .amd { margin-top: 6px; }
.aka ul.amd, .aka ol.amd { padding-left: 18px; }
.aka li + li { margin-top: 2px; }
/* Round 36 (zone A): the link of an app for the expert at the end of an answer, and (round 53, the re-walk's fault 6)
   every link inside an answer, in the colour of See. */
.aka a { color: var(--care-d); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.am .work { font-size: var(--t-xs); color: var(--ink3); animation: dd-wait 1100ms ease-in-out infinite; }
.am .work.done { animation: none; }
.work .wnow { margin-left: 6px; color: var(--ink2); }
.cnot { font-size: var(--t-s); color: var(--try-d); }
.am .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; animation: dd-fade 240ms ease both; }
.astop .sq { width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.see { font: inherit; font-size: var(--t-xs); font-weight: 500; color: var(--care-d); text-decoration: underline; text-underline-offset: 3px; padding: 0; }

/* ---------- The checklist: one tinted row per step ---------- */
.akl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.akr { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--soft) 70%, transparent);
  font-size: var(--t-s); line-height: 1.4; color: var(--ink); transition: background-color var(--m-step) ease, color var(--m-step) ease; }
.akr.look { padding: 5px 10px; font-size: var(--t-xs); color: var(--ink2); background: transparent; }
.akr.s-run { background: var(--soft); }
.akr.s-done { background: color-mix(in srgb, var(--good-bg) 55%, transparent); }
.akr.s-fail { background: color-mix(in srgb, var(--bad-bg) 70%, transparent); }
.akr.s-skip { background: transparent; color: var(--ink3); }
.akr.look.s-done { background: transparent; }
.akt { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.akr .akn { margin-top: 2px; font-size: var(--t-xs); color: var(--ink2); }
.akr.s-fail .akn { color: var(--bad-d); }
.akr.s-skip .akn { color: var(--ink3); }
.akr .see { flex: none; align-self: center; }
.akl.off .akr { background: transparent; }
.akl.off .akw { color: var(--ink3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink3) 60%, transparent); }
/* The mark: a number while the step waits, a spinner while it runs, a tick, "!", a dashed ring when skipped. */
.akm { position: relative; flex: none; width: 20px; height: 20px; margin-top: 0; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  color: var(--ink2); font-size: var(--t-2xs); font-weight: 600; line-height: 1; }
.akr.look .akm { width: 16px; height: 16px; margin-top: 0; }
.s-run .akm { background: transparent; border: 2px solid color-mix(in srgb, var(--ink3) 28%, transparent); border-top-color: var(--sage-d); animation: ask-spin 800ms linear infinite; }
.s-done .akm { background: var(--good); }
.s-done .akm::after { content: ''; width: 8px; height: 4.5px; margin-top: -2px; border: solid var(--on-mine); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.s-fail .akm { background: var(--bad); }
.s-fail .akm::after { content: '!'; color: var(--on-mine); font-size: var(--t-xs); font-weight: 700; }
.s-skip .akm { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--ink3) 70%, transparent); }
.akr.look.s-done .akm { background: color-mix(in srgb, var(--good) 75%, transparent); }
/* A row whose state changed since it was last drawn: its tint eases in, its mark springs, a tick draws itself. */
.akr.chg { animation: ask-row 520ms var(--ease-out) both; }
.akr.chg .akm { animation: dd-pop 300ms var(--ease-spring); }
.akr.chg.s-run .akm { animation: ask-spin 800ms linear infinite; }
.akr.chg.s-done .akm::after { animation: dd-tick 380ms var(--ease-spring) both; }
@keyframes ask-spin { to { transform: rotate(360deg); } }
@keyframes ask-row { from { background-color: color-mix(in srgb, var(--soft) 70%, transparent); } }

/* ---------- The shortcuts and the box ---------- */
/* One row that scrolls sideways when the shortcuts are more than the panel's width. */
.ashort { flex: none; display: flex; gap: 6px; padding: 2px 12px 2px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.ashort::-webkit-scrollbar { display: none; }
.ashort.none { display: none; }
.ashb { flex: none; color: var(--ink2); animation: dd-fade 240ms ease both; }
.afield { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 6px; }
.afield .uinfo { flex: none; margin: 0 2px 10px; }
.afield .xin { flex: 1; min-width: 0; min-height: 40px; max-height: 160px; border: 0; border-radius: 20px; padding: 10px 14px; background: var(--care); color: var(--ink);
  font: inherit; font-size: var(--t-s); line-height: 1.4; resize: none; overflow-y: auto; }
.afield .xin::placeholder { color: var(--care-d); opacity: .75; }
.afield .xin:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--care-d) 30%, transparent); }

/* The client page: Ask AI in the plan's place; at phone width over the whole page. */
.cpb[data-side="ask"] .cpin { height: 100%; }

/* ---------- The Clients page (js/ask/ask-clients.js): a column on the right while open ---------- */
.top .cl-askr { display: none; }
.clask { display: none; }
.page:has(> .tabview[data-tab="clients"] .clp.askon) { overflow: hidden; display: flex; flex-direction: column; }
.tabview[data-tab="clients"]:has(.clp.askon) { flex: 1; min-height: 0; }
.clp.askon { flex: 1; height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
.clp.askon > .cl-page { min-width: 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.clp.askon > .clask { display: flex; min-width: 0; min-height: 0; border-radius: 18px; background: var(--card); overflow: hidden; animation: dd-rise var(--m-add) var(--ease-out) both; }
.top .cl-askb.on { box-shadow: inset 0 0 0 1.5px currentColor; }

@media (max-width: 880px) {
  .cpb[data-side="ask"] .cpside { display: block; position: fixed; inset: 0; z-index: 40; border-radius: 0; animation: dd-rise .3s var(--ease-out) both; }
  .kbp.askon .kbask .askx { display: grid; }
  .wask .ah { padding-top: max(12px, env(safe-area-inset-top)); }
  .afield { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .afield .xin { font-size: var(--t-m); }
  .top .cl-askb { display: none; }
  .top .cl-askr { display: grid; }
  .clp.askon { display: block; }
  .clp.askon > .clask { position: fixed; inset: 0; z-index: 40; border-radius: 0; height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .akr.chg, .akr.chg .akm, .aent.in, .akp, .aka, .ashb, .am .acts { animation: none; }
  .s-run .akm, .akr.chg.s-run .akm { animation-duration: 2400ms; }
}
