@import url("./tokens.css");

html.ibc-desk-on .top-scroll { display: none !important; }
html.ibc-desk-sheet {
  overflow: hidden;
}
html.ibc-desk-sheet body {
  overflow: hidden;
}

#ibc-desk {
  font-family: var(--desk-font-body);
  color: var(--desk-ink);
  -webkit-font-smoothing: antialiased;
}
#ibc-desk button,
#ibc-desk input {
  font: inherit;
  color: inherit;
}
#ibc-desk button,
#ibc-desk a {
  -webkit-tap-highlight-color: transparent;
}
#ibc-desk button {
  cursor: pointer;
  border: 0;
  border-radius: 0;
  background: none;
}
#ibc-desk a {
  color: inherit;
  text-underline-offset: 4px;
}
#ibc-desk a:hover,
#ibc-desk button:hover {
  color: var(--desk-accent);
}
#ibc-desk button:focus-visible,
#ibc-desk a:focus-visible,
#ibc-desk input:focus-visible {
  outline: 2px solid var(--desk-accent);
  outline-offset: 4px;
}
#ibc-desk p,
#ibc-desk h2 {
  margin: 0;
}
#ibc-desk h2 {
  font-family: var(--desk-font-heading);
  font-weight: 400;
  letter-spacing: var(--desk-heading-tracking);
}
#ibc-desk .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#ibc-desk .agent-glyph {
  width: 48px;
  height: 48px;
  flex: none;
  fill: none;
  stroke: var(--desk-ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#ibc-desk .agent-glyph .g-ink { stroke: var(--desk-ink); }

#ibc-desk .live-dot {
  width: 20px;
  height: 20px;
  flex: none;
  overflow: visible;
  color: var(--desk-accent);
}
#ibc-desk .pulse-core { fill: currentColor; }
#ibc-desk .pulse-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  transform-origin: center;
  animation: desk-pulse var(--desk-dot-cycle-ms) linear infinite;
}
#ibc-desk .pulse-ring.second { animation-delay: var(--desk-dot-offset-ms); }
@keyframes desk-pulse {
  from { r: 7; opacity: 0.45; }
  to { r: 30; opacity: 0; }
}

#ibc-desk .desk-launcher {
  position: fixed;
  right: var(--desk-edge);
  bottom: var(--desk-bottom, var(--desk-edge));
  z-index: 40;
  background: var(--desk-surface);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  text-align: left;
}
#ibc-desk [hidden] { display: none !important; }
#ibc-desk .desk-launcher .agent-glyph { width: 32px; height: 32px; }
#ibc-desk .launcher-title {
  font: 26px var(--desk-font-heading);
  white-space: nowrap;
}
#ibc-desk .launcher-count {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
#ibc-desk .launcher-open {
  width: 20px;
  height: 20px;
  margin-left: 8px;
  display: block;
  flex-shrink: 0;
}
#ibc-desk .launcher-open svg {
  display: block;
  width: 100%;
  height: 100%;
}

#ibc-desk .desk-panel {
  position: fixed;
  inset: auto var(--desk-edge) var(--desk-bottom, var(--desk-edge)) auto;
  z-index: var(--desk-z-desktop);
  width: var(--desk-width);
  max-width: calc(100vw - 48px);
  height: var(--desk-height);
  max-height: var(--desk-available-height, calc(100dvh - var(--nav-h) - 48px));
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: var(--desk-surface);
  color: var(--desk-ink);
  overflow: hidden;
  outline: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--desk-open-ms) ease, transform var(--desk-open-ms) var(--desk-motion-ease);
}
#ibc-desk .desk-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}
#ibc-desk .desk-panel.is-closing {
  transition-duration: var(--desk-close-ms);
  opacity: 0;
  transform: translateY(12px);
}

