* {
  box-sizing: border-box;
}

:root {
  --bg: #080b0f;
  --bg2: #0d1117;
  --panel: #11161d;
  --panel2: #171d26;
  --panel3: #1d2530;
  --border: #252d38;
  --border2: #303946;
  --text: #f4f6f8;
  --muted: #8f9aa8;
  --blue: #2f80ed;
  --green: #23d875;
  --red: #e5384f;

  --header-height: 56px;
  --toolbar-height: 78px;
  --sidebar-width: 340px;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;

  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    "Segoe UI",
    Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* =========================
   HEADER
========================= */

#appHeader {
  height: var(--header-height);

  display: flex;
  align-items: center;

  gap: 16px;
  padding: 0 20px;

  background: #090d12;
  border-bottom: 1px solid var(--border);

  user-select: none;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .7px;

  white-space: nowrap;
}

.header-divider {
  width: 1px;
  height: 24px;

  background: #39414b;
}

.meeting-title {
  max-width: 400px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 15px;
}

.meeting-info {
  width: 24px;
  height: 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #4b5563;
  color: #111;

  font-size: 14px;
  font-weight: bold;
}

.meeting-time {
  color: #c4cad2;

  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.header-spacer {
  flex: 1;
}

.signal {
  padding-right: 5px;

  color: var(--green);

  font-size: 19px;
  letter-spacing: -5px;
}

.header-button {
  height: 36px;

  padding: 0 12px;

  border: 1px solid var(--border2);
  border-radius: 8px;

  background: var(--panel2);
  color: white;
}

.header-button:hover {
  background: var(--panel3);
}

.icon-button {
  width: 38px;
  padding: 0;

  font-size: 18px;
}

/* =========================
   HOME
========================= */

#home {
  height: calc(100vh - var(--header-height));

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background:
    radial-gradient(
      circle at 30% 20%,
      #152231 0,
      transparent 35%
    ),
    var(--bg);
}

.home-card {
  width: min(680px, 100%);

  padding: 46px;

  border: 1px solid var(--border);
  border-radius: 18px;

  background: rgba(17, 22, 29, .96);

  box-shadow:
    0 30px 100px rgba(0, 0, 0, .45);
}

.home-card h1 {
  margin: 0 0 12px;

  font-size: 34px;
}

.home-card p {
  margin: 0 0 28px;

  color: var(--muted);

  line-height: 1.6;
}

.primary-button {
  padding: 13px 20px;

  border: 0;
  border-radius: 9px;

  background: var(--blue);
  color: white;

  font-weight: 600;
}

.primary-button:hover {
  filter: brightness(1.1);
}

.created-room {
  margin-top: 28px;
  padding-top: 24px;

  border-top: 1px solid var(--border);
}

.created-title {
  margin-bottom: 12px;

  font-weight: 600;
}

.link-row {
  display: flex;

  gap: 8px;
  margin-bottom: 12px;
}

.link-row input {
  min-width: 0;
  flex: 1;

  padding: 12px;

  border: 1px solid var(--border2);
  border-radius: 8px;

  background: #090d12;
  color: white;
}

.secondary-button {
  padding: 0 15px;

  border: 1px solid var(--border2);
  border-radius: 8px;

  background: var(--panel2);
  color: white;
}

.secondary-button:hover {
  background: var(--panel3);
}

/* =========================
   PREJOIN
========================= */

#join {
  height: calc(100vh - var(--header-height));

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px;
}

.prejoin {
  width: min(1050px, 100%);

  display: grid;
  grid-template-columns:
    minmax(0, 1.55fr)
    minmax(280px, .75fr);

  gap: 32px;
}

.preview {
  position: relative;

  aspect-ratio: 16 / 9;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 15px;

  background: #030507;
}

#previewVideo {
  width: 100%;
  height: 100%;

  object-fit: cover;

  transform: scaleX(-1);
}

.preview-avatar {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #242b35;

  font-size: 72px;
  font-weight: 600;
}

.preview-controls {
  position: absolute;

  left: 50%;
  bottom: 20px;

  display: flex;
  gap: 12px;

  transform: translateX(-50%);
}

.preview-round {
  width: 50px;
  height: 50px;

  border: 0;
  border-radius: 50%;

  background: #343b46;
  color: white;

  font-size: 20px;

  box-shadow:
    0 4px 15px rgba(0, 0, 0, .35);
}

