/* Live chat: the Chat button (assets/js/chat.js), Admin → Live chats, and the chat alerts on every admin page
   (assets/js/admin-chat.js). Colours come from the theme, so it follows dark and light mode. */
.chat, .admin-live, [data-cs] {
  --c-list: var(--bg);          /* behind the messages */
  --c-them: var(--surface-2);   /* their bubbles */
  --c-shadow: 0 30px 70px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(231, 190, 49, .05);
}
:root[data-theme="light"] .chat, :root[data-theme="light"] .admin-live, :root[data-theme="light"] [data-cs] {
  --c-list: var(--surface-2);
  --c-them: #FFFFFF;
  --c-shadow: 0 28px 60px -18px rgba(30, 40, 8, .35);
}

/* ---------- the Chat button ---------- */
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 902; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 15px;
  border: 0; border-radius: 999px; background: var(--grad); color: var(--on-gold); font: 700 14px var(--sans); cursor: pointer;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .7), 0 0 0 4px var(--btn-glow); transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, background .25s ease; }
.chat-fab:hover { background: var(--grad-hover); transform: translateY(-2px); box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .75), 0 0 0 8px var(--btn-glow); }
.chat-fab:active { transform: translateY(0) scale(.97); }
.chat-fab:focus-visible { outline: none; box-shadow: var(--focus), 0 14px 34px -10px rgba(0, 0, 0, .7); }
.chat-fab svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; transition: transform .3s ease; }
.chat.is-open .chat-fab svg { transform: rotate(-8deg) scale(.92); }
:root[data-theme="light"] .chat-fab { box-shadow: 0 14px 30px -12px rgba(30, 40, 8, .45), 0 0 0 6px var(--btn-glow); }
.chat-dot { position: absolute; top: -5px; right: -5px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: #D9452F; color: #fff;
  font: 800 11.5px/21px var(--sans); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.chat-dot[hidden] { display: none; }
/* Motion on the button: it pops in, a soft gold ring ripples out (3 times, then every 12 s),
   a light sweep crosses the gold every 6 s, and the bubble icon wiggles on hover */
.chat-fab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .chat-fab { background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%) no-repeat, var(--grad);
    background-size: 260% 100%, 100% 100%; background-position: 160% 0, 0 0;
    animation: chat-pop .6s .5s cubic-bezier(.34, 1.4, .64, 1) backwards, chat-sweep 6s 2s ease-in-out infinite; }
  .chat-fab:hover { background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%) no-repeat, var(--grad-hover);
    background-size: 260% 100%, 100% 100%; }
  .chat-fab::after { animation: chat-ring 2.4s 1.4s ease-out 3, chat-ring-late 12s 9s ease-out infinite; }
  .chat.is-open .chat-fab::after, .chat.is-open .chat-fab { animation-play-state: paused; }
  .chat-fab:hover svg { animation: chat-wiggle .6s ease-in-out; }
  .chat-dot:not([hidden]) { animation: chat-pulse 2s ease-in-out infinite; }
}
@keyframes chat-sweep { 0%, 70% { background-position: 160% 0, 0 0; } 100% { background-position: -60% 0, 0 0; } }
@keyframes chat-ring { 0% { box-shadow: 0 0 0 0 rgba(222, 205, 52, .55); } 100% { box-shadow: 0 0 0 16px rgba(222, 205, 52, 0); } }
@keyframes chat-ring-late { 0%, 80% { box-shadow: 0 0 0 0 rgba(222, 205, 52, 0); } 81% { box-shadow: 0 0 0 0 rgba(222, 205, 52, .5); } 100% { box-shadow: 0 0 0 16px rgba(222, 205, 52, 0); } }
@keyframes chat-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.08); } 55% { transform: rotate(10deg) scale(1.08); } 80% { transform: rotate(-4deg); } }
@keyframes chat-pop { from { opacity: 0; transform: translateY(14px) scale(.85); } }
@keyframes chat-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 0 rgba(217, 69, 47, .45); } 50% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 7px rgba(217, 69, 47, 0); } }

