/* ---------- Live chat widget ---------- */
/* Docked into the bottom right corner of the window, bevelled on its inner corner only. */
.chat { position: fixed; right: 0; bottom: 0; z-index: 70; font-family: var(--f-body); }
/* while the meeting wizard is open, the chat gets out of its way */
body.consult-open .chat { opacity: 0; pointer-events: none; transition: opacity .2s ease; }

/* collapsed: the bubble */
.chat__bubble { position: relative; display: flex; align-items: center; gap: 10px; border: 0; cursor: pointer;
  padding: 14px 20px 14px 16px; border-radius: 10px 0 0 0; background: var(--c-accent); color: #fff;
  font-weight: 700; font-size: var(--t-small); letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 -6px 26px rgba(8, 14, 24, .3); transition: background .25s ease; }
.chat__bubble:hover { background: var(--c-accent-hover); }
.chat__bubble:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.chat__bubble svg { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
.chat.is-online .chat__bubble svg { filter: drop-shadow(0 0 0 transparent); }
.chat.is-online .chat__dot { display: block; }
.chat__dot { display: none; width: 9px; height: 9px; border-radius: 50%; background: #35C759; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.chat.is-open .chat__bubble { display: none; }

/* unread: a count on the bubble, and a peek at the message above it */
.chat__badge { position: absolute; top: -8px; left: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--c-navy); color: #fff; font-size: var(--t-label); line-height: 22px; text-align: center;
  box-shadow: 0 2px 8px rgba(8,14,24,.4); animation: chat-pop .4s ease; }
@keyframes chat-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.chat__peek { position: absolute; right: 12px; bottom: 100%; margin-bottom: 10px; width: min(300px, calc(100vw - 32px));
  background: #fff; color: var(--c-ink); border-radius: 10px 10px 0 10px; text-align: left;
  box-shadow: 0 14px 34px rgba(8,14,24,.25); font-size: var(--t-small); line-height: 20px;
  animation: chat-rise .35s ease; }
.chat__peek-open { display: block; width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
  padding: 12px 34px 12px 14px; font-family: var(--f-body); font-size: inherit; line-height: inherit; color: inherit; }
.chat__peek-close { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 6px;
  background: none; color: var(--c-ink-soft); font-size: var(--t-body); line-height: 1; cursor: pointer; }
.chat__peek-close:hover { background: rgba(10, 22, 55, .07); color: var(--c-ink); }
.chat__peek-close:focus-visible, .chat__peek-open:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
.chat__peek strong { display: block; font-size: var(--t-label); letter-spacing: .12em; text-transform: uppercase; color: var(--c-accent-deep); margin-bottom: 4px; }
@keyframes chat-rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* expanded: the panel, growing out of the same corner */
.chat__panel { width: min(380px, 100vw); max-height: min(600px, calc(100vh - 80px)); display: flex; flex-direction: column;
  background: #fff; border-radius: 12px 0 0 0; overflow: hidden; box-shadow: 0 -10px 60px rgba(8, 14, 24, .35);
  transform-origin: 100% 100%; animation: chat-open .22s ease; }
.chat__panel[hidden] { display: none; }
@keyframes chat-open { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--c-navy); color: #fff; }
.chat__head img { border-radius: 50%; flex: 0 0 auto; }
.chat__head strong { display: block; font-size: var(--t-body); line-height: 20px; }
.chat__status { font-size: var(--t-label); letter-spacing: .06em; text-transform: uppercase; color: var(--c-on-dark-soft); }
.chat.is-online .chat__status { color: #7BE495; }
.chat__close { margin-left: auto; width: 32px; height: 32px; border: 0; background: rgba(255, 255, 255, .1); color: #fff;
  border-radius: 6px; font-size: var(--t-lead); line-height: 1; cursor: pointer; transition: background .25s ease; }
.chat__close:hover { background: var(--c-accent); }

.chat__list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--c-band);
  scrollbar-width: thin; }
.chat__msg { max-width: 85%; }
.chat__msg p { margin: 0; padding: 10px 14px; border-radius: 10px; font-size: var(--t-body); line-height: 22px; white-space: pre-wrap; }
.chat__msg time { display: block; margin-top: 4px; font-size: var(--t-label); color: var(--c-ink-soft); }
.chat__msg--nathan p { background: var(--c-band); color: var(--c-ink); border-bottom-left-radius: 3px; }
.chat__msg--visitor { align-self: flex-end; text-align: right; }
.chat__msg--visitor p { background: var(--c-navy); color: #fff; border-bottom-right-radius: 3px; }

.chat__ask { padding: 12px 12px 0; }
.chat__email { width: 100%; border: 1px solid rgba(10, 22, 55, .15); border-radius: 6px; padding: 10px 12px;
  font-family: var(--f-body); font-size: var(--t-body); line-height: 20px; color: var(--c-ink); }
.chat__email:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.chat__ask-note { margin: 6px 0 0; font-size: var(--t-label); line-height: 17px; color: var(--c-ink-soft); }
.chat__ask-note.is-warning { color: var(--c-accent-deep); font-weight: 700; }

.chat__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(10, 22, 55, .1); }
.chat__input { flex: 1; resize: none; border: 1px solid rgba(10, 22, 55, .15); border-radius: 6px; padding: 10px 12px;
  font-family: var(--f-body); font-size: var(--t-body); line-height: 20px; color: var(--c-ink); max-height: 120px; }
