/* ============================================================================
   SellFalcon - shared UI layer (Round S redesign)
   Loaded AFTER site.css and the per-page stylesheet on every page.
   Contains: toast stack, modal/confirm/prompt dialogs, skeleton loaders,
   inline spinners, button loading states and the small motion primitives the
   pages share. No frameworks, no external requests. Both themes.
   ============================================================================ */

/* ------------------------------ Motion keyframes -------------------------- */
@keyframes sf-toast-in   { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sf-toast-out  { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sf-fade-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes sf-pop-in     { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sf-pop-out    { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes sf-spin       { to { transform: rotate(360deg); } }
@keyframes sf-shimmer    { to { background-position: 200% 0; } }
@keyframes sf-bar        { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes sf-tick       { from { stroke-dashoffset: 26; } to { stroke-dashoffset: 0; } }

/* ------------------------------ Toast stack ------------------------------- */
.sf-toasts {
  position: fixed;
  z-index: 9000;
  right: 20px;
  /* Pages with a fixed bottom bar (the editor's phone publish bar) raise
     --sf-toast-offset so a toast never covers the buttons it talks about. */
  bottom: var(--sf-toast-offset);
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(392px, calc(100vw - 40px));
  pointer-events: none;
}
.sf-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 14px 14px 15px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: sf-toast-in var(--t-med) var(--ease);
}
html[data-theme="dark"] .sf-toast { background: var(--surface-3); }
.sf-toast.out { animation: sf-toast-out var(--t-fast) var(--ease) forwards; }
.sf-toast .sf-toast-ic {
  width: 30px; height: 30px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--blue-500) 12%, transparent);
  color: var(--blue-600);
}
html[data-theme="dark"] .sf-toast .sf-toast-ic { color: var(--blue-300); }
.sf-toast .sf-toast-ic svg { width: 17px; height: 17px; }
.sf-toast .sf-toast-txt { min-width: 0; padding-top: 2px; }
.sf-toast strong { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; }
.sf-toast span { display: block; margin-top: 3px; color: var(--muted); font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.sf-toast .sf-toast-act {
  display: inline-block;
  margin-top: 9px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--blue-600);
  font: inherit; font-size: 12.5px; font-weight: 750;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.sf-toast .sf-toast-act:hover { border-color: var(--blue-500); background: var(--surface); }
/* The action button is a sibling of the message now, on the same row, so a
   toast that carries one needs a fourth column here too. */
.sf-toast:has(> .sf-toast-act) { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.sf-toast > .sf-toast-act { margin-top: 0; align-self: center; }
html[data-theme="dark"] .sf-toast .sf-toast-act { color: var(--blue-300); }
.sf-toast .sf-toast-x {
  flex: none;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.sf-toast .sf-toast-x:hover { color: var(--text); background: var(--surface-3); }
.sf-toast .sf-toast-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  transform-origin: left center;
  background: var(--blue-500);
  opacity: .5;
  animation: sf-bar linear forwards;
}
.sf-toast.success .sf-toast-ic { background: var(--success-bg); color: var(--success-ink); }
.sf-toast.success .sf-toast-bar { background: var(--green-500); }
.sf-toast.warning .sf-toast-ic { background: var(--warning-bg); color: var(--warning-ink); }
.sf-toast.warning .sf-toast-bar { background: var(--amber-500); }
.sf-toast.danger  .sf-toast-ic { background: var(--danger-bg); color: var(--danger-ink); }
.sf-toast.danger  .sf-toast-bar { background: var(--red-500); }
.sf-toast:hover .sf-toast-bar { animation-play-state: paused; }
@media (max-width: 560px) {
  /* Setting the token itself, not relying on a fallback: once
     --sf-toast-offset gained a :root default, this rule's "12px" fallback
     could never fire and phones silently inherited the desktop 20px. A
     fallback only fires when the token is UNDEFINED, never when it is merely
     defined elsewhere. */
  .sf-toasts { --sf-toast-offset: 12px; right: 12px; left: 12px; bottom: var(--sf-toast-offset); width: auto; }
}

/* ------------------------------ Account menu ------------------------------ */
.sf-acct { position: relative; flex: none; }
.sf-acct-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 38px; padding: 0 8px 0 5px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.sf-acct-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.sf-acct.open .sf-acct-btn { border-color: var(--blue-400); color: var(--text); box-shadow: var(--ring); }
.sf-acct-av {
  width: 28px; height: 28px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
}
.sf-acct-av svg { width: 16px; height: 16px; }
.sf-acct-av.has-ini svg { display: none; }
.sf-acct-chev { transition: transform var(--t-med) var(--ease); }
.sf-acct.open .sf-acct-chev { transform: rotate(180deg); }

.sf-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 200;
  width: 248px;
  padding: 6px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: sf-pop-in var(--t-fast) var(--ease);
}
.sf-menu[hidden] { display: none !important; }
.sf-menu-who { padding: 10px 12px 11px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.sf-menu-who b { display: block; font-size: 13.5px; font-weight: 750; overflow-wrap: anywhere; line-height: 1.35; }
.sf-menu-who small { display: block; margin-top: 2px; color: var(--subtle); font-size: 12px; }
.sf-menu-who small:empty { display: none; }
.sf-menu-list { display: grid; gap: 1px; }
.sf-menu-end { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.sf-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 9px;
  background: none; color: var(--text-2);
  font: inherit; font-size: 13.5px; font-weight: 650; text-align: left;
  cursor: pointer; text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sf-menu-item svg { width: 16px; height: 16px; flex: none; opacity: .75; }
.sf-menu-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.sf-menu-item.danger { color: var(--danger-ink); }
.sf-menu-item.danger:hover { background: var(--danger-bg); color: var(--danger-ink); }
@media (max-width: 480px) { .sf-menu { width: calc(100vw - 32px); right: -6px; } }

/* ------------------------------ Dialogs ----------------------------------- */
.sf-modal { position: fixed; inset: 0; z-index: 9100; display: grid; place-items: center; padding: 20px; }
.sf-modal[hidden] { display: none !important; }
.sf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 20, 46, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: sf-fade-in var(--t-fast) var(--ease);
}
.sf-modal-box {
  position: relative;
  width: min(440px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 26px 26px 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: sf-pop-in var(--t-med) var(--ease);
}
.sf-modal.closing .sf-modal-box { animation: sf-pop-out var(--t-fast) var(--ease) forwards; }
.sf-modal.closing .sf-modal-backdrop { animation: sf-fade-in var(--t-fast) var(--ease) reverse forwards; }
.sf-modal-ic {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  background: color-mix(in srgb, var(--blue-500) 12%, transparent);
  color: var(--blue-600);
}
html[data-theme="dark"] .sf-modal-ic { color: var(--blue-300); }
.sf-modal-ic svg { width: 22px; height: 22px; }
.sf-modal.danger  .sf-modal-ic { background: var(--danger-bg); color: var(--danger-ink); }
.sf-modal.warning .sf-modal-ic { background: var(--warning-bg); color: var(--warning-ink); }
.sf-modal.success .sf-modal-ic { background: var(--success-bg); color: var(--success-ink); }
.sf-modal-box h2 { font-size: 20px; margin: 0 0 8px; letter-spacing: -0.02em; }
.sf-modal-body { color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.sf-modal-body p { margin: 0 0 10px; }
.sf-modal-body p:last-child { margin: 0; }
.sf-modal-body strong { color: var(--text-2); font-weight: 700; }
.sf-modal-field { display: grid; gap: 6px; margin-top: 16px; }
.sf-modal-field label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.sf-modal-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.sf-modal-field input:focus-visible { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }
.sf-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.sf-modal-foot .btn { padding: 11px 20px; font-size: 14.5px; }
.sf-modal-foot .btn.danger {
  border-color: transparent;
  background: linear-gradient(135deg, var(--red-500), #c62841);
  color: #fff;
  box-shadow: 0 12px 26px rgba(239, 64, 86, 0.26);
}
@media (max-width: 480px) {
  .sf-modal-foot { flex-direction: column-reverse; }
  .sf-modal-foot .btn { width: 100%; }
}

/* ------------------------------ Skeletons --------------------------------- */
.sk {
  border-radius: var(--r-sm);
  background: linear-gradient(
      90deg,
      color-mix(in srgb, var(--text) 7%, transparent) 0%,
      color-mix(in srgb, var(--text) 12%, transparent) 40%,
      color-mix(in srgb, var(--text) 7%, transparent) 80%);
  background-size: 200% 100%;
  animation: sf-shimmer 1.4s linear infinite;
}
.sk-line { height: 11px; margin: 7px 0; }
.sk-line.sm { width: 42%; }
.sk-line.md { width: 68%; }
.sk-line.lg { width: 88%; }
.sk-tile { height: 96px; border-radius: var(--r-lg); }
.sk-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }

/* ------------------------------ Spinners / button states ------------------ */
.sf-spin {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sf-spin 0.62s linear infinite;
  vertical-align: -2px;
}
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-sm); }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-right-color: transparent;
  border-radius: 50%;
  animation: sf-spin 0.62s linear infinite;
}
.btn:not(.primary).is-busy::before { border-color: color-mix(in srgb, var(--text) 30%, transparent); border-right-color: transparent; }

/* Screen-reader-only live region for announcements. */
.sf-live {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .sf-toast, .sf-modal-box, .sf-modal-backdrop { animation: none !important; }
  .sk { animation: none; }
  .sf-toast .sf-toast-bar { animation-duration: inherit; }
}

/* ---------------------- support chat (Round BA) ----------------------------
   Shared by the tool's Support page and the marketing bubble: one look for
   the same conversation wherever it is opened. */
.sfc-presence { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--subtle); }
.sfc-presence .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--border-strong); flex: none; }
.sfc-presence .dot.on { background: var(--green-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-500) 22%, transparent); }
.sfc-log {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 44vh; overflow: auto; padding: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.sfc-msg { max-width: 82%; }
.sfc-msg p {
  margin: 0; padding: 9px 13px; border-radius: 13px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.sfc-msg small { color: var(--subtle); font-size: 11px; padding: 2px 4px; display: inline-block; }
.sfc-msg.mine { align-self: flex-end; text-align: right; }
.sfc-msg.mine p { background: var(--blue-600); border-color: var(--blue-600); color: #fff; text-align: left; }
.sfc-msg.team p { border-color: color-mix(in srgb, var(--blue-500) 35%, var(--border)); }
.sfc-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.sfc-compose textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 130px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 11px; padding: 10px 12px; font: inherit; font-size: 13.5px;
}
.sfc-compose textarea:focus { outline: none; box-shadow: var(--ring); }
.sfc-rows { display: grid; gap: 6px; margin: 8px 0 0; }
.sfc-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 11px; padding: 10px 13px; font: inherit; font-size: 13px; cursor: pointer;
}
.sfc-row:hover { border-color: var(--blue-500); }
.sfc-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.sfc-row .when { color: var(--subtle); font-size: 11.5px; flex: none; }
.sfc-row .unread { width: 9px; height: 9px; border-radius: 999px; background: var(--blue-500); flex: none; }
.sfc-chip {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 9px;
  font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--blue-500) 12%, var(--surface));
  color: var(--blue-600); flex: none;
}
html[data-theme="dark"] .sfc-chip { color: var(--blue-300); }
.sfc-chip.status-answered { background: var(--success-bg); color: var(--success-ink); }
.sfc-chip.status-resolved { background: var(--surface-3); color: var(--muted); }
.sfc-chip.status-on_hold { background: var(--warning-bg); color: var(--warning-ink); }
.sfc-chip.urgent { background: var(--danger-bg); color: var(--danger-ink); }

