/* EquiDetails shell kit: the header, its menus, and the messages drawer.
 *
 * One block, .eqd-header, four slots:
 *   .eqd-header__brand     crest + wordmark, links to THIS surface's home
 *   .eqd-header__endorse   "by EquiDetails" (the word is a link home); absent
 *                          on master-brand surfaces
 *   .eqd-header__middle    site mode: nav links. tool mode: divider + workspace
 *   .eqd-header__account   site mode: Sign in + one call to action.
 *                          tool mode: bell, messages, avatar chip (shell.js)
 *
 * Mode is the data-mode attribute on the header ("site" | "tool"); product is
 * data-product ("equidetails" | "equimarket" | "equifarrier" | "equihay"). Requires
 * tokens.css. Visual weight matches the app's AppNavBar: 56px, surface at 92%
 * with a blur, hairline below, the same soft shadow.
 */

.eqd-header,
.eqd-header *,
.eqd-drawer,
.eqd-drawer *,
.eqd-panel,
.eqd-panel *,
.eqd-menu,
.eqd-menu * {
  box-sizing: border-box;
}

.eqd-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: var(--eqd-header-height);
  padding: 0 var(--eqd-gutter);
  background: rgba(255, 253, 249, 0.92);
  border-bottom: 1px solid var(--eqd-line);
  box-shadow: var(--eqd-shadow-header);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--eqd-font-sans);
  font-size: 14px;
  line-height: 1.4;
  color: var(--eqd-ink);
}

:root[data-theme="dark"] .eqd-header {
  background: rgba(24, 36, 48, 0.92);
}

.eqd-header a {
  color: inherit;
}

/* Signed-in-only and signed-out-only content, anywhere on the page. shell.js
   stamps the <html> element once the session is known; until then the page
   is what the server rendered (the signed-out half), so crawlers see a clean
   page and a signed-in person sees the swap a moment later. */
html:not([data-eqd-signed-in="true"]) [data-eqd-signed-in-only] {
  display: none !important;
}

html[data-eqd-signed-in="true"] [data-eqd-signed-out-only] {
  display: none !important;
}

.eqd-header button {
  font: inherit;
  color: inherit;
}

/* A button does not take its parent's font unless told to, and only the
   customer app has a global rule that does. Family only, so each button
   keeps its own size and weight. The drawer and the new-message sheet
   (Send is a button in both). */
.eqd-drawer button,
.eqd-sheet button {
  font-family: inherit;
}

.eqd-header :focus-visible,
.eqd-menu :focus-visible,
.eqd-panel :focus-visible,
.eqd-drawer :focus-visible {
  outline: 2px solid var(--eqd-focus-ring);
  outline-offset: 2px;
}

/* ---------- Slot 1: brand ---------- */

.eqd-header__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
  height: 40px;
  text-decoration: none;
  color: var(--eqd-ink);
}

.eqd-wordmark {
  display: block;
  height: 32px;
  width: auto;
  color: var(--eqd-ink);
}

.eqd-crest {
  display: none;
  height: 32px;
  width: 32px;
}

/* ---------- Slot 2: endorsement ---------- */

.eqd-header__endorse {
  flex-shrink: 0;
  margin-left: -2px;
  padding-top: 6px; /* sits on the wordmark's baseline */
  font-size: 12px;
  font-weight: 500;
  color: var(--eqd-muted);
  white-space: nowrap;
}

.eqd-header__endorse a {
  color: var(--eqd-brass-text);
  font-weight: 600;
  text-decoration: none;
}

.eqd-header__endorse a:hover {
  text-decoration: underline;
}

/* ---------- Slot 3: middle ---------- */

.eqd-header__middle {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
  margin-left: 8px;
}

.eqd-header__divider {
  flex-shrink: 0;
  width: 1px;
  height: 16px;
  margin: 0 12px 0 4px;
  background: var(--eqd-line);
}

.eqd-header__workspace {
  min-width: 0;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--eqd-muted);
}

.eqd-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.eqd-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--eqd-radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--eqd-muted);
  text-decoration: none;
  white-space: nowrap;
}

