:root {
  --ink: #17202a;
  --muted: #6c7785;
  --line: #dde4ec;
  --surface: #ffffff;
  --panel: #f4f7fb;
  --primary: #128c7e;
  --primary-dark: #075e54;
  --accent: #2f6fed;
  --mine: #dff7ea;
  --theirs: #ffffff;
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #e9eef4;
}

.auth-page {
  align-items: center;
  background: #216c94;
  display: flex;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(20, 35, 50, 0.16);
  display: grid;
  gap: 12px;
  max-width: 390px;
  padding: 28px;
  width: 100%;
}
.auth-logo-button {
  align-items: center !important;
  background: #ffffff !important;
  border: 0 !important;
  border-radius: 13px !important;
  box-shadow: 0 12px 28px rgba(20, 35, 50, 0.18) !important;
  cursor: default !important;
  display: inline-flex !important;
  height: 68px !important;
  justify-content: center !important;
  justify-self: center !important;
  margin: 0 auto 8px !important;
  padding: 9px 12px !important;
  position: static !important;
  transform: none !important;
  width: 100px !important;
}

.auth-logo-button img {
  display: block !important;
  height: auto !important;
  max-height: 47px !important;
  max-width: 76px !important;
  object-fit: contain !important;
  width: 76px !important;
}

.auth-card h1,
.auth-card p {
  margin: 0;
}
.auth-card p,
.auth-card a {
  color: var(--muted);
}

.auth-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.alert {
  background: #fff7df;
  border: 1px solid #f1d48a;
  border-radius: 8px;
  color: #755200;
  padding: 10px 12px;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile {
  align-items: center;
  background: var(--primary-dark);
  color: white;
  display: flex;
  gap: 12px;
  padding: 18px;
}

.profile span,
.conversation small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.profile span {
  color: #cce5df;
}

.avatar {
  align-items: center;
  background: var(--primary);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  flex: 0 0 44px;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.avatar.small {
  flex-basis: 36px;
  height: 36px;
  width: 36px;
}

.avatar.group {
  background: var(--accent);
}

.avatar.broadcast {
  background: #8a5cf6;
}

.action-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  padding: 14px;
}

.icon-btn,
.send-btn {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.icon-btn {
  background: #edf6f4;
  color: var(--primary-dark);
  padding: 11px 10px;
}

.icon-btn.accent {
  background: #eef3ff;
  color: var(--accent);
}

.conversation-list {
  overflow-y: auto;
  padding: 6px 0 18px;
}

.conversation-list h3 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  margin: 18px 16px 8px;
  text-transform: uppercase;
}

.conversation {
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 4px solid transparent;
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
}

.conversation > span:nth-child(2) {
  min-width: 0;
}

.unread-badge {
  align-items: center;
  background: #22c55e;
  border-radius: 999px;
  color: white;
  display: none;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  margin-left: auto;
  min-width: 22px;
  padding: 0 7px;
}

.unread-badge.is-visible {
  display: inline-flex;
}

.conversation:hover,
.conversation.is-active {
  background: #f1f8f6;
  border-left-color: var(--primary);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
}

.chat-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 76px;
  padding: 14px 24px;
}

.chat-header p,
.chat-header h1 {
  margin: 0;
}

.chat-header p {
  color: var(--muted);
  font-size: 13px;
}

.chat-header h1 {
  font-size: 22px;
}

.messages {
  background:
    linear-gradient(rgba(244, 247, 251, 0.94), rgba(244, 247, 251, 0.94)),
    repeating-linear-gradient(45deg, #dfe8ef 0 1px, transparent 1px 18px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 22px;
}

.empty-state {
  align-self: center;
  color: var(--muted);
  margin: auto;
  text-align: center;
}

.message {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 35, 50, 0.09);
  max-width: min(680px, 78%);
  padding: 10px 12px 8px;
}

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

.message.theirs {
  align-self: flex-start;
  background: var(--theirs);
}

.message strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.message p {
  margin: 0 0 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message time {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 6px;
  text-align: right;
}

.attachment-link {
  color: var(--primary-dark);
  display: inline-block;
  font-weight: 700;
  margin-top: 4px;
}

.composer {
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 14px 16px;
}
.tool-btn {
  align-items: center;
  background: #eef2f5;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.tool-btn input {
  display: none;
}

.tool-btn.recorded {
  background: #ffe9e9;
  color: #c53030;
}

.composer input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-width: 0;
  padding: 12px 16px;
}

.send-btn {
  background: var(--primary);
  color: white;
  padding: 12px 18px;
}

.send-btn.full {
  width: 100%;
}

.file-preview {
  background: #fbfcfe;
  color: var(--muted);
  font-size: 13px;
  min-height: 28px;
  padding: 0 18px 10px;
}

.modal {
  align-items: center;
  background: rgba(16, 24, 40, 0.46);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.24);
  max-width: 520px;
  padding: 24px;
  position: relative;
  width: 100%;
}

.modal-card h2 {
  margin: 0 0 18px;
}

.modal-card label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.modal-card input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.close-modal {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 28px;
  position: absolute;
  right: 16px;
  top: 12px;
}

.member-grid {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  margin: 16px 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
}

.member-option {
  align-items: center;
  display: flex !important;
  flex-direction: row;
  font-weight: 500 !important;
  gap: 10px !important;
  padding: 8px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: 42vh;
  }

  .chat-panel {
    min-height: 58vh;
  }

  .message {
    max-width: 92%;
  }

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

  .send-btn {
    grid-column: 1 / -1;
  }
}

.video-call-btn-unused {
  align-items: center;
  background: #e8f7ef;
  border: 1px solid #b9e7cc;
  border-radius: 8px;
  color: #087443;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  padding: 10px 14px;
  white-space: nowrap;
}

.select-all-option {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex !important;
  flex-direction: row !important;
  font-weight: 700 !important;
  gap: 10px !important;
  margin-top: 14px;
  padding: 10px 12px;
}

.video-modal {
  z-index: 20;
}

.video-card {
  background: #0f172a;
  border-radius: 8px;
  box-shadow: 0 20px 80px rgba(15, 23, 42, 0.34);
  display: grid;
  grid-template-rows: auto 1fr;
  height: min(760px, 92vh);
  overflow: hidden;
  width: min(1120px, 96vw);
}

.video-card-header {
  align-items: center;
  background: #111827;
  color: white;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
}

.video-card-header p,
.video-card-header h2 {
  margin: 0;
}

.video-card-header p {
  color: #a7b0bf;
  font-size: 13px;
}

.video-card-header .close-modal {
  color: white;
  position: static;
}

#videoCallFrame {
  border: 0;
  height: 100%;
  width: 100%;
}
@media (max-width: 820px) {
  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .video-call-btn-unused {
    justify-content: center;
    width: 100%;
  }

  .video-card {
    height: 94vh;
    width: 96vw;
  }
}
/* Composer final layout fix */
.composer {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.composer .tool-btn {
  flex: 0 0 42px;
}

.composer input[type="text"] {
  flex: 1 1 auto;
  min-width: 180px;
}

.composer .send-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .composer {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .composer input[type="text"] {
    min-width: 90px;
  }

  .composer .tool-btn {
    flex-basis: 40px;
    height: 40px;
    width: 40px;
  }
}