/* ------------------------- the marketing bubble ---------------------------- */
.sf-bubble {
  /* Above the sticky site header (z 100): a chat the user has opened -
     or dragged large - must never slide underneath the page furniture,
     which was exactly where its close and resize buttons went. */
  position: fixed; right: 18px; bottom: 18px; z-index: 140;
  width: 54px; height: 54px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--blue-600); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--blue-600) 45%, transparent);
}
.sf-bubble:hover { transform: translateY(-1px); }
.sf-bubble .sf-bubble-dot {
  position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 999px;
  background: var(--red-500); border: 2px solid #fff;
}
.sf-bubble-panel {
  position: fixed; right: 18px; bottom: 82px; z-index: 140;
  width: min(360px, calc(100vw - 28px));
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(2, 8, 23, .28);
  display: flex; flex-direction: column; overflow: hidden;
}
.sf-bubble-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 15px;
  background: var(--blue-600); color: #fff;
}
.sf-bubble-head b { font-size: 14.5px; }
.sf-bubble-head .sfc-presence { color: rgba(255, 255, 255, .85); }
.sf-bubble-head .sfc-presence .dot.on { box-shadow: none; }
.sf-bubble-head .x {
  margin-left: auto; background: none; border: none; color: #fff; cursor: pointer;
  padding: 4px; border-radius: 7px; display: inline-flex;
}
.sf-bubble-head .x:hover { background: rgba(255, 255, 255, .16); }
.sf-bubble-body { padding: 14px 15px 15px; overflow: auto; max-height: min(60vh, 480px); }
/* Resizable chat (owner's ask, 2026-08-15). The grip sits at the panel's free
   corner - it is anchored bottom-right, so growth happens up and left. */
