:root {
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #182321;
  --muted: #66736f;
  --line: #dbe4e0;
  --teal: #0f766e;
  --teal-dark: #0b4f4a;
  --amber: #d8911d;
  --danger: #c24130;
  --shadow: 0 18px 50px rgba(24, 35, 33, 0.12);
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.08), transparent 32rem),
    linear-gradient(315deg, rgba(216, 145, 29, 0.11), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.brand-row.compact {
  gap: 10px;
}

.brand-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.brand-mark.small {
  width: 36px;
  height: 36px;
}

.button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

.button.primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.button.secondary {
  background: #e8f1ef;
  color: var(--teal-dark);
}

.button.quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.button.full {
  width: 100%;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 420px;
  gap: 28px;
  align-items: center;
  padding: 42px;
}

.login-shell > * {
  min-width: 0;
}

.login-visual {
  min-width: 0;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0)),
    #132421;
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.login-visual::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -70px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 50%;
}

.login-visual h1 {
  width: min(720px, 100%);
  margin: 82px 0 18px;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.login-visual p {
  width: min(620px, 100%);
  margin: 0;
  color: rgba(255,255,255,0.76);
  font-size: 18px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.login-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: min(620px, 100%);
  margin-top: 54px;
}

.login-metrics div {
  padding: 18px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.login-metrics strong,
.login-metrics span {
  display: block;
}

.login-metrics span {
  margin-top: 5px;
  color: rgba(255,255,255,0.64);
  font-size: 13px;
}

.login-card {
  padding: 32px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0 0 28px;
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form label,
.room-label,
.prompt-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 86px;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: #111c1a;
  color: #fff;
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(216, 145, 29, 0.18);
  color: #ffd28a;
  font-size: 12px;
  font-weight: 900;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.nav-item {
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 13px;
  background: transparent;
  color: rgba(255,255,255,0.68);
  text-align: left;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.side-card,
.account-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.09);
}

.compact-card {
  gap: 9px;
}

.side-card .section-kicker {
  color: #9ee5dc;
}

.side-card input {
  background: rgba(255,255,255,0.92);
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-button {
  height: 38px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.72);
  font-weight: 800;
}

.mode-button.active {
  background: #f1fbf9;
  color: var(--teal-dark);
}

.account-card {
  margin-top: auto;
}

.account-card small {
  color: rgba(255,255,255,0.58);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 20px;
  align-items: start;
}

.stage-panel,
.call-panel,
.activity-panel,
.section-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.86);
  box-shadow: 0 10px 30px rgba(24, 35, 33, 0.08);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.room-stats {
  display: flex;
  gap: 8px;
}

.room-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.participant-stack {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.participant-tile {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  border-radius: 10px;
  background: #101817;
  border: 1px solid rgba(255,255,255,0.08);
}

.primary-tile {
  aspect-ratio: 16 / 9;
  min-height: 360px;
}

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

.tile-label {
  position: absolute;
  left: 12px;
  top: 12px;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.58);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: rgba(255,255,255,0.72);
  background:
    linear-gradient(135deg, rgba(15,118,110,0.24), transparent),
    #101817;
}

.video-empty strong {
  color: #fff;
  font-size: 24px;
}

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

.remote-grid:empty {
  display: none;
}

.remote-tile {
  aspect-ratio: 16 / 9;
  min-height: 180px;
}

.ai-tile {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(circle at 50% 42%, rgba(79, 209, 197, 0.2), transparent 42%),
    #101817;
  color: #fff;
}

.ai-tile-copy {
  position: absolute;
  left: 18px;
  bottom: 16px;
  display: grid;
  gap: 2px;
}

.ai-tile-copy span {
  color: rgba(255,255,255,0.66);
  font-size: 13px;
}

.ai-avatar {
  position: relative;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
}

.avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: linear-gradient(145deg, rgba(15,118,110,0.85), rgba(216,145,29,0.42));
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
}

.avatar-face {
  position: relative;
  width: 70px;
  height: 76px;
  border-radius: 35px 35px 30px 30px;
  background: #e9fffb;
}

.avatar-face i {
  position: absolute;
  top: 30px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b4f4a;
}

.avatar-face i:first-child {
  left: 20px;
}

.avatar-face i:nth-child(2) {
  right: 20px;
}

.avatar-face b {
  position: absolute;
  left: 25px;
  bottom: 20px;
  width: 20px;
  height: 7px;
  border-radius: 0 0 12px 12px;
  background: #0b4f4a;
}

.ai-avatar.listening .avatar-ring,
.call-orb.listening span {
  animation: pulse 1.4s infinite ease-in-out;
}

.ai-avatar.thinking .avatar-ring,
.call-orb.thinking span {
  animation: spin 2s infinite linear;
}

.ai-avatar.speaking .avatar-face b {
  animation: speak 480ms infinite alternate ease-in-out;
}

.call-panel {
  padding-bottom: 18px;
}

.call-state {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.call-status-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 18px;
  padding: 28px 18px;
  border-radius: 10px;
  background: #f6fbfa;
  border: 1px solid var(--line);
  text-align: center;
}

.call-orb {
  position: relative;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
}

.call-orb span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--amber));
  box-shadow: 0 18px 34px rgba(15, 118, 110, 0.24);
}

.call-orb strong {
  position: relative;
  color: #fff;
  font-size: 14px;
}

.call-status-card p {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.manual-row,
.button-row {
  display: flex;
  gap: 10px;
  padding: 0 18px;
}

.manual-row input {
  flex: 1;
}

.prompt-box {
  margin: 18px;
}

.activity-panel {
  margin-top: 20px;
}

.analysis-feed {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.analysis-card {
  min-height: 112px;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.analysis-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-card p {
  margin: 10px 0 0;
  line-height: 1.55;
}

.section-panel {
  padding: 24px;
}

.section-panel h2 {
  margin: 0 0 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.settings-grid div,
.session-empty {
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.settings-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-grid strong {
  word-break: break-word;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.78;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes speak {
  from {
    height: 5px;
  }
  to {
    height: 15px;
  }
}

@media (max-width: 1180px) {
  .room-layout {
    grid-template-columns: 1fr;
  }

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

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

  .login-shell {
    padding: 18px;
  }

  .login-visual {
    min-height: 460px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .remote-grid,
  .analysis-feed,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .primary-tile {
    min-height: 240px;
  }
}

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

  .login-visual {
    min-height: 560px;
    padding: 28px;
  }

  .login-visual h1 {
    width: min(100%, 320px);
    margin-top: 76px;
    font-size: 30px;
    line-height: 1.14;
  }

  .login-visual p {
    width: min(100%, 320px);
    font-size: 16px;
  }

  .login-metrics {
    grid-template-columns: 1fr;
    width: min(100%, 320px);
  }

  .login-card {
    padding: 24px;
  }

  .manual-row,
  .button-row {
    flex-direction: column;
  }
}
