/* Chat room (21 Oct 2026): one team conversation. Bubbles (mine on the right), a colour per person, a day
   line between days, @mentions highlighted, a gold edge on messages that mention you, a big composer that
   stays at the bottom of the screen (just above the menu bar on a phone). Tokens only: works in both themes. */
.chat-top .chat-sub { flex: 1; min-width: 0; }
.chat-notify { white-space: nowrap; }
.chat { --chat-dock: 0px; max-width: 900px; margin: 0 auto; display: grid; gap: 10px; }

/* ---- the log ---- */
.chat-log { display: flex; flex-direction: column; gap: 8px; min-height: 38vh; padding: 4px 0 6px; }
.chat-more { align-self: center; margin: 0 0 6px; }
.chat-day, .chat-new { display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.chat-day::before, .chat-day::after, .chat-new::before, .chat-new::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-new { color: var(--gold-2); margin: 4px 0; }
.chat-new::before, .chat-new::after { background: var(--gold-line); }
.chat-empty { display: grid; gap: 4px; justify-items: center; padding: 36px 18px; margin: auto 0; text-align: center; color: var(--text-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.chat-empty b { font-size: 16px; color: var(--text); }

.chat-msg { display: flex; justify-content: flex-start; }
.chat-msg.mine { justify-content: flex-end; }
.chat-bubble { position: relative; max-width: min(78%, 620px); min-width: 120px; padding: 7px 12px 9px; border-radius: 14px 14px 14px 4px; border: 1px solid var(--line); border-left: 3px solid var(--who, var(--line-strong)); background: var(--surface-2); box-shadow: 0 1px 0 rgba(0, 0, 0, .08); }
.chat-msg.mine .chat-bubble { border-radius: 14px 14px 4px 14px; border-left-width: 1px; border-right: 3px solid var(--who, var(--gold)); background: color-mix(in srgb, var(--gold) 11%, var(--surface-2)); }
.chat-msg.at-me .chat-bubble { border-color: var(--gold); border-left: 4px solid var(--gold); background: color-mix(in srgb, var(--gold) 9%, var(--surface-2)); box-shadow: 0 0 0 1px var(--gold-line), 0 6px 22px var(--gold-soft); }
.chat-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; font-size: 12.5px; line-height: 1.4; }
.chat-who { color: color-mix(in srgb, var(--who, var(--text-2)) 78%, var(--text)); font-weight: 700; font-size: 13px; letter-spacing: .01em; }
.chat-head time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.chat-for-you { padding: 0 7px; border-radius: 999px; background: var(--gold); color: #ffffff; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.6; }
.chat-del { margin-left: auto; padding: 0 2px; border: 0; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s, color .15s; }
.chat-msg:hover .chat-del, .chat-del:focus-visible { opacity: 1; }
.chat-del:hover { color: var(--danger); text-decoration: underline; }
@media (hover: none) { .chat-del { opacity: .75; } }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; color: var(--text); }
.chat-text a { color: var(--gold-2); text-decoration: underline; text-underline-offset: 2px; }
.chat-at { padding: 0 3px; border-radius: 4px; background: var(--gold-soft); color: var(--gold-2); font-weight: 600; }
.chat-at.me { background: var(--gold); color: #ffffff; }

/* ---- the composer ---- */
.chat-compose { position: sticky; bottom: calc(var(--chat-dock) + 10px); z-index: 6; padding: 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.chat-input { display: block; min-height: 84px; max-height: 40vh; resize: vertical; font-size: 16px; line-height: 1.45; }
.chat-compose-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chat-hint { flex: 1; min-width: 0; color: var(--text-3); font-size: 12.5px; }
.chat-hint kbd { padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font: 600 11px/1.5 var(--font); color: var(--text-2); }
.chat-hint b { color: var(--gold-2); }
.chat-left { color: var(--warn); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chat-send { min-width: 110px; min-height: 44px; font-size: 15px; }
.chat-jump { position: absolute; left: 50%; top: -48px; transform: translateX(-50%); padding: 7px 14px; border: 1px solid var(--gold-line); border-radius: 999px; background: var(--surface-3); color: var(--gold-2); font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: var(--shadow); }
.chat-jump[hidden], .chat-picker[hidden] { display: none; }

/* The "@" list, just above the box. */
.chat-picker { position: absolute; left: 10px; bottom: calc(100% - 4px); z-index: 8; min-width: 230px; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.chat-picker li { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.chat-picker li b { color: var(--text); }
.chat-picker li .muted { margin-left: auto; font-size: 12px; }
.chat-picker li[aria-selected="true"], .chat-picker li:hover { background: var(--gold-soft); }
.chat-picker li[aria-selected="true"] b { color: var(--gold-2); }
.chat-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--who, var(--gold)); }

/* The menu badge: a calm gold count for unread, the red "@" when someone mentioned you. */
.nav-badge.chat-badge.is-count { background: var(--gold); color: #ffffff; }
body.face .nav-badge.chat-badge.is-count { background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 0 0 3px var(--gold-soft); }
.nav-badge.chat-badge.is-at { font-size: 12.5px; }

/* The mention toast: the words, then an Open button. */
.chat-toast { display: flex; align-items: center; gap: 12px; }
.chat-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-toast .btn { flex: none; }

body.face .chat-bubble { background: rgba(26, 26, 26, .86); }
body.face .chat-msg.mine .chat-bubble { background: color-mix(in srgb, var(--gold) 12%, rgba(26, 26, 26, .9)); }
body.face .chat-msg.at-me .chat-bubble { background: color-mix(in srgb, var(--gold) 10%, rgba(26, 26, 26, .9)); }
body.face .chat-compose { background: rgba(12, 12, 12, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
body.face .chat-picker { background: rgb(14, 14, 14); border-color: var(--edge-2, var(--line-strong)); }

@media (max-width: 900px) {
  .chat-compose { bottom: calc(var(--chat-dock) + 6px); }
  /* The menu is a sideways-scrolling bar at the bottom: the count goes first so it is on screen. */
  .nav a .chat-badge { order: -1; margin-left: 0; }
  /* A mention toast sits above that bar, full width, instead of covering it. */
  .toasts:has(.chat-toast) { left: 12px; right: 12px; bottom: 78px; }
  .toasts:has(.chat-toast) .toast { max-width: none; }
}
@media (max-width: 760px) {
  .chat-bubble { max-width: 88%; }
  .chat-hint { display: none; }
  .chat-compose-row { justify-content: flex-end; }
  .chat-input { min-height: 72px; }
  .chat-compose { padding: 8px; }
  .chat-picker { left: 8px; right: 8px; min-width: 0; }
}