#ibc-desk .desk-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 32px 24px;
  flex-shrink: 0;
}
#ibc-desk .desk-name {
  font: 400 32px/1 var(--desk-font-heading);
  letter-spacing: -0.02em;
}
#ibc-desk .desk-meta {
  margin-top: 6px;
  font: 12px var(--desk-font-meta);
  color: var(--desk-muted);
  letter-spacing: 0.04em;
}
#ibc-desk .desk-header-actions {
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}
#ibc-desk .desk-back {
  font: 12px var(--desk-font-meta);
  letter-spacing: 0.04em;
  color: var(--desk-muted);
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  align-self: flex-start;
  margin-top: -6px;
}
#ibc-desk .desk-close {
  font: 300 30px/1 var(--desk-font-body);
  width: 44px;
  height: 44px;
  align-self: flex-start;
  margin: -6px -10px 0 0;
}
#ibc-desk .desk-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
  padding: 12px 40px 32px;
}
#ibc-desk .desk-stage {
  transition: opacity var(--desk-open-ms) var(--desk-motion-ease), transform var(--desk-open-ms) var(--desk-motion-ease);
}
#ibc-desk .desk-stage.is-leaving,
#ibc-desk .desk-stage.is-entering {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
#ibc-desk .desk-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 13px var(--desk-font-meta);
  color: var(--desk-accent);
  margin-bottom: 32px;
}
#ibc-desk .welcome-title {
  font-size: 44px;
  line-height: 1.04;
  margin-bottom: 20px;
}
#ibc-desk .desk-body {
  font-size: 20px;
  line-height: 1.5;
  color: var(--desk-muted);
}
#ibc-desk .suggestions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 32px;
  gap: 0;
}
#ibc-desk .suggestions button {
  font-size: 18px;
  line-height: 1.5;
  text-align: left;
  min-height: 48px;
  padding: 9px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
#ibc-desk .suggestions button span {
  color: var(--desk-accent);
  flex-shrink: 0;
}
#ibc-desk .desk-composer {
  padding: 0 40px 24px;
  flex-shrink: 0;
  background: var(--desk-surface);
}
#ibc-desk .input-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--desk-rule);
  min-height: var(--desk-input-min-height);
  gap: 8px;
}
#ibc-desk .input-row input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  font-size: 18px;
  padding: 14px 0;
  outline: none;
}
#ibc-desk .input-row:focus-within { border-color: var(--desk-accent); }
#ibc-desk .input-row input::placeholder {
  color: var(--desk-muted);
  opacity: 1;
}
#ibc-desk .input-row button {
  width: 44px;
  height: 44px;
  font-size: 28px;
}
#ibc-desk .input-row button:disabled {
  opacity: 0.45;
  cursor: default;
}
#ibc-desk .desk-footnote {
  margin-top: 16px;
  font: 12px var(--desk-font-meta);
  color: var(--desk-muted);
}
#ibc-desk .composer-meta {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
#ibc-desk .composer-meta .desk-footnote {
  margin-top: 0;
}
#ibc-desk .desk-quota {
  font: 12px var(--desk-font-meta);
  color: var(--desk-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
#ibc-desk .question-label {
  font: 12px var(--desk-font-meta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--desk-muted);
  margin-bottom: 12px;
}
#ibc-desk .user-question { margin-bottom: 28px; }
#ibc-desk .user-question > p:last-child {
  font: 400 30px/1.18 var(--desk-font-heading);
  letter-spacing: -0.02em;
}
#ibc-desk .wire-body {
  font-size: 22px;
  line-height: 1.5;
  color: var(--desk-ink);
}
#ibc-desk .source-row { margin-top: 24px; }
#ibc-desk .source-row a {
  font: 13px/1.5 var(--desk-font-meta);
  color: var(--desk-muted);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  text-decoration: none;
}
#ibc-desk .source-row a:hover {
  text-decoration: underline;
  color: var(--desk-accent);
}
#ibc-desk .source-row a span {
  font-family: var(--desk-font-body);
  font-size: 20px;
  color: var(--desk-accent);
}
#ibc-desk .handback {
  margin-top: 24px;
  font: 400 28px/1.16 var(--desk-font-heading);
  letter-spacing: -0.02em;
  color: var(--desk-accent);
}
#ibc-desk .follow-choices {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 16px;
  gap: 0;
}
#ibc-desk .follow-choices.is-long {
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  margin-right: -8px;
}
#ibc-desk .follow-choices button {
  font-size: 18px;
  line-height: 1.5;
  text-align: left;
  min-height: 48px;
  padding: 9px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
