/* ==========================================================================
   CONTROL TOWER · ASSISTANT — the footer action and a WhatsApp-style chat.
   (22 Sep 2026.) WhatsApp's own palette and shapes, so it reads at a glance
   as a chat: green header, doodle wallpaper, white and green bubbles with
   tails, times, ticks, reply buttons, a list sheet.
   ========================================================================== */

:root {
  --wa-head: #008069; --wa-send: #00A884; --wa-wall: #EFEAE2;
  --wa-in: #FFFFFF; --wa-out: #D9FDD3; --wa-ink: #111B21; --wa-sub: #667781;
  --wa-link: #027EB5; --wa-tick: #53BDEB; --wa-line: #E9EDEF; --wa-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --cb-face: #FFE8D2;
}

/* ── the Assistant action: the mascot's face, in the footer (and, on a big
   screen, the top bar). A floating button until the owner moved it to the
   footer (22 Sep 2026). The head sits left of centre in the picture: 155%
   puts the face in the circle. ─────────────────────────────────────────── */
.cb-face { position: absolute; inset: 0; border-radius: 50%; background-color: var(--cb-face); background-repeat: no-repeat; background-size: 155%; background-position: 33% 0%; }
/* The assistant's face, at the size every other icon in the bar is drawn. */
.ct-fassist { position: relative; width: var(--fbb-icon, 22px); height: var(--fbb-icon, 22px); border-radius: 50%; box-shadow: 0 0 0 1px rgba(17, 20, 24, .1); }
.ct-top-assist { display: inline-flex; align-items: center; gap: 6px; }
.ct-top-assist .cb-face { position: relative; inset: auto; display: inline-block; width: 22px; height: 22px; flex: none; }

/* ── the chat: full screen on a phone, a panel on a big screen ────────── */
.cb-chat {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  background: var(--wa-wall); color: var(--wa-ink); font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  animation: cb-up .22s cubic-bezier(.22, 1, .36, 1);
}
.cb-chat[hidden] { display: none; }
@keyframes cb-up { from { transform: translateY(24px); opacity: 0; } }
html.cb-open, html.cb-open body { overflow: hidden; }
@media (min-width: 768px) {
  .cb-chat { inset: auto 24px 24px auto; width: 390px; height: min(680px, calc(100vh - 48px)); border-radius: 16px; overflow: hidden;
    box-shadow: 0 16px 48px rgba(11, 20, 26, .28); }
  html.cb-open, html.cb-open body { overflow: auto; }
  .cb-back { display: none !important; }
}
@media (max-width: 767.98px) { .cb-x { display: none !important; } }

