/* =========================================================
   Notebook Assist (assist.js): the ✦ entry points, its menu, the panel
   (a card at the right of a wide window, a bottom sheet on a phone),
   suggestions under their lines and the bar that gathers them.
   One accent for Assist: warm. Verdicts use green, red and the muted grey.
   ========================================================= */

/* ── Entry points ── */
.nb-tool[data-tool="assist"] svg { color: var(--warm); }
.nb-sheet-ic.nb-sheet-ic-assist svg { color: var(--warm); }
.nb-selbar .nb-selbar-assist { color: var(--warm); background: color-mix(in srgb, var(--warm) 12%, transparent); }
.nb-selbar .nb-selbar-assist:hover, .nb-selbar .nb-selbar-assist:focus-visible { background: color-mix(in srgb, var(--warm) 22%, transparent); }
.nb-selbar .nb-selbar-assist svg { width: 16px; height: 16px; }
/* Docked on a phone: the sparkle alone keeps the bar inside the screen. */
.nb-selbar.is-docked .nb-selbar-assist .lbl { display: none; }
.nb-block-sheet-panel button.assist {
  color: var(--warm);
  border-color: color-mix(in srgb, var(--warm) 40%, var(--border));
  background: color-mix(in srgb, var(--warm) 8%, var(--bg-card));
  font-weight: 600;
}
.nb-block-sheet-panel button.assist span[aria-hidden] { color: var(--warm); display: inline-grid; place-items: center; }
.nb-block-sheet-panel button.assist svg { width: 17px; height: 17px; }

/* ── The menu ── */
.nb-block-sheet.nb-sheet-pop.nb-sheet-assist .nb-block-sheet-panel { width: min(540px, calc(100vw - 16px)); max-height: min(640px, calc(100dvh - 24px)); }
.nb-block-sheet.nb-sheet-pop.nb-sheet-assist-outline .nb-block-sheet-panel { width: min(440px, calc(100vw - 16px)); max-height: min(640px, calc(100dvh - 24px)); }
.ast-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nb-block-sheet-panel .ast-tools button.ast-tool {
  align-items: flex-start;
  gap: 10px;
  min-height: 64px;
  padding: 10px 11px;
  border-radius: 12px;
  text-align: left;
  font-size: 0.9rem;
  white-space: normal;
}
.nb-block-sheet-panel .ast-tools button.ast-tool:hover { border-color: color-mix(in srgb, var(--warm) 45%, var(--border)); background: color-mix(in srgb, var(--warm) 6%, var(--bg-card)); }
.nb-block-sheet-panel button span.ast-ic[aria-hidden] {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--warm);
  background: color-mix(in srgb, var(--warm) 13%, transparent);
}
.ast-ic svg { width: 17px; height: 17px; }
.ast-tl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ast-tl b { font: 600 0.9rem/1.2 var(--font-heading); color: var(--text); }
.ast-tl small { font-size: 0.74rem; line-height: 1.3; color: var(--text-muted); font-weight: 400; }
.nb-sheet-pop .nb-block-sheet-panel .ast-tools button.ast-tool { min-height: 52px; padding: 8px 10px; }
.nb-sheet-pop .nb-block-sheet-panel .nb-sheet-sec { margin-top: 4px; }
.ast-note { margin-top: 8px; }
/* One column on a narrow phone (or with big text) so each line fits. */
@media (max-width: 360px) { .ast-tools { grid-template-columns: minmax(0, 1fr); } }

.ast-in {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  padding: 10px 10px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--warm) 40%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--warm) 9%, var(--bg-card));
}
.ast-in p { flex: 1; margin: 0; font-size: 0.86rem; line-height: 1.4; color: var(--text); }
/* Two ways in (Request access or sign in, and your own AI); your own AI in use: a calm teal note. */
.ast-in-btns { display: flex; flex-direction: column; gap: 6px; flex: none; }
.ast-in.own { border-color: color-mix(in srgb, var(--teal) 40%, var(--border)); background: color-mix(in srgb, var(--teal) 8%, var(--bg-card)); }
.nb-block-sheet-panel button.ast-in-btn.ghost { background: transparent; border-color: var(--border-hover); color: var(--text); font-weight: 600; }
@media (max-width: 480px) { .ast-in { flex-wrap: wrap; } .ast-in-btns { flex-direction: row; width: 100%; } .ast-in-btns > button { flex: 1 1 0; } }
.nb-block-sheet-panel button.ast-in-btn {
  flex: none;
  width: auto;
  min-height: 40px;
  padding: 0 16px;
  justify-content: center;
  border-color: var(--warm);
  background: var(--warm);
  color: #1d140c;
  font-weight: 700;
}
.ast-scope, .ast-as {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.nb-block-sheet-panel .ast-scope button {
  flex: 1;
  justify-content: center;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.nb-block-sheet-panel .ast-scope button[aria-checked="true"] { background: var(--bg-card); color: var(--text); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warm) 55%, transparent); }
