:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f9;
  color: #111827;
  --line: #d9e0ea;
  --muted: #5b6778;
  --panel: #ffffff;
  --primary: #155eef;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button,
.link-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

button:hover,
.link-button:hover {
  border-color: #9fb2cc;
  background: #f8fafc;
}

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

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

.disabled {
  pointer-events: none;
  opacity: 0.55;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topbar h1,
.topbar p,
.panel-block h2,
.chat-panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 20px;
  line-height: 1.2;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  min-width: 118px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 7px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.status[data-tone="ok"] {
  background: #e7f8ee;
  border-color: #abefc6;
  color: #067647;
}

.status[data-tone="busy"] {
  background: #eff8ff;
  border-color: #b2ddff;
  color: #175cd3;
}

.status[data-tone="warn"],
.status[data-tone="error"] {
  background: #fff4ed;
  border-color: #f9dbaf;
  color: #b93815;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(420px, 1fr) minmax(280px, 340px);
  gap: 16px;
  padding: 16px;
  min-height: calc(100vh - 72px);
}

.join-workspace {
  grid-template-columns: minmax(260px, 320px) minmax(420px, 1fr) minmax(280px, 340px);
}

.side-panel,
.chat-panel,
.call-surface {
  min-width: 0;
}

.side-panel,
.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-block,
.chat-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 14px;
}

.panel-block h2,
.chat-panel h2 {
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: #101828;
  background: #ffffff;
}

.copy-row,
.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

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

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.call-surface {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr);
  gap: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 10px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  padding: 12px;
  min-height: 360px;
}

.video-grid:empty::before {
  content: "Create or join a room to start video";
  display: grid;
  place-items: center;
  min-height: 320px;
  color: #cbd5e1;
  border: 1px dashed #475569;
  border-radius: 8px;
}

.video-tile {
  position: relative;
  min-height: 180px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #334155;
}

.tile-label {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  padding: 5px 8px;
  font-size: 12px;
}

.media-slot,
.media-slot video {
  width: 100%;
  height: 100%;
}

.media-slot video {
  display: block;
  object-fit: cover;
}

.chat-panel {
  min-height: 0;
}

.chat-list,
.activity-log {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.chat-list {
  min-height: 240px;
  max-height: 40vh;
}

.activity-log {
  min-height: 120px;
  max-height: 24vh;
}

.chat-list li,
.activity-log li {
  padding: 9px 10px;
  border-bottom: 1px solid #e6ebf2;
  font-size: 13px;
}

.chat-list li:last-child,
.activity-log li:last-child {
  border-bottom: 0;
}

.chat-list strong {
  display: block;
  margin-bottom: 3px;
}

.chat-list li.own {
  background: #eff8ff;
}

@media (max-width: 1180px) {
  .workspace,
  .join-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .chat-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .workspace,
  .join-workspace {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .copy-row,
  .chat-input {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