.preview-round:hover {
  background: #414a57;
}

.preview-round.off {
  background: var(--red);
}

.join-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.join-panel h2 {
  margin: 0 0 8px;

  font-size: 27px;
}

.join-panel p {
  color: var(--muted);

  line-height: 1.5;
}

.join-panel input {
  width: 100%;

  margin: 18px 0 8px;
  padding: 13px 14px;

  border: 1px solid var(--border2);
  border-radius: 8px;

  outline: none;

  background: #0b0f14;
  color: white;
}

.join-panel input:focus {
  border-color: var(--blue);
}

.error {
  min-height: 22px;

  margin: 4px 0 10px !important;

  color: #ff6677 !important;
}

/* =========================
   CONFERENCE
========================= */

#conference {
  position: relative;

  display: none;

  height: calc(
    100vh - var(--header-height)
  );

  background: var(--bg);
}

.workspace {
  position: absolute;

  left: 0;
  right: 0;
  top: 0;
  bottom: var(--toolbar-height);

  display: flex;

  min-height: 0;
}

.stage {
  flex: 1;

  min-width: 0;
  min-height: 0;

  padding: 10px;

  overflow: hidden;
}

/* =========================
   VIDEO GRID
========================= */

#videos {
  width: 100%;
  height: 100%;

  display: grid;

  gap: 7px;

  align-content: center;
  justify-content: center;
}

#videos.count-1 {
  grid-template-columns:
    minmax(320px, 1000px);

  grid-template-rows:
    minmax(0, 1fr);
}

#videos.count-2 {
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  grid-template-rows:
    minmax(0, 1fr);
}

#videos.count-3,
#videos.count-4 {
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  grid-template-rows:
    repeat(2, minmax(0, 1fr));
}

#videos.count-many {
  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  grid-auto-rows:
    minmax(0, 1fr);
}

/* =========================
   PARTICIPANT TILE
========================= */

.participant {
  position: relative;

  min-width: 0;
  min-height: 0;

  overflow: hidden;

  border: 2px solid transparent;
  border-radius: 8px;

  background: #20262f;

  transition:
    border-color .15s,
    box-shadow .15s;
}

.participant.speaking {
  border-color: var(--green);

  box-shadow:
    0 0 0 1px
    rgba(35, 216, 117, .25);
}

.participant video {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  background: #050607;
}

.participant.local video.camera {
  transform: scaleX(-1);
}

.avatar {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-circle {
  width: 105px;
  height: 105px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #394352;
  color: #d7dce3;

  font-size: 38px;
  font-weight: 500;
}

.participant.has-camera .avatar {
  display: none;
}

.tile-name {
  position: absolute;

  left: 8px;
  bottom: 8px;

  z-index: 8;

  max-width: calc(100% - 60px);

  display: flex;
  align-items: center;

  gap: 6px;

  padding: 5px 8px;

  overflow: hidden;

  border-radius: 5px;

  background: rgba(5, 8, 12, .78);

  font-size: 13px;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.tile-person-name {
  overflow: hidden;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.tile-mic {
  flex: none;

  color: var(--green);
}

.tile-mic.muted {
  color: #ff3e59;
}

.tile-menu {
  position: absolute;

  right: 8px;
  top: 8px;

  z-index: 8;

  width: 34px;
  height: 34px;

  border: 0;
  border-radius: 6px;

  background: rgba(7, 10, 14, .68);
  color: white;

  font-size: 20px;
}

.tile-menu:hover {
  background: rgba(30, 37, 47, .95);
}

/* =========================
   SCREEN SHARE
========================= */

#shareStage {
  display: none;

  width: 100%;
  height: 100%;

  min-width: 0;
  min-height: 0;

  gap: 8px;
}

#conference.sharing #videos {
  display: none;
}

#conference.sharing #shareStage {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr) 180px;
}

.share-main {
  position: relative;

  min-width: 0;
  min-height: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  border: 2px solid var(--green);
  border-radius: 8px;

  background: #000;
}

.share-main video {
  width: 100%;
  height: 100%;

  object-fit: contain;

  background: #000;
}

