:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #f8fbfa;
  --line: #d1ddda;
  --line-soft: #dbe5e2;
  --text-main: #1d2b28;
  --text-sub: #475f5a;
  --accent: #19b67d;
  --accent-soft: #43cca0;
  --accent-ink: #066848;
  --danger: #de4f43;
  --shadow-soft: 0 6px 14px rgba(17, 50, 40, 0.05);
  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-main);
  background: var(--bg);
}

body {
  background: #f7faf8;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

body.meeting-live .topbar {
  display: none;
}

body.meeting-live .app-shell {
  max-width: 1560px;
  padding: 12px;
}

.card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.hidden {
  display: none !important;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-box {
  width: 56px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  display: grid;
  place-items: center;
}

.brand-logo {
  width: 40px;
  height: auto;
  display: block;
}

.brand-name {
  margin: 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--text-sub);
  font-size: 12px;
}

.top-search {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  color: #556e68;
  font-size: 14px;
  font-weight: 500;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-chip,
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: var(--surface);
  font-size: 13px;
  color: #325148;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.pre-meeting {
  display: grid;
  gap: 14px;
}

.hero-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
  background: #ffffff;
  border-left: 4px solid rgba(25, 182, 125, 0.34);
}

.hero-kicker {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
  font-weight: 700;
}

.hero-panel h1 {
  margin: 8px 0 10px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  max-width: 980px;
}

.hero-sub {
  margin: 0;
  font-size: 15px;
  color: #4a615d;
  max-width: 920px;
  line-height: 1.56;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #bcded2;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  color: #2d5c4f;
  background: #edf8f4;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  padding: 14px;
}

.kpi-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5f7871;
  font-weight: 700;
}

.kpi-value {
  margin: 6px 0 0;
  font-size: 22px;
  font-family: 'Source Sans 3', sans-serif;
}

.kpi-note {
  margin: 8px 0 0;
  color: #4f6762;
  font-size: 13px;
  line-height: 1.45;
}

.join-card {
  padding: 18px;
  max-width: none;
  width: 100%;
}

.join-head h2 {
  margin: 0;
  font-family: 'Source Sans 3', sans-serif;
}

.join-head p {
  margin: 7px 0 0;
  color: var(--text-sub);
  font-size: 14px;
}

.join-form {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #485f5a;
  font-weight: 600;
}

input,
button {
  font: inherit;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-main);
  padding: 10px 12px;
}

input[type='text']::placeholder,
input[type='password']::placeholder {
  color: #718a84;
}

input[type='text']:focus,
input[type='password']:focus,
input[type='range']:focus,
input[type='color']:focus {
  outline: 2px solid rgba(25, 182, 125, 0.24);
  outline-offset: 1px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  transform: none;
  cursor: not-allowed;
}

.btn-accent {
  border-color: rgba(10, 153, 101, 0.35);
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-soft));
}

.btn-accent:hover {
  background: linear-gradient(120deg, #16a873, #27c996);
}

.btn-plain {
  border-color: #d5e2de;
  color: #2f4f46;
  background: #ffffff;
}

.btn-plain:hover {
  background: #f4f9f7;
  border-color: #b8d5cb;
}

.btn-plain.active {
  border-color: rgba(25, 182, 125, 0.38);
  background: #ebfaf4;
  color: #0a754f;
}

.btn-danger {
  border-color: rgba(188, 58, 47, 0.35);
  color: #fff;
  background: var(--danger);
}

.btn-danger:hover {
  background: #c94136;
}

.hint {
  margin: 10px 0 0;
  min-height: 18px;
  color: #136e4f;
  font-size: 13px;
  font-weight: 500;
}

.meeting {
  display: grid;
  gap: 14px;
}

.meeting-shell {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 370px;
  gap: 14px;
  min-height: 760px;
}

.meeting-rail,
.meeting-main,
.meeting-side {
  background: #ffffff;
  border-color: #d9e6df;
  box-shadow: 0 10px 24px rgba(14, 59, 40, 0.08);
}

.meeting-rail {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
  padding: 12px 8px;
}

.rail-btn {
  width: 50px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #d4e6dd;
  background: #ffffff;
  color: #245042;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}

.rail-btn.active {
  border-color: rgba(24, 170, 116, 0.5);
  background: linear-gradient(135deg, #17b47d, #45d09e);
  color: #053926;
}

.rail-btn.rail-btn-accent {
  border-color: rgba(17, 156, 105, 0.4);
  background: linear-gradient(135deg, #dbf8ee, #edfef8);
  color: #0e6848;
}

.meeting-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 16px;
}

.meeting-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 12px;
  align-items: start;
}

.room-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #d6e7df;
  background: #f4fbf7;
  object-fit: contain;
  padding: 6px;
}

.room-label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5f7a70;
  font-weight: 700;
}