.sf-bubble-grip {
  background: none; border: none; color: rgba(255, 255, 255, .82); cursor: nwse-resize;
  padding: 4px; margin: -4px 0 -4px -6px; border-radius: 7px; display: inline-flex;
  touch-action: none;
}
.sf-bubble-grip:hover { background: rgba(255, 255, 255, .16); color: #fff; }
/* Once a size has been chosen, the panel's height is the user's number and
   the body fills it: the scrolling log (or the message box on the first
   form) takes every spare pixel, and nothing else stretches. */
/* A remembered size can be bigger than the window it wakes up in (a rotated
   phone, a shrunk browser): the viewport wins, whatever the inline style says. */
.sf-bubble-panel.sized { max-width: calc(100vw - 28px); max-height: calc(100vh - 96px); }
.sf-bubble-panel.sized .sf-bubble-body {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: none;
}
.sf-bubble-panel.sized .sf-bubble-body > * { flex: 0 0 auto; }
.sf-bubble-panel.sized .sf-bubble-body > .sfc-log,
.sf-bubble-panel.sized .sf-bubble-body > textarea { flex: 1 1 auto; min-height: 0; max-height: none; }
.sf-bubble-panel.sized .sf-bubble-body > textarea { min-height: 84px; }
.sf-bubble-body label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.sf-bubble-body input, .sf-bubble-body select, .sf-bubble-body textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px;
}
.sf-bubble-body textarea { resize: vertical; min-height: 84px; }
.sf-bubble-body input:focus, .sf-bubble-body select:focus, .sf-bubble-body textarea:focus { outline: none; box-shadow: var(--ring); }
.sf-bubble-body .sfc-log { max-height: 38vh; }
.sf-bubble-note { color: var(--subtle); font-size: 11.5px; margin: 10px 0 0; }
@media (max-width: 480px) {
  .sf-bubble-panel { bottom: 78px; }
}

