:root {
  --ink: #121a16;
  --muted: #5f6d64;
  --paper: #edf2ef;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: #ffffff;
  --line: rgba(18, 26, 22, 0.1);
  --accent: #0d6e67;
  --accent-deep: #0a5550;
  --accent-soft: rgba(13, 110, 103, 0.12);
  --good: #1b7a4c;
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.1);
  --shadow: 0 20px 50px rgba(18, 26, 22, 0.1);
  --radius: 24px;
  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--paper);
  overflow-x: hidden;
}

body.connected .lobby { display: none; }
body.connected .studio { display: flex; flex: 1; min-height: 0; }
body.connected {
  height: 100dvh;
  overflow: hidden;
}
body.connected .app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(880px 460px at 8% -8%, rgba(13, 110, 103, 0.16), transparent 58%),
    radial-gradient(640px 380px at 96% 0%, rgba(160, 130, 70, 0.12), transparent 52%),
    linear-gradient(165deg, #f6f9f7 0%, #e7eeea 55%, #dde7e2 100%);
  animation: atmosphere-drift 16s ease-in-out infinite alternate;
}

@keyframes atmosphere-drift {
  from { transform: scale(1); }
  to { transform: scale(1.03) translateY(-8px); }
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
  animation: rise 0.55s ease both;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

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

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.status-pill { background: var(--accent-soft); border-color: rgba(13, 110, 103, 0.22); }
.agent-pill { background: rgba(154, 103, 0, 0.1); }
.agent-pill.online {
  background: rgba(27, 122, 76, 0.1);
  border-color: rgba(27, 122, 76, 0.28);
  color: var(--good);
}
.voice-pill { background: rgba(13, 110, 103, 0.08); }
.voice-pill[hidden] { display: none; }
.timer-pill { font-variant-numeric: tabular-nums; }

.lobby {
  margin-top: 48px;
  max-width: 560px;
  animation: rise 0.7s ease both;
}

.lobby-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.92;
}

.lobby-copy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
  max-width: 46ch;
}

.lobby-form {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.lobby-form label > span {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.lobby-form input,
.lobby-form select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.lobby-form input:focus,
.lobby-form select:focus {
  border-color: rgba(13, 110, 103, 0.45);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field input::placeholder {
  color: #8a978f;
  font-weight: 500;
}

.field-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(18, 26, 22, 0.06);
  border: 1px solid var(--line);
}

.mode-btn {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mode-btn:hover {
  color: var(--ink);
}

.mode-btn.active {
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(18, 26, 22, 0.08);
}

.lobby-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lobby-actions button:not(.secondary),
#create-btn,
#join-btn {
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.lobby-actions button:not(.secondary):hover,
#create-btn:hover,
#join-btn:hover {
  background: var(--accent-deep);
}

.lobby-actions button:not(.secondary):disabled,
#create-btn:disabled,
#join-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lobby .status {
  margin-top: 16px;
}

.share-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  word-break: break-all;
}

.share-link:hover { text-decoration: underline; }

.share-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.share-box[hidden] { display: none; }

.share-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.studio[hidden] { display: none; }

.stage-row {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: stretch;
  animation: rise 0.65s ease both;
}

body.connected .stage-row {
  flex: 1;
  min-height: 0;
  margin-top: 16px;
}

.stage,
.transcript-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.stage { padding: 14px; }

body.connected .stage,
body.connected .transcript-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.connected .stage {
  display: flex;
  flex-direction: column;
}

body.connected .video-grid {
  flex: 1;
  min-height: 0;
}

body.connected .video-tile {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.connected .video-wrap,
body.connected .remote-video-container {
  flex: 1;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
}

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

.video-tile { min-width: 0; }

.video-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.video-card-header h2,
.transcript-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.video-wrap,
.remote-video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 240px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(150deg, #1a2620, #0d1411);
}

.video-wrap video,
.remote-video-container video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0d1411;
  z-index: 1;
}

.face-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background: transparent;
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(238, 242, 239, 0.7);
  font-size: 0.92rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 3;
  background: linear-gradient(150deg, #1a2620, #0d1411);
}

.media-placeholder.hidden {
  display: none !important;
}

.remote-video-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-content: stretch;
}

.remote-video-container > div {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: #0d1411;
}

.remote-video-container > .remote-video-tile {
  min-height: 0;
  aspect-ratio: 4 / 3;
}