.share-title {
  position: absolute;

  left: 12px;
  top: 10px;

  z-index: 10;

  max-width: calc(100% - 24px);

  padding: 6px 10px;

  overflow: hidden;

  border-radius: 5px;

  background: rgba(0, 0, 0, .72);
  color: white;

  font-size: 13px;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.share-filmstrip {
  min-height: 0;

  display: flex;
  flex-direction: column;

  gap: 7px;

  overflow-x: hidden;
  overflow-y: auto;
}

.share-filmstrip .participant {
  flex: 0 0 112px;

  min-height: 112px;
}

.share-filmstrip .avatar-circle {
  width: 58px;
  height: 58px;

  font-size: 21px;
}

.share-filmstrip .tile-name {
  left: 5px;
  right: 5px;
  bottom: 5px;

  max-width: none;

  padding: 4px 6px;

  font-size: 11px;
}

.share-filmstrip .tile-menu {
  display: none;
}

/* =========================
   PARTICIPANTS SIDEBAR
========================= */

#participantsPanel {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);

  display: flex;
  flex-direction: column;

  margin:
    0
    8px
    8px
    0;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--panel);
}

.sidebar-header {
  height: 52px;
  flex: none;

  display: flex;
  align-items: center;

  padding: 0 16px;

  border-bottom: 1px solid var(--border);

  font-weight: 600;
}

.sidebar-header > span:first-child {
  flex: 1;
}

.sidebar-close {
  width: 32px;
  height: 32px;

  border: 0;
  border-radius: 6px;

  background: transparent;
  color: #d8dde4;

  font-size: 24px;
}

.sidebar-close:hover {
  background: var(--panel3);
}

.search-box {
  position: relative;

  flex: none;

  margin: 12px 14px;
}

.search-box input {
  width: 100%;
  height: 42px;

  padding:
    0
    12px
    0
    36px;

  border: 1px solid var(--border2);
  border-radius: 7px;

  outline: none;

  background: #111720;
  color: white;
}

.search-box input:focus {
  border-color: var(--blue);
}

.search-icon {
  position: absolute;

  left: 12px;
  top: 10px;

  z-index: 2;

  color: var(--muted);

  font-size: 18px;

  pointer-events: none;
}

#participantList {
  flex: 1;

  min-height: 0;

  overflow-y: auto;

  padding: 2px 10px;
}

.list-participant {
  min-height: 54px;

  display: flex;
  align-items: center;

  gap: 10px;

  padding: 6px 5px;

  border-radius: 7px;
}

.list-participant:hover {
  background: #171e27;
}

.list-avatar {
  width: 38px;
  height: 38px;

  flex: none;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #317dc8;
  color: white;

  font-size: 14px;
  font-weight: 600;
}

.list-name {
  flex: 1;

  min-width: 0;

  overflow: hidden;

  font-size: 14px;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.list-state {
  flex: none;

  display: flex;

  gap: 10px;

  font-size: 16px;
}

.state-on {
  color: var(--green);
}

.state-off {
  color: #e93d55;
}

.sidebar-actions {
  flex: none;

  display: grid;

  grid-template-columns:
    1fr 1fr;

  gap: 7px;

  padding: 12px;

  border-top: 1px solid var(--border);
}

.sidebar-action {
  height: 42px;

  border: 1px solid var(--border2);
  border-radius: 7px;

  background: #1a212b;
  color: white;
}

.sidebar-action:hover {
  background: #232c38;
}

/* =========================
   SCROLLBARS
========================= */

#participantList,
.share-filmstrip {
  scrollbar-width: thin;

  scrollbar-color:
    #3b4654
    transparent;
}

#participantList::-webkit-scrollbar,
.share-filmstrip::-webkit-scrollbar {
  width: 7px;
}

#participantList::-webkit-scrollbar-track,
.share-filmstrip::-webkit-scrollbar-track {
  background: transparent;
}

#participantList::-webkit-scrollbar-thumb,
.share-filmstrip::-webkit-scrollbar-thumb {
  border-radius: 10px;

  background: #3b4654;
}

/* =========================
   BOTTOM TOOLBAR
========================= */

#toolbar {
  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: var(--toolbar-height);

  display: flex;
  align-items: center;

  gap: 4px;

  padding: 0 18px;

  border-top: 1px solid var(--border);

  background: #11161c;
}

.toolbar-main {
  height: 100%;

  flex: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 2px;
}

