:root {
  --ink: var(--text);
  --green: var(--primary);
  --muted: var(--text-2);
  --paper: var(--surface-2);
  --font: var(--font-sans);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.48 var(--font);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  font-weight: 600;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  outline-offset: 2px;
}
input,
select,
textarea {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 0.58rem 0.7rem;
}
textarea {
  width: 100%;
  resize: vertical;
}
label {
  font-size: 13px;
  font-weight: 650;
}
h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}
h1 {
  font-size: clamp(27px, 4vw, 40px);
  line-height: 1.13;
  letter-spacing: -1.7px;
  font-weight: 600;
}
h2 {
  font-size: 22px;
  line-height: 1.24;
  letter-spacing: -0.6px;
}
h3 {
  font-size: 16px;
  letter-spacing: -0.2px;
}
.primary,
.secondary,
.quiet {
  border-radius: 6px;
  padding: 0.55rem 0.95rem;
  line-height: 1.4;
}
.primary {
  color: var(--on-primary);
  background: var(--green);
  border: 1px solid var(--green);
}
.primary:hover {
  background: var(--primary-hover);
}
.secondary {
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--border);
}
.secondary:hover {
  background: var(--surface-2);
}
.quiet {
  border: 0;
  background: transparent;
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 670;
  letter-spacing: -0.6px;
}
.mark {
  display: flex;
  gap: 3px;
  align-items: center;
  width: 30px;
  height: 30px;
  justify-content: center;
  transform: skew(-10deg);
}
.mark b {
  width: 5px;
  height: 18px;
  background: currentColor;
  border-radius: 4px;
}
.mark b:first-child {
  height: 11px;
}
.mark b:nth-child(2) {
  height: 24px;
}
#login {
  min-height: 100vh;
  display: grid;
  place-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  border-radius: 17px;
  width: min(420px, 90vw);
  padding: 36px;
}
.login-card h1 {
  font-size: 32px;
  margin: 35px 0 22px;
}
.login-card form,
#policyForm {
  display: grid;
  gap: 10px;
}
.login-card .primary {
  margin-top: 5px;
}
#loginStatus {
  color: var(--danger);
  margin-top: 12px;
}
.signature {
  font-weight: 650;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 30px;
}
.top {
  background: var(--surface);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 65px;
  padding: 10px clamp(16px, 4vw, 68px);
}
.top .mark {
  color: var(--primary);
}
.identity {
  display: flex;
  align-items: center;
  gap: 10px;
}
#tenant {
  color: var(--text-2);
  margin-right: 14px;
}
.avatar {
  background: var(--brand-gradient);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.light {
  color: var(--text-2);
}
.tabs {
  background: var(--paper);
  padding: 0 clamp(16px, 4vw, 68px);
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  padding: 13px 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
}
.tabs button[aria-current="page"] {
  color: var(--green);
  border-color: var(--green);
}
#workspace {
  max-width: 1640px;
  margin: auto;
  padding: 26px clamp(14px, 4vw, 68px) 48px;
}
.heading,
.detail-title,
.section-head,
.composer-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.heading {
  margin: 4px 0 22px;
}
.label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  color: var(--muted);
  font-weight: 750;
  margin-bottom: 6px;
}
.board {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  display: grid;
  grid-template-columns: clamp(235px, 27vw, 350px) minmax(0, 1fr);
  min-height: 63vh;
  overflow: hidden;
}
.list-pane {
  background: var(--surface-3);
  border-right: 1px solid var(--border);
}
.filters {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 15px;
  border-bottom: 1px solid var(--border);
}
.filters select {
  padding: 5px;
  font-size: 12px;
}
.filters label {
  font-size: 12px;
  color: var(--muted);
}
#items {
  max-height: 70vh;
  overflow: auto;
}
.session {
  width: 100%;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  text-align: left;
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 17px 15px;
}
.session:hover {
  background: var(--surface-3);
}
.session[aria-pressed="true"] {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 var(--green);
}
.symbol {
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 750;
  font-size: 17px;
}
.symbol.sms {
  background: var(--info-soft);
  color: var(--info);
}
.symbol.email {
  background: var(--warning-soft);
  color: var(--warning);
}
.symbol.voice {
  background: var(--accent-soft);
  color: var(--accent);
}
.session .name {
  font-size: 14px;
  display: block;
}
.session small {
  display: block;
  font-size: 12px;
  font-weight: 450;
  color: var(--muted);
  margin-top: 2px;
}
.detail {
  padding: clamp(18px, 3vw, 34px);
  min-width: 0;
}
.empty {
  padding: 24px;
  color: var(--muted);
}
.detail > #empty {
  height: 100%;
  min-height: 150px;
  display: grid;
  place-items: center;
}
.pill {
  border-radius: 14px;
  padding: 4px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  padding: 15px 0;
}
.facts dt,
.eventtime,
#typing,
#policyHelp {
  font-size: 12px;
  color: var(--muted);
}
.facts dd {
  overflow-wrap: anywhere;
}
.controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.controls button {
  font-size: 12px;
  padding: 4px 9px;
}
.section-head {
  border-top: 1px solid var(--border);
  padding: 15px 0 8px;
}
.timeline {
  max-height: 35vh;
  overflow: auto;
  display: grid;
  gap: 7px;
  padding: 5px 3px;
}
.event {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.message {
  background: var(--surface-3);
  border-radius: 10px;
  padding: 9px 12px;
  max-width: 85%;
  width: fit-content;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.out {
  background: var(--surface-3);
  justify-self: end;
}
.eventtime {
  display: block;
  font-size: 10px;
  margin-top: 3px;
}
.composer-buttons {
  justify-content: flex-end;
  margin-top: 7px;
}
#reply label {
  display: block;
  margin-bottom: 5px;
}
#typing {
  height: 20px;
}
#notice {
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 6px;
}
.cards,
.reportgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.card {
  background: var(--paper);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.card strong.metric {
  font-size: 37px;
  display: block;
  letter-spacing: -1.5px;
}
.reportgrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}
.reportgrid h2 {
  font-size: 18px;
  margin-bottom: 14px;
}
.reportrow {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
#policy {
  font:
    13px/1.5 "IBM Plex Mono",
    monospace;
}
#savePolicy {
  justify-self: start;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (max-width: 680px) {
  .board {
    display: block;
  }
  .list-pane {
    border: 0;
    border-bottom: 1px solid var(--border);
  }
  #items {
    max-height: 180px;
  }
  .detail {
    padding: 15px;
  }
  .top {
    padding: 9px 14px;
  }
  .tabs {
    gap: 18px;
  }
  .identity {
    gap: 5px;
  }
  #actor,
  #tenant {
    display: none;
  }
  .cards,
  .reportgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .heading {
    margin-top: 0;
  }
  .timeline {
    max-height: 45vh;
  }
  .reportgrid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 14px;
  }
}

