/* AutoTalk has fixed chrome and navigation; only the selected view scrolls. */
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] {
  box-sizing: border-box !important;
  position: fixed !important;
  inset: 6px !important;
  margin: auto !important;
  transform: none !important;
  translate: none !important;
  width: min(920px, calc(calc(100 * var(--surface-vw, 1vw)) - 12px)) !important;
  max-width: calc(calc(100 * var(--surface-vw, 1vw)) - 12px) !important;
  height: min(760px, calc(calc(100 * var(--surface-vh, 1dvh)) - 12px)) !important;
  max-height: calc(calc(100 * var(--surface-vh, 1dvh)) - 12px) !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
}
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"][hidden] { display: none !important; }
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] > .modal-chrome-header {
  position: relative !important;
  inset: auto !important;
  flex: 0 0 auto !important;
  min-height: 38px !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px !important;
}
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] > .modal-body {
  position: relative !important;
  inset: auto !important;
  align-self: stretch !important;
  min-width: 0 !important;
  display: block !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  padding: 0 !important;
  touch-action: pan-y;
  overscroll-behavior: contain;
  scrollbar-gutter: stable !important;
  scrollbar-width: auto !important;
  scrollbar-color: var(--ux-muted) var(--ux-field-surface);
}
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] .auto-talk-content::-webkit-scrollbar { display:block !important; width:12px !important; }
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] .auto-talk-content::-webkit-scrollbar-thumb { background:var(--ux-muted); border:3px solid var(--ux-field-surface); border-radius:8px; }
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] .modal-module-card,
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] :is(#module-extra-fields, [data-replica-id="module-extra-fields"]) {
  display: block !important;
  position: static !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  transform: none !important;
}
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] :is(#module-rule-list, [data-replica-id="module-rule-list"]) { display:none !important; }
:is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] {
  .auto-talk-workspace { display:grid; grid-template-columns:168px minmax(0,1fr); height:100%; min-height:0; min-width:0; color:var(--ux-text); background:transparent; font-size:12px; line-height:1.45; }
  .auto-talk-nav { display:flex; flex-direction:column; gap:3px; padding:14px 10px; border-right:1px solid rgba(255,255,255,.08); background:rgba(8,10,11,.42); }
  .auto-talk-nav::before { content:"SETUP"; padding:0 9px 8px; color:var(--modal-color-muted); font-size:9px; font-weight:800; letter-spacing:.16em; }
  .auto-talk-nav :is(button, a[data-replica-control]) { display:grid; grid-template-columns:22px minmax(0,1fr); align-items:center; gap:8px; min-height:38px; padding:7px 9px; border:1px solid transparent; border-radius:4px; background:transparent; color:var(--modal-color-label); font:600 11px/1.2 inherit; text-align:left; cursor:pointer; transition:background 120ms ease,color 120ms ease,border-color 120ms ease; }
  .auto-talk-nav :is(button, a[data-replica-control]):hover { color:var(--ux-text); background:rgba(255,255,255,.045); }
  .auto-talk-nav :is(button, a[data-replica-control])[aria-pressed="true"] { color:var(--modal-color-title); background:var(--ux-field-surface-hover); border-color:var(--ux-field-border-hover); box-shadow:inset 2px 0 var(--ux-accent); }
  .auto-talk-nav-index { display:grid; place-items:center; width:20px; height:20px; border:1px solid rgba(255,255,255,.11); border-radius:50%; color:var(--modal-color-muted); font-size:9px; font-variant-numeric:tabular-nums; }
  .auto-talk-nav :is(button, a[data-replica-control])[aria-pressed="true"] .auto-talk-nav-index { border-color:var(--ux-field-border-hover); color:var(--modal-color-title); }
  .auto-talk-content { min-height:0; min-width:0; overflow-x:hidden; overflow-y:scroll; overscroll-behavior:contain; scrollbar-gutter:stable; scrollbar-width:auto; scrollbar-color:var(--ux-muted) var(--ux-field-surface); padding:20px 22px 28px; }
  .auto-talk-ai-settings { display:grid; gap:6px; margin:0 0 16px; padding:10px; border:1px solid rgba(255,255,255,.08); border-radius:5px; background:rgba(255,255,255,.025); }
  .auto-talk-ai-style-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; min-width:0; }
  .auto-talk-persona-traits { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; min-width:0; }
  .auto-talk-ai-key .antibot-key { display:grid; gap:6px; }
  .auto-talk-ai-key .antibot-key-heading, .auto-talk-ai-key .antibot-key-controls { display:flex; align-items:center; gap:6px; }
  .auto-talk-ai-key .antibot-key-heading { justify-content:space-between; }
  .auto-talk-ai-key .antibot-key-controls input { flex:1; }
  .auto-talk-ai-key .antibot-key-controls :is(button, a[data-replica-control]) { flex:none; }
  .auto-talk-content > [hidden] { display:none !important; }
  .auto-talk-group { min-width:0; margin:0 0 18px; border:0; padding:0; background:transparent; }
  .auto-talk-section-heading { display:flex; align-items:center; gap:10px; margin:0 0 9px; color:var(--modal-color-title); font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
  .auto-talk-section-heading::after { content:""; height:1px; flex:1; background:rgba(255,255,255,.08); }
  .auto-talk-group > summary { cursor:pointer; margin-top:8px; padding:9px 11px; border:1px solid rgba(255,255,255,.08); border-radius:4px; color:var(--modal-color-label); background:rgba(255,255,255,.025); font-size:11px; font-weight:700; }
  .auto-talk-group > summary:hover { background:rgba(255,255,255,.05); }
  .auto-talk-group[open] > summary { border-radius:4px 4px 0 0; border-bottom-color:transparent; }
  .auto-talk-group[open] > .auto-talk-group-body { padding:10px; border:1px solid rgba(255,255,255,.08); border-top:0; border-radius:0 0 4px 4px; }
  .auto-talk-group-body { min-width:0; }
  .auto-talk-policy-table { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .auto-talk-policy-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; min-width:0; margin:0; padding:10px; border:1px solid rgba(255,255,255,.08); border-radius:5px; background:rgba(255,255,255,.025); }
  .auto-talk-policy-row legend { padding:0 5px; color:var(--modal-color-title); font-size:11px; font-weight:800; }
  .auto-talk-policy-toggles { grid-column:1 / -1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding-bottom:6px; border-bottom:1px solid rgba(255,255,255,.06); }
  .auto-talk-policy-toggles label { padding:4px 6px; border-radius:3px; background:rgba(0,0,0,.16); }
  .auto-talk-fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:8px; }
  .auto-talk-source-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)) minmax(160px,1.6fr); gap:6px; align-items:center; }
  .auto-talk-source-row > .auto-talk-check { min-height:30px; padding:4px 7px; border:1px solid rgba(255,255,255,.07); border-radius:4px; background:rgba(255,255,255,.025); }
  .auto-talk-channel-field { display:grid !important; grid-template-columns:auto minmax(0,1fr); align-items:center !important; gap:7px !important; }
  .auto-talk-guardrail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .auto-talk-guardrail-card { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:start; gap:7px 12px; min-width:0; padding:10px; border:1px solid rgba(255,255,255,.08); border-radius:5px; background:rgba(255,255,255,.025); }
  .auto-talk-guardrail-card h4 { grid-column:1 / -1; margin:0 0 3px; padding-bottom:7px; border-bottom:1px solid rgba(255,255,255,.07); color:var(--ux-text); font-size:11px; }
  .auto-talk-nearby-card { grid-column:1 / -1; grid-template-columns:repeat(3,minmax(0,1fr)); }
  .auto-talk-guardrail-card > label { min-height:30px; }
  .auto-talk-safety-layout { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .auto-talk-state-card { grid-column:1 / -1; }
  .auto-talk-state-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; }
  .auto-talk-state-grid label { padding:4px 7px; border-radius:3px; background:rgba(0,0,0,.16); }
  .auto-talk-workspace label { display:flex; flex-direction:column; align-items:stretch; gap:4px; min-width:0; color:var(--modal-color-label); font-size:10px; font-weight:650; }
  .auto-talk-workspace label:has(input[type="checkbox"]) { flex-direction:row; align-items:center; justify-content:space-between; gap:8px; min-height:30px; cursor:pointer; }
  .auto-talk-workspace :is(input,select,textarea) { box-sizing:border-box; width:100% !important; min-width:0 !important; max-width:100%; min-height:30px; padding:5px 7px; border-color:rgba(255,255,255,.12); background:var(--modal-color-field); color:var(--ux-text); font:inherit; }
  .auto-talk-workspace textarea { resize:vertical; line-height:1.45; }
  .auto-talk-workspace input[type="checkbox"] { appearance:none !important; width:15px !important; height:15px !important; min-height:15px; margin:0; padding:0; flex:none; border:1px solid var(--ux-field-border); border-radius:3px; background:var(--ux-field-surface); box-shadow:none; cursor:pointer; }
  .auto-talk-workspace input[type="checkbox"]:checked { border-color:rgba(127,196,106,.82); background-color:rgba(44,91,39,.92); background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m3.5 8 3 3 6-6'/%3E%3C/svg%3E"); background-size:13px; background-position:center; background-repeat:no-repeat; }
  .auto-talk-workspace :is(input,select,textarea,:is(button, a[data-replica-control]),summary):focus-visible { outline:2px solid var(--ux-accent); outline-offset:2px; }
  .auto-talk-workspace .btn { min-height:32px; flex-shrink:0; }
  .auto-talk-note { margin:8px 0; color:var(--modal-color-muted); font-size:10px; line-height:1.5; }
  .auto-talk-rules-bar { display:flex; gap:10px; flex-wrap:wrap; align-items:end; margin-bottom:10px; }
  .auto-talk-rules-bar > :is(label,select) { flex:1 1 180px; width:auto !important; }
  .auto-talk-answer { display:grid; grid-template-columns:78px minmax(100px,1fr) 58px auto; gap:8px; align-items:end; padding:10px; margin-bottom:8px; border:1px solid rgba(255,255,255,.08); border-radius:5px; background:rgba(255,255,255,.025); }
  .auto-talk-answer-text { grid-column:1 / -1; grid-row:1; }
  .auto-talk-answer-text textarea { min-height:64px; }
  .auto-talk-answer > :is(button, a[data-replica-control]) { grid-column:4; }
  .auto-talk-workspace pre { min-height:94px; white-space:pre-wrap; overflow-wrap:anywhere; padding:11px; border:1px solid rgba(255,255,255,.08); border-radius:5px; color:var(--modal-color-label); background:var(--modal-color-field); font:10px/1.55 monospace; margin:8px 0; }
  .auto-talk-history-row { display:grid; gap:3px; padding:9px 10px; margin-bottom:5px; border:1px solid rgba(255,255,255,.07); border-radius:4px; background:rgba(255,255,255,.02); overflow-wrap:anywhere; }
  [data-at-errors] { color:#ffbf8c; padding:10px; border:1px solid currentColor; border-radius:4px; }
}
@container ui-surface (max-width:650px) {
  :is(#modal-layer, [data-replica-id="modal-layer"]) > :is(#modal-module, [data-replica-id="modal-module"]):is(#modal-module, [data-replica-id="modal-module"])[data-active-module-key="autoTalk"] {
    .auto-talk-workspace { grid-template-columns:1fr; grid-template-rows:auto minmax(0,1fr); }
    .auto-talk-nav { flex-direction:row; padding:7px; border-right:0; border-bottom:1px solid rgba(255,255,255,.08); }
    .auto-talk-nav::before,.auto-talk-nav-index { display:none; }
    .auto-talk-nav :is(button, a[data-replica-control]) { display:block; flex:1; min-height:32px; padding:6px 4px; text-align:center; }
    .auto-talk-policy-table,.auto-talk-fields,.auto-talk-source-row,.auto-talk-guardrail-grid,.auto-talk-safety-layout { grid-template-columns:minmax(0,1fr); }
    .auto-talk-guardrail-card,.auto-talk-nearby-card { grid-column:auto; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .auto-talk-state-card { grid-column:auto; }
    .auto-talk-state-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .auto-talk-policy-row { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
    .auto-talk-content { padding:10px; }
    .auto-talk-answer { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
    .auto-talk-answer > :is(button, a[data-replica-control]) { grid-column:2; }
  }
}
