/* Ask Claude side panel of the owner screen (ask-sidebar.js). Uses the look's own colours from portal.css,
   so it follows every look (aurora, night sky, engraved dark, engraved cream).
   1280px and wider: a panel on the right, 380px wide, and the page steps aside, so the page stays usable.
   700 to 1279px: the same panel on top of the page with a shade, like the other pop-ups.
   Phone (under 700px): the whole screen. The head with Close always stays in sight; the rest scrolls.
   Text is 18px or more everywhere; every press is 48px tall or more and has words on it. */

.askc-fab,
.askc-panel {
  --ask-w: 380px;
  font-variant-numeric: lining-nums tabular-nums;
}

/* engraved cream: the panel is cream paper with dark ink, the same as the pop-ups of that look */
[data-theme="engraved-cream"] .askc-panel {
  color-scheme: light;
  --ink: #0a1826;
  --soft: #23323f;
  --quiet: #465665;
  --rule: rgba(160, 122, 56, .50);
  --line: #a9843f;
  --accent: #96702c;
  --fig: #0a1826;
  --fig-rule: #b8914f;
  --focus: #0f6d72;
  --on: #0a1826;
  --link: #0a1826;
  --stamp: #3e5a7a;
  --box-bg: rgba(255, 253, 247, .55);

  --btn1-bg: #0a1826;
  --btn1-ink: #fbf8f2;
  --btn1-line: #c9a368;
  --btn1-icon: #e5bf7c;
  --btn1-shadow: 0 6px 14px -8px rgba(10, 24, 38, .65);
  --btn2-bg: #fffdf8;
  --btn2-ink: #0a1826;
  --btn2-line: #b08a4a;
  --btn2-icon: #0a1826;
  --btn2-shadow: none;
  --btn3-bg: #0a1826;
  --btn3-ink: #fbf8f2;
  --btn3-line: #c9a368;
  --btn3-icon: #e5bf7c;
  --btn3-shadow: 0 6px 14px -8px rgba(10, 24, 38, .65);
  --btn4-bg: #0a1826;
  --btn4-ink: #fbf8f2;
  --btn4-line: #c9a368;
  --btn4-icon: #e5bf7c;
  --btn4-shadow: 0 6px 14px -8px rgba(10, 24, 38, .65);
  --picked-ring: #0a1826;

  --field-bg: #fffefa;
  --field-ink: #0a1826;
  --field-line: #a9843f;
  --tick-bg: #0a1826;
  --tick-ink: #fbf8f2;

  --ring-line: #b08a4a;
  --ring-ink: #0a1826;
  --ring-bg: transparent;
  --good: #0d5f41;
  --good-bg: rgba(20, 122, 82, .09);
  --good-line: rgba(13, 95, 65, .55);
  --warn: #6d4a0c;
  --warn-bg: rgba(201, 163, 104, .18);
  --warn-line: #a9843f;
  --bad: #9a2419;
  --bad-bg: rgba(190, 60, 44, .08);
  --bad-line: rgba(154, 36, 25, .55);
}

[data-theme="engraved-cream"] .askc-chatname {
  color: #6d4a0c;
}

/* ---- the floating "Ask Claude" button ---- */
.askc-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  min-height: 56px;
  padding: 10px 24px;
  border-radius: 999px;
  box-shadow: 0 14px 32px -12px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .35);
}

.askc-fab[hidden] {
  display: none;
}

/* engraved cream: the small shadow of that look's own buttons */
[data-theme="engraved-cream"] .askc-fab {
  box-shadow: 0 6px 14px -8px rgba(10, 24, 38, .65);
}

/* The focus ring is drawn INSIDE the button, in the button's own word colour, and the shadow stays as it is.
   The button floats over the page, so a ring outside it lay on whatever happened to be under it (the review
   cards, a teal button) and was too faint there in some looks (join pass, Oct 16). */
.askc-fab:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--btn1-ink, #051b22), 0 14px 32px -12px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .35);
}