.eqd-nav a:hover {
  color: var(--eqd-ink);
  background: var(--eqd-hunter-soft);
}

.eqd-nav a[aria-current="page"] {
  color: var(--eqd-ink);
  font-weight: 600;
}

/* The phone menu button for site-mode links (shell.js toggles data-nav-open). */
.eqd-navtoggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-sm);
  background: var(--eqd-surface);
  color: var(--eqd-muted);
  cursor: pointer;
}

.eqd-navtoggle svg {
  width: 18px;
  height: 18px;
}

/* ---------- Slot 4: account ---------- */

.eqd-header__account {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.eqd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--eqd-radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

/* A call to action may carry a short label for phones ("Sell" for "Sell on
   EquiMarket"): the long one shows on a desktop, the short one below 640px,
   so the cluster never pushes past the right edge. */
.eqd-btn__short {
  display: none;
}

.eqd-btn--primary {
  background: var(--eqd-hunter);
  border-color: var(--eqd-hunter);
  color: var(--eqd-on-hunter);
  box-shadow: 0 1px 2px rgba(16, 35, 61, 0.08);
}

/* Links in the header inherit the header's ink (.eqd-header a, above), and
   that rule outranks a single class, so the primary button kept ink text on
   hunter green until this line (found by the Map Room, 23 September). */
.eqd-header a.eqd-btn--primary {
  color: var(--eqd-on-hunter);
}

.eqd-btn--primary:hover {
  filter: brightness(1.08);
}

.eqd-btn--ghost {
  background: var(--eqd-surface);
  border-color: var(--eqd-line);
  color: var(--eqd-ink);
  font-weight: 500;
}

.eqd-btn--ghost:hover {
  background: var(--eqd-ground);
}

/* Icon buttons: bell and messages. 36px square, the app's bordered style. */
.eqd-iconbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-sm);
  background: var(--eqd-surface);
  color: var(--eqd-muted);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 35, 61, 0.05);
}

.eqd-iconbtn:hover,
.eqd-iconbtn[aria-expanded="true"] {
  background: var(--eqd-ground);
  color: var(--eqd-ink);
}

.eqd-iconbtn svg {
  width: 18px;
  height: 18px;
}

.eqd-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--eqd-radius-pill);
  background: var(--eqd-wine);
  color: var(--eqd-on-wine);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.eqd-badge[hidden] {
  display: none;
}

/* Avatar chip that opens the account menu. */
.eqd-acct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 220px;
  height: 36px;
  padding: 0 10px 0 4px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-sm);
  background: var(--eqd-surface);
  color: var(--eqd-ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 35, 61, 0.05);
}

.eqd-acct:hover,
.eqd-acct[aria-expanded="true"] {
  background: var(--eqd-ground);
}

.eqd-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--eqd-hunter);
  background-size: cover;
  background-position: center;
  color: var(--eqd-on-hunter);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.eqd-acct__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--eqd-muted);
}

.eqd-acct__caret {
  flex-shrink: 0;
  color: var(--eqd-muted);
  font-size: 11px;
}

/* Anchors for the pop-overs. */
.eqd-pop {
  position: relative;
}

/* ---------- Account menu and notifications panel ---------- */

.eqd-menu,
.eqd-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(340px, calc(100vw - 24px));
  /* Never taller than the window below the header: on a short laptop screen the
     menu scrolls inside, so Sign out at the bottom can always be reached (#200). */
  max-height: calc(100dvh - var(--eqd-header-height) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-lg);
  background: var(--eqd-surface);
  box-shadow: var(--eqd-shadow-pop);
  color: var(--eqd-ink);
  font-family: var(--eqd-font-sans);
  font-size: 14px;
  text-align: left;
}

.eqd-panel {
  width: min(384px, calc(100vw - 24px));
  padding: 12px;
}

.eqd-menu[hidden],
.eqd-panel[hidden] {
  display: none;
}

.eqd-menu__identity {
  padding: 12px 16px;
  border-bottom: 1px solid var(--eqd-line);
  background: var(--eqd-surface-soft);
  box-shadow: inset 0 2px 0 rgba(183, 138, 67, 0.45);
}