.nb-block-sheet-panel button.ast-last { min-height: 44px; margin-top: 8px; font-size: 0.86rem; color: var(--text-dim); background: transparent; }

/* Outline: what it is for, an optional topic, Make. */
.ast-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nb-block-sheet-panel .ast-kinds button {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 66px;
  padding: 9px 12px;
  white-space: normal;
}
.ast-kinds b { font: 600 0.92rem/1.2 var(--font-heading); }
.ast-kinds small { font-size: 0.74rem; line-height: 1.3; color: var(--text-muted); font-weight: 400; }
.nb-block-sheet-panel .ast-kinds button[aria-checked="true"] { border-color: var(--warm); background: color-mix(in srgb, var(--warm) 11%, var(--bg-card)); box-shadow: 0 0 0 1px var(--warm); }
.ast-topic { display: flex; flex-direction: column; gap: 6px; margin: 8px 2px 2px; font-size: 0.78rem; color: var(--text-muted); }
.ast-topic input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border2, var(--border));
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.ast-topic input:focus { outline: none; border-color: color-mix(in srgb, var(--warm) 70%, transparent); }
.nb-block-sheet-panel button.ast-go, .nb-sheet-pop .nb-block-sheet-panel button.ast-go {
  justify-content: center;
  min-height: 46px;
  margin-top: 6px;
  border-color: var(--warm);
  background: var(--warm);
  color: #1d140c;
  font-weight: 700;
}

/* ── The panel ── */
.ast-panel { position: fixed; inset: 0; z-index: 9300; pointer-events: none; }
.ast-panel-back { display: none; }
.ast-panel-box {
  pointer-events: auto;
  position: fixed;
  top: calc(var(--nb-uh, 0px) + var(--nb-topbar-h, 56px) + 10px);
  right: 12px;
  bottom: 12px;
  width: min(400px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border2, var(--border));
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateX(14px);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-theme="light"] .ast-panel-box { box-shadow: 0 20px 50px rgba(20, 24, 40, 0.16), 0 2px 6px rgba(20, 24, 40, 0.08); }
.ast-panel.open .ast-panel-box { opacity: 1; transform: none; }
/* A wide window: the page moves over, so both stay in view. */
@media (min-width: 1100px) {
  html.ast-side .nb-main { padding-right: 424px; }
  html.ast-side .nb-main.rail-on { display: block; }
  html.ast-side .nb-rail { display: none; }
}
/* Narrower than that: a bottom sheet (the page cannot sit beside the panel). */
@media (max-width: 1099px) {
  .ast-panel-back { display: block; position: absolute; inset: 0; pointer-events: auto; background: rgba(6, 8, 14, 0.45); opacity: 0; transition: opacity 0.18s ease; }
  [data-theme="light"] .ast-panel-back { background: rgba(20, 24, 40, 0.24); }
  .ast-panel.open .ast-panel-back { opacity: 1; }
  .ast-panel-box {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: 640px;
    margin: 0 auto;
    max-height: min(86dvh, calc(100dvh - 48px));
    border-bottom: none;
    border-radius: 18px 18px 0 0;
    transform: translateY(24px);
  }
}
.ast-panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.ast-panel-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--warm); background: color-mix(in srgb, var(--warm) 13%, transparent); }
.ast-panel-ic svg { width: 18px; height: 18px; }
.ast-panel-tt { flex: 1; min-width: 0; }
.ast-panel-tt h2 { margin: 0; font: 600 1.02rem/1.25 var(--font-heading); color: var(--text); outline: none; }
.ast-panel-sub { margin: 2px 0 0; font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ast-x { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text-dim); cursor: pointer; }
.ast-x svg { width: 18px; height: 18px; }
.ast-x:hover, .ast-x:focus-visible { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); outline: none; }
@media (pointer: coarse) { .ast-x { width: 44px; height: 44px; } }
.ast-panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 16px; }
.ast-panel-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.ast-panel-foot[hidden] { display: none; }
@media (max-width: 1099px) { .ast-panel-foot .ast-btn { flex: 1; } }