.remote-video-container > .remote-video-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remote-audio-bin {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 64px;
  overflow: hidden;
  opacity: 0.02;
  pointer-events: none;
  z-index: 2;
}

.remote-audio-bin audio {
  width: 64px;
  height: 64px;
  display: block;
}

.remote-tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-presence {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 24px;
  text-align: center;
  color: rgba(238, 242, 239, 0.82);
  background:
    radial-gradient(circle at 50% 42%, rgba(13, 110, 103, 0.28), transparent 42%),
    linear-gradient(150deg, #1a2620, #0d1411);
}

.agent-presence.online .agent-orb {
  animation: orb-pulse 1.6s ease infinite;
  box-shadow: 0 0 0 12px rgba(27, 122, 76, 0.12);
  background: linear-gradient(145deg, #2f9e6d, #0d6e67);
}

.agent-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a4a42, #1c2922);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.agent-presence-title {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.agent-presence-copy {
  margin: 0;
  max-width: 26ch;
  font-size: 0.86rem;
  color: rgba(238, 242, 239, 0.62);
  line-height: 1.4;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.speaking-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
}

.speaking-badge.speaking {
  background: rgba(27, 122, 76, 0.12);
  border-color: rgba(27, 122, 76, 0.32);
  color: var(--good);
}

.speaking-badge.speaking::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
}