.cb-head { flex: none; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 6px 0 4px; background: var(--wa-head); color: #fff; }
.cb-hbtn { display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.cb-hbtn svg { width: 24px; height: 24px; }
.cb-hbtn:hover { background: rgba(255, 255, 255, .12); }
.cb-hbtn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.cb-ava { width: 40px; height: 40px; flex: none; border-radius: 50%; background-color: var(--cb-face); background-repeat: no-repeat; background-size: 155%; background-position: 33% 0%; }
.cb-who { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 4px; }
.cb-who b { font-size: 16px; line-height: 21px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-status { font-size: 13px; line-height: 17px; opacity: .85; }

/* The wallpaper: WhatsApp's doodle, drawn from the trade (truck, ₹, box, cart, chat). */
.cb-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 8px; display: flex; flex-direction: column;
  background-color: var(--wa-wall);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none' stroke='%23B9AFA1' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' opacity='.35'%3E%3Cpath d='M20 38V26a2 2 0 0 1 2-2h14v14M36 30h6l4 5v3M20 38h26'/%3E%3Ccircle cx='26' cy='40' r='2.5'/%3E%3Ccircle cx='41' cy='40' r='2.5'/%3E%3Cpath d='M118 20h14M118 26h14M118 32l10 10M118 32h4a6 6 0 0 0 0-12'/%3E%3Cpath d='m84 96 10-5 10 5v11l-10 5-10-5z M84 96l10 5 10-5 M94 101v11'/%3E%3Cpath d='M20 120h4l5 16h14l3-11H26'/%3E%3Ccircle cx='31' cy='141' r='1.8'/%3E%3Ccircle cx='41' cy='141' r='1.8'/%3E%3Cpath d='M140 118h22a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-14l-6 5v-5h-2a4 4 0 0 1-4-4v-12a4 4 0 0 1 4-4z'/%3E%3Cpath d='M70 44c6-8 16-8 22 0M150 70l4 8 8 1-6 6 2 8-8-4-8 4 2-8-6-6 8-1z M60 160c4-6 12-6 16 0'/%3E%3C/svg%3E");
}
.cb-chip { align-self: center; max-width: 88%; margin: 6px auto; padding: 5px 12px 6px; border-radius: 8px; background: #fff; box-shadow: var(--wa-shadow);
  font-size: 12.5px; line-height: 17px; color: #54656F; text-align: center; }
.cb-chip:first-child { text-transform: uppercase; font-size: 12px; font-weight: 500; }
.cb-note { background: #FFEECD; color: #54656F; margin-bottom: 10px; }
.cb-note svg { width: 11px; height: 11px; margin: 0 4px -1px 0; }

/* Bubbles: incoming white on the left, the owner's green on the right; the
   first of a run carries a tail. */
.cb-row { display: flex; margin-top: 2px; }
.cb-row.in { justify-content: flex-start; }
.cb-row.out { justify-content: flex-end; }
.cb-row.cb-tail { margin-top: 10px; }
.cb-grp { display: flex; flex-direction: column; max-width: 84%; min-width: 0; }
.cb-row.out .cb-grp { align-items: flex-end; }
.cb-bub { position: relative; padding: 6px 8px 8px 9px; border-radius: 8px; background: var(--wa-in); box-shadow: var(--wa-shadow);
  font-size: 14.5px; line-height: 20px; overflow-wrap: anywhere; }
.cb-row.out .cb-bub { background: var(--wa-out); }
.cb-tail.in .cb-bub { border-top-left-radius: 0; }
.cb-tail.out .cb-bub { border-top-right-radius: 0; }
.cb-tail.in .cb-bub::before { content: ""; position: absolute; top: 0; left: -8px; border-top: 0; border-right: 8px solid var(--wa-in); border-bottom: 12px solid transparent; }
.cb-tail.out .cb-bub::before { content: ""; position: absolute; top: 0; right: -8px; border-left: 8px solid var(--wa-out); border-bottom: 12px solid transparent; }
.cb-txt b { font-weight: 700; }
.cb-time { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 8px -2px -5px 12px; font-size: 11px; line-height: 15px; color: var(--wa-sub); white-space: nowrap; }
.cb-ticks { display: inline-flex; color: #8696A0; }
.cb-ticks svg { width: 16px; height: 16px; }
.cb-ticks.is-read { color: var(--wa-tick); }
.cb-bub.is-img { padding: 3px 3px 8px; }
.cb-img { display: block; width: 240px; max-width: 100%; aspect-ratio: 1; border-radius: 6px; margin-bottom: 4px;
  background: radial-gradient(circle at 50% 38%, #FFF6EA 0, #FDE3C8 70%); }
.cb-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cb-bub.is-img .cb-txt { display: block; padding: 2px 6px 0; }
.cb-bub.is-img .cb-time { margin-right: 4px; }

/* WhatsApp's list button, inside the bubble under a hairline. */
.cb-listbtn { display: flex; align-items: center; justify-content: center; gap: 6px; clear: both; width: calc(100% + 17px); margin: 8px -8px -8px -9px;
  padding: 11px 8px; border: 0; border-top: 1px solid var(--wa-line); border-radius: 0 0 8px 8px; background: none; color: var(--wa-link);
  font: 500 14.5px/18px inherit; font-family: inherit; cursor: pointer; }
.cb-listbtn svg { width: 18px; height: 18px; }
/* Reply buttons: separate white cards under the bubble. */
.cb-btns { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; width: 100%; }
.cb-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 8px;
  background: var(--wa-in); box-shadow: var(--wa-shadow); color: var(--wa-link); font: 500 14.5px/18px inherit; font-family: inherit; cursor: pointer; text-align: center; }
.cb-btn svg { width: 16px; height: 16px; flex: none; }
.cb-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-btn:hover, .cb-listbtn:hover { background: #F5F6F6; }
.cb-btn:focus-visible, .cb-listbtn:focus-visible { outline: 2px solid var(--wa-link); outline-offset: -2px; }
/* A sticker: the mascot, no bubble. */
.cb-stk { position: relative; width: 120px; height: 120px; }
.cb-stk img { width: 120px; height: 120px; object-fit: contain; display: block; }
.cb-stk .cb-time { position: absolute; right: 0; bottom: 0; margin: 0; padding: 1px 6px; border-radius: 8px; background: rgba(255, 255, 255, .85); }

/* typing… */
.cb-typing { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.cb-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9AA6AC; animation: cb-dot 1.1s infinite ease-in-out; }
.cb-typing i:nth-child(2) { animation-delay: .15s; }
.cb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cb-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* The message box: a white pill and WhatsApp's round green send. */
.cb-bar { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px calc(8px + var(--safe, 0px)); background: transparent; }
.cb-input { flex: 1; min-width: 0; height: 46px; padding: 0 18px; border: 0; border-radius: 24px; background: #fff; box-shadow: var(--wa-shadow);
  font: 400 15.5px/20px inherit; font-family: inherit; color: var(--wa-ink); }
.cb-input::placeholder { color: #8696A0; }
.cb-input:focus { outline: none; box-shadow: var(--wa-shadow), 0 0 0 2px rgba(0, 168, 132, .35); }
.cb-send { display: grid; place-items: center; width: 46px; height: 46px; flex: none; padding: 0 0 0 3px; border: 0; border-radius: 50%;
  background: var(--wa-send); color: #fff; cursor: pointer; box-shadow: var(--wa-shadow); transition: opacity .15s, transform .1s; }
.cb-send svg { width: 22px; height: 22px; }
.cb-send:disabled { opacity: .55; cursor: default; }
.cb-send:not(:disabled):active { transform: scale(.94); }

/* The list: WhatsApp's bottom sheet, inside the chat. */
.cb-sheetwrap { position: absolute; inset: 0; z-index: 2; background: rgba(11, 20, 26, .42); display: flex; align-items: flex-end; animation: cb-fade .15s ease; }
.cb-sheetwrap[hidden] { display: none; }
@keyframes cb-fade { from { opacity: 0; } }
.cb-sheet { width: 100%; max-height: 78%; overflow-y: auto; padding-bottom: calc(8px + var(--safe, 0px)); border-radius: 16px 16px 0 0; background: #fff;
  animation: cb-up .22s cubic-bezier(.22, 1, .36, 1); }
.cb-sh { position: sticky; top: 0; display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 4px; background: #fff; border-bottom: 1px solid var(--wa-line); color: #54656F; }
.cb-sh b { flex: 1; text-align: center; margin-right: 40px; font-size: 16px; font-weight: 600; color: var(--wa-ink); }
.cb-rows { padding: 4px 0; }
.cb-rowbtn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 18px 8px 16px; border: 0; background: none; text-align: left; cursor: pointer; font-family: inherit; }
.cb-rowbtn + .cb-rowbtn { border-top: 1px solid var(--wa-line); }
.cb-rowbtn:hover { background: #F5F6F6; }
.cb-rowbtn:focus-visible { outline: 2px solid var(--wa-link); outline-offset: -2px; }
.cb-rn { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #E7F8F2; color: var(--wa-head); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.cb-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cb-rt b { font-size: 15.5px; line-height: 20px; font-weight: 500; color: var(--wa-ink); }
.cb-rt small { font-size: 13px; line-height: 17px; color: var(--wa-sub); }
.cb-radio { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid #8696A0; box-sizing: border-box; }
.cb-rowbtn:active .cb-radio { border-color: var(--wa-send); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 10px var(--wa-send); }

@media (prefers-reduced-motion: reduce) {
  .cb-chat, .cb-sheet, .cb-sheetwrap { animation: none !important; }
  .cb-typing i { animation: none; opacity: .7; }
}