#files {
  border-top: 1px solid var(--border);
  padding: 10px 0 12px;
}
#files summary {
  cursor: pointer;
  color: var(--green);
  font-size: 13px;
  font-weight: 650;
}
#upload {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 8px 0;
}
#attachment {
  max-width: 100%;
  font-size: 12px;
  padding: 3px;
}
#fileStatus {
  font-size: 12px;
  color: var(--muted);
}
#filelist button {
  display: block;
  text-align: left;
}

.head-actions {
  display: flex;
  gap: 7px;
}
.head-actions button {
  white-space: nowrap;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: min(440px, 95vw);
  width: 440px;
  background: var(--paper);
  color: var(--ink);
  padding: 24px;
}
dialog::backdrop {
  background: var(--scrim);
}
#smsForm, #mailForm {
  display: grid;
  gap: 8px;
}
#smsForm .heading, #mailForm .heading {
  margin: 0 0 8px;
}
#smsStatus, #mailStatus {
  color: var(--danger);
  font-size: 13px;
}
@media (max-width: 480px) {
  .heading {
    align-items: flex-start;
  }
  .head-actions {
    flex-direction: column;
  }
  .head-actions button {
    font-size: 12px;
    padding: 4px 8px;
  }
}

#phonePanel {
  position: fixed;
  z-index: 70;
  right: clamp(10px, 4vw, 68px);
  top: 60px;
  width: min(355px, calc(100vw - 20px));
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
#phonePanel .phone-bar {
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid var(--border);
  padding: 4px 12px;
}
#hidePhone {
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  padding: 3px 5px;
  text-decoration: underline;
}
#phoneMount iframe {
  display: block;
  border: 0;
  width: 100%;
  height: min(510px, calc(100dvh - 110px));
}

#voiceMedia {
  margin: 12px 0;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
#voiceMedia summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--green);
}
#voiceMediaContents {
  padding: 10px 0;
}
#voiceMediaContents h3 {
  font-size: 14px;
}
#voiceMediaContents audio {
  width: 100%;
  max-width: 450px;
  margin-top: 7px;
}
#voiceTurns {
  max-height: 230px;
  overflow: auto;
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
#voiceTurns li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.voice-turn-label,
#voiceMediaStatus,
#recordingMeta,
#voiceNoTurns,
#recordingFeedback {
  font-size: 12px;
  color: var(--muted);
}
.voice-turn-text,
#afterText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.voice-media-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 13px 0 5px;
}