/* --------------------- chat composer tools (Round BB) ----------------------
   Attach a picture or a PDF, drop in an emoji, record a voice note - the
   shape his IPBurger example uses, built from the design system's own parts. */
.sfc-tools { display: flex; align-items: center; gap: 4px; position: relative; }
.sfc-tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  background: none; border: 1px solid transparent; border-radius: 9px;
  color: var(--subtle); cursor: pointer; padding: 0;
}
.sfc-tool:hover { background: var(--surface-3); color: var(--text); }
.sfc-tool.rec { color: var(--danger-ink); background: var(--danger-bg); }
.sfc-tool[disabled] { opacity: .45; cursor: not-allowed; }
.sfc-rectime { font-size: 12px; font-weight: 700; color: var(--danger-ink); font-variant-numeric: tabular-nums; }

.sfc-emoji {
  position: absolute; bottom: 42px; left: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px;
  width: min(310px, 78vw); max-height: 190px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 8px; box-shadow: 0 16px 40px rgba(2, 8, 23, .22);
}
.sfc-emoji button {
  background: none; border: none; cursor: pointer; font-size: 18px;
  line-height: 1; padding: 5px 2px; border-radius: 7px;
}
.sfc-emoji button:hover { background: var(--surface-3); }

/* Files queued to send, and files already sent inside a bubble. */
.sfc-queue { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.sfc-file {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 5px 9px; font-size: 12px; color: var(--muted);
}
.sfc-file b { font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.sfc-file button { background: none; border: none; color: var(--subtle); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.sfc-file button:hover { color: var(--danger-ink); }

.sfc-msg .sfc-att { margin-top: 6px; display: grid; gap: 6px; }
.sfc-msg .sfc-att img {
  max-width: 100%; max-height: 260px; border-radius: 10px; display: block;
  border: 1px solid var(--border); cursor: zoom-in; background: var(--surface-2);
}
.sfc-msg .sfc-att audio { width: 100%; max-width: 260px; height: 38px; }
.sfc-msg .sfc-att a {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 11px; font-size: 12.5px; font-weight: 650; color: var(--text); text-decoration: none;
}
.sfc-msg .sfc-att a:hover { border-color: var(--blue-500); text-decoration: none; }
.sfc-msg.mine .sfc-att a { color: var(--text); }
/* A message that is ONLY an attachment needs no empty speech bubble. */
.sfc-msg p:empty { display: none; }

/* Round BC: see what you are about to send. */
.sfc-file .sfc-thumb {
  width: 30px; height: 30px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--border); flex: none;
}
.sfc-ficon { font-size: 15px; flex: none; }

/* ===================== Round CP: keyboard-first layer ====================== */
/* The palette (Cmd/Ctrl-K), its header pill, and the shortcuts sheet. Every
   colour is a site.css token, so light and dark both come free. */
/* His note (2026-08-15): the pill next to the logo read as a stray chip, not
   a search box. It is drawn as a FIELD now - recessed surface, label on the
   left, the shortcut sitting quietly at the far end - sized so it looks like
   the thing you would click to type. flex: none, because a flexing header
   must squeeze the nav, never the search box, and never wrap it under the
   logo. */
.sf-searchbtn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 8px 0 13px;
  min-width: 225px; flex: none;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--subtle);
  font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.sf-searchbtn svg { flex: none; }
.sf-searchbtn span { flex: 1 1 auto; text-align: left; }
.sf-searchbtn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.sf-searchbtn:focus-visible { outline: none; box-shadow: var(--ring); }
.sf-searchbtn kbd {
  flex: none; margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); color: var(--subtle);
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
}
@media (max-width: 860px) {
  .sf-searchbtn span, .sf-searchbtn kbd { display: none; }
  .sf-searchbtn { padding: 0 10px; min-width: 0; }
}

