/* The share sheet (app/core/templates/_hh_share.html, share.js): a dialog on a wide screen, a bottom sheet on a phone.
   HubHive's look on its tokens (hh.css part 1): pills, 16px cards, quiet lines, a soft wide shadow. */

/* ------------------------------------------------------------------------------------------- the dialog */
.hhsh { border: 0; padding: 0; margin: auto; width: min(480px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px));
  border-radius: 24px; background: var(--hh-card); color: var(--hh-ink); box-shadow: var(--shadow-xl); overflow: hidden; }
.hhsh[open] { display: flex; flex-direction: column; }
.hhsh::backdrop { background: var(--scrim); }
.hhsh-in { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 12px; }
.hhsh-in > * { flex-shrink: 0; }
/* Always in view under what scrolls: the note and Send once someone is picked, then the device's own ways. */
.hhsh-foot { flex: none; display: flex; flex-direction: column; padding: 0 20px 14px; border-top: 1px solid var(--hh-line-soft); background: var(--hh-card); }
.hhsh-grab { display: none; }
.hhsh-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 6px; position: sticky; top: 0;
  background: var(--hh-card); z-index: 1; }
.hhsh-title { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--hh-navy); outline: none; }
.hhsh-x { margin-right: -8px; }

/* What is being shared */
.hhsh-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--hh-soft); margin: 4px 0 14px; min-height: 68px; }
.hhsh-item-pic { flex: none; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--hh-lilac-2); }
.hhsh-item-pic.is-mark { display: grid; place-items: center; color: var(--hh-violet); background: var(--accent-soft); }
.hhsh-item-pic.is-mark svg { width: 22px; height: 22px; }
.hhsh-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hhsh-item-text small { color: var(--hh-muted); font-size: 0.78rem; font-weight: 600; }
.hhsh-item-text strong { color: var(--hh-navy); font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hhsh-item-text > span { color: var(--hh-faint); font-size: 0.82rem; }
.hhsh-line { display: block; height: 12px; width: 70%; margin: 4px 0; }
.hhsh-line.is-short { width: 40%; }

/* The agents, first */
.hhsh-agents { display: grid; gap: 8px; margin-bottom: 18px; }
.hhsh-agent { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; text-align: left; cursor: pointer;
  border: 1px solid var(--accent-border); background: var(--accent-soft); color: var(--hh-ink); font: inherit; }
.hhsh-agent:hover { box-shadow: 0 0 0 3px var(--accent-tint); }
.hhsh-agent:focus-visible { outline: 2px solid var(--hh-violet); outline-offset: 2px; }
.hhsh-agent[hidden] { display: none; }
.hhsh-agent-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--hh-grad); color: #fff; }
.hhsh-agent-icon.is-biz { background: var(--hh-navy-fill); }
.hhsh-agent-icon svg { width: 18px; height: 18px; }
.hhsh-agent-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.hhsh-agent-text strong { font-weight: 700; color: var(--hh-violet-deep); }
.hhsh-agent-text small { color: var(--hh-muted); font-size: 0.8rem; }
.hhsh-go { flex: none; width: 18px; height: 18px; color: var(--hh-violet); }

/* People, businesses and Hives */
.hhsh-label { margin: 0 0 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hh-violet); display: block; }
.hhsh-search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--hh-line); border-radius: 999px; background: var(--hh-card); }
.hhsh-search:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-tint); }
.hhsh-search svg { width: 16px; height: 16px; color: var(--hh-faint); flex: none; }
.hhsh .hhsh-search input, .hhsh .hhsh-search input:focus { flex: 1; min-width: 0; height: auto; min-height: 0; margin: 0; border: 0; border-radius: 0;
  outline: 0; box-shadow: none; background: transparent; padding: 11px 0; font: inherit; color: var(--hh-ink); -webkit-appearance: none; appearance: none; }
