:root {
  color-scheme: light;
  --bg: #eef2f3;
  --panel: #ffffff;
  --panel-soft: #f7faf9;
  --text: #142125;
  --muted: #67777d;
  --line: #d8e1e3;
  --accent: #0f766e;
  --accent-strong: #0b5d56;
  --bubble-in: #ffffff;
  --bubble-out: #dff5ef;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(24, 41, 47, 0.15);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.ghost {
  color: var(--text);
  border: 1px solid var(--line);
  background: #fff;
}

button.ghost:hover {
  background: #f1f5f5;
}

button.danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

input {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  font-weight: 750;
  letter-spacing: 0;
}

h1 {
  margin: 8px 0 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.sidebar-head,
.chat-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.self {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9aa8ad;
}

.status-dot.online {
  background: #14845f;
}

.vault {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.vault-title {
  font-weight: 700;
}

.vault-subtitle,
.section-title,
.fingerprint,
.call-subtitle,
.meta {
  color: var(--muted);
  font-size: 12px;
}

.section-title {
  padding: 14px 18px 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.peer-list {
  overflow: auto;
  padding: 0 10px 14px;
}

.peer {
  width: 100%;
  height: auto;
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.peer:hover,
.peer.active {
  background: #e9f3f1;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #315b6b;
  font-weight: 750;
}

.peer-lines {
  min-width: 0;
}

.peer-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.peer-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.chat {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #f3f6f7;
}

.peer-name {
  font-size: 18px;
  font-weight: 750;
}

.head-actions,
.call-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.call-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff7ed;
}

.call-title {
  font-weight: 750;
}

.messages {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
}

.empty {
  margin: auto;
  color: var(--muted);
}

.message {
  max-width: min(680px, 78%);
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bubble-in);
  box-shadow: 0 4px 18px rgba(19, 33, 37, 0.05);
}

.message.out {
  align-self: flex-end;
  background: var(--bubble-out);
}

.message.in {
  align-self: flex-start;
}

.text {
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 240px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
}

.file-card a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.composer {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.tool {
  color: var(--text);
  border: 1px solid var(--line);
  background: #eef4f4;
}

.recording {
  background: #ffe4e6 !important;
  color: #9f1239 !important;
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 260px minmax(0, 1fr);
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .composer {
    grid-template-columns: auto auto 1fr;
  }

  #sendButton {
    grid-column: 1 / -1;
  }

  .message {
    max-width: 92%;
  }
}