.eqd-menu__name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eqd-menu__email {
  margin-top: 2px;
  font-size: 12px;
  color: var(--eqd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eqd-menu__section {
  padding: 8px;
  border-bottom: 1px solid var(--eqd-line);
}

.eqd-menu__section:last-child {
  border-bottom: 0;
}

.eqd-menu__kicker {
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--eqd-muted);
}

.eqd-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--eqd-radius-md);
  background: none;
  color: var(--eqd-ink);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.eqd-menu__item:hover {
  background: var(--eqd-ground);
}

.eqd-menu__item small {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--eqd-muted);
}

/* Your page on EquiSocial (#916): your photo beside your name, and under it
   the pages you look after, set in to line up with the name. */
.eqd-menu__who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.eqd-menu__who > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eqd-menu__managed {
  padding-top: 6px;
  padding-bottom: 6px;
  padding-left: 46px;
  font-size: 13px;
}

.eqd-menu__managed > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eqd-menu__managed--more {
  color: var(--eqd-hunter);
  font-weight: 600;
}

.eqd-menu__here {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: var(--eqd-radius-pill);
  background: var(--eqd-hunter-soft);
  color: var(--eqd-hunter);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.eqd-menu__count {
  flex-shrink: 0;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: var(--eqd-radius-pill);
  background: var(--eqd-wine);
  color: var(--eqd-on-wine);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

/* Current account and its switch (#219): the business name with a small
   "Switch" button; the other businesses list under it as menu items. */
.eqd-menu__current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 8px 6px;
}

.eqd-menu__current-name {
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eqd-menu__switch {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-sm);
  background: var(--eqd-surface);
  color: var(--eqd-ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.eqd-menu__switch:hover,
.eqd-menu__switch[aria-expanded="true"] {
  background: var(--eqd-ground);
}

.eqd-menu__item:disabled {
  cursor: default;
  opacity: 0.6;
}

.eqd-menu__error {
  padding: 4px 8px;
  font-size: 12px;
  color: var(--eqd-wine);
}

.eqd-menu__footer {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  border-top: 1px solid var(--eqd-line);
}

.eqd-menu__signout {
  padding: 6px 12px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-sm);
  background: var(--eqd-surface);
  color: var(--eqd-ink);
  font-weight: 500;
  cursor: pointer;
}

.eqd-menu__signout:hover {
  background: var(--eqd-ground);
}

/* The light/dark switch inside the menu (tool mode only). */
.eqd-switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-pill);
  background: var(--eqd-ground);
  transition: background 0.15s;
}

.eqd-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

[aria-checked="true"] .eqd-switch {
  background: var(--eqd-saddle);
  border-color: var(--eqd-saddle);
}

[aria-checked="true"] .eqd-switch::after {
  transform: translateX(18px);
}

/* Notifications */
.eqd-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--eqd-line);
  font-weight: 600;
}

.eqd-panel__head button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--eqd-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.eqd-panel__head button:disabled {
  opacity: 0.5;
  cursor: default;
}

.eqd-panel__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(28rem, calc(100vh - 10rem));
  overflow-y: auto;
  padding-right: 2px;
}

.eqd-panel__empty {
  padding: 16px 12px;
  border: 1px dashed var(--eqd-line);
  border-radius: var(--eqd-radius-md);
  color: var(--eqd-muted);
}

.eqd-note {
  padding: 10px 12px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-md);
  background: var(--eqd-surface-soft);
}

.eqd-note--read {
  opacity: 0.7;
}

.eqd-note--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.eqd-note--warning,
.eqd-note--action {
  background: #fffbeb;
  border-color: #fde68a;
}

:root[data-theme="dark"] .eqd-note--success {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(110, 231, 183, 0.35);
}

:root[data-theme="dark"] .eqd-note--warning,
:root[data-theme="dark"] .eqd-note--action {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(252, 211, 77, 0.38);
}

.eqd-note__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.eqd-note__title {
  font-weight: 600;
}

.eqd-note__body {
  margin-top: 2px;
  color: var(--eqd-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.eqd-note__meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--eqd-muted);
}