.hhsh-picked { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.hhsh-picked:empty { display: none; }
.hhsh-chip { cursor: pointer; font: inherit; font-size: 0.85rem; }
.hhsh-chip svg { width: 14px; height: 14px; }
.hhsh-people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.hhsh-person { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 8px; border: 0; border-radius: 14px; background: transparent;
  color: var(--hh-ink); font: inherit; text-align: left; cursor: pointer; }
.hhsh-person:hover { background: var(--hh-soft); }
.hhsh-person:focus-visible { outline: 2px solid var(--hh-violet); outline-offset: -2px; }
.hhsh-person[aria-pressed="true"] { background: var(--accent-soft); }
.hhsh-pic { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--hh-grad);
  color: #fff; font-weight: 700; }
.hhsh-pic.is-business, .hhsh-pic.is-hive { border-radius: 12px; }
.hhsh-pic img { width: 100%; height: 100%; object-fit: cover; }
.hhsh-person-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.hhsh-person-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hhsh-person-text small { color: var(--hh-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hhsh-warn { display: inline-flex; align-items: center; gap: 4px; color: var(--warning-ink) !important; white-space: normal !important; }
.hhsh-warn svg { width: 12px; height: 12px; flex: none; }
.hhsh-check { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--hh-line); color: transparent; }
.hhsh-check svg { width: 14px; height: 14px; }
.hhsh-person[aria-pressed="true"] .hhsh-check { background: var(--hh-violet-fill); border-color: var(--hh-violet-fill); color: #fff; }
.hhsh-skel { display: flex; align-items: center; gap: 12px; padding: 8px; }
.hhsh-skel .hhsh-line { width: 50%; }
.hhsh-empty { color: var(--hh-muted); padding: 12px 8px; margin: 0; font-size: 0.9rem; }

.hhsh-send { display: flex; align-items: flex-end; gap: 8px; padding-top: 12px; }
.hhsh-send[hidden] { display: none; }
.hhsh-send textarea { flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 140px; border-radius: 12px; }
.hhsh-send .btn { flex: none; min-height: 44px; }
.hhsh-send .btn svg, .hhsh-askform .btn svg { width: 16px; height: 16px; }
.hhsh-as { margin: 8px 0 0; color: var(--hh-faint); font-size: 0.8rem; text-align: center; }

/* Asking the business */
.hhsh-askform { display: grid; gap: 10px; }
.hhsh-askform .hhsh-label { text-transform: none; letter-spacing: -0.01em; font-size: 1rem; color: var(--hh-navy); }
.hhsh-askform textarea { resize: vertical; border-radius: 12px; }
.hhsh-row { display: flex; justify-content: space-between; gap: 8px; }

/* Sent */
.hhsh-done { text-align: center; padding: 8px 0 4px; }
.hhsh-done-mark { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--success-soft); color: var(--success-ink); }
.hhsh-done-mark svg { width: 26px; height: 26px; }
.hhsh-done-title { margin: 10px 0 12px; font-size: 1.15rem; color: var(--hh-navy); outline: none; }
.hhsh-sent { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; text-align: left; }
.hhsh-sent li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; background: var(--hh-soft); }
.hhsh-signin { text-align: center; padding: 4px 0 8px; }
.hhsh-signin p { color: var(--hh-muted); margin: 0 0 12px; }

/* Then the device */
.hhsh-device { display: flex; justify-content: center; gap: 8px; padding-top: 10px; }
.hhsh-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; max-width: 108px; padding: 6px 4px; border: 0; border-radius: 14px;
  background: transparent; color: var(--hh-ink); font: inherit; font-size: 0.8rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.hhsh-tile[hidden] { display: none; }
.hhsh-tile:hover { background: var(--hh-soft); }
.hhsh-tile:focus-visible { outline: 2px solid var(--hh-violet); outline-offset: 2px; }
.hhsh-tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--hh-soft); border: 1px solid var(--hh-line); color: var(--hh-navy); }
.hhsh-tile-icon svg { width: 18px; height: 18px; }
.hhsh-toast { align-self: center; margin-top: 10px; background: var(--hh-navy-fill); color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600; box-shadow: var(--shadow-lg); }
.hhsh-toast[hidden] { display: none; }
.hhsh-offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* A phone: a sheet from the bottom */
@media (max-width: 640px) {
  .hhsh { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 24px 24px 0 0; max-height: 88vh; }
  .hhsh[open] { animation: hhsh-up 0.22s ease-out; }
  .hhsh-in { padding: 0 16px 10px; }
  .hhsh-foot { padding: 0 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .hhsh-grab { display: block; width: 40px; height: 4px; border-radius: 999px; background: var(--hh-line); margin: 8px auto 0; flex: none; }
  .hhsh-head { padding-top: 8px; }
  .hhsh-tile { font-size: 0.76rem; }
}
@keyframes hhsh-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hhsh[open] { animation: none; } }

/* ------------------------------------------------------------------------------------------- a Shared item's card */
/* In a message thread (messages.js asks HHShare.cardHtml) and wherever else a shared thing is shown. */
.hhsh-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; border: 1px solid var(--hh-line); background: var(--hh-card);
  color: var(--hh-ink); text-decoration: none; max-width: 340px; min-width: 220px; }
a.hhsh-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-lg); }
.hhsh-card-img { flex: none; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--hh-soft); }
.hhsh-card-mark { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--hh-violet); }
.hhsh-card-mark svg { width: 20px; height: 20px; }
.hhsh-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hhsh-card-text small { color: var(--hh-muted); font-size: 0.75rem; font-weight: 600; }
.hhsh-card-text strong { color: var(--hh-navy); font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hhsh-card-text > span { color: var(--hh-faint); font-size: 0.8rem; }
.hhsh-card.is-locked { background: var(--hh-soft); border-style: dashed; }
.hhsh-card.is-locked .hhsh-card-mark { background: var(--hh-card); color: var(--hh-muted); }
.hhsh-card.is-locked .hhsh-card-text > span { color: var(--hh-muted); font-size: 0.86rem; }
.hhsh-card.is-locked a { color: var(--hh-violet); font-weight: 600; }

/* ------------------------------------------------------------------------------------------- attached to the prompt box */
.hhsh-ctx { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin: 0 0 8px; padding: 6px 8px 6px 6px; border-radius: 14px;
  border: 1px solid var(--accent-border); background: var(--accent-soft); }
.hhsh-ctx-pic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; overflow: hidden; background: var(--hh-card); color: var(--hh-violet); }
.hhsh-ctx-pic img { width: 100%; height: 100%; object-fit: cover; }
.hhsh-ctx-pic svg { width: 18px; height: 18px; }
.hhsh-ctx-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.hhsh-ctx-text small { color: var(--hh-violet); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.hhsh-ctx-text strong { color: var(--hh-navy); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hhsh-ctx-x { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--hh-muted); cursor: pointer; }
.hhsh-ctx-x:hover { background: var(--hh-card); color: var(--hh-ink); }
.hhsh-ctx-x svg { width: 14px; height: 14px; }

/* A message carrying a Shared item (messages.js): the card, then the note's bubble under it. */
.hm-shared { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 100%; }
.hm-msg.is-mine .hm-shared { align-items: flex-end; }
