body[data-page-id="messages"] {
  min-height: 100vh;
}

.messages-shell {
  margin: 0 auto;
  max-width: 1220px;
  padding: 32px 20px 56px;
}

.messages-header {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 18px 0 22px;
}

.messages-header h1 {
  color: #f7fbff;
  font-size: clamp(2rem, 3vw, 2.85rem);
  line-height: 1.06;
  margin: 0;
}

.messages-copy {
  color: #b7c8da;
  line-height: 1.5;
  margin: 9px 0 0;
  max-width: 680px;
}

.messages-status,
.message-form-status {
  border-radius: 999px;
  font-weight: 800;
  line-height: 1.35;
}

.messages-status {
  background: rgba(75, 163, 255, 0.12);
  border: 1px solid rgba(75, 163, 255, 0.26);
  color: #d9ecff;
  flex: 0 1 320px;
  margin: 0;
  padding: 9px 13px;
}

.messages-status[data-tone="success"],
.message-form-status[data-tone="success"] {
  background: rgba(47, 199, 161, 0.12);
  border-color: rgba(47, 199, 161, 0.3);
  color: #a9f5df;
}

.messages-status[data-tone="warning"],
.message-form-status[data-tone="warning"] {
  background: rgba(244, 201, 93, 0.12);
  border-color: rgba(244, 201, 93, 0.34);
  color: #ffe3a3;
}

.messages-status[data-tone="danger"],
.message-form-status[data-tone="danger"] {
  background: rgba(255, 122, 110, 0.12);
  border-color: rgba(255, 122, 110, 0.34);
  color: #ffb8b2;
}

.message-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.message-summary-card {
  background: linear-gradient(180deg, rgba(15, 36, 55, 0.9), rgba(10, 26, 40, 0.95));
  border: 1px solid rgba(172, 196, 219, 0.2);
  border-radius: 10px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
}

.message-summary-card span {
  color: #9fb2c8;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.message-summary-card strong {
  color: #f7fbff;
  font-size: 1.65rem;
  line-height: 1;
}

.message-summary-card small {
  color: #9fb2c8;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
}

.message-summary-card[data-tone="warning"] strong {
  color: #ffe3a3;
}

.message-summary-card[data-tone="success"] strong {
  color: #a9f5df;
}

.message-summary-card[data-tone="info"] strong {
  color: #d9ecff;
}

.message-summary-card[data-tone="urgent"] strong {
  color: #ffcf78;
}

.message-action-queue {
  background: linear-gradient(180deg, rgba(15, 36, 55, 0.92), rgba(10, 26, 40, 0.98));
  border: 1px solid rgba(172, 196, 219, 0.22);
  border-radius: 10px;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.26);
  margin: 0 0 16px;
  padding: 16px;
}

.message-action-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.message-action-heading h2 {
  color: #f7fbff;
  font-size: 1.12rem;
  margin: 0;
}

.message-action-status {
  background: rgba(244, 201, 93, 0.12);
  border: 1px solid rgba(244, 201, 93, 0.32);
  border-radius: 999px;
  color: #ffe3a3;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 7px 10px;
}

.message-action-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.message-action-item,
.message-action-empty {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-left: 4px solid #f4c95d;
  border-radius: 8px;
  min-width: 0;
  padding: 12px;
}

.message-action-item.is-stale {
  background: rgba(255, 122, 110, 0.1);
  border-color: rgba(255, 122, 110, 0.34);
  border-left-color: #ff7a6e;
}

