:root {
  --bg-1: #f7f1e6;
  --bg-2: #e9dfcf;
  --card: rgba(255, 251, 244, 0.92);
  --line: rgba(91, 78, 57, 0.18);
  --text: #1f241f;
  --muted: #687267;
  --accent: #17624b;
  --accent-soft: #dceee6;
  --danger: #a93b2f;
  --panel-shadow: 0 24px 70px rgba(35, 33, 26, 0.08);
  --bubble-self: #dff4e4;
  --bubble-other: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(23, 98, 75, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(174, 79, 36, 0.12), transparent 30%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

.page-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.topbar h1,
.info-card h2,
.panel-head h2,
.section-head h3 {
  margin: 6px 0 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--muted);
}

.lede {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

a.ghost {
  padding: 8px 12px;
  border-radius: 12px;
}

button.secondary,
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-card,
.user-panel,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--panel-shadow);
}

.info-card {
  padding: 18px 20px;
}

.info-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.simulator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.user-panel {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.panel-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

.status-pill.offline {
  background: #f2e1db;
  color: var(--danger);
}

.identity-card,
.card {
  padding: 16px;
}

.identity-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
}

.split-column {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  min-height: 620px;
}

.chat-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

.group-list,
.messages {
  display: grid;
  gap: 12px;
  align-content: start;
}

.group-list {
  max-height: 540px;
  overflow: auto;
}

.group-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.group-card.active {
  border-color: var(--accent);
  background: #eef8f3;
}

.group-card h4,
.group-card p {
  margin: 0;
}

.group-card p {
  margin-top: 6px;
  color: var(--muted);
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
}

.typing-indicator {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 13px;
  font-style: italic;
}

.messages {
  min-height: 420px;
  max-height: 420px;
  overflow: auto;
  padding-right: 6px;
}

.message-row {
  display: flex;
}

.message-row.mine {
  justify-content: flex-end;
}

.bubble {
  max-width: min(80%, 460px);
  border-radius: 22px;
  padding: 14px 16px;
  background: var(--bubble-other);
  box-shadow: 0 14px 36px rgba(28, 28, 28, 0.06);
}

.message-row.mine .bubble {
  background: var(--bubble-self);
}

.bubble.deleted {
  color: var(--muted);
  font-style: italic;
}

.bubble-top,
.bubble-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.bubble p {
  margin: 10px 0;
  white-space: pre-wrap;
}

.stamp {
  font-size: 12px;
  color: var(--muted);
}

.message-actions {
  display: flex;
  gap: 8px;
}

.message-actions button {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.compact-btn {
  font-size: 12px;
  height: auto;
  padding: 6px 10px;
}

.message-actions .delete-btn {
  background: var(--danger);
}

.composer {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}

.composer .reply-banner,
.composer .composer-tools {
  grid-column: 1 / -1;
}

.reply-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(23, 98, 75, 0.08);
}

.reply-banner p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.composer-tools {
  display: flex;
  justify-content: flex-start;
}

.hidden {
  display: none;
}

.reply-chip {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: rgba(23, 98, 75, 0.08);
  border-radius: 12px;
}

.reply-chip strong,
.mention-list strong {
  display: block;
  font-size: 12px;
  color: var(--accent);
}

.reply-chip span,
.mention-list span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.mention-list {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.attachment-preview {
  margin: 8px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.attachment-clickable {
  position: relative;
  cursor: pointer;
}

.attachment-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(23, 98, 75, 0.9);
  color: white;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.attachment-actions {
  display: flex;
  gap: 8px;
  margin: 6px 0 10px;
}

.attachment-preview img,
.attachment-preview video {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.file-attachment {
  margin: 8px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  font-size: 13px;
}

.file-attachment a {
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}

.attachment-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 40;
}

.attachment-modal.hidden {
  display: none;
}

.attachment-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 24, 20, 0.5);
}

.attachment-modal-card {
  position: relative;
  z-index: 1;
  width: min(86vw, 780px);
  max-height: 86vh;
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--panel-shadow);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.attachment-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.attachment-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-modal-actions a {
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 12px;
}

.attachment-modal-body {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  max-height: 60vh;
  overflow: auto;
}

.attachment-modal-body img,
.attachment-modal-body video {
  max-width: 100%;
  display: block;
}

.attachment-file-preview {
  display: grid;
  gap: 10px;
  font-size: 14px;
}

.empty-state {
  color: var(--muted);
  padding: 10px 2px;
}

@media (max-width: 1240px) {
  .simulator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
  }

  .info-strip {
    grid-template-columns: 1fr;
  }

  .split-column {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .messages {
    max-height: 320px;
    min-height: 320px;
  }
}
