@import url('/leadrelay/tokens.css');
:root {
  font: 400 1rem/1.5 var(--sans);
  color: var(--ink);
  background: var(--canvas);
  scrollbar-color: var(--control) var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: #d6e3ff; }
body { margin: 0; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { color: var(--accent); }
button, input, textarea, summary { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:where(h1, h2, h3, p, dl, dd) { margin: 0; }
.wrap { width: min(100% - clamp(24px, 7vw, 104px), 1264px); margin-inline: auto; }
.top { border-bottom: 1px solid var(--line); background: var(--paper); }
.top-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .workspace-link {
  min-height: 44px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  text-decoration: none;
  font-weight: 600;
}
.brand { font-size: 1.2rem; letter-spacing: -.035em; }
.workspace-link { color: var(--sub); font-size: .875rem; text-align: right; }
.workspace-link span { font-size: 1rem; }
.intro {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
  padding: clamp(24px, 4vw, 38px) 0 23px;
}
h1 { font-size: clamp(24px, 3vw, 28px); line-height: 1.05; letter-spacing: -.045em; }
.intro p { margin: 8px 0 0; color: var(--sub); }
.source { position: relative; z-index: 1; flex: none; }
.button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.button:not(:disabled):hover { border-color: var(--control); background: var(--canvas); }
.button:disabled { color: #64728a; background: #eff2f7; }
.button.primary { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.button.primary:not(:disabled):hover { border-color: var(--deep); background: var(--deep); }
.button.primary:disabled { background: #5e6f97; border-color: #5e6f97; }
.text-button { border-color: transparent; padding-inline: 0; color: var(--accent); }
.text-button:not(:disabled):hover { text-decoration: underline; text-underline-offset: .22em; }
.source summary { list-style: none; }
.source summary::-webkit-details-marker { display: none; }
.source[open] > summary svg { transform: rotate(180deg); }
.source-menu {
  position: absolute;
  inset: calc(100% + 8px) 0 auto auto;
  display: grid;
  width: min(440px, calc(100vw - 24px));
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 12px 28px #152b5321;
}
.source-menu label { display: block; font-size: .875rem; font-weight: 600; }
.current { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; }
.current a, #source-list a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); overflow-wrap: anywhere; }
.current span, #source-count, #source-list { font-size: .875rem; color: var(--sub); }
#source-count { display: flex; align-items: center; min-height: 44px; gap: 7px; }
#source-count::before { content: ''; width: 7px; height: 7px; border-bottom: 1px solid; border-right: 1px solid; transform: rotate(-45deg); }
#sources[open] > #source-count::before { transform: rotate(45deg); }
#source-list { max-height: 170px; overflow-y: auto; margin: 0; padding-inline-start: 20px; }
.url-field { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin-top: 6px; }
.url-field input, #reply {
  border: 1px solid var(--control);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  background: var(--paper);
  caret-color: var(--accent);
}
.url-field input { min-width: 0; min-height: 44px; flex: 1 1 165px; }
.url-field input::placeholder, #reply::placeholder { color: var(--sub); }
.source-menu .source-status { margin: 0; overflow-wrap: anywhere; font-size: .875rem; }
.source-status[data-error], .operator-status[data-error] { color: var(--danger); }
.source-menu .text-button { justify-self: start; }
.mobile-jump, .mobile-return { display: none; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.split[data-expanded]:not([data-expanded=""]) { grid-template-columns: minmax(0, 1fr); }
.pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: max(580px, min(654px, calc(100dvh - 222px)));
  min-width: 0;
  overflow: hidden;
  scroll-margin-block: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.pane:focus { outline-offset: 3px; }
.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 59px;
  padding: 4px 10px 4px 15px;
  border-bottom: 1px solid var(--line);
}
.pane-head h2 { font-size: 1rem; font-weight: 700; }
.pane-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--wash);
}
.expand {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  margin-inline-start: auto;
  padding-inline: 8px;
  border: 0;
  border-radius: var(--radius);
  color: var(--sub);
  background: transparent;
  font-size: .875rem;
  font-weight: 600;
}
.expand:hover { color: var(--accent); background: var(--wash); }
.expand[aria-pressed='true'] .expand-icon, .expand[aria-pressed='false'] .restore-icon { display: none; }
.preview, .preview iframe { min-width: 0; width: 100%; height: 100%; }
.preview iframe { display: block; border: 0; background: #f7f1e7; }
.preview-state {
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  color: var(--sub);
  text-align: center;
}
.operator-content { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; min-height: 0; }
.record {
  display: grid;
  grid-template-columns: minmax(76px, .7fr) minmax(0, 1.65fr) minmax(0, 1.3fr);
  max-height: 132px;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.record:focus-visible { outline-offset: -2px; }
.record-cell { min-width: 0; padding: 13px clamp(8px, 1.4vw, 19px); }
.record-cell + .record-cell { border-left: 1px solid var(--line); }
.record-cell dt { margin-bottom: 5px; color: var(--sub); font: 400 .6875rem/1.4 var(--mono); letter-spacing: .03em; text-transform: uppercase; }
.record-cell dd { font-size: .875rem; overflow-wrap: anywhere; }
.record-cell dd strong { font-weight: 600; }
.record-cell dd > :is(span, time):not(.intent) { display: block; margin-top: 2px; color: var(--sub); font-size: .75rem; }
.intent { display: inline-block; padding: 2px 6px; border-radius: 8px; color: var(--sub); background: var(--wash); font-size: .75rem; font-weight: 700; }
.intent[data-intent='hot'] { color: var(--danger); background: color-mix(in srgb,var(--danger) 12%,var(--paper)); }
.intent[data-intent='warm'] { color: var(--warning); background: color-mix(in srgb,var(--warning) 12%,var(--paper)); }
.intent[data-intent='support'] { color: var(--info); background: var(--selection); }
.thread-head {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 13px 15px 10px;
}
.thread-head h3 { font-size: .9375rem; font-weight: 700; }
.connection { display: flex; gap: 6px; align-items: center; margin-inline-start: auto; color: var(--sub); font: 400 .6875rem/1.4 var(--mono); }
.connection::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.mode-note { flex-basis: 100%; color: var(--sub); font-size: .75rem; }
.timeline { min-height: 0; overflow-y: auto; padding: 0 15px 13px; }
.timeline:focus-visible { outline-offset: -2px; }
.empty {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  gap: 7px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  text-align: center;
}
.empty svg { margin-bottom: 2px; color: var(--accent); }
.empty strong { font-weight: 600; }
.empty p { color: var(--sub); font-size: .875rem; }
.messages { display: grid; gap: 13px; padding: 2px 0 1px 11px; border-left: 1px solid var(--line); }
.turn { position: relative; padding: 9px 10px; border-radius: var(--radius); background: var(--canvas); }
.turn::before { position: absolute; inset: 14px auto auto -16px; width: 7px; height: 7px; content: ''; border: 1px solid var(--control); border-radius: 50%; background: var(--paper); }
.turn[data-role='assistant']::before { border-color: var(--accent); background: var(--accent); }
.turn[data-role='human'] { background: var(--selection); }
.turn[data-role='human']::before { border-color: #4866a7; background: #9eb8ef; }
.turn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-bottom: 3px; }
.turn-meta strong { color: var(--sub); font: 400 .6875rem/1.4 var(--mono); text-transform: uppercase; }
.turn-text { max-width: 68ch; font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.mode { padding: 2px 5px; border-radius: 8px; color: var(--sub); background: var(--wash); font: 400 .6875rem/1.3 var(--mono); }
.mode[data-mode='ai'] { color: var(--deep); background: var(--wash); }
.current-mode { white-space: nowrap; }
.takeover { padding: 9px 15px; border-top: 1px solid var(--line); background: var(--canvas); }
.agent-control, #reply-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.agent-state { font-size: .875rem; font-weight: 700; }
.agent-info, .operator-status { color: var(--sub); font-size: .75rem; }
.operator-status { margin-top: 7px; }
#reply-form { align-items: end; margin-top: 8px; }
#reply { flex: 1 1 135px; min-width: 0; width: 100%; min-height: 44px; max-height: 105px; resize: vertical; font-size: .875rem; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 16px; padding: 8px 0 12px; color: var(--sub); font-size: .8125rem; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 920px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .pane { height: 644px; }
  .operator { height: 590px; }
  .operator .pane-head h2 { flex: 1; }
  .operator .expand { margin-inline-start: 0; }
  .mobile-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin: -4px 0 6px; }
  .mobile-jump a { display: inline-flex; min-height: 44px; gap: 6px; align-items: center; color: var(--accent); font-size: .875rem; }
  .mobile-return { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--accent); font-size: .75rem; line-height: 1.2; }
}
@media (max-width: 620px) {
  .intro { flex-direction: column; align-items: start; padding-bottom: 12px; }
  .source-menu { inset-inline: 0 auto; }
}
@media (max-width: 385px) {
  .pane-head { gap: 6px; padding-inline: 8px; }
  .expand span { display: none; }
  .operator { height: 624px; }
  .mobile-return { max-width: 90px; }
  .timeline, .thread-head, .takeover { padding-inline: 9px; }
  .record { grid-template-columns: minmax(65px, .6fr) minmax(0, 1.5fr) minmax(0, 1.15fr); max-height: 110px; }
}

.preset-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.preset { min-height:50px; border:1px solid var(--line); border-radius:var(--radius); padding:7px; color:var(--sub); background:var(--paper); text-align:left; }
.preset strong,.preset span { display:block; }
.preset strong { color:var(--ink); font-size:.875rem; }
.preset span { font-size:.75rem; }
.preset[aria-pressed="true"] { border-color:var(--accent); background:var(--wash); }
.live-receipt { min-width:0; border-top:1px solid var(--line); }
.live-receipt summary { display:flex; align-items:center; gap:7px; min-height:44px; padding:6px 12px; cursor:pointer; font-size:.8125rem; font-weight:600; }
.live-receipt summary::before { content:'▸'; color:var(--sub); }
.live-receipt[open] summary::before { content:'▾'; }
.live-receipt summary::-webkit-details-marker { display:none; }
#webhook-state { margin-left:auto; color:var(--sub); font:400 .6875rem/1.3 var(--mono); }
#webhook-state[data-result="ok"] { color:var(--success); }
#webhook-state[data-result="failed"] { color:var(--danger); }
.receipt-body { max-height:115px; overflow:auto; background:var(--canvas); border-top:1px solid var(--line); padding:8px 12px; font-size:.75rem; }
.receipt-body p,.receipt-body pre { margin:0; }
.receipt-header { padding:5px 0; }
.receipt-body code,.receipt-body pre { font:.75rem/1.45 var(--mono); overflow-wrap:anywhere; white-space:pre-wrap; }

.demo-steps {display:flex;flex-wrap:wrap;border-block:1px solid var(--line);margin:0 0 16px}
.demo-steps a {flex:1 1 190px;display:flex;align-items:center;gap:8px;min-height:44px;padding:6px;color:var(--sub);font-size:13px;font-weight:600;text-decoration:none}
.demo-steps i {display:grid;place-items:center;min-width:24px;height:24px;border:1px solid var(--control);border-radius:50%;font:12px var(--mono)}
.demo-steps [data-complete=true] i {background:var(--success);border-color:var(--success);color:white}
.turn-meta time {font:11px var(--mono);color:var(--sub)}
@media(max-width:600px){.demo-steps {display:grid;gap:0}.demo-steps a{min-height:44px}}

.demo-steps{align-items:center;gap:8px;background:var(--paper);border:1px solid var(--line);border-radius:14px;padding:6px 10px;box-shadow:var(--shadow-sm)}#demo-progress{font:600 13px var(--mono);color:var(--sub);padding:0 8px}.demo-steps a{min-height:44px;border-radius:20px;padding:6px 10px}.demo-steps [data-complete=true]{color:var(--success);background:color-mix(in srgb,var(--success) 10%,var(--paper))}.demo-steps [data-complete=true] i{color:var(--paper)}
.receipt-body{max-height:210px}.receipt-body pre{background:#19263c;color:#e3eaf8;padding:12px;border-radius:8px}.live-receipt #webhook-state[data-result]{border-radius:16px;padding:2px 6px;background:var(--wash)}

@media(min-width:761px) and (pointer:fine){
  .button,.text-button,.head-tool,.tools button,.detail button,.detail select,.detail input,.receipt-tools button,.demo-steps a{min-height:36px;padding-block:4px}.head-tool{min-width:36px}
}