.eqd-note__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--eqd-wine);
}

.eqd-note__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
}

.eqd-note__actions a {
  color: var(--eqd-saddle);
  font-weight: 600;
  text-decoration: none;
}

.eqd-note__actions a:hover {
  text-decoration: underline;
}

.eqd-note__actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--eqd-muted);
  font-size: 12px;
  cursor: pointer;
}

/* ---------- Messages drawer ---------- */

.eqd-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(22, 32, 42, 0.35);
}

.eqd-scrim[hidden] {
  display: none;
}

.eqd-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  display: flex;
  flex-direction: column;
  width: 420px;
  max-width: 100vw;
  background: var(--eqd-surface);
  border-left: 1px solid var(--eqd-line);
  box-shadow: var(--eqd-shadow-pop);
  color: var(--eqd-ink);
  font-family: var(--eqd-font-sans);
  font-size: 14px;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
}

.eqd-drawer[data-open="true"] {
  transform: translateX(0);
}

.eqd-drawer[hidden] {
  display: none;
}

.eqd-drawer__head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--eqd-header-height);
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--eqd-line);
}

.eqd-drawer__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--eqd-font-serif);
  font-size: 18px;
  font-weight: 700;
}

.eqd-drawer__back,
.eqd-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--eqd-radius-sm);
  background: none;
  color: var(--eqd-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.eqd-drawer__back:hover,
.eqd-drawer__close:hover {
  background: var(--eqd-ground);
  color: var(--eqd-ink);
}

.eqd-drawer__back[hidden] {
  display: none;
}

.eqd-drawer__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.eqd-drawer__body[hidden] {
  display: none;
}

.eqd-drawer__status {
  margin: auto;
  padding: 24px;
  color: var(--eqd-muted);
  text-align: center;
}

/* Conversation list */
.eqd-convs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.eqd-conv {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--eqd-line);
  background: none;
  color: var(--eqd-ink);
  text-align: left;
  cursor: pointer;
}

.eqd-conv:hover {
  background: var(--eqd-hunter-soft);
}

.eqd-conv__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.eqd-conv__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.eqd-conv--unread .eqd-conv__title {
  font-weight: 700;
}

.eqd-conv--unread .eqd-conv__title::before {
  content: "\25CF";
  margin-right: 6px;
  color: var(--eqd-brass-text);
  font-size: 9px;
  vertical-align: 2px;
}

.eqd-conv__when {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--eqd-muted);
}

.eqd-conv__listing {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--eqd-brass-text);
}

.eqd-conv__preview {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--eqd-muted);
}

/* Thread */
.eqd-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.eqd-thread__listing {
  padding: 8px 16px;
  border-bottom: 1px solid var(--eqd-line);
  font-size: 13px;
}

.eqd-thread__listing a {
  color: var(--eqd-hunter);
  font-weight: 600;
  text-decoration: none;
}

.eqd-thread__msgs {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
}

/* Shown over the bottom of the thread when a reply lands while the reader is
   scrolled up (#257). */
.eqd-thread__new {
  align-self: center;
  margin: -6px 0 8px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--eqd-hunter);
  color: var(--eqd-on-hunter);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--eqd-shadow-pop);
}

.eqd-thread__new[hidden] {
  display: none;
}

.eqd-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.eqd-msg--mine {
  align-self: flex-end;
  align-items: flex-end;
}

.eqd-msg--theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.eqd-msg__who {
  margin-bottom: 2px;
  font-size: 11.5px;
  color: var(--eqd-muted);
}

.eqd-msg__bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.eqd-msg--mine .eqd-msg__bubble {
  background: var(--eqd-hunter);
  color: var(--eqd-on-hunter);
  border-bottom-right-radius: 4px;
}

.eqd-msg--theirs .eqd-msg__bubble {
  background: var(--eqd-ground);
  border: 1px solid var(--eqd-line);
  border-bottom-left-radius: 4px;
}

.eqd-msg__time {
  margin-top: 3px;
  font-size: 11px;
  color: var(--eqd-muted);
}

