/* Yunban control system: shared by console, administration and agent. */
:root {
  --control-brand: #3457d5;
  --control-brand-hover: #2846b5;
  --control-border: #c9d2e3;
  --control-ring: #3457d5;
  --control-radius: 10px;
}
button { font-family: inherit; touch-action: manipulation; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--control-ring);
  outline-offset: 3px;
}
button.primary, button.ghost, button.new-chat, button.ag-send {
  min-height: 40px;
  border-radius: var(--control-radius);
  font-weight: 600;
  line-height: 1.4;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
button.primary, button.new-chat, button.ag-send {
  background: var(--control-brand);
  color: #fff;
  box-shadow: 0 1px 2px #16234b1a;
}
button.primary:hover:not(:disabled), button.new-chat:hover:not(:disabled),
button.ag-send:hover:not(:disabled) {
  background: var(--control-brand-hover);
  opacity: 1;
  box-shadow: 0 3px 8px #2846b524;
}
button.primary:active:not(:disabled), button.new-chat:active:not(:disabled),
button.ag-send:active:not(:disabled) { background: #203a98; box-shadow: inset 0 2px 3px #0002; }
button.ghost { background: #fff; color: #2948b8; border: 1px solid var(--control-border); }
button.ghost:hover:not(:disabled) { background: #f0f4ff; border-color: #7890de; }
button.ghost:active:not(:disabled) { background: #e5ecff; }
button.link { min-height: 32px; padding: 4px 6px; color: #2948b8; border-radius: 6px; }
button.link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
button:disabled { cursor: not-allowed; }
button.primary:disabled, button.new-chat:disabled, button.ag-send:disabled {
  background: #e2e7ef; color: #626f83; box-shadow: none; opacity: 1;
}
button.ghost:disabled { background: #f4f6f9; color: #707b8c; border-color: #d6dce6; opacity: 1; }
button.link:disabled { color: #707b8c; text-decoration: none; }
button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]::before {
  content: ""; display: inline-block; width: 12px; height: 12px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: control-spin 800ms linear infinite;
}
@keyframes control-spin { to { transform: rotate(360deg); } }

/* Keep the native input focus, checked state, label and Space interaction. */
.switch, .ag-tools .switch {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; color: #44516a; cursor: pointer;
}
.switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: 0 0 40px; width: 40px; height: 24px;
  margin: 0; padding: 0; border: 1px solid #8492a9;
  border-radius: 999px; background: #8492a9; cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.switch input[type="checkbox"]::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 2px; top: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px #18234c33; transition: transform 160ms ease;
}
.switch input[type="checkbox"]:checked { background: var(--control-brand); border-color: var(--control-brand); }
.switch input[type="checkbox"]:checked::before { transform: translateX(16px); }
.switch input[type="checkbox"]:disabled { opacity: .55; cursor: not-allowed; }
.switch:has(input:disabled) { cursor: not-allowed; color: #707b8c; }

/* Opt-in ranges; do not introduce unsupported model parameters. */
.yb-range { --range-fill: 0%; width: 100%; min-width: 0; height: 44px; margin: 0;
  padding: 0; border: none; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.yb-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--control-brand) var(--range-fill), #dce3ef var(--range-fill));
}
.yb-range::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 22px; height: 22px;
  margin-top: -8px; border: 3px solid var(--control-brand); border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px #18234c26;
}
.yb-range::-moz-range-track { height: 6px; border-radius: 999px; background: #dce3ef; }
.yb-range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--control-brand); }
.yb-range::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--control-brand); border-radius: 50%; background: #fff; }
.yb-range:disabled { opacity: .5; cursor: not-allowed; }
@media (pointer: coarse) {
  button.primary, button.ghost, button.new-chat, button.ag-send, button.link { min-height: 44px; }
  button.ag-send { min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  button, .switch input[type="checkbox"], .switch input[type="checkbox"]::before { transition: none; }
  button[aria-busy="true"]::before { animation: none; border-style: dotted; }
}
@media (forced-colors: active) {
  .switch input[type="checkbox"] { appearance: auto; -webkit-appearance: auto; }
  .switch input[type="checkbox"]::before { display: none; }
  .yb-range { appearance: auto; -webkit-appearance: auto; }
}