.chat__input:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.chat__send { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 6px; background: var(--c-accent); color: #fff; cursor: pointer;
  display: grid; place-items: center; transition: background .25s ease; }
.chat__send:hover { background: var(--c-accent-hover); }
.chat__send svg { width: 18px; height: 18px; fill: currentColor; }
.chat__note { margin: 0; padding: 0 14px 12px; font-size: var(--t-label); line-height: 16px; color: var(--c-ink-soft); }
.chat__note a { color: var(--c-accent-deep); }
.chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Phones: just the icon and the status dot, so it cannot cover the page */
@media (max-width: 599.98px) {
  .chat__bubble { padding: 14px 16px; gap: 8px; }
  .chat__bubble-label { display: none; }
  .chat__peek { right: 8px; }

  /* a taller window, and everything in it two sizes up */
  .chat__panel { height: min(600px, calc(100vh - 120px)); max-height: none; }
  .chat__head strong { font-size: var(--t-lead); line-height: 24px; }
  .chat__status { font-size: var(--t-small); }
  .chat__msg p { font-size: var(--t-body); line-height: 25px; }
  .chat__msg time { font-size: var(--t-small); }
  .chat__email, .chat__input { font-size: var(--t-body); line-height: 23px; }
  .chat__ask-note { font-size: var(--t-small); line-height: 20px; }
  .chat__note { font-size: var(--t-small); line-height: 18px; }
  .chat__peek { font-size: var(--t-body); line-height: 22px; }
  .chat__peek strong { font-size: var(--t-small); }
}

@media (prefers-reduced-motion: reduce) { .chat__bubble, .chat__panel, .chat__badge, .chat__peek { animation: none; transition: none; } }

/* ---------- Nathan's desk (private page) ---------- */
.desk__bar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.desk__bar h1 { margin: 0; font-size: var(--t-sub); line-height: 34px; }
.desk__toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--t-small); letter-spacing: .08em; text-transform: uppercase; }
.desk__state { margin-left: auto; font-size: var(--t-label); letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink-soft); }
.desk__grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .desk__grid { grid-template-columns: 300px 1fr; align-items: start; } }
.desk__list { display: grid; gap: 8px; max-height: 70vh; overflow-y: auto; }
.desk__conv { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid rgba(10, 22, 55, .12); border-radius: 8px;
  background: #fff; cursor: pointer; font-family: var(--f-body); }
.desk__conv.is-current { border-color: var(--c-navy); }
.desk__conv.has-unread strong::after { content: " ●"; color: var(--c-accent); }
.desk__conv strong { font-size: var(--t-body); }
.desk__when { font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-soft); }
.desk__last { font-size: var(--t-small); color: var(--c-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk__thread { border: 1px solid rgba(10, 22, 55, .12); border-radius: 8px; background: #fff; display: flex; flex-direction: column; min-height: 60vh; }
.desk__messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 60vh; }
.desk__who { margin: 0 0 8px; font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-soft); }
.desk__msg { max-width: 80%; }
.desk__msg p { margin: 0; padding: 10px 14px; border-radius: 12px; font-size: var(--t-body); line-height: 22px; white-space: pre-wrap; }
.desk__msg time { display: block; margin-top: 4px; font-size: var(--t-label); color: var(--c-ink-soft); }
.desk__msg--visitor p { background: var(--c-band); color: var(--c-ink); }
.desk__msg--nathan { align-self: flex-end; text-align: right; }
.desk__msg--nathan p { background: var(--c-navy); color: #fff; }
.desk__form { display: flex; gap: 10px; padding: 12px; border-top: 1px solid rgba(10, 22, 55, .1); }
.desk__form textarea { flex: 1; resize: vertical; border: 1px solid rgba(10, 22, 55, .15); border-radius: 8px; padding: 10px 12px;
  font-family: var(--f-body); font-size: var(--t-body); line-height: 20px; }
.desk__empty { color: var(--c-ink-soft); }
.desk__test { border: 1px solid rgba(10,22,55,.2); background: #fff; border-radius: 6px; padding: 7px 12px; cursor: pointer;
  font-family: var(--f-body); font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.desk__test:hover { border-color: var(--c-navy); }