.eqd-reply {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--eqd-line);
}

.eqd-reply textarea {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-md);
  background: var(--eqd-ground);
  color: var(--eqd-ink);
  font: inherit;
  font-size: 16px; /* under 16px Safari on a phone zooms the page on focus */
  resize: none;
}

.eqd-reply__error {
  padding: 0 12px 10px;
  color: var(--eqd-wine);
  font-size: 12px;
}

.eqd-reply__error[hidden] {
  display: none;
}

/* ---------- Phones ---------- */

@media (max-width: 720px) {
  /* Links fold into a menu button; shell.js toggles data-nav-open. Any mode:
     a server-rendered surface keeps its links once it becomes a tool. */
  .eqd-header .eqd-nav {
    display: none;
  }

  .eqd-header .eqd-navtoggle {
    display: inline-flex;
  }

  .eqd-header[data-nav-open="true"] .eqd-nav {
    position: absolute;
    top: var(--eqd-header-height);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
    background: var(--eqd-surface);
    border-bottom: 1px solid var(--eqd-line);
    box-shadow: var(--eqd-shadow-header);
  }

  .eqd-header[data-nav-open="true"] .eqd-nav a {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .eqd-header {
    gap: 8px;
    padding: 0 var(--eqd-gutter-phone);
  }

  /* Master brand: the wordmark text goes, the crest stays, because the
     crest IS the brand. A product surface is the other way round (Map Room,
     15 September): it keeps its own name and drops the endorsement text,
     which otherwise left EquiMarket's phone header reading "E by
     EquiDetails" with the product's name the one thing not on the screen.
     The door home survives in the account menu's Go to list. */
  .eqd-header[data-product="equidetails"] .eqd-wordmark {
    display: none;
  }

  .eqd-header:not([data-product="equidetails"]) .eqd-header__endorse {
    display: none;
  }

  /* The standalone crest is the master brand's phone lockup; a product's
     wordmark already carries its own crest. */
  .eqd-header[data-product="equidetails"] .eqd-crest {
    display: block;
  }

  .eqd-header__divider,
  .eqd-header__workspace {
    display: none;
  }

  /* ★ The account cluster must never overflow the right edge again
     (EquiMarket, 2026-09-05: a third text link pushed the bell and avatar off
     screen). The cluster holds ONLY icon buttons and the avatar chip on a
     phone, the chip drops its name, and every destination that used to be a
     text link lives in the account menu instead. Nothing here can grow. */
  .eqd-header__account {
    gap: 6px;
  }

  .eqd-acct {
    max-width: 44px;
    padding: 0 3px;
  }

  .eqd-acct__name,
  .eqd-acct__caret {
    display: none;
  }

  .eqd-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .eqd-btn__long {
    display: none;
  }

  .eqd-btn__short {
    display: inline;
  }

  .eqd-menu,
  .eqd-panel {
    position: fixed;
    top: calc(var(--eqd-header-height) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
  }

  .eqd-drawer {
    width: 100%;
    border-left: 0;
  }
}

/* A card as the message itself (a hay quote, a lesson enrollment, a training
   proposal...; .eqd-card is any card drawn from the server's description,
   #296): the app's proposal card. A coloured header with an eyebrow and a
   title; label/value rows; a highlighted note when there is one; the state
   and the actions at the foot. */
.eqd-msg--card { max-width: min(24rem, 92%); }
.eqd-msg--card .eqd-msg__time { margin-top: 3px; }
.eqd-haycard {
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--eqd-line);
  background: var(--eqd-surface, #fff);
  color: var(--eqd-ink);
  font-size: 13px;
  text-align: left;
  box-shadow: 0 1px 2px rgba(16, 35, 61, 0.06);
}
.eqd-haycard__loading { padding: 24px 16px; color: var(--eqd-muted); }
.eqd-haycard__head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--eqd-saddle);
  color: #fff;
}
.eqd-haycard__icon { font-size: 18px; line-height: 1; }
.eqd-haycard__titles { min-width: 0; }
.eqd-haycard__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.8); }
.eqd-haycard__title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eqd-haycard__rows { margin: 0; padding: 0 14px; }
.eqd-haycard__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--eqd-line); font-size: 13px;
}
.eqd-haycard__row:first-child { border-top: 0; }
.eqd-haycard__k { flex-shrink: 0; color: var(--eqd-muted); }
.eqd-haycard__v { margin: 0; text-align: right; color: var(--eqd-ink); }
.eqd-haycard__note {
  margin: 4px 14px; padding: 6px 10px; border-radius: 8px;
  background: #fffbeb; color: #92400e; font-size: 11px;
}
.eqd-haycard__note--ok { background: rgba(30,74,56,.08); color: var(--eqd-hunter); }
.eqd-haycard__foot { padding: 8px 14px 14px; text-align: center; }
.eqd-haycard__state { font-size: 12px; font-weight: 500; color: var(--eqd-muted); }
.eqd-haycard__accept {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer;
  background: var(--eqd-saddle); color: #fff; font: inherit; font-size: 14px; font-weight: 500;
}
.eqd-haycard__accept:hover { opacity: .9; }
/* The same button drawn as a link (the seller's door into EquiHay). */
a.eqd-haycard__accept { text-decoration: none; box-sizing: border-box; }