.tool {
  min-width: 92px;
  height: 64px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 5px;

  border: 0;
  border-radius: 8px;

  background: transparent;
  color: #f2f4f7;
}

.tool:hover {
  background: #1c232c;
}

.tool-icon {
  font-size: 23px;
  line-height: 24px;
}

.tool-label {
  font-size: 12px;
}

.tool.off .tool-icon {
  color: #ff4057;
}

.tool.active {
  background: #202833;
}

.tool.active .tool-icon {
  color: var(--green);
}

.toolbar-separator {
  width: 1px;
  height: 40px;

  margin: 0 8px;

  background: #39414b;
}

.leave-button {
  flex: none;

  min-width: 126px;
  height: 48px;

  border: 0;
  border-radius: 8px;

  background: var(--red);
  color: white;

  font-size: 14px;
  font-weight: 600;
}

.leave-button:hover {
  filter: brightness(1.1);
}

/* =========================
   TOAST
========================= */

#toast {
  position: fixed;

  z-index: 1000;

  left: 50%;
  bottom: 92px;

  transform: translateX(-50%);

  padding: 10px 18px;

  border: 1px solid var(--border2);
  border-radius: 7px;

  background: #1c232c;

  box-shadow:
    0 10px 30px rgba(0, 0, 0, .35);

  font-size: 14px;
}

/* =========================
   FULLSCREEN
========================= */

:fullscreen #appHeader {
  display: none;
}

:fullscreen #conference {
  height: 100vh;
}

:fullscreen #conference.sharing .workspace {
  top: 0;
}

:fullscreen #conference.sharing .share-main {
  border-radius: 0;
}

.share-main:fullscreen {
  width: 100vw;
  height: 100vh;

  border: 0;
  border-radius: 0;

  background: #000;
}

.share-main:fullscreen video {
  width: 100vw;
  height: 100vh;

  object-fit: contain;
}

/* =========================
   TABLET / NOTEBOOK
========================= */

@media (max-width: 1200px) {

  :root {
    --sidebar-width: 300px;
  }

  .tool {
    min-width: 76px;
  }

  #conference.sharing #shareStage {
    grid-template-columns:
      minmax(0, 1fr) 150px;
  }

  .share-filmstrip .participant {
    flex-basis: 100px;
    min-height: 100px;
  }
}

@media (max-width: 1000px) {

  :root {
    --sidebar-width: 280px;
  }

  .tool {
    min-width: 64px;
  }

  .tool-label {
    font-size: 11px;
  }

  .meeting-title {
    max-width: 220px;
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 760px) {

  :root {
    --header-height: 50px;
    --toolbar-height: 68px;
  }

  #appHeader {
    padding: 0 12px;
  }

  .logo {
    font-size: 18px;
  }

  .meeting-title,
  .meeting-info,
  .meeting-time,
  .signal,
  #layoutButton,
  #settingsButton {
    display: none;
  }

  #home {
    padding: 16px;
  }

  .home-card {
    padding: 28px;
  }

  .home-card h1 {
    font-size: 27px;
  }

  .prejoin {
    grid-template-columns: 1fr;

    gap: 20px;
  }

  #join {
    padding: 15px;

    overflow-y: auto;
  }

  .join-panel {
    text-align: center;
  }

  .workspace {
    position: absolute;
  }

  #participantsPanel {
    position: absolute;

    z-index: 50;

    right: 0;
    top: 0;
    bottom: 0;

    width: min(92vw, 340px);

    margin: 0;

    border-radius: 0;

    box-shadow:
      -20px 0 50px
      rgba(0, 0, 0, .45);
  }

  #videos.count-2,
  #videos.count-3,
  #videos.count-4,
  #videos.count-many {
    grid-template-columns: 1fr;

    grid-auto-rows:
      minmax(230px, 1fr);

    align-content: start;

    overflow-y: auto;
  }

  #conference.sharing #shareStage {
    grid-template-columns: 1fr;

    grid-template-rows:
      minmax(0, 1fr)
      105px;
  }

  .share-filmstrip {
    flex-direction: row;

    overflow-x: auto;
    overflow-y: hidden;
  }

  .share-filmstrip .participant {
    flex:
      0
      0
      150px;

    min-height: 96px;
  }

  #toolbar {
    padding: 0 6px;
  }

  .toolbar-main {
    justify-content: space-around;
  }

  .tool {
    width: 48px;
    min-width: 48px;
  }

  .tool-label {
    display: none;
  }

  .toolbar-separator {
    display: none;
  }

  #chatButton,
  #reactionButton,
  #moreButton {
    display: none;
  }

  .leave-button {
    width: 58px;
    min-width: 58px;

    font-size: 0;
  }

  .leave-button::after {
    content: "☎";

    font-size: 23px;
  }
}