[data-theme="engraved-cream"] .askc-fab:focus-visible {
  box-shadow: inset 0 0 0 3px var(--btn1-ink, #fbf8f2), 0 6px 14px -8px rgba(10, 24, 38, .65);
}

/* a field or button that gets the keyboard focus scrolls up clear of the button */
html.askc-ready {
  scroll-padding-bottom: 104px;
}

/* room at the end of the page, so the last line can scroll up past the button */
.askc-spacer {
  height: 92px;
}

@media (max-width: 899px) {
  .askc-fab {
    right: 14px;
    bottom: calc(var(--bar-h, 76px) + env(safe-area-inset-bottom, 0px) + 12px);
  }
  html.askc-ready {
    scroll-padding-bottom: calc(var(--bar-h, 76px) + 104px);
  }
}

/* ---- the panel ---- */
.askc-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  display: block;
  width: min(var(--ask-w), 100vw);
  max-width: 100vw;
  background: var(--pop-bg, #0c2233);
  border-left: 1px solid var(--panel-line, rgba(196, 230, 240, .2));
  box-shadow: -24px 0 60px -30px rgba(0, 0, 0, .85);
  color: var(--ink, #f7f2e8);
  font: 400 1.125rem/1.45 var(--font-body, Georgia, serif);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 104px;   /* a field that gets the focus scrolls clear of the sticky head */
  scroll-padding-bottom: 16px;
}

.askc-panel[hidden],
.askc-shade[hidden] {
  display: none;
}

/* 1280px and wider: the page steps aside for the panel (ask-sidebar.js sets askc-docked) */
html.askc-docked body {
  margin-right: 380px;
}

/* ...and the owner's own pop-ups (Fix it, Ask the client, the company list) open in the page part, left of
   the panel, so no pop-up and no Close button ever lies under the panel (join pass, Oct 16) */
html.askc-docked .popup {
  right: 380px;
}

/* narrower: a shade over the page, and the page underneath stays still */
.askc-shade {
  position: fixed;
  inset: 0;
  z-index: 149;
  background: var(--shade, rgba(2, 7, 13, .74));
}

html.askc-sheet,
html.askc-sheet body {
  overflow: hidden;
}

@media (max-width: 699px) {
  .askc-panel {
    left: 0;
    width: 100vw;
    border-left: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* the title and Close: always in sight while the panel scrolls (the same as the pop-ups) */
.askc-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px 20px;
  border-bottom: 1px solid var(--rule, rgba(200, 226, 236, .2));
  background: var(--pop-bg, #0c2233);
}

.askc-titles {
  flex: 1 1 auto;
  min-width: 0;
}

.askc-title {
  margin: 0;
  font: var(--w-head, 540) 1.5rem/1.2 var(--font-head, Georgia, serif);
  color: var(--ink, #f7f2e8);
}

.askc-chatname {
  margin: 4px 0 0;
  font: 600 1.125rem/1.3 var(--font-ui, Georgia, serif);
  color: var(--accent, #f0c577);
  overflow-wrap: anywhere;
}

.askc-close {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 8px 18px;
}

/* effort picker and how full the chat is */
.askc-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule, rgba(200, 226, 236, .2));
}

.askc-effort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.askc-effort-word {
  margin-right: 4px;
  font: 600 1.125rem/1.2 var(--font-ui, Georgia, serif);
  color: var(--soft, #dfe7ea);
}

.askc-eff {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 18px;
  border: 1px solid var(--btn2-line, rgba(200, 228, 238, .32));
  border-radius: var(--btn-radius, 9px);
  background: var(--btn2-bg, #1b3242);
  color: var(--btn2-ink, #f7f2e8);
  font: var(--w-btn2, 400) 1.125rem/1.2 var(--font-ui, Georgia, serif);
  cursor: pointer;
}

.askc-eff:focus-visible {
  outline: 3px solid var(--focus, #a6ede5);
  outline-offset: 3px;
}

.askc-eff.is-on {
  border-color: var(--good-line, rgba(124, 220, 170, .55));
  background: var(--good-bg, rgba(74, 190, 136, .14));
  font-weight: 650;
}

/* a green dot by the effort in use, like his green circles */
.askc-eff.is-on::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3fbf6f;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}

.askc-full-words {
  margin: 0 0 6px;
  font: 400 1.125rem/1.3 var(--font-ui, Georgia, serif);
  color: var(--soft, #dfe7ea);
}

.askc-meter {
  height: 8px;
  border-radius: 4px;
  background: var(--rule, rgba(200, 226, 236, .2));
  overflow: hidden;
}

.askc-meter-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: var(--on, #8fdcd5);
}

.askc-panel.is-due .askc-meter-fill {
  background: var(--warn, #f1cb88);
}

/* "Time for a new chat" */
.askc-due {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--warn-line, rgba(231, 188, 114, .6));
  border-radius: 12px;
  background: var(--warn-bg, rgba(231, 188, 114, .13));
}

.askc-due[hidden] {
  display: none;
}

.askc-due-words {
  margin: 0;
  color: var(--ink, #f7f2e8);
}

.askc-due .btn {
  width: 100%;
  min-height: 52px;
  padding: 9px 14px;
  font-size: 1.125rem;
  white-space: normal;
}

/* off, signed out, a problem */
.askc-note {
  margin: 12px 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--line, rgba(200, 228, 238, .38));
  border-radius: 12px;
  background: var(--box-bg, rgba(7, 20, 31, .34));
}

.askc-note[hidden] {
  display: none;
}

.askc-note-words {
  margin: 0 0 6px;
  font-weight: var(--w-strong, 680);
  color: var(--ink, #f7f2e8);
}

.askc-note-step {
  margin: 0 0 6px;
  color: var(--soft, #dfe7ea);
}

.askc-note .askc-again {
  margin-top: 6px;
  min-height: 48px;
  padding: 8px 18px;
  font-size: 1.125rem;
}

/* the conversation */
.askc-log {
  padding: 14px 16px 8px;
}

/* the hint when the chat is empty, the lines in between and "Claude is thinking" each have their own frame */
.askc-empty,
.askc-line,
.askc-wait {
  margin: 4px 0 14px;
  padding: 8px 12px;
  color: var(--soft, #dfe7ea);
}

.askc-empty {
  border: 1px dashed var(--line, rgba(200, 228, 238, .38));
  border-radius: 12px;
}

.askc-line {
  border-left: 3px solid var(--rule, rgba(200, 226, 236, .2));
  font-style: italic;
}

.askc-wait {
  border-left: 3px solid var(--accent, #f0c577);
  color: var(--ink, #f7f2e8);
}

.askc-msg {
  margin: 0 0 14px;
  padding: 10px 14px 12px;
  border: 1px solid var(--rule, rgba(200, 226, 236, .2));
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.askc-me {
  margin-left: 28px;
  background: var(--field-bg, rgba(33, 50, 62, .72));
}

.askc-claude {
  margin-right: 12px;
  border-left: 3px solid var(--on, #8fdcd5);
  background: var(--box-bg, rgba(7, 20, 31, .34));
}

.askc-example {
  border-style: dashed;
}

.askc-who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font: 600 1.125rem/1.3 var(--font-ui, Georgia, serif);
  color: var(--soft, #dfe7ea);
}

.askc-tag {
  padding: 0 10px;
  border: 1px solid var(--warn-line, rgba(231, 188, 114, .6));
  border-radius: 999px;
  background: var(--warn-bg, rgba(231, 188, 114, .13));
  color: var(--ink, #f7f2e8);
  font-weight: 600;
}

.askc-body .askc-p,
.askc-body .askc-list {
  margin: 0 0 8px;
}

.askc-body .askc-p:last-child,
.askc-body .askc-list:last-child {
  margin-bottom: 0;
}

.askc-body .askc-list {
  padding-left: 1.3em;
}

/* a Markdown heading of Claude's answer, drawn as a bold line (pass 2) */
.askc-body .askc-head-line {
  margin-top: 4px;
}

.askc-body .askc-rows li {
  overflow-wrap: anywhere;
}

.askc-body li {
  margin: 0 0 4px;
}

.askc-body code {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--rule, rgba(200, 226, 236, .2));
  font: inherit;
}

/* the box at the bottom */
.askc-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--rule, rgba(200, 226, 236, .2));
}

.askc-field .label {
  font-size: 1.125rem;
}

.askc-box.input {
  min-height: 96px;
  max-height: 34vh;
  font-size: 1.125rem;
  resize: vertical;
}

.askc-send-row {
  display: flex;
  justify-content: flex-end;
}

.askc-send {
  min-width: 140px;
}

.askc-send:disabled,
.askc-due .btn:disabled {
  cursor: progress;
}

/* the receipt this question is about */
.askc-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line, rgba(200, 228, 238, .38));
  border-left-width: 5px;
  border-radius: 10px;
  background: var(--box-bg, rgba(7, 20, 31, .34));
}

.askc-chip[hidden] {
  display: none;
}

.askc-chip[data-light="green"] { border-left-color: var(--good-line, rgba(124, 220, 170, .55)); }
.askc-chip[data-light="yellow"] { border-left-color: var(--warn-line, rgba(231, 188, 114, .6)); }
.askc-chip[data-light="red"] { border-left-color: var(--bad-line, rgba(255, 160, 146, .65)); }

.askc-chip-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
  margin: 0;
}

.askc-chip-about {
  color: var(--soft, #dfe7ea);
}

.askc-chip-light {
  font-weight: 700;
}

.askc-chip[data-light="green"] .askc-chip-light { color: var(--good, #9be5bd); }
.askc-chip[data-light="yellow"] .askc-chip-light { color: var(--warn, #f1cb88); }
.askc-chip[data-light="red"] .askc-chip-light { color: var(--bad, #ffb9ad); }

.askc-chip-vendor {
  overflow-wrap: anywhere;
}

.askc-chip-total {
  font-weight: 650;
  white-space: nowrap;
}

.askc-chip-off.btn {
  min-height: 48px;
  padding: 6px 10px;
  font-size: 1.125rem;
}

/* PASS 3: on the owner screen the Ask Claude button no longer floats. owner.js moves it into the top bar (computer)
   or the bottom bar (phone) and sets ow-ask-placed; its looks there are in owner-aurora.css. Then the room kept
   for the floating button at the end of the page and under the focus is not needed any more. */
html.ow-ask-placed .askc-spacer {
  display: none;
}

html.ow-ask-placed.askc-ready {
  scroll-padding-bottom: 24px;
}

@media (max-width: 899px) {
  html.ow-ask-placed.askc-ready {
    scroll-padding-bottom: calc(var(--bar-h, 76px) + 24px);
  }
}

/* PASS 3, the answer word by word (ask-sidebar.js 1.2.0): Stop sits next to Send while words come in, and the answer
   being written (.askc-msg[data-live="yes"]) has a soft edge and a blinking cursor at its end, so it is clear the words
   are still coming. The conversation is aria-busy then; nothing here is read out. No blinking when the person asks
   for less movement. */
.askc-send-row {
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.askc-stop {
  min-width: 140px;
}

.askc-stop::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-radius: 2px;
  background: currentColor;
}

.askc-msg[data-live="yes"] {
  border-color: var(--on, #8fdcd5);
  box-shadow: 0 0 0 1px var(--on, #8fdcd5);
}

.askc-msg[data-live="yes"] .askc-body > .askc-p:last-child::after,
.askc-msg[data-live="yes"] .askc-body > .askc-list:last-child > li:last-child::after {
  content: "";
  display: inline-block;
  width: .5em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: text-bottom;
  border-radius: 1px;
  background: currentColor;
  animation: askc-caret 1.05s steps(1) infinite;
}

@keyframes askc-caret {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .askc-msg[data-live="yes"] .askc-body > .askc-p:last-child::after,
  .askc-msg[data-live="yes"] .askc-body > .askc-list:last-child > li:last-child::after {
    animation: none;
  }
}

/* look A (Northern lights): the live answer glows aurora teal at its left edge, as Claude's bubbles do in picture A;
   Stop is the dark glass second button with a soft red square, so it never looks like Send */
:is(html[data-theme="aurora"], html:not([data-theme])) .askc-msg[data-live="yes"] {
  border-color: rgba(63, 199, 180, .7);
  border-left-color: #3fc7b4;
  box-shadow: 0 0 0 1px rgba(63, 199, 180, .35), 0 0 26px -10px rgba(63, 199, 180, .7);
}

:is(html[data-theme="aurora"], html:not([data-theme])) .askc-msg[data-live="yes"] .askc-body > .askc-p:last-child::after,
:is(html[data-theme="aurora"], html:not([data-theme])) .askc-msg[data-live="yes"] .askc-body > .askc-list:last-child > li:last-child::after {
  background: #5fe0cc;
}

:is(html[data-theme="aurora"], html:not([data-theme])) .askc-stop::before {
  background: #f0645a;
}

/* pass 3 run 1: the panel itself takes the focus when it opens from the address on a phone (no ring on the
   whole panel; Tab then goes to its first button, which shows the normal ring) */
.askc-panel:focus {
  outline: none;
}