/* ---------- the chat window ---------- */
.chat-panel { position: fixed; right: 20px; bottom: 76px; z-index: 901; width: 350px; max-width: calc(100vw - 32px); height: 500px; max-height: calc(100vh - 100px);
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--c-shadow); font-family: var(--sans);
  opacity: 0; transform: translateY(18px) scale(.96); transform-origin: bottom right; transition: opacity .22s ease, transform .3s cubic-bezier(.2, .85, .25, 1); }
.chat-panel.in { opacity: 1; transform: none; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 10px 11px 14px; background: var(--brand-bg); color: var(--brand-text); border-bottom: 1px solid var(--brand-line); }
.chat-title { display: grid; gap: 3px; min-width: 0; }
.chat-title b { font: 700 14px/1.25 var(--head); }
.chat-status { font-size: 12px; color: var(--brand-dim); display: inline-flex; align-items: center; gap: 7px; }
.chat-status.on { color: var(--brand-muted); }
.chat-status.on::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5BC56A; box-shadow: 0 0 0 3px rgba(91, 197, 106, .22); }
.chat-acts { display: flex; align-items: center; gap: 6px; }
.chat-x, .chat-end { height: 30px; border-radius: 8px; border: 1px solid var(--brand-line); background: transparent; color: var(--brand-text); cursor: pointer; font: 600 12.5px var(--sans);
  transition: background .2s ease, color .2s ease, transform .25s ease; }
.chat-x { width: 30px; display: grid; place-items: center; }
.chat-x svg, .chat-hint-x svg, .al-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.chat-end { padding: 0 10px; }
.chat-x:hover, .chat-end:hover { background: var(--brand-bg-2); color: var(--brand-accent); }
.chat-x:hover { transform: rotate(90deg); }
.chat-end[hidden] { display: none; }