/* =========================
   VERY SMALL MOBILE
========================= */

@media (max-width: 430px) {

  .stage {
    padding: 5px;
  }

  #videos {
    gap: 5px;
  }

  .participant {
    border-radius: 6px;
  }

  .avatar-circle {
    width: 78px;
    height: 78px;

    font-size: 29px;
  }

  .tool {
    width: 44px;
    min-width: 44px;
  }

  .leave-button {
    width: 52px;
    min-width: 52px;
  }
}

/* =========================
   BRAND LOGO
========================= */

.logo {
  display: flex;
  align-items: center;
  flex: none;
}

.logo img {
  display: block;
  width: auto;
  height: 38px;
  max-width: 260px;
  object-fit: contain;
}

/* =========================================================
   CORPORATE BRAND
========================================================= */

@font-face {
  font-family: 'Lato';
  src: url('/fonts/Lato-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Lato';
  src: url('/fonts/Lato-Black.ttf') format('truetype');
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

:root {
  --blue: #006e78;
  --green: #6dcdcf;

  --brand-primary: #006e78;
  --brand-accent: #6dcdcf;
}

html,
body,
button,
input,
textarea,
select {
  font-family: 'Lato', Arial, sans-serif;
}

body {
  font-weight: 400;
}

h1,
h2,
h3,
.logo,
.primary-button,
.leave-button {
  font-weight: 900;
}

/* Header logo */

.logo img {
  width: auto;
  height: 38px;
  max-width: 270px;
}

/* Home logo */

.home-logo {
  display: flex;
  align-items: center;

  margin-bottom: 18px;
}

.home-logo img {
  display: block;

  width: auto;
  height: 54px;
  max-width: 360px;
}

/* Main corporate buttons */

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

.primary-button:hover {
  border-color: var(--brand-accent);
  background: var(--brand-accent);
  color: #071416;
}

.primary-button:active {
  background: #58babc;
}

/* Secondary buttons */

.secondary-button:hover,
.sidebar-action:hover {
  border-color: var(--brand-accent);
}

/* Focus */

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-accent) !important;
  outline: none;
}

/* Active controls */

.tool.active .tool-icon {
  color: var(--brand-accent);
}

/* Active speaker */

.participant.speaking {
  border-color: var(--brand-accent);
}

/* Screen share */

.share-main {
  border-color: var(--brand-accent);
}

/* Online indicator */

.signal {
  color: var(--brand-accent);
}

/* Mobile home logo */

@media (max-width: 760px) {
  .home-logo img {
    height: 42px;
    max-width: 280px;
  }

  .logo img {
    height: 32px;
    max-width: 220px;
  }
}

/* =========================================================
   LATO CORPORATE FONT
========================================================= */

@font-face {
  font-family: 'Lato';
  src: url('/fonts/Lato-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Lato';
  src: url('/fonts/Lato-Black.ttf') format('truetype');
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

/* Весь интерфейс */

html,
body,
button,
input,
textarea,
select {
  font-family: 'Lato', Arial, sans-serif !important;
}

body {
  font-weight: 400;
}

/* Обычный текст интерфейса */

.meeting-title,
.meeting-info,
.meeting-time,
.tile-person-name,
.tile-name,
.list-name,
.tool-label,
.share-title,
.sidebar-header,
.search-box input,
.join-panel,
.home-card {
  font-family: 'Lato', Arial, sans-serif;
  font-weight: 400;
}

/* Акцентные элементы */

h1,
h2,
h3,
.primary-button,
.leave-button,
.logo {
  font-family: 'Lato', Arial, sans-serif;
  font-weight: 900;
}

.signal,
.meeting-time {
  font-family: 'Lato', Arial, sans-serif !important;
  font-weight: 400 !important;
}

/* =========================================================
   LIVEKIT CHAT
========================================================= */

#chatPanel {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  display: flex;
  flex-direction: column;
  margin: 0 8px 8px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
}

#chatPanel.hidden {
  display: none;
}

