.comm-page {
  padding: 24px 0 48px;
}

.comm-page[data-authenticated="0"] {
  max-width: 980px;
}

.comm-auth {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  font-size: 1.62rem;
  line-height: 1.45;
}

.comm-side,
.comm-thread,
.comm-guest {
  background: #fff;
  border: 1px solid #d4dfe7;
  border-radius: 14px;
  padding: 14px;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-thread {
  display: flex;
  flex-direction: column;
  min-height: 64vh;
}

.comm-side-head {
  margin-bottom: 10px;
}

.comm-side-head h2,
.comm-super h3,
.comm-guest h1 {
  margin: 0;
}

.comm-guest {
  border: 0;
  background: transparent;
  padding: 8px 0 0;
}

.comm-guest-wrap {
  max-width: 760px;
}

.comm-guest h1 {
  font-size: clamp(2.2rem, 4.8vw, 3.35rem);
  line-height: 1.05;
  font-weight: 400;
  margin-bottom: 0.65rem;
}

.comm-guest p {
  color: #555;
  font-size: 1.03rem;
  line-height: 1.45;
  max-width: 720px;
}

.comm-guest-form {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.8rem;
}

.comm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.comm-field {
  display: grid;
  gap: 0.55rem;
}

.comm-field > span {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2f2f2f;
}

.comm-guest select,
.comm-guest input,
.comm-guest textarea {
  width: 100%;
  font: inherit;
}

.comm-guest select {
  border: 1px solid #e3e3e3;
  background: #f7f7f7;
  border-radius: 3px;
  min-height: 50px;
  padding: 10px 12px;
}

.comm-guest input {
  border: 0;
  border-bottom: 1px solid #d5d5d5;
  border-radius: 0;
  background: transparent;
  padding: 10px 2px;
}

.comm-guest textarea {
  border: 0;
  background: #f3f3f3;
  min-height: 210px;
  padding: 14px;
  border-radius: 0;
}

.comm-file-field input[type="file"] {
  border: 0;
  padding: 0;
}

.comm-file-note {
  margin: -0.8rem 0 0;
  color: #6a6a6a;
  font-size: 0.8em;
}

.comm-submit {
  width: 100%;
  justify-content: center;
}

.comm-thread-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.comm-thread-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.comm-thread-row .comm-thread-item {
  flex: 1 1 auto;
}

.comm-thread-hide {
  flex: 0 0 40px;
  border: 1px solid #efb9bf;
  border-radius: 10px;
  background: #fff2f4;
  color: #b12634;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
  font-size: 0.85em;
  font-weight: 700;
  cursor: pointer;
}

.comm-thread-hide:hover {
  background: #ffdfe4;
  color: #8d1c28;
}

.comm-section-label {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8aabb9;
  padding: 8px 4px 2px;
}

.comm-thread-item {
  border: 1px solid #d4dfe7;  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  background: #f8fbfd;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-thread-item.is-active {
  border-color: #0b7b95;
  background: #eef7fb;
}

.comm-thread-item strong {
  display: block;
  font-size: 1em;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-thread-item small {
  color: #537080;
  font-size: 0.8em;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-unread-dot {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  border-radius: 999px;
  background: #c93636;
  color: #fff;
  font-size: 0.7em;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 6px;
}

.comm-thread-head {
  font-weight: 700;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.comm-thread-messages {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: 64vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.comm-thread-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.comm-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  align-self: flex-start;
}

.comm-msg.mine {
  align-self: flex-end;
}

.comm-msg-sender {
  font-size: 0.85em;
  font-weight: 700;
  color: #537080;
  margin-bottom: 3px;
  padding: 0 4px;
}

.comm-msg.mine .comm-msg-sender {
  text-align: right;
}

.comm-msg-bubble {
  background: #f0f6fa;
  border: 1px solid #d4dfe7;
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  padding: 9px 13px;
  position: relative;
}

.comm-msg.mine .comm-msg-bubble {
  background: #ddf0f7;
  border-color: #a6d5e8;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 3px;
}

.comm-msg-body {
  font-size: 1em;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1a2f3a;
}

.comm-msg-time {
  font-size: 0.7em;
  color: #8aabb9;
  margin-top: 5px;
  text-align: right;
}

.comm-msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  padding: 0 4px;
}

.comm-msg.mine .comm-msg-actions {
  justify-content: flex-end;
}

.comm-msg-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  color: #537080;
  margin-bottom: 6px;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-inline-reply {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  margin-top: auto;
  background: #fff;
  border-top: 1px solid #e7eef3;
  flex: 0 0 auto;
}

.comm-inline-reply textarea {
  flex: 1 1 auto;
  border: 1px solid #c8d8e2;
  border-radius: 10px;
  padding: 8px;
  font: inherit;
  min-height: 60px;
  resize: vertical;
}

.comm-inline-reply-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-self: stretch;
}

.comm-inline-reply-actions button {
  height: 100%;
}

/* Contacts pane */
.comm-contact-row {
  border: 1px solid #d4dfe7;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.comm-contact-toggle {
  width: 100%;
  background: #f8fbfd;
  border: none;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-contact-toggle.is-active {
  background: #eef7fb;
}

.comm-contact-toggle:hover {
  background: #eaf4f9;
}

.comm-contact-head {
  flex: 1;
  min-width: 0;
}

.comm-contact-head strong {
  display: block;
  font-size: 1em;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-contact-head small {
  display: block;
  color: #537080;
  font-size: 0.8em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Open Sans", "Trebuchet MS", sans-serif;
}

.comm-contact-chevron {
  font-size: 0.8em;
  color: #8aabb9;
  flex-shrink: 0;
}

.comm-contact-thread {
  border-top: 1px solid #d4dfe7;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 58vh;
  overflow: hidden;
}

.comm-contact-thread .comm-thread-scroll {
  padding: 0;
}

.comm-contact-loading {
  padding: 12px;
  color: #537080;
  font-style: italic;
}

.comm-msg-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  color: #537080;
  margin-bottom: 6px;
}

.comm-turnstile {
  margin-top: 4px;
}

.comm-guest-warning {
  margin: 0;
  color: #b12634;
  font-weight: 600;
}

@media (max-width: 920px) {
  .comm-auth {
    grid-template-columns: 1fr;
  }

  .comm-form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .comm-page {
    padding: 12px 0 28px;
  }

  .comm-side,
  .comm-thread,
  .comm-guest {
    border-radius: 10px;
    padding: 10px;
  }

  .comm-thread {
    min-height: 55vh;
  }

  .comm-thread-messages {
    max-height: 45vh;
  }

  .comm-guest h1 {
    font-size: clamp(1.8rem, 7vw, 2.8rem);
  }

  /* Inline reply: stack send button below textarea on phones */
  .comm-inline-reply {
    flex-direction: column;
    gap: 6px;
  }

  .comm-inline-reply-actions {
    align-self: flex-end;
  }

  /* Contact form submit button full width */
  .comm-submit {
    width: 100%;
  }
}
