:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --ink: #111827;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #d9dee7;
  --line-strong: #c7ceda;
  --teal: #0f766e;
  --teal-soft: #e7f4f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --red: #b42318;
  --green: #067647;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  height: 100vh;
  padding: 18px;
  background: #111827;
  color: #f9fafb;
}

.brand,
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand > span,
.sidebar-status > span {
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: #1f2937;
  color: #5eead4;
}

.brand strong,
.brand small,
.sidebar-status strong,
.sidebar-status small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand small,
.sidebar-status small {
  margin-top: 2px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.2;
}

.sidebar-status strong {
  font-size: 13px;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 10px;
  background: transparent;
  color: #d1d5db;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #1f2937;
  color: #ffffff;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #9ca3af;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: #5eead4;
}

.sidebar-status {
  min-height: 58px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}

.workspace {
  display: grid;
  gap: 16px;
  padding: 18px;
  min-width: 0;
}

.workspace-top,
.metric-strip,
.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workspace-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 16px 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

h3 {
  font-size: 13px;
  line-height: 1.2;
}

.workspace-top p,
.surface-heading p,
.call-header p,
label,
dt,
.empty,
.summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.state-chip,
.status-dot,
.mini-chip {
  display: inline-grid;
  place-items: center;
  min-width: 92px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(15, 118, 110, 0.22);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.state-chip.listening,
.state-chip.hearing {
  background: #ecfdf3;
  color: var(--green);
}

.state-chip.speaking {
  background: var(--blue-soft);
  color: var(--blue);
}

.state-chip.processing {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-dot.ready {
  min-width: 50px;
  height: 28px;
}

.mini-chip {
  min-width: 74px;
  height: 28px;
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.metric-strip article {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.metric-strip article:last-child {
  border-right: 0;
}

.metric-strip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-strip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  line-height: 1.2;
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(380px, 1.18fr) 320px;
  gap: 16px;
  align-items: start;
}

.surface {
  min-width: 0;
}

.surface-heading,
.call-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.surface-heading.compact {
  padding-bottom: 12px;
}

.assistant-card,
.call-setup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.call-setup {
  border-top: 1px solid var(--line);
}

.agent-provisioner {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

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

.provisioner-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.agent-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.agent-actions button {
  min-width: 0;
  padding: 0 10px;
}

.agent-list {
  display: grid;
  gap: 8px;
}

.agent-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agent-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.agent-list button.active {
  border-color: rgba(37, 99, 235, 0.36);
  background: var(--blue-soft);
}

.agent-list strong,
.agent-list small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-list small {
  color: var(--muted);
  font-size: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 750;
}

label.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 10px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
}

#openingLine {
  min-height: 92px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.8);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.setup-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 40px;
}

.primary-action,
.secondary-action,
.composer button,
.control-button,
.native-voice-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action,
.composer button,
.control-button.primary {
  background: var(--teal);
}

.secondary-action,
.native-voice-actions button {
  background: var(--blue);
}

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

.call-panel {
  display: grid;
  grid-template-rows: auto minmax(420px, 58vh) auto auto auto;
}

.waveform {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  min-width: 86px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.waveform span {
  width: 4px;
  border-radius: 999px;
  background: var(--teal);
}

.waveform span:nth-child(1) { height: 10px; }
.waveform span:nth-child(2) { height: 18px; }
.waveform span:nth-child(3) { height: 24px; }
.waveform span:nth-child(4) { height: 14px; }
.waveform span:nth-child(5) { height: 22px; }
.waveform span:nth-child(6) { height: 12px; }

.transcript {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 16px;
  background: linear-gradient(180deg, #fbfcfd 0%, #ffffff 100%);
}

.empty {
  display: grid;
  gap: 4px;
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
}

.empty strong {
  color: var(--ink);
  font-size: 14px;
}

.turn {
  max-width: min(740px, 86%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.turn strong {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.turn p {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.45;
}

.turn.agent {
  border-color: rgba(15, 118, 110, 0.24);
  background: var(--teal-soft);
}

.turn.caller {
  justify-self: end;
  border-color: rgba(37, 99, 235, 0.22);
  background: var(--blue-soft);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.controls,
.native-voice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 14px;
}

.native-voice-actions {
  padding-bottom: 16px;
}

.control-button {
  background: #344054;
}

.control-button.listening {
  background: var(--green);
}

.control-button.recording,
.control-button.danger {
  background: var(--red);
}

.details {
  display: grid;
  gap: 14px;
  padding-bottom: 16px;
}

.state-list,
.mini-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0 16px;
}

.state-list div,
.mini-list div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.mini-list {
  padding: 0;
}

.details section {
  display: grid;
  gap: 10px;
  padding: 0 16px;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.summary {
  min-height: 154px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.integration-panel {
  padding-bottom: 16px;
}

.knowledge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}

.knowledge-list span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 800;
}

.webhook-list,
.recent-calls {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.webhook-list div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.webhook-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: #344054;
  font-size: 12px;
}

.copy-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.recent-calls button {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.recent-calls strong,
.recent-calls span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-calls span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1260px) {
  .console-grid {
    grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  }

  .details {
    grid-column: 1 / -1;
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-status {
    display: none;
  }

  .console-grid,
  .integration-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-strip article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 12px;
  }

  .workspace-top,
  .surface-heading,
  .call-header {
    flex-direction: column;
  }

  .assistant-card,
  .call-setup,
  .agent-actions,
  .setup-actions,
  .controls,
  .native-voice-actions,
  .composer,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .call-panel {
    grid-template-rows: auto minmax(320px, 52vh) auto auto auto;
  }

  .turn {
    max-width: 100%;
  }

  .state-list div,
  .mini-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