#chatMessages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: #3b4654 transparent;
}

.chat-empty {
  margin: auto;
  color: var(--muted);
  font-family: 'Lato', Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
}

/* Сообщение */

.chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.chat-message.own {
  align-items: flex-end;
}

.chat-message-header {
  max-width: 88%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 3px;
  font-family: 'Lato', Arial, sans-serif;
  font-size: 11px;
}

.chat-message-name {
  overflow: hidden;
  color: #dce2e8;
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-message-time {
  flex: none;
  color: var(--muted);
  font-weight: 400;
}

.chat-message-body {
  max-width: 88%;
  padding: 9px 11px;
  border: 1px solid var(--border2);
  border-radius: 5px 12px 12px 12px;
  background: #171e27;
  color: #f4f6f8;
  font-family: 'Lato', Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Собственные сообщения */

.chat-message.own .chat-message-body {
  border-color: #006e78;
  border-radius: 12px 5px 12px 12px;
  background: #006e78;
  color: #fff;
}

/* Поле ввода */

.chat-compose {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

#chatInput {
  min-width: 0;
  min-height: 42px;
  max-height: 120px;
  flex: 1;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  outline: none;
  background: #111720;
  color: #fff;
  font-family: 'Lato', Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

#chatInput:focus {
  border-color: #6dcdcf;
}

#chatInput::placeholder {
  color: var(--muted);
}

/* Кнопка отправки */

#chatSend {
  width: 42px;
  height: 42px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: #006e78;
  color: #fff;
  font-family: 'Lato', Arial, sans-serif;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

#chatSend:hover {
  background: #6dcdcf;
  color: #071416;
}

/* Счётчик непрочитанных */

#chatButton {
  position: relative;
}

.chat-unread {
  position: absolute;
  top: 5px;
  right: 13px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #11161c;
  border-radius: 10px;
  background: #6dcdcf;
  color: #071416;
  font-family: 'Lato', Arial, sans-serif;
  font-size: 10px;
  font-weight: 900;
  line-height: 14px;
}

/* Scrollbar */

#chatMessages::-webkit-scrollbar {
  width: 7px;
}

#chatMessages::-webkit-scrollbar-track {
  background: transparent;
}

#chatMessages::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #3b4654;
}

/* Мобильный интерфейс */

@media (max-width: 760px) {
  #chatPanel {
    position: absolute;
    z-index: 51;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(92vw, 340px);
    margin: 0;
    border-radius: 0;
    box-shadow: -20px 0 50px rgba(0, 0, 0, .45);
  }

  .chat-unread {
    top: 3px;
    right: 1px;
  }
}



/* =========================================================
   MOBILE CONFERENCE LAYOUT FIX
========================================================= */

