:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #667085;
  --line: #e4e7ec;
  --green: #0e9f6e;
  --green-dark: #08794f;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app {
  min-height: 100%;
}

.hidden {
  display: none !important;
}

.boot-status {
  position: fixed;
  z-index: 1000;
  top: calc(10px + env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  border: 1px solid #b7e4d0;
  border-radius: 8px;
  background: #ecfdf3;
  color: #064e3b;
  padding: 10px 12px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgb(16 24 40 / 0.12);
}

.boot-status a {
  color: #08794f;
  font-weight: 800;
}

.login {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  max-width: 440px;
  margin: 0 auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

h1,
p {
  margin: 0;
}

.brand h1,
.topbar h1 {
  font-size: 28px;
}

.brand p,
.topbar p {
  color: var(--muted);
  margin-top: 3px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
}

.primary,
.send {
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  padding: 13px 16px;
}

.error {
  min-height: 20px;
  color: var(--danger);
}

.chat {
  display: grid;
  height: 100vh;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar h1 {
  font-size: 22px;
}

.ghost,
.tool {
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  font-weight: 800;
  padding: 9px 10px;
}

.messages {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.message-row {
  display: flex;
}

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

.bubble {
  max-width: min(78%, 560px);
  border-radius: 16px;
  padding: 9px 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.06);
}

.own .bubble {
  background: var(--green);
  color: #fff;
}

.sender {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
}

.body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.time {
  margin-top: 5px;
  color: #7a808a;
  font-size: 11px;
  text-align: right;
}

.own .time {
  color: #ddf7ea;
}

.attachment {
  display: block;
  margin-top: 7px;
  color: inherit;
}

.attachment img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: 10px;
}

.attachment audio {
  max-width: 100%;
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.reaction {
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.76);
  padding: 3px 7px;
}

.other .reaction {
  background: #edf2f7;
}

.reaction-menu {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}

.reaction-menu button {
  border: 0;
  background: transparent;
  padding: 2px;
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: 42px 42px 42px 1fr auto;
  gap: 7px;
  align-items: end;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.tool {
  height: 42px;
  padding: 0;
}

textarea {
  min-height: 42px;
  max-height: 124px;
  resize: none;
  border-radius: 18px;
  background: var(--bg);
}

.send {
  min-height: 42px;
  border-radius: 18px;
}

.emoji-panel {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 74px;
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgb(16 24 40 / 0.16);
}

.emoji-panel button {
  border: 0;
  background: #f2f4f7;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 20px;
}

@media (max-width: 520px) {
  .ghost {
    max-width: 125px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .composer {
    grid-template-columns: 36px 36px 36px 1fr 60px;
  }
}