.ast-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border2, var(--border));
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font: 600 0.86rem/1 var(--font-heading);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ast-btn:hover { border-color: var(--border-hover, var(--border2)); }
.ast-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--warm) 70%, transparent); outline-offset: 2px; }
.ast-btn:disabled { opacity: 0.5; cursor: default; }
.ast-btn.ast-primary { border-color: var(--warm); background: var(--warm); color: #1d140c; }
.ast-btn.ast-primary:hover { background: color-mix(in srgb, var(--warm) 88%, #fff); }
.ast-btn.ast-quiet { border-color: transparent; background: transparent; color: var(--text-dim); }
@media (pointer: coarse) { .ast-btn { min-height: 44px; } }

/* Working */
.ast-work { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 6px 10px; }
.ast-orb { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; color: var(--warm); background: radial-gradient(circle, color-mix(in srgb, var(--warm) 22%, transparent), transparent 70%); animation: astPulse 1.8s ease-in-out infinite; }
.ast-orb svg { width: 30px; height: 30px; animation: astSpin 6s linear infinite; }
@keyframes astPulse { 50% { transform: scale(1.08); } }
@keyframes astSpin { to { transform: rotate(360deg); } }
.ast-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.ast-steps li { position: relative; padding-left: 26px; font-size: 0.9rem; line-height: 1.4; color: var(--text-muted); }
.ast-steps li::before { content: ''; position: absolute; left: 6px; top: 0.42em; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--border2, var(--border)); }
.ast-steps li.now { color: var(--text); }
.ast-steps li.now::before { border-color: var(--warm); background: var(--warm); animation: astBlink 1.1s ease-in-out infinite; }
.ast-steps li.done { color: var(--text-dim); }
.ast-steps li.done::before { border-color: var(--green); background: var(--green); }
@keyframes astBlink { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .ast-orb, .ast-orb svg, .ast-steps li.now::before { animation: none; } .ast-panel-box, .ast-panel-back { transition: none; } }
.ast-fail { padding: 18px 2px; }
.ast-fail p { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--text); }
.ast-lead { margin: 4px 0 12px; font-size: 0.95rem; line-height: 1.5; color: var(--text); }
.ast-small { margin: 8px 0 0; font-size: 0.78rem; line-height: 1.45; color: var(--text-muted); }
.ast-empty { padding: 14px 2px; }

/* Fact-check */
.ast-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }
.ast-v { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.8rem; color: var(--text-dim); }
.ast-v::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.ast-v.ok::before { background: var(--green); }
.ast-v.no::before { background: var(--red); }
.ast-v b { color: var(--text); font-weight: 700; }
.ast-claims { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ast-claim { padding: 11px 12px 12px; border: 1px solid var(--border); border-left: 3px solid var(--text-muted); border-radius: 12px; background: var(--bg-card); }
.ast-claim[data-v="ok"] { border-left-color: var(--green); }
.ast-claim[data-v="no"] { border-left-color: var(--red); }
.ast-claim-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ast-badge { display: inline-flex; align-items: center; gap: 6px; font: 700 0.7rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.ast-badge-ic { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: color-mix(in srgb, var(--text) 10%, transparent); }
.ast-badge-ic svg { width: 11px; height: 11px; }
.ast-badge.ok { color: var(--green); }
.ast-badge.ok .ast-badge-ic { background: color-mix(in srgb, var(--green) 18%, transparent); }
.ast-badge.no { color: var(--red); }
.ast-badge.no .ast-badge-ic { background: color-mix(in srgb, var(--red) 18%, transparent); }
[data-theme="light"] .ast-badge.ok { color: color-mix(in srgb, var(--green) 62%, #000); }
[data-theme="light"] .ast-badge.no { color: color-mix(in srgb, var(--red) 75%, #000); }
.ast-goto { flex: none; min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-dim); font: 600 0.75rem/1 var(--font-heading); cursor: pointer; }
.ast-goto:hover, .ast-goto:focus-visible { color: var(--text); border-color: var(--border2, var(--border)); outline: none; }
@media (pointer: coarse) { .ast-goto { min-height: 40px; } }
.ast-claim-t { margin: 8px 0 0; font-size: 0.93rem; line-height: 1.5; color: var(--text); }
.ast-quote { margin: 9px 0 0; padding: 2px 0 2px 11px; border-left: 2px solid var(--border2, var(--border)); font-size: 0.86rem; line-height: 1.5; color: var(--text-dim); }
.ast-quote-k { display: block; margin-bottom: 2px; font: 700 0.64rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--red); }
.ast-quote.closest .ast-quote-k { color: var(--text-muted); }
[data-theme="light"] .ast-quote-k { color: color-mix(in srgb, var(--red) 75%, #000); }
.ast-src { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--teal); font: 500 0.8rem/1.3 var(--font-heading); text-decoration: none; text-align: left; cursor: pointer; }
.ast-src svg { flex: none; width: 13px; height: 13px; }
.ast-src span { overflow-wrap: anywhere; }
.ast-src:hover span { text-decoration: underline; }
[data-theme="light"] .ast-src { color: color-mix(in srgb, var(--teal) 70%, #000); }
.ast-claim-note { margin: 6px 0 0; font-size: 0.8rem; line-height: 1.45; color: var(--text-muted); }
.ast-checked { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.ast-checked h3 { margin: 0 0 8px; font: 400 0.64rem/1.2 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.ast-checked ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ast-checked li { font-size: 0.84rem; line-height: 1.4; color: var(--text); overflow-wrap: anywhere; }
.ast-checked li a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border2, var(--border)); text-underline-offset: 3px; }
.ast-checked li span { color: var(--text-muted); font-size: 0.78rem; }
.ast-checked p { margin: 0; font-size: 0.84rem; color: var(--text-dim); }
.ast-checked p.ast-small { margin-top: 12px; font-size: 0.78rem; color: var(--text-muted); }

/* Add sources */
.ast-srcs { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ast-srcs li { display: flex; align-items: stretch; gap: 6px; }
.ast-src-row { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); cursor: pointer; }
.ast-src-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ast-box { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border2, var(--border)); background: var(--bg); }
.ast-src-row input:checked + .ast-box { border-color: var(--warm); background: var(--warm); }
.ast-src-row input:checked + .ast-box::after { content: ''; width: 9px; height: 5px; margin-top: -2px; border-left: 2.2px solid #1d140c; border-bottom: 2.2px solid #1d140c; transform: rotate(-45deg); }
.ast-src-row input:focus-visible + .ast-box { outline: 2px solid color-mix(in srgb, var(--warm) 70%, transparent); outline-offset: 2px; }
.ast-src-row:has(input:checked) { border-color: color-mix(in srgb, var(--warm) 45%, var(--border)); }
.ast-src-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ast-src-t b { font: 600 0.9rem/1.3 var(--font-heading); color: var(--text); overflow-wrap: anywhere; }
.ast-src-t small { font-size: 0.76rem; line-height: 1.35; color: var(--text-muted); }
.ast-src-open { flex: none; display: grid; place-items: center; width: 44px; border: 1px solid var(--border); border-radius: 12px; color: var(--text-dim); }
.ast-src-open svg { width: 16px; height: 16px; }
.ast-src-open:hover { color: var(--teal); border-color: var(--border2, var(--border)); }
.ast-as { align-items: center; }
.ast-as > span { padding: 0 8px 0 9px; font: 400 0.64rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.ast-as button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--text-dim); font: 600 0.84rem/1 var(--font-heading); cursor: pointer; }
.ast-as button[aria-checked="true"] { background: var(--bg-card); color: var(--text); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warm) 55%, transparent); }
@media (pointer: coarse) { .ast-as button { min-height: 42px; } }

/* ── Suggestions under their lines ── */
.ast-sug {
  margin: 2px 0 14px 28px;
  padding: 10px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--warm) 38%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--warm) 6%, var(--bg-card));
  user-select: text;
  animation: astIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes astIn { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .ast-sug { animation: none; } }
.ast-sug-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ast-sug-k { display: inline-flex; align-items: center; gap: 5px; font: 700 0.66rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--warm); }
.ast-sug-k svg { width: 14px; height: 14px; }
[data-theme="light"] .ast-sug-k { color: color-mix(in srgb, var(--warm) 60%, #000); }
.ast-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ast-tags i { padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); font: 400 0.7rem/1.4 var(--font-heading); font-style: normal; color: var(--text-dim); }
.ast-sug-diff { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.ast-sug-diff ins { text-decoration: none; color: var(--text); background: color-mix(in srgb, var(--green) 22%, transparent); border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.ast-sug-diff del { color: var(--text-muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 70%, transparent); }
.ast-sug-why { margin: 6px 0 0; font-size: 0.8rem; color: var(--text-muted); }
.ast-sug-was { margin: 6px 0 0; padding-left: 10px; border-left: 2px solid var(--border2, var(--border)); font-size: 0.84rem; line-height: 1.5; color: var(--text-muted); }
.ast-sug-was span { font: 700 0.62rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
@media (max-width: 880px) { .ast-sug { margin-left: 0; } }
.ast-sug-paras p { margin: 8px 0 0; font-size: 1rem; line-height: 1.65; color: var(--text); }
.ast-sug-gap { margin: 8px 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--text-dim); }
.ast-sug-gap b { color: var(--text); font-weight: 600; }
.ast-sug-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ast-sug-acts .ast-btn { min-height: 36px; padding: 0 14px; }
@media (pointer: coarse) { .ast-sug-acts .ast-btn { min-height: 44px; } }
/* Phones: the buttons share the width; Insert below takes a row of its own. */
@media (max-width: 880px) {
  .ast-sug-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ast-sug-expand .ast-sug-acts .ast-primary { grid-column: 1 / -1; }
  .ast-sug-acts .ast-quiet { border-color: var(--border); }
}

/* ── The bar while suggestions wait ── */
.ast-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 9100;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border2, var(--border));
  border-radius: 999px;
  background: var(--bg-elevated);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.2);
  animation: astBarIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
[data-theme="light"] .ast-bar { box-shadow: 0 12px 28px rgba(20, 24, 40, 0.15), 0 2px 6px rgba(20, 24, 40, 0.08); }
@keyframes astBarIn { from { opacity: 0; transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .ast-bar { animation: none; } }
.ast-bar button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font: 600 0.84rem/1 var(--font-heading); white-space: nowrap; cursor: pointer; }
.ast-bar button:hover, .ast-bar button:focus-visible { background: color-mix(in srgb, var(--text) 9%, transparent); outline: none; }
.ast-bar .ast-bar-ic { display: inline-grid; color: var(--warm); }
.ast-bar .ast-bar-ic svg { width: 15px; height: 15px; }
.ast-bar .ast-bar-ok { background: var(--warm); color: #1d140c; }
.ast-bar .ast-bar-ok:hover, .ast-bar .ast-bar-ok:focus-visible { background: color-mix(in srgb, var(--warm) 88%, #fff); }
@media (min-width: 1100px) { html.ast-side .ast-bar { left: calc(50% - 212px); } }
/* A message while the bar shows: above it. */
@media (min-width: 881px) { html.ast-bar-on .nb-toast { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); } }
/* Phones: on the row of the Undo pill, at the left, over the thumb bar. */
@media (max-width: 880px) {
  .ast-bar, html.ast-side .ast-bar {
    left: 10px;
    transform: none;
    bottom: calc(var(--nb-mobile-bar-h) + env(safe-area-inset-bottom, 0px) + 8px + var(--nb-kb, 0px));
    max-width: calc(100vw - 124px);
  }
  @keyframes astBarIn { from { opacity: 0; transform: translateY(6px); } }
  .ast-bar button { min-height: 44px; padding: 0 12px; }
  .ast-bar .ast-bar-w { display: none; }
  .nb-body:has(> .nb-block-sheet) .ast-bar { visibility: hidden; }
  html.ast-bar-on { --nb-undo-lift: 54px; }
}
@media print { .ast-sug, .ast-bar, .ast-panel { display: none !important; } }

/* Light paper: the warm accent is a deep rust there, so its buttons carry white words. */
[data-theme="light"] .ast-btn.ast-primary,
[data-theme="light"] .ast-bar .ast-bar-ok,
[data-theme="light"] .nb-block-sheet-panel button.ast-go,
[data-theme="light"] .nb-block-sheet-panel button.ast-in-btn { color: #fff; }
[data-theme="light"] .nb-block-sheet-panel button.ast-in-btn.ghost { color: var(--text); }
[data-theme="light"] .ast-src-row input:checked + .ast-box::after { border-color: #fff; }