.face-roster {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.face-roster-empty {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.face-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  min-width: 118px;
}

.face-chip.known {
  border-color: rgba(13, 110, 103, 0.3);
  background: var(--accent-soft);
}

.face-chip strong {
  font-size: 0.8rem;
  color: var(--ink);
}

.face-chip span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.invite-sheet {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(13, 110, 103, 0.28);
  box-shadow: 0 10px 24px rgba(18, 26, 22, 0.06);
}

.invite-sheet[hidden] { display: none; }

.invite-sheet-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.invite-sheet-link {
  display: block;
  margin-top: 6px;
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.4;
  word-break: break-all;
  text-decoration: none;
}

.invite-sheet-link:hover { text-decoration: underline; }

.invite-sheet-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.dock {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.dock-role {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  color: var(--muted, #5c6b66);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dock-role select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: #f4f7f5;
}

.dock-role select:disabled {
  opacity: 0.55;
}

.dock-btn,
button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.dock-btn {
  min-width: 118px;
  background: #f4f7f5;
  color: var(--ink);
  border: 1px solid var(--line);
}

.dock-btn.active {
  background: var(--accent-soft);
  border-color: rgba(13, 110, 103, 0.35);
  color: var(--accent-deep);
}

.dock-btn.danger {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.2);
  color: var(--danger);
}

.dock-btn.hear {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

button:hover:not(:disabled),
.dock-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

#join-btn { background: var(--accent); color: #fff; }
#join-btn:hover:not(:disabled) { background: var(--accent-deep); }

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

button:disabled,
.dock-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: rgba(13, 110, 103, 0.45);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.status {
  color: var(--muted);
  min-height: 22px;
  font-weight: 600;
  font-size: 0.92rem;
}

.transcript-panel {
  padding: 16px 16px 14px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.74));
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.transcript-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.transcript-header button {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.transcript-scroll-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
}

.transcript-log {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 14px 12px 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(13, 110, 103, 0.05), transparent 72px),
    rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 110, 103, 0.45) transparent;
  mask-image: linear-gradient(to bottom, transparent, #000 14px);
}

.transcript-log::-webkit-scrollbar {
  width: 8px;
}

.transcript-log::-webkit-scrollbar-thumb {
  background: rgba(13, 110, 103, 0.38);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.transcript-jump {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 12px 28px rgba(18, 26, 22, 0.22);
}

.transcript-jump[hidden] {
  display: none;
}

.transcript-empty {
  margin: auto;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
  padding: 24px 8px;
  max-width: 220px;
}

.transcript-line {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(18, 26, 22, 0.04);
  animation: line-in 0.25s ease both;
}

.transcript-line.user {
  border-left: 3px solid var(--accent);
  background: linear-gradient(180deg, #f4fbf9, #fff);
}

.transcript-line.agent {
  border-left: 3px solid var(--good);
  background: linear-gradient(180deg, #f5fbf7, #fff);
}

.transcript-line .who {
  font-weight: 800;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.transcript-line.partial { opacity: 0.68; }

.transcript-line .text,
.transcript-line .heard-text {
  margin: 0;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.45;
}

.transcript-line .heard {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.transcript-line .heard[hidden] { display: none; }

.transcript-line .heard-label {
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--good);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  body.connected,
  body.connected .app-shell {
    height: auto;
    overflow: auto;
  }

  body.connected .studio { display: block; }

  .stage-row { grid-template-columns: 1fr; }

  body.connected .stage,
  body.connected .transcript-panel,
  body.connected .video-wrap,
  body.connected .remote-video-container {
    height: auto;
    overflow: visible;
  }

  body.connected .video-wrap,
  body.connected .remote-video-container {
    aspect-ratio: 4 / 3;
    min-height: 220px;
  }

  .transcript-panel { min-height: 0; }
  .transcript-scroll-wrap { min-height: 320px; }
  .transcript-log {
    min-height: 320px;
    max-height: min(52vh, 520px);
  }
}

.desk-pill {
  cursor: pointer;
  background: #f4f7f5;
  color: var(--ink);
  border: 1px solid var(--line);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.calls-page .desk-shell {
  width: min(1280px, calc(100% - 24px));
  padding-top: 18px;
}

.calls-page .brand {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.calls-page .desk-topbar {
  margin-bottom: 4px;
}

.desk {
  margin: 20px auto 40px;
  width: 100%;
  padding: 18px 18px 22px;
  border: 1px solid rgba(18, 53, 47, 0.1);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(18, 26, 22, 0.06);
}

.desk-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 4px 2px 2px;
  flex-wrap: wrap;
}

.desk-title-block h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.desk-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.mode-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(18, 53, 47, 0.1);
  border-radius: 12px;
  background: #f7faf8;
}

.mode-switch {
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(18, 53, 47, 0.06);
}

.mode-option {
  flex: 1;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-option.active {
  background: #12352f;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.desk-status.suggesting {
  background: #e7f2ff;
  color: #1d4f91;
}

.incoming-call {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #0c2420;
  color: #f4f7f4;
  border: 1px solid rgba(157, 222, 200, 0.18);
}

.incoming-call[hidden] {
  display: none;
}

.incoming-call .desk-kicker {
  color: #9ddec8;
}

.incoming-call .desk-hint {
  color: rgba(244, 247, 244, 0.78);
}

.incoming-call strong {
  display: block;
  font-size: 1.15rem;
}

.dial-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dial-talk {
  margin: 0;
  min-width: 240px;
  max-width: 280px;
}

.dial-card.on-call .dial-talk {
  background: rgba(255, 255, 255, 0.1);
}

.dial-card.on-call .dial-talk .mode-option {
  color: #d7efe6;
}

.dial-card.on-call .dial-talk .mode-option.active {
  background: #fff;
  color: #12352f;
}

.dial-talk .mode-option:disabled {
  cursor: default;
}

.dial-card {
  position: relative;
  z-index: 5;
  margin: 0 0 16px;
  padding: 16px 18px 18px;
  border-radius: 14px;
  background: #12352f;
  color: #f4f7f4;
  border: 1px solid rgba(18, 53, 47, 0.2);
  box-shadow: 0 14px 32px rgba(18, 53, 47, 0.14);
}

.dial-card .desk-kicker {
  color: #9ddec8;
}

.dial-card .desk-hint {
  color: rgba(244, 247, 244, 0.78);
  margin: 2px 0 0;
}

.dial-card.on-call {
  background: #0c2420;
}

.dial-card.on-call .desk-kicker {
  color: #9ddec8;
}

.dial-card.on-call .desk-hint {
  color: rgba(244, 247, 244, 0.78);
}

.dial-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-top: 14px;
}

.dial-row > #outbound-number {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: #fff;
  color: var(--ink);
}

.country-picker {
  position: relative;
  flex: 0 0 188px;
  z-index: 8;
}

.country-trigger {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.country-trigger #country-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-trigger #country-code {
  flex: 0 0 auto;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}

.country-trigger:disabled {
  opacity: 0.85;
  cursor: default;
}

.country-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, 78vw);
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(18, 53, 47, 0.12);
  box-shadow: 0 18px 40px rgba(18, 26, 22, 0.18);
}

.country-menu[hidden] {
  display: none;
}

.country-menu input {
  width: 100%;
  height: 40px;
  border: 1px solid rgba(18, 53, 47, 0.14);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9rem;
  background: #f7faf8;
  color: var(--ink);
}

.country-list {
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
  margin-top: 8px;
}

.country-option {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.country-option span:last-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.country-option:hover,
.country-option.active {
  background: #eef5f2;
}

.country-option.active span:last-child {
  color: var(--accent-deep);
}

.country-empty {
  margin: 12px 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.dial-card.on-call .dial-row > #outbound-number,
.dial-card.on-call .country-trigger {
  background: rgba(255, 255, 255, 0.94);
}

.incoming-answer,
.incoming-hangup {
  border: 0;
  border-radius: 10px;
  height: 46px;
  min-width: 96px;
  padding: 0 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.incoming-answer {
  background: #19a45a;
  color: #fff;
  box-shadow: 0 6px 16px rgba(25, 164, 90, 0.28);
}

.incoming-answer:disabled,
.incoming-hangup:disabled {
  opacity: 0.42;
  cursor: default;
  box-shadow: none;
}

.incoming-answer.small {
  height: auto;
  min-width: 0;
  margin-left: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
}

.incoming-hangup {
  background: #b42318;
  color: #fff;
}

@media (max-width: 720px) {
  .dial-row {
    flex-wrap: wrap;
  }
  .country-picker {
    flex: 1 1 100%;
  }
  .dial-row > #outbound-number {
    flex-basis: 100%;
  }
  .country-menu {
    width: 100%;
  }
  .incoming-answer,
  .incoming-hangup {
    flex: 1;
  }
}

.ai-switch {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ai-switch label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.desk-download {
  border: 0;
  background: #12352f;
  color: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}

.desk-download.quiet {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid rgba(13, 110, 103, 0.28);
}

.desk-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.desk-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.desk-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

#desk-hint {
  display: none;
}

.desk-tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  padding: 3px;
  width: fit-content;
  border-radius: 10px;
  background: rgba(18, 53, 47, 0.06);
}

.desk-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.desk-tab span {
  min-width: 1.4rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(18, 26, 22, 0.06);
  font-size: 0.72rem;
}

.desk-tab.active {
  background: var(--ink);
  color: #fff;
}

.desk-tab.active span {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.desk-panel[hidden] {
  display: none;
}

.desk-tickets {
  margin: 0;
}

.desk-tickets h3 {
  display: none;
}

.desk-hint {
  font-size: 0.82rem;
}

.desk-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(18, 53, 47, 0.08);
  border-radius: 12px;
  background: #f7faf8;
}

.desk-filters input,
.desk-filters select {
  border: 1px solid rgba(18, 53, 47, 0.14);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.84rem;
}

.desk-filters input {
  flex: 1 1 220px;
  min-width: 180px;
}

.desk-filters select {
  min-width: 118px;
}

.desk-status.raised {
  background: #e5f6ef;
  color: #0b6b45;
}

.ticket-card {
  height: auto;
  max-height: min(84vh, 720px);
  padding: 28px;
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.ticket-head h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.ticket-issue {
  margin-top: 22px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f4fbf8, #fff);
  border: 1px solid rgba(13, 110, 103, 0.14);
}

.ticket-issue span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ticket-issue p {
  margin: 8px 0 0;
  font-size: 1.15rem;
  line-height: 1.45;
}

.ticket-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.desk-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.desk-pager button {
  border: 1px solid rgba(13, 110, 103, 0.22);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.desk-pager button:disabled {
  opacity: 0.4;
}

.desk-pager span {
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 7rem;
  text-align: center;
}

.desk-table-wrap {
  margin-top: 0;
  overflow: auto;
  border: 1px solid rgba(18, 53, 47, 0.1);
  border-radius: 12px;
  background: #fff;
}

.desk-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

.desk-table th {
  position: sticky;
  top: 0;
  padding: 9px 10px;
  background: #eef3f0;
  color: #4d5c55;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
}

.desk-table th:nth-child(1) { width: 7%; }
.desk-table th:nth-child(2) { width: 7%; }
.desk-table th:nth-child(3) { width: 14%; }
.desk-table th:nth-child(4) { width: 16%; }
.desk-table th:nth-child(5) { width: 8%; }
.desk-table th:nth-child(6) { width: 28%; }
.desk-table th:nth-child(7) { width: 9%; }
.desk-table th:nth-child(8) { width: 11%; }

.desk-table td {
  padding: 10px;
  border-top: 1px solid rgba(18, 26, 22, 0.06);
  vertical-align: middle;
  color: #1c2823;
}

.desk-table td.desk-time,
.desk-table td.desk-mono {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.desk-table td.desk-customer {
  line-height: 1.25;
}

.desk-table td.desk-customer strong {
  display: block;
  font-size: 0.8rem;
}

.desk-table td.desk-customer span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.desk-table td.desk-issue {
  color: #24332c;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
}

.desk-table td.desk-status-cell {
  white-space: nowrap;
}

.desk-table td.desk-status-cell .ai-switch.compact {
  margin-top: 6px;
  gap: 6px;
}

.desk-table td.desk-status-cell .ai-switch-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.desk-date td {
  background: #eef4f1;
  color: var(--accent-deep);
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 0.78rem;
  padding-top: 8px;
  padding-bottom: 8px;
}

.desk-row {
  cursor: pointer;
}

.desk-row:hover td,
.desk-row:focus td {
  background: rgba(13, 110, 103, 0.06);
}

.desk-row.live td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.desk-log {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 26, 22, 0.46);
}

.desk-log[hidden] {
  display: none;
}

.desk-log-card {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  height: min(84vh, 780px);
  padding: 18px 18px 14px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(18, 26, 22, 0.18);
}

.desk-log-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.desk-log-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.desk-log-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.desk-log-actions {
  display: flex;
  gap: 8px;
}

.desk-log-facts {
  margin-top: 12px;
}

.desk-thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-right: 4px;
}

.desk-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  background: #f4f7f5;
}

.desk-bubble.agent {
  align-self: flex-start;
  background: rgba(13, 110, 103, 0.1);
}

.desk-bubble.caller {
  align-self: flex-end;
  background: #f6f8f7;
}

.desk-bubble p {
  margin: 2px 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.desk-recordings {
  margin-top: 12px;
  border-top: 1px solid rgba(18, 26, 22, 0.08);
  padding-top: 8px;
}

.desk-recordings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.desk-log-audio {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  margin-top: 8px;
}

.desk-clip {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 8px;
}

.desk-clip span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.desk-clip audio {
  width: 100%;
  height: 32px;
}

.desk-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.desk-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.desk-card {
  padding: 16px 16px 14px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(18, 26, 22, 0.08);
  box-shadow: 0 10px 30px rgba(18, 26, 22, 0.04);
}

.desk-card.live {
  border-color: rgba(13, 110, 103, 0.35);
}

.desk-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.desk-fact {
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #f4f7f5;
}

.desk-fact span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.desk-fact strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
}

.desk-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.desk-card h3 {
  margin: 0;
  font-size: 1rem;
}

.desk-direction {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.desk-direction.inbound {
  background: #e8f3ff;
  color: #0b5cab;
}

.desk-direction.outbound {
  background: #f3eee4;
  color: #7a5a18;
}

.desk-status {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-deep);
}

.desk-status.connected {
  background: #e5f6ee;
  color: #0f7a45;
}

.desk-status.busy {
  background: #fff4e5;
  color: #9a5b00;
}

.desk-status.ended {
  background: #eef1ef;
  color: var(--muted);
}

.desk-meta,
.desk-details {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.desk-lines {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.desk-lines li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #f6f8f7;
  font-size: 0.88rem;
}

.desk-lines li.agent {
  background: rgba(13, 110, 103, 0.08);
}

.desk-who {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.desk-card .desk-download {
  margin-top: 12px;
}

.file-upload {
  cursor: pointer;
}

.file-upload input {
  display: none;
}

.answer-bar,
.answer-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.answer-bar > div:first-child {
  max-width: 640px;
}

.answer-bar .desk-kicker {
  margin-bottom: 4px;
}

.answer-bar p,
.answer-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.answer-form,
.answer-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(18, 53, 47, 0.1);
  border-radius: 12px;
  background: #fff;
}

.answer-form {
  display: grid;
  gap: 12px;
  background: #f7faf8;
}

.answer-form label {
  display: grid;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4d5c55;
}

.answer-form textarea {
  width: 100%;
  border: 1px solid rgba(18, 53, 47, 0.14);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.answer-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.answer-langs {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.answer-langs p {
  display: grid;
  gap: 2px;
  color: var(--ink);
}

.answer-langs span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 16px;
  }

  .lobby { margin-top: 28px; }
  .video-grid { grid-template-columns: 1fr; }
  .dock { border-radius: 18px; }
  .dock-btn { min-width: 96px; padding: 11px 14px; }
}
