/* Community: the launcher, the side panel (friends, The Coffee Shop, messages, visits) and the farm visit
   screen. Colours come from the farm office tokens in theme.css so light and dark themes both work. */

.community-btn {
  position: relative;
  height: 36px;
  padding: 0 12px;
  margin-right: 8px;
  border-radius: 18px;
  border: 1px solid #ffffff44;
  background: transparent;
  color: var(--paper, #f0efdc);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  cursor: pointer;
  white-space: nowrap;
}
.community-btn:hover,
.community-btn:focus-visible {
  border-color: var(--lime);
}
.fh-community {
  position: relative;
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--fh-line-strong);
  background: var(--fh-surface);
  color: var(--fh-ink);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.fh-community:hover {
  border-color: var(--fh-accent-ink);
}
:is(.community-btn, .fh-community) .fh-badge {
  position: absolute;
  top: -4px;
  right: -4px;
}
@media (max-width: 1100px) {
  .community-btn span {
    display: none;
  }
}
@media (max-width: 700px) {
  .fh-community span {
    display: none;
  }
}

/* panel */
.cm-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: var(--fh-surface);
  color: var(--fh-ink);
  border: 1px solid var(--fh-line-strong);
  border-radius: 16px;
  box-shadow: 0 18px 60px #0005;
  overflow: hidden;
  font-size: 14px;
}
.cm-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--fh-line);
}
.cm-head > div {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.cm-head .eyebrow {
  font-size: 10px;
  letter-spacing: 1.4px;
  color: var(--fh-muted);
}
.cm-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--fh-line-strong);
  background: transparent;
  color: var(--fh-ink);
  cursor: pointer;
  flex: none;
}
.cm-icon.on {
  background: var(--fh-bad-bg);
  border-color: var(--fh-bad);
}
.cm-tabs {
  display: flex;
  border-bottom: 1px solid var(--fh-line);
}
.cm-tabs button {
  flex: 1;
  padding: 10px 6px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--fh-muted);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.cm-tabs button[aria-selected='true'] {
  color: var(--fh-ink);
  border-bottom-color: var(--lime);
}
.cm-tabs b,
.cm-unread {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 9px;
  background: var(--fh-bad);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  text-align: center;
}
.cm-body {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
}
.cm-roombody {
  display: flex;
  padding: 0;
  overflow: hidden;
}
.cm-sec {
  margin: 14px 0;
}
.cm-sec h4 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--fh-muted);
}
.cm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--fh-line);
}
.cm-row > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cm-row small,
.cm-hint,
.cm-add small {
  color: var(--fh-muted);
  font-size: 12px;
}
.cm-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.cm-open > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cm-av {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: hsl(var(--h, 120) 42% 36%);
}
.cm-dot {
  position: absolute;
  left: 26px;
  top: 26px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--fh-surface);
  background: var(--fh-faint);
}
.cm-dot.on {
  background: #2fb35a;
}
.cm-more {
  position: relative;
}
.cm-more > summary {
  list-style: none;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
  color: var(--fh-muted);
  font-weight: 800;
}
.cm-more > summary::-webkit-details-marker {
  display: none;
}
.cm-more > div {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 3;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--fh-surface);
  border: 1px solid var(--fh-line-strong);
  border-radius: 10px;
  box-shadow: var(--fh-shadow);
}
.cm-more > div button {
  padding: 8px 10px;
  border: 0;
  background: none;
  color: var(--fh-ink);
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
}
.cm-more > div button:hover {
  background: var(--fh-accent-soft);
}
.cm-more > div button.danger {
  color: var(--fh-bad);
}
.cm-more > div small {
  padding: 4px 10px;
  color: var(--fh-muted);
}
.cm-add {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cm-add label {
  font-weight: 700;
}
.cm-add > div {
  display: flex;
  gap: 6px;
}
.cm-add input,
.cm-form textarea {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--fh-line-strong);
  background: var(--fh-input);
  color: var(--fh-ink);
  font: inherit;
}
.cm-empty {
  color: var(--fh-muted);
  padding: 12px 4px;
  list-style: none;
}
.cm-panel .small,
.cv-wrap .small {
  padding: 6px 10px;
  font-size: 11px;
}
.cm-blocked summary {
  cursor: pointer;
  color: var(--fh-muted);
}

