:root {
  color: #18211f;
  background: #f5f7f2;
  font-family:
    Inter,
    "Yu Gothic",
    "Hiragino Kaku Gothic ProN",
    Meiryo,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 76px 280px minmax(0, 1fr) 320px;
  min-height: 100vh;
  background: #f5f7f2;
}

.space-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 10px;
  background: #20332d;
  color: #fff;
}

.brand-mark,
.space-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.brand-mark {
  background: #f0c95a;
  color: #20332d;
  font-weight: 800;
}

.space-button {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.space-button.is-active {
  background: #fbf8ea;
  color: #20332d;
}

.space-button strong {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #c43d2f;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
}

.space-button i {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #55c98a;
}

.channel-panel {
  overflow-y: auto;
  padding: 18px 16px;
  background: #eef2ea;
  border-right: 1px solid #d7ded4;
}

.channel-panel header,
.top-bar,
.template-panel div,
.card-heading,
.message-row header,
.participant-tile footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.channel-panel header p,
.top-bar p,
.template-panel span,
.recording-row span,
.audit-row span {
  margin: 0;
  color: #64706a;
  font-size: 12px;
}

.channel-panel h1,
.top-bar h2,
.status-card h2 {
  margin: 0;
}

.channel-panel h1 {
  font-size: 20px;
}

.user-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 18px 0;
}

.user-switcher button,
.tab-bar button,
.template-panel button,
.video-tools button {
  border: 1px solid #d0d8cd;
  border-radius: 8px;
  background: #fff;
  color: #26322e;
}

.user-switcher button {
  min-height: 34px;
  padding: 6px;
  font-size: 12px;
}

.user-switcher button.is-selected,
.tab-bar button.is-active {
  border-color: #286b55;
  background: #e0efe8;
  color: #174333;
}

.channel-group {
  margin: 18px 0;
}

.channel-group h2 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 6px;
  color: #64706a;
  font-size: 12px;
  letter-spacing: 0;
}

.channel-button {
  display: grid;
  grid-template-columns: 18px 1fr 16px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #34423d;
  text-align: left;
}

.channel-button.is-active,
.channel-button:hover {
  background: #dfe8db;
}

.channel-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-panel {
  padding: 12px;
  border: 1px solid #d6ded1;
  border-radius: 8px;
  background: #fbfcf8;
}

.template-panel h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

.template-panel button,
.video-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.template-panel button {
  width: 100%;
  min-height: 34px;
  margin-top: 7px;
}

.template-panel p {
  margin: 8px 0 0;
  color: #66736c;
  font-size: 13px;
}

.main-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 20px;
}

.top-bar {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.top-bar h2 {
  font-size: 24px;
}

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

.top-actions span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d7ded4;
  border-radius: 8px;
  background: #fff;
  color: #495650;
  font-size: 13px;
}

.content-card,
.video-stage,
.policy-gate {
  min-height: 0;
  flex: 1;
  border: 1px solid #d7ded4;
  border-radius: 8px;
  background: #fff;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #e2e7df;
}

.tab-bar button {
  min-height: 34px;
  padding: 0 12px;
}

.message-list {
  display: flex;
  min-height: 540px;
  flex-direction: column;
  padding: 16px;
}

.message-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #eef1eb;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e6efe8;
  color: #214b3b;
  font-weight: 700;
}

.message-row p {
  margin: 6px 0 0;
  line-height: 1.7;
}

.composer {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 72px;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}

.composer input,
.composer button {
  min-height: 42px;
  border: 1px solid #d5ddd2;
  border-radius: 8px;
}

.composer input {
  width: 100%;
  padding: 0 12px;
}

.composer.is-disabled {
  opacity: 0.72;
}

.placeholder-panel,
.policy-gate {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 40px;
  text-align: center;
}

.placeholder-panel p,
.policy-gate p {
  max-width: 560px;
  color: #596862;
  line-height: 1.8;
}

.policy-gate button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #286b55;
  color: #fff;
}

.video-stage {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  padding: 16px;
  background: #17211e;
}

.video-badges {
  position: absolute;
  z-index: 1;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.badge-rec,
.badge-monitor {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.badge-rec {
  background: #b3261e;
}

.badge-monitor {
  background: #8a5a00;
}

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

.participant-tile {
  display: grid;
  min-height: 220px;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #26312d;
  color: #fff;
}

.participant-video {
  display: grid;
  place-items: center;
  min-height: 160px;
  background:
    linear-gradient(135deg, rgba(85, 201, 138, 0.3), rgba(240, 201, 90, 0.18)),
    #243a32;
  font-size: 34px;
  font-weight: 800;
}

.participant-tile footer {
  min-height: 48px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.24);
}

.participant-tile footer div {
  display: flex;
  gap: 6px;
}

.is-muted {
  opacity: 0.35;
}

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

.video-tools button {
  min-height: 44px;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 20px 16px;
  border-left: 1px solid #d7ded4;
  background: #fbfcf8;
}

.status-card {
  padding: 14px;
  border: 1px solid #d7ded4;
  border-radius: 8px;
  background: #fff;
}

.status-card h2 {
  font-size: 15px;
}

.status-card dl {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.status-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-card dt {
  color: #65726b;
}

.status-card dd {
  margin: 0;
  font-weight: 700;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #e4e9e1;
}

.meter span {
  display: block;
  height: 100%;
  background: #286b55;
}

.recording-row,
.audit-row {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-bottom: 1px solid #eef1eb;
}

.recording-row em {
  width: max-content;
  padding: 3px 7px;
  border-radius: 8px;
  background: #fff1cc;
  color: #775000;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 68px 250px minmax(0, 1fr);
  }

  .admin-panel {
    grid-column: 2 / 4;
    border-left: 0;
    border-top: 1px solid #d7ded4;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .space-rail {
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .channel-panel,
  .admin-panel {
    grid-column: auto;
    border: 0;
  }

  .main-panel {
    padding: 14px;
  }

  .video-grid,
  .video-tools {
    grid-template-columns: 1fr;
  }

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

  .composer button:last-child {
    grid-column: 1 / -1;
  }
}