/* Switchboard tokens: brand, type scale and surfaces */
.mark {
  background: var(--brand-gradient);
  color: #fff;
}
.top {
  border-bottom: 1px solid var(--border);
}
h1 {
  font-size: 24px;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
}
.login-card h1 {
  font-size: 24px;
  margin: 24px 0 6px;
}
.login-card .muted {
  margin-bottom: 18px;
}
.login-card form {
  gap: 6px;
}
.login-card form label {
  margin-top: 8px;
}
.login-card form .primary {
  margin-top: 14px;
  min-height: 42px;
}
.login-advanced {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-3);
  padding: 12px 14px 14px;
  display: grid;
  gap: 6px;
}
.login-advanced-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}
.login-advanced label {
  margin-top: 4px;
}
.login-theme {
  position: absolute;
  top: 16px;
  right: 16px;
}
#login {
  position: relative;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
}
.theme-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
}
.signature b {
  font-weight: 600;
}
.mark {
  transform: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  gap: 3px;
}
.mark b {
  width: 3px;
  background: #fff;
}
.top .mark {
  color: #fff;
}
.top .quiet {
  text-decoration: none;
  border-radius: 8px;
}
.top .quiet:hover {
  background: var(--surface-3);
  text-decoration: none;
}
#myPresence {
  padding-left: clamp(16px, 4vw, 68px);
  padding-right: clamp(16px, 4vw, 68px);
}

/* ---- Agent workspace (H2): status rail · interaction · docked phone ---- */
.ws {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  height: calc(100dvh - 65px);
  min-height: 560px;
}
.ws-center {
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.ws-center #workspace {
  width: 100%;
  padding-top: 18px;
}
.has-workspace .board {
  min-height: 420px;
}
.ws-rail {
  width: 280px;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.ws-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.ws-card h2,
.ws-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ws-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.ws-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.ws-caption {
  font-size: 12px;
  color: var(--text-2);
}
.ws-error {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--danger);
}
.ws-error:empty {
  display: none;
}
#outcomeStatus {
  color: var(--text-2);
}
.ws-state-now {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ws-state-now .sb-dot {
  width: 12px;
  height: 12px;
  box-shadow: 0 0 0 4px var(--surface-3);
}
.ws-state-now strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-hint {
  margin: 8px 0 12px;
  font-size: 13px;
  color: var(--text-2);
  min-height: 20px;
}
.ws-state-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ws-state-actions #wsReady {
  grid-column: 1 / -1;
}
.ws-state-actions .sb-btn {
  width: 100%;
}
.ws-menu {
  position: relative;
}
.ws-menu summary {
  list-style: none;
}
.ws-menu summary::-webkit-details-marker {
  display: none;
}
.ws-menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.ws-menu-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
}
.ws-reason {
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 8px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-reason::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--away);
}
.ws-reason:hover,
.ws-reason:focus-visible {
  background: var(--surface-3);
  outline: none;
}
.ws-reason[aria-pressed="true"] {
  background: var(--away-soft);
}
.ws-stats {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ws-stats div {
  background: var(--surface-3);
  border-radius: 8px;
  padding: 8px 10px;
}
.ws-stats dt {
  font-size: 12px;
  color: var(--text-2);
}
.ws-stats dd {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ws-queues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ws-queues li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 13px;
  font-weight: 500;
}
.ws-queues li > span:first-child {
  flex: 1;
}
.ws-queues .ws-empty {
  font-weight: 400;
  color: var(--text-2);
}
.ws-open-phone {
  width: 100%;
}
.ws-interaction {
  margin: 18px clamp(14px, 3vw, 40px) 0;
  border-left: 3px solid var(--border-strong);
}
.ws-interaction.is-live {
  border-left-color: var(--primary);
}
.ix-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.ix-who h2 {
  font-size: 20px;
  margin: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}
.ix-who p {
  margin: 0;
}
.ix-timer {
  font-size: 16px;
}
.ix-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.ix-body > :not([hidden]) {
  margin-top: 14px;
}
.ix-script ol {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
.ix-script p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 13px;
}
.ix-outcome {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: var(--surface-3);
  border-radius: 10px;
}
.ix-outcome-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.ix-outcome p {
  margin: 0 0 4px;
}
.ix-outcome .sb-select,
.ix-outcome .sb-textarea,
.ix-outcome .sb-input {
  width: 100%;
}
.ix-callback {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 0;
}
.ix-callback legend {
  font-size: 12px;
  color: var(--text-2);
  padding: 0 4px;
}
.ix-outcome-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.ix-outcome-foot .ws-caption {
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 1100px) {
  .ws #phonePanel {
    position: static;
    width: 340px;
    border-radius: 0;
    border-width: 0 0 0 1px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .ws #phoneMount {
    flex: 1;
    min-height: 0;
  }
  .ws #phoneMount iframe {
    height: 100%;
  }
}
@media (max-width: 1099px) {
  .ws {
    display: block;
    height: auto;
  }
  .ws-rail {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .ws-rail > .ws-card {
    flex: 1 1 240px;
  }
  .ws-center {
    overflow: visible;
  }
}