/* chat */
.cm-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}
.cm-log {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cm-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  list-style: none;
}
.cm-line > div {
  max-width: 78%;
  padding: 8px 11px;
  border-radius: 12px 12px 12px 4px;
  background: var(--fh-bg);
}
.cm-line.mine {
  flex-direction: row-reverse;
}
.cm-line.mine > div {
  border-radius: 12px 12px 4px 12px;
  background: var(--fh-accent-soft);
}
.cm-line small {
  color: var(--fh-muted);
  font-size: 11px;
}
.cm-line p {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.cm-line .cm-av {
  width: 30px;
  height: 30px;
  font-size: 11px;
}
.cm-line .cm-more {
  align-self: center;
  opacity: 0.4;
}
.cm-line:hover .cm-more,
.cm-line .cm-more[open] {
  opacity: 1;
}
.cm-line.mine .cm-more > div {
  right: auto;
  left: 0;
}
.cm-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 12px 6px;
}
.cm-chips button {
  flex: none;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid var(--fh-line-strong);
  background: var(--fh-surface);
  color: var(--fh-ink);
  font-size: 12px;
  cursor: pointer;
}
.cm-form {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--fh-line);
}
.cm-form textarea {
  resize: none;
  max-height: 120px;
}
.cm-chat > .cm-hint {
  margin: 0;
  padding: 0 12px 10px;
}

/* farm visit */
.cv-wrap {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #0009;
}
.cv-box {
  width: min(1180px, 100%);
  height: min(820px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--fh-bg);
  color: var(--fh-ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px #0007;
}
.cv-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--fh-surface);
  border-bottom: 1px solid var(--fh-line);
}
.cv-head > div:first-child {
  flex: 1;
}
.cv-head h3 {
  margin: 2px 0;
}
.cv-sub {
  margin: 0;
  color: var(--fh-muted);
  font-size: 13px;
}
.cv-head-actions {
  display: flex;
  gap: 6px;
}
.cv-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
}
.cv-farm {
  overflow: auto;
  padding: 16px 18px;
}
.cv-chat {
  display: flex;
  min-height: 0;
  background: var(--fh-surface);
  border-left: 1px solid var(--fh-line);
}
.cv-fc {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.cv-fc span {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--fh-surface);
  border: 1px solid var(--fh-line);
  font-size: 12px;
}
.cv-fc b {
  margin-right: 6px;
}
.cv-fields {
  display: grid;
  gap: 12px;
}
.cv-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 72px;
  gap: 14px;
  align-items: start;
  padding: 12px;
  border-radius: 12px;
  background: var(--fh-surface);
  border: 1px solid var(--fh-line);
  box-shadow: var(--fh-shadow);
}
.cv-art {
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(#bcd9f0, #e8f2d8);
  display: grid;
  place-items: center;
}
.cv-art svg {
  width: 100%;
  height: 100%;
}
.cv-bare {
  color: #5a4630;
  font-size: 12px;
}
.cv-info h4 {
  margin: 0 0 4px;
}
.cv-info p {
  margin: 3px 0;
  font-size: 13px;
}
.cv-scout {
  color: var(--fh-muted);
}
.cv-cond {
  font-weight: 600;
}
.cv-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--fh-accent-soft);
}
.cv-alerts {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--fh-warn);
}
.cv-shape path {
  fill: var(--fh-accent-soft);
  stroke: var(--fh-accent-ink);
  stroke-width: 2;
}
@media (max-width: 860px) {
  .cv-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.2fr) minmax(280px, 1fr);
  }
  .cv-chat {
    border-left: 0;
    border-top: 1px solid var(--fh-line);
  }
  .cv-field {
    grid-template-columns: 90px minmax(0, 1fr);
  }
  .cv-shape {
    display: none;
  }
  .cv-wrap {
    padding: 0;
  }
  .cv-box {
    border-radius: 0;
    height: 100%;
  }
  .cv-head {
    flex-wrap: wrap;
  }
}
@media (max-width: 700px) {
  .cm-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    height: 82vh;
  }
}

/* The Coffee Shop name step (before the first visit) */
.cm-namegate {
  display: grid;
  gap: 8px;
  padding: 4px 2px 12px;
}
.cm-namegate h4 {
  margin: 0;
  font-size: 17px;
  color: var(--fh-ink);
}
.cm-namegate p {
  margin: 0;
  color: var(--fh-muted);
  font-size: 13px;
  line-height: 1.5;
}
.cm-namegate .farm-input {
  width: 100%;
}
.cm-namegate .cm-namegate-err {
  min-height: 1em;
  color: var(--fh-bad);
}
.cm-namegate .primary {
  justify-self: start;
  margin-top: 4px;
}