/* The kit's confirmation (accepting a hay quote, #204): the family's dialog,
   above the message panel. */
.eqd-kconfirm { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; font-family: var(--eqd-font-sans); text-align: left; }
.eqd-kconfirm__backdrop { position: absolute; inset: 0; background: rgba(16, 36, 62, 0.4); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.eqd-kconfirm__panel { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); background: var(--eqd-surface); border: 1px solid var(--eqd-line); border-radius: 16px; box-shadow: 0 24px 60px rgba(16, 35, 61, 0.28); outline: none; color: var(--eqd-ink); }
.eqd-kconfirm__close { position: absolute; top: -8px; right: -8px; z-index: 1; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--eqd-line); background: var(--eqd-surface); color: var(--eqd-muted); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
.eqd-kconfirm__close:hover { color: var(--eqd-ink); }
.eqd-kconfirm__head { padding: 16px 24px; border-bottom: 1px solid var(--eqd-line); background: var(--eqd-surface-soft); border-radius: 16px 16px 0 0; }
.eqd-kconfirm__title { margin: 0; font-family: var(--eqd-font-serif, Georgia, serif); font-size: 20px; font-weight: 600; color: var(--eqd-ink); }
.eqd-kconfirm__body { padding: 20px 24px; font-size: 15px; line-height: 1.55; overflow-y: auto; }
.eqd-kconfirm__body p { margin: 0 0 6px; }
.eqd-kconfirm__body p:last-child { margin: 0; color: var(--eqd-muted); }
.eqd-kconfirm__foot { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--eqd-line); border-radius: 0 0 16px 16px; }
.eqd-kconfirm__cancel, .eqd-kconfirm__action { font: inherit; font-size: 14px; font-weight: 600; padding: 9px 18px; border-radius: 999px; cursor: pointer; }
.eqd-kconfirm__cancel { background: var(--eqd-surface); color: var(--eqd-ink); border: 1px solid var(--eqd-line); }
.eqd-kconfirm__cancel:hover { background: var(--eqd-surface-soft); }
.eqd-kconfirm__action { background: var(--eqd-hunter); color: var(--eqd-on-hunter); border: 1px solid var(--eqd-hunter); }
.eqd-kconfirm__action:focus-visible, .eqd-kconfirm__cancel:focus-visible, .eqd-kconfirm__close:focus-visible { outline: 2px solid rgba(183, 138, 67, 0.5); outline-offset: 2px; }
.eqd-haycard__foot .eqd-haycard__door { margin-top: 8px; }
.eqd-haycard__decline {
  display: block; width: 100%; margin-top: 6px; border: 0; background: none; cursor: pointer;
  color: var(--eqd-muted); font: inherit; font-size: 12px; font-weight: 500; padding: 4px;
}
.eqd-haycard__decline:hover { color: var(--eqd-ink); }
.eqd-haycard__accept:disabled, .eqd-haycard__decline:disabled { opacity: .6; cursor: default; }
.eqd-haycard__door {
  display: inline-block; font-size: 13px; font-weight: 600; color: var(--eqd-hunter); text-decoration: none;
}
/* A card drawn from the server's description: where it stands, then what the
   reader can do. */