.meeting-title-block h3 {
  margin: 2px 0 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.14;
  color: #1d2b28;
  overflow-wrap: anywhere;
}

.status {
  margin: 0;
  color: #4e665e;
  font-size: 13px;
}

.status.invite {
  overflow-wrap: anywhere;
}

.meeting-meta-block {
  display: grid;
  gap: 8px;
}

.meeting .btn {
  border-radius: 12px;
  border-color: #d0e4dc;
  color: #25463d;
  background: #ffffff;
}

.meeting .btn:hover {
  background: #f4faf7;
  border-color: #b8dace;
}

.meeting .btn-accent {
  border-color: rgba(20, 170, 115, 0.45);
  background: linear-gradient(120deg, #17b57d, #45d19f);
  color: #063624;
}

.meeting .btn-accent:hover {
  background: linear-gradient(120deg, #24bf88, #5cdbac);
}

.meeting .btn-danger {
  border-color: rgba(255, 110, 120, 0.6);
  background: linear-gradient(120deg, #e84d61, #ff6f7f);
  color: #fff;
}

.meeting .btn-danger:hover {
  background: linear-gradient(120deg, #ef6174, #ff8190);
}

.control-icon-btn {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 14px;
  position: relative;
}

.control-icon-btn svg {
  width: 21px;
  height: 21px;
  display: block;
  fill: currentColor;
}

.control-icon-btn.active {
  border-color: rgba(22, 171, 116, 0.46);
  background: linear-gradient(120deg, #e3f8ef, #f2fdf8);
  color: #0f7953;
}

.control-icon-btn.is-off {
  color: #5f756d;
}

.control-icon-btn.is-off::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 2px;
  background: #c14f4f;
  border-radius: 999px;
  transform: rotate(-35deg);
}

.control-icon-btn:disabled {
  opacity: 0.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.meeting input[type='text'],
.meeting input[type='password'] {
  border-color: #d3e5dd;
  background: #ffffff;
  color: #223732;
}

.meeting input[type='text']::placeholder,
.meeting input[type='password']::placeholder {
  color: #769287;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(24, 170, 116, 0.38);
  background: #ecf8f2;
  color: #0f7d55;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  text-transform: uppercase;
}

.role-badge.role-host {
  border-color: rgba(24, 170, 116, 0.58);
  color: #0c8458;
}

.role-badge.role-moderator {
  border-color: rgba(68, 181, 140, 0.54);
  color: #1c8a64;
}

.video-stage {
  position: relative;
  padding: 10px;
  border: 1px solid #d5e7df;
  border-radius: 18px;
  background: #f9fdfb;
  min-height: 580px;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

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

.stage-head h4,
.panel-head h4 {
  margin: 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  color: #213430;
}

.stage-head span {
  color: #60786f;
  font-size: 13px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.video-grid.has-spotlight {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-tile {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #0f1b22;
  border: 1px solid #d2e4dc;
  min-height: 180px;
  aspect-ratio: 16 / 9;
}

.video-tile.screen-share {
  border-color: rgba(21, 174, 119, 0.8);
  box-shadow: 0 0 0 2px rgba(21, 174, 119, 0.2);
}

.video-tile.is-spotlight {
  grid-column: 1 / -1;
  min-height: clamp(260px, 52vh, 640px);
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #050c15;
}

.video-tile.screen-share video,
.video-tile.is-spotlight video {
  object-fit: contain;
}

.video-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tile-action-btn {
  border: 1px solid rgba(170, 213, 195, 0.8);
  border-radius: 999px;
  background: rgba(8, 18, 30, 0.85);
  color: #def6ef;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
}

.tile-action-btn.tile-action-primary {
  border-color: rgba(39, 199, 142, 0.72);
  color: #9dffe4;
}

.tile-action-btn.tile-action-primary.active {
  background: linear-gradient(120deg, #1bb57e, #45d09e);
  color: #042f22;
}

.video-meta {
  position: absolute;
  inset: auto 10px 10px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(7, 15, 26, 0.74);
  border: 1px solid rgba(138, 174, 164, 0.38);
  color: #f2f7fe;
  font-size: 12px;
}

.pill {
  border: 1px solid rgba(39, 199, 142, 0.55);
  border-radius: 999px;
  padding: 2px 8px;
  color: #98ffe0;
  background: rgba(20, 168, 115, 0.2);
}

.empty-stage {
  position: absolute;
  inset: 62px 10px 10px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 16px;
  border: 1px dashed #c8ddd4;
  color: #6f897f;
  background: #f3faf7;
}

.meeting-dock {
  justify-content: center;
  gap: 10px;
  display: flex;
  flex-wrap: wrap;
}

.audio-inline {
  border: 1px solid #dbe9e2;
  border-radius: 14px;
  background: #fbfefc;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.audio-inline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.audio-inline label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #5c756d;
}

.audio-inline select,
.audio-inline input[type='range'] {
  width: 100%;
}

.audio-inline select {
  border: 1px solid #d5e6df;
  border-radius: 9px;
  background: #ffffff;
  color: #2a443b;
  padding: 7px 9px;
}

.audio-inline .meter-wrap.compact {
  gap: 4px;
}

.meeting-side {
  display: grid;
  grid-template-rows: 1fr;
  gap: 8px;
  padding: 10px;
}

.panel {
  padding: 10px;
  display: grid;
  gap: 8px;
  border: 1px solid #d7e7df;
  border-radius: 14px;
  background: #ffffff;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.participant-panel,
.chat-panel,
.audio-panel,
.whiteboard-panel {
  min-height: 0;
}

.participant-list,
.chat-list {
  /* border: 1px solid #dbe9e2; */
  border-radius: 12px;
  background: #fbfefc;
  overflow: auto;
}

.participant-list {
  padding: 6px;
  min-height: 380px;
}

.participant-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 5px;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid #ddebe4;
  background: #ffffff;
}

.participant-item:last-child {
  margin-bottom: 0;
}

.participant-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #213631;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-meta {
  margin: 3px 0 0;
  color: #6f8980;
  font-size: 12px;
}

.participant-actions {
  display: flex;
  align-items: center;
}

.chat-panel {
  grid-template-rows: auto 1fr auto;
}

.chat-list {
  padding: 7px;
  min-height: 300px;
}

.chat-message {
  margin: 0 0 8px;
  border: 1px solid #dcebe4;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px;
}

.chat-message p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.46;
  color: #263d36;
  overflow-wrap: anywhere;
}

.chat-meta {
  font-size: 11px;
  color: #708a80;
}

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

.audio-panel label {
  display: grid;
  gap: 4px;
  color: #5f7a70;
  font-size: 13px;
}

.audio-panel select,
.audio-panel input[type='range'] {
  width: 100%;
}

.audio-panel select {
  border: 1px solid #d5e6df;
  border-radius: 10px;
  background: #ffffff;
  color: #2a443b;
  padding: 8px 10px;
}

.meter-wrap {
  display: grid;
  gap: 4px;
}

.meter-label {
  margin: 0;
  color: #5f7a70;
  font-size: 12px;
}

.meter-track {
  border-radius: 999px;
  border: 1px solid #d8e8e1;
  background: #eff8f4;
  height: 12px;
  overflow: hidden;
}

.meter-fill {
  width: 2%;
  height: 100%;
  background: linear-gradient(90deg, #19b67d, #44d09d);
  transition: width 80ms linear;
}

.whiteboard-panel {
  grid-template-rows: auto minmax(300px, 1fr);
}

.whiteboard-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type='color'] {
  width: 36px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #d5e6de;
  background: #ffffff;
}

input[type='range'] {
  width: 100%;
  accent-color: #18b57c;
}

#whiteboardCanvas {
  width: 100%;
  height: 100%;
  border: 1px solid #d7e8e0;
  border-radius: 12px;
  background: #ffffff;
  touch-action: none;
}

@media (max-width: 1300px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-meta {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .meeting-topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .meeting-shell {
    grid-template-columns: 58px minmax(0, 1fr) 320px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 12px;
  }

  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .meeting-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .meeting-rail {
    grid-auto-flow: column;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: stretch;
    justify-items: stretch;
  }

  .rail-btn {
    width: 100%;
  }

  .meeting-side {
    min-height: 420px;
  }

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

  .video-stage {
    min-height: 450px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .video-grid.has-spotlight {
    grid-template-columns: minmax(0, 1fr);
  }

  .video-tile.is-spotlight {
    min-height: clamp(200px, 42vh, 420px);
  }

  .chat-list {
    min-height: 220px;
  }
}

@media (max-width: 700px) {
  .topbar,
  .hero-panel,
  .join-card,
  .meeting-main,
  .meeting-side,
  .meeting-topbar,
  .video-stage,
  .panel {
    border-radius: 14px;
    padding: 12px;
  }

  .hero-panel h1 {
    font-size: clamp(21px, 8vw, 30px);
  }

  .button-row,
  .chat-form {
    grid-template-columns: minmax(0, 1fr);
    display: grid;
  }

  .meeting-dock {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .meeting-title-block h3 {
    font-size: clamp(22px, 8vw, 30px);
  }

  .room-brand-logo {
    width: 38px;
    height: 38px;
  }

  .audio-inline-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-search {
    display: none;
  }
}
