/* Switchboard Talk — live voice sheet (js/switchboard-talk.js).
   Phone and narrow windows (<= 900px): bottom sheet. Wider: a small card in the Jarvis panel's corner
   (opening Talk closes the panel). */
.swt {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border: 1px solid var(--border, #d4d2cb);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface, #fff);
  box-shadow: 0 -12px 48px rgba(0, 0, 0, .28);
  color: var(--text, #0d0d0b);
  font-family: var(--font, system-ui, sans-serif);
  outline: none;
  animation: swt-up .26s cubic-bezier(.2, .8, .2, 1);
}
.swt[hidden] { display: none; }

@keyframes swt-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.swt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 4px 16px;
  background: var(--surface-2, #e4e3df);
}
.swt-title { font-size: 17px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.swt-x {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted, #6b6c64);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.swt-x:hover { color: var(--text, #0d0d0b); }

.swt-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

.swt-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 30px; }
.swt-status { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 500; color: var(--text-muted, #6b6c64); font-variant-numeric: tabular-nums; }
.swt-status[data-phase="active"] { color: var(--text, #0d0d0b); }
.swt-status[data-phase="error"], .swt-status[data-tone="warn"] { color: var(--danger, #dc2626); }
.swt-padtoggle {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 15px;
  background: var(--surface-2, #e4e3df);
  color: var(--text, #0d0d0b);
  font: 500 13px/1 var(--font, system-ui, sans-serif);
  cursor: pointer;
}

/* Captions: the newest line only (2 text lines max). */
.swt-cap { overflow-wrap: anywhere; font-size: 14px; line-height: 1.35; color: var(--text, #0d0d0b); }
.swt-cap-line[data-who="you"] { font-size: 12px; color: var(--text-muted, #6b6c64); }
.swt-cap-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.swt-pin { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 36px; }
.swt-dots { display: flex; justify-content: center; gap: 12px; min-height: 14px; }
.swt-back {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted, #6b6c64);
  font: 500 18px/1 var(--font, system-ui, sans-serif);
  cursor: pointer;
  touch-action: manipulation;
}
.swt-back:hover { color: var(--text, #0d0d0b); }
.swt-back:active { transform: scale(.97); }
.swt-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--text-muted, #6b6c64);
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.swt-dot.on { background: var(--text, #0d0d0b); border-color: var(--text, #0d0d0b); transform: scale(1.05); }

.swt-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 300px;
  width: 100%;
  margin: 0 auto;
}
.swt-hang[hidden], .swt-keypad[hidden], .swt-pin[hidden], .swt-cap[hidden], .swt-meter[hidden], .swt-padtoggle[hidden] { display: none; }
.swt-key {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-2, #e4e3df);
  color: var(--text, #0d0d0b);
  font: 600 20px/1 var(--font, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform .1s ease-out, background .12s ease;
}
.swt-key:hover { background: var(--bg-hover, #dcdad4); }
.swt-key:active, .swt-hang:active, .swt-padtoggle:active { transform: scale(.97); }

.swt-meter { height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2, #e4e3df); }
.swt-meter-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent, #b0664a);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 60ms linear;
}

.swt-hang {
  min-height: 52px;
  border: 0;
  border-radius: 26px;
  background: var(--danger, #dc2626);
  color: #fff;
  font: 700 16px/1 var(--font, system-ui, sans-serif);
  cursor: pointer;
  transition: transform .1s ease-out, filter .12s ease;
}
.swt-hang:hover { filter: brightness(.94); }
.swt-hang.swt-redial { background: var(--text, #0d0d0b); color: var(--surface, #fff); }

.swt button:focus-visible { outline: 2px solid var(--accent, #b0664a); outline-offset: 2px; }

@media (min-width: 901px) {
  .swt {
    left: auto;
    right: var(--im-launcher-edge, 16px);
    bottom: var(--im-launcher-bottom, 20px);
    width: 320px;
    max-width: calc(100vw - 32px);
    border-bottom: 1px solid var(--border, #d4d2cb);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  }
  .swt-x { min-width: 36px; min-height: 36px; }
  .swt-back { min-height: 30px; }
  .swt-body { padding-bottom: 16px; gap: 10px; }
  .swt-key { min-height: 40px; font-size: 18px; }
  .swt-hang { min-height: 44px; }
}

.ka-talk { display: inline-grid; place-items: center; }
.ka-talk[hidden] { display: none; }
.ka-talk:hover { color: var(--text, #f4f4f2); }

@media (prefers-reduced-motion: reduce) {
  .swt { animation: none; }
  .swt-key, .swt-back, .swt-hang, .swt-dot, .swt-meter-fill { transition: none; }
}