.eqd-card .eqd-haycard__state + .eqd-haycard__accept,
.eqd-card .eqd-haycard__accept + .eqd-haycard__accept { margin-top: 8px; }
.eqd-card .eqd-haycard__state + .eqd-haycard__door { margin-top: 6px; }

/* ---------- The Products menu in the site-mode nav ----------
 * The kit's site-mode nav is a flat list of links. The master brand adds one
 * menu to it (rule 5: the root carries a Products menu), and the app's
 * sign-in pages wear the same list, so the menu lives in the kit. A <details>
 * element so it works before any script runs; the host closes it on Escape
 * or an outside click (apps/equidetails_public/src/islands/Header.tsx,
 * apps/equidetails_web/src/components/nav/SiteProductsMenu.tsx). */
.eqd-navmenu {
  position: relative;
}
.eqd-navmenu > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--eqd-radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--eqd-muted);
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}
.eqd-navmenu > summary::-webkit-details-marker {
  display: none;
}
.eqd-navmenu > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.eqd-navmenu > summary:hover,
.eqd-navmenu[open] > summary {
  color: var(--eqd-ink);
  background: var(--eqd-hunter-soft);
}
.eqd-navmenu__list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: 280px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-lg);
  background: var(--eqd-surface);
  box-shadow: var(--eqd-shadow-pop);
}
.eqd-navmenu__list a,
.eqd-navmenu__list .eqd-navmenu__soon {
  display: block;
  padding: 8px 10px;
  border-radius: var(--eqd-radius-md);
  color: var(--eqd-ink);
  font-weight: 600;
  text-decoration: none;
  /* The nav's links stay on one line; the menu's wrap inside its box. */
  white-space: normal;
}
.eqd-navmenu__list a:hover {
  background: var(--eqd-ground);
}
.eqd-navmenu__list small {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  font-weight: 400;
  color: var(--eqd-muted);
}
.eqd-navmenu__soon {
  color: var(--eqd-muted);
  cursor: default;
}
.eqd-navmenu__soon .eqd-navmenu__tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px dashed var(--eqd-line);
  border-radius: var(--eqd-radius-pill);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}
@media (max-width: 720px) {
  .eqd-navmenu__list {
    position: static;
    width: auto;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 4px 12px;
  }
  .eqd-navmenu > summary {
    min-height: 44px;
  }
}

/* ---------- Writing to a page ----------
   The sheet a business page's Message button opens (shell.js writeTo). A
   centred card on a desktop, a sheet from the bottom on a phone. It sits
   above the header and the drawer's scrim, and its box is 16px so Safari on a
   phone does not zoom the page on focus. */

.eqd-sheetscrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(22, 32, 42, 0.42);
}

.eqd-sheetscrim[hidden] {
  display: none;
}

.eqd-sheet {
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--eqd-line);
  border-radius: 14px;
  background: var(--eqd-surface);
  box-shadow: var(--eqd-shadow-pop);
  color: var(--eqd-ink);
  font-family: var(--eqd-font-sans);
  font-size: 14px;
  line-height: 1.5;
}

.eqd-sheet,
.eqd-sheet * {
  box-sizing: border-box;
}

.eqd-sheet[hidden],
.eqd-sheet [hidden] {
  display: none;
}

.eqd-sheet__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eqd-sheet__to {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.eqd-sheet__face {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--eqd-hunter) center / cover no-repeat;
  color: var(--eqd-on-hunter);
  font-family: var(--eqd-font-serif, Georgia, serif);
  font-weight: 700;
  font-size: 14px;
}

.eqd-sheet__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.eqd-sheet__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--eqd-muted);
}

.eqd-sheet__name {
  font-family: var(--eqd-font-serif, Georgia, serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.eqd-sheet__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--eqd-muted);
  cursor: pointer;
}