#ibc-desk .follow-choices button span {
  color: var(--desk-accent);
  flex-shrink: 0;
}
#ibc-desk .follow-choices button:disabled {
  opacity: 0.45;
  cursor: default;
}
#ibc-desk .thinking-line {
  display: block;
  font: 22px/1.5 var(--desk-font-heading);
  color: var(--desk-muted);
  margin-top: 32px;
}
#ibc-desk .terminal-state { margin-top: 40px; }
#ibc-desk .terminal-state h2 {
  font-size: 44px;
  line-height: 1.04;
  max-width: 14ch;
}
#ibc-desk .terminal-state > p {
  font-size: 20px;
  line-height: 1.5;
  color: var(--desk-muted);
  margin-top: 20px;
}
#ibc-desk .after-state { margin-top: 0; }
#ibc-desk .after-state .coverage-window {
  font: 13px/1.5 var(--desk-font-meta);
  margin-top: 40px;
  color: var(--desk-accent);
}
#ibc-desk .retry-button {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 0;
  margin-top: 12px;
  min-height: 48px;
  font-size: 20px;
  color: var(--desk-accent);
}
#ibc-desk .terminal-footer { padding-bottom: 32px; }
#ibc-desk .turn.is-fresh .wire-block {
  animation: wire-arrival var(--desk-arrival-ms) ease-out both;
}
#ibc-desk .turn.is-fresh .source-row { animation-delay: 200ms; }
#ibc-desk .turn.is-fresh .source-row:nth-of-type(2) { animation-delay: 200ms; }
#ibc-desk .turn.is-fresh .handback { animation-delay: 400ms; }
#ibc-desk .is-still .pulse-ring { display: none; }
@keyframes wire-arrival {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 899px) {
  #ibc-desk .desk-launcher {
    display: grid;
    grid-template-columns: 32px 1fr 24px;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom, 0px);
    padding: 16px 24px;
    min-height: 76px;
  }
  #ibc-desk .desk-launcher .agent-glyph {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 32px;
    height: 32px;
  }
  #ibc-desk .launcher-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 26px;
  }
  #ibc-desk .launcher-count {
    grid-column: 2;
    grid-row: 2;
    font-size: 13px;
  }
  #ibc-desk .desk-launcher .launcher-open {
    grid-column: 3;
    grid-row: 1 / 3;
    margin-left: 0;
    width: 24px;
    height: 24px;
    align-self: center;
  }
  #ibc-desk .desk-launcher .live-dot {
    width: 16px;
    height: 16px;
  }
  #ibc-desk .desk-panel {
    inset: var(--desk-vv-top, 0px) 0 auto 0;
    width: 100%;
    max-width: none;
    height: var(--desk-vv-height, 100dvh);
    max-height: none;
    z-index: var(--desk-z-mobile);
    background: var(--desk-page);
    transform: translateY(24px);
  }
  #ibc-desk .desk-panel.is-open { transform: none; }
  #ibc-desk .desk-panel.is-closing { transform: translateY(24px); }
  #ibc-desk .desk-header {
    padding: calc(24px + env(safe-area-inset-top, 0px)) 24px 24px;
    gap: 8px;
  }
  #ibc-desk .desk-header .agent-glyph { width: 40px; height: 40px; }
  #ibc-desk .desk-scroll { padding: 16px 24px 28px; }
  #ibc-desk .desk-status { font-size: 12px; }
  #ibc-desk .desk-composer {
    background: var(--desk-page);
    padding: 0 24px calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  #ibc-desk *,
  #ibc-desk *::before,
  #ibc-desk *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
  #ibc-desk .pulse-ring { display: none; }
  #ibc-desk .desk-panel,
  #ibc-desk .desk-panel.is-closing {
    transform: none;
  }
}