.sf-cmdk { position: fixed; inset: 0; z-index: 9200; }
.sf-cmdk[hidden] { display: none !important; }
.sf-cmdk-back {
  position: absolute; inset: 0;
  background: rgba(6, 20, 46, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: sf-fade-in var(--t-fast) var(--ease);
}
.sf-cmdk-box {
  position: relative;
  width: min(620px, calc(100vw - 28px));
  margin: min(14vh, 130px) auto 0;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: sf-pop-in var(--t-med) var(--ease);
}
.sf-cmdk-in {
  display: flex; align-items: center; gap: 11px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.sf-cmdk-in svg { width: 18px; height: 18px; color: var(--subtle); flex: none; }
.sf-cmdk-in input {
  flex: 1; min-width: 0;
  border: 0; background: none; color: var(--text);
  font: inherit; font-size: 15.5px;
}
.sf-cmdk-in input:focus { outline: none; }
.sf-cmdk-in input::placeholder { color: var(--subtle); }
.sf-cmdk-in kbd {
  flex: none; padding: 3px 8px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2); color: var(--subtle);
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
}
.sf-cmdk-list { max-height: min(52vh, 430px); overflow: auto; padding: 7px; }
.sf-cmdk-group {
  padding: 10px 11px 5px;
  color: var(--subtle);
  font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.sf-cmdk-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 11px;
  border: 0; border-radius: 10px;
  background: none; color: var(--text-2);
  font: inherit; text-align: left; cursor: pointer;
}
.sf-cmdk-item .ic {
  flex: none; width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sf-cmdk-item .ic svg { width: 15px; height: 15px; }
.sf-cmdk-item .tx { flex: 1; min-width: 0; }
.sf-cmdk-item .tx b { display: block; font-size: 14px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-cmdk-item .tx small { display: block; margin-top: 1px; color: var(--subtle); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-cmdk-item .ct {
  flex: none; min-width: 22px; text-align: center;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px; font-weight: 750; font-variant-numeric: tabular-nums;
}
.sf-cmdk-item .kb { flex: none; display: inline-flex; gap: 3px; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.sf-cmdk-item .kb kbd {
  padding: 2px 6px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface-2); color: var(--subtle);
  font-family: var(--font-sans); font-size: 10.5px; font-weight: 700;
}
.sf-cmdk-item.on { background: color-mix(in srgb, var(--blue-500) 9%, transparent); }
.sf-cmdk-item.on .ic { background: color-mix(in srgb, var(--blue-500) 16%, transparent); color: var(--blue-600); }
html[data-theme="dark"] .sf-cmdk-item.on .ic { color: var(--blue-300); }
.sf-cmdk-item.on .kb { opacity: 1; }
.sf-cmdk-none { margin: 0; padding: 26px 16px 30px; text-align: center; color: var(--muted); font-size: 13.5px; }
.sf-cmdk-foot {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--subtle); font-size: 12px;
}
.sf-cmdk-foot kbd {
  padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); font-family: var(--font-sans); font-size: 10.5px; font-weight: 700;
}
.sf-cmdk-hint { margin-left: auto; }
@media (max-width: 640px) { .sf-cmdk-hint { display: none; } .sf-cmdk-box { margin-top: 10vh; } }

/* ------------------------------ shortcuts sheet --------------------------- */
.sf-keys { position: fixed; inset: 0; z-index: 9200; }
.sf-keys-back {
  position: absolute; inset: 0;
  background: rgba(6, 20, 46, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: sf-fade-in var(--t-fast) var(--ease);
}
.sf-keys-box {
  position: relative;
  width: min(640px, calc(100vw - 28px));
  max-height: 82vh; overflow: auto;
  margin: min(15vh, 140px) auto 0;
  padding: 24px 26px 20px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: sf-pop-in var(--t-med) var(--ease);
}
.sf-keys-box h2 { margin: 0 0 16px; font-size: 19px; letter-spacing: -0.02em; }
/* The one control in the sheet, and the reason it has one: a dialog a reader
   can be put into has to have somewhere for focus to land and a way out that
   is not a key they have to know. */
.sf-keys-x {
  position: absolute; top: 14px; right: 16px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 9px;
  background: transparent; color: var(--subtle);
  font: inherit; font-size: 18px; line-height: 1;
  cursor: pointer;
}
.sf-keys-x:hover { color: var(--text); border-color: var(--text); }
.sf-keys-x:focus-visible { outline: none; box-shadow: var(--ring); }
.sf-keys-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 28px; }
.sf-keys-col h3 {
  margin: 10px 0 8px;
  color: var(--subtle);
  font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.sf-keys-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
  color: var(--text-2); font-size: 13.5px;
}
.sf-keys-row > span { flex: none; display: inline-flex; gap: 4px; min-width: 74px; }
.sf-keys-row kbd {
  padding: 2px 7px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2);
  font-family: var(--font-sans); font-size: 11.5px; font-weight: 700;
}
.sf-keys-note { margin: 16px 0 0; color: var(--subtle); font-size: 12.5px; }

/* A count that just went up says so. Applied by the pages that own badges. */
@keyframes sf-bump { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }
.sf-bump { animation: sf-bump .5s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .sf-cmdk-box, .sf-keys-box, .sf-cmdk-back, .sf-keys-back { animation: none !important; }
  .sf-bump { animation: none; }
}

/* Round DH: same iOS focus-zoom guard as site.css, for the support chat -
   which is the CLOSED-DOOR access path, so it is a money-path field too. */
@media (max-width: 900px) {
  .sf-bubble-body input, .sf-bubble-body select, .sf-bubble-body textarea,
  .sfc-compose textarea { font-size: 16px; }
}

/* Round EV: the account menu's anchor-shaped items wore the global dark
   link-blue (see site.css's dark-anchor sweep). Buttons were never hit -
   only anchors - and .danger keeps its own colour. */
html[data-theme="dark"] a.sf-menu-item:not(.danger) { color: var(--text-2); }
html[data-theme="dark"] a.sf-menu-item:not(.danger):hover { color: var(--text); }
/* 8 September 2026: the saved profile photo in the header's account button. */
.sf-acct-av.has-img { overflow: hidden; background: var(--pn3); }
.sf-acct-av img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