.eqd-sheet__close:hover {
  background: var(--eqd-hunter-soft);
  color: var(--eqd-ink);
}

.eqd-sheet__form textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--eqd-line);
  border-radius: var(--eqd-radius-md);
  background: var(--eqd-ground);
  color: var(--eqd-ink);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}

.eqd-sheet__form textarea:focus-visible,
.eqd-sheet .eqd-btn:focus-visible,
.eqd-sheet__close:focus-visible {
  outline: 2px solid var(--eqd-hunter);
  outline-offset: 2px;
}

.eqd-sheet__lead {
  margin: 14px 0 12px;
  font-size: 15px;
}

.eqd-sheet__note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--eqd-muted);
}

.eqd-sheet__error {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--eqd-wine);
}

.eqd-sheet__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.eqd-sheet__wide {
  width: 100%;
}

.eqd-sheet__sent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: var(--eqd-radius-md);
  background: var(--eqd-hunter-soft);
  font-size: 15px;
}

.eqd-sheet__tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--eqd-hunter);
  color: var(--eqd-on-hunter);
  font-size: 13px;
}

/* ---------- Report a problem (#625) ----------
   The account menu's form (shell.js reportProblem), in the same sheet as
   writing to a page: three boxes, a picture, Send. The boxes are 16px so
   Safari on a phone does not zoom the page on focus. */

.eqd-report__title {
  flex: 1;
  margin: 0;
  font-family: var(--eqd-font-serif, Georgia, serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.eqd-report__label {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}

/* The first question (#639): something broken or an idea, two choices on a line. */
.eqd-report__kind {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.eqd-report__kind > legend.eqd-report__label {
  float: left;
  width: 100%;
  margin-top: 0;
  margin-bottom: 6px;
  padding: 0;
}

.eqd-report__choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
}

.eqd-report__choice input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--eqd-hunter);
}

.eqd-sheet__form textarea.eqd-report__box {
  min-height: 64px;
  margin-top: 6px;
}

.eqd-report__file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.eqd-report__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.eqd-report__pick {
  cursor: pointer;
}

/* Send waits for What happened, and shows it is waiting. */
.eqd-report .eqd-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.eqd-report__pick:focus-within {
  outline: 2px solid var(--eqd-hunter);
  outline-offset: 2px;
}

.eqd-report__filename {
  min-width: 0;
  font-size: 13px;
  color: var(--eqd-ink);
  overflow-wrap: anywhere;
}

.eqd-report__remove {
  border: 0;
  background: transparent;
  color: var(--eqd-wine);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.eqd-toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(440px, calc(100vw - 32px));
  padding: 12px 8px 12px 12px;
  transform: translateX(-50%);
  border: 1px solid var(--eqd-line);
  border-radius: 12px;
  background: var(--eqd-surface);
  box-shadow: var(--eqd-shadow-pop);
  color: var(--eqd-ink);
  font-family: var(--eqd-font-sans);
  font-size: 14px;
  line-height: 1.5;
}

.eqd-toast[hidden] {
  display: none;
}

.eqd-toast__text {
  flex: 1;
  min-width: 0;
}

.eqd-toast__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--eqd-muted);
  cursor: pointer;
}

/* The line above a message that came from a page: where it started, for the
   business that reads it. */
.eqd-msg__origin {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 2px;
  font-size: 12px;
  color: var(--eqd-muted);
}

.eqd-msg__origin::before,
.eqd-msg__origin::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--eqd-line);
}

.eqd-msg__origin a {
  color: var(--eqd-hunter);
  font-weight: 600;
  text-decoration: none;
}

[data-theme="dark"] .eqd-msg__origin a {
  color: var(--eqd-brass-text);
}

@media (max-width: 640px) {
  .eqd-sheetscrim {
    place-items: end stretch;
    padding: 0;
  }

  .eqd-sheet {
    width: 100%;
    max-height: calc(100vh - 48px);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .eqd-sheet__actions .eqd-btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .eqd-sheet {
    animation: eqd-sheet-in 0.16s ease-out;
  }
}

@keyframes eqd-sheet-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