.message-action-content {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.message-action-content strong {
  color: #f7fbff;
  overflow-wrap: anywhere;
}

.message-action-content span,
.message-action-content small,
.message-action-empty {
  color: #b7c8da;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.4;
}

.message-action-open {
  align-items: center;
  background: rgba(107, 214, 198, 0.12);
  border: 1px solid rgba(107, 214, 198, 0.34);
  border-radius: 999px;
  color: #dffcf7;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 900;
  justify-content: center;
  margin-top: 10px;
  min-height: 30px;
  padding: 0 10px;
}

.message-action-open:hover,
.message-action-open:focus-visible {
  background: linear-gradient(135deg, #2fc7a1, #4ba3ff);
  color: #03101c;
  outline: none;
}

.message-template-panel {
  background: linear-gradient(180deg, rgba(15, 36, 55, 0.94), rgba(10, 26, 40, 0.98));
  border: 1px solid rgba(172, 196, 219, 0.22);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  margin: 0 0 16px;
  padding: 16px;
}

.message-template-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.message-template-heading h2 {
  color: #f7fbff;
  font-size: 1.12rem;
  margin: 0;
}

.message-template-status {
  background: rgba(75, 163, 255, 0.12);
  border: 1px solid rgba(75, 163, 255, 0.32);
  border-radius: 999px;
  color: #d9ecff;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 7px 10px;
}

.message-template-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.message-template-button,
.message-template-empty {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-radius: 8px;
  color: #f7fbff;
  min-width: 0;
  padding: 12px;
}

.message-template-button {
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 6px;
  text-align: left;
}

.message-template-button:hover,
.message-template-button:focus-visible {
  background: rgba(75, 163, 255, 0.12);
  border-color: rgba(75, 163, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(75, 163, 255, 0.14);
  outline: none;
}

.message-template-button strong {
  color: #f7fbff;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.message-template-button span,
.message-template-empty {
  color: #b7c8da;
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.4;
}

.message-template-button small {
  background: rgba(47, 199, 161, 0.12);
  border: 1px solid rgba(47, 199, 161, 0.3);
  border-radius: 999px;
  color: #a9f5df;
  font-size: 0.7rem;
  font-weight: 850;
  justify-self: start;
  padding: 4px 7px;
}

.messages-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 0.8fr) minmax(300px, 0.8fr) minmax(360px, 1.2fr);
}

.message-compose-card,
.message-thread-card,
.message-detail-card {
  background: linear-gradient(180deg, rgba(15, 36, 55, 0.96), rgba(10, 26, 40, 0.98));
  border: 1px solid rgba(172, 196, 219, 0.22);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  color: #f7fbff;
  min-width: 0;
  padding: 20px;
}

.message-card-heading,
.message-thread-heading {
  margin-bottom: 14px;
}

.message-card-heading h2,
.message-thread-heading h2,
.message-detail-heading h2 {
  color: #f7fbff;
  font-size: 1.12rem;
  margin: 0;
}

.message-card-heading p,
.message-thread-heading p,
.message-detail-heading p {
  color: #9fb2c8;
  line-height: 1.45;
  margin: 6px 0 0;
}

.message-thread-heading,
.message-detail-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.thread-count,
.message-status-badge {
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 850;
  padding: 6px 9px;
}

.thread-count {
  background: rgba(47, 199, 161, 0.13);
  border: 1px solid rgba(47, 199, 161, 0.3);
  color: #dffcf7;
}

.message-status-badge {
  background: rgba(75, 163, 255, 0.12);
  border: 1px solid rgba(75, 163, 255, 0.34);
  color: #d9ecff;
}

.message-status-badge[data-status="resolved"] {
  background: rgba(47, 199, 161, 0.13);
  border-color: rgba(47, 199, 161, 0.3);
  color: #a9f5df;
}

.message-form,
.message-reply-form {
  display: grid;
  gap: 14px;
}

.message-form label,
.message-reply-form label {
  color: #cfe2f4;
  display: grid;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 7px;
}

.message-form input,
.message-filter input,
.message-form textarea,
.message-reply-form textarea {
  background: rgba(5, 14, 24, 0.82);
  border: 1px solid rgba(172, 196, 219, 0.24);
  border-radius: 8px;
  box-sizing: border-box;
  caret-color: #f7fbff;
  color: #f7fbff;
  color-scheme: dark;
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.message-form textarea,
.message-reply-form textarea {
  min-height: 118px;
}

.message-form input::placeholder,
.message-filter input::placeholder,
.message-form textarea::placeholder,
.message-reply-form textarea::placeholder {
  color: #98aac0;
  opacity: 1;
}

.message-form input:focus,
.message-filter input:focus,
.message-form textarea:focus,
.message-reply-form textarea:focus {
  border-color: rgba(75, 163, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(75, 163, 255, 0.18);
  outline: none;
}

.message-form-status {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.16);
  color: #cfe2f4;
  font-size: 0.84rem;
  margin: 0;
  padding: 10px 12px;
}

.message-form button,
.message-reply-form button {
  background: linear-gradient(135deg, #2fc7a1, #4ba3ff);
  border: 0;
  border-radius: 8px;
  color: #03101c;
  cursor: pointer;
  font-weight: 850;
  min-height: 42px;
  padding: 10px 15px;
}

.message-reply-form button:first-child {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(172, 196, 219, 0.22);
  color: #d9ecff;
}

.message-form button:disabled,
.message-reply-form button:disabled {
  background: rgba(159, 178, 200, 0.18);
  color: #9fb2c8;
  cursor: not-allowed;
}

.message-filter {
  color: #cfe2f4;
  display: grid;
  font-size: 0.82rem;
  font-weight: 850;
  gap: 7px;
  margin: 0 0 14px;
}

.message-filter-tabs {
  background: rgba(5, 14, 24, 0.58);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 14px;
  padding: 6px;
}

.message-filter-tabs button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cfe2f4;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  min-height: 36px;
  padding: 8px 9px;
}

.message-filter-tabs button:hover,
.message-filter-tabs button:focus-visible {
  background: rgba(75, 163, 255, 0.12);
  border-color: rgba(75, 163, 255, 0.34);
  color: #f7fbff;
  outline: none;
}

.message-filter-tabs button.is-active {
  background: linear-gradient(135deg, rgba(47, 199, 161, 0.24), rgba(75, 163, 255, 0.24));
  border-color: rgba(75, 163, 255, 0.5);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  color: #f7fbff;
}

.message-thread-list {
  display: grid;
  gap: 10px;
}

.message-thread-button {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-radius: 8px;
  color: #f7fbff;
  cursor: pointer;
  display: grid;
  gap: 5px;
  padding: 12px;
  text-align: left;
}

.message-thread-button.needs-response {
  background: rgba(244, 201, 93, 0.09);
  border-color: rgba(244, 201, 93, 0.36);
}

.message-thread-button.is-unread {
  box-shadow: inset 4px 0 0 #4ba3ff;
}

.message-thread-button.is-active,
.message-thread-button:focus-visible {
  border-color: rgba(75, 163, 255, 0.76);
  box-shadow: 0 0 0 3px rgba(75, 163, 255, 0.16);
  outline: none;
}

.message-thread-title-row,
.message-detail-badges {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.message-response-badge {
  background: rgba(244, 201, 93, 0.14);
  border: 1px solid rgba(244, 201, 93, 0.34);
  border-radius: 999px;
  color: #ffe3a3;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
  padding: 5px 8px;
}

.message-unread-badge {
  background: rgba(75, 163, 255, 0.14);
  border: 1px solid rgba(75, 163, 255, 0.36);
  border-radius: 999px;
  color: #d9ecff;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
  padding: 5px 8px;
}

.message-age-badge {
  background: rgba(75, 163, 255, 0.12);
  border: 1px solid rgba(75, 163, 255, 0.32);
  border-radius: 999px;
  color: #d9ecff;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
  padding: 5px 8px;
}

.message-age-badge.is-stale {
  background: rgba(255, 122, 110, 0.13);
  border-color: rgba(255, 122, 110, 0.36);
  color: #ffb8b2;
}

.message-audience-badge {
  background: rgba(75, 163, 255, 0.12);
  border: 1px solid rgba(75, 163, 255, 0.32);
  border-radius: 999px;
  color: #d9ecff;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
  padding: 5px 8px;
}

.message-audience-badge[data-audience="tenant"] {
  background: rgba(47, 199, 161, 0.12);
  border-color: rgba(47, 199, 161, 0.32);
  color: #a9f5df;
}

.message-audience-badge[data-audience="team"] {
  background: rgba(244, 201, 93, 0.12);
  border-color: rgba(244, 201, 93, 0.32);
  color: #ffe3a3;
}

.message-property-badge {
  background: rgba(47, 199, 161, 0.12);
  border: 1px solid rgba(47, 199, 161, 0.3);
  border-radius: 999px;
  color: #a9f5df;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 850;
  padding: 5px 8px;
}

.message-thread-button span,
.message-thread-button small {
  color: #9fb2c8;
  line-height: 1.4;
}

.message-empty,
.message-detail-empty {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-radius: 8px;
  color: #9fb2c8;
  font-weight: 750;
  margin: 0;
  padding: 14px;
}

.message-detail {
  display: grid;
  gap: 14px;
}

.message-routing-panel {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 12px;
}

.message-routing-panel div {
  min-width: 0;
}

.message-routing-panel dt {
  color: #9fb2c8;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.message-routing-panel dd {
  color: #f7fbff;
  font-size: 0.86rem;
  font-weight: 800;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.message-response-panel {
  align-items: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 12px;
}

.message-response-panel strong {
  color: #f7fbff;
  font-size: 0.92rem;
}

.message-response-panel span {
  color: #9fb2c8;
  font-size: 0.82rem;
  font-weight: 750;
  text-align: right;
}

.message-response-panel[data-tone="warning"] {
  background: rgba(244, 201, 93, 0.1);
  border-color: rgba(244, 201, 93, 0.3);
}

.message-response-panel[data-tone="stale"] {
  background: rgba(255, 122, 110, 0.11);
  border-color: rgba(255, 122, 110, 0.34);
}

.message-response-panel[data-tone="success"] {
  background: rgba(47, 199, 161, 0.1);
  border-color: rgba(47, 199, 161, 0.3);
}

.message-reply-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.message-reply {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(172, 196, 219, 0.18);
  border-left: 4px solid #4ba3ff;
  border-radius: 8px;
  padding: 12px;
}

.message-reply[data-role="staff"] {
  border-left-color: #2fc7a1;
}

.message-reply-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.message-reply-heading strong {
  color: #f7fbff;
}

.message-reply-heading span,
.message-reply p {
  color: #9fb2c8;
  line-height: 1.45;
  margin: 0;
}

.reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 1060px) {
  .message-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .message-action-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .message-routing-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .message-template-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .messages-layout {
    grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  }

  .message-compose-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .messages-header,
  .message-summary-grid,
  .message-action-list,
  .message-template-list,
  .message-routing-panel,
  .messages-layout,
  .message-thread-heading,
  .message-detail-heading,
  .message-response-panel,
  .message-reply-heading {
    grid-template-columns: 1fr;
  }

  .messages-header,
  .message-action-heading,
  .message-template-heading,
  .message-thread-heading,
  .message-detail-heading,
  .message-response-panel,
  .message-reply-heading {
    flex-direction: column;
  }

  .message-action-heading,
  .message-template-heading {
    align-items: stretch;
  }

  .message-response-panel {
    align-items: flex-start;
  }

  .message-response-panel span {
    text-align: left;
  }
}

@media (max-width: 620px) {
  .messages-shell {
    padding: 22px 14px 42px;
  }

  .message-compose-card,
  .message-thread-card,
  .message-detail-card {
    padding: 16px;
  }

  .reply-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