.chat-msgs, .cs-msgs, .al-msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; background: var(--c-list); }
.chat-msgs { padding: 12px 12px 6px; }
.cm { max-width: 84%; display: grid; gap: 2px; }
.cm p { margin: 0; padding: 8px 11px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm small { font-size: 11px; color: var(--text-3); padding: 0 5px; font-variant-numeric: tabular-nums; }
.cm-them { align-self: flex-start; }
.cm-them p { background: var(--c-them); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.cm-me { align-self: flex-end; text-align: right; }
.cm-me p { background: var(--grad); color: var(--on-gold); border-bottom-right-radius: 5px; text-align: left; font-weight: 500; }
.cm .cm-receipt { color: var(--text-3); }
.cm .cm-receipt.seen { color: var(--ok); font-weight: 600; }
.cm-hi .chat-help { font-size: 12.5px; color: var(--gold); padding: 0 5px; text-decoration: underline; text-underline-offset: 2px; }
.cm-hi .chat-help:hover { color: var(--gold-hover); }
@media (prefers-reduced-motion: no-preference) {
  .cm { animation: cm-in .35s cubic-bezier(.2, .8, .2, 1) both; }
  .cm-me { transform-origin: bottom right; }
  .cm-them { transform-origin: bottom left; }
}
@keyframes cm-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.chat-typing, .cs-typing, .al-typing { margin: 0; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; background: var(--c-list); }
.chat-typing { padding: 2px 18px 10px; }
.chat-typing[hidden], .cs-typing[hidden], .al-typing[hidden] { display: none; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .35; animation: chat-dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes chat-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-form { display: grid; gap: 6px; padding: 10px 10px 8px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form[hidden] { display: none; }
.chat-who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-form input, .chat-form textarea, .chat-rate textarea, .cs-reply textarea, .al-send textarea {
  width: 100%; box-sizing: border-box; min-height: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: 13.5px/1.4 var(--sans); resize: none; transition: border-color .2s ease, box-shadow .2s ease; }
:root[data-theme="light"] .chat-form input, :root[data-theme="light"] .chat-form textarea, :root[data-theme="light"] .chat-rate textarea,
:root[data-theme="light"] .cs-reply textarea, :root[data-theme="light"] .al-send textarea { background: #fff; }
.chat-form input:focus, .chat-form textarea:focus, .chat-rate textarea:focus, .cs-reply textarea:focus, .al-send textarea:focus { outline: none; border-color: var(--gold-line); box-shadow: var(--focus); }
.chat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.chat-send, .chat-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 13px; border: 0; border-radius: 10px; background: var(--grad); color: var(--on-gold);
  font: 700 13.5px var(--sans); cursor: pointer; transition: background .2s ease, transform .2s ease, opacity .2s ease; }
.chat-send svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.chat-send:hover, .chat-btn:hover { background: var(--grad-hover); }
.chat-send:active, .chat-btn:active { transform: scale(.97); }
.chat-send:disabled, .chat-btn:disabled { opacity: .5; cursor: default; transform: none; }
.chat-btn-ghost { height: 38px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font: 600 14px var(--sans); cursor: pointer; }
.chat-btn-ghost:hover { color: var(--text); border-color: var(--gold-line); }
.chat-err { margin: 0; font-size: 13px; color: var(--err); }
.chat-err[hidden] { display: none; }
.chat-note { margin: 0; font-size: 11px; color: var(--text-3); text-align: center; }
.chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* End chat and the rating */
.chat-rate { display: grid; gap: 8px; padding: 12px 12px 14px; border-top: 1px solid var(--border); text-align: center; justify-items: center; background: var(--surface); }
.chat-rate b { font: 700 14px var(--head); }
.chat-rate-note { margin: 0; font-size: 12.5px; color: var(--text-3); }
.chat-stars { display: flex; gap: 4px; }
.chat-stars button { width: 34px; height: 34px; border: 0; background: none; font-size: 25px; line-height: 1; color: var(--border); cursor: pointer; transition: transform .15s ease, color .15s ease; }
.chat-stars button.on { color: #E7BE31; }
.chat-stars button:hover { transform: scale(1.15); }
.chat-stars button:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.chat-rate-row { display: flex; gap: 8px; justify-content: center; }

/* "Need help? 👋" above the Chat button */
.chat-hint { position: fixed; right: 20px; bottom: 76px; z-index: 900; display: flex; align-items: flex-start; gap: 2px; max-width: 230px; padding: 3px; border-radius: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--c-shadow); font-family: var(--sans);
  animation: chat-hint-in .45s cubic-bezier(.2, .85, .25, 1) both; transition: opacity .2s ease, transform .2s ease; }
.chat-hint.out { opacity: 0; transform: translateY(8px) scale(.97); }
.chat-hint::after { content: ""; position: absolute; right: 30px; bottom: -7px; width: 12px; height: 12px; background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
.chat-hint-body { display: grid; gap: 1px; padding: 7px 2px 7px 10px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font-family: var(--sans); }
.chat-hint-body b { font-size: 13.5px; transition: color .2s ease; }
.chat-hint-body span { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.chat-hint-body:hover b { color: var(--gold); }
.chat-hint-x { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--text-3); cursor: pointer; }
.chat-hint-x:hover { background: var(--surface-2); color: var(--text); }
@keyframes chat-hint-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }

@media (max-width: 560px) {
  .chat-fab span { display: none; }
  .chat-fab { right: 14px; bottom: 14px; padding: 0; width: 50px; height: 50px; justify-content: center; }
  .chat-panel { right: 10px; left: 10px; bottom: 74px; width: auto; max-width: none; height: min(480px, calc(100vh - 96px)); height: min(480px, calc(100dvh - 96px)); }
  .chat-hint { right: 14px; bottom: 74px; }
  .chat-hint::after { right: 22px; }
  .chat-who { grid-template-columns: 1fr; }
  /* 16px text in the boxes: phones (iPhone) zoom the whole page in when you tap smaller text */
  .chat-form input, .chat-form textarea, .chat-rate textarea { font-size: 16px; }
  .chat-send span { display: none; }
  .chat-send { width: 38px; padding: 0; }
  /* Sign-in pages: the button sits at the end of the page instead of floating over the form */
  .chat-auth { display: flex; justify-content: center; padding: 4px 16px 28px; }
  .chat-auth .chat-fab { position: relative; right: auto; bottom: auto; width: auto; height: 42px; padding: 0 20px 0 16px; box-shadow: none; }
  .chat-auth .chat-fab span { display: inline; }
  body:has(.chat:not(.chat-auth)) .site-footer { padding-bottom: 76px; }
}

/* ---------- Admin → Live chats ---------- */
.badge[hidden] { display: none !important; }
.cs-tiles { margin-bottom: 22px; }
.cs-wrap { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.cs-list, .cs-conv { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.cs-list { max-height: 640px; overflow-y: auto; }
.cs-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 76px; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none;
  transition: background .2s ease; }
.cs-row:first-child { border-top: 0; }
.cs-row:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.cs-row:hover { background: var(--surface-2); }
.cs-row.cur { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.cs-av, .al-av { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font: 700 12px var(--sans); }
.cs-row.unread .cs-av { background: var(--grad); color: var(--on-gold); border-color: transparent; }
.cs-main { min-width: 0; display: grid; gap: 2px; }
.cs-main b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-main span { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-row.unread .cs-main b { font-weight: 800; }
.cs-row.unread .cs-main span { color: var(--text-2); }
.cs-when { display: grid; gap: 4px; justify-items: start; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; padding-left: 12px; border-left: 1px solid var(--border); }
.cs-count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--grad); color: var(--on-gold); font: 800 11px/20px var(--sans); text-align: center; }
.cs-stars { color: #E7BE31; letter-spacing: 1px; font-size: 11px; }
.cs-empty { margin: 0; padding: 24px 18px; color: var(--text-2); font-size: 14px; }
.cs-conv { display: flex; flex-direction: column; min-height: 460px; }
.cs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.cs-back { display: none; font-size: 13px; font-weight: 600; flex-basis: 100%; }
.cs-who { display: grid; gap: 4px; min-width: 0; }
.cs-who b { font: 700 16px var(--head); }
.cs-who > span { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.cs-who a { color: var(--text-2); }
.cs-here i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #5BC56A; margin-right: 5px; vertical-align: 1px; }
.cs-here[hidden] { display: none; }
.cs-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.cs-acts form { margin: 0; }
.cs-danger { color: var(--err); }
.cs-danger:hover { border-color: var(--err); color: var(--err); }
.cs-ended { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--gold-soft); font-size: 13px; color: var(--text-2); }
.cs-rating .cs-stars { font-size: 13px; }
.cs-msgs { padding: 18px; max-height: 520px; min-height: 260px; }
.cs-msgs .cm { max-width: 74%; }
.cs-typing { padding: 0 18px 10px; }
.cs-reply { display: grid; gap: 10px; padding: 14px 18px 16px; border-top: 1px solid var(--border); }
.cs-reply textarea { resize: vertical; }
.cs-send { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 980px) {
  .cs-wrap { grid-template-columns: 1fr; }
  .cs-wrap.has-thread .cs-list { display: none; }
  .cs-wrap:not(.has-thread) .cs-conv { display: none; }
  .cs-back { display: block; }
  .cs-msgs .cm { max-width: 88%; }
}
@media (max-width: 640px) {
  .cs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-head { padding: 12px 14px; }
  .cs-msgs { padding: 14px; }
  .cs-reply { padding: 12px 14px 14px; }
}

/* ---------- Admin: chat alerts on every admin page ---------- */
.al-slot { margin-top: 10px; }
.al-slot:empty { display: none; }
.al-alerts { display: grid; gap: 8px; }
.al-ctl { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--brand-line); border-radius: 10px; background: transparent; color: var(--brand-muted);
  font: 600 13.5px var(--sans); cursor: pointer; text-align: left; transition: background .2s ease, color .2s ease; }
.al-ctl svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.al-ctl:hover, .al-ctl[aria-expanded="true"] { background: var(--brand-bg-2); color: var(--brand-text); }
.al-menu { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: var(--brand-bg-2); border: 1px solid var(--brand-line); animation: al-up .2s ease both; }
.al-menu[hidden] { display: none; }
.al-menu b { font-size: 12.5px; color: var(--brand-text); }
.al-opt { text-align: left; border: 1px solid var(--brand-line); border-radius: 9px; padding: 8px 11px; background: var(--brand-bg); color: var(--brand-text); font: 600 13px var(--sans); cursor: pointer; }
.al-opt:hover:not(:disabled) { border-color: var(--gold-line); }
.al-opt:disabled { cursor: default; color: var(--brand-dim); }
.al-opt[hidden] { display: none; }
.al-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--brand-dim); }

.al-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 950; display: grid; gap: 8px; width: min(330px, calc(100vw - 24px)); }
.admin-live.has-chat .al-toasts { right: 370px; }
.al-toast { display: grid; grid-template-columns: 34px minmax(0, 1fr) 26px; gap: 10px; padding: 11px 10px 11px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--gold-line);
  box-shadow: var(--c-shadow); font-family: var(--sans); animation: al-in .5s cubic-bezier(.16, 1, .3, 1) both; transition: opacity .22s ease, transform .22s ease; }
.al-toast .al-av { width: 34px; height: 34px; background: var(--grad); color: var(--on-gold); border: 0; font-size: 13px; }
.al-main { min-width: 0; display: grid; gap: 4px; }
.al-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.al-top b { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-top small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.al-toast p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.al-acts { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.al-later { border: 0; background: none; color: var(--text-3); font: 600 13px var(--sans); cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.al-later:hover { color: var(--text); background: var(--surface-2); }
.al-x { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--text-3); cursor: pointer; transition: background .2s ease, color .2s ease, transform .25s ease; }
.al-x:hover { background: var(--surface-2); color: var(--text); transform: rotate(90deg); }
.al-toast.out, .al-chat.out { opacity: 0; transform: translateY(10px) scale(.98); }

.al-chat { position: fixed; right: 20px; bottom: 20px; z-index: 951; display: flex; flex-direction: column; width: min(340px, calc(100vw - 24px)); height: min(460px, calc(100vh - 100px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--c-shadow); font-family: var(--sans);
  animation: al-up .35s cubic-bezier(.2, .85, .25, 1) both; transition: opacity .22s ease, transform .22s ease; }
.al-head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 28px; gap: 8px; align-items: center; padding: 9px 8px 9px 12px; background: var(--brand-bg); color: var(--brand-text); border-bottom: 1px solid var(--brand-line); }
.al-head .al-av { width: 32px; height: 32px; background: var(--grad); color: var(--on-gold); border: 0; }
.al-who { min-width: 0; display: grid; }
.al-who b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-who small { font-size: 11.5px; color: var(--brand-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-full { font-size: 12px; font-weight: 600; color: var(--brand-accent); white-space: nowrap; }
.al-full:hover { text-decoration: underline; }
.al-head .al-x { color: var(--brand-muted); }
.al-head .al-x:hover { background: var(--brand-bg-2); color: var(--brand-text); }
.al-msgs { padding: 12px; }
.al-typing { padding: 2px 14px 8px; }
.al-err { margin: 0; padding: 7px 14px; font-size: 12.5px; color: var(--err); background: var(--err-soft); }
.al-err[hidden] { display: none; }
.al-send { display: flex; gap: 6px; align-items: flex-end; padding: 8px; border-top: 1px solid var(--border); margin: 0; }
.al-send textarea { flex: 1; max-height: 120px; }
.al-send .btn { height: 38px; }
@keyframes al-in { from { opacity: 0; transform: translateX(28px) scale(.98); } }
@keyframes al-up { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@media (max-width: 640px) {
  .admin-live.has-chat .al-toasts { right: 12px; bottom: auto; top: 76px; }
  .al-toasts, .al-chat { right: 12px; bottom: 12px; }
}

/* ---------- less motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-hint, .al-toast, .al-chat, .al-menu { animation: none; transition: none; }
  .chat-panel { transform: none; }
  .dots i { animation: none; opacity: .7; }
  .chat-x:hover, .al-x:hover { transform: none; }
}
@media print { .chat, .admin-live { display: none !important; } }
