/* Chat dock + bot panel shell. Colours match the island prototype. */
.chat-dock {
  --red: #e0283c; --navy: #1d2b64; --ink: #18213d; --muted: #5b6785; --line: #e3e8f2; --soft: #f3f6fb;
  display: flex; flex-direction: column; width: 380px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 24px);
  background: #fff; border-radius: 18px; box-shadow: 0 20px 50px rgba(20, 40, 90, .25);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); overflow: hidden;
}
.cd-head { padding: 12px 16px; background: var(--navy); color: #fff; font-weight: 800; }
.cd-active { font-weight: 600; opacity: .85; margin-left: 4px; }
.cd-head { display: flex; align-items: center; gap: 6px; }
.cd-account { margin-left: auto; border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff;
  border-radius: 999px; padding: 2px 10px; font: 600 12px/1.6 system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.cd-account:hover, .cd-account:focus-visible { background: rgba(255,255,255,.15); }
.cd-account[hidden], .cd-login[hidden], .cd-login-row[hidden] { display: none; }
.cd-login { padding: 10px 16px; background: var(--soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.cd-login p { margin: 0 0 6px; color: var(--muted); }
.cd-login-row { display: flex; gap: 6px; }
.cd-login-row input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.cd-login-row button { padding: 6px 10px; border: 0; border-radius: 8px; background: var(--navy); color: #fff; font: 600 13px system-ui, sans-serif; cursor: pointer; }
.cd-login-status:empty { display: none; }
.cd-login-status { margin: 6px 0 0; }
.cd-note { margin: 0; padding: 6px 16px; background: #fff4e5; color: #6b3d00; font-size: 12px; }
.cd-note[hidden] { display: none; }
.cd-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.cd-who { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--red); margin: 6px 0 0 4px; }
.cd-msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.cd-msg p { margin: 0 0 6px; white-space: normal; } .cd-msg p:last-child { margin: 0; }
.cd-msg ul { margin: 4px 0; padding-left: 18px; white-space: normal; }
.cd-msg a { color: var(--navy); font-weight: 700; }
.cd-msg.cd-bot { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.cd-msg.cd-user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.cd-link { display: block; margin-top: 2px; word-break: break-all; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.cd-chip { border: 1.5px solid var(--navy); border-radius: 999px; background: #fff; color: var(--navy); font: inherit;
           font-size: 13px; font-weight: 700; padding: 6px 12px; cursor: pointer; }
.cd-chip[aria-pressed="true"] { background: var(--navy); color: #fff; }
.cd-chip.cd-done { border-color: var(--red); color: var(--red); }
.cd-chip:disabled { opacity: .45; cursor: default; }
.cd-notice { align-self: center; font-size: 12px; color: var(--muted); background: #fff; border: 1px dashed var(--line);
             border-radius: 999px; padding: 4px 12px; margin: 4px 0; text-align: center; }
.cd-notice.cd-error { color: #8a1020; border-color: #f2b8c0; }
.cd-back { border: 0; background: none; color: var(--navy); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
.cd-typing { display: flex; gap: 4px; align-items: center; padding: 0 16px 8px; color: var(--muted); font-size: 12px; }
.cd-typing[hidden] { display: none; }
.cd-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: cd-b 1s infinite; }
.cd-typing span:nth-child(2) { animation-delay: .15s; } .cd-typing span:nth-child(3) { animation-delay: .3s; }
.cd-typing em { font-style: normal; margin-left: 6px; }
@keyframes cd-b { 50% { opacity: .2; } }
/* Tasks only the visitor can finish */
.cd-usertasks { flex: none; border-top: 1px solid var(--line); background: #fff4e5; }
.cd-usertasks[hidden] { display: none; }
.cd-usertask { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13px; }
.cd-usertask + .cd-usertask { border-top: 1px solid #f3dfc4; }
.cd-usertask-text { flex: 1; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.cd-usertask-text b { font-size: 11px; color: #6b3d00; letter-spacing: .02em; }
.cd-usertask-done { flex: none; border: 0; border-radius: 9px; background: var(--navy); color: #fff; font: inherit; font-size: 13px;
                    font-weight: 700; padding: 7px 10px; cursor: pointer; }
.cd-usertask-done:disabled { opacity: .5; cursor: default; }
.cd-usertask-done:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Checklist above the message field */
.cd-tasks { border-top: 1px solid var(--line); background: var(--soft); flex: none; }
.cd-tasks[hidden] { display: none; }
.cd-tasks-head { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 12px; border: 0; background: none;
                 color: var(--ink); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; text-align: left; }
.cd-tasks-head::after { content: "▾"; color: var(--muted); }
.cd-tasks-head[aria-expanded="false"]::after { content: "▸"; }
.cd-tasks-title { flex: 1; }
.cd-tasks-count { color: var(--muted); font-weight: 600; }
.cd-tasks-head:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.cd-tasks-list { position: relative; max-height: 132px; overflow-y: auto; margin: 0; padding: 0 12px 8px; list-style: none; font-size: 13px; }
.cd-tasks-list[hidden] { display: none; }
.cd-tasks-list ol { margin: 0; padding: 0 0 0 20px; list-style: none; }
.cd-task-line { display: flex; gap: 7px; align-items: baseline; padding: 2px 0; }
.cd-task-mark { flex: none; width: 13px; text-align: center; color: var(--muted); font-weight: 800; }
.cd-task-pending > .cd-task-line .cd-task-mark::before { content: "○"; }
.cd-task-in_progress > .cd-task-line .cd-task-mark::before { content: "●"; color: var(--red); }
.cd-task-waiting > .cd-task-line .cd-task-mark::before { content: "◔"; color: #b35c00; }   /* not an emoji: needs no emoji font */
.cd-task-done > .cd-task-line .cd-task-mark::before { content: "✓"; color: #12804a; }
.cd-task-skipped > .cd-task-line .cd-task-mark::before { content: "–"; }
.cd-task-done > .cd-task-line .cd-task-title { color: var(--muted); }
.cd-task-skipped > .cd-task-line .cd-task-title { color: var(--muted); text-decoration: line-through; }
.cd-task-in_progress > .cd-task-line .cd-task-title { font-weight: 700; }
.cd-task[aria-current="step"] > .cd-task-line .cd-task-title { color: var(--red); }
.cd-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.cd-input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; }
.cd-input:focus { outline: 2px solid var(--navy); outline-offset: 0; border-color: transparent; }
.cd-send { border: 0; border-radius: 10px; background: var(--red); color: #fff; font: inherit; font-weight: 800; padding: 0 14px; cursor: pointer; }
.cd-chip:focus-visible, .cd-send:focus-visible, .cd-back:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Panel shell (host element gets .bot-panel while a bot panel is shown). */
.bot-panel { display: flex; flex-direction: column; }
.bp-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid #e3e8f2; }
.bp-title { margin: 0; font: 800 19px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif; color: #18213d; flex: 1; }
.bp-title:focus { outline: none; }
.bp-close { display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #f3f6fb; cursor: pointer; color: #5b6785; }
.bp-body { flex: 1; overflow-y: auto; padding: 14px 18px 18px; }
@media (min-width: 761px) {
  .bp-body.expanded { display: flex; min-height: 0; padding: 0; overflow: hidden; }   /* each pane scrolls by itself */
}
@media (prefers-reduced-motion: reduce) { .cd-typing span { animation: none; } }