@media (max-width: 760px) {

  :root {
    --header-height: 50px;
    --toolbar-height: 66px;
  }


  /* -----------------------------------------
     Conference занимает только видимый экран
  ----------------------------------------- */

  #conference {
    height: calc(
      100dvh - var(--header-height)
    );

    min-height: 0;

    overflow: hidden;
  }


  /* -----------------------------------------
     Видео заканчивается перед toolbar
  ----------------------------------------- */

  .workspace {
    position: absolute;

    left: 0;
    right: 0;
    top: 0;

    bottom: calc(
      var(--toolbar-height) +
      env(safe-area-inset-bottom, 0px)
    );

    min-width: 0;
    min-height: 0;

    overflow: hidden;
  }


  .stage {
    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    padding: 5px;

    overflow: hidden;
  }


  /* -----------------------------------------
     Video grid
  ----------------------------------------- */

  #videos {
    width: 100%;
    height: 100%;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    gap: 5px;
  }


  /*
   * Один участник:
   * камера не может выйти за область stage.
   */

  #videos.count-1 {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);

    align-content: stretch;
  }


  #videos.count-1 .participant {
    min-height: 0;
    height: 100%;
  }


  /*
   * Несколько участников:
   * вертикальная прокрутка.
   */

  #videos.count-2,
  #videos.count-3,
  #videos.count-4,
  #videos.count-many {
    grid-template-columns: 1fr;

    grid-auto-rows:
      minmax(180px, 1fr);

    align-content: start;

    overflow-y: auto;
  }


  .participant {
    min-width: 0;
    overflow: hidden;
  }


  .participant video {
    width: 100%;
    height: 100%;

    object-fit: cover;
  }


  /* -----------------------------------------
     Bottom toolbar всегда видим
  ----------------------------------------- */

  #toolbar {
    position: absolute;

    z-index: 60;

    left: 0;
    right: 0;
    bottom: 0;

    height: calc(
      var(--toolbar-height) +
      env(safe-area-inset-bottom, 0px)
    );

    min-height: 0;

    display: flex;
    align-items: flex-start;

    gap: 0;

    padding:
      0
      4px
      env(safe-area-inset-bottom, 0px);

    border-top: 1px solid var(--border);

    background: #11161c;
  }


  .toolbar-main {
    height: var(--toolbar-height);

    min-width: 0;

    flex: 1;

    display: flex;
    align-items: center;
    justify-content: space-evenly;

    gap: 0;

    overflow: visible;
  }


  /* -----------------------------------------
     Mobile buttons
  ----------------------------------------- */

  .tool {
    width: auto;
    min-width: 0;
    height: 58px;

    flex: 1 1 0;

    padding: 0 2px;

    gap: 0;

    border-radius: 7px;
  }


  .tool-icon {
    font-size: 21px;
    line-height: 24px;
  }


  /*
   * Подписи на маленьком экране скрываем.
   * Иконки остаются.
   */

  .tool-label {
    display: none;
  }


  .toolbar-separator {
    display: none;
  }


  /* Чат и "Ещё" теперь показываем */

  #chatButton,
  #moreButton {
    display: flex;
  }


  /*
   * Реакции пока убираем —
   * экономим одно место.
   */

  #reactionButton {
    display: none;
  }


  /* -----------------------------------------
     Leave
  ----------------------------------------- */

  .leave-button {
    width: 48px;
    min-width: 48px;
    height: 48px;

    align-self: center;

    margin: 0 2px;

    padding: 0;

    font-size: 0;

    border-radius: 8px;
  }


  .leave-button::after {
    content: "☎";

    font-size: 21px;
    line-height: 1;
  }


  /* -----------------------------------------
     Participants sidebar
     Не перекрывает toolbar
  ----------------------------------------- */

  #participantsPanel {
    position: absolute;

    z-index: 55;

    right: 0;
    top: 0;
    bottom: 0;

    width: min(92vw, 340px);
    height: auto;

    margin: 0;

    border-radius: 0;

    box-shadow:
      -20px 0 50px
      rgba(0, 0, 0, .45);
  }


  /* -----------------------------------------
     Chat sidebar
     Также заканчивается перед toolbar
  ----------------------------------------- */

  #chatPanel {
    position: absolute;

    z-index: 56;

    right: 0;
    top: 0;
    bottom: 0;

    width: min(92vw, 340px);
    height: auto;

    margin: 0;

    border-radius: 0;

    box-shadow:
      -20px 0 50px
      rgba(0, 0, 0, .45);
  }


  /* Badge чата */

  .chat-unread {
    top: 3px;
    right: 2px;
  }


  /* -----------------------------------------
     Screen sharing
  ----------------------------------------- */

  #conference.sharing #shareStage {
    height: 100%;
    min-height: 0;

    grid-template-columns: 1fr;

    grid-template-rows:
      minmax(0, 1fr)
      96px;
  }


  .share-main {
    min-height: 0;
  }


  .share-filmstrip {
    min-height: 0;

    flex-direction: row;

    overflow-x: auto;
    overflow-y: hidden;
  }

}


/* =========================================================
   VERY SMALL PHONES
========================================================= */

@media (max-width: 430px) {

  :root {
    --toolbar-height: 62px;
  }


  #toolbar {
    padding-left: 2px;
    padding-right: 2px;
  }


  .tool {
    height: 54px;

    padding: 0 1px;
  }


  .tool-icon {
    font-size: 19px;
  }


  .leave-button {
    width: 44px;
    min-width: 44px;
    height: 44px;

    margin-left: 1px;
    margin-right: 1px;
  }


  .leave-button::after {
    font-size: 20px;
  }

}

